@decocms/mesh 1.0.0 → 1.0.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-Cu9USDUK.js → AlertCircle-CctpU08Y.js} +1 -1
- package/dist/client/assets/{ArrowLeft-nKBVB_NL.js → ArrowLeft-DMs-Q5a_.js} +1 -1
- package/dist/client/assets/{CheckCircle-BogvGi-0.js → CheckCircle-gjG4WSw6.js} +1 -1
- package/dist/client/assets/{ChevronDown-B5vWNgW1.js → ChevronDown-o688tr0R.js} +1 -1
- package/dist/client/assets/{Clock-Ck2lYkyl.js → Clock-9q1_LHWv.js} +1 -1
- package/dist/client/assets/{Copy01-BeUF9LPk.js → Copy01-Bos_ARNX.js} +1 -1
- package/dist/client/assets/{CpuChip02-8BkRby_U.js → CpuChip02-DMtVpA_p.js} +1 -1
- package/dist/client/assets/{DotsVertical-CmKPHj4W.js → DotsVertical-DjWbU1pT.js} +1 -1
- package/dist/client/assets/{File06-Cn7JLPIx.js → File06-Bt03vXoe.js} +1 -1
- package/dist/client/assets/{Grid01-4uSGUJjV.js → Grid01-DKsOPPqt.js} +1 -1
- package/dist/client/assets/{Inbox01-C8nofD1D.js → Inbox01-7EuLNj_o.js} +1 -1
- package/dist/client/assets/{InfoCircle-C21KXVBJ.js → InfoCircle-D52jwcjZ.js} +1 -1
- package/dist/client/assets/{Key01-CzDrcb2u.js → Key01-DIAppwaZ.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DhNFEAza.js → LinkExternal01-OAVXSkWT.js} +1 -1
- package/dist/client/assets/{Loading01-BUZAT-Ht.js → Loading01-DhMR9Rl3.js} +1 -1
- package/dist/client/assets/{Plus-DTWKiMkv.js → Plus-BoTbvZ3o.js} +1 -1
- package/dist/client/assets/{SearchMd-BXC4Yoz_.js → SearchMd-Cle1NAvW.js} +1 -1
- package/dist/client/assets/{Trash01-KhsmIXrl.js → Trash01-CObqwAuB.js} +1 -1
- package/dist/client/assets/{Upload01-Dm3ykMHj.js → Upload01-BIarHoYq.js} +1 -1
- package/dist/client/assets/{X-BFstV52u.js → X-BS6wMyAf.js} +1 -1
- package/dist/client/assets/{XClose-OisY7Sog.js → XClose-CanbUWiZ.js} +1 -1
- package/dist/client/assets/{alert-dialog-Ck-TQRXx.js → alert-dialog-BZCR78KJ.js} +1 -1
- package/dist/client/assets/{auth-catchall-DDvXFYk4.js → auth-catchall-B7-v9vo-.js} +1 -1
- package/dist/client/assets/{auth-DB_JGgAS.js → auth-l7FoQBwy.js} +1 -1
- package/dist/client/assets/{avatar-CqnXtnOZ.js → avatar-tMh-ed4_.js} +1 -1
- package/dist/client/assets/{badge-RGvdF-cd.js → badge-ZGSDRM2V.js} +1 -1
- package/dist/client/assets/{button-Chm7HSn5.js → button-DRbSSzMo.js} +1 -1
- package/dist/client/assets/{card-BVamKRXq.js → card-yDshgaNk.js} +1 -1
- package/dist/client/assets/{checkbox-BMbqVqRo.js → checkbox-CVaEe_Kv.js} +1 -1
- package/dist/client/assets/collection-detail-DipzpGBX.js +1 -0
- package/dist/client/assets/{collection-display-button-DDw_0fW6.js → collection-display-button-CxHAeMlJ.js} +1 -1
- package/dist/client/assets/{collection-header-BVYMmoel.js → collection-header-Bbr_EelX.js} +1 -1
- package/dist/client/assets/{collection-page-BoS9hpji.js → collection-page-BB_fkZHl.js} +1 -1
- package/dist/client/assets/{collection-search-CBHWh6W9.js → collection-search-CAT-KwFV.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CGsO_-78.js → collection-table-wrapper-CpATqDDy.js} +1 -1
- package/dist/client/assets/{connection-card-D6fhK6Cn.js → connection-card-BHTh8x40.js} +1 -1
- package/dist/client/assets/{connection-detail-ClFH3Tdf.js → connection-detail-D__R0L9n.js} +1 -1
- package/dist/client/assets/{connections-BtC-4KRY.js → connections-BbW7JMdD.js} +1 -1
- package/dist/client/assets/{core-BiybLldu.js → core-LRyg4NIV.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-D3ZZuPXS.js → create-organization-dialog-Tqv9FyFB.js} +1 -1
- package/dist/client/assets/{deco-chat-skeleton-DHRag8GN.js → deco-chat-skeleton-BWkV1MzQ.js} +9 -9
- package/dist/client/assets/{dialog-kXtxooG_.js → dialog-BBqtAKNq.js} +1 -1
- package/dist/client/assets/{dropdown-menu-MeaPHHuN.js → dropdown-menu-ZynV4CKZ.js} +1 -1
- package/dist/client/assets/{error-boundary-m5kquR9K.js → error-boundary-77v8_xoc.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BSn-ydRW.js → extract-connection-data-Cqx4p3NY.js} +1 -1
- package/dist/client/assets/{form-BBS_Tp5l.js → form-CKfv-8nJ.js} +1 -1
- package/dist/client/assets/{formatDistanceToNow-Dkl3nWpl.js → formatDistanceToNow-D6EC-Mne.js} +1 -1
- package/dist/client/assets/{gateway-detail-B6IgcRfH.js → gateway-detail-C3YoTd2-.js} +1 -1
- package/dist/client/assets/{gateways-Bu8MP7ql.js → gateways-DD9oFefb.js} +1 -1
- package/dist/client/assets/{home-BYCoW2D_.js → home-RnslI0RJ.js} +1 -1
- package/dist/client/assets/{index-BZz7aGs7.js → index-BpYm0xnO.js} +1 -1
- package/dist/client/assets/{index-hySmljwG.js → index-BwdoZ6Iz.js} +1 -1
- package/dist/client/assets/index-CL5fDzg4.css +1 -0
- package/dist/client/assets/{index-C4a1DvcM.js → index-DPFREQMN.js} +2 -2
- package/dist/client/assets/{index-RS2MPOun.js → index-aOeElpLt.js} +1 -1
- package/dist/client/assets/{input-DCV4VviT.js → input-jqtlIgj3.js} +1 -1
- package/dist/client/assets/json-CAM1x_8F.js +1 -0
- package/dist/client/assets/{json-syntax-highlighter-VMspUwuH.js → json-syntax-highlighter-BDiX9ikS.js} +2 -2
- package/dist/client/assets/{layout-BkDVhV_I.js → layout-CkdsMZBx.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-Bx9tA9px.js → lazy-highlighter-CqCOmbZ8.js} +1 -1
- package/dist/client/assets/{localstorage-keys-G21128-2.js → localstorage-keys-Ffqwn37f.js} +1 -1
- package/dist/client/assets/{login-DEwqVT25.js → login-B57O8j1V.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Cm2UNUay.js → mcp-oauth-DxMvAHRa.js} +1 -1
- package/dist/client/assets/{members-BpGlve-L.js → members-BWnzV6ih.js} +1 -1
- package/dist/client/assets/{monitoring-DHEto-A6.js → monitoring-DIiGLrrO.js} +1 -1
- package/dist/client/assets/{oauth-callback-DchNKQy2.js → oauth-callback-CwLtKUf9.js} +1 -1
- package/dist/client/assets/{page-DGoTXd70.js → page-TnUbYFnb.js} +1 -1
- package/dist/client/assets/{popover-Cx3pFfUQ.js → popover-aib-y-v5.js} +1 -1
- package/dist/client/assets/prism-light-6y0IYHxK.js +1 -0
- package/dist/client/assets/{resource-tabs-n23Yoxcd.js → resource-tabs-BA7yau3f.js} +1 -1
- package/dist/client/assets/{schema-DIY49r7a.js → schema-BnBjhQOg.js} +1 -1
- package/dist/client/assets/{select-BXHiOY7b.js → select-CQ6166et.js} +1 -1
- package/dist/client/assets/{settings-BwVTvZ32.js → settings-B4dEHs8J.js} +1 -1
- package/dist/client/assets/shell-layout-B00KNNmL.js +17 -0
- package/dist/client/assets/{spinner-zi1IadXF.js → spinner-CfV2XsUQ.js} +1 -1
- package/dist/client/assets/{store-app-detail-BswrVEFL.js → store-app-detail-ClCjW4tC.js} +1 -1
- package/dist/client/assets/{store-Bu-y0GHn.js → store-j9hTSK4h.js} +1 -1
- package/dist/client/assets/{switch-C8nDXRDi.js → switch-DfV4Hg4D.js} +1 -1
- package/dist/client/assets/{textarea-BA6caASm.js → textarea-rD1H1oiO.js} +1 -1
- package/dist/client/assets/{tools-list-Cw4QW2l7.js → tools-list-BtqQwWMd.js} +1 -1
- package/dist/client/assets/{tooltip-DZ8PMo3S.js → tooltip-T6rRsM2k.js} +1 -1
- package/dist/client/assets/{types-DsEr-_hk.js → types-D-N921FV.js} +1 -1
- package/dist/client/assets/{use-binding-C1zXgwae.js → use-binding-CWUVDcMm.js} +1 -1
- package/dist/client/assets/{use-connection-8aFd9ZgQ.js → use-connection-BObBSW3a.js} +1 -1
- package/dist/client/assets/{use-connection-resources-BaWWtVSI.js → use-connection-resources-BN_6g4of.js} +1 -1
- package/dist/client/assets/{use-gateway-BGsZlt6a.js → use-gateway-BnSOdKih.js} +1 -1
- package/dist/client/assets/{use-list-state-DhJWwg48.js → use-list-state-BXrmE2tY.js} +1 -1
- package/dist/client/assets/{use-mcp-BJzX7M7c.js → use-mcp-feMLqae5.js} +1 -1
- package/dist/client/assets/{use-members-BNSWYzmJ.js → use-members-pxuBBuU5.js} +1 -1
- package/dist/client/assets/{use-mobile-BQAr1bEF.js → use-mobile-BWmDV7SV.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CAOHB7nk.js → use-organization-settings-B_v59XiE.js} +1 -1
- package/dist/client/assets/{use-tool-call-Dxebi6Uq.js → use-tool-call-DJqpt8-4.js} +1 -1
- package/dist/client/assets/useQuery-BDJatAa4.js +1 -0
- package/dist/client/assets/utils-BDWLM78M.js +1 -0
- package/dist/client/assets/{well-known-mcp-DizRQm94.js → well-known-mcp-r4sGkJCM.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/collection-detail-UyMhNT0c.js +0 -1
- package/dist/client/assets/index-MyldRbGR.css +0 -1
- package/dist/client/assets/json-CtxcuNHM.js +0 -1
- package/dist/client/assets/prism-light-DhG4KyCm.js +0 -1
- package/dist/client/assets/shell-layout-BqZsnuW0.js +0 -17
- package/dist/client/assets/useQuery-39cprZL6.js +0 -1
- package/dist/client/assets/utils-BXNVuJET.js +0 -1
package/dist/client/assets/{deco-chat-skeleton-DHRag8GN.js → deco-chat-skeleton-BWkV1MzQ.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-
|
|
2
|
-
import{aw as D,ax as $d,ay as pa,az as ma,aA as rr,aB as Zd,aC as de,aD as Bi,aE as jt,aF as Rr,aG as Or,aH as Yd,aI as qd,aJ as lo,aK as co,aL as An,aM as Fi,aN as Vd,aO as Wd,aP as Fn,aQ as Gn,aR as Gd,aS as ga,aT as fo,aU as Qd,aV as G,r as V,c as W,j as g,aW as pn,a4 as ho,ak as ba,aX as Kd,f as Xd,t as kr,Z as po,K as We,q as Ea,aY as Jd,aZ as ef,a_ as tf,a$ as nf,b0 as rf,b1 as af,b2 as sf,b3 as uf,b4 as of,b5 as lf,b6 as cf,b7 as df,b8 as ff,b9 as mo,ba as hf,bb as re}from"./index-C4a1DvcM.js";import{c as te}from"./utils-BXNVuJET.js";import{B as Mt,u as $t}from"./button-Chm7HSn5.js";import{a as pf,c as mf}from"./Grid01-4uSGUJjV.js";import{T as gf}from"./textarea-BA6caASm.js";import{i as qt,u as mn,c as go,b as bo,T as Eo}from"./tooltip-DZ8PMo3S.js";import{i as Ta}from"./CpuChip02-8BkRby_U.js";import{i as To}from"./SearchMd-BXC4Yoz_.js";import{I as _o,b as bf,U as Ef,e as Tf,c as _f,u as xf}from"./use-connection-8aFd9ZgQ.js";import{b as yf,a as kf,c as Af,S as Cf,n as If}from"./select-BXHiOY7b.js";import{u as Sf}from"./use-mobile-BQAr1bEF.js";import{u as Nf}from"./use-gateway-BGsZlt6a.js";import{t as xo}from"./ChevronDown-B5vWNgW1.js";import{a as Yr}from"./Copy01-BeUF9LPk.js";import{i as wf}from"./AlertCircle-Cu9USDUK.js";import{C as vf}from"./connection-card-D6fhK6Cn.js";import{n as Rf}from"./LinkExternal01-DhNFEAza.js";import{S as Of}from"./spinner-zi1IadXF.js";import{i as Lf}from"./File06-Cn7JLPIx.js";import{i as Df}from"./InfoCircle-C21KXVBJ.js";import{u as Pf,E as Mf}from"./use-binding-C1zXgwae.js";const Bf=/^[cC][^\s-]{8,}$/,Ff=/^[0-9a-z]+$/,Uf=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hf=/^[0-9a-vA-V]{20}$/,zf=/^[A-Za-z0-9]{27}$/,jf=/^[a-zA-Z0-9_-]{21}$/,$f=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zf=/^([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})$/,us=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,Yf=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Vf(){return new RegExp(qf,"u")}const Wf=/^(?:(?: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])$/,Gf=/^(([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})$/,Qf=/^((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])$/,Kf=/^(([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])$/,Xf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yo=/^[A-Za-z0-9_-]*$/,Jf=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,eh=/^\+(?:[0-9]){6,14}[0-9]$/,ko="(?:(?:\\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])))",th=new RegExp(`^${ko}$`);function Ao(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nh(t){return new RegExp(`^${Ao(t)}$`)}function rh(t){const e=Ao({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${ko}T(?:${r})$`)}const ih=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},ah=/^\d+$/,sh=/^-?\d+(?:\.\d+)?/i,uh=/true|false/i,oh=/null/i,lh=/^[^A-Z]*$/,ch=/^[^a-z]*$/,Ge=D("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Co={number:"number",bigint:"bigint",object:"date"},Io=D("$ZodCheckLessThan",(t,e)=>{Ge.init(t,e);const n=Co[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,a=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),So=D("$ZodCheckGreaterThan",(t,e)=>{Ge.init(t,e);const n=Co[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,a=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),dh=D("$ZodCheckMultipleOf",(t,e)=>{Ge.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):$d(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),fh=D("$ZodCheckNumberFormat",(t,e)=>{Ge.init(t,e),e.format=e.format||"float64";const n=e.format?.includes("int"),r=n?"int":"number",[i,a]=Zd[e.format];t._zod.onattach.push(s=>{const u=s._zod.bag;u.format=e.format,u.minimum=i,u.maximum=a,n&&(u.pattern=ah)}),t._zod.check=s=>{const u=s.value;if(n){if(!Number.isInteger(u)){s.issues.push({expected:r,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?s.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort}):s.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});return}}u<i&&s.issues.push({origin:"number",input:u,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),u>a&&s.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inst:t})}}),hh=D("$ZodCheckMaxLength",(t,e)=>{var n;Ge.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!pa(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const s=ma(i);r.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),ph=D("$ZodCheckMinLength",(t,e)=>{var n;Ge.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!pa(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const s=ma(i);r.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),mh=D("$ZodCheckLengthEquals",(t,e)=>{var n;Ge.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!pa(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,a=i.length;if(a===e.length)return;const s=ma(i),u=a>e.length;r.issues.push({origin:s,...u?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),qr=D("$ZodCheckStringFormat",(t,e)=>{var n,r;Ge.init(t,e),t._zod.onattach.push(i=>{const a=i._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),gh=D("$ZodCheckRegex",(t,e)=>{qr.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),bh=D("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=lh),qr.init(t,e)}),Eh=D("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=ch),qr.init(t,e)}),Th=D("$ZodCheckIncludes",(t,e)=>{Ge.init(t,e);const n=rr(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(i=>{const a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),_h=D("$ZodCheckStartsWith",(t,e)=>{Ge.init(t,e);const n=new RegExp(`^${rr(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),xh=D("$ZodCheckEndsWith",(t,e)=>{Ge.init(t,e);const n=new RegExp(`.*${rr(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),yh=D("$ZodCheckOverwrite",(t,e)=>{Ge.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class kh{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-CqCOmbZ8.js","assets/index-DPFREQMN.js","assets/index-CL5fDzg4.css","assets/core-LRyg4NIV.js","assets/json-BESjz4hO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aw as D,ax as $d,ay as pa,az as ma,aA as rr,aB as Zd,aC as de,aD as Bi,aE as jt,aF as Rr,aG as Or,aH as Yd,aI as qd,aJ as lo,aK as co,aL as An,aM as Fi,aN as Vd,aO as Wd,aP as Fn,aQ as Gn,aR as Gd,aS as ga,aT as fo,aU as Qd,aV as G,r as V,c as W,j as g,aW as pn,a4 as ho,ak as ba,aX as Kd,f as Xd,t as kr,Z as po,K as We,q as Ea,aY as Jd,aZ as ef,a_ as tf,a$ as nf,b0 as rf,b1 as af,b2 as sf,b3 as uf,b4 as of,b5 as lf,b6 as cf,b7 as df,b8 as ff,b9 as mo,ba as hf,bb as ne}from"./index-DPFREQMN.js";import{c as re}from"./utils-BDWLM78M.js";import{B as Mt,u as $t}from"./button-DRbSSzMo.js";import{a as pf,c as mf}from"./Grid01-DKsOPPqt.js";import{T as gf}from"./textarea-rD1H1oiO.js";import{i as qt,u as mn,c as go,b as bo,T as Eo}from"./tooltip-T6rRsM2k.js";import{i as Ta}from"./CpuChip02-DMtVpA_p.js";import{i as To}from"./SearchMd-Cle1NAvW.js";import{I as _o,b as bf,U as Ef,e as Tf,c as _f,u as xf}from"./use-connection-BObBSW3a.js";import{b as yf,a as kf,c as Af,S as Cf,n as If}from"./select-CQ6166et.js";import{u as Sf}from"./use-mobile-BWmDV7SV.js";import{u as Nf}from"./use-gateway-BnSOdKih.js";import{t as xo}from"./ChevronDown-o688tr0R.js";import{a as Yr}from"./Copy01-Bos_ARNX.js";import{i as wf}from"./AlertCircle-CctpU08Y.js";import{C as vf}from"./connection-card-BHTh8x40.js";import{n as Rf}from"./LinkExternal01-OAVXSkWT.js";import{S as Of}from"./spinner-CfV2XsUQ.js";import{i as Lf}from"./File06-Bt03vXoe.js";import{i as Df}from"./InfoCircle-D52jwcjZ.js";import{u as Pf,E as Mf}from"./use-binding-CWUVDcMm.js";const Bf=/^[cC][^\s-]{8,}$/,Ff=/^[0-9a-z]+$/,Uf=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hf=/^[0-9a-vA-V]{20}$/,zf=/^[A-Za-z0-9]{27}$/,jf=/^[a-zA-Z0-9_-]{21}$/,$f=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zf=/^([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})$/,us=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,Yf=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Vf(){return new RegExp(qf,"u")}const Wf=/^(?:(?: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])$/,Gf=/^(([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})$/,Qf=/^((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])$/,Kf=/^(([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])$/,Xf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yo=/^[A-Za-z0-9_-]*$/,Jf=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,eh=/^\+(?:[0-9]){6,14}[0-9]$/,ko="(?:(?:\\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])))",th=new RegExp(`^${ko}$`);function Ao(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nh(t){return new RegExp(`^${Ao(t)}$`)}function rh(t){const e=Ao({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${ko}T(?:${r})$`)}const ih=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},ah=/^\d+$/,sh=/^-?\d+(?:\.\d+)?/i,uh=/true|false/i,oh=/null/i,lh=/^[^A-Z]*$/,ch=/^[^a-z]*$/,Ge=D("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Co={number:"number",bigint:"bigint",object:"date"},Io=D("$ZodCheckLessThan",(t,e)=>{Ge.init(t,e);const n=Co[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,a=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),So=D("$ZodCheckGreaterThan",(t,e)=>{Ge.init(t,e);const n=Co[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,a=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),dh=D("$ZodCheckMultipleOf",(t,e)=>{Ge.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):$d(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),fh=D("$ZodCheckNumberFormat",(t,e)=>{Ge.init(t,e),e.format=e.format||"float64";const n=e.format?.includes("int"),r=n?"int":"number",[i,a]=Zd[e.format];t._zod.onattach.push(s=>{const u=s._zod.bag;u.format=e.format,u.minimum=i,u.maximum=a,n&&(u.pattern=ah)}),t._zod.check=s=>{const u=s.value;if(n){if(!Number.isInteger(u)){s.issues.push({expected:r,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?s.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort}):s.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});return}}u<i&&s.issues.push({origin:"number",input:u,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),u>a&&s.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inst:t})}}),hh=D("$ZodCheckMaxLength",(t,e)=>{var n;Ge.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!pa(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const s=ma(i);r.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),ph=D("$ZodCheckMinLength",(t,e)=>{var n;Ge.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!pa(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const s=ma(i);r.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),mh=D("$ZodCheckLengthEquals",(t,e)=>{var n;Ge.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!pa(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,a=i.length;if(a===e.length)return;const s=ma(i),u=a>e.length;r.issues.push({origin:s,...u?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),qr=D("$ZodCheckStringFormat",(t,e)=>{var n,r;Ge.init(t,e),t._zod.onattach.push(i=>{const a=i._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),gh=D("$ZodCheckRegex",(t,e)=>{qr.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),bh=D("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=lh),qr.init(t,e)}),Eh=D("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=ch),qr.init(t,e)}),Th=D("$ZodCheckIncludes",(t,e)=>{Ge.init(t,e);const n=rr(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(i=>{const a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),_h=D("$ZodCheckStartsWith",(t,e)=>{Ge.init(t,e);const n=new RegExp(`^${rr(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),xh=D("$ZodCheckEndsWith",(t,e)=>{Ge.init(t,e);const n=new RegExp(`.*${rr(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),yh=D("$ZodCheckOverwrite",(t,e)=>{Ge.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class kh{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
3
3
|
`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),a=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of a)this.content.push(s)}compile(){const e=Function,n=this?.args,i=[...(this?.content??[""]).map(a=>` ${a}`)];return new e(...n,i.join(`
|
|
4
4
|
`))}}const Ah={major:4,minor:0,patch:0},ke=D("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Ah;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const i of r)for(const a of i._zod.onattach)a(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const i=(a,s,u)=>{let o=Fn(a),l;for(const f of s){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(o)continue;const d=a.issues.length,p=f._zod.check(a);if(p instanceof Promise&&u?.async===!1)throw new Fi;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==d&&(o||(o=Fn(a,d)))});else{if(a.issues.length===d)continue;o||(o=Fn(a,d))}}return l?l.then(()=>a):a};t._zod.run=(a,s)=>{const u=t._zod.parse(a,s);if(u instanceof Promise){if(s.async===!1)throw new Fi;return u.then(o=>i(o,r,s))}return i(u,r,s)}}t["~standard"]={validate:i=>{try{const a=Vd(t,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Wd(t,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),_a=D("$ZodString",(t,e)=>{ke.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??ih(t._zod.bag),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),Ne=D("$ZodStringFormat",(t,e)=>{qr.init(t,e),_a.init(t,e)}),Ch=D("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Zf),Ne.init(t,e)}),Ih=D("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=us(r))}else e.pattern??(e.pattern=us());Ne.init(t,e)}),Sh=D("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Yf),Ne.init(t,e)}),Nh=D("$ZodURL",(t,e)=>{Ne.init(t,e),t._zod.check=n=>{try{const r=n.value,i=new URL(r),a=i.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Jf.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),!r.endsWith("/")&&a.endsWith("/")?n.value=a.slice(0,-1):n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),wh=D("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Vf()),Ne.init(t,e)}),vh=D("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=jf),Ne.init(t,e)}),Rh=D("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Bf),Ne.init(t,e)}),Oh=D("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Ff),Ne.init(t,e)}),Lh=D("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Uf),Ne.init(t,e)}),Dh=D("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Hf),Ne.init(t,e)}),Ph=D("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=zf),Ne.init(t,e)}),Mh=D("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=rh(e)),Ne.init(t,e)}),Bh=D("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=th),Ne.init(t,e)}),Fh=D("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=nh(e)),Ne.init(t,e)}),Uh=D("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=$f),Ne.init(t,e)}),Hh=D("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Wf),Ne.init(t,e),t._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),zh=D("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Gf),Ne.init(t,e),t._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),jh=D("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Qf),Ne.init(t,e)}),$h=D("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Kf),Ne.init(t,e),t._zod.check=n=>{const[r,i]=n.value.split("/");try{if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function No(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Zh=D("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Xf),Ne.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),t._zod.check=n=>{No(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Yh(t){if(!yo.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return No(n)}const qh=D("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=yo),Ne.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),t._zod.check=n=>{Yh(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Vh=D("$ZodE164",(t,e)=>{e.pattern??(e.pattern=eh),Ne.init(t,e)});function Wh(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const Gh=D("$ZodJWT",(t,e)=>{Ne.init(t,e),t._zod.check=n=>{Wh(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),wo=D("$ZodNumber",(t,e)=>{ke.init(t,e),t._zod.pattern=t._zod.bag.pattern??sh,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...a?{received:a}:{}}),n}}),Qh=D("$ZodNumber",(t,e)=>{fh.init(t,e),wo.init(t,e)}),Kh=D("$ZodBoolean",(t,e)=>{ke.init(t,e),t._zod.pattern=uh,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),n}}),Xh=D("$ZodNull",(t,e)=>{ke.init(t,e),t._zod.pattern=oh,t._zod.values=new Set([null]),t._zod.parse=(n,r)=>{const i=n.value;return i===null||n.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),n}}),Jh=D("$ZodUnknown",(t,e)=>{ke.init(t,e),t._zod.parse=n=>n}),e0=D("$ZodNever",(t,e)=>{ke.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function os(t,e,n){t.issues.length&&e.issues.push(...jt(n,t.issues)),e.value[n]=t.value}const t0=D("$ZodArray",(t,e)=>{ke.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),n;n.value=Array(i.length);const a=[];for(let s=0;s<i.length;s++){const u=i[s],o=e.element._zod.run({value:u,issues:[]},r);o instanceof Promise?a.push(o.then(l=>os(l,n,s))):os(o,n,s)}return a.length?Promise.all(a).then(()=>n):n}});function pr(t,e,n){t.issues.length&&e.issues.push(...jt(n,t.issues)),e.value[n]=t.value}function ls(t,e,n,r){t.issues.length?r[n]===void 0?n in r?e.value[n]=void 0:e.value[n]=t.value:e.issues.push(...jt(n,t.issues)):t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}const n0=D("$ZodObject",(t,e)=>{ke.init(t,e);const n=lo(()=>{const d=Object.keys(e.shape);for(const h of d)if(!(e.shape[h]instanceof ke))throw new Error(`Invalid element at key "${h}": expected a Zod schema`);const p=Gd(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(p)}});de(t._zod,"propValues",()=>{const d=e.shape,p={};for(const h in d){const m=d[h]._zod;if(m.values){p[h]??(p[h]=new Set);for(const E of m.values)p[h].add(E)}}return p});const r=d=>{const p=new kh(["shape","payload","ctx"]),h=n.value,m=k=>{const b=An(k);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};p.write("const input = payload.value;");const E=Object.create(null);let x=0;for(const k of h.keys)E[k]=`key_${x++}`;p.write("const newResult = {}");for(const k of h.keys)if(h.optionalKeys.has(k)){const b=E[k];p.write(`const ${b} = ${m(k)};`);const N=An(k);p.write(`
|
|
5
5
|
if (${b}.issues.length) {
|
|
@@ -26,7 +26,7 @@ import{aw as D,ax as $d,ay as pa,az as ma,aA as rr,aB as Zd,aC as de,aD as Bi,aE
|
|
|
26
26
|
path: iss.path ? [${An(k)}, ...iss.path] : [${An(k)}]
|
|
27
27
|
})));`),p.write(`newResult[${An(k)}] = ${b}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");const T=p.compile();return(k,b)=>T(d,k,b)};let i;const a=co,s=!Yd.jitless,o=s&&qd.value,l=e.catchall;let f;t._zod.parse=(d,p)=>{f??(f=n.value);const h=d.value;if(!a(h))return d.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),d;const m=[];if(s&&o&&p?.async===!1&&p.jitless!==!0)i||(i=r(e.shape)),d=i(d,p);else{d.value={};const b=f.shape;for(const N of f.keys){const v=b[N],C=v._zod.run({value:h[N],issues:[]},p),L=v._zod.optin==="optional"&&v._zod.optout==="optional";C instanceof Promise?m.push(C.then(M=>L?ls(M,d,N,h):pr(M,d,N))):L?ls(C,d,N,h):pr(C,d,N)}}if(!l)return m.length?Promise.all(m).then(()=>d):d;const E=[],x=f.keySet,T=l._zod,k=T.def.type;for(const b of Object.keys(h)){if(x.has(b))continue;if(k==="never"){E.push(b);continue}const N=T.run({value:h[b],issues:[]},p);N instanceof Promise?m.push(N.then(v=>pr(v,d,b))):pr(N,d,b)}return E.length&&d.issues.push({code:"unrecognized_keys",keys:E,input:h,inst:t}),m.length?Promise.all(m).then(()=>d):d}});function cs(t,e,n,r){for(const i of t)if(i.issues.length===0)return e.value=i.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(a=>Rr(a,r,Or())))}),e}const vo=D("$ZodUnion",(t,e)=>{ke.init(t,e),de(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),de(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),de(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),de(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){const n=e.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>ga(r.source)).join("|")})$`)}}),t._zod.parse=(n,r)=>{let i=!1;const a=[];for(const s of e.options){const u=s._zod.run({value:n.value,issues:[]},r);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(s=>cs(s,n,t,r)):cs(a,n,t,r)}}),r0=D("$ZodDiscriminatedUnion",(t,e)=>{vo.init(t,e);const n=t._zod.parse;de(t._zod,"propValues",()=>{const i={};for(const a of e.options){const s=a._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const[u,o]of Object.entries(s)){i[u]||(i[u]=new Set);for(const l of o)i[u].add(l)}}return i});const r=lo(()=>{const i=e.options,a=new Map;for(const s of i){const u=s._zod.propValues[e.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const o of u){if(a.has(o))throw new Error(`Duplicate discriminator value "${String(o)}"`);a.set(o,s)}}return a});t._zod.parse=(i,a)=>{const s=i.value;if(!co(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;const u=r.value.get(s?.[e.discriminator]);return u?u._zod.run(i,a):e.unionFallback?n(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[e.discriminator],inst:t}),i)}}),i0=D("$ZodIntersection",(t,e)=>{ke.init(t,e),t._zod.parse=(n,r)=>{const i=n.value,a=e.left._zod.run({value:i,issues:[]},r),s=e.right._zod.run({value:i,issues:[]},r);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([o,l])=>ds(n,o,l)):ds(n,a,s)}});function Ui(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Bi(t)&&Bi(e)){const n=Object.keys(e),r=Object.keys(t).filter(a=>n.indexOf(a)!==-1),i={...t,...e};for(const a of r){const s=Ui(t[a],e[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};i[a]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],a=e[r],s=Ui(i,a);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ds(t,e,n){if(e.issues.length&&t.issues.push(...e.issues),n.issues.length&&t.issues.push(...n.issues),Fn(t))return t;const r=Ui(e.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return t.value=r.data,t}const a0=D("$ZodRecord",(t,e)=>{ke.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Bi(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const a=[];if(e.keyType._zod.values){const s=e.keyType._zod.values;n.value={};for(const o of s)if(typeof o=="string"||typeof o=="number"||typeof o=="symbol"){const l=e.valueType._zod.run({value:i[o],issues:[]},r);l instanceof Promise?a.push(l.then(f=>{f.issues.length&&n.issues.push(...jt(o,f.issues)),n.value[o]=f.value})):(l.issues.length&&n.issues.push(...jt(o,l.issues)),n.value[o]=l.value)}let u;for(const o in i)s.has(o)||(u=u??[],u.push(o));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:u})}else{n.value={};for(const s of Reflect.ownKeys(i)){if(s==="__proto__")continue;const u=e.keyType._zod.run({value:s,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map(l=>Rr(l,r,Or())),input:s,path:[s],inst:t}),n.value[u.value]=u.value;continue}const o=e.valueType._zod.run({value:i[s],issues:[]},r);o instanceof Promise?a.push(o.then(l=>{l.issues.length&&n.issues.push(...jt(s,l.issues)),n.value[u.value]=l.value})):(o.issues.length&&n.issues.push(...jt(s,o.issues)),n.value[u.value]=o.value)}}return a.length?Promise.all(a).then(()=>n):n}}),s0=D("$ZodEnum",(t,e)=>{ke.init(t,e);const n=fo(e.entries);t._zod.values=new Set(n),t._zod.pattern=new RegExp(`^(${n.filter(r=>Qd.has(typeof r)).map(r=>typeof r=="string"?rr(r):r.toString()).join("|")})$`),t._zod.parse=(r,i)=>{const a=r.value;return t._zod.values.has(a)||r.issues.push({code:"invalid_value",values:n,input:a,inst:t}),r}}),u0=D("$ZodLiteral",(t,e)=>{ke.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?rr(n):n?n.toString():String(n)).join("|")})$`),t._zod.parse=(n,r)=>{const i=n.value;return t._zod.values.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),o0=D("$ZodTransform",(t,e)=>{ke.init(t,e),t._zod.parse=(n,r)=>{const i=e.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(n.value=s,n));if(i instanceof Promise)throw new Fi;return n.value=i,n}}),l0=D("$ZodOptional",(t,e)=>{ke.init(t,e),t._zod.optin="optional",t._zod.optout="optional",de(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),de(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${ga(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(n,r):n.value===void 0?n:e.innerType._zod.run(n,r)}),c0=D("$ZodNullable",(t,e)=>{ke.init(t,e),de(t._zod,"optin",()=>e.innerType._zod.optin),de(t._zod,"optout",()=>e.innerType._zod.optout),de(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${ga(n.source)}|null)$`):void 0}),de(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),d0=D("$ZodDefault",(t,e)=>{ke.init(t,e),t._zod.optin="optional",de(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=e.defaultValue,n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>fs(a,e)):fs(i,e)}});function fs(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const f0=D("$ZodPrefault",(t,e)=>{ke.init(t,e),t._zod.optin="optional",de(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),h0=D("$ZodNonOptional",(t,e)=>{ke.init(t,e),de(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>hs(a,t)):hs(i,t)}});function hs(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const p0=D("$ZodCatch",(t,e)=>{ke.init(t,e),t._zod.optin="optional",de(t._zod,"optout",()=>e.innerType._zod.optout),de(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>(n.value=a.value,a.issues.length&&(n.value=e.catchValue({...n,error:{issues:a.issues.map(s=>Rr(s,r,Or()))},input:n.value}),n.issues=[]),n)):(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(a=>Rr(a,r,Or()))},input:n.value}),n.issues=[]),n)}}),m0=D("$ZodPipe",(t,e)=>{ke.init(t,e),de(t._zod,"values",()=>e.in._zod.values),de(t._zod,"optin",()=>e.in._zod.optin),de(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(n,r)=>{const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(a=>ps(a,e,r)):ps(i,e,r)}});function ps(t,e,n){return Fn(t)?t:e.out._zod.run({value:t.value,issues:t.issues},n)}const g0=D("$ZodReadonly",(t,e)=>{ke.init(t,e),de(t._zod,"propValues",()=>e.innerType._zod.propValues),de(t._zod,"values",()=>e.innerType._zod.values),de(t._zod,"optin",()=>e.innerType._zod.optin),de(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(ms):ms(i)}});function ms(t){return t.value=Object.freeze(t.value),t}const b0=D("$ZodLazy",(t,e)=>{ke.init(t,e),de(t._zod,"innerType",()=>e.getter()),de(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),de(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),de(t._zod,"optin",()=>t._zod.innerType._zod.optin),de(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(n,r)=>t._zod.innerType._zod.run(n,r)}),E0=D("$ZodCustom",(t,e)=>{Ge.init(t,e),ke.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(a=>gs(a,n,r,t));gs(i,n,r,t)}});function gs(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(Gn(i))}}class Ro{constructor(){this._map=new Map,this._idmap=new Map}add(e,...n){const r=n[0];if(this._map.set(e,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function T0(){return new Ro}const Ln=T0();function _0(t,e){return new t({type:"string",...G(e)})}function x0(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...G(e)})}function bs(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...G(e)})}function y0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...G(e)})}function k0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...G(e)})}function A0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...G(e)})}function C0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...G(e)})}function I0(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...G(e)})}function S0(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...G(e)})}function N0(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...G(e)})}function w0(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...G(e)})}function v0(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...G(e)})}function R0(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...G(e)})}function O0(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...G(e)})}function L0(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...G(e)})}function D0(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...G(e)})}function P0(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...G(e)})}function M0(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...G(e)})}function B0(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...G(e)})}function F0(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...G(e)})}function U0(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...G(e)})}function H0(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...G(e)})}function z0(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...G(e)})}function j0(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...G(e)})}function $0(t,e){return new t({type:"string",format:"date",check:"string_format",...G(e)})}function Z0(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...G(e)})}function Y0(t,e){return new t({type:"string",format:"duration",check:"string_format",...G(e)})}function q0(t,e){return new t({type:"number",checks:[],...G(e)})}function V0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...G(e)})}function W0(t,e){return new t({type:"boolean",...G(e)})}function G0(t,e){return new t({type:"null",...G(e)})}function Q0(t){return new t({type:"unknown"})}function K0(t,e){return new t({type:"never",...G(e)})}function Es(t,e){return new Io({check:"less_than",...G(e),value:t,inclusive:!1})}function fi(t,e){return new Io({check:"less_than",...G(e),value:t,inclusive:!0})}function Ts(t,e){return new So({check:"greater_than",...G(e),value:t,inclusive:!1})}function hi(t,e){return new So({check:"greater_than",...G(e),value:t,inclusive:!0})}function _s(t,e){return new dh({check:"multiple_of",...G(e),value:t})}function Oo(t,e){return new hh({check:"max_length",...G(e),maximum:t})}function Lr(t,e){return new ph({check:"min_length",...G(e),minimum:t})}function Lo(t,e){return new mh({check:"length_equals",...G(e),length:t})}function X0(t,e){return new gh({check:"string_format",format:"regex",...G(e),pattern:t})}function J0(t){return new bh({check:"string_format",format:"lowercase",...G(t)})}function ep(t){return new Eh({check:"string_format",format:"uppercase",...G(t)})}function tp(t,e){return new Th({check:"string_format",format:"includes",...G(e),includes:t})}function np(t,e){return new _h({check:"string_format",format:"starts_with",...G(e),prefix:t})}function rp(t,e){return new xh({check:"string_format",format:"ends_with",...G(e),suffix:t})}function ir(t){return new yh({check:"overwrite",tx:t})}function ip(t){return ir(e=>e.normalize(t))}function ap(){return ir(t=>t.trim())}function sp(){return ir(t=>t.toLowerCase())}function up(){return ir(t=>t.toUpperCase())}function op(t,e,n){return new t({type:"array",element:e,...G(n)})}function lp(t,e,n){const r=G(n);return r.abort??(r.abort=!0),new t({type:"custom",check:"custom",fn:e,...r})}function cp(t,e,n){return new t({type:"custom",check:"custom",fn:e,...G(n)})}class xs{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ln,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const u={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(e,u);const o=e._zod.toJSONSchema?.();if(o)u.schema=o;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path},p=e._zod.parent;if(p)u.ref=p,this.process(p,d),this.seen.get(p).isParent=!0;else{const h=u.schema;switch(i.type){case"string":{const m=h;m.type="string";const{minimum:E,maximum:x,format:T,patterns:k,contentEncoding:b}=e._zod.bag;if(typeof E=="number"&&(m.minLength=E),typeof x=="number"&&(m.maxLength=x),T&&(m.format=a[T]??T,m.format===""&&delete m.format),b&&(m.contentEncoding=b),k&&k.size>0){const N=[...k];N.length===1?m.pattern=N[0].source:N.length>1&&(u.schema.allOf=[...N.map(v=>({...this.target==="draft-7"?{type:"string"}:{},pattern:v.source}))])}break}case"number":{const m=h,{minimum:E,maximum:x,format:T,multipleOf:k,exclusiveMaximum:b,exclusiveMinimum:N}=e._zod.bag;typeof T=="string"&&T.includes("int")?m.type="integer":m.type="number",typeof N=="number"&&(m.exclusiveMinimum=N),typeof E=="number"&&(m.minimum=E,typeof N=="number"&&(N>=E?delete m.minimum:delete m.exclusiveMinimum)),typeof b=="number"&&(m.exclusiveMaximum=b),typeof x=="number"&&(m.maximum=x,typeof b=="number"&&(b<=x?delete m.maximum:delete m.exclusiveMaximum)),typeof k=="number"&&(m.multipleOf=k);break}case"boolean":{const m=h;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{h.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{h.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const m=h,{minimum:E,maximum:x}=e._zod.bag;typeof E=="number"&&(m.minItems=E),typeof x=="number"&&(m.maxItems=x),m.type="array",m.items=this.process(i.element,{...d,path:[...d.path,"items"]});break}case"object":{const m=h;m.type="object",m.properties={};const E=i.shape;for(const k in E)m.properties[k]=this.process(E[k],{...d,path:[...d.path,"properties",k]});const x=new Set(Object.keys(E)),T=new Set([...x].filter(k=>{const b=i.shape[k]._zod;return this.io==="input"?b.optin===void 0:b.optout===void 0}));T.size>0&&(m.required=Array.from(T)),i.catchall?._zod.def.type==="never"?m.additionalProperties=!1:i.catchall?i.catchall&&(m.additionalProperties=this.process(i.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{const m=h;m.anyOf=i.options.map((E,x)=>this.process(E,{...d,path:[...d.path,"anyOf",x]}));break}case"intersection":{const m=h,E=this.process(i.left,{...d,path:[...d.path,"allOf",0]}),x=this.process(i.right,{...d,path:[...d.path,"allOf",1]}),T=b=>"allOf"in b&&Object.keys(b).length===1,k=[...T(E)?E.allOf:[E],...T(x)?x.allOf:[x]];m.allOf=k;break}case"tuple":{const m=h;m.type="array";const E=i.items.map((k,b)=>this.process(k,{...d,path:[...d.path,"prefixItems",b]}));if(this.target==="draft-2020-12"?m.prefixItems=E:m.items=E,i.rest){const k=this.process(i.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?m.items=k:m.additionalItems=k}i.rest&&(m.items=this.process(i.rest,{...d,path:[...d.path,"items"]}));const{minimum:x,maximum:T}=e._zod.bag;typeof x=="number"&&(m.minItems=x),typeof T=="number"&&(m.maxItems=T);break}case"record":{const m=h;m.type="object",m.propertyNames=this.process(i.keyType,{...d,path:[...d.path,"propertyNames"]}),m.additionalProperties=this.process(i.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const m=h,E=fo(i.entries);E.every(x=>typeof x=="number")&&(m.type="number"),E.every(x=>typeof x=="string")&&(m.type="string"),m.enum=E;break}case"literal":{const m=h,E=[];for(const x of i.values)if(x===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof x=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");E.push(Number(x))}else E.push(x);if(E.length!==0)if(E.length===1){const x=E[0];m.type=x===null?"null":typeof x,m.const=x}else E.every(x=>typeof x=="number")&&(m.type="number"),E.every(x=>typeof x=="string")&&(m.type="string"),E.every(x=>typeof x=="boolean")&&(m.type="string"),E.every(x=>x===null)&&(m.type="null"),m.enum=E;break}case"file":{const m=h,E={type:"string",format:"binary",contentEncoding:"binary"},{minimum:x,maximum:T,mime:k}=e._zod.bag;x!==void 0&&(E.minLength=x),T!==void 0&&(E.maxLength=T),k?k.length===1?(E.contentMediaType=k[0],Object.assign(m,E)):m.anyOf=k.map(b=>({...E,contentMediaType:b})):Object.assign(m,E);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const m=this.process(i.innerType,d);h.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(i.innerType,d),u.ref=i.innerType;break}case"success":{const m=h;m.type="boolean";break}case"default":{this.process(i.innerType,d),u.ref=i.innerType,h.default=JSON.parse(JSON.stringify(i.defaultValue));break}case"prefault":{this.process(i.innerType,d),u.ref=i.innerType,this.io==="input"&&(h._prefault=JSON.parse(JSON.stringify(i.defaultValue)));break}case"catch":{this.process(i.innerType,d),u.ref=i.innerType;let m;try{m=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}h.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const m=h,E=e._zod.pattern;if(!E)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=E.source;break}case"pipe":{const m=this.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;this.process(m,d),u.ref=m;break}case"readonly":{this.process(i.innerType,d),u.ref=i.innerType,h.readOnly=!0;break}case"promise":{this.process(i.innerType,d),u.ref=i.innerType;break}case"optional":{this.process(i.innerType,d),u.ref=i.innerType;break}case"lazy":{const m=e._zod.innerType;this.process(m,d),u.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const l=this.metadataRegistry.get(e);return l&&Object.assign(u.schema,l),this.io==="input"&&De(e)&&(delete u.schema.examples,delete u.schema.default),this.io==="input"&&u.schema._prefault&&((r=u.schema).default??(r.default=u.schema._prefault)),delete u.schema._prefault,this.seen.get(e).schema}emit(e,n){const r={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},i=this.seen.get(e);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=f=>{const d=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const E=r.external.registry.get(f[0])?.id,x=r.external.uri??(k=>k);if(E)return{ref:x(E)};const T=f[1].defId??f[1].schema.id??`schema${this.counter++}`;return f[1].defId=T,{defId:T,ref:`${x("__shared")}#/${d}/${T}`}}if(f[1]===i)return{ref:"#"};const h=`#/${d}/`,m=f[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:h+m}},s=f=>{if(f[1].schema.$ref)return;const d=f[1],{ref:p,defId:h}=a(f);d.def={...d.schema},h&&(d.defId=h);const m=d.schema;for(const E in m)delete m[E];m.$ref=p};if(r.cycles==="throw")for(const f of this.seen.entries()){const d=f[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
|
|
28
28
|
|
|
29
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of this.seen.entries()){const d=f[1];if(e===f[0]){s(f);continue}if(r.external){const h=r.external.registry.get(f[0])?.id;if(e!==f[0]&&h){s(f);continue}}if(this.metadataRegistry.get(f[0])?.id){s(f);continue}if(d.cycle){s(f);continue}if(d.count>1&&r.reused==="ref"){s(f);continue}}const u=(f,d)=>{const p=this.seen.get(f),h=p.def??p.schema,m={...h};if(p.ref===null)return;const E=p.ref;if(p.ref=null,E){u(E,d);const x=this.seen.get(E).schema;x.$ref&&d.target==="draft-7"?(h.allOf=h.allOf??[],h.allOf.push(x)):(Object.assign(h,x),Object.assign(h,m))}p.isParent||this.override({zodSchema:f,jsonSchema:h,path:p.path??[]})};for(const f of[...this.seen.entries()].reverse())u(f[0],{target:this.target});const o={};if(this.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?o.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),r.external?.uri){const f=r.external.registry.get(e)?.id;if(!f)throw new Error("Schema is missing an `id` property");o.$id=r.external.uri(f)}Object.assign(o,i.def);const l=r.external?.defs??{};for(const f of this.seen.entries()){const d=f[1];d.def&&d.defId&&(l[d.defId]=d.def)}r.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{return JSON.parse(JSON.stringify(o))}catch{throw new Error("Error converting schema to JSON.")}}}function dp(t,e){if(t instanceof Ro){const r=new xs(e),i={};for(const u of t._idmap.entries()){const[o,l]=u;r.process(l)}const a={},s={registry:t,uri:e?.uri,defs:i};for(const u of t._idmap.entries()){const[o,l]=u;a[o]=r.emit(l,{...e,external:s})}if(Object.keys(i).length>0){const u=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:i}}return{schemas:a}}const n=new xs(e);return n.process(t),n.emit(t,e)}function De(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const i=t._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return De(i.element,n);case"object":{for(const a in i.shape)if(De(i.shape[a],n))return!0;return!1}case"union":{for(const a of i.options)if(De(a,n))return!0;return!1}case"intersection":return De(i.left,n)||De(i.right,n);case"tuple":{for(const a of i.items)if(De(a,n))return!0;return!!(i.rest&&De(i.rest,n))}case"record":return De(i.keyType,n)||De(i.valueType,n);case"map":return De(i.keyType,n)||De(i.valueType,n);case"set":return De(i.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return De(i.innerType,n);case"lazy":return De(i.getter(),n);case"default":return De(i.innerType,n);case"prefault":return De(i.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return De(i.in,n)||De(i.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${i.type}`)}const Do=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));Do.displayName="Coins01";const Po=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));Po.displayName="CurrencyDollar";const Mo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M16.2 21H6.931c-.605 0-.908 0-1.049-.12a.5.5 0 0 1-.173-.42c.014-.183.228-.397.657-.826l8.503-8.503c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668L21 15v1.2M16.2 21c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.72 21 17.88 21 16.2M16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"}));Mo.displayName="Image01";const Bo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));Bo.displayName="Lightbulb01";const Fo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));Fo.displayName="LogOut04";const Uo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));Uo.displayName="MessageChatSquare";const Vr=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));Vr.displayName="Stars01";const Ho=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));Ho.displayName="Stop";const zo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));zo.displayName="Target04";const jo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"m4 17 6-6-6-6m8 14h8"}));jo.displayName="Terminal";function fp(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=te("flex flex-col h-full w-full bg-sidebar transform-[translateZ(0)]",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=g.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function hp(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=te("flex h-12 items-center justify-between border-b border-border px-4 flex-none",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=g.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function pp(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=te("flex-1 min-h-0 overflow-y-auto",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=g.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function mp(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=te("flex-none w-full mx-auto p-2",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=g.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}const Wr=Object.assign(fp,{Header:hp,Content:pp,Footer:mp});function gp(t){const e=W.c(67),{value:n,onChange:r,onSubmit:i,onStop:a,disabled:s,isStreaming:u,placeholder:o,className:l,centered:f,contextContent:d,leftActions:p,rightActions:h,maxTextHeight:m}=t,E=o===void 0?"Ask anything or @ for context":o,x=f===void 0?!1:f,T=m===void 0?"164px":m;let k;e[0]!==s||e[1]!==u||e[2]!==n?(k=!s&&!u&&n.trim().length>0,e[0]=s,e[1]=u,e[2]=n,e[3]=k):k=e[3];const b=k;let N;e[4]!==b||e[5]!==u||e[6]!==a||e[7]!==i?(N=rt=>{rt.preventDefault(),u&&a?a():b&&i()},e[4]=b,e[5]=u,e[6]=a,e[7]=i,e[8]=N):N=e[8];const v=N;let C;e[9]!==b||e[10]!==i?(C=rt=>{rt.key==="Enter"&&!rt.shiftKey&&(rt.preventDefault(),b&&i())},e[9]=b,e[10]=i,e[11]=C):C=e[11];const L=C;let M;e[12]!==l?(M=te("w-full",l),e[12]=l,e[13]=M):M=e[13];const F=x?"shadow-md":"shadow-sm";let w;e[14]!==F?(w=te("relative rounded-xl border border-border bg-background w-full min-h-[130px] flex flex-col",F),e[14]=F,e[15]=w):w=e[15];let B;e[16]!==d?(B=d&&g.jsx("div",{className:"mb-1",children:d}),e[16]=d,e[17]=B):B=e[17];let $;e[18]!==T?($={maxHeight:T},e[18]=T,e[19]=$):$=e[19];let J;e[20]!==r?(J=rt=>r(rt.target.value),e[20]=r,e[21]=J):J=e[21];const q=s||u;let z;e[22]===Symbol.for("react.memo_cache_sentinel")?(z=te("placeholder:text-muted-foreground resize-none focus-visible:ring-0 border-0 p-2 text-sm min-h-[20px] w-full","rounded-none shadow-none"),e[22]=z):z=e[22];let Q;e[23]===Symbol.for("react.memo_cache_sentinel")?(Q={minHeight:"20px",height:"auto",overflow:"hidden"},e[23]=Q):Q=e[23];let ie;e[24]!==L||e[25]!==E||e[26]!==J||e[27]!==q||e[28]!==n?(ie=g.jsx(gf,{value:n,onChange:J,onKeyDown:L,placeholder:E,disabled:q,className:z,rows:1,style:Q}),e[24]=L,e[25]=E,e[26]=J,e[27]=q,e[28]=n,e[29]=ie):ie=e[29];let be;e[30]!==$||e[31]!==ie?(be=g.jsx("div",{className:"overflow-y-auto relative flex-1",style:$,children:ie}),e[30]=$,e[31]=ie,e[32]=be):be=e[32];let Re;e[33]!==B||e[34]!==be?(Re=g.jsxs("div",{className:"relative flex flex-col gap-2 p-2.5 flex-1",children:[B,be]}),e[33]=B,e[34]=be,e[35]=Re):Re=e[35];let I;e[36]!==p?(I=g.jsx("div",{className:"flex items-center overflow-hidden",children:p}),e[36]=p,e[37]=I):I=e[37];const Ie=u?"button":"submit";let Ee;e[38]!==u||e[39]!==a?(Ee=rt=>{u&&(rt.preventDefault(),rt.stopPropagation(),a?.())},e[38]=u,e[39]=a,e[40]=Ee):Ee=e[40];const S=b||u?"default":"ghost",ce=!b&&!u,me=!b&&!u&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed";let ge;e[41]!==me?(ge=te("size-8 rounded-full transition-all",me),e[41]=me,e[42]=ge):ge=e[42];const _t=u?"Stop generating":"Send message (Enter)";let He;e[43]!==u?(He=u?g.jsx(Ho,{size:20}):g.jsx(pf,{size:20}),e[43]=u,e[44]=He):He=e[44];let Ke;e[45]!==Ie||e[46]!==Ee||e[47]!==S||e[48]!==ce||e[49]!==ge||e[50]!==_t||e[51]!==He?(Ke=g.jsx(Mt,{type:Ie,onClick:Ee,variant:S,size:"icon",disabled:ce,className:ge,title:_t,children:He}),e[45]=Ie,e[46]=Ee,e[47]=S,e[48]=ce,e[49]=ge,e[50]=_t,e[51]=He,e[52]=Ke):Ke=e[52];let Xe;e[53]!==h||e[54]!==Ke?(Xe=g.jsxs("div",{className:"flex items-center gap-1",children:[h,Ke]}),e[53]=h,e[54]=Ke,e[55]=Xe):Xe=e[55];let ut;e[56]!==I||e[57]!==Xe?(ut=g.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[I,Xe]}),e[56]=I,e[57]=Xe,e[58]=ut):ut=e[58];let St;e[59]!==Re||e[60]!==ut||e[61]!==w?(St=g.jsxs("div",{className:w,children:[Re,ut]}),e[59]=Re,e[60]=ut,e[61]=w,e[62]=St):St=e[62];let en;return e[63]!==v||e[64]!==St||e[65]!==M?(en=g.jsx("form",{onSubmit:v,className:M,children:St}),e[63]=v,e[64]=St,e[65]=M,e[66]=en):en=e[66],en}function bp(t){const e=W.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=g.jsx(pn.Root,{"data-slot":"drawer",...n}),e[2]=n,e[3]=r):r=e[3],r}function Ep(t){const e=W.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=g.jsx(pn.Trigger,{"data-slot":"drawer-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function Tp(t){const e=W.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=g.jsx(pn.Portal,{"data-slot":"drawer-portal",...n}),e[2]=n,e[3]=r):r=e[3],r}function _p(t){const e=W.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=te("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=g.jsx(pn.Overlay,{"data-slot":"drawer-overlay",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function xp(t){const e=W.c(12);let n,r,i;e[0]!==t?({className:r,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=g.jsx(_p,{}),e[4]=a):a=e[4];let s;e[5]!==r?(s=te("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",r),e[5]=r,e[6]=s):s=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=g.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),e[7]=u):u=e[7];let o;return e[8]!==n||e[9]!==i||e[10]!==s?(o=g.jsxs(Tp,{"data-slot":"drawer-portal",children:[a,g.jsxs(pn.Content,{"data-slot":"drawer-content",className:s,...i,children:[u,n]})]}),e[8]=n,e[9]=i,e[10]=s,e[11]=o):o=e[11],o}function yp(t){const e=W.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=te("flex flex-col gap-1.5 px-4 py-2",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=g.jsx("div",{"data-slot":"drawer-header",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function kp(t){const e=W.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=te("text-foreground font-semibold",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=g.jsx(pn.Title,{"data-slot":"drawer-title",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function ys({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=Ap({defaultProp:e,onChange:n}),a=t!==void 0,s=a?t:r,u=ho(n),o=V.useCallback(l=>{if(a){const d=typeof l=="function"?l(t):l;d!==t&&u(d)}else i(l)},[a,t,i,u]);return[s,o]}function Ap({defaultProp:t,onChange:e}){const n=V.useState(t),[r]=n,i=V.useRef(r),a=ho(e);return V.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}const $o=V.createContext({isMobile:!1,setValue:()=>{}}),xa=()=>V.useContext($o),Zo=t=>{const e=W.c(37);let n,r,i,a,s,u,o,l;e[0]!==t?({children:n,defaultOpen:r,open:u,onOpenChange:a,defaultValue:i,value:l,onValueChange:s,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=a,e[5]=s,e[6]=u,e[7]=o,e[8]=l):(n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],u=e[6],o=e[7],l=e[8]);const f=Sf(),d=r??!1;let p;e[9]!==a||e[10]!==u||e[11]!==d?(p={prop:u,defaultProp:d,onChange:a},e[9]=a,e[10]=u,e[11]=d,e[12]=p):p=e[12];const[h,m]=ys(p);let E;e[13]!==i||e[14]!==s||e[15]!==l?(E={prop:l,defaultProp:i,onChange:s},e[13]=i,e[14]=s,e[15]=l,e[16]=E):E=e[16];const[x,T]=ys(E);let k;e[17]!==T?(k=M=>{M&&T(M)},e[17]=T,e[18]=k):k=e[18];const b=k;let N;e[19]!==f||e[20]!==b?(N={isMobile:f,setValue:b},e[19]=f,e[20]=b,e[21]=N):N=e[21];let v;e[22]!==n||e[23]!==h||e[24]!==o||e[25]!==m?(v=g.jsx(bp,{open:h,onOpenChange:m,...o,children:n}),e[22]=n,e[23]=h,e[24]=o,e[25]=m,e[26]=v):v=e[26];let C;e[27]!==h||e[28]!==o||e[29]!==m||e[30]!==b||e[31]!==v||e[32]!==x?(C=g.jsx(Cf,{open:h,onOpenChange:m,value:x,onValueChange:b,...o,children:v}),e[27]=h,e[28]=o,e[29]=m,e[30]=b,e[31]=v,e[32]=x,e[33]=C):C=e[33];let L;return e[34]!==N||e[35]!==C?(L=g.jsx($o.Provider,{value:N,children:C}),e[34]=N,e[35]=C,e[36]=L):L=e[36],L},Yo=t=>{const{children:e,title:n,headerActions:r,...i}=t,{isMobile:a}=xa(),{className:s,...u}=i;return a?g.jsxs(xp,{...u,children:[g.jsxs(yp,{className:te(r?"flex flex-row items-center justify-between":"hidden"),children:[g.jsx(kp,{children:n}),r]}),g.jsx("div",{className:te("flex flex-col gap-2 p-2 py-4",s),children:e})]}):g.jsx(Af,{...i,children:e})},qo=t=>{const e=W.c(7);let n,r;e[0]!==t?({children:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);const{isMobile:i}=xa();let a;return e[3]!==n||e[4]!==i||e[5]!==r?(a=i?g.jsx(Ep,{asChild:!0,children:g.jsx(Mt,{variant:"outline",...r,children:n})}):g.jsx(kf,{...r,children:n}),e[3]=n,e[4]=i,e[5]=r,e[6]=a):a=e[6],a},Vo=t=>{const e=W.c(7);let n,r;e[0]!==t?({children:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);const{isMobile:i}=xa();let a;return e[3]!==n||e[4]!==i||e[5]!==r?(a=i?g.jsx("span",{...r,children:n}):g.jsx(yf,{...r,children:n}),e[3]=n,e[4]=i,e[5]=r,e[6]=a):a=e[6],a};function Cp(){const t=W.c(2),e=Nf();let n;return t[0]!==e?(n=e.map(Ip),t[0]=e,t[1]=n):n=t[1],n}function Ip(t){return{id:t.id,title:t.title,description:t.description??null,icon:t.icon??null,fallbackIcon:g.jsx(Ta,{})}}function Sp(t){const e=W.c(24),{gateway:n,isSelected:r}=t,i=r&&"bg-accent";let a;e[0]!==i?(a=te("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl",i),e[0]=i,e[1]=a):a=e[1];let s;e[2]!==n.fallbackIcon?(s=n.fallbackIcon??g.jsx(Ta,{}),e[2]=n.fallbackIcon,e[3]=s):s=e[3];let u;e[4]!==n.icon||e[5]!==n.title||e[6]!==s?(u=g.jsx(_o,{icon:n.icon,name:n.title,size:"sm",fallbackIcon:s,className:"size-10"}),e[4]=n.icon,e[5]=n.title,e[6]=s,e[7]=u):u=e[7];let o;e[8]!==n.title?(o=g.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=o):o=e[9];let l;e[10]!==r?(l=r&&g.jsx(qt,{size:16,className:"text-foreground shrink-0"}),e[10]=r,e[11]=l):l=e[11];let f;e[12]!==o||e[13]!==l?(f=g.jsxs("div",{className:"flex items-center justify-between",children:[o,l]}),e[12]=o,e[13]=l,e[14]=f):f=e[14];let d;e[15]!==n.description?(d=n.description&&g.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:n.description}),e[15]=n.description,e[16]=d):d=e[16];let p;e[17]!==f||e[18]!==d?(p=g.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[f,d]}),e[17]=f,e[18]=d,e[19]=p):p=e[19];let h;return e[20]!==a||e[21]!==u||e[22]!==p?(h=g.jsxs("div",{className:a,children:[u,p]}),e[20]=a,e[21]=u,e[22]=p,e[23]=h):h=e[23],h}function Np(t){const e=W.c(12),{gateway:n}=t;if(!n){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=g.jsx("span",{className:"text-sm text-muted-foreground",children:"Select gateway"}),e[0]=u):u=e[0],u}let r;e[1]!==n.fallbackIcon?(r=n.fallbackIcon??g.jsx(Ta,{}),e[1]=n.fallbackIcon,e[2]=r):r=e[2];let i;e[3]!==n.icon||e[4]!==n.title||e[5]!==r?(i=g.jsx(_o,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:r,className:"size-5"}),e[3]=n.icon,e[4]=n.title,e[5]=r,e[6]=i):i=e[6];let a;e[7]!==n.title?(a=g.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=a):a=e[8];let s;return e[9]!==i||e[10]!==a?(s=g.jsxs("div",{className:"flex items-center gap-2",children:[i,a]}),e[9]=i,e[10]=a,e[11]=s):s=e[11],s}function wp(t){const e=W.c(37),{selectedGatewayId:n,onGatewayChange:r,variant:i,className:a,placeholder:s}=t,u=i===void 0?"bordered":i,o=s===void 0?"Select gateway":s,[l,f]=V.useState(!1),d=Cp();let p;if(e[0]!==d||e[1]!==n){let B;e[3]!==n?(B=$=>$.id===n,e[3]=n,e[4]=B):B=e[4],p=d.find(B),e[0]=d,e[1]=n,e[2]=p}else p=e[2];const h=p;let m;e[5]!==r?(m=B=>{r(B),f(!1)},e[5]=r,e[6]=m):m=e[6];const E=m;if(d.length===0)return null;const x=n||"",T=u==="borderless"?"border-0 md:border-none":"border";let k;e[7]!==a||e[8]!==T?(k=te("h-8! text-sm hover:bg-accent rounded-lg py-1 px-2 gap-1 shadow-none cursor-pointer group focus-visible:ring-0 focus-visible:ring-offset-0",T,a),e[7]=a,e[8]=T,e[9]=k):k=e[9];let b;e[10]!==h?(b=g.jsx(Np,{gateway:h}),e[10]=h,e[11]=b):b=e[11];let N;e[12]!==o||e[13]!==b?(N=g.jsx(Vo,{placeholder:o,children:b}),e[12]=o,e[13]=b,e[14]=N):N=e[14];let v;e[15]!==k||e[16]!==N?(v=g.jsx(qo,{className:k,children:N}),e[15]=k,e[16]=N,e[17]=v):v=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:g.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[g.jsx(To,{size:16}),g.jsx("span",{className:"text-sm",children:"Search for a gateway..."})]})}),e[18]=C):C=e[18];let L;if(e[19]!==d||e[20]!==E||e[21]!==n){let B;e[23]!==E||e[24]!==n?(B=$=>g.jsx("div",{onClick:()=>E($.id),className:"outline-none",children:g.jsx(Sp,{gateway:$,isSelected:$.id===n})},$.id),e[23]=E,e[24]=n,e[25]=B):B=e[25],L=d.map(B),e[19]=d,e[20]=E,e[21]=n,e[22]=L}else L=e[22];let M;e[26]!==L?(M=g.jsxs("div",{className:"flex flex-col max-h-[400px]",children:[C,g.jsx("div",{className:"overflow-y-auto p-2 flex flex-col gap-1",children:L})]}),e[26]=L,e[27]=M):M=e[27];let F;e[28]!==o||e[29]!==M?(F=g.jsx(Yo,{title:o,className:"w-full md:w-[400px] p-0",children:M}),e[28]=o,e[29]=M,e[30]=F):F=e[30];let w;return e[31]!==E||e[32]!==l||e[33]!==v||e[34]!==F||e[35]!==x?(w=g.jsxs(Zo,{open:l,onOpenChange:f,value:x,onValueChange:E,children:[v,F]}),e[31]=E,e[32]=l,e[33]=v,e[34]=F,e[35]=x,e[36]=w):w=e[36],w}function ya(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Kt=ya();function Wo(t){Kt=t}var Un={exec:()=>null};function fe(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,a)=>{let s=typeof a=="string"?a:a.source;return s=s.replace(Ze.caret,"$1"),n=n.replace(i,s),r},getRegex:()=>new RegExp(n,e)};return r}var Ze={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},vp=/^(?:[ \t]*(?:\n|$))+/,Rp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Op=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ar=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Lp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ka=/(?:[*+-]|\d{1,9}[.)])/,Go=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qo=fe(Go).replace(/bull/g,ka).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Dp=fe(Go).replace(/bull/g,ka).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Aa=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Pp=/^[^\n]+/,Ca=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Mp=fe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ca).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Bp=fe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ka).getRegex(),Gr="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ia=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Fp=fe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ia).replace("tag",Gr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ko=fe(Aa).replace("hr",ar).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Gr).getRegex(),Up=fe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ko).getRegex(),Sa={blockquote:Up,code:Rp,def:Mp,fences:Op,heading:Lp,hr:ar,html:Fp,lheading:Qo,list:Bp,newline:vp,paragraph:Ko,table:Un,text:Pp},ks=fe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ar).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Gr).getRegex(),Hp={...Sa,lheading:Dp,table:ks,paragraph:fe(Aa).replace("hr",ar).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ks).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Gr).getRegex()},zp={...Sa,html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ia).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Un,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:fe(Aa).replace("hr",ar).replace("heading",` *#{1,6} *[^
|
|
29
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of this.seen.entries()){const d=f[1];if(e===f[0]){s(f);continue}if(r.external){const h=r.external.registry.get(f[0])?.id;if(e!==f[0]&&h){s(f);continue}}if(this.metadataRegistry.get(f[0])?.id){s(f);continue}if(d.cycle){s(f);continue}if(d.count>1&&r.reused==="ref"){s(f);continue}}const u=(f,d)=>{const p=this.seen.get(f),h=p.def??p.schema,m={...h};if(p.ref===null)return;const E=p.ref;if(p.ref=null,E){u(E,d);const x=this.seen.get(E).schema;x.$ref&&d.target==="draft-7"?(h.allOf=h.allOf??[],h.allOf.push(x)):(Object.assign(h,x),Object.assign(h,m))}p.isParent||this.override({zodSchema:f,jsonSchema:h,path:p.path??[]})};for(const f of[...this.seen.entries()].reverse())u(f[0],{target:this.target});const o={};if(this.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?o.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),r.external?.uri){const f=r.external.registry.get(e)?.id;if(!f)throw new Error("Schema is missing an `id` property");o.$id=r.external.uri(f)}Object.assign(o,i.def);const l=r.external?.defs??{};for(const f of this.seen.entries()){const d=f[1];d.def&&d.defId&&(l[d.defId]=d.def)}r.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{return JSON.parse(JSON.stringify(o))}catch{throw new Error("Error converting schema to JSON.")}}}function dp(t,e){if(t instanceof Ro){const r=new xs(e),i={};for(const u of t._idmap.entries()){const[o,l]=u;r.process(l)}const a={},s={registry:t,uri:e?.uri,defs:i};for(const u of t._idmap.entries()){const[o,l]=u;a[o]=r.emit(l,{...e,external:s})}if(Object.keys(i).length>0){const u=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:i}}return{schemas:a}}const n=new xs(e);return n.process(t),n.emit(t,e)}function De(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const i=t._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return De(i.element,n);case"object":{for(const a in i.shape)if(De(i.shape[a],n))return!0;return!1}case"union":{for(const a of i.options)if(De(a,n))return!0;return!1}case"intersection":return De(i.left,n)||De(i.right,n);case"tuple":{for(const a of i.items)if(De(a,n))return!0;return!!(i.rest&&De(i.rest,n))}case"record":return De(i.keyType,n)||De(i.valueType,n);case"map":return De(i.keyType,n)||De(i.valueType,n);case"set":return De(i.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return De(i.innerType,n);case"lazy":return De(i.getter(),n);case"default":return De(i.innerType,n);case"prefault":return De(i.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return De(i.in,n)||De(i.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${i.type}`)}const Do=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));Do.displayName="Coins01";const Po=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));Po.displayName="CurrencyDollar";const Mo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M16.2 21H6.931c-.605 0-.908 0-1.049-.12a.5.5 0 0 1-.173-.42c.014-.183.228-.397.657-.826l8.503-8.503c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668L21 15v1.2M16.2 21c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.72 21 17.88 21 16.2M16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"}));Mo.displayName="Image01";const Bo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));Bo.displayName="Lightbulb01";const Fo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));Fo.displayName="LogOut04";const Uo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));Uo.displayName="MessageChatSquare";const Vr=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));Vr.displayName="Stars01";const Ho=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));Ho.displayName="Stop";const zo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));zo.displayName="Target04";const jo=({size:t=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"m4 17 6-6-6-6m8 14h8"}));jo.displayName="Terminal";function fp(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=re("flex flex-col h-full w-full bg-sidebar transform-[translateZ(0)]",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=g.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function hp(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=re("flex h-12 items-center justify-between border-b border-border px-4 flex-none",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=g.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function pp(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=re("flex-1 min-h-0 overflow-y-auto",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=g.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function mp(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=re("flex-none w-full mx-auto p-2",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=g.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}const Wr=Object.assign(fp,{Header:hp,Content:pp,Footer:mp});function gp(t){const e=W.c(67),{value:n,onChange:r,onSubmit:i,onStop:a,disabled:s,isStreaming:u,placeholder:o,className:l,centered:f,contextContent:d,leftActions:p,rightActions:h,maxTextHeight:m}=t,E=o===void 0?"Ask anything or @ for context":o,x=f===void 0?!1:f,T=m===void 0?"164px":m;let k;e[0]!==s||e[1]!==u||e[2]!==n?(k=!s&&!u&&n.trim().length>0,e[0]=s,e[1]=u,e[2]=n,e[3]=k):k=e[3];const b=k;let N;e[4]!==b||e[5]!==u||e[6]!==a||e[7]!==i?(N=rt=>{rt.preventDefault(),u&&a?a():b&&i()},e[4]=b,e[5]=u,e[6]=a,e[7]=i,e[8]=N):N=e[8];const v=N;let C;e[9]!==b||e[10]!==i?(C=rt=>{rt.key==="Enter"&&!rt.shiftKey&&(rt.preventDefault(),b&&i())},e[9]=b,e[10]=i,e[11]=C):C=e[11];const L=C;let M;e[12]!==l?(M=re("w-full",l),e[12]=l,e[13]=M):M=e[13];const F=x?"shadow-md":"shadow-sm";let w;e[14]!==F?(w=re("relative rounded-xl border border-border bg-background w-full min-h-[130px] flex flex-col",F),e[14]=F,e[15]=w):w=e[15];let B;e[16]!==d?(B=d&&g.jsx("div",{className:"mb-1",children:d}),e[16]=d,e[17]=B):B=e[17];let $;e[18]!==T?($={maxHeight:T},e[18]=T,e[19]=$):$=e[19];let J;e[20]!==r?(J=rt=>r(rt.target.value),e[20]=r,e[21]=J):J=e[21];const q=s||u;let z;e[22]===Symbol.for("react.memo_cache_sentinel")?(z=re("placeholder:text-muted-foreground resize-none focus-visible:ring-0 border-0 p-2 text-sm min-h-[20px] w-full","rounded-none shadow-none"),e[22]=z):z=e[22];let Q;e[23]===Symbol.for("react.memo_cache_sentinel")?(Q={minHeight:"20px",height:"auto",overflow:"hidden"},e[23]=Q):Q=e[23];let ie;e[24]!==L||e[25]!==E||e[26]!==J||e[27]!==q||e[28]!==n?(ie=g.jsx(gf,{value:n,onChange:J,onKeyDown:L,placeholder:E,disabled:q,className:z,rows:1,style:Q}),e[24]=L,e[25]=E,e[26]=J,e[27]=q,e[28]=n,e[29]=ie):ie=e[29];let be;e[30]!==$||e[31]!==ie?(be=g.jsx("div",{className:"overflow-y-auto relative flex-1",style:$,children:ie}),e[30]=$,e[31]=ie,e[32]=be):be=e[32];let Re;e[33]!==B||e[34]!==be?(Re=g.jsxs("div",{className:"relative flex flex-col gap-2 p-2.5 flex-1",children:[B,be]}),e[33]=B,e[34]=be,e[35]=Re):Re=e[35];let I;e[36]!==p?(I=g.jsx("div",{className:"flex items-center overflow-hidden",children:p}),e[36]=p,e[37]=I):I=e[37];const Ie=u?"button":"submit";let Ee;e[38]!==u||e[39]!==a?(Ee=rt=>{u&&(rt.preventDefault(),rt.stopPropagation(),a?.())},e[38]=u,e[39]=a,e[40]=Ee):Ee=e[40];const S=b||u?"default":"ghost",ce=!b&&!u,me=!b&&!u&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed";let ge;e[41]!==me?(ge=re("size-8 rounded-full transition-all",me),e[41]=me,e[42]=ge):ge=e[42];const _t=u?"Stop generating":"Send message (Enter)";let He;e[43]!==u?(He=u?g.jsx(Ho,{size:20}):g.jsx(pf,{size:20}),e[43]=u,e[44]=He):He=e[44];let Ke;e[45]!==Ie||e[46]!==Ee||e[47]!==S||e[48]!==ce||e[49]!==ge||e[50]!==_t||e[51]!==He?(Ke=g.jsx(Mt,{type:Ie,onClick:Ee,variant:S,size:"icon",disabled:ce,className:ge,title:_t,children:He}),e[45]=Ie,e[46]=Ee,e[47]=S,e[48]=ce,e[49]=ge,e[50]=_t,e[51]=He,e[52]=Ke):Ke=e[52];let Xe;e[53]!==h||e[54]!==Ke?(Xe=g.jsxs("div",{className:"flex items-center gap-1",children:[h,Ke]}),e[53]=h,e[54]=Ke,e[55]=Xe):Xe=e[55];let ut;e[56]!==I||e[57]!==Xe?(ut=g.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[I,Xe]}),e[56]=I,e[57]=Xe,e[58]=ut):ut=e[58];let St;e[59]!==Re||e[60]!==ut||e[61]!==w?(St=g.jsxs("div",{className:w,children:[Re,ut]}),e[59]=Re,e[60]=ut,e[61]=w,e[62]=St):St=e[62];let en;return e[63]!==v||e[64]!==St||e[65]!==M?(en=g.jsx("form",{onSubmit:v,className:M,children:St}),e[63]=v,e[64]=St,e[65]=M,e[66]=en):en=e[66],en}function bp(t){const e=W.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=g.jsx(pn.Root,{"data-slot":"drawer",...n}),e[2]=n,e[3]=r):r=e[3],r}function Ep(t){const e=W.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=g.jsx(pn.Trigger,{"data-slot":"drawer-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function Tp(t){const e=W.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=g.jsx(pn.Portal,{"data-slot":"drawer-portal",...n}),e[2]=n,e[3]=r):r=e[3],r}function _p(t){const e=W.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=re("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=g.jsx(pn.Overlay,{"data-slot":"drawer-overlay",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function xp(t){const e=W.c(12);let n,r,i;e[0]!==t?({className:r,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=g.jsx(_p,{}),e[4]=a):a=e[4];let s;e[5]!==r?(s=re("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",r),e[5]=r,e[6]=s):s=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=g.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),e[7]=u):u=e[7];let o;return e[8]!==n||e[9]!==i||e[10]!==s?(o=g.jsxs(Tp,{"data-slot":"drawer-portal",children:[a,g.jsxs(pn.Content,{"data-slot":"drawer-content",className:s,...i,children:[u,n]})]}),e[8]=n,e[9]=i,e[10]=s,e[11]=o):o=e[11],o}function yp(t){const e=W.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=re("flex flex-col gap-1.5 px-4 py-2",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=g.jsx("div",{"data-slot":"drawer-header",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function kp(t){const e=W.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=re("text-foreground font-semibold",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=g.jsx(pn.Title,{"data-slot":"drawer-title",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function ys({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=Ap({defaultProp:e,onChange:n}),a=t!==void 0,s=a?t:r,u=ho(n),o=V.useCallback(l=>{if(a){const d=typeof l=="function"?l(t):l;d!==t&&u(d)}else i(l)},[a,t,i,u]);return[s,o]}function Ap({defaultProp:t,onChange:e}){const n=V.useState(t),[r]=n,i=V.useRef(r),a=ho(e);return V.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}const $o=V.createContext({isMobile:!1,setValue:()=>{}}),xa=()=>V.useContext($o),Zo=t=>{const e=W.c(37);let n,r,i,a,s,u,o,l;e[0]!==t?({children:n,defaultOpen:r,open:u,onOpenChange:a,defaultValue:i,value:l,onValueChange:s,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=a,e[5]=s,e[6]=u,e[7]=o,e[8]=l):(n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],u=e[6],o=e[7],l=e[8]);const f=Sf(),d=r??!1;let p;e[9]!==a||e[10]!==u||e[11]!==d?(p={prop:u,defaultProp:d,onChange:a},e[9]=a,e[10]=u,e[11]=d,e[12]=p):p=e[12];const[h,m]=ys(p);let E;e[13]!==i||e[14]!==s||e[15]!==l?(E={prop:l,defaultProp:i,onChange:s},e[13]=i,e[14]=s,e[15]=l,e[16]=E):E=e[16];const[x,T]=ys(E);let k;e[17]!==T?(k=M=>{M&&T(M)},e[17]=T,e[18]=k):k=e[18];const b=k;let N;e[19]!==f||e[20]!==b?(N={isMobile:f,setValue:b},e[19]=f,e[20]=b,e[21]=N):N=e[21];let v;e[22]!==n||e[23]!==h||e[24]!==o||e[25]!==m?(v=g.jsx(bp,{open:h,onOpenChange:m,...o,children:n}),e[22]=n,e[23]=h,e[24]=o,e[25]=m,e[26]=v):v=e[26];let C;e[27]!==h||e[28]!==o||e[29]!==m||e[30]!==b||e[31]!==v||e[32]!==x?(C=g.jsx(Cf,{open:h,onOpenChange:m,value:x,onValueChange:b,...o,children:v}),e[27]=h,e[28]=o,e[29]=m,e[30]=b,e[31]=v,e[32]=x,e[33]=C):C=e[33];let L;return e[34]!==N||e[35]!==C?(L=g.jsx($o.Provider,{value:N,children:C}),e[34]=N,e[35]=C,e[36]=L):L=e[36],L},Yo=t=>{const{children:e,title:n,headerActions:r,...i}=t,{isMobile:a}=xa(),{className:s,...u}=i;return a?g.jsxs(xp,{...u,children:[g.jsxs(yp,{className:re(r?"flex flex-row items-center justify-between":"hidden"),children:[g.jsx(kp,{children:n}),r]}),g.jsx("div",{className:re("flex flex-col gap-2 p-2 py-4",s),children:e})]}):g.jsx(Af,{...i,children:e})},qo=t=>{const e=W.c(7);let n,r;e[0]!==t?({children:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);const{isMobile:i}=xa();let a;return e[3]!==n||e[4]!==i||e[5]!==r?(a=i?g.jsx(Ep,{asChild:!0,children:g.jsx(Mt,{variant:"outline",...r,children:n})}):g.jsx(kf,{...r,children:n}),e[3]=n,e[4]=i,e[5]=r,e[6]=a):a=e[6],a},Vo=t=>{const e=W.c(7);let n,r;e[0]!==t?({children:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);const{isMobile:i}=xa();let a;return e[3]!==n||e[4]!==i||e[5]!==r?(a=i?g.jsx("span",{...r,children:n}):g.jsx(yf,{...r,children:n}),e[3]=n,e[4]=i,e[5]=r,e[6]=a):a=e[6],a};function Cp(){const t=W.c(2),e=Nf();let n;return t[0]!==e?(n=e.map(Ip),t[0]=e,t[1]=n):n=t[1],n}function Ip(t){return{id:t.id,title:t.title,description:t.description??null,icon:t.icon??null,fallbackIcon:g.jsx(Ta,{})}}function Sp(t){const e=W.c(24),{gateway:n,isSelected:r}=t,i=r&&"bg-accent";let a;e[0]!==i?(a=re("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl",i),e[0]=i,e[1]=a):a=e[1];let s;e[2]!==n.fallbackIcon?(s=n.fallbackIcon??g.jsx(Ta,{}),e[2]=n.fallbackIcon,e[3]=s):s=e[3];let u;e[4]!==n.icon||e[5]!==n.title||e[6]!==s?(u=g.jsx(_o,{icon:n.icon,name:n.title,size:"sm",fallbackIcon:s,className:"size-10"}),e[4]=n.icon,e[5]=n.title,e[6]=s,e[7]=u):u=e[7];let o;e[8]!==n.title?(o=g.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=o):o=e[9];let l;e[10]!==r?(l=r&&g.jsx(qt,{size:16,className:"text-foreground shrink-0"}),e[10]=r,e[11]=l):l=e[11];let f;e[12]!==o||e[13]!==l?(f=g.jsxs("div",{className:"flex items-center justify-between",children:[o,l]}),e[12]=o,e[13]=l,e[14]=f):f=e[14];let d;e[15]!==n.description?(d=n.description&&g.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:n.description}),e[15]=n.description,e[16]=d):d=e[16];let p;e[17]!==f||e[18]!==d?(p=g.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[f,d]}),e[17]=f,e[18]=d,e[19]=p):p=e[19];let h;return e[20]!==a||e[21]!==u||e[22]!==p?(h=g.jsxs("div",{className:a,children:[u,p]}),e[20]=a,e[21]=u,e[22]=p,e[23]=h):h=e[23],h}function Np(t){const e=W.c(12),{gateway:n}=t;if(!n){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=g.jsx("span",{className:"text-sm text-muted-foreground",children:"Select gateway"}),e[0]=u):u=e[0],u}let r;e[1]!==n.fallbackIcon?(r=n.fallbackIcon??g.jsx(Ta,{}),e[1]=n.fallbackIcon,e[2]=r):r=e[2];let i;e[3]!==n.icon||e[4]!==n.title||e[5]!==r?(i=g.jsx(_o,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:r,className:"size-5"}),e[3]=n.icon,e[4]=n.title,e[5]=r,e[6]=i):i=e[6];let a;e[7]!==n.title?(a=g.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=a):a=e[8];let s;return e[9]!==i||e[10]!==a?(s=g.jsxs("div",{className:"flex items-center gap-2",children:[i,a]}),e[9]=i,e[10]=a,e[11]=s):s=e[11],s}function wp(t){const e=W.c(37),{selectedGatewayId:n,onGatewayChange:r,variant:i,className:a,placeholder:s}=t,u=i===void 0?"bordered":i,o=s===void 0?"Select gateway":s,[l,f]=V.useState(!1),d=Cp();let p;if(e[0]!==d||e[1]!==n){let B;e[3]!==n?(B=$=>$.id===n,e[3]=n,e[4]=B):B=e[4],p=d.find(B),e[0]=d,e[1]=n,e[2]=p}else p=e[2];const h=p;let m;e[5]!==r?(m=B=>{r(B),f(!1)},e[5]=r,e[6]=m):m=e[6];const E=m;if(d.length===0)return null;const x=n||"",T=u==="borderless"?"border-0 md:border-none":"border";let k;e[7]!==a||e[8]!==T?(k=re("h-8! text-sm hover:bg-accent rounded-lg py-1 px-2 gap-1 shadow-none cursor-pointer group focus-visible:ring-0 focus-visible:ring-offset-0",T,a),e[7]=a,e[8]=T,e[9]=k):k=e[9];let b;e[10]!==h?(b=g.jsx(Np,{gateway:h}),e[10]=h,e[11]=b):b=e[11];let N;e[12]!==o||e[13]!==b?(N=g.jsx(Vo,{placeholder:o,children:b}),e[12]=o,e[13]=b,e[14]=N):N=e[14];let v;e[15]!==k||e[16]!==N?(v=g.jsx(qo,{className:k,children:N}),e[15]=k,e[16]=N,e[17]=v):v=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:g.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[g.jsx(To,{size:16}),g.jsx("span",{className:"text-sm",children:"Search for a gateway..."})]})}),e[18]=C):C=e[18];let L;if(e[19]!==d||e[20]!==E||e[21]!==n){let B;e[23]!==E||e[24]!==n?(B=$=>g.jsx("div",{onClick:()=>E($.id),className:"outline-none",children:g.jsx(Sp,{gateway:$,isSelected:$.id===n})},$.id),e[23]=E,e[24]=n,e[25]=B):B=e[25],L=d.map(B),e[19]=d,e[20]=E,e[21]=n,e[22]=L}else L=e[22];let M;e[26]!==L?(M=g.jsxs("div",{className:"flex flex-col max-h-[400px]",children:[C,g.jsx("div",{className:"overflow-y-auto p-2 flex flex-col gap-1",children:L})]}),e[26]=L,e[27]=M):M=e[27];let F;e[28]!==o||e[29]!==M?(F=g.jsx(Yo,{title:o,className:"w-full md:w-[400px] p-0",children:M}),e[28]=o,e[29]=M,e[30]=F):F=e[30];let w;return e[31]!==E||e[32]!==l||e[33]!==v||e[34]!==F||e[35]!==x?(w=g.jsxs(Zo,{open:l,onOpenChange:f,value:x,onValueChange:E,children:[v,F]}),e[31]=E,e[32]=l,e[33]=v,e[34]=F,e[35]=x,e[36]=w):w=e[36],w}function ya(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Kt=ya();function Wo(t){Kt=t}var Un={exec:()=>null};function fe(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,a)=>{let s=typeof a=="string"?a:a.source;return s=s.replace(Ze.caret,"$1"),n=n.replace(i,s),r},getRegex:()=>new RegExp(n,e)};return r}var Ze={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},vp=/^(?:[ \t]*(?:\n|$))+/,Rp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Op=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ar=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Lp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ka=/(?:[*+-]|\d{1,9}[.)])/,Go=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qo=fe(Go).replace(/bull/g,ka).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Dp=fe(Go).replace(/bull/g,ka).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Aa=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Pp=/^[^\n]+/,Ca=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Mp=fe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ca).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Bp=fe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ka).getRegex(),Gr="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ia=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Fp=fe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ia).replace("tag",Gr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ko=fe(Aa).replace("hr",ar).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Gr).getRegex(),Up=fe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ko).getRegex(),Sa={blockquote:Up,code:Rp,def:Mp,fences:Op,heading:Lp,hr:ar,html:Fp,lheading:Qo,list:Bp,newline:vp,paragraph:Ko,table:Un,text:Pp},ks=fe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ar).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Gr).getRegex(),Hp={...Sa,lheading:Dp,table:ks,paragraph:fe(Aa).replace("hr",ar).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ks).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Gr).getRegex()},zp={...Sa,html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ia).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Un,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:fe(Aa).replace("hr",ar).replace("heading",` *#{1,6} *[^
|
|
30
30
|
]`).replace("lheading",Qo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},jp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,$p=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Xo=/^( {2,}|\\)\n(?!\s*$)/,Zp=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Qr=/[\p{P}\p{S}]/u,Na=/[\s\p{P}\p{S}]/u,Jo=/[^\s\p{P}\p{S}]/u,Yp=fe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Na).getRegex(),el=/(?!~)[\p{P}\p{S}]/u,qp=/(?!~)[\s\p{P}\p{S}]/u,Vp=/(?:[^\s\p{P}\p{S}]|~)/u,Wp=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,tl=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Gp=fe(tl,"u").replace(/punct/g,Qr).getRegex(),Qp=fe(tl,"u").replace(/punct/g,el).getRegex(),nl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Kp=fe(nl,"gu").replace(/notPunctSpace/g,Jo).replace(/punctSpace/g,Na).replace(/punct/g,Qr).getRegex(),Xp=fe(nl,"gu").replace(/notPunctSpace/g,Vp).replace(/punctSpace/g,qp).replace(/punct/g,el).getRegex(),Jp=fe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Jo).replace(/punctSpace/g,Na).replace(/punct/g,Qr).getRegex(),em=fe(/\\(punct)/,"gu").replace(/punct/g,Qr).getRegex(),tm=fe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),nm=fe(Ia).replace("(?:-->|$)","-->").getRegex(),rm=fe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",nm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Dr=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,im=fe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Dr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),rl=fe(/^!?\[(label)\]\[(ref)\]/).replace("label",Dr).replace("ref",Ca).getRegex(),il=fe(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ca).getRegex(),am=fe("reflink|nolink(?!\\()","g").replace("reflink",rl).replace("nolink",il).getRegex(),wa={_backpedal:Un,anyPunctuation:em,autolink:tm,blockSkip:Wp,br:Xo,code:$p,del:Un,emStrongLDelim:Gp,emStrongRDelimAst:Kp,emStrongRDelimUnd:Jp,escape:jp,link:im,nolink:il,punctuation:Yp,reflink:rl,reflinkSearch:am,tag:rm,text:Zp,url:Un},sm={...wa,link:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",Dr).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Dr).getRegex()},Hi={...wa,emStrongRDelimAst:Xp,emStrongLDelim:Qp,url:fe(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},um={...Hi,br:fe(Xo).replace("{2,}","*").getRegex(),text:fe(Hi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},mr={normal:Sa,gfm:Hp,pedantic:zp},Cn={normal:wa,gfm:Hi,breaks:um,pedantic:sm},om={"&":"&","<":"<",">":">",'"':""","'":"'"},As=t=>om[t];function ht(t,e){if(e){if(Ze.escapeTest.test(t))return t.replace(Ze.escapeReplace,As)}else if(Ze.escapeTestNoEncode.test(t))return t.replace(Ze.escapeReplaceNoEncode,As);return t}function Cs(t){try{t=encodeURI(t).replace(Ze.percentDecode,"%")}catch{return null}return t}function Is(t,e){const n=t.replace(Ze.findPipe,(a,s,u)=>{let o=!1,l=s;for(;--l>=0&&u[l]==="\\";)o=!o;return o?"|":" |"}),r=n.split(Ze.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Ze.slashPipe,"|");return r}function In(t,e,n){const r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function lm(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ss(t,e,n,r,i){const a=e.href,s=e.title||null,u=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:s,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,o}function cm(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const i=r[1];return e.split(`
|
|
31
31
|
`).map(a=>{const s=a.match(n.other.beginningSpace);if(s===null)return a;const[u]=s;return u.length>=i.length?a.slice(i.length):a}).join(`
|
|
32
32
|
`)}var Pr=class{options;rules;lexer;constructor(t){this.options=t||Kt}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:In(n,`
|
|
@@ -81,7 +81,7 @@ ${t}</tr>
|
|
|
81
81
|
`}tablecell(t){const e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
82
82
|
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ht(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const r=this.parser.parseInline(n),i=Cs(t);if(i===null)return r;t=i;let a='<a href="'+t+'"';return e&&(a+=' title="'+ht(e)+'"'),a+=">"+r+"</a>",a}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const i=Cs(t);if(i===null)return ht(n);t=i;let a=`<img src="${t}" alt="${n}"`;return e&&(a+=` title="${ht(e)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ht(t.text)}},va=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Ct=class ji{options;renderer;textRenderer;constructor(e){this.options=e||Kt,this.options.renderer=this.options.renderer||new Mr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new va}static parse(e,n){return new ji(n).parse(e)}static parseInline(e,n){return new ji(n).parseInline(e)}parse(e,n=!0){let r="";for(let i=0;i<e.length;i++){const a=e[i];if(this.options.extensions?.renderers?.[a.type]){const u=a,o=this.options.extensions.renderers[u.type].call({parser:this},u);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(u.type)){r+=o||"";continue}}const s=a;switch(s.type){case"space":{r+=this.renderer.space(s);continue}case"hr":{r+=this.renderer.hr(s);continue}case"heading":{r+=this.renderer.heading(s);continue}case"code":{r+=this.renderer.code(s);continue}case"table":{r+=this.renderer.table(s);continue}case"blockquote":{r+=this.renderer.blockquote(s);continue}case"list":{r+=this.renderer.list(s);continue}case"html":{r+=this.renderer.html(s);continue}case"paragraph":{r+=this.renderer.paragraph(s);continue}case"text":{let u=s,o=this.renderer.text(u);for(;i+1<e.length&&e[i+1].type==="text";)u=e[++i],o+=`
|
|
83
83
|
`+this.renderer.text(u);n?r+=this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o,escaped:!0}]}):r+=o;continue}default:{const u='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}parseInline(e,n=this.renderer){let r="";for(let i=0;i<e.length;i++){const a=e[i];if(this.options.extensions?.renderers?.[a.type]){const u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}const s=a;switch(s.type){case"escape":{r+=n.text(s);break}case"html":{r+=n.html(s);break}case"link":{r+=n.link(s);break}case"image":{r+=n.image(s);break}case"strong":{r+=n.strong(s);break}case"em":{r+=n.em(s);break}case"codespan":{r+=n.codespan(s);break}case"br":{r+=n.br(s);break}case"del":{r+=n.del(s);break}case"text":{r+=n.text(s);break}default:{const u='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Ar=class{options;block;constructor(t){this.options=t||Kt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?At.lex:At.lexInline}provideParser(){return this.block?Ct.parse:Ct.parseInline}},dm=class{defaults=ya();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ct;Renderer=Mr;TextRenderer=va;Lexer=At;Tokenizer=Pr;Hooks=Ar;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{const i=r;for(const a of i.header)n=n.concat(this.walkTokens(a.tokens,e));for(const a of i.rows)for(const s of a)n=n.concat(this.walkTokens(s.tokens,e));break}case"list":{const i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{const i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{const s=i[a].flat(1/0);n=n.concat(this.walkTokens(s,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const a=e.renderers[i.name];a?e.renderers[i.name]=function(...s){let u=i.renderer.apply(this,s);return u===!1&&(u=a.apply(this,s)),u}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const a=e[i.level];a?a.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=this.defaults.renderer||new Mr(this.defaults);for(const a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;const s=a,u=n.renderer[s],o=i[s];i[s]=(...l)=>{let f=u.apply(i,l);return f===!1&&(f=o.apply(i,l)),f||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new Pr(this.defaults);for(const a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;const s=a,u=n.tokenizer[s],o=i[s];i[s]=(...l)=>{let f=u.apply(i,l);return f===!1&&(f=o.apply(i,l)),f}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new Ar;for(const a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;const s=a,u=n.hooks[s],o=i[s];Ar.passThroughHooks.has(a)?i[s]=l=>{if(this.defaults.async)return Promise.resolve(u.call(i,l)).then(d=>o.call(i,d));const f=u.call(i,l);return o.call(i,f)}:i[s]=(...l)=>{let f=u.apply(i,l);return f===!1&&(f=o.apply(i,l)),f}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,a=n.walkTokens;r.walkTokens=function(s){let u=[];return u.push(a.call(this,s)),i&&(u=u.concat(i.call(this,s))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return At.lex(t,e??this.defaults)}parser(t,e){return Ct.parse(t,e??this.defaults)}parseMarkdown(t){return(n,r)=>{const i={...r},a={...this.defaults,...i},s=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));a.hooks&&(a.hooks.options=a,a.hooks.block=t);const u=a.hooks?a.hooks.provideLexer():t?At.lex:At.lexInline,o=a.hooks?a.hooks.provideParser():t?Ct.parse:Ct.parseInline;if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then(l=>u(l,a)).then(l=>a.hooks?a.hooks.processAllTokens(l):l).then(l=>a.walkTokens?Promise.all(this.walkTokens(l,a.walkTokens)).then(()=>l):l).then(l=>o(l,a)).then(l=>a.hooks?a.hooks.postprocess(l):l).catch(s);try{a.hooks&&(n=a.hooks.preprocess(n));let l=u(n,a);a.hooks&&(l=a.hooks.processAllTokens(l)),a.walkTokens&&this.walkTokens(l,a.walkTokens);let f=o(l,a);return a.hooks&&(f=a.hooks.postprocess(f)),f}catch(l){return s(l)}}}onError(t,e){return n=>{if(n.message+=`
|
|
84
|
-
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+ht(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Vt=new dm;function he(t,e){return Vt.parse(t,e)}he.options=he.setOptions=function(t){return Vt.setOptions(t),he.defaults=Vt.defaults,Wo(he.defaults),he};he.getDefaults=ya;he.defaults=Kt;he.use=function(...t){return Vt.use(...t),he.defaults=Vt.defaults,Wo(he.defaults),he};he.walkTokens=function(t,e){return Vt.walkTokens(t,e)};he.parseInline=Vt.parseInline;he.Parser=Ct;he.parser=Ct.parse;he.Renderer=Mr;he.TextRenderer=va;he.Lexer=At;he.lexer=At.lex;he.Tokenizer=Pr;he.Hooks=Ar;he.parse=he;he.options;he.setOptions;he.use;he.walkTokens;he.parseInline;Ct.parse;At.lex;function Ns(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);const s=n.slice(i,r).trim();(s||!a)&&e.push(s),i=r+1,r=n.indexOf(",",i)}return e}function al(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const fm=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hm=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pm={};function ws(t,e){return(pm.jsx?hm:fm).test(t)}const mm=/[ \t\n\f\r]/g;function gm(t){return typeof t=="object"?t.type==="text"?vs(t.value):!1:vs(t)}function vs(t){return t.replace(mm,"")===""}class sr{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}sr.prototype.normal={};sr.prototype.property={};sr.prototype.space=void 0;function sl(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new sr(n,r,e)}function Qn(t){return t.toLowerCase()}class Qe{constructor(e,n){this.attribute=n,this.property=e}}Qe.prototype.attribute="";Qe.prototype.booleanish=!1;Qe.prototype.boolean=!1;Qe.prototype.commaOrSpaceSeparated=!1;Qe.prototype.commaSeparated=!1;Qe.prototype.defined=!1;Qe.prototype.mustUseProperty=!1;Qe.prototype.number=!1;Qe.prototype.overloadedBoolean=!1;Qe.prototype.property="";Qe.prototype.spaceSeparated=!1;Qe.prototype.space=void 0;let bm=0;const ne=Xt(),Le=Xt(),$i=Xt(),j=Xt(),ye=Xt(),ln=Xt(),et=Xt();function Xt(){return 2**++bm}const Zi=Object.freeze(Object.defineProperty({__proto__:null,boolean:ne,booleanish:Le,commaOrSpaceSeparated:et,commaSeparated:ln,number:j,overloadedBoolean:$i,spaceSeparated:ye},Symbol.toStringTag,{value:"Module"})),pi=Object.keys(Zi);class Ra extends Qe{constructor(e,n,r,i){let a=-1;if(super(e,n),Rs(this,"space",i),typeof r=="number")for(;++a<pi.length;){const s=pi[a];Rs(this,pi[a],(r&Zi[s])===Zi[s])}}}Ra.prototype.defined=!0;function Rs(t,e,n){n&&(t[e]=n)}function gn(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const a=new Ra(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),e[r]=a,n[Qn(r)]=r,n[Qn(a.attribute)]=r}return new sr(e,n,t.space)}const ul=gn({properties:{ariaActiveDescendant:null,ariaAtomic:Le,ariaAutoComplete:null,ariaBusy:Le,ariaChecked:Le,ariaColCount:j,ariaColIndex:j,ariaColSpan:j,ariaControls:ye,ariaCurrent:null,ariaDescribedBy:ye,ariaDetails:null,ariaDisabled:Le,ariaDropEffect:ye,ariaErrorMessage:null,ariaExpanded:Le,ariaFlowTo:ye,ariaGrabbed:Le,ariaHasPopup:null,ariaHidden:Le,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ye,ariaLevel:j,ariaLive:null,ariaModal:Le,ariaMultiLine:Le,ariaMultiSelectable:Le,ariaOrientation:null,ariaOwns:ye,ariaPlaceholder:null,ariaPosInSet:j,ariaPressed:Le,ariaReadOnly:Le,ariaRelevant:null,ariaRequired:Le,ariaRoleDescription:ye,ariaRowCount:j,ariaRowIndex:j,ariaRowSpan:j,ariaSelected:Le,ariaSetSize:j,ariaSort:null,ariaValueMax:j,ariaValueMin:j,ariaValueNow:j,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function ol(t,e){return e in t?t[e]:e}function ll(t,e){return ol(t,e.toLowerCase())}const Em=gn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ln,acceptCharset:ye,accessKey:ye,action:null,allow:null,allowFullScreen:ne,allowPaymentRequest:ne,allowUserMedia:ne,alt:null,as:null,async:ne,autoCapitalize:null,autoComplete:ye,autoFocus:ne,autoPlay:ne,blocking:ye,capture:null,charSet:null,checked:ne,cite:null,className:ye,cols:j,colSpan:null,content:null,contentEditable:Le,controls:ne,controlsList:ye,coords:j|ln,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ne,defer:ne,dir:null,dirName:null,disabled:ne,download:$i,draggable:Le,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ne,formTarget:null,headers:ye,height:j,hidden:$i,high:j,href:null,hrefLang:null,htmlFor:ye,httpEquiv:ye,id:null,imageSizes:null,imageSrcSet:null,inert:ne,inputMode:null,integrity:null,is:null,isMap:ne,itemId:null,itemProp:ye,itemRef:ye,itemScope:ne,itemType:ye,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ne,low:j,manifest:null,max:null,maxLength:j,media:null,method:null,min:null,minLength:j,multiple:ne,muted:ne,name:null,nonce:null,noModule:ne,noValidate:ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ne,optimum:j,pattern:null,ping:ye,placeholder:null,playsInline:ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ne,referrerPolicy:null,rel:ye,required:ne,reversed:ne,rows:j,rowSpan:j,sandbox:ye,scope:null,scoped:ne,seamless:ne,selected:ne,shadowRootClonable:ne,shadowRootDelegatesFocus:ne,shadowRootMode:null,shape:null,size:j,sizes:null,slot:null,span:j,spellCheck:Le,src:null,srcDoc:null,srcLang:null,srcSet:null,start:j,step:null,style:null,tabIndex:j,target:null,title:null,translate:null,type:null,typeMustMatch:ne,useMap:null,value:Le,width:j,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ye,axis:null,background:null,bgColor:null,border:j,borderColor:null,bottomMargin:j,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ne,declare:ne,event:null,face:null,frame:null,frameBorder:null,hSpace:j,leftMargin:j,link:null,longDesc:null,lowSrc:null,marginHeight:j,marginWidth:j,noResize:ne,noHref:ne,noShade:ne,noWrap:ne,object:null,profile:null,prompt:null,rev:null,rightMargin:j,rules:null,scheme:null,scrolling:Le,standby:null,summary:null,text:null,topMargin:j,valueType:null,version:null,vAlign:null,vLink:null,vSpace:j,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ne,disableRemotePlayback:ne,prefix:null,property:null,results:j,security:null,unselectable:null},space:"html",transform:ll}),Tm=gn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:et,accentHeight:j,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:j,amplitude:j,arabicForm:null,ascent:j,attributeName:null,attributeType:null,azimuth:j,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:j,by:null,calcMode:null,capHeight:j,className:ye,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:j,diffuseConstant:j,direction:null,display:null,dur:null,divisor:j,dominantBaseline:null,download:ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:j,enableBackground:null,end:null,event:null,exponent:j,externalResourcesRequired:null,fill:null,fillOpacity:j,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ln,g2:ln,glyphName:ln,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:j,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:j,horizOriginX:j,horizOriginY:j,id:null,ideographic:j,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:j,k:j,k1:j,k2:j,k3:j,k4:j,kernelMatrix:et,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:j,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:j,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:j,overlineThickness:j,paintOrder:null,panose1:null,path:null,pathLength:j,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ye,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:j,pointsAtY:j,pointsAtZ:j,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:et,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:et,rev:et,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:et,requiredFeatures:et,requiredFonts:et,requiredFormats:et,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:j,specularExponent:j,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:j,strikethroughThickness:j,string:null,stroke:null,strokeDashArray:et,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:j,strokeOpacity:j,strokeWidth:null,style:null,surfaceScale:j,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:et,tabIndex:j,tableValues:null,target:null,targetX:j,targetY:j,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:et,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:j,underlineThickness:j,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:j,values:null,vAlphabetic:j,vMathematical:j,vectorEffect:null,vHanging:j,vIdeographic:j,version:null,vertAdvY:j,vertOriginX:j,vertOriginY:j,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:j,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ol}),cl=gn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),dl=gn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ll}),fl=gn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),_m={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},xm=/[A-Z]/g,Os=/-[a-z]/g,ym=/^data[-\w.:]+$/i;function Kr(t,e){const n=Qn(e);let r=e,i=Qe;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ym.test(e)){if(e.charAt(4)==="-"){const a=e.slice(5).replace(Os,Am);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=e.slice(4);if(!Os.test(a)){let s=a.replace(xm,km);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=Ra}return new i(r,e)}function km(t){return"-"+t.toLowerCase()}function Am(t){return t.charAt(1).toUpperCase()}const ur=sl([ul,Em,cl,dl,fl],"html"),Bt=sl([ul,Tm,cl,dl,fl],"svg");function Ls(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function hl(t){return t.join(" ").trim()}var nn={},mi,Ds;function Cm(){if(Ds)return mi;Ds=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,u=/^\s+|\s+$/g,o=`
|
|
84
|
+
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+ht(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Vt=new dm;function he(t,e){return Vt.parse(t,e)}he.options=he.setOptions=function(t){return Vt.setOptions(t),he.defaults=Vt.defaults,Wo(he.defaults),he};he.getDefaults=ya;he.defaults=Kt;he.use=function(...t){return Vt.use(...t),he.defaults=Vt.defaults,Wo(he.defaults),he};he.walkTokens=function(t,e){return Vt.walkTokens(t,e)};he.parseInline=Vt.parseInline;he.Parser=Ct;he.parser=Ct.parse;he.Renderer=Mr;he.TextRenderer=va;he.Lexer=At;he.lexer=At.lex;he.Tokenizer=Pr;he.Hooks=Ar;he.parse=he;he.options;he.setOptions;he.use;he.walkTokens;he.parseInline;Ct.parse;At.lex;function Ns(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);const s=n.slice(i,r).trim();(s||!a)&&e.push(s),i=r+1,r=n.indexOf(",",i)}return e}function al(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const fm=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hm=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pm={};function ws(t,e){return(pm.jsx?hm:fm).test(t)}const mm=/[ \t\n\f\r]/g;function gm(t){return typeof t=="object"?t.type==="text"?vs(t.value):!1:vs(t)}function vs(t){return t.replace(mm,"")===""}class sr{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}sr.prototype.normal={};sr.prototype.property={};sr.prototype.space=void 0;function sl(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new sr(n,r,e)}function Qn(t){return t.toLowerCase()}class Qe{constructor(e,n){this.attribute=n,this.property=e}}Qe.prototype.attribute="";Qe.prototype.booleanish=!1;Qe.prototype.boolean=!1;Qe.prototype.commaOrSpaceSeparated=!1;Qe.prototype.commaSeparated=!1;Qe.prototype.defined=!1;Qe.prototype.mustUseProperty=!1;Qe.prototype.number=!1;Qe.prototype.overloadedBoolean=!1;Qe.prototype.property="";Qe.prototype.spaceSeparated=!1;Qe.prototype.space=void 0;let bm=0;const te=Xt(),Le=Xt(),$i=Xt(),j=Xt(),ye=Xt(),ln=Xt(),et=Xt();function Xt(){return 2**++bm}const Zi=Object.freeze(Object.defineProperty({__proto__:null,boolean:te,booleanish:Le,commaOrSpaceSeparated:et,commaSeparated:ln,number:j,overloadedBoolean:$i,spaceSeparated:ye},Symbol.toStringTag,{value:"Module"})),pi=Object.keys(Zi);class Ra extends Qe{constructor(e,n,r,i){let a=-1;if(super(e,n),Rs(this,"space",i),typeof r=="number")for(;++a<pi.length;){const s=pi[a];Rs(this,pi[a],(r&Zi[s])===Zi[s])}}}Ra.prototype.defined=!0;function Rs(t,e,n){n&&(t[e]=n)}function gn(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const a=new Ra(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),e[r]=a,n[Qn(r)]=r,n[Qn(a.attribute)]=r}return new sr(e,n,t.space)}const ul=gn({properties:{ariaActiveDescendant:null,ariaAtomic:Le,ariaAutoComplete:null,ariaBusy:Le,ariaChecked:Le,ariaColCount:j,ariaColIndex:j,ariaColSpan:j,ariaControls:ye,ariaCurrent:null,ariaDescribedBy:ye,ariaDetails:null,ariaDisabled:Le,ariaDropEffect:ye,ariaErrorMessage:null,ariaExpanded:Le,ariaFlowTo:ye,ariaGrabbed:Le,ariaHasPopup:null,ariaHidden:Le,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ye,ariaLevel:j,ariaLive:null,ariaModal:Le,ariaMultiLine:Le,ariaMultiSelectable:Le,ariaOrientation:null,ariaOwns:ye,ariaPlaceholder:null,ariaPosInSet:j,ariaPressed:Le,ariaReadOnly:Le,ariaRelevant:null,ariaRequired:Le,ariaRoleDescription:ye,ariaRowCount:j,ariaRowIndex:j,ariaRowSpan:j,ariaSelected:Le,ariaSetSize:j,ariaSort:null,ariaValueMax:j,ariaValueMin:j,ariaValueNow:j,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function ol(t,e){return e in t?t[e]:e}function ll(t,e){return ol(t,e.toLowerCase())}const Em=gn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ln,acceptCharset:ye,accessKey:ye,action:null,allow:null,allowFullScreen:te,allowPaymentRequest:te,allowUserMedia:te,alt:null,as:null,async:te,autoCapitalize:null,autoComplete:ye,autoFocus:te,autoPlay:te,blocking:ye,capture:null,charSet:null,checked:te,cite:null,className:ye,cols:j,colSpan:null,content:null,contentEditable:Le,controls:te,controlsList:ye,coords:j|ln,crossOrigin:null,data:null,dateTime:null,decoding:null,default:te,defer:te,dir:null,dirName:null,disabled:te,download:$i,draggable:Le,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:te,formTarget:null,headers:ye,height:j,hidden:$i,high:j,href:null,hrefLang:null,htmlFor:ye,httpEquiv:ye,id:null,imageSizes:null,imageSrcSet:null,inert:te,inputMode:null,integrity:null,is:null,isMap:te,itemId:null,itemProp:ye,itemRef:ye,itemScope:te,itemType:ye,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:te,low:j,manifest:null,max:null,maxLength:j,media:null,method:null,min:null,minLength:j,multiple:te,muted:te,name:null,nonce:null,noModule:te,noValidate:te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:te,optimum:j,pattern:null,ping:ye,placeholder:null,playsInline:te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:te,referrerPolicy:null,rel:ye,required:te,reversed:te,rows:j,rowSpan:j,sandbox:ye,scope:null,scoped:te,seamless:te,selected:te,shadowRootClonable:te,shadowRootDelegatesFocus:te,shadowRootMode:null,shape:null,size:j,sizes:null,slot:null,span:j,spellCheck:Le,src:null,srcDoc:null,srcLang:null,srcSet:null,start:j,step:null,style:null,tabIndex:j,target:null,title:null,translate:null,type:null,typeMustMatch:te,useMap:null,value:Le,width:j,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ye,axis:null,background:null,bgColor:null,border:j,borderColor:null,bottomMargin:j,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:te,declare:te,event:null,face:null,frame:null,frameBorder:null,hSpace:j,leftMargin:j,link:null,longDesc:null,lowSrc:null,marginHeight:j,marginWidth:j,noResize:te,noHref:te,noShade:te,noWrap:te,object:null,profile:null,prompt:null,rev:null,rightMargin:j,rules:null,scheme:null,scrolling:Le,standby:null,summary:null,text:null,topMargin:j,valueType:null,version:null,vAlign:null,vLink:null,vSpace:j,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:te,disableRemotePlayback:te,prefix:null,property:null,results:j,security:null,unselectable:null},space:"html",transform:ll}),Tm=gn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:et,accentHeight:j,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:j,amplitude:j,arabicForm:null,ascent:j,attributeName:null,attributeType:null,azimuth:j,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:j,by:null,calcMode:null,capHeight:j,className:ye,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:j,diffuseConstant:j,direction:null,display:null,dur:null,divisor:j,dominantBaseline:null,download:te,dx:null,dy:null,edgeMode:null,editable:null,elevation:j,enableBackground:null,end:null,event:null,exponent:j,externalResourcesRequired:null,fill:null,fillOpacity:j,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ln,g2:ln,glyphName:ln,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:j,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:j,horizOriginX:j,horizOriginY:j,id:null,ideographic:j,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:j,k:j,k1:j,k2:j,k3:j,k4:j,kernelMatrix:et,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:j,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:j,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:j,overlineThickness:j,paintOrder:null,panose1:null,path:null,pathLength:j,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ye,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:j,pointsAtY:j,pointsAtZ:j,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:et,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:et,rev:et,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:et,requiredFeatures:et,requiredFonts:et,requiredFormats:et,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:j,specularExponent:j,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:j,strikethroughThickness:j,string:null,stroke:null,strokeDashArray:et,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:j,strokeOpacity:j,strokeWidth:null,style:null,surfaceScale:j,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:et,tabIndex:j,tableValues:null,target:null,targetX:j,targetY:j,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:et,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:j,underlineThickness:j,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:j,values:null,vAlphabetic:j,vMathematical:j,vectorEffect:null,vHanging:j,vIdeographic:j,version:null,vertAdvY:j,vertOriginX:j,vertOriginY:j,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:j,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ol}),cl=gn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),dl=gn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ll}),fl=gn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),_m={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},xm=/[A-Z]/g,Os=/-[a-z]/g,ym=/^data[-\w.:]+$/i;function Kr(t,e){const n=Qn(e);let r=e,i=Qe;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ym.test(e)){if(e.charAt(4)==="-"){const a=e.slice(5).replace(Os,Am);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=e.slice(4);if(!Os.test(a)){let s=a.replace(xm,km);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=Ra}return new i(r,e)}function km(t){return"-"+t.toLowerCase()}function Am(t){return t.charAt(1).toUpperCase()}const ur=sl([ul,Em,cl,dl,fl],"html"),Bt=sl([ul,Tm,cl,dl,fl],"svg");function Ls(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function hl(t){return t.join(" ").trim()}var nn={},mi,Ds;function Cm(){if(Ds)return mi;Ds=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,u=/^\s+|\s+$/g,o=`
|
|
85
85
|
`,l="/",f="*",d="",p="comment",h="declaration";function m(x,T){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];T=T||{};var k=1,b=1;function N(q){var z=q.match(e);z&&(k+=z.length);var Q=q.lastIndexOf(o);b=~Q?q.length-Q:b+q.length}function v(){var q={line:k,column:b};return function(z){return z.position=new C(q),F(),z}}function C(q){this.start=q,this.end={line:k,column:b},this.source=T.source}C.prototype.content=x;function L(q){var z=new Error(T.source+":"+k+":"+b+": "+q);if(z.reason=q,z.filename=T.source,z.line=k,z.column=b,z.source=x,!T.silent)throw z}function M(q){var z=q.exec(x);if(z){var Q=z[0];return N(Q),x=x.slice(Q.length),z}}function F(){M(n)}function w(q){var z;for(q=q||[];z=B();)z!==!1&&q.push(z);return q}function B(){var q=v();if(!(l!=x.charAt(0)||f!=x.charAt(1))){for(var z=2;d!=x.charAt(z)&&(f!=x.charAt(z)||l!=x.charAt(z+1));)++z;if(z+=2,d===x.charAt(z-1))return L("End of comment missing");var Q=x.slice(2,z-2);return b+=2,N(Q),x=x.slice(z),b+=2,q({type:p,comment:Q})}}function $(){var q=v(),z=M(r);if(z){if(B(),!M(i))return L("property missing ':'");var Q=M(a),ie=q({type:h,property:E(z[0].replace(t,d)),value:Q?E(Q[0].replace(t,d)):d});return M(s),ie}}function J(){var q=[];w(q);for(var z;z=$();)z!==!1&&(q.push(z),w(q));return q}return F(),J()}function E(x){return x?x.replace(u,d):d}return mi=m,mi}var Ps;function Im(){if(Ps)return nn;Ps=1;var t=nn&&nn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(nn,"__esModule",{value:!0}),nn.default=n;const e=t(Cm());function n(r,i){let a=null;if(!r||typeof r!="string")return a;const s=(0,e.default)(r),u=typeof i=="function";return s.forEach(o=>{if(o.type!=="declaration")return;const{property:l,value:f}=o;u?i(l,f,o):f&&(a=a||{},a[l]=f)}),a}return nn}var Sn={},Ms;function Sm(){if(Ms)return Sn;Ms=1,Object.defineProperty(Sn,"__esModule",{value:!0}),Sn.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(l){return!l||n.test(l)||t.test(l)},s=function(l,f){return f.toUpperCase()},u=function(l,f){return"".concat(f,"-")},o=function(l,f){return f===void 0&&(f={}),a(l)?l:(l=l.toLowerCase(),f.reactCompat?l=l.replace(i,u):l=l.replace(r,u),l.replace(e,s))};return Sn.camelCase=o,Sn}var Nn,Bs;function Nm(){if(Bs)return Nn;Bs=1;var t=Nn&&Nn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(Im()),n=Sm();function r(i,a){var s={};return!i||typeof i!="string"||(0,e.default)(i,function(u,o){u&&o&&(s[(0,n.camelCase)(u,a)]=o)}),s}return r.default=r,Nn=r,Nn}var wm=Nm();const vm=ba(wm),Xr=pl("end"),Et=pl("start");function pl(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Rm(t){const e=Et(t),n=Xr(t);if(e&&n)return{start:e,end:n}}function Hn(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Fs(t.position):"start"in t||"end"in t?Fs(t):"line"in t||"column"in t?Yi(t):""}function Yi(t){return Us(t&&t.line)+":"+Us(t&&t.column)}function Fs(t){return Yi(t&&t.start)+"-"+Yi(t&&t.end)}function Us(t){return t&&typeof t=="number"?t:1}class Fe extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},s=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof e=="string"?i=e:!a.cause&&e&&(s=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r=="string"){const o=r.indexOf(":");o===-1?a.ruleId=r:(a.source=r.slice(0,o),a.ruleId=r.slice(o+1))}if(!a.place&&a.ancestors&&a.ancestors){const o=a.ancestors[a.ancestors.length-1];o&&(a.place=o.position)}const u=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=Hn(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Fe.prototype.file="";Fe.prototype.name="";Fe.prototype.reason="";Fe.prototype.message="";Fe.prototype.stack="";Fe.prototype.column=void 0;Fe.prototype.line=void 0;Fe.prototype.ancestors=void 0;Fe.prototype.cause=void 0;Fe.prototype.fatal=void 0;Fe.prototype.place=void 0;Fe.prototype.ruleId=void 0;Fe.prototype.source=void 0;const Oa={}.hasOwnProperty,Om=new Map,Lm=/[A-Z]/g,Dm=new Set(["table","tbody","thead","tfoot","tr"]),Pm=new Set(["td","th"]),ml="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Mm(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Zm(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=$m(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Bt:ur,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},a=gl(i,t,void 0);return a&&typeof a!="string"?a:i.create(t,i.Fragment,{children:a||void 0},void 0)}function gl(t,e,n){if(e.type==="element")return Bm(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Fm(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Hm(t,e,n);if(e.type==="mdxjsEsm")return Um(t,e);if(e.type==="root")return zm(t,e,n);if(e.type==="text")return jm(t,e)}function Bm(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Bt,t.schema=i),t.ancestors.push(e);const a=El(t,e.tagName,!1),s=Ym(t,e);let u=Da(t,e);return Dm.has(e.tagName)&&(u=u.filter(function(o){return typeof o=="string"?!gm(o):!0})),bl(t,s,a,e),La(s,u),t.ancestors.pop(),t.schema=r,t.create(e,a,s,n)}function Fm(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Kn(t,e.position)}function Um(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Kn(t,e.position)}function Hm(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Bt,t.schema=i),t.ancestors.push(e);const a=e.name===null?t.Fragment:El(t,e.name,!0),s=qm(t,e),u=Da(t,e);return bl(t,s,a,e),La(s,u),t.ancestors.pop(),t.schema=r,t.create(e,a,s,n)}function zm(t,e,n){const r={};return La(r,Da(t,e)),t.create(e,t.Fragment,r,n)}function jm(t,e){return e.value}function bl(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function La(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function $m(t,e,n){return r;function r(i,a,s,u){const l=Array.isArray(s.children)?n:e;return u?l(a,s,u):l(a,s)}}function Zm(t,e){return n;function n(r,i,a,s){const u=Array.isArray(a.children),o=Et(r);return e(i,a,s,u,{columnNumber:o?o.column-1:void 0,fileName:t,lineNumber:o?o.line:void 0},void 0)}}function Ym(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Oa.call(e.properties,i)){const a=Vm(t,i,e.properties[i]);if(a){const[s,u]=a;t.tableCellAlignToStyle&&s==="align"&&typeof u=="string"&&Pm.has(e.tagName)?r=u:n[s]=u}}if(r){const a=n.style||(n.style={});a[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function qm(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const a=r.data.estree.body[0];a.type;const s=a.expression;s.type;const u=s.properties[0];u.type,Object.assign(n,t.evaluater.evaluateExpression(u.argument))}else Kn(t,e.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const u=r.value.data.estree.body[0];u.type,a=t.evaluater.evaluateExpression(u.expression)}else Kn(t,e.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Da(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:Om;for(;++r<e.children.length;){const a=e.children[r];let s;if(t.passKeys){const o=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(o){const l=i.get(o)||0;s=o+"-"+l,i.set(o,l+1)}}const u=gl(t,a,s);u!==void 0&&n.push(u)}return n}function Vm(t,e,n){const r=Kr(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?al(n):hl(n)),r.property==="style"){let i=typeof n=="object"?n:Wm(t,String(n));return t.stylePropertyNameCase==="css"&&(i=Gm(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?_m[r.property]||r.property:r.attribute,n]}}function Wm(t,e){try{return vm(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new Fe("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=ml+"#cannot-parse-style-attribute",i}}function El(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let a=-1,s;for(;++a<i.length;){const u=ws(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};s=s?{type:"MemberExpression",object:s,property:u,computed:!!(a&&u.type==="Literal"),optional:!1}:u}r=s}else r=ws(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return Oa.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);Kn(t)}function Kn(t,e){const n=new Fe("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=ml+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Gm(t){const e={};let n;for(n in t)Oa.call(t,n)&&(e[Qm(n)]=t[n]);return e}function Qm(t){let e=t.replace(Lm,Km);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Km(t){return"-"+t.toLowerCase()}const gi={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Xm={};function Pa(t,e){const n=Xm,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Tl(t,r,i)}function Tl(t,e,n){if(Jm(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Hs(t.children,e,n)}return Array.isArray(t)?Hs(t,e,n):""}function Hs(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=Tl(t[i],e,n);return r.join("")}function Jm(t){return!!(t&&typeof t=="object")}const zs=document.createElement("i");function Ma(t){const e="&"+t+";";zs.innerHTML=e;const n=zs.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function tt(t,e,n,r){const i=t.length;let a=0,s;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);a<r.length;)s=r.slice(a,a+1e4),s.unshift(e,0),t.splice(...s),a+=1e4,e+=1e4}function at(t,e){return t.length>0?(tt(t,t.length,0,e),t):e}const js={}.hasOwnProperty;function _l(t){const e={};let n=-1;for(;++n<t.length;)e1(e,t[n]);return e}function e1(t,e){let n;for(n in e){const i=(js.call(t,n)?t[n]:void 0)||(t[n]={}),a=e[n];let s;if(a)for(s in a){js.call(i,s)||(i[s]=[]);const u=a[s];t1(i[s],Array.isArray(u)?u:u?[u]:[])}}}function t1(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);tt(t,0,0,r)}function xl(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function dt(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $e=Ft(/[A-Za-z]/),Be=Ft(/[\dA-Za-z]/),n1=Ft(/[#-'*+\--9=?A-Z^-~]/);function Br(t){return t!==null&&(t<32||t===127)}const qi=Ft(/\d/),r1=Ft(/[\dA-Fa-f]/),i1=Ft(/[!-/:-@[-`{-~]/);function K(t){return t!==null&&t<-2}function xe(t){return t!==null&&(t<0||t===32)}function se(t){return t===-2||t===-1||t===32}const Jr=Ft(new RegExp("\\p{P}|\\p{S}","u")),Wt=Ft(/\s/);function Ft(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function bn(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const a=t.charCodeAt(n);let s="";if(a===37&&Be(t.charCodeAt(n+1))&&Be(t.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(s=String.fromCharCode(a));else if(a>55295&&a<57344){const u=t.charCodeAt(n+1);a<56320&&u>56319&&u<57344?(s=String.fromCharCode(a,u),i=1):s="�"}else s=String.fromCharCode(a);s&&(e.push(t.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function le(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return s;function s(o){return se(o)?(t.enter(n),u(o)):e(o)}function u(o){return se(o)&&a++<i?(t.consume(o),u):(t.exit(n),e(o))}}const a1={tokenize:s1};function s1(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),le(t,e,"linePrefix")}function i(u){return t.enter("paragraph"),a(u)}function a(u){const o=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=o),n=o,s(u)}function s(u){if(u===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(u);return}return K(u)?(t.consume(u),t.exit("chunkText"),a):(t.consume(u),s)}}const u1={tokenize:o1},$s={tokenize:l1};function o1(t){const e=this,n=[];let r=0,i,a,s;return u;function u(b){if(r<n.length){const N=n[r];return e.containerState=N[1],t.attempt(N[0].continuation,o,l)(b)}return l(b)}function o(b){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&k();const N=e.events.length;let v=N,C;for(;v--;)if(e.events[v][0]==="exit"&&e.events[v][1].type==="chunkFlow"){C=e.events[v][1].end;break}T(r);let L=N;for(;L<e.events.length;)e.events[L][1].end={...C},L++;return tt(e.events,v+1,0,e.events.slice(N)),e.events.length=L,l(b)}return u(b)}function l(b){if(r===n.length){if(!i)return p(b);if(i.currentConstruct&&i.currentConstruct.concrete)return m(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check($s,f,d)(b)}function f(b){return i&&k(),T(r),p(b)}function d(b){return e.parser.lazy[e.now().line]=r!==n.length,s=e.now().offset,m(b)}function p(b){return e.containerState={},t.attempt($s,h,m)(b)}function h(b){return r++,n.push([e.currentConstruct,e.containerState]),p(b)}function m(b){if(b===null){i&&k(),T(0),t.consume(b);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),E(b)}function E(b){if(b===null){x(t.exit("chunkFlow"),!0),T(0),t.consume(b);return}return K(b)?(t.consume(b),x(t.exit("chunkFlow")),r=0,e.interrupt=void 0,u):(t.consume(b),E)}function x(b,N){const v=e.sliceStream(b);if(N&&v.push(null),b.previous=a,a&&(a.next=b),a=b,i.defineSkip(b.start),i.write(v),e.parser.lazy[b.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<s&&(!i.events[C][1].end||i.events[C][1].end.offset>s))return;const L=e.events.length;let M=L,F,w;for(;M--;)if(e.events[M][0]==="exit"&&e.events[M][1].type==="chunkFlow"){if(F){w=e.events[M][1].end;break}F=!0}for(T(r),C=L;C<e.events.length;)e.events[C][1].end={...w},C++;tt(e.events,M+1,0,e.events.slice(L)),e.events.length=C}}function T(b){let N=n.length;for(;N-- >b;){const v=n[N];e.containerState=v[1],v[0].exit.call(e,t)}n.length=b}function k(){i.write([null]),a=void 0,i=void 0,e.containerState._closeFlow=void 0}}function l1(t,e,n){return le(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function cn(t){if(t===null||xe(t)||Wt(t))return 1;if(Jr(t))return 2}function ei(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const a=t[i].resolveAll;a&&!r.includes(a)&&(e=a(e,n),r.push(a))}return e}const Vi={name:"attention",resolveAll:c1,tokenize:d1};function c1(t,e){let n=-1,r,i,a,s,u,o,l,f;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;o=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const d={...t[r][1].end},p={...t[n][1].start};Zs(d,-o),Zs(p,o),s={type:o>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},u={type:o>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},a={type:o>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:o>1?"strong":"emphasis",start:{...s.start},end:{...u.end}},t[r][1].end={...s.start},t[n][1].start={...u.end},l=[],t[r][1].end.offset-t[r][1].start.offset&&(l=at(l,[["enter",t[r][1],e],["exit",t[r][1],e]])),l=at(l,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",a,e]]),l=at(l,ei(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),l=at(l,[["exit",a,e],["enter",u,e],["exit",u,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,l=at(l,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,tt(t,r-1,n-r+3,l),n=r+l.length-f-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function d1(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=cn(r);let a;return s;function s(o){return a=o,t.enter("attentionSequence"),u(o)}function u(o){if(o===a)return t.consume(o),u;const l=t.exit("attentionSequence"),f=cn(o),d=!f||f===2&&i||n.includes(o),p=!i||i===2&&f||n.includes(r);return l._open=!!(a===42?d:d&&(i||!p)),l._close=!!(a===42?p:p&&(f||!d)),e(o)}}function Zs(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const f1={name:"autolink",tokenize:h1};function h1(t,e,n){let r=0;return i;function i(h){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),a}function a(h){return $e(h)?(t.consume(h),s):h===64?n(h):l(h)}function s(h){return h===43||h===45||h===46||Be(h)?(r=1,u(h)):l(h)}function u(h){return h===58?(t.consume(h),r=0,o):(h===43||h===45||h===46||Be(h))&&r++<32?(t.consume(h),u):(r=0,l(h))}function o(h){return h===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.exit("autolink"),e):h===null||h===32||h===60||Br(h)?n(h):(t.consume(h),o)}function l(h){return h===64?(t.consume(h),f):n1(h)?(t.consume(h),l):n(h)}function f(h){return Be(h)?d(h):n(h)}function d(h){return h===46?(t.consume(h),r=0,f):h===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.exit("autolink"),e):p(h)}function p(h){if((h===45||Be(h))&&r++<63){const m=h===45?p:d;return t.consume(h),m}return n(h)}}const or={partial:!0,tokenize:p1};function p1(t,e,n){return r;function r(a){return se(a)?le(t,i,"linePrefix")(a):i(a)}function i(a){return a===null||K(a)?e(a):n(a)}}const yl={continuation:{tokenize:g1},exit:b1,name:"blockQuote",tokenize:m1};function m1(t,e,n){const r=this;return i;function i(s){if(s===62){const u=r.containerState;return u.open||(t.enter("blockQuote",{_container:!0}),u.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),a}return n(s)}function a(s){return se(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}function g1(t,e,n){const r=this;return i;function i(s){return se(s)?le(t,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):a(s)}function a(s){return t.attempt(yl,e,n)(s)}}function b1(t){t.exit("blockQuote")}const kl={name:"characterEscape",tokenize:E1};function E1(t,e,n){return r;function r(a){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(a),t.exit("escapeMarker"),i}function i(a){return i1(a)?(t.enter("characterEscapeValue"),t.consume(a),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(a)}}const Al={name:"characterReference",tokenize:T1};function T1(t,e,n){const r=this;let i=0,a,s;return u;function u(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),o}function o(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),a=31,s=Be,f(d))}function l(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),a=6,s=r1,f):(t.enter("characterReferenceValue"),a=7,s=qi,f(d))}function f(d){if(d===59&&i){const p=t.exit("characterReferenceValue");return s===Be&&!Ma(r.sliceSerialize(p))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return s(d)&&i++<a?(t.consume(d),f):n(d)}}const Ys={partial:!0,tokenize:x1},qs={concrete:!0,name:"codeFenced",tokenize:_1};function _1(t,e,n){const r=this,i={partial:!0,tokenize:v};let a=0,s=0,u;return o;function o(C){return l(C)}function l(C){const L=r.events[r.events.length-1];return a=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,u=C,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),f(C)}function f(C){return C===u?(s++,t.consume(C),f):s<3?n(C):(t.exit("codeFencedFenceSequence"),se(C)?le(t,d,"whitespace")(C):d(C))}function d(C){return C===null||K(C)?(t.exit("codeFencedFence"),r.interrupt?e(C):t.check(Ys,E,N)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||K(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(C)):se(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),le(t,h,"whitespace")(C)):C===96&&C===u?n(C):(t.consume(C),p)}function h(C){return C===null||K(C)?d(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||K(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(C)):C===96&&C===u?n(C):(t.consume(C),m)}function E(C){return t.attempt(i,N,x)(C)}function x(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),T}function T(C){return a>0&&se(C)?le(t,k,"linePrefix",a+1)(C):k(C)}function k(C){return C===null||K(C)?t.check(Ys,E,N)(C):(t.enter("codeFlowValue"),b(C))}function b(C){return C===null||K(C)?(t.exit("codeFlowValue"),k(C)):(t.consume(C),b)}function N(C){return t.exit("codeFenced"),e(C)}function v(C,L,M){let F=0;return w;function w(z){return C.enter("lineEnding"),C.consume(z),C.exit("lineEnding"),B}function B(z){return C.enter("codeFencedFence"),se(z)?le(C,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):$(z)}function $(z){return z===u?(C.enter("codeFencedFenceSequence"),J(z)):M(z)}function J(z){return z===u?(F++,C.consume(z),J):F>=s?(C.exit("codeFencedFenceSequence"),se(z)?le(C,q,"whitespace")(z):q(z)):M(z)}function q(z){return z===null||K(z)?(C.exit("codeFencedFence"),L(z)):M(z)}}}function x1(t,e,n){const r=this;return i;function i(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),a)}function a(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}const bi={name:"codeIndented",tokenize:k1},y1={partial:!0,tokenize:A1};function k1(t,e,n){const r=this;return i;function i(l){return t.enter("codeIndented"),le(t,a,"linePrefix",5)(l)}function a(l){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?o(l):K(l)?t.attempt(y1,s,o)(l):(t.enter("codeFlowValue"),u(l))}function u(l){return l===null||K(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),u)}function o(l){return t.exit("codeIndented"),e(l)}}function A1(t,e,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):K(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):le(t,a,"linePrefix",5)(s)}function a(s){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(s):K(s)?i(s):n(s)}}const C1={name:"codeText",previous:S1,resolve:I1,tokenize:N1};function I1(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function S1(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function N1(t,e,n){let r=0,i,a;return s;function s(d){return t.enter("codeText"),t.enter("codeTextSequence"),u(d)}function u(d){return d===96?(t.consume(d),r++,u):(t.exit("codeTextSequence"),o(d))}function o(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),o):d===96?(a=t.enter("codeTextSequence"),i=0,f(d)):K(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),o):(t.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||K(d)?(t.exit("codeTextData"),o(d)):(t.consume(d),l)}function f(d){return d===96?(t.consume(d),i++,f):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(a.type="codeTextData",l(d))}}class w1{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&wn(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),wn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);wn(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);wn(this.left,n.reverse())}}}function wn(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Cl(t){const e={};let n=-1,r,i,a,s,u,o,l;const f=new w1(t);for(;++n<f.length;){for(;n in e;)n=e[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(o=r[1]._tokenizer.events,a=0,a<o.length&&o[a][1].type==="lineEndingBlank"&&(a+=2),a<o.length&&o[a][1].type==="content"))for(;++a<o.length&&o[a][1].type!=="content";)o[a][1].type==="chunkText"&&(o[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,v1(f,n)),n=e[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(s=f.get(a),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=a);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},u=f.slice(i,n),u.unshift(r),f.splice(i,n-i+1,u))}}return tt(t,0,Number.POSITIVE_INFINITY,f.slice(0)),!l}function v1(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const a=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const u=s.events,o=[],l={};let f,d,p=-1,h=n,m=0,E=0;const x=[E];for(;h;){for(;t.get(++i)[1]!==h;);a.push(i),h._tokenizer||(f=r.sliceStream(h),h.next||f.push(null),d&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(f),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++p<u.length;)u[p][0]==="exit"&&u[p-1][0]==="enter"&&u[p][1].type===u[p-1][1].type&&u[p][1].start.line!==u[p][1].end.line&&(E=p+1,x.push(E),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):x.pop(),p=x.length;p--;){const T=u.slice(x[p],x[p+1]),k=a.pop();o.push([k,k+T.length-1]),t.splice(k,2,T)}for(o.reverse(),p=-1;++p<o.length;)l[m+o[p][0]]=m+o[p][1],m+=o[p][1]-o[p][0]-1;return l}const R1={resolve:L1,tokenize:D1},O1={partial:!0,tokenize:P1};function L1(t){return Cl(t),t}function D1(t,e){let n;return r;function r(u){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?a(u):K(u)?t.check(O1,s,a)(u):(t.consume(u),i)}function a(u){return t.exit("chunkContent"),t.exit("content"),e(u)}function s(u){return t.consume(u),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function P1(t,e,n){const r=this;return i;function i(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),le(t,a,"linePrefix")}function a(s){if(s===null||K(s))return n(s);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function Il(t,e,n,r,i,a,s,u,o){const l=o||Number.POSITIVE_INFINITY;let f=0;return d;function d(T){return T===60?(t.enter(r),t.enter(i),t.enter(a),t.consume(T),t.exit(a),p):T===null||T===32||T===41||Br(T)?n(T):(t.enter(r),t.enter(s),t.enter(u),t.enter("chunkString",{contentType:"string"}),E(T))}function p(T){return T===62?(t.enter(a),t.consume(T),t.exit(a),t.exit(i),t.exit(r),e):(t.enter(u),t.enter("chunkString",{contentType:"string"}),h(T))}function h(T){return T===62?(t.exit("chunkString"),t.exit(u),p(T)):T===null||T===60||K(T)?n(T):(t.consume(T),T===92?m:h)}function m(T){return T===60||T===62||T===92?(t.consume(T),h):h(T)}function E(T){return!f&&(T===null||T===41||xe(T))?(t.exit("chunkString"),t.exit(u),t.exit(s),t.exit(r),e(T)):f<l&&T===40?(t.consume(T),f++,E):T===41?(t.consume(T),f--,E):T===null||T===32||T===40||Br(T)?n(T):(t.consume(T),T===92?x:E)}function x(T){return T===40||T===41||T===92?(t.consume(T),E):E(T)}}function Sl(t,e,n,r,i,a){const s=this;let u=0,o;return l;function l(h){return t.enter(r),t.enter(i),t.consume(h),t.exit(i),t.enter(a),f}function f(h){return u>999||h===null||h===91||h===93&&!o||h===94&&!u&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(t.exit(a),t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):K(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||K(h)||u++>999?(t.exit("chunkString"),f(h)):(t.consume(h),o||(o=!se(h)),h===92?p:d)}function p(h){return h===91||h===92||h===93?(t.consume(h),u++,d):d(h)}}function Nl(t,e,n,r,i,a){let s;return u;function u(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),s=p===40?41:p,o):n(p)}function o(p){return p===s?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(a),l(p))}function l(p){return p===s?(t.exit(a),o(s)):p===null?n(p):K(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),le(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===s||p===null||K(p)?(t.exit("chunkString"),l(p)):(t.consume(p),p===92?d:f)}function d(p){return p===s||p===92?(t.consume(p),f):f(p)}}function zn(t,e){let n;return r;function r(i){return K(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):se(i)?le(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const M1={name:"definition",tokenize:F1},B1={partial:!0,tokenize:U1};function F1(t,e,n){const r=this;let i;return a;function a(h){return t.enter("definition"),s(h)}function s(h){return Sl.call(r,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function u(h){return i=dt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),o):n(h)}function o(h){return xe(h)?zn(t,l)(h):l(h)}function l(h){return Il(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return t.attempt(B1,d,d)(h)}function d(h){return se(h)?le(t,p,"whitespace")(h):p(h)}function p(h){return h===null||K(h)?(t.exit("definition"),r.parser.defined.push(i),e(h)):n(h)}}function U1(t,e,n){return r;function r(u){return xe(u)?zn(t,i)(u):n(u)}function i(u){return Nl(t,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function a(u){return se(u)?le(t,s,"whitespace")(u):s(u)}function s(u){return u===null||K(u)?e(u):n(u)}}const H1={name:"hardBreakEscape",tokenize:z1};function z1(t,e,n){return r;function r(a){return t.enter("hardBreakEscape"),t.consume(a),i}function i(a){return K(a)?(t.exit("hardBreakEscape"),e(a)):n(a)}}const j1={name:"headingAtx",resolve:$1,tokenize:Z1};function $1(t,e){let n=t.length-2,r=3,i,a;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},a={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},tt(t,r,n-r+1,[["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e]])),t}function Z1(t,e,n){let r=0;return i;function i(f){return t.enter("atxHeading"),a(f)}function a(f){return t.enter("atxHeadingSequence"),s(f)}function s(f){return f===35&&r++<6?(t.consume(f),s):f===null||xe(f)?(t.exit("atxHeadingSequence"),u(f)):n(f)}function u(f){return f===35?(t.enter("atxHeadingSequence"),o(f)):f===null||K(f)?(t.exit("atxHeading"),e(f)):se(f)?le(t,u,"whitespace")(f):(t.enter("atxHeadingText"),l(f))}function o(f){return f===35?(t.consume(f),o):(t.exit("atxHeadingSequence"),u(f))}function l(f){return f===null||f===35||xe(f)?(t.exit("atxHeadingText"),u(f)):(t.consume(f),l)}}const Y1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Vs=["pre","script","style","textarea"],q1={concrete:!0,name:"htmlFlow",resolveTo:G1,tokenize:Q1},V1={partial:!0,tokenize:X1},W1={partial:!0,tokenize:K1};function G1(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Q1(t,e,n){const r=this;let i,a,s,u,o;return l;function l(S){return f(S)}function f(S){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(S),d}function d(S){return S===33?(t.consume(S),p):S===47?(t.consume(S),a=!0,E):S===63?(t.consume(S),i=3,r.interrupt?e:I):$e(S)?(t.consume(S),s=String.fromCharCode(S),x):n(S)}function p(S){return S===45?(t.consume(S),i=2,h):S===91?(t.consume(S),i=5,u=0,m):$e(S)?(t.consume(S),i=4,r.interrupt?e:I):n(S)}function h(S){return S===45?(t.consume(S),r.interrupt?e:I):n(S)}function m(S){const ce="CDATA[";return S===ce.charCodeAt(u++)?(t.consume(S),u===ce.length?r.interrupt?e:$:m):n(S)}function E(S){return $e(S)?(t.consume(S),s=String.fromCharCode(S),x):n(S)}function x(S){if(S===null||S===47||S===62||xe(S)){const ce=S===47,me=s.toLowerCase();return!ce&&!a&&Vs.includes(me)?(i=1,r.interrupt?e(S):$(S)):Y1.includes(s.toLowerCase())?(i=6,ce?(t.consume(S),T):r.interrupt?e(S):$(S)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):a?k(S):b(S))}return S===45||Be(S)?(t.consume(S),s+=String.fromCharCode(S),x):n(S)}function T(S){return S===62?(t.consume(S),r.interrupt?e:$):n(S)}function k(S){return se(S)?(t.consume(S),k):w(S)}function b(S){return S===47?(t.consume(S),w):S===58||S===95||$e(S)?(t.consume(S),N):se(S)?(t.consume(S),b):w(S)}function N(S){return S===45||S===46||S===58||S===95||Be(S)?(t.consume(S),N):v(S)}function v(S){return S===61?(t.consume(S),C):se(S)?(t.consume(S),v):b(S)}function C(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(t.consume(S),o=S,L):se(S)?(t.consume(S),C):M(S)}function L(S){return S===o?(t.consume(S),o=null,F):S===null||K(S)?n(S):(t.consume(S),L)}function M(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||xe(S)?v(S):(t.consume(S),M)}function F(S){return S===47||S===62||se(S)?b(S):n(S)}function w(S){return S===62?(t.consume(S),B):n(S)}function B(S){return S===null||K(S)?$(S):se(S)?(t.consume(S),B):n(S)}function $(S){return S===45&&i===2?(t.consume(S),Q):S===60&&i===1?(t.consume(S),ie):S===62&&i===4?(t.consume(S),Ie):S===63&&i===3?(t.consume(S),I):S===93&&i===5?(t.consume(S),Re):K(S)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(V1,Ee,J)(S)):S===null||K(S)?(t.exit("htmlFlowData"),J(S)):(t.consume(S),$)}function J(S){return t.check(W1,q,Ee)(S)}function q(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),z}function z(S){return S===null||K(S)?J(S):(t.enter("htmlFlowData"),$(S))}function Q(S){return S===45?(t.consume(S),I):$(S)}function ie(S){return S===47?(t.consume(S),s="",be):$(S)}function be(S){if(S===62){const ce=s.toLowerCase();return Vs.includes(ce)?(t.consume(S),Ie):$(S)}return $e(S)&&s.length<8?(t.consume(S),s+=String.fromCharCode(S),be):$(S)}function Re(S){return S===93?(t.consume(S),I):$(S)}function I(S){return S===62?(t.consume(S),Ie):S===45&&i===2?(t.consume(S),I):$(S)}function Ie(S){return S===null||K(S)?(t.exit("htmlFlowData"),Ee(S)):(t.consume(S),Ie)}function Ee(S){return t.exit("htmlFlow"),e(S)}}function K1(t,e,n){const r=this;return i;function i(s){return K(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),a):n(s)}function a(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function X1(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(or,e,n)}}const J1={name:"htmlText",tokenize:eg};function eg(t,e,n){const r=this;let i,a,s;return u;function u(I){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(I),o}function o(I){return I===33?(t.consume(I),l):I===47?(t.consume(I),v):I===63?(t.consume(I),b):$e(I)?(t.consume(I),M):n(I)}function l(I){return I===45?(t.consume(I),f):I===91?(t.consume(I),a=0,m):$e(I)?(t.consume(I),k):n(I)}function f(I){return I===45?(t.consume(I),h):n(I)}function d(I){return I===null?n(I):I===45?(t.consume(I),p):K(I)?(s=d,ie(I)):(t.consume(I),d)}function p(I){return I===45?(t.consume(I),h):d(I)}function h(I){return I===62?Q(I):I===45?p(I):d(I)}function m(I){const Ie="CDATA[";return I===Ie.charCodeAt(a++)?(t.consume(I),a===Ie.length?E:m):n(I)}function E(I){return I===null?n(I):I===93?(t.consume(I),x):K(I)?(s=E,ie(I)):(t.consume(I),E)}function x(I){return I===93?(t.consume(I),T):E(I)}function T(I){return I===62?Q(I):I===93?(t.consume(I),T):E(I)}function k(I){return I===null||I===62?Q(I):K(I)?(s=k,ie(I)):(t.consume(I),k)}function b(I){return I===null?n(I):I===63?(t.consume(I),N):K(I)?(s=b,ie(I)):(t.consume(I),b)}function N(I){return I===62?Q(I):b(I)}function v(I){return $e(I)?(t.consume(I),C):n(I)}function C(I){return I===45||Be(I)?(t.consume(I),C):L(I)}function L(I){return K(I)?(s=L,ie(I)):se(I)?(t.consume(I),L):Q(I)}function M(I){return I===45||Be(I)?(t.consume(I),M):I===47||I===62||xe(I)?F(I):n(I)}function F(I){return I===47?(t.consume(I),Q):I===58||I===95||$e(I)?(t.consume(I),w):K(I)?(s=F,ie(I)):se(I)?(t.consume(I),F):Q(I)}function w(I){return I===45||I===46||I===58||I===95||Be(I)?(t.consume(I),w):B(I)}function B(I){return I===61?(t.consume(I),$):K(I)?(s=B,ie(I)):se(I)?(t.consume(I),B):F(I)}function $(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),i=I,J):K(I)?(s=$,ie(I)):se(I)?(t.consume(I),$):(t.consume(I),q)}function J(I){return I===i?(t.consume(I),i=void 0,z):I===null?n(I):K(I)?(s=J,ie(I)):(t.consume(I),J)}function q(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||xe(I)?F(I):(t.consume(I),q)}function z(I){return I===47||I===62||xe(I)?F(I):n(I)}function Q(I){return I===62?(t.consume(I),t.exit("htmlTextData"),t.exit("htmlText"),e):n(I)}function ie(I){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),be}function be(I){return se(I)?le(t,Re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):Re(I)}function Re(I){return t.enter("htmlTextData"),s(I)}}const Ba={name:"labelEnd",resolveAll:ig,resolveTo:ag,tokenize:sg},tg={tokenize:ug},ng={tokenize:og},rg={tokenize:lg};function ig(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&tt(t,0,t.length,n),t}function ag(t,e){let n=t.length,r=0,i,a,s,u;for(;n--;)if(i=t[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const o={type:t[a][1].type==="labelLink"?"link":"image",start:{...t[a][1].start},end:{...t[t.length-1][1].end}},l={type:"label",start:{...t[a][1].start},end:{...t[s][1].end}},f={type:"labelText",start:{...t[a+r+2][1].end},end:{...t[s-2][1].start}};return u=[["enter",o,e],["enter",l,e]],u=at(u,t.slice(a+1,a+r+3)),u=at(u,[["enter",f,e]]),u=at(u,ei(e.parser.constructs.insideSpan.null,t.slice(a+r+4,s-3),e)),u=at(u,[["exit",f,e],t[s-2],t[s-1],["exit",l,e]]),u=at(u,t.slice(s+1)),u=at(u,[["exit",o,e]]),tt(t,a,t.length,u),t}function sg(t,e,n){const r=this;let i=r.events.length,a,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return u;function u(p){return a?a._inactive?d(p):(s=r.parser.defined.includes(dt(r.sliceSerialize({start:a.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),o):n(p)}function o(p){return p===40?t.attempt(tg,f,s?f:d)(p):p===91?t.attempt(ng,f,s?l:d)(p):s?f(p):d(p)}function l(p){return t.attempt(rg,f,d)(p)}function f(p){return e(p)}function d(p){return a._balanced=!0,n(p)}}function ug(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return xe(d)?zn(t,a)(d):a(d)}function a(d){return d===41?f(d):Il(t,s,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return xe(d)?zn(t,o)(d):f(d)}function u(d){return n(d)}function o(d){return d===34||d===39||d===40?Nl(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):f(d)}function l(d){return xe(d)?zn(t,f)(d):f(d)}function f(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function og(t,e,n){const r=this;return i;function i(u){return Sl.call(r,t,a,s,"reference","referenceMarker","referenceString")(u)}function a(u){return r.parser.defined.includes(dt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function s(u){return n(u)}}function lg(t,e,n){return r;function r(a){return t.enter("reference"),t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),i}function i(a){return a===93?(t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),t.exit("reference"),e):n(a)}}const cg={name:"labelStartImage",resolveAll:Ba.resolveAll,tokenize:dg};function dg(t,e,n){const r=this;return i;function i(u){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(u),t.exit("labelImageMarker"),a}function a(u){return u===91?(t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelImage"),s):n(u)}function s(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):e(u)}}const fg={name:"labelStartLink",resolveAll:Ba.resolveAll,tokenize:hg};function hg(t,e,n){const r=this;return i;function i(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),a}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):e(s)}}const Ei={name:"lineEnding",tokenize:pg};function pg(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),le(t,e,"linePrefix")}}const Cr={name:"thematicBreak",tokenize:mg};function mg(t,e,n){let r=0,i;return a;function a(l){return t.enter("thematicBreak"),s(l)}function s(l){return i=l,u(l)}function u(l){return l===i?(t.enter("thematicBreakSequence"),o(l)):r>=3&&(l===null||K(l))?(t.exit("thematicBreak"),e(l)):n(l)}function o(l){return l===i?(t.consume(l),r++,o):(t.exit("thematicBreakSequence"),se(l)?le(t,u,"whitespace")(l):u(l))}}const Ve={continuation:{tokenize:Tg},exit:xg,name:"list",tokenize:Eg},gg={partial:!0,tokenize:yg},bg={partial:!0,tokenize:_g};function Eg(t,e,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return u;function u(h){const m=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:qi(h)){if(r.containerState.type||(r.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),h===42||h===45?t.check(Cr,n,l)(h):l(h);if(!r.interrupt||h===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),o(h)}return n(h)}function o(h){return qi(h)&&++s<10?(t.consume(h),o):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(t.exit("listItemValue"),l(h)):n(h)}function l(h){return t.enter("listItemMarker"),t.consume(h),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,t.check(or,r.interrupt?n:f,t.attempt(gg,p,d))}function f(h){return r.containerState.initialBlankLine=!0,a++,p(h)}function d(h){return se(h)?(t.enter("listItemPrefixWhitespace"),t.consume(h),t.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=a+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(h)}}function Tg(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(or,i,a);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,le(t,e,"listItemIndent",r.containerState.size+1)(u)}function a(u){return r.containerState.furtherBlankLines||!se(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(bg,e,s)(u))}function s(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,le(t,t.attempt(Ve,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function _g(t,e,n){const r=this;return le(t,i,"listItemIndent",r.containerState.size+1);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(a):n(a)}}function xg(t){t.exit(this.containerState.type)}function yg(t,e,n){const r=this;return le(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const s=r.events[r.events.length-1];return!se(a)&&s&&s[1].type==="listItemPrefixWhitespace"?e(a):n(a)}}const Ws={name:"setextUnderline",resolveTo:kg,tokenize:Ag};function kg(t,e){let n=t.length,r,i,a;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!a&&t[n][1].type==="definition"&&(a=n);const s={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",a?(t.splice(i,0,["enter",s,e]),t.splice(a+1,0,["exit",t[r][1],e]),t[r][1].end={...t[a][1].end}):t[r][1]=s,t.push(["exit",s,e]),t}function Ag(t,e,n){const r=this;let i;return a;function a(l){let f=r.events.length,d;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){d=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),i=l,s(l)):n(l)}function s(l){return t.enter("setextHeadingLineSequence"),u(l)}function u(l){return l===i?(t.consume(l),u):(t.exit("setextHeadingLineSequence"),se(l)?le(t,o,"lineSuffix")(l):o(l))}function o(l){return l===null||K(l)?(t.exit("setextHeadingLine"),e(l)):n(l)}}const Cg={tokenize:Ig};function Ig(t){const e=this,n=t.attempt(or,r,t.attempt(this.parser.constructs.flowInitial,i,le(t,t.attempt(this.parser.constructs.flow,i,t.attempt(R1,i)),"linePrefix")));return n;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEndingBlank"),t.consume(a),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Sg={resolveAll:vl()},Ng=wl("string"),wg=wl("text");function wl(t){return{resolveAll:vl(t==="text"?vg:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],a=n.attempt(i,s,u);return s;function s(f){return l(f)?a(f):u(f)}function u(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),o}function o(f){return l(f)?(n.exit("data"),a(f)):(n.consume(f),o)}function l(f){if(f===null)return!0;const d=i[f];let p=-1;if(d)for(;++p<d.length;){const h=d[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function vl(t){return e;function e(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return t?t(n,r):n}}function vg(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let a=i.length,s=-1,u=0,o;for(;a--;){const l=i[a];if(typeof l=="string"){for(s=l.length;l.charCodeAt(s-1)===32;)u++,s--;if(s)break;s=-1}else if(l===-2)o=!0,u++;else if(l!==-1){a++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(u=0),u){const l={type:n===t.length||o||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?s:r.start._bufferIndex+s,_index:r.start._index+a,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...l.start},r.start.offset===r.end.offset?Object.assign(r,l):(t.splice(n,0,["enter",l,e],["exit",l,e]),n+=2)}n++}return t}const Rg={42:Ve,43:Ve,45:Ve,48:Ve,49:Ve,50:Ve,51:Ve,52:Ve,53:Ve,54:Ve,55:Ve,56:Ve,57:Ve,62:yl},Og={91:M1},Lg={[-2]:bi,[-1]:bi,32:bi},Dg={35:j1,42:Cr,45:[Ws,Cr],60:q1,61:Ws,95:Cr,96:qs,126:qs},Pg={38:Al,92:kl},Mg={[-5]:Ei,[-4]:Ei,[-3]:Ei,33:cg,38:Al,42:Vi,60:[f1,J1],91:fg,92:[H1,kl],93:Ba,95:Vi,96:C1},Bg={null:[Vi,Sg]},Fg={null:[42,95]},Ug={null:[]},Hg=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Fg,contentInitial:Og,disable:Ug,document:Rg,flow:Dg,flowInitial:Lg,insideSpan:Bg,string:Pg,text:Mg},Symbol.toStringTag,{value:"Module"}));function zg(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let s=[],u=[];const o={attempt:L(v),check:L(C),consume:k,enter:b,exit:N,interrupt:L(C,{interrupt:!0})},l={code:null,containerState:{},defineSkip:E,events:[],now:m,parser:t,previous:null,sliceSerialize:p,sliceStream:h,write:d};let f=e.tokenize.call(l,o);return e.resolveAll&&a.push(e),l;function d(B){return s=at(s,B),x(),s[s.length-1]!==null?[]:(M(e,0),l.events=ei(a,l.events,l),l.events)}function p(B,$){return $g(h(B),$)}function h(B){return jg(s,B)}function m(){const{_bufferIndex:B,_index:$,line:J,column:q,offset:z}=r;return{_bufferIndex:B,_index:$,line:J,column:q,offset:z}}function E(B){i[B.line]=B.column,w()}function x(){let B;for(;r._index<s.length;){const $=s[r._index];if(typeof $=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<$.length;)T($.charCodeAt(r._bufferIndex));else T($)}}function T(B){f=f(B)}function k(B){K(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,w()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=B}function b(B,$){const J=$||{};return J.type=B,J.start=m(),l.events.push(["enter",J,l]),u.push(J),J}function N(B){const $=u.pop();return $.end=m(),l.events.push(["exit",$,l]),$}function v(B,$){M(B,$.from)}function C(B,$){$.restore()}function L(B,$){return J;function J(q,z,Q){let ie,be,Re,I;return Array.isArray(q)?Ee(q):"tokenize"in q?Ee([q]):Ie(q);function Ie(ge){return _t;function _t(He){const Ke=He!==null&&ge[He],Xe=He!==null&&ge.null,ut=[...Array.isArray(Ke)?Ke:Ke?[Ke]:[],...Array.isArray(Xe)?Xe:Xe?[Xe]:[]];return Ee(ut)(He)}}function Ee(ge){return ie=ge,be=0,ge.length===0?Q:S(ge[be])}function S(ge){return _t;function _t(He){return I=F(),Re=ge,ge.partial||(l.currentConstruct=ge),ge.name&&l.parser.constructs.disable.null.includes(ge.name)?me():ge.tokenize.call($?Object.assign(Object.create(l),$):l,o,ce,me)(He)}}function ce(ge){return B(Re,I),z}function me(ge){return I.restore(),++be<ie.length?S(ie[be]):Q}}}function M(B,$){B.resolveAll&&!a.includes(B)&&a.push(B),B.resolve&&tt(l.events,$,l.events.length-$,B.resolve(l.events.slice($),l)),B.resolveTo&&(l.events=B.resolveTo(l.events,l))}function F(){const B=m(),$=l.previous,J=l.currentConstruct,q=l.events.length,z=Array.from(u);return{from:q,restore:Q};function Q(){r=B,l.previous=$,l.currentConstruct=J,l.events.length=q,u=z,w()}}function w(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function jg(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,a=e.end._bufferIndex;let s;if(n===i)s=[t[n].slice(r,a)];else{if(s=t.slice(n,i),r>-1){const u=s[0];typeof u=="string"?s[0]=u.slice(r):s.shift()}a>0&&s.push(t[i].slice(0,a))}return s}function $g(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const a=t[n];let s;if(typeof a=="string")s=a;else switch(a){case-5:{s="\r";break}case-4:{s=`
|
|
86
86
|
`;break}case-3:{s=`\r
|
|
87
87
|
`;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&i)continue;s=" ";break}default:s=String.fromCharCode(a)}i=a===-2,r.push(s)}return r.join("")}function Zg(t){const r={constructs:_l([Hg,...(t||{}).extensions||[]]),content:i(a1),defined:[],document:i(u1),flow:i(Cg),lazy:{},string:i(Ng),text:i(wg)};return r;function i(a){return s;function s(u){return zg(r,a,u)}}}function Yg(t){for(;!Cl(t););return t}const Gs=/[\0\t\n\r]/g;function qg(){let t=1,e="",n=!0,r;return i;function i(a,s,u){const o=[];let l,f,d,p,h;for(a=e+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),d=0,e="",n&&(a.charCodeAt(0)===65279&&d++,n=void 0);d<a.length;){if(Gs.lastIndex=d,l=Gs.exec(a),p=l&&l.index!==void 0?l.index:a.length,h=a.charCodeAt(p),!l){e=a.slice(d);break}if(h===10&&d===p&&r)o.push(-3),r=void 0;else switch(r&&(o.push(-5),r=void 0),d<p&&(o.push(a.slice(d,p)),t+=p-d),h){case 0:{o.push(65533),t++;break}case 9:{for(f=Math.ceil(t/4)*4,o.push(-2);t++<f;)o.push(-1);break}case 10:{o.push(-4),t=1;break}default:r=!0,t=1}d=p+1}return u&&(r&&o.push(-5),e&&o.push(e),o.push(null)),o}}const Vg=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Wg(t){return t.replace(Vg,Gg)}function Gg(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return xl(n.slice(a?2:1),a?16:10)}return Ma(n)||t}const Rl={}.hasOwnProperty;function Qg(t,e,n){return typeof e!="string"&&(n=e,e=void 0),Kg(n)(Yg(Zg(n).document().write(qg()(t,e,!0))))}function Kg(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(as),autolinkProtocol:F,autolinkEmail:F,atxHeading:a(ns),blockQuote:a(Xe),characterEscape:F,characterReference:F,codeFenced:a(ut),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(ut,s),codeText:a(St,s),codeTextData:F,data:F,codeFlowValue:F,definition:a(en),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(rt),hardBreakEscape:a(rs),hardBreakTrailing:a(rs),htmlFlow:a(is,s),htmlFlowData:F,htmlText:a(is,s),htmlTextData:F,image:a(Bd),label:s,link:a(as),listItem:a(Fd),listItemValue:p,listOrdered:a(ss,d),listUnordered:a(ss),paragraph:a(Ud),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(ns),strong:a(Hd),thematicBreak:a(jd)},exit:{atxHeading:o(),atxHeadingSequence:v,autolink:o(),autolinkEmail:Ke,autolinkProtocol:He,blockQuote:o(),characterEscapeValue:w,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:ge,characterReference:_t,codeFenced:o(x),codeFencedFence:E,codeFencedFenceInfo:h,codeFencedFenceMeta:m,codeFlowValue:w,codeIndented:o(T),codeText:o(z),codeTextData:w,data:w,definition:o(),definitionDestinationString:N,definitionLabelString:k,definitionTitleString:b,emphasis:o(),hardBreakEscape:o($),hardBreakTrailing:o($),htmlFlow:o(J),htmlFlowData:w,htmlText:o(q),htmlTextData:w,image:o(ie),label:Re,labelText:be,lineEnding:B,link:o(Q),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:ce,resourceDestinationString:I,resourceTitleString:Ie,resource:Ee,setextHeading:o(M),setextHeadingLineSequence:L,setextHeadingText:C,strong:o(),thematicBreak:o()}};Ol(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(P){let Z={type:"root",children:[]};const ee={stack:[Z],tokenStack:[],config:e,enter:u,exit:l,buffer:s,resume:f,data:n},ue=[];let Te=-1;for(;++Te<P.length;)if(P[Te][1].type==="listOrdered"||P[Te][1].type==="listUnordered")if(P[Te][0]==="enter")ue.push(Te);else{const ot=ue.pop();Te=i(P,ot,Te)}for(Te=-1;++Te<P.length;){const ot=e[P[Te][0]];Rl.call(ot,P[Te][1].type)&&ot[P[Te][1].type].call(Object.assign({sliceSerialize:P[Te][2].sliceSerialize},ee),P[Te][1])}if(ee.tokenStack.length>0){const ot=ee.tokenStack[ee.tokenStack.length-1];(ot[1]||Qs).call(ee,void 0,ot[0])}for(Z.position={start:Nt(P.length>0?P[0][1].start:{line:1,column:1,offset:0}),end:Nt(P.length>0?P[P.length-2][1].end:{line:1,column:1,offset:0})},Te=-1;++Te<e.transforms.length;)Z=e.transforms[Te](Z)||Z;return Z}function i(P,Z,ee){let ue=Z-1,Te=-1,ot=!1,Ut,xt,yn,kn;for(;++ue<=ee;){const Je=P[ue];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?Te++:Te--,kn=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(Ut&&!kn&&!Te&&!yn&&(yn=ue),kn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:kn=void 0}if(!Te&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||Te===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(Ut){let tn=ue;for(xt=void 0;tn--;){const yt=P[tn];if(yt[1].type==="lineEnding"||yt[1].type==="lineEndingBlank"){if(yt[0]==="exit")continue;xt&&(P[xt][1].type="lineEndingBlank",ot=!0),yt[1].type="lineEnding",xt=tn}else if(!(yt[1].type==="linePrefix"||yt[1].type==="blockQuotePrefix"||yt[1].type==="blockQuotePrefixWhitespace"||yt[1].type==="blockQuoteMarker"||yt[1].type==="listItemIndent"))break}yn&&(!xt||yn<xt)&&(Ut._spread=!0),Ut.end=Object.assign({},xt?P[xt][1].start:Je[1].end),P.splice(xt||ue,0,["exit",Ut,Je[2]]),ue++,ee++}if(Je[1].type==="listItemPrefix"){const tn={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};Ut=tn,P.splice(ue,0,["enter",tn,Je[2]]),ue++,ee++,yn=void 0,kn=!0}}}return P[Z][1]._spread=ot,ee}function a(P,Z){return ee;function ee(ue){u.call(this,P(ue),ue),Z&&Z.call(this,ue)}}function s(){this.stack.push({type:"fragment",children:[]})}function u(P,Z,ee){this.stack[this.stack.length-1].children.push(P),this.stack.push(P),this.tokenStack.push([Z,ee||void 0]),P.position={start:Nt(Z.start),end:void 0}}function o(P){return Z;function Z(ee){P&&P.call(this,ee),l.call(this,ee)}}function l(P,Z){const ee=this.stack.pop(),ue=this.tokenStack.pop();if(ue)ue[0].type!==P.type&&(Z?Z.call(this,P,ue[0]):(ue[1]||Qs).call(this,P,ue[0]));else throw new Error("Cannot close `"+P.type+"` ("+Hn({start:P.start,end:P.end})+"): it’s not open");ee.position.end=Nt(P.end)}function f(){return Pa(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(P){if(this.data.expectingFirstListItemValue){const Z=this.stack[this.stack.length-2];Z.start=Number.parseInt(this.sliceSerialize(P),10),this.data.expectingFirstListItemValue=void 0}}function h(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.lang=P}function m(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.meta=P}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.value=P.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.value=P.replace(/(\r?\n|\r)$/g,"")}function k(P){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.label=Z,ee.identifier=dt(this.sliceSerialize(P)).toLowerCase()}function b(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.title=P}function N(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.url=P}function v(P){const Z=this.stack[this.stack.length-1];if(!Z.depth){const ee=this.sliceSerialize(P).length;Z.depth=ee}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function L(P){const Z=this.stack[this.stack.length-1];Z.depth=this.sliceSerialize(P).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function F(P){const ee=this.stack[this.stack.length-1].children;let ue=ee[ee.length-1];(!ue||ue.type!=="text")&&(ue=zd(),ue.position={start:Nt(P.start),end:void 0},ee.push(ue)),this.stack.push(ue)}function w(P){const Z=this.stack.pop();Z.value+=this.sliceSerialize(P),Z.position.end=Nt(P.end)}function B(P){const Z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ee=Z.children[Z.children.length-1];ee.position.end=Nt(P.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Z.type)&&(F.call(this,P),w.call(this,P))}function $(){this.data.atHardBreak=!0}function J(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.value=P}function q(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.value=P}function z(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.value=P}function Q(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=Z,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function ie(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=Z,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function be(P){const Z=this.sliceSerialize(P),ee=this.stack[this.stack.length-2];ee.label=Wg(Z),ee.identifier=dt(Z).toLowerCase()}function Re(){const P=this.stack[this.stack.length-1],Z=this.resume(),ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,ee.type==="link"){const ue=P.children;ee.children=ue}else ee.alt=Z}function I(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.url=P}function Ie(){const P=this.resume(),Z=this.stack[this.stack.length-1];Z.title=P}function Ee(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function ce(P){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.label=Z,ee.identifier=dt(this.sliceSerialize(P)).toLowerCase(),this.data.referenceType="full"}function me(P){this.data.characterReferenceType=P.type}function ge(P){const Z=this.sliceSerialize(P),ee=this.data.characterReferenceType;let ue;ee?(ue=xl(Z,ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ue=Ma(Z);const Te=this.stack[this.stack.length-1];Te.value+=ue}function _t(P){const Z=this.stack.pop();Z.position.end=Nt(P.end)}function He(P){w.call(this,P);const Z=this.stack[this.stack.length-1];Z.url=this.sliceSerialize(P)}function Ke(P){w.call(this,P);const Z=this.stack[this.stack.length-1];Z.url="mailto:"+this.sliceSerialize(P)}function Xe(){return{type:"blockquote",children:[]}}function ut(){return{type:"code",lang:null,meta:null,value:""}}function St(){return{type:"inlineCode",value:""}}function en(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function rt(){return{type:"emphasis",children:[]}}function ns(){return{type:"heading",depth:0,children:[]}}function rs(){return{type:"break"}}function is(){return{type:"html",value:""}}function Bd(){return{type:"image",title:null,url:"",alt:null}}function as(){return{type:"link",title:null,url:"",children:[]}}function ss(P){return{type:"list",ordered:P.type==="listOrdered",start:null,spread:P._spread,children:[]}}function Fd(P){return{type:"listItem",spread:P._spread,checked:null,children:[]}}function Ud(){return{type:"paragraph",children:[]}}function Hd(){return{type:"strong",children:[]}}function zd(){return{type:"text",value:""}}function jd(){return{type:"thematicBreak"}}}function Nt(t){return{line:t.line,column:t.column,offset:t.offset}}function Ol(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?Ol(t,r):Xg(t,r)}}function Xg(t,e){let n;for(n in e)if(Rl.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function Qs(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Hn({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Hn({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Hn({start:e.start,end:e.end})+") is still open")}function Jg(t){const e=this;e.parser=n;function n(r){return Qg(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function eb(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function tb(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
@@ -110,15 +110,15 @@ Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An err
|
|
|
110
110
|
`))+1))}const s="#".repeat(i),u=n.enter("headingAtx"),o=n.enter("phrasing");a.move(s+" ");let l=n.containerPhrasing(t,{before:"# ",after:`
|
|
111
111
|
`,...a.current()});return/^[\t ]/.test(l)&&(l=Jn(l.charCodeAt(0))+l.slice(1)),l=l?s+" "+l:s,n.options.closeAtx&&(l+=" "+s),o(),u(),l}Nc.peek=Ox;function Nc(t){return t.value||""}function Ox(){return"<"}wc.peek=Lx;function wc(t,e,n,r){const i=Ga(n),a=i==='"'?"Quote":"Apostrophe",s=n.enter("image");let u=n.enter("label");const o=n.createTracker(r);let l=o.move("![");return l+=o.move(n.safe(t.alt,{before:l,after:"]",...o.current()})),l+=o.move("]("),u(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),l+=o.move("<"),l+=o.move(n.safe(t.url,{before:l,after:">",...o.current()})),l+=o.move(">")):(u=n.enter("destinationRaw"),l+=o.move(n.safe(t.url,{before:l,after:t.title?" ":")",...o.current()}))),u(),t.title&&(u=n.enter(`title${a}`),l+=o.move(" "+i),l+=o.move(n.safe(t.title,{before:l,after:i,...o.current()})),l+=o.move(i),u()),l+=o.move(")"),s(),l}function Lx(){return"!"}vc.peek=Dx;function vc(t,e,n,r){const i=t.referenceType,a=n.enter("imageReference");let s=n.enter("label");const u=n.createTracker(r);let o=u.move("![");const l=n.safe(t.alt,{before:o,after:"]",...u.current()});o+=u.move(l+"]["),s();const f=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(t),{before:o,after:"]",...u.current()});return s(),n.stack=f,a(),i==="full"||!l||l!==d?o+=u.move(d+"]"):i==="shortcut"?o=o.slice(0,-1):o+=u.move("]"),o}function Dx(){return"!"}Rc.peek=Px;function Rc(t,e,n){let r=t.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const s=n.unsafe[a],u=n.compilePattern(s);let o;if(s.atBreak)for(;o=u.exec(r);){let l=o.index;r.charCodeAt(l)===10&&r.charCodeAt(l-1)===13&&l--,r=r.slice(0,l)+" "+r.slice(o.index+1)}}return i+r+i}function Px(){return"`"}function Oc(t,e){const n=Pa(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Lc.peek=Mx;function Lc(t,e,n,r){const i=Ga(n),a=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let u,o;if(Oc(t,n)){const f=n.stack;n.stack=[],u=n.enter("autolink");let d=s.move("<");return d+=s.move(n.containerPhrasing(t,{before:d,after:">",...s.current()})),d+=s.move(">"),u(),n.stack=f,d}u=n.enter("link"),o=n.enter("label");let l=s.move("[");return l+=s.move(n.containerPhrasing(t,{before:l,after:"](",...s.current()})),l+=s.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),l+=s.move("<"),l+=s.move(n.safe(t.url,{before:l,after:">",...s.current()})),l+=s.move(">")):(o=n.enter("destinationRaw"),l+=s.move(n.safe(t.url,{before:l,after:t.title?" ":")",...s.current()}))),o(),t.title&&(o=n.enter(`title${a}`),l+=s.move(" "+i),l+=s.move(n.safe(t.title,{before:l,after:i,...s.current()})),l+=s.move(i),o()),l+=s.move(")"),u(),l}function Mx(t,e,n){return Oc(t,n)?"<":"["}Dc.peek=Bx;function Dc(t,e,n,r){const i=t.referenceType,a=n.enter("linkReference");let s=n.enter("label");const u=n.createTracker(r);let o=u.move("[");const l=n.containerPhrasing(t,{before:o,after:"]",...u.current()});o+=u.move(l+"]["),s();const f=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(t),{before:o,after:"]",...u.current()});return s(),n.stack=f,a(),i==="full"||!l||l!==d?o+=u.move(d+"]"):i==="shortcut"?o=o.slice(0,-1):o+=u.move("]"),o}function Bx(){return"["}function Qa(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function Fx(t){const e=Qa(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Ux(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function Pc(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function Hx(t,e,n,r){const i=n.enter("list"),a=n.bulletCurrent;let s=t.ordered?Ux(n):Qa(n);const u=t.ordered?s==="."?")":".":Fx(n);let o=e&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((s==="*"||s==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(o=!0),Pc(n)===s&&f){let d=-1;for(;++d<t.children.length;){const p=t.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){o=!0;break}}}}o&&(s=u),n.bulletCurrent=s;const l=n.containerFlow(t,r);return n.bulletLastUsed=s,n.bulletCurrent=a,i(),l}function zx(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function jx(t,e,n,r){const i=zx(n);let a=n.bulletCurrent||Qa(n);e&&e.type==="list"&&e.ordered&&(a=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+a);let s=a.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(s=Math.ceil(s/4)*4);const u=n.createTracker(r);u.move(a+" ".repeat(s-a.length)),u.shift(s);const o=n.enter("listItem"),l=n.indentLines(n.containerFlow(t,u.current()),f);return o(),l;function f(d,p,h){return p?(h?"":" ".repeat(s))+d:(h?a:a+" ".repeat(s-a.length))+d}}function $x(t,e,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),s=n.containerPhrasing(t,r);return a(),i(),s}const Zx=ni(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Yx(t,e,n,r){return(t.children.some(function(s){return Zx(s)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function qx(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Mc.peek=Vx;function Mc(t,e,n,r){const i=qx(n),a=n.enter("strong"),s=n.createTracker(r),u=s.move(i+i);let o=s.move(n.containerPhrasing(t,{after:i,before:u,...s.current()}));const l=o.charCodeAt(0),f=jr(r.before.charCodeAt(r.before.length-1),l,i);f.inside&&(o=Jn(l)+o.slice(1));const d=o.charCodeAt(o.length-1),p=jr(r.after.charCodeAt(0),d,i);p.inside&&(o=o.slice(0,-1)+Jn(d));const h=s.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:f.outside},u+o+h}function Vx(t,e,n){return n.options.strong||"*"}function Wx(t,e,n,r){return n.safe(t.value,r)}function Gx(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Qx(t,e,n){const r=(Pc(n)+(n.options.ruleSpaces?" ":"")).repeat(Gx(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Bc={blockquote:Tx,break:Lu,code:Cx,definition:Sx,emphasis:Sc,hardBreak:Lu,heading:Rx,html:Nc,image:wc,imageReference:vc,inlineCode:Rc,link:Lc,linkReference:Dc,list:Hx,listItem:jx,paragraph:$x,root:Yx,strong:Mc,text:Wx,thematicBreak:Qx};function Kx(){return{enter:{table:Xx,tableData:Du,tableHeader:Du,tableRow:e3},exit:{codeText:t3,table:Jx,tableData:Oi,tableHeader:Oi,tableRow:Oi}}}function Xx(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Jx(t){this.exit(t),this.data.inTable=void 0}function e3(t){this.enter({type:"tableRow",children:[]},t)}function Oi(t){this.exit(t)}function Du(t){this.enter({type:"tableCell",children:[]},t)}function t3(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,n3));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function n3(t,e){return e==="|"?e:t}function r3(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
112
112
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:s,tableCell:o,tableRow:u}};function s(h,m,E,x){return l(f(h,E,x),h.align)}function u(h,m,E,x){const T=d(h,E,x),k=l([T]);return k.slice(0,k.indexOf(`
|
|
113
|
-
`))}function o(h,m,E,x){const T=E.enter("tableCell"),k=E.enter("phrasing"),b=E.containerPhrasing(h,{...x,before:a,after:a});return k(),T(),b}function l(h,m){return bx(h,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function f(h,m,E){const x=h.children;let T=-1;const k=[],b=m.enter("table");for(;++T<x.length;)k[T]=d(x[T],m,E);return b(),k}function d(h,m,E){const x=h.children;let T=-1;const k=[],b=m.enter("tableRow");for(;++T<x.length;)k[T]=o(x[T],h,m,E);return b(),k}function p(h,m,E){let x=Bc.inlineCode(h,m,E);return E.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function i3(){return{exit:{taskListCheckValueChecked:Pu,taskListCheckValueUnchecked:Pu,paragraph:s3}}}function a3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:u3}}}function Pu(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function s3(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let a=-1,s;for(;++a<i.length;){const u=i[a];if(u.type==="paragraph"){s=u;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function u3(t,e,n,r){const i=t.children[0],a=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(s);let o=Bc.listItem(t,e,n,{...r,...u.current()});return a&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),o;function l(f){return f+s}}function o3(){return[H_(),ux(),dx(),Kx(),i3()]}function l3(t){return{extensions:[z_(),ox(t),fx(),r3(t),a3()]}}const c3={tokenize:g3,partial:!0},Fc={tokenize:b3,partial:!0},Uc={tokenize:E3,partial:!0},Hc={tokenize:T3,partial:!0},d3={tokenize:_3,partial:!0},zc={name:"wwwAutolink",tokenize:p3,previous:$c},jc={name:"protocolAutolink",tokenize:m3,previous:Zc},It={name:"emailAutolink",tokenize:h3,previous:Yc},Tt={};function f3(){return{text:Tt}}let Ht=48;for(;Ht<123;)Tt[Ht]=It,Ht++,Ht===58?Ht=65:Ht===91&&(Ht=97);Tt[43]=It;Tt[45]=It;Tt[46]=It;Tt[95]=It;Tt[72]=[It,jc];Tt[104]=[It,jc];Tt[87]=[It,zc];Tt[119]=[It,zc];function h3(t,e,n){const r=this;let i,a;return s;function s(d){return!ra(d)||!Yc.call(r,r.previous)||Ka(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(d))}function u(d){return ra(d)?(t.consume(d),u):d===64?(t.consume(d),o):n(d)}function o(d){return d===46?t.check(d3,f,l)(d):d===45||d===95||Be(d)?(a=!0,t.consume(d),o):f(d)}function l(d){return t.consume(d),i=!0,o}function f(d){return a&&i&&$e(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function p3(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!$c.call(r,r.previous)||Ka(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(c3,t.attempt(Fc,t.attempt(Uc,a),n),n)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function m3(t,e,n){const r=this;let i="",a=!1;return s;function s(d){return(d===72||d===104)&&Zc.call(r,r.previous)&&!Ka(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),u):n(d)}function u(d){if($e(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),u;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),o}return n(d)}function o(d){return d===47?(t.consume(d),a?l:(a=!0,o)):n(d)}function l(d){return d===null||Br(d)||xe(d)||Wt(d)||Jr(d)?n(d):t.attempt(Fc,t.attempt(Uc,f),n)(d)}function f(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function g3(t,e,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),i):s===46&&r===3?(t.consume(s),a):n(s)}function a(s){return s===null?n(s):e(s)}}function b3(t,e,n){let r,i,a;return s;function s(l){return l===46||l===95?t.check(Hc,o,u)(l):l===null||xe(l)||Wt(l)||l!==45&&Jr(l)?o(l):(a=!0,t.consume(l),s)}function u(l){return l===95?r=!0:(i=r,r=void 0),t.consume(l),s}function o(l){return i||r||!a?n(l):e(l)}}function E3(t,e){let n=0,r=0;return i;function i(s){return s===40?(n++,t.consume(s),i):s===41&&r<n?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(Hc,e,a)(s):s===null||xe(s)||Wt(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&r++,t.consume(s),i}}function T3(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),a):u===93?(t.consume(u),i):u===60||u===null||xe(u)||Wt(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||xe(u)||Wt(u)?e(u):r(u)}function a(u){return $e(u)?s(u):n(u)}function s(u){return u===59?(t.consume(u),r):$e(u)?(t.consume(u),s):n(u)}}function _3(t,e,n){return r;function r(a){return t.consume(a),i}function i(a){return Be(a)?n(a):e(a)}}function $c(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||xe(t)}function Zc(t){return!$e(t)}function Yc(t){return!(t===47||ra(t))}function ra(t){return t===43||t===45||t===46||t===95||Be(t)}function Ka(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const x3={tokenize:w3,partial:!0};function y3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:I3,continuation:{tokenize:S3},exit:N3}},text:{91:{name:"gfmFootnoteCall",tokenize:C3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:k3,resolveTo:A3}}}}function k3(t,e,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){s=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return u;function u(o){if(!s||!s._balanced)return n(o);const l=dt(r.sliceSerialize({start:s.end,end:r.now()}));return l.codePointAt(0)!==94||!a.includes(l.slice(1))?n(o):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(o),t.exit("gfmFootnoteCallLabelMarker"),e(o))}}function A3(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function C3(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,s;return u;function u(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),o}function o(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(d){if(a>999||d===93&&!s||d===null||d===91||xe(d))return n(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(dt(r.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return xe(d)||(s=!0),a++,t.consume(d),d===92?f:l}function f(d){return d===91||d===92||d===93?(t.consume(d),a++,l):l(d)}}function I3(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,s=0,u;return o;function o(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),l}function l(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(m)}function f(m){if(s>999||m===93&&!u||m===null||m===91||xe(m))return n(m);if(m===93){t.exit("chunkString");const E=t.exit("gfmFootnoteDefinitionLabelString");return a=dt(r.sliceSerialize(E)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return xe(m)||(u=!0),s++,t.consume(m),m===92?d:f}function d(m){return m===91||m===92||m===93?(t.consume(m),s++,f):f(m)}function p(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(a)||i.push(a),le(t,h,"gfmFootnoteDefinitionWhitespace")):n(m)}function h(m){return e(m)}}function S3(t,e,n){return t.check(or,e,t.attempt(x3,e,n))}function N3(t){t.exit("gfmFootnoteDefinition")}function w3(t,e,n){const r=this;return le(t,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(a):n(a)}}function v3(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,u){let o=-1;for(;++o<s.length;)if(s[o][0]==="enter"&&s[o][1].type==="strikethroughSequenceTemporary"&&s[o][1]._close){let l=o;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[o][1].end.offset-s[o][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[o][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[o][1].end)},d={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[o][1].start)},p=[["enter",f,u],["enter",s[l][1],u],["exit",s[l][1],u],["enter",d,u]],h=u.parser.constructs.insideSpan.null;h&&tt(p,p.length,0,ei(h,s.slice(l+1,o),u)),tt(p,p.length,0,[["exit",d,u],["enter",s[o][1],u],["exit",s[o][1],u],["exit",f,u]]),tt(s,l-1,o-l+3,p),o=l+p.length-2;break}}for(o=-1;++o<s.length;)s[o][1].type==="strikethroughSequenceTemporary"&&(s[o][1].type="data");return s}function a(s,u,o){const l=this.previous,f=this.events;let d=0;return p;function p(m){return l===126&&f[f.length-1][1].type!=="characterEscape"?o(m):(s.enter("strikethroughSequenceTemporary"),h(m))}function h(m){const E=cn(l);if(m===126)return d>1?o(m):(s.consume(m),d++,h);if(d<2&&!n)return o(m);const x=s.exit("strikethroughSequenceTemporary"),T=cn(m);return x._open=!T||T===2&&!!E,x._close=!E||E===2&&!!T,u(m)}}}class R3{constructor(){this.map=[]}add(e,n,r){O3(this,e,n,r)}consume(e){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const a of i)e.push(a);i=r.pop()}this.map.length=0}}function O3(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function L3(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function D3(){return{flow:{null:{name:"table",tokenize:P3,resolveAll:M3}}}}function P3(t,e,n){const r=this;let i=0,a=0,s;return u;function u(w){let B=r.events.length-1;for(;B>-1;){const q=r.events[B][1].type;if(q==="lineEnding"||q==="linePrefix")B--;else break}const $=B>-1?r.events[B][1].type:null,J=$==="tableHead"||$==="tableRow"?C:o;return J===C&&r.parser.lazy[r.now().line]?n(w):J(w)}function o(w){return t.enter("tableHead"),t.enter("tableRow"),l(w)}function l(w){return w===124||(s=!0,a+=1),f(w)}function f(w){return w===null?n(w):K(w)?a>1?(a=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),h):n(w):se(w)?le(t,f,"whitespace")(w):(a+=1,s&&(s=!1,i+=1),w===124?(t.enter("tableCellDivider"),t.consume(w),t.exit("tableCellDivider"),s=!0,f):(t.enter("data"),d(w)))}function d(w){return w===null||w===124||xe(w)?(t.exit("data"),f(w)):(t.consume(w),w===92?p:d)}function p(w){return w===92||w===124?(t.consume(w),d):d(w)}function h(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(t.enter("tableDelimiterRow"),s=!1,se(w)?le(t,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):m(w))}function m(w){return w===45||w===58?x(w):w===124?(s=!0,t.enter("tableCellDivider"),t.consume(w),t.exit("tableCellDivider"),E):v(w)}function E(w){return se(w)?le(t,x,"whitespace")(w):x(w)}function x(w){return w===58?(a+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(w),t.exit("tableDelimiterMarker"),T):w===45?(a+=1,T(w)):w===null||K(w)?N(w):v(w)}function T(w){return w===45?(t.enter("tableDelimiterFiller"),k(w)):v(w)}function k(w){return w===45?(t.consume(w),k):w===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(w),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(w))}function b(w){return se(w)?le(t,N,"whitespace")(w):N(w)}function N(w){return w===124?m(w):w===null||K(w)?!s||i!==a?v(w):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(w)):v(w)}function v(w){return n(w)}function C(w){return t.enter("tableRow"),L(w)}function L(w){return w===124?(t.enter("tableCellDivider"),t.consume(w),t.exit("tableCellDivider"),L):w===null||K(w)?(t.exit("tableRow"),e(w)):se(w)?le(t,L,"whitespace")(w):(t.enter("data"),M(w))}function M(w){return w===null||w===124||xe(w)?(t.exit("data"),L(w)):(t.consume(w),w===92?F:M)}function F(w){return w===92||w===124?(t.consume(w),M):M(w)}}function M3(t,e){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],u=!1,o=0,l,f,d;const p=new R3;for(;++n<t.length;){const h=t[n],m=h[1];h[0]==="enter"?m.type==="tableHead"?(u=!1,o!==0&&(Mu(p,e,o,l,f),f=void 0,o=0),l={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",l,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,a=[0,0,0,0],s=[0,n+1,0,0],u&&(u=!1,f={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",f,e]])),i=m.type==="tableDelimiterRow"?2:f?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],d=_r(p,e,a,i,void 0,d),a=[0,0,0,0]),s[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],d=_r(p,e,a,i,void 0,d)),a=s,s=[a[1],n,0,0])):m.type==="tableHead"?(u=!0,o=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(o=n,a[1]!==0?(s[0]=s[1],d=_r(p,e,a,i,n,d)):s[1]!==0&&(d=_r(p,e,s,i,n,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&Mu(p,e,o,l,f),p.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=L3(e.events,n))}return t}function _r(t,e,n,r,i,a){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},an(e.events,n[0])),t.add(n[0],0,[["exit",a,e]]));const o=an(e.events,n[1]);if(a={type:s,start:Object.assign({},o),end:Object.assign({},o)},t.add(n[1],0,[["enter",a,e]]),n[2]!==0){const l=an(e.events,n[2]),f=an(e.events,n[3]),d={type:u,start:Object.assign({},l),end:Object.assign({},f)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const p=e.events[n[2]],h=e.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,E=n[3]-n[2]-1;t.add(m,E,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(a.end=Object.assign({},an(e.events,i)),t.add(i,0,[["exit",a,e]]),a=void 0),a}function Mu(t,e,n,r,i){const a=[],s=an(e.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,e])),r.end=Object.assign({},s),a.push(["exit",r,e]),t.add(n+1,0,a)}function an(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const B3={name:"tasklistCheck",tokenize:U3};function F3(){return{text:{91:B3}}}function U3(t,e,n){const r=this;return i;function i(o){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(o):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),a)}function a(o){return xe(o)?(t.enter("taskListCheckValueUnchecked"),t.consume(o),t.exit("taskListCheckValueUnchecked"),s):o===88||o===120?(t.enter("taskListCheckValueChecked"),t.consume(o),t.exit("taskListCheckValueChecked"),s):n(o)}function s(o){return o===93?(t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(o)}function u(o){return K(o)?e(o):se(o)?t.check({tokenize:H3},e,n)(o):n(o)}}function H3(t,e,n){return le(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function z3(t){return _l([f3(),y3(),v3(t),D3(),F3()])}const j3={};function $3(t){const e=this,n=t||j3,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(z3(n)),a.push(o3()),s.push(l3(n))}const Z3=V.lazy(()=>Kd(()=>import("./lazy-highlighter-Bx9tA9px.js"),__vite__mapDeps([0,1,2,3,4])));function qc(){const t=W.c(3),[e,n]=V.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function Y3(){const t=W.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[85,70],t[0]=e):e=t[0];const n=e;let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"p-4 font-mono text-sm",style:{background:"#2d2d2d",borderRadius:"0 0 0.5rem 0.5rem",overflow:"auto",minHeight:"4rem"},children:n.map(q3)}),t[1]=r):r=t[1],r}function q3(t,e){return g.jsxs("div",{className:"flex gap-2 items-center my-1",children:[e>2&&e<7&&g.jsx("div",{className:"w-4 h-4 rounded-sm opacity-40 animate-pulse",style:{background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.1}s`}}),e%4===0&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"3rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.12}s`}}),e%3===1&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"2.5rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.14}s`}}),g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:`${t}%`,background:"rgba(255, 255, 255, 0.1)",animationDelay:`${e*.1}s`}}),e%5===2&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"4rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.16}s`}})]},e)}function V3(t){const e=W.c(12),n=V.useRef(null),{handleCopy:r,copied:i}=qc(),a=W3;let s;e[0]!==r?(s=async()=>{const p=a(n.current);await r(p)},e[0]=r,e[1]=s):s=e[1];const u=s;let o;e[2]!==i?(o=i?g.jsx(qt,{size:12}):g.jsx(Yr,{size:12}),e[2]=i,e[3]=o):o=e[3];let l;e[4]!==u||e[5]!==o?(l=g.jsx("div",{className:"flex justify-end items-center",children:g.jsxs(Mt,{variant:"ghost",onClick:u,"aria-label":"Copy as CSV",className:"text-muted-foreground hover:text-foreground h-6 text-[10px]",type:"button",children:["Copy as CSV",o]})}),e[4]=u,e[5]=o,e[6]=l):l=e[6];let f;e[7]!==t?(f=g.jsx("div",{className:"overflow-x-auto mb-4 rounded-lg border border-border",children:g.jsx("table",{ref:n,...t,className:"min-w-full border-collapse text-sm",children:t.children})}),e[7]=t,e[8]=f):f=e[8];let d;return e[9]!==l||e[10]!==f?(d=g.jsxs(g.Fragment,{children:[l,f]}),e[9]=l,e[10]=f,e[11]=d):d=e[11],d}function W3(t){return t?Array.from(t.querySelectorAll("tr")).map(G3).join(`
|
|
114
|
-
`):""}function G3(t){return Array.from(t.querySelectorAll("th,td")).map(Q3).join(",")}function Q3(t){let e=t.textContent||"";return e=e.replace(/"/g,'""'),e.search(/([",\n])/g)>=0&&(e=`"${e}"`),e}const K3=[$3],X3=[D_],J3={p:t=>g.jsx("p",{...t,className:"leading-relaxed text-sm"}),strong:t=>g.jsx("strong",{...t,className:"font-bold"}),em:t=>g.jsx("em",{...t,className:"italic"}),a:t=>g.jsx("a",{...t,target:"_blank",rel:"noopener noreferrer",className:"text-primary-dark hover:underline break-all font-medium"}),ul:t=>g.jsx("ul",{...t,className:"list-disc ml-6 my-4 space-y-2"}),ol:t=>g.jsx("ol",{...t,className:"list-decimal ml-6 my-4 space-y-2"}),li:t=>g.jsx("li",{...t,className:"leading-relaxed text-sm"}),code:t=>g.jsx("code",{...t,className:"px-1 py-0.5 bg-muted rounded text-sm font-mono break-all"}),pre:t=>g.jsx("pre",{...t,className:"flex w-full min-w-0 my-4 bg-muted rounded overflow-hidden",children:g.jsx("code",{className:"flex-1 min-w-0 p-4 text-sm font-mono whitespace-pre overflow-x-auto",children:t.children})}),table:t=>g.jsx(V3,{...t}),thead:t=>g.jsx("thead",{...t,className:"bg-muted",children:t.children}),tr:t=>g.jsx("tr",{...t,className:"even:bg-muted/50 border-b border-border last:border-0"}),th:t=>g.jsx("th",{...t,className:"px-4 py-2 text-left font-semibold text-muted-foreground border-b border-border"}),td:t=>g.jsx("td",{...t,className:"px-4 py-2 border-b border-border"})},Vc=V.memo(t=>{const e=W.c(2),{content:n}=t;let r;return e[0]!==n?(r=g.jsx(EE,{remarkPlugins:K3,rehypePlugins:X3,components:J3,children:n}),e[0]=n,e[1]=r):r=e[1],r},(t,e)=>t.content===e.content);function ey(t){const e=W.c(20),{language:n,content:r}=t,{handleCopy:i,copied:a}=qc(),s=n||"text";let u;e[0]!==s?(u=g.jsx("span",{className:"text-xs font-mono uppercase text-muted-foreground tracking-widest select-none",children:s}),e[0]=s,e[1]=u):u=e[1];let o;e[2]!==r||e[3]!==i?(o=()=>i(r),e[2]=r,e[3]=i,e[4]=o):o=e[4];let l;e[5]!==a?(l=a?g.jsx(qt,{size:14}):g.jsx(Yr,{size:14}),e[5]=a,e[6]=l):l=e[6];let f;e[7]!==o||e[8]!==l?(f=g.jsx(Mt,{size:"icon",variant:"ghost",onClick:o,"aria-label":"Copy code",className:"text-muted-foreground hover:text-foreground rounded-lg h-8 w-8",children:l}),e[7]=o,e[8]=l,e[9]=f):f=e[9];let d;e[10]!==u||e[11]!==f?(d=g.jsxs("div",{className:"flex items-center justify-between p-1 pl-4 bg-muted border-b border-border",children:[u,f]}),e[10]=u,e[11]=f,e[12]=d):d=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=g.jsx(Y3,{}),e[13]=p):p=e[13];let h;e[14]!==r||e[15]!==n?(h=g.jsx(V.Suspense,{fallback:p,children:g.jsx(Z3,{language:n,content:r})}),e[14]=r,e[15]=n,e[16]=h):h=e[16];let m;return e[17]!==d||e[18]!==h?(m=g.jsxs("div",{className:"my-4 rounded-lg bg-muted overflow-hidden border border-border grid min-w-0",children:[d,h]}),e[17]=d,e[18]=h,e[19]=m):m=e[19],m}Vc.displayName="MemoizedMarkdownBlock";const Xa=t=>{const e=W.c(7),{id:n,text:r}=t;let i;e[0]!==r?(i=he.lexer(r),e[0]=r,e[1]=i):i=e[1];const a=i;let s;if(e[2]!==a||e[3]!==n){let u;e[5]!==n?(u=(o,l)=>o.type==="code"?g.jsx(ey,{language:o.lang,content:o.text},`${n}-block_${l}`):g.jsx(Vc,{content:o.raw},`${n}-block_${l}`),e[5]=n,e[6]=u):u=e[6],s=a.map(u),e[2]=a,e[3]=n,e[4]=s}else s=e[4];return s};Xa.displayName="MemoizedMarkdown";function ty(t,e){switch(e.type){case"TOGGLE":return{isExpanded:!t.isExpanded,wasManuallyToggled:!0};case"SET_EXPANDED":return t.wasManuallyToggled?t:{...t,isExpanded:e.payload};default:return t}}function ny(t){const e=W.c(38),{part:n,id:r}=t,{state:i}=n,a=i==="streaming";let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={isExpanded:!1,wasManuallyToggled:!1},e[0]=s):s=e[0];const[u,o]=V.useReducer(ty,s),{isExpanded:l}=u;let f,d;e[1]!==a?(f=()=>{o({type:"SET_EXPANDED",payload:a})},d=[a],e[1]=a,e[2]=f,e[3]=d):(f=e[2],d=e[3]),V.useEffect(f,d);let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{o({type:"TOGGLE"})},e[4]=p):p=e[4];const h=p,m=a&&"animate-pulse";let E;e[5]!==m?(E=te("text-muted-foreground transition-opacity",m),e[5]=m,e[6]=E):E=e[6];let x;e[7]!==E?(x=g.jsx(Vr,{className:E}),e[7]=E,e[8]=x):x=e[8];const T=a&&"text-shimmer";let k;e[9]!==T?(k=te("text-sm font-medium text-muted-foreground",T),e[9]=T,e[10]=k):k=e[10];let b;e[11]!==k?(b=g.jsx("span",{className:k,children:"Agent thinking"}),e[11]=k,e[12]=b):b=e[12];const N=l?"rotate-180":"";let v;e[13]!==N?(v=te("text-muted-foreground transition-transform duration-200",N),e[13]=N,e[14]=v):v=e[14];let C;e[15]!==v?(C=g.jsx(xo,{className:v}),e[15]=v,e[16]=C):C=e[16];let L;e[17]!==b||e[18]!==C||e[19]!==x?(L=g.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-2 py-2 transition-colors cursor-pointer",children:[x,b,C]}),e[17]=b,e[18]=C,e[19]=x,e[20]=L):L=e[20];const M=l?a?"max-h-[400px] opacity-100":"max-h-[200px] opacity-80":"max-h-0 opacity-0 overflow-hidden";let F;e[21]!==M?(F=te("transition-all duration-200 ease-in-out",M),e[21]=M,e[22]=F):F=e[22];const w=a?"max-h-[400px]":"max-h-[200px]";let B;e[23]!==w?(B=te("border-l-2 pl-4 overflow-y-auto",w),e[23]=w,e[24]=B):B=e[24];let $;e[25]===Symbol.for("react.memo_cache_sentinel")?($=te("text-muted-foreground markdown-sm pb-2"),e[25]=$):$=e[25];let J;e[26]!==r||e[27]!==n.text?(J=g.jsx("div",{className:$,children:g.jsx(Xa,{id:r,text:n.text})}),e[26]=r,e[27]=n.text,e[28]=J):J=e[28];let q;e[29]!==B||e[30]!==J?(q=g.jsx("div",{className:B,children:J}),e[29]=B,e[30]=J,e[31]=q):q=e[31];let z;e[32]!==F||e[33]!==q?(z=g.jsx("div",{className:F,children:q}),e[32]=F,e[33]=q,e[34]=z):z=e[34];let Q;return e[35]!==L||e[36]!==z?(Q=g.jsxs("div",{className:"flex flex-col",children:[L,z]}),e[35]=L,e[36]=z,e[37]=Q):Q=e[37],Q}function ry(){const t=W.c(3),[e,n]=V.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function Wc(t){const e=W.c(15),{id:n,text:r,copyable:i,extraActions:a}=t,s=i===void 0?!1:i,{handleCopy:u}=ry(),[o,l]=V.useState(!1);let f;e[0]!==u||e[1]!==r?(f=async()=>{await u(r),l(!0),setTimeout(()=>l(!1),2e3)},e[0]=u,e[1]=r,e[2]=f):f=e[2];const d=f,p=s||a;let h;e[3]!==n||e[4]!==r?(h=g.jsx(Xa,{id:n,text:r}),e[3]=n,e[4]=r,e[5]=h):h=e[5];let m;e[6]!==s||e[7]!==a||e[8]!==d||e[9]!==o||e[10]!==p?(m=p&&g.jsx("div",{className:"flex w-full items-center text-xs text-muted-foreground opacity-0 pointer-events-none transition-all duration-200 group-hover/part:opacity-100 group-hover/part:pointer-events-auto mt-2",children:g.jsxs("div",{className:"flex items-center gap-1",children:[s&&g.jsx(Mt,{onClick:d,variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground size-6 whitespace-nowrap",children:o?g.jsx(qt,{size:12}):g.jsx(Yr,{size:12})}),a]})}),e[6]=s,e[7]=a,e[8]=d,e[9]=o,e[10]=p,e[11]=m):m=e[11];let E;return e[12]!==h||e[13]!==m?(E=g.jsxs("div",{className:"group/part relative",children:[h,m]}),e[12]=h,e[13]=m,e[14]=E):E=e[14],E}function iy(t){const e=W.c(28),{toolName:n,input:r,output:i,isError:a}=t;let s;if(e[0]!==i){const l=JSON.stringify(i,null,2);s=l.length>2e3?l.slice(0,2e3)+"...[TRUNCATED]":l,e[0]=i,e[1]=s}else s=e[1];const u=s;if(n==="READ_MCP_TOOLS"){const l=r?.id;if(l){let f;return e[2]!==l?(f=g.jsx(Bu,{connectionId:l}),e[2]=l,e[3]=f):f=e[3],f}}if(n==="CALL_MCP_TOOL"){const l=r?.connectionId;let f;e[4]!==l?(f=l&&g.jsx(Bu,{connectionId:l,compact:!0}),e[4]=l,e[5]=f):f=e[5];let d;e[6]!==i?(d=JSON.stringify(i,null,2),e[6]=i,e[7]=d):d=e[7];let p;e[8]!==d?(p=g.jsx("div",{className:"absolute top-1 right-1 z-10",children:g.jsx(ay,{text:d})}),e[8]=d,e[9]=p):p=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=g.jsx("div",{className:"font-semibold text-muted-foreground mb-0.5 text-[10px] uppercase tracking-wider",children:"Input"}),e[10]=h):h=e[10];let m;e[11]!==r?(m=JSON.stringify(r,null,2),e[11]=r,e[12]=m):m=e[12];let E;e[13]!==m?(E=g.jsx("pre",{className:"whitespace-pre-wrap break-all text-muted-foreground mb-2",children:m}),e[13]=m,e[14]=E):E=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=g.jsx("div",{className:"font-semibold text-muted-foreground mb-0.5 text-[10px] uppercase tracking-wider",children:"Output"}),e[15]=x):x=e[15];const T=`whitespace-pre-wrap break-all ${a?"text-destructive":"text-foreground"}`;let k;e[16]!==u||e[17]!==T?(k=g.jsx("pre",{className:T,children:u}),e[16]=u,e[17]=T,e[18]=k):k=e[18];let b;e[19]!==k||e[20]!==p||e[21]!==E?(b=g.jsxs("div",{className:"relative bg-muted rounded-md p-2 text-xs font-mono overflow-auto max-h-[200px]",children:[p,h,E,x,k]}),e[19]=k,e[20]=p,e[21]=E,e[22]=b):b=e[22];let N;return e[23]!==b||e[24]!==f?(N=g.jsxs("div",{className:"flex flex-col gap-2",children:[f,b]}),e[23]=b,e[24]=f,e[25]=N):N=e[25],N}let o;return e[26]!==u?(o=g.jsx("div",{className:"bg-muted rounded-md p-2 text-xs font-mono overflow-auto max-h-[200px]",children:g.jsx("pre",{className:"whitespace-pre-wrap break-all",children:u})}),e[26]=u,e[27]=o):o=e[27],o}function Bu(t){const e=W.c(15),{connectionId:n,compact:r}=t,i=bf(n),{org:a}=mn(),{slug:s}=a,u=Xd();if(!i)return null;let o;e[0]!==i.id||e[1]!==u||e[2]!==s?(o=()=>{u({to:"/$org/mcps/$connectionId",params:{org:s,connectionId:i.id}})},e[0]=i.id,e[1]=u,e[2]=s,e[3]=o):o=e[3];const l=o;if(r){let d;e[4]!==i.title?(d=g.jsx("span",{className:"font-medium text-foreground",children:i.title}),e[4]=i.title,e[5]=d):d=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=g.jsx(Rf,{size:12}),e[6]=p):p=e[6];let h;e[7]!==l?(h=g.jsx("button",{type:"button",onClick:l,className:"hover:text-foreground transition-colors",title:"Open connection",children:p}),e[7]=l,e[8]=h):h=e[8];let m;return e[9]!==d||e[10]!==h?(m=g.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/50 px-2 py-1 rounded-md w-fit",children:[d,h]}),e[9]=d,e[10]=h,e[11]=m):m=e[11],m}let f;return e[12]!==i||e[13]!==l?(f=g.jsx(vf,{connection:i,onClick:l}),e[12]=i,e[13]=l,e[14]=f):f=e[14],f}function ay({text:t}){const e=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(t),kr.success("Copied to clipboard");else throw new Error("Clipboard API unavailable")}catch(n){try{const r=document.createElement("textarea");r.value=t,r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const i=document.execCommand("copy");if(document.body.removeChild(r),i)kr.success("Copied to clipboard");else throw new Error("Fallback copy failed")}catch(r){console.error("Copy failed",n,r),kr.error("Failed to copy to clipboard")}}};return g.jsx(Mt,{size:"icon",variant:"ghost",className:"h-5 w-5 hover:bg-background/50",onClick:e,children:g.jsx(Yr,{size:12})})}function sy(t){const e=W.c(39),{part:n}=t,{state:r}=n;let i;e[0]!==n?(i="toolName"in n?n.toolName:n.type.replace("tool-",""),e[0]=n,e[1]=i):i=e[1];const a=i;let s;e[2]!==r?(s=r==="output-error"?g.jsx(wf,{className:"h-3.5 w-3.5 text-destructive"}):g.jsx(jo,{className:"h-3.5 w-3.5"}),e[2]=r,e[3]=s):s=e[3];const u=r==="output-error"&&"text-destructive/90";let o;e[4]!==u?(o=te(u),e[4]=u,e[5]=o):o=e[5];const l=r==="input-streaming"&&`Streaming ${a} arguments`,f=r==="input-available"&&`Calling ${a}`,d=r==="output-available"&&`Called ${a}`,p=r==="output-error"&&`Error calling ${a}`;let h;e[6]!==o||e[7]!==l||e[8]!==f||e[9]!==d||e[10]!==p?(h=g.jsxs("span",{className:o,children:[l,f,d,p]}),e[6]=o,e[7]=l,e[8]=f,e[9]=d,e[10]=p,e[11]=h):h=e[11];let m;e[12]!==r?(m=(r==="input-streaming"||r==="input-available")&&g.jsx("span",{className:"animate-spin",children:g.jsx(Of,{size:"xs"})}),e[12]=r,e[13]=m):m=e[13];let E;e[14]!==m||e[15]!==s||e[16]!==h?(E=g.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[s,h,m]}),e[14]=m,e[15]=s,e[16]=h,e[17]=E):E=e[17];const x=r==="output-error"?"border-destructive/50":"border-border";let T;e[18]!==x?(T=te("transition-all duration-200 ease-in-out","border-l-2 pl-3",x),e[18]=x,e[19]=T):T=e[19];let k;e[20]!==n.input||e[21]!==r?(k=(r==="input-streaming"||r==="input-available")&&!!n.input&&g.jsx("div",{className:"text-xs font-mono text-muted-foreground bg-muted/30 p-2 rounded",children:JSON.stringify(n.input,null,2)}),e[20]=n.input,e[21]=r,e[22]=k):k=e[22];let b;e[23]!==n.input||e[24]!==n.output||e[25]!==r||e[26]!==a?(b=r==="output-available"&&g.jsx(iy,{toolName:a,input:n.input,output:n.output}),e[23]=n.input,e[24]=n.output,e[25]=r,e[26]=a,e[27]=b):b=e[27];let N;e[28]!==n||e[29]!==r?(N=r==="output-error"&&g.jsx("div",{className:"text-xs font-mono bg-destructive/10 text-destructive p-2 rounded border border-destructive/20",children:"errorText"in n&&typeof n.errorText=="string"?n.errorText:"An unknown error occurred"}),e[28]=n,e[29]=r,e[30]=N):N=e[30];let v;e[31]!==T||e[32]!==k||e[33]!==b||e[34]!==N?(v=g.jsxs("div",{className:T,children:[k,b,N]}),e[31]=T,e[32]=k,e[33]=b,e[34]=N,e[35]=v):v=e[35];let C;return e[36]!==E||e[37]!==v?(C=g.jsxs("div",{className:"flex flex-col gap-1.5 py-1",children:[E,v]}),e[36]=E,e[37]=v,e[38]=C):C=e[38],C}const uy={openrouter:t=>{const e=t?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function oy(t){if(!t?.providerMetadata)return null;for(const e of Object.values(uy)){const n=e(t.providerMetadata);if(n!==null)return n}return null}function ly(t){return t.reduce((e,n)=>{const r=n.metadata?.usage;return r?{inputTokens:e.inputTokens+(r.inputTokens??0),outputTokens:e.outputTokens+(r.outputTokens??0),totalTokens:e.totalTokens+(r.totalTokens??0),cost:e.cost+(oy(r)??0)}:e},{inputTokens:0,outputTokens:0,totalTokens:0,cost:0})}function Gc(t){const e=W.c(38),{messages:n}=t;let r,i,a,s,u,o,l,f,d,p,h,m;if(e[0]!==n){m=Symbol.for("react.early_return_sentinel");e:{const N=ly(n);if(!N){m=null;break e}const{totalTokens:v,inputTokens:C,outputTokens:L,cost:M}=N;if(a=M,!v&&!C&&!L){m=null;break e}i=go;let F;e[13]===Symbol.for("react.memo_cache_sentinel")?(F=g.jsx(Do,{size:12}),e[13]=F):F=e[13];const w=g.jsxs(Mt,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap",children:[F,g.jsx("span",{className:"text-[10px] font-mono tabular-nums",children:v.toLocaleString()})]});e[14]!==w?(h=g.jsx(bo,{asChild:!0,children:w}),e[14]=w,e[15]=h):h=e[15],r=Eo,d="top",p="font-mono text-[11px]",u="grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",e[16]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx("span",{className:"text-muted",children:"in"}),e[16]=o):o=e[16],l=g.jsx("span",{children:C.toLocaleString()}),e[17]===Symbol.for("react.memo_cache_sentinel")?(f=g.jsx("span",{className:"text-muted",children:"out"}),e[17]=f):f=e[17],s=L.toLocaleString()}e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=s,e[5]=u,e[6]=o,e[7]=l,e[8]=f,e[9]=d,e[10]=p,e[11]=h,e[12]=m}else r=e[1],i=e[2],a=e[3],s=e[4],u=e[5],o=e[6],l=e[7],f=e[8],d=e[9],p=e[10],h=e[11],m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m;let E;e[18]!==s?(E=g.jsx("span",{children:s}),e[18]=s,e[19]=E):E=e[19];let x;e[20]!==a?(x=a>0&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-muted",children:"cost"}),g.jsxs("span",{children:["$",a.toFixed(4)]})]}),e[20]=a,e[21]=x):x=e[21];let T;e[22]!==E||e[23]!==x||e[24]!==u||e[25]!==o||e[26]!==l||e[27]!==f?(T=g.jsxs("div",{className:u,children:[o,l,f,E,x]}),e[22]=E,e[23]=x,e[24]=u,e[25]=o,e[26]=l,e[27]=f,e[28]=T):T=e[28];let k;e[29]!==r||e[30]!==T||e[31]!==d||e[32]!==p?(k=g.jsx(r,{side:d,className:p,children:T}),e[29]=r,e[30]=T,e[31]=d,e[32]=p,e[33]=k):k=e[33];let b;return e[34]!==i||e[35]!==k||e[36]!==h?(b=g.jsxs(i,{children:[h,k]}),e[34]=i,e[35]=k,e[36]=h,e[37]=b):b=e[37],b}const cy={planning:{icon:g.jsx(zo,{className:"text-muted-foreground animate-pulse",size:20}),label:"Planning next moves"},thinking:{icon:g.jsx(Vr,{className:"text-muted-foreground animate-pulse",size:20}),label:"Thinking"}},dy=1200;function fy(){const t=W.c(7),[e,n]=V.useState("planning");let r,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const o=setTimeout(()=>{n("thinking")},dy);return()=>{clearTimeout(o)}},i=[],t[0]=r,t[1]=i):(r=t[0],i=t[1]),V.useEffect(r,i);const a=cy[e];let s;t[2]!==a.label?(s=g.jsxs("span",{className:"text-sm font-medium text-muted-foreground text-shimmer",children:[a.label,"..."]}),t[2]=a.label,t[3]=s):s=t[3];let u;return t[4]!==a.icon||t[5]!==s?(u=g.jsxs("div",{className:"flex items-center gap-2 py-2",children:[a.icon,s]}),t[4]=a.icon,t[5]=s,t[6]=u):u=t[6],u}function hy(t){const e=W.c(5),{duration:n}=t,r=n/1e3;let i;e[0]!==r?(i=r.toFixed(1),e[0]=r,e[1]=i):i=e[1];const a=i;let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx(Bo,{className:"text-muted-foreground",size:16}),e[2]=s):s=e[2];let u;return e[3]!==a?(u=g.jsxs("div",{className:"flex items-center gap-2 py-2 opacity-60",children:[s,g.jsxs("span",{className:"text-xs text-muted-foreground",children:["Thought · ",a,"s"]})]}),e[3]=a,e[4]=u):u=e[4],u}function py(t,e,n,r){const i=t.type.startsWith("tool-")||t.type==="dynamic-tool";if(t.type==="step-start"||t.type==="file"||t.type==="source-url"||t.type==="source-document")return null;if(i)return g.jsx(sy,{part:t,id:e},`${e}-${n}`);switch(t.type){case"text":return g.jsx(Wc,{id:e,text:t.text,copyable:!0,extraActions:r},`${e}-${n}`);case"reasoning":return g.jsx(ny,{part:t,id:e},`${e}-${n}`)}throw new Error(`Unknown part type: ${t.type}`)}function my(t){const e=W.c(27),{message:n,status:r,className:i}=t,{id:a,parts:s}=n,l=r==="streaming"||r==="submitted",f=V.useRef(null);let d;e[0]!==a?(d=()=>{const w=localStorage.getItem(`msg-duration-${a}`);return w?Number(w):null},e[0]=a,e[1]=d):d=e[1];const[p,h]=V.useState(d);let m,E;e[2]!==l?(m=()=>{l&&f.current===null&&(f.current=Date.now())},E=[l],e[2]=l,e[3]=m,e[4]=E):(m=e[3],E=e[4]),V.useEffect(m,E);let x,T;e[5]!==p||e[6]!==a||e[7]!==s.length?(x=()=>{if(s.length>0&&p===null&&f.current!==null){const w=Date.now()-f.current;h(w),localStorage.setItem(`msg-duration-${a}`,w.toString())}},T=[s.length,p,a],e[5]=p,e[6]=a,e[7]=s.length,e[8]=x,e[9]=T):(x=e[8],T=e[9]),V.useEffect(x,T);const k=s.length>0,b=k&&!l&&p!==null;let N;e[10]!==n?(N=g.jsx(Gc,{messages:[n]}),e[10]=n,e[11]=N):N=e[11];const v=N;let C;e[12]!==i?(C=te("w-full min-w-0 group relative flex items-start gap-4 px-8 z-20 text-foreground flex-row",i),e[12]=i,e[13]=C):C=e[13];let L;e[14]!==p||e[15]!==k||e[16]!==a||e[17]!==l||e[18]!==s||e[19]!==b||e[20]!==v?(L=k?g.jsxs(g.Fragment,{children:[b&&g.jsx(hy,{duration:p}),s.map((w,B)=>py(w,a,B,B===s.length-1?v:void 0))]}):l?g.jsx(fy,{}):null,e[14]=p,e[15]=k,e[16]=a,e[17]=l,e[18]=s,e[19]=b,e[20]=v,e[21]=L):L=e[21];let M;e[22]!==L?(M=g.jsx("div",{className:"flex flex-col gap-2 min-w-0 w-full items-start",children:g.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-sm wrap-break-word overflow-wrap-anywhere bg-transparent",children:L})}),e[22]=L,e[23]=M):M=e[23];let F;return e[24]!==C||e[25]!==M?(F=g.jsx("div",{className:C,children:M}),e[24]=C,e[25]=M,e[26]=F):F=e[26],F}const Qc=V.createContext(null);function Kc(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function gy(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(!V.isValidElement(r))continue;if(r.props?.message?.role==="assistant"){const a=t[n-1],s=V.isValidElement(a)&&a.props?.message?.role,u=a&&V.isValidElement(a)&&s==="user"?a:null;e.push({user:u,assistant:r})}}return e}function by(t){const e=W.c(27),{children:n,className:r,minHeightOffset:i}=t,a=V.useRef(null);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const u=V.useRef(s);let o,l,f,d,p,h,m;if(e[1]!==n||e[2]!==r||e[3]!==i){const k=V.Children.toArray(n),b=k[k.length-1];l=b&&V.isValidElement(b)&&b.type===Kc?b:null;const N=l?k.slice(0,-1):k,v=gy(N);let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=M=>{const F=u.current[M];if(F&&a.current){const w=a.current.offsetTop,B=F.offsetTop;a.current.scrollTo({top:B-w,behavior:"smooth"})}},e[11]=C):C=e[11];const L=C;o=Qc.Provider,e[12]===Symbol.for("react.memo_cache_sentinel")?(m={scrollToPair:L},e[12]=m):m=e[12],p=a,e[13]!==r?(h=te("w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",r),e[13]=r,e[14]=h):h=e[14],f="flex flex-col min-w-0 max-w-2xl mx-auto w-full",d=v.map((M,F)=>{const w=F===v.length-1;return g.jsxs("div",{ref:B=>{u.current[F]=B},className:"flex flex-col gap-2 pb-2",style:w&&i?{minHeight:`calc(100vh - ${i}px)`}:void 0,children:[g.jsx("div",{className:"sticky top-0 z-50 bg-background w-full h-4"}),g.jsx("div",{className:"sticky top-4 z-50",children:M.user&&V.isValidElement(M.user)?V.cloneElement(M.user,{pairIndex:F}):M.user}),M.assistant]},F)}),e[1]=n,e[2]=r,e[3]=i,e[4]=o,e[5]=l,e[6]=f,e[7]=d,e[8]=p,e[9]=h,e[10]=m}else o=e[4],l=e[5],f=e[6],d=e[7],p=e[8],h=e[9],m=e[10];let E;e[15]!==l||e[16]!==f||e[17]!==d?(E=g.jsxs("div",{className:f,children:[d,l]}),e[15]=l,e[16]=f,e[17]=d,e[18]=E):E=e[18];let x;e[19]!==p||e[20]!==h||e[21]!==E?(x=g.jsx("div",{ref:p,className:h,children:E}),e[19]=p,e[20]=h,e[21]=E,e[22]=x):x=e[22];let T;return e[23]!==o||e[24]!==m||e[25]!==x?(T=g.jsx(o,{value:m,children:x}),e[23]=o,e[24]=m,e[25]=x,e[26]=T):T=e[26],T}function Ey(t){const e=W.c(29),{message:n,className:r,pairIndex:i}=t,{id:a,parts:s}=n,u=V.useRef(null),o=V.useContext(Qc),[l,f]=V.useState(!1);if(!s||s.length===0)return null;const p=s.reduce(Ty,0)>60;let h;e[0]!==o||e[1]!==i?(h=()=>{i!==void 0&&o?.scrollToPair(i)},e[0]=o,e[1]=i,e[2]=h):h=e[2];const m=h;let E;e[3]!==r?(E=te("message-block w-full min-w-0 group relative flex items-start gap-4 px-4 text-foreground flex-row-reverse",r),e[3]=r,e[4]=E):E=e[4];const x=p&&!l&&"overflow-hidden relative max-h-[60px]";let T;e[5]!==x?(T=te(x),e[5]=x,e[6]=T):T=e[6];let k;if(e[7]!==a||e[8]!==s){let M;e[10]!==a?(M=(F,w)=>F.type==="text"?g.jsx(Wc,{id:a,text:F.text},`${a}-${w}`):null,e[10]=a,e[11]=M):M=e[11],k=s.map(M),e[7]=a,e[8]=s,e[9]=k}else k=e[9];let b;e[12]!==l||e[13]!==p?(b=p&&!l&&g.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-muted to-transparent pointer-events-none"}),e[12]=l,e[13]=p,e[14]=b):b=e[14];let N;e[15]!==T||e[16]!==k||e[17]!==b?(N=g.jsxs("div",{className:T,children:[k,b]}),e[15]=T,e[16]=k,e[17]=b,e[18]=N):N=e[18];let v;e[19]!==l||e[20]!==p?(v=p&&g.jsx("div",{className:"flex justify-center",children:g.jsx(Mt,{onClick:M=>{M.stopPropagation(),f(!l)},variant:"ghost",size:"xs",className:"text-xs w-full text-muted-foreground hover:text-foreground",children:l?g.jsx(If,{className:"text-sm"}):g.jsx(xo,{className:"text-sm"})})}),e[19]=l,e[20]=p,e[21]=v):v=e[21];let C;e[22]!==m||e[23]!==N||e[24]!==v?(C=g.jsxs("div",{onClick:m,className:"w-full border min-w-0 shadow-[0_3px_6px_-1px_rgba(0,0,0,0.1)] rounded-lg text-[0.9375rem] break-words overflow-wrap-anywhere bg-muted px-4 py-2 cursor-pointer transition-colors",children:[N,v]}),e[22]=m,e[23]=N,e[24]=v,e[25]=C):C=e[25];let L;return e[26]!==E||e[27]!==C?(L=g.jsxs("div",{ref:u,className:E,children:[" ",C]}),e[26]=E,e[27]=C,e[28]=L):L=e[28],L}function Ty(t,e){return e.type==="text"?t+e.text.length:t}function _y(t,e){const n=W.c(4);let r;n[0]!==e?(r={},n[0]=e,n[1]=r):r=n[1];const i=r,a=t??Ef;let s;return n[2]!==a?(s=_f(a),n[2]=a,n[3]=s):s=n[3],Tf(a,"LLM",s,i)}function xy(){const t=W.c(8),e=xf();let n;t[0]!==e?(n={connections:e,binding:"LLMS"},t[0]=e,t[1]=n):n=t[1];const[r]=Pf(n),i=_y(r?.id);if(!i||!r){let s;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[2]=s):s=t[2],s}let a;if(t[3]!==r||t[4]!==i){let s;t[6]!==r?(s=u=>({...u,name:u.title,contextWindow:u.limits?.contextWindow,outputLimit:u.limits?.maxOutputTokens,inputCost:u.costs?.input,outputCost:u.costs?.output,provider:u.provider,connectionId:r.id,connectionName:r.title}),t[6]=r,t[7]=s):s=t[7],a=i.map(s).sort(yy),t[3]=r,t[4]=i,t[5]=a}else a=t[5];return a}function yy(t,e){return t.name.localeCompare(e.name)}const ky={reasoning:{icon:g.jsx(Vr,{className:"size-4"}),bg:"bg-purple-100",text:"text-purple-700",label:"Reasoning"},"image-upload":{icon:g.jsx(Mo,{className:"size-4"}),bg:"bg-teal-100",text:"text-teal-700",label:"Can analyze images"},"file-upload":{icon:g.jsx(Lf,{className:"size-4"}),bg:"bg-blue-100",text:"text-blue-700",label:"Can analyze files"},"web-search":{icon:g.jsx(To,{className:"size-4"}),bg:"bg-amber-100",text:"text-amber-700",label:"Can search the web to answer questions"}},Xc=V.memo(function(e){const n=W.c(11),{capability:r}=e,i=ky[r];let a;n[0]!==r||n[1]!==i?(a=i||{icon:g.jsx(qt,{className:"size-4"}),bg:"bg-slate-200",text:"text-slate-700",label:r},n[0]=r,n[1]=i,n[2]=a):a=n[2];const s=a,u=`flex items-center justify-center h-6 w-6 rounded-sm ${s.bg} ${s.text}`;let o;n[3]!==s.icon||n[4]!==u?(o=g.jsx(bo,{asChild:!0,children:g.jsx("div",{className:u,children:s.icon})}),n[3]=s.icon,n[4]=u,n[5]=o):o=n[5];let l;n[6]!==s.label?(l=g.jsx(Eo,{children:g.jsx("p",{children:s.label})}),n[6]=s.label,n[7]=l):l=n[7];let f;return n[8]!==o||n[9]!==l?(f=g.jsxs(go,{children:[o,l]}),n[8]=o,n[9]=l,n[10]=f):f=n[10],f}),Fu=V.memo(function(e){const n=W.c(54),{model:r,compact:i}=e,a=i===void 0?!1:i;if(!r){let T;return n[0]===Symbol.for("react.memo_cache_sentinel")?(T=g.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),n[0]=T):T=n[0],T}const s=r.contextWindow||r.inputCost||r.outputCost||r.outputLimit;if(!s&&!a){let T;n[1]!==r.logo||n[2]!==r.name?(T=r.logo&&g.jsx("img",{src:r.logo,className:"w-6 h-6",alt:r.name}),n[1]=r.logo,n[2]=r.name,n[3]=T):T=n[3];let k;n[4]!==r.name?(k=g.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[4]=r.name,n[5]=k):k=n[5];let b;n[6]!==T||n[7]!==k?(b=g.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[T,k]}),n[6]=T,n[7]=k,n[8]=b):b=n[8];let N;n[9]!==r.description?(N=r.description&&g.jsx("p",{className:"text-sm text-muted-foreground",children:r.description}),n[9]=r.description,n[10]=N):N=n[10];let v;return n[11]!==b||n[12]!==N?(v=g.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[b,N]}),n[11]=b,n[12]=N,n[13]=v):v=n[13],v}if(!s&&a)return null;if(a){let T;n[14]!==r.contextWindow?(T=r.contextWindow&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Context"}),g.jsxs("span",{className:"text-foreground font-medium",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[14]=r.contextWindow,n[15]=T):T=n[15];let k;n[16]!==r.inputCost?(k=r.inputCost&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Input cost"}),g.jsxs("span",{className:"text-foreground font-medium",children:["$",r.inputCost.toFixed(2)," / 1M"]})]}),n[16]=r.inputCost,n[17]=k):k=n[17];let b;n[18]!==r.outputCost?(b=r.outputCost&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Output cost"}),g.jsxs("span",{className:"text-foreground font-medium",children:["$",r.outputCost.toFixed(2)," / 1M"]})]}),n[18]=r.outputCost,n[19]=b):b=n[19];let N;n[20]!==r.outputLimit?(N=r.outputLimit&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),g.jsxs("span",{className:"text-foreground font-medium",children:[r.outputLimit.toLocaleString()," tokens"]})]}),n[20]=r.outputLimit,n[21]=N):N=n[21];let v;return n[22]!==T||n[23]!==k||n[24]!==b||n[25]!==N?(v=g.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-xl text-xs",children:[T,k,b,N]}),n[22]=T,n[23]=k,n[24]=b,n[25]=N,n[26]=v):v=n[26],v}let u;n[27]!==r.logo||n[28]!==r.name?(u=r.logo&&g.jsx("img",{src:r.logo,className:"w-6 h-6",alt:r.name}),n[27]=r.logo,n[28]=r.name,n[29]=u):u=n[29];let o;n[30]!==r.name?(o=g.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[30]=r.name,n[31]=o):o=n[31];let l;n[32]!==u||n[33]!==o?(l=g.jsxs("div",{className:"flex items-center gap-3",children:[u,o]}),n[32]=u,n[33]=o,n[34]=l):l=n[34];let f;n[35]!==r.capabilities?(f=r.capabilities&&r.capabilities.length>0&&g.jsx("div",{className:"flex items-center gap-2",children:r.capabilities.map(Sy)}),n[35]=r.capabilities,n[36]=f):f=n[36];let d;n[37]!==l||n[38]!==f?(d=g.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[l,f]}),n[37]=l,n[38]=f,n[39]=d):d=n[39];let p;n[40]!==r.contextWindow?(p=r.contextWindow&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(mf,{className:"w-3.5 h-3.5 text-muted-foreground"}),g.jsx("p",{className:"text-sm text-foreground",children:"Context window"})]}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[40]=r.contextWindow,n[41]=p):p=n[41];let h;n[42]!==r.inputCost||n[43]!==r.outputCost?(h=(r.inputCost||r.outputCost)&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(Po,{className:"w-3.5 h-3.5 text-muted-foreground"}),g.jsx("p",{className:"text-sm text-foreground",children:"Costs"})]}),g.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.inputCost!==null&&r.inputCost!==void 0&&g.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.inputCost.toFixed(2)," / 1M tokens (input)"]}),r.outputCost!==null&&r.outputCost!==void 0&&g.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.outputCost.toFixed(2)," / 1M tokens (output)"]})]})]}),n[42]=r.inputCost,n[43]=r.outputCost,n[44]=h):h=n[44];let m;n[45]!==r.outputLimit?(m=r.outputLimit&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(Fo,{className:"w-4.5 h-4.5 text-muted-foreground/70"}),g.jsx("p",{className:"text-sm text-foreground",children:"Output limit"})]}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.outputLimit.toLocaleString()," token limit"]})]}),n[45]=r.outputLimit,n[46]=m):m=n[46];let E;n[47]!==p||n[48]!==h||n[49]!==m?(E=g.jsxs("div",{className:"flex flex-col gap-4",children:[p,h,m]}),n[47]=p,n[48]=h,n[49]=m,n[50]=E):E=n[50];let x;return n[51]!==E||n[52]!==d?(x=g.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[d,E]}),n[51]=E,n[52]=d,n[53]=x):x=n[53],x}),Ay=V.memo(function(e){const n=W.c(27),{model:r,onHover:i,isSelected:a,hasExpandedInfo:s}=e,u=s?"rounded-t-xl":"rounded-xl";let o;n[0]!==u?(o=te("flex items-center gap-2 h-10 py-4 px-3 hover:bg-accent cursor-pointer",u),n[0]=u,n[1]=o):o=n[1];let l;n[2]!==r||n[3]!==i?(l=()=>i(r),n[2]=r,n[3]=i,n[4]=l):l=n[4];let f;n[5]!==r.logo||n[6]!==r.name?(f=r.logo&&g.jsx("img",{src:r.logo,className:"w-5 h-5 shrink-0",alt:r.name}),n[5]=r.logo,n[6]=r.name,n[7]=f):f=n[7];let d;n[8]!==r.name?(d=g.jsx("span",{className:"text-sm text-foreground",children:r.name}),n[8]=r.name,n[9]=d):d=n[9];let p;n[10]!==s||n[11]!==r.capabilities?(p=s&&r.capabilities&&r.capabilities.length>0&&g.jsx("div",{className:"md:hidden flex items-center gap-1.5 ml-auto",children:r.capabilities.map(Ny)}),n[10]=s,n[11]=r.capabilities,n[12]=p):p=n[12];let h;n[13]!==s||n[14]!==a?(h=a&&!s&&g.jsx(qt,{className:"w-4 h-4 text-foreground ml-auto"}),n[13]=s,n[14]=a,n[15]=h):h=n[15];let m;n[16]!==s||n[17]!==a?(m=a&&s&&g.jsx(qt,{className:"w-4 h-4 text-foreground ml-2 shrink-0"}),n[16]=s,n[17]=a,n[18]=m):m=n[18];let E;return n[19]!==o||n[20]!==l||n[21]!==f||n[22]!==d||n[23]!==p||n[24]!==h||n[25]!==m?(E=g.jsxs("div",{className:o,onMouseEnter:l,children:[f,d,p,h,m]}),n[19]=o,n[20]=l,n[21]=f,n[22]=d,n[23]=p,n[24]=h,n[25]=m,n[26]=E):E=n[26],E});function Cy(t){const e=W.c(9),{model:n}=t;if(!n){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("span",{className:"text-sm text-muted-foreground",children:"Select model"}),e[0]=s):s=e[0],s}let r;e[1]!==n.logo||e[2]!==n.name?(r=n.logo&&g.jsx("img",{src:n.logo,className:"w-4 h-4",alt:n.name}),e[1]=n.logo,e[2]=n.name,e[3]=r):r=e[3];let i;e[4]!==n.name?(i=g.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:n.name}),e[4]=n.name,e[5]=i):i=e[5];let a;return e[6]!==r||e[7]!==i?(a=g.jsxs("div",{className:"flex items-center gap-2",children:[r,i]}),e[6]=r,e[7]=i,e[8]=a):a=e[8],a}function Iy(t){const e=W.c(57),{selectedModel:n,onModelChange:r,variant:i,className:a,placeholder:s}=t,u=i===void 0?"borderless":i,o=s===void 0?"Select model":s,[l,f]=V.useState(!1),[d,p]=V.useState(null),[h,m]=V.useState(!1),E=xy();let x;e[0]!==E||e[1]!==n?(x=n?E.find(ce=>ce.id===n.id&&ce.connectionId===n.connectionId)?.id:void 0,e[0]=E,e[1]=n,e[2]=x):x=e[2];const T=x;let k;if(e[3]!==E||e[4]!==T){let ce;e[6]!==T?(ce=me=>me.id===T,e[6]=T,e[7]=ce):ce=e[7],k=E.find(ce),e[3]=E,e[4]=T,e[5]=k}else k=e[5];const b=k;let N;e[8]!==E||e[9]!==r?(N=ce=>{const me=E.find(ge=>ge.id===ce);me&&(r({id:me.id,connectionId:me.connectionId,provider:me.provider??void 0}),f(!1))},e[8]=E,e[9]=r,e[10]=N):N=e[10];const v=N;if(E.length===0)return null;const C=T||"",L=u==="borderless"&&"md:border-none";let M;e[11]!==a||e[12]!==L?(M=te("h-8! text-sm hover:bg-accent rounded-lg py-1 px-2 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0",L,a),e[11]=a,e[12]=L,e[13]=M):M=e[13];let F;e[14]!==b?(F=g.jsx(Cy,{model:b}),e[14]=b,e[15]=F):F=e[15];let w;e[16]!==o||e[17]!==F?(w=g.jsx(Vo,{placeholder:o,children:F}),e[16]=o,e[17]=F,e[18]=w):w=e[18];let B;e[19]!==w||e[20]!==M?(B=g.jsx(qo,{className:M,children:w}),e[19]=w,e[20]=M,e[21]=B):B=e[21];let $;e[22]!==h?($=()=>m(!h),e[22]=h,e[23]=$):$=e[23];const J=h?"text-foreground":"text-muted-foreground";let q;e[24]!==J?(q=te("w-5 h-5 transition-colors",J),e[24]=J,e[25]=q):q=e[25];let z;e[26]!==q?(z=g.jsx(Df,{className:q}),e[26]=q,e[27]=z):z=e[27];let Q;e[28]!==$||e[29]!==z?(Q=g.jsx("button",{type:"button",onClick:$,className:"md:hidden flex items-center justify-center h-8 w-8 rounded-lg hover:bg-accent transition-colors","aria-label":"Toggle model info",children:z}),e[28]=$,e[29]=z,e[30]=Q):Q=e[30];let ie;if(e[31]!==v||e[32]!==E||e[33]!==T||e[34]!==h){let ce;e[36]!==v||e[37]!==T||e[38]!==h?(ce=me=>g.jsxs("div",{onClick:()=>v(me.id),className:te("rounded-xl mb-1",me.id===T&&"bg-accent"),children:[g.jsx(Ay,{model:me,onHover:p,isSelected:me.id===T,hasExpandedInfo:h}),h&&g.jsx("div",{className:"md:hidden",children:g.jsx(Fu,{model:me,compact:!0})})]},me.id),e[36]=v,e[37]=T,e[38]=h,e[39]=ce):ce=e[39],ie=E.map(ce),e[31]=v,e[32]=E,e[33]=T,e[34]=h,e[35]=ie}else ie=e[35];let be;e[40]!==ie?(be=g.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 md:border-r",children:ie}),e[40]=ie,e[41]=be):be=e[41];const Re=d||b||null;let I;e[42]!==Re?(I=g.jsx("div",{className:"hidden md:block md:w-[300px] p-3",children:g.jsx(Fu,{model:Re})}),e[42]=Re,e[43]=I):I=e[43];let Ie;e[44]!==be||e[45]!==I?(Ie=g.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[be,I]}),e[44]=be,e[45]=I,e[46]=Ie):Ie=e[46];let Ee;e[47]!==o||e[48]!==Q||e[49]!==Ie?(Ee=g.jsx(Yo,{title:o,className:"w-full md:w-auto md:min-w-[600px] [&_button[aria-label='Scroll down']]:!hidden [&_button[aria-label='Scroll up']]:!hidden",headerActions:Q,children:Ie}),e[47]=o,e[48]=Q,e[49]=Ie,e[50]=Ee):Ee=e[50];let S;return e[51]!==v||e[52]!==l||e[53]!==B||e[54]!==Ee||e[55]!==C?(S=g.jsxs(Zo,{open:l,onOpenChange:f,value:C,onValueChange:v,children:[B,Ee]}),e[51]=v,e[52]=l,e[53]=B,e[54]=Ee,e[55]=C,e[56]=S):S=e[56],S}function Sy(t){return g.jsx(Xc,{capability:t},t)}function Ny(t){return g.jsx(Xc,{capability:t},t)}function wy({messageCount:t,sentinelRef:e}){const n=V.useRef(t),r=V.useRef(0);t>n.current&&r.current!==t&&queueMicrotask(()=>{e.current?.scrollIntoView({behavior:"smooth",block:"start"}),r.current=t}),n.current=t}function $r(t,e){const n=V.Children.toArray(t);for(const r of n)if(V.isValidElement(r)&&r.type===e)return r;return null}function vy(t,e){return V.Children.toArray(t).filter(n=>V.isValidElement(n)?!e.includes(n.type):!0)}function Ry(t){const e=W.c(5),{className:n,children:r}=t;let i;e[0]!==n?(i=te("h-full",n),e[0]=n,e[1]=i):i=e[1];let a;return e[2]!==r||e[3]!==i?(a=g.jsx(Wr,{className:i,children:r}),e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function Oy(t){const e=W.c(11),{children:n}=t;let r;e[0]!==n?(r=$r(n,Jc),e[0]=n,e[1]=r):r=e[1];const i=r;let a;e[2]!==n?(a=$r(n,ed),e[2]=n,e[3]=a):a=e[3];const s=a,u=i?.props.children;let o;e[4]!==u?(o=g.jsx("div",{className:"flex items-center gap-2",children:u}),e[4]=u,e[5]=o):o=e[5];const l=s?.props.children;let f;e[6]!==l?(f=g.jsx("div",{className:"flex items-center gap-1",children:l}),e[6]=l,e[7]=f):f=e[7];let d;return e[8]!==o||e[9]!==f?(d=g.jsxs(Wr.Header,{children:[o,f]}),e[8]=o,e[9]=f,e[10]=d):d=e[10],d}function Jc(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function ed(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function Ly(t){const e=W.c(6),{children:n,className:r,innerClassName:i}=t;let a;e[0]!==n||e[1]!==i?(a=i?g.jsx("div",{className:te("h-full w-full min-w-0",i),children:n}):n,e[0]=n,e[1]=i,e[2]=a):a=e[2];let s;return e[3]!==r||e[4]!==a?(s=g.jsx(Wr.Content,{className:r,children:a}),e[3]=r,e[4]=a,e[5]=s):s=e[5],s}function Dy(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Py(t){const e=W.c(12),{messages:n,status:r,minHeightOffset:i}=t,a=i===void 0?240:i,s=V.useRef(null);let u;e[0]!==n.length?(u={messageCount:n.length,sentinelRef:s},e[0]=n.length,e[1]=u):u=e[1],wy(u);let o;if(e[2]!==n||e[3]!==r){let d;e[5]!==n.length||e[6]!==r?(d=(p,h)=>p.role==="user"?g.jsx(Ey,{message:p},p.id):p.role==="assistant"?g.jsx(my,{message:p,status:h===n.length-1?r:void 0},p.id):null,e[5]=n.length,e[6]=r,e[7]=d):d=e[7],o=n.map(d),e[2]=n,e[3]=r,e[4]=o}else o=e[4];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=g.jsx(Kc,{children:g.jsx("div",{ref:s,className:"h-0"})}),e[8]=l):l=e[8];let f;return e[9]!==a||e[10]!==o?(f=g.jsxs(by,{minHeightOffset:a,children:[o,l]}),e[9]=a,e[10]=o,e[11]=f):f=e[11],f}function My(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(Wr.Footer,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function ia(t){return null}function aa(t){return null}function By(t){const e=W.c(31),{onSubmit:n,onStop:r,disabled:i,isStreaming:a,placeholder:s,usageMessages:u,children:o}=t,[l,f]=V.useState("");let d,p,h,m,E;if(e[0]!==o||e[1]!==l||e[2]!==a||e[3]!==n){const N=$r(o,ia),v=$r(o,aa);let C;e[9]!==o?(C=vy(o,[ia,aa]),e[9]=o,e[10]=C):C=e[10],p=C;let L;e[11]!==l||e[12]!==a||e[13]!==n?(L=async M=>{if(M?.preventDefault(),!l?.trim()||a)return;const F=l.trim();try{await n(F),f("")}catch(w){const B=w;console.error("Failed to send message:",B);const $=B instanceof Error?B.message:"Failed to send message";kr.error($)}},e[11]=l,e[12]=a,e[13]=n,e[14]=L):L=e[14],d=L,h="flex items-center gap-2 min-w-0",m=v?g.jsx("div",{className:te("flex items-center gap-2 flex-wrap min-w-0",v.props.disabled&&"pointer-events-none opacity-60"),children:g.jsx(wp,{selectedGatewayId:v.props.selectedGatewayId,onGatewayChange:v.props.onGatewayChange,placeholder:"Gateway",variant:"bordered",className:v.props.className})}):null,E=N?g.jsx("div",{className:te("flex items-center gap-2 flex-wrap min-w-0",N.props.disabled&&"pointer-events-none opacity-60"),children:g.jsx(Iy,{selectedModel:N.props.selectedModel,onModelChange:N.props.onModelChange,placeholder:"Model",variant:"borderless",className:N.props.className})}):null,e[0]=o,e[1]=l,e[2]=a,e[3]=n,e[4]=d,e[5]=p,e[6]=h,e[7]=m,e[8]=E}else d=e[4],p=e[5],h=e[6],m=e[7],E=e[8];let x;e[15]!==u?(x=u?g.jsx(Gc,{messages:u}):null,e[15]=u,e[16]=x):x=e[16];let T;e[17]!==p||e[18]!==h||e[19]!==m||e[20]!==E||e[21]!==x?(T=g.jsxs("div",{className:h,children:[m,E,p,x]}),e[17]=p,e[18]=h,e[19]=m,e[20]=E,e[21]=x,e[22]=T):T=e[22];const k=T;let b;return e[23]!==i||e[24]!==d||e[25]!==l||e[26]!==a||e[27]!==k||e[28]!==r||e[29]!==s?(b=g.jsx(gp,{value:l,onChange:f,onSubmit:d,onStop:r,disabled:i,isStreaming:a,placeholder:s,leftActions:k}),e[23]=i,e[24]=d,e[25]=l,e[26]=a,e[27]=k,e[28]=r,e[29]=s,e[30]=b):b=e[30],b}const fI=Object.assign(Ry,{Header:Object.assign(Oy,{Left:Jc,Right:ed}),Main:Ly,Messages:Py,EmptyState:Dy,Footer:My,Input:Object.assign(By,{ModelSelector:ia,GatewaySelector:aa})});function Gt(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Fy(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=Gt(i),n.then(a=>{a.onclose=()=>n=void 0},()=>{}),n};return(i,a)=>r().then(s=>a(s.transaction(e,i).objectStore(e)))}let Li;function li(){return Li||(Li=Fy("keyval-store","keyval")),Li}function Ja(t,e=li()){return e("readonly",n=>Gt(n.get(t)))}function Wn(t,e,n=li()){return n("readwrite",r=>(r.put(e,t),Gt(r.transaction)))}function td(t,e=li()){return e("readwrite",n=>(n.delete(t),Gt(n.transaction)))}function Uy(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Gt(t.transaction)}function nd(t=li()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Gt(e.getAllKeys()),Gt(e.getAll())]).then(([r,i])=>r.map((a,s)=>[a,i[s]]));const n=[];return t("readonly",r=>Uy(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function Hy(t,e){const n=`${t}:threads:${e}`;return await Ja(n)??null}async function zy(t){const e=`${t}:threads:`;return(await nd()).filter(([i])=>typeof i=="string"&&i.startsWith(e)).map(([,i])=>i).filter(i=>!i.hidden).sort((i,a)=>String(a.updated_at).localeCompare(String(i.updated_at)))}function jy(t,e){const n=`${t}:messages:`;return nd().then(r=>r.filter(([a])=>typeof a=="string"&&a.startsWith(n)).map(([,a])=>a).filter(a=>a.metadata?.thread_id===e||a.threadId===e).sort((a,s)=>{const u=a.metadata?.created_at||a.createdAt||"",o=s.metadata?.created_at||s.createdAt||"";return String(u).localeCompare(String(o))}))}function hI(){const t=W.c(12),{locator:e}=mn();let n;t[0]!==e?(n=We.threads(e),t[0]=e,t[1]=n):n=t[1];let r;t[2]!==e?(r=()=>zy(e),t[2]=e,t[3]=r):r=t[3];let i;t[4]!==n||t[5]!==r?(i={queryKey:n,queryFn:r,staleTime:3e4},t[4]=n,t[5]=r,t[6]=i):i=t[6];const{data:a,refetch:s}=Ea(i);let u;t[7]!==a?(u=a??[],t[7]=a,t[8]=u):u=t[8];let o;return t[9]!==s||t[10]!==u?(o={threads:u,refetch:s},t[9]=s,t[10]=u,t[11]=o):o=t[11],o}function $y(t){const e=W.c(11),{locator:n}=mn();let r;e[0]!==n||e[1]!==t?(r=We.threadMessages(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;e[3]!==n||e[4]!==t?(i=()=>jy(n,t),e[3]=n,e[4]=t,e[5]=i):i=e[5];let a;e[6]!==r||e[7]!==i?(a={queryKey:r,queryFn:i,staleTime:3e4},e[6]=r,e[7]=i,e[8]=a):a=e[8];const{data:s}=Ea(a);let u;return e[9]!==s?(u=s??[],e[9]=s,e[10]=u):u=e[10],u}function Zy(){const t=W.c(28),{locator:e}=mn(),n=po();let r;t[0]!==e?(r=async x=>{const T=`${e}:threads:${x.id}`;return await Wn(T,x),x},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=()=>{n.invalidateQueries({queryKey:We.threads(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=$t(a);let u;t[8]!==e?(u=async x=>{const{id:T,updates:k}=x,b=`${e}:threads:${T}`,N=await Ja(b);if(!N)throw new Error(`Thread ${T} not found`);const v={...N,...k};return await Wn(b,v),v},t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=x=>{n.invalidateQueries({queryKey:We.threads(e)}),n.invalidateQueries({queryKey:We.thread(e,x.id)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=$t(l);let d;t[16]!==e?(d=async x=>{const T=`${e}:threads:${x}`;return await td(T),x},t[16]=e,t[17]=d):d=t[17];let p;t[18]!==e||t[19]!==n?(p=()=>{n.invalidateQueries({queryKey:We.threads(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h={mutationFn:d,onSuccess:p},t[21]=d,t[22]=p,t[23]=h):h=t[23];const m=$t(h);let E;return t[24]!==m||t[25]!==s||t[26]!==f?(E={insert:s,update:f,delete:m},t[24]=m,t[25]=s,t[26]=f,t[27]=E):E=t[27],E}function Yy(){const t=W.c(37),{locator:e}=mn(),n=po();let r;t[0]!==e?(r=async N=>{const v=`${e}:messages:${N.id}`;return await Wn(v,N),N},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=N=>{const v=N.metadata?.thread_id||N.threadId;v&&n.invalidateQueries({queryKey:We.threadMessages(e,v)}),n.invalidateQueries({queryKey:We.messages(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=$t(a);let u;t[8]!==e?(u=async N=>(await Promise.all(N.map(v=>{const C=`${e}:messages:${v.id}`;return Wn(C,v)})),N),t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=N=>{const v=new Set;for(const C of N){const L=C.metadata?.thread_id||C.threadId;L&&v.add(L)}for(const C of v)n.invalidateQueries({queryKey:We.threadMessages(e,C)});n.invalidateQueries({queryKey:We.messages(e)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=$t(l);let d;t[16]!==e?(d=async N=>{const{id:v,updates:C}=N,L=`${e}:messages:${v}`,M=await Ja(L);if(!M)throw new Error(`Message ${v} not found`);const F={...M,...C};return await Wn(L,F),F},t[16]=e,t[17]=d):d=t[17];let p;t[18]!==e||t[19]!==n?(p=N=>{const v=N.metadata?.thread_id||N.threadId;v&&n.invalidateQueries({queryKey:We.threadMessages(e,v)}),n.invalidateQueries({queryKey:We.messages(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h={mutationFn:d,onSuccess:p},t[21]=d,t[22]=p,t[23]=h):h=t[23];const m=$t(h);let E;t[24]!==e?(E=async N=>{const v=`${e}:messages:${N}`;return await td(v),N},t[24]=e,t[25]=E):E=t[25];let x;t[26]!==e||t[27]!==n?(x=()=>{n.invalidateQueries({queryKey:We.messages(e)})},t[26]=e,t[27]=n,t[28]=x):x=t[28];let T;t[29]!==x||t[30]!==E?(T={mutationFn:E,onSuccess:x},t[29]=x,t[30]=E,t[31]=T):T=t[31];const k=$t(T);let b;return t[32]!==k||t[33]!==s||t[34]!==f||t[35]!==m?(b={insert:s,insertMany:f,update:m,delete:k},t[32]=k,t[33]=s,t[34]=f,t[35]=m,t[36]=b):b=t[36],b}var rd="vercel.ai.error",qy=Symbol.for(rd),Uu,Hu,Pt=class id extends(Hu=Error,Uu=qy,Hu){constructor({name:e,message:n,cause:r}){super(n),this[Uu]=!0,this.name=e,this.cause=r}static isInstance(e){return id.hasMarker(e,rd)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function ad(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var sd="AI_InvalidArgumentError",ud=`vercel.ai.error.${sd}`,Vy=Symbol.for(ud),zu,ju,Wy=class extends(ju=Pt,zu=Vy,ju){constructor({message:t,cause:e,argument:n}){super({name:sd,message:t,cause:e}),this[zu]=!0,this.argument=n}static isInstance(t){return Pt.hasMarker(t,ud)}},od="AI_JSONParseError",ld=`vercel.ai.error.${od}`,Gy=Symbol.for(ld),$u,Zu,Yu=class extends(Zu=Pt,$u=Gy,Zu){constructor({text:t,cause:e}){super({name:od,message:`JSON parsing failed: Text: ${t}.
|
|
113
|
+
`))}function o(h,m,E,x){const T=E.enter("tableCell"),k=E.enter("phrasing"),b=E.containerPhrasing(h,{...x,before:a,after:a});return k(),T(),b}function l(h,m){return bx(h,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function f(h,m,E){const x=h.children;let T=-1;const k=[],b=m.enter("table");for(;++T<x.length;)k[T]=d(x[T],m,E);return b(),k}function d(h,m,E){const x=h.children;let T=-1;const k=[],b=m.enter("tableRow");for(;++T<x.length;)k[T]=o(x[T],h,m,E);return b(),k}function p(h,m,E){let x=Bc.inlineCode(h,m,E);return E.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function i3(){return{exit:{taskListCheckValueChecked:Pu,taskListCheckValueUnchecked:Pu,paragraph:s3}}}function a3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:u3}}}function Pu(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function s3(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let a=-1,s;for(;++a<i.length;){const u=i[a];if(u.type==="paragraph"){s=u;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function u3(t,e,n,r){const i=t.children[0],a=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(s);let o=Bc.listItem(t,e,n,{...r,...u.current()});return a&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),o;function l(f){return f+s}}function o3(){return[H_(),ux(),dx(),Kx(),i3()]}function l3(t){return{extensions:[z_(),ox(t),fx(),r3(t),a3()]}}const c3={tokenize:g3,partial:!0},Fc={tokenize:b3,partial:!0},Uc={tokenize:E3,partial:!0},Hc={tokenize:T3,partial:!0},d3={tokenize:_3,partial:!0},zc={name:"wwwAutolink",tokenize:p3,previous:$c},jc={name:"protocolAutolink",tokenize:m3,previous:Zc},It={name:"emailAutolink",tokenize:h3,previous:Yc},Tt={};function f3(){return{text:Tt}}let Ht=48;for(;Ht<123;)Tt[Ht]=It,Ht++,Ht===58?Ht=65:Ht===91&&(Ht=97);Tt[43]=It;Tt[45]=It;Tt[46]=It;Tt[95]=It;Tt[72]=[It,jc];Tt[104]=[It,jc];Tt[87]=[It,zc];Tt[119]=[It,zc];function h3(t,e,n){const r=this;let i,a;return s;function s(d){return!ra(d)||!Yc.call(r,r.previous)||Ka(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(d))}function u(d){return ra(d)?(t.consume(d),u):d===64?(t.consume(d),o):n(d)}function o(d){return d===46?t.check(d3,f,l)(d):d===45||d===95||Be(d)?(a=!0,t.consume(d),o):f(d)}function l(d){return t.consume(d),i=!0,o}function f(d){return a&&i&&$e(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function p3(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!$c.call(r,r.previous)||Ka(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(c3,t.attempt(Fc,t.attempt(Uc,a),n),n)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function m3(t,e,n){const r=this;let i="",a=!1;return s;function s(d){return(d===72||d===104)&&Zc.call(r,r.previous)&&!Ka(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),u):n(d)}function u(d){if($e(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),u;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),o}return n(d)}function o(d){return d===47?(t.consume(d),a?l:(a=!0,o)):n(d)}function l(d){return d===null||Br(d)||xe(d)||Wt(d)||Jr(d)?n(d):t.attempt(Fc,t.attempt(Uc,f),n)(d)}function f(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function g3(t,e,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),i):s===46&&r===3?(t.consume(s),a):n(s)}function a(s){return s===null?n(s):e(s)}}function b3(t,e,n){let r,i,a;return s;function s(l){return l===46||l===95?t.check(Hc,o,u)(l):l===null||xe(l)||Wt(l)||l!==45&&Jr(l)?o(l):(a=!0,t.consume(l),s)}function u(l){return l===95?r=!0:(i=r,r=void 0),t.consume(l),s}function o(l){return i||r||!a?n(l):e(l)}}function E3(t,e){let n=0,r=0;return i;function i(s){return s===40?(n++,t.consume(s),i):s===41&&r<n?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(Hc,e,a)(s):s===null||xe(s)||Wt(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&r++,t.consume(s),i}}function T3(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),a):u===93?(t.consume(u),i):u===60||u===null||xe(u)||Wt(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||xe(u)||Wt(u)?e(u):r(u)}function a(u){return $e(u)?s(u):n(u)}function s(u){return u===59?(t.consume(u),r):$e(u)?(t.consume(u),s):n(u)}}function _3(t,e,n){return r;function r(a){return t.consume(a),i}function i(a){return Be(a)?n(a):e(a)}}function $c(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||xe(t)}function Zc(t){return!$e(t)}function Yc(t){return!(t===47||ra(t))}function ra(t){return t===43||t===45||t===46||t===95||Be(t)}function Ka(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const x3={tokenize:w3,partial:!0};function y3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:I3,continuation:{tokenize:S3},exit:N3}},text:{91:{name:"gfmFootnoteCall",tokenize:C3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:k3,resolveTo:A3}}}}function k3(t,e,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){s=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return u;function u(o){if(!s||!s._balanced)return n(o);const l=dt(r.sliceSerialize({start:s.end,end:r.now()}));return l.codePointAt(0)!==94||!a.includes(l.slice(1))?n(o):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(o),t.exit("gfmFootnoteCallLabelMarker"),e(o))}}function A3(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function C3(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,s;return u;function u(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),o}function o(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(d){if(a>999||d===93&&!s||d===null||d===91||xe(d))return n(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(dt(r.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return xe(d)||(s=!0),a++,t.consume(d),d===92?f:l}function f(d){return d===91||d===92||d===93?(t.consume(d),a++,l):l(d)}}function I3(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,s=0,u;return o;function o(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),l}function l(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(m)}function f(m){if(s>999||m===93&&!u||m===null||m===91||xe(m))return n(m);if(m===93){t.exit("chunkString");const E=t.exit("gfmFootnoteDefinitionLabelString");return a=dt(r.sliceSerialize(E)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return xe(m)||(u=!0),s++,t.consume(m),m===92?d:f}function d(m){return m===91||m===92||m===93?(t.consume(m),s++,f):f(m)}function p(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(a)||i.push(a),le(t,h,"gfmFootnoteDefinitionWhitespace")):n(m)}function h(m){return e(m)}}function S3(t,e,n){return t.check(or,e,t.attempt(x3,e,n))}function N3(t){t.exit("gfmFootnoteDefinition")}function w3(t,e,n){const r=this;return le(t,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(a):n(a)}}function v3(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,u){let o=-1;for(;++o<s.length;)if(s[o][0]==="enter"&&s[o][1].type==="strikethroughSequenceTemporary"&&s[o][1]._close){let l=o;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[o][1].end.offset-s[o][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[o][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[o][1].end)},d={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[o][1].start)},p=[["enter",f,u],["enter",s[l][1],u],["exit",s[l][1],u],["enter",d,u]],h=u.parser.constructs.insideSpan.null;h&&tt(p,p.length,0,ei(h,s.slice(l+1,o),u)),tt(p,p.length,0,[["exit",d,u],["enter",s[o][1],u],["exit",s[o][1],u],["exit",f,u]]),tt(s,l-1,o-l+3,p),o=l+p.length-2;break}}for(o=-1;++o<s.length;)s[o][1].type==="strikethroughSequenceTemporary"&&(s[o][1].type="data");return s}function a(s,u,o){const l=this.previous,f=this.events;let d=0;return p;function p(m){return l===126&&f[f.length-1][1].type!=="characterEscape"?o(m):(s.enter("strikethroughSequenceTemporary"),h(m))}function h(m){const E=cn(l);if(m===126)return d>1?o(m):(s.consume(m),d++,h);if(d<2&&!n)return o(m);const x=s.exit("strikethroughSequenceTemporary"),T=cn(m);return x._open=!T||T===2&&!!E,x._close=!E||E===2&&!!T,u(m)}}}class R3{constructor(){this.map=[]}add(e,n,r){O3(this,e,n,r)}consume(e){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const a of i)e.push(a);i=r.pop()}this.map.length=0}}function O3(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function L3(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function D3(){return{flow:{null:{name:"table",tokenize:P3,resolveAll:M3}}}}function P3(t,e,n){const r=this;let i=0,a=0,s;return u;function u(w){let B=r.events.length-1;for(;B>-1;){const q=r.events[B][1].type;if(q==="lineEnding"||q==="linePrefix")B--;else break}const $=B>-1?r.events[B][1].type:null,J=$==="tableHead"||$==="tableRow"?C:o;return J===C&&r.parser.lazy[r.now().line]?n(w):J(w)}function o(w){return t.enter("tableHead"),t.enter("tableRow"),l(w)}function l(w){return w===124||(s=!0,a+=1),f(w)}function f(w){return w===null?n(w):K(w)?a>1?(a=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),h):n(w):se(w)?le(t,f,"whitespace")(w):(a+=1,s&&(s=!1,i+=1),w===124?(t.enter("tableCellDivider"),t.consume(w),t.exit("tableCellDivider"),s=!0,f):(t.enter("data"),d(w)))}function d(w){return w===null||w===124||xe(w)?(t.exit("data"),f(w)):(t.consume(w),w===92?p:d)}function p(w){return w===92||w===124?(t.consume(w),d):d(w)}function h(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(t.enter("tableDelimiterRow"),s=!1,se(w)?le(t,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):m(w))}function m(w){return w===45||w===58?x(w):w===124?(s=!0,t.enter("tableCellDivider"),t.consume(w),t.exit("tableCellDivider"),E):v(w)}function E(w){return se(w)?le(t,x,"whitespace")(w):x(w)}function x(w){return w===58?(a+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(w),t.exit("tableDelimiterMarker"),T):w===45?(a+=1,T(w)):w===null||K(w)?N(w):v(w)}function T(w){return w===45?(t.enter("tableDelimiterFiller"),k(w)):v(w)}function k(w){return w===45?(t.consume(w),k):w===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(w),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(w))}function b(w){return se(w)?le(t,N,"whitespace")(w):N(w)}function N(w){return w===124?m(w):w===null||K(w)?!s||i!==a?v(w):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(w)):v(w)}function v(w){return n(w)}function C(w){return t.enter("tableRow"),L(w)}function L(w){return w===124?(t.enter("tableCellDivider"),t.consume(w),t.exit("tableCellDivider"),L):w===null||K(w)?(t.exit("tableRow"),e(w)):se(w)?le(t,L,"whitespace")(w):(t.enter("data"),M(w))}function M(w){return w===null||w===124||xe(w)?(t.exit("data"),L(w)):(t.consume(w),w===92?F:M)}function F(w){return w===92||w===124?(t.consume(w),M):M(w)}}function M3(t,e){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],u=!1,o=0,l,f,d;const p=new R3;for(;++n<t.length;){const h=t[n],m=h[1];h[0]==="enter"?m.type==="tableHead"?(u=!1,o!==0&&(Mu(p,e,o,l,f),f=void 0,o=0),l={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",l,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,a=[0,0,0,0],s=[0,n+1,0,0],u&&(u=!1,f={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",f,e]])),i=m.type==="tableDelimiterRow"?2:f?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],d=_r(p,e,a,i,void 0,d),a=[0,0,0,0]),s[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],d=_r(p,e,a,i,void 0,d)),a=s,s=[a[1],n,0,0])):m.type==="tableHead"?(u=!0,o=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(o=n,a[1]!==0?(s[0]=s[1],d=_r(p,e,a,i,n,d)):s[1]!==0&&(d=_r(p,e,s,i,n,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&Mu(p,e,o,l,f),p.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=L3(e.events,n))}return t}function _r(t,e,n,r,i,a){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},an(e.events,n[0])),t.add(n[0],0,[["exit",a,e]]));const o=an(e.events,n[1]);if(a={type:s,start:Object.assign({},o),end:Object.assign({},o)},t.add(n[1],0,[["enter",a,e]]),n[2]!==0){const l=an(e.events,n[2]),f=an(e.events,n[3]),d={type:u,start:Object.assign({},l),end:Object.assign({},f)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const p=e.events[n[2]],h=e.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,E=n[3]-n[2]-1;t.add(m,E,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(a.end=Object.assign({},an(e.events,i)),t.add(i,0,[["exit",a,e]]),a=void 0),a}function Mu(t,e,n,r,i){const a=[],s=an(e.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,e])),r.end=Object.assign({},s),a.push(["exit",r,e]),t.add(n+1,0,a)}function an(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const B3={name:"tasklistCheck",tokenize:U3};function F3(){return{text:{91:B3}}}function U3(t,e,n){const r=this;return i;function i(o){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(o):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),a)}function a(o){return xe(o)?(t.enter("taskListCheckValueUnchecked"),t.consume(o),t.exit("taskListCheckValueUnchecked"),s):o===88||o===120?(t.enter("taskListCheckValueChecked"),t.consume(o),t.exit("taskListCheckValueChecked"),s):n(o)}function s(o){return o===93?(t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(o)}function u(o){return K(o)?e(o):se(o)?t.check({tokenize:H3},e,n)(o):n(o)}}function H3(t,e,n){return le(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function z3(t){return _l([f3(),y3(),v3(t),D3(),F3()])}const j3={};function $3(t){const e=this,n=t||j3,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(z3(n)),a.push(o3()),s.push(l3(n))}const Z3=V.lazy(()=>Kd(()=>import("./lazy-highlighter-CqCOmbZ8.js"),__vite__mapDeps([0,1,2,3,4])));function qc(){const t=W.c(3),[e,n]=V.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function Y3(){const t=W.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[85,70],t[0]=e):e=t[0];const n=e;let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"p-4 font-mono text-sm",style:{background:"#2d2d2d",borderRadius:"0 0 0.5rem 0.5rem",overflow:"auto",minHeight:"4rem"},children:n.map(q3)}),t[1]=r):r=t[1],r}function q3(t,e){return g.jsxs("div",{className:"flex gap-2 items-center my-1",children:[e>2&&e<7&&g.jsx("div",{className:"w-4 h-4 rounded-sm opacity-40 animate-pulse",style:{background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.1}s`}}),e%4===0&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"3rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.12}s`}}),e%3===1&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"2.5rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.14}s`}}),g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:`${t}%`,background:"rgba(255, 255, 255, 0.1)",animationDelay:`${e*.1}s`}}),e%5===2&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"4rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.16}s`}})]},e)}function V3(t){const e=W.c(12),n=V.useRef(null),{handleCopy:r,copied:i}=qc(),a=W3;let s;e[0]!==r?(s=async()=>{const p=a(n.current);await r(p)},e[0]=r,e[1]=s):s=e[1];const u=s;let o;e[2]!==i?(o=i?g.jsx(qt,{size:12}):g.jsx(Yr,{size:12}),e[2]=i,e[3]=o):o=e[3];let l;e[4]!==u||e[5]!==o?(l=g.jsx("div",{className:"flex justify-end items-center",children:g.jsxs(Mt,{variant:"ghost",onClick:u,"aria-label":"Copy as CSV",className:"text-muted-foreground hover:text-foreground h-6 text-[10px]",type:"button",children:["Copy as CSV",o]})}),e[4]=u,e[5]=o,e[6]=l):l=e[6];let f;e[7]!==t?(f=g.jsx("div",{className:"overflow-x-auto mb-4 rounded-lg border border-border",children:g.jsx("table",{ref:n,...t,className:"min-w-full border-collapse text-sm",children:t.children})}),e[7]=t,e[8]=f):f=e[8];let d;return e[9]!==l||e[10]!==f?(d=g.jsxs(g.Fragment,{children:[l,f]}),e[9]=l,e[10]=f,e[11]=d):d=e[11],d}function W3(t){return t?Array.from(t.querySelectorAll("tr")).map(G3).join(`
|
|
114
|
+
`):""}function G3(t){return Array.from(t.querySelectorAll("th,td")).map(Q3).join(",")}function Q3(t){let e=t.textContent||"";return e=e.replace(/"/g,'""'),e.search(/([",\n])/g)>=0&&(e=`"${e}"`),e}const K3=[$3],X3=[D_],J3={p:t=>g.jsx("p",{...t,className:"leading-relaxed text-sm"}),strong:t=>g.jsx("strong",{...t,className:"font-bold"}),em:t=>g.jsx("em",{...t,className:"italic"}),a:t=>g.jsx("a",{...t,target:"_blank",rel:"noopener noreferrer",className:"text-primary-dark hover:underline break-all font-medium"}),ul:t=>g.jsx("ul",{...t,className:"list-disc ml-6 my-4 space-y-2"}),ol:t=>g.jsx("ol",{...t,className:"list-decimal ml-6 my-4 space-y-2"}),li:t=>g.jsx("li",{...t,className:"leading-relaxed text-sm"}),code:t=>g.jsx("code",{...t,className:"px-1 py-0.5 bg-muted rounded text-sm font-mono break-all"}),pre:t=>g.jsx("pre",{...t,className:"flex w-full min-w-0 my-4 bg-muted rounded overflow-hidden",children:g.jsx("code",{className:"flex-1 min-w-0 p-4 text-sm font-mono whitespace-pre overflow-x-auto",children:t.children})}),table:t=>g.jsx(V3,{...t}),thead:t=>g.jsx("thead",{...t,className:"bg-muted",children:t.children}),tr:t=>g.jsx("tr",{...t,className:"even:bg-muted/50 border-b border-border last:border-0"}),th:t=>g.jsx("th",{...t,className:"px-4 py-2 text-left font-semibold text-muted-foreground border-b border-border"}),td:t=>g.jsx("td",{...t,className:"px-4 py-2 border-b border-border"})},Vc=V.memo(t=>{const e=W.c(2),{content:n}=t;let r;return e[0]!==n?(r=g.jsx(EE,{remarkPlugins:K3,rehypePlugins:X3,components:J3,children:n}),e[0]=n,e[1]=r):r=e[1],r},(t,e)=>t.content===e.content);function ey(t){const e=W.c(20),{language:n,content:r}=t,{handleCopy:i,copied:a}=qc(),s=n||"text";let u;e[0]!==s?(u=g.jsx("span",{className:"text-xs font-mono uppercase text-muted-foreground tracking-widest select-none",children:s}),e[0]=s,e[1]=u):u=e[1];let o;e[2]!==r||e[3]!==i?(o=()=>i(r),e[2]=r,e[3]=i,e[4]=o):o=e[4];let l;e[5]!==a?(l=a?g.jsx(qt,{size:14}):g.jsx(Yr,{size:14}),e[5]=a,e[6]=l):l=e[6];let f;e[7]!==o||e[8]!==l?(f=g.jsx(Mt,{size:"icon",variant:"ghost",onClick:o,"aria-label":"Copy code",className:"text-muted-foreground hover:text-foreground rounded-lg h-8 w-8",children:l}),e[7]=o,e[8]=l,e[9]=f):f=e[9];let d;e[10]!==u||e[11]!==f?(d=g.jsxs("div",{className:"flex items-center justify-between p-1 pl-4 bg-muted border-b border-border",children:[u,f]}),e[10]=u,e[11]=f,e[12]=d):d=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=g.jsx(Y3,{}),e[13]=p):p=e[13];let h;e[14]!==r||e[15]!==n?(h=g.jsx(V.Suspense,{fallback:p,children:g.jsx(Z3,{language:n,content:r})}),e[14]=r,e[15]=n,e[16]=h):h=e[16];let m;return e[17]!==d||e[18]!==h?(m=g.jsxs("div",{className:"my-4 rounded-lg bg-muted overflow-hidden border border-border grid min-w-0",children:[d,h]}),e[17]=d,e[18]=h,e[19]=m):m=e[19],m}Vc.displayName="MemoizedMarkdownBlock";const Xa=t=>{const e=W.c(7),{id:n,text:r}=t;let i;e[0]!==r?(i=he.lexer(r),e[0]=r,e[1]=i):i=e[1];const a=i;let s;if(e[2]!==a||e[3]!==n){let u;e[5]!==n?(u=(o,l)=>o.type==="code"?g.jsx(ey,{language:o.lang,content:o.text},`${n}-block_${l}`):g.jsx(Vc,{content:o.raw},`${n}-block_${l}`),e[5]=n,e[6]=u):u=e[6],s=a.map(u),e[2]=a,e[3]=n,e[4]=s}else s=e[4];return s};Xa.displayName="MemoizedMarkdown";function ty(t,e){switch(e.type){case"TOGGLE":return{isExpanded:!t.isExpanded,wasManuallyToggled:!0};case"SET_EXPANDED":return t.wasManuallyToggled?t:{...t,isExpanded:e.payload};default:return t}}function ny(t){const e=W.c(38),{part:n,id:r}=t,{state:i}=n,a=i==="streaming";let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={isExpanded:!1,wasManuallyToggled:!1},e[0]=s):s=e[0];const[u,o]=V.useReducer(ty,s),{isExpanded:l}=u;let f,d;e[1]!==a?(f=()=>{o({type:"SET_EXPANDED",payload:a})},d=[a],e[1]=a,e[2]=f,e[3]=d):(f=e[2],d=e[3]),V.useEffect(f,d);let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{o({type:"TOGGLE"})},e[4]=p):p=e[4];const h=p,m=a&&"animate-pulse";let E;e[5]!==m?(E=re("text-muted-foreground transition-opacity",m),e[5]=m,e[6]=E):E=e[6];let x;e[7]!==E?(x=g.jsx(Vr,{className:E}),e[7]=E,e[8]=x):x=e[8];const T=a&&"text-shimmer";let k;e[9]!==T?(k=re("text-sm font-medium text-muted-foreground",T),e[9]=T,e[10]=k):k=e[10];let b;e[11]!==k?(b=g.jsx("span",{className:k,children:"Agent thinking"}),e[11]=k,e[12]=b):b=e[12];const N=l?"rotate-180":"";let v;e[13]!==N?(v=re("text-muted-foreground transition-transform duration-200",N),e[13]=N,e[14]=v):v=e[14];let C;e[15]!==v?(C=g.jsx(xo,{className:v}),e[15]=v,e[16]=C):C=e[16];let L;e[17]!==b||e[18]!==C||e[19]!==x?(L=g.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-2 py-2 transition-colors cursor-pointer",children:[x,b,C]}),e[17]=b,e[18]=C,e[19]=x,e[20]=L):L=e[20];const M=l?a?"max-h-[400px] opacity-100":"max-h-[200px] opacity-80":"max-h-0 opacity-0 overflow-hidden";let F;e[21]!==M?(F=re("transition-all duration-200 ease-in-out",M),e[21]=M,e[22]=F):F=e[22];const w=a?"max-h-[400px]":"max-h-[200px]";let B;e[23]!==w?(B=re("border-l-2 pl-4 overflow-y-auto",w),e[23]=w,e[24]=B):B=e[24];let $;e[25]===Symbol.for("react.memo_cache_sentinel")?($=re("text-muted-foreground markdown-sm pb-2"),e[25]=$):$=e[25];let J;e[26]!==r||e[27]!==n.text?(J=g.jsx("div",{className:$,children:g.jsx(Xa,{id:r,text:n.text})}),e[26]=r,e[27]=n.text,e[28]=J):J=e[28];let q;e[29]!==B||e[30]!==J?(q=g.jsx("div",{className:B,children:J}),e[29]=B,e[30]=J,e[31]=q):q=e[31];let z;e[32]!==F||e[33]!==q?(z=g.jsx("div",{className:F,children:q}),e[32]=F,e[33]=q,e[34]=z):z=e[34];let Q;return e[35]!==L||e[36]!==z?(Q=g.jsxs("div",{className:"flex flex-col",children:[L,z]}),e[35]=L,e[36]=z,e[37]=Q):Q=e[37],Q}function ry(){const t=W.c(3),[e,n]=V.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function Wc(t){const e=W.c(15),{id:n,text:r,copyable:i,extraActions:a}=t,s=i===void 0?!1:i,{handleCopy:u}=ry(),[o,l]=V.useState(!1);let f;e[0]!==u||e[1]!==r?(f=async()=>{await u(r),l(!0),setTimeout(()=>l(!1),2e3)},e[0]=u,e[1]=r,e[2]=f):f=e[2];const d=f,p=s||a;let h;e[3]!==n||e[4]!==r?(h=g.jsx(Xa,{id:n,text:r}),e[3]=n,e[4]=r,e[5]=h):h=e[5];let m;e[6]!==s||e[7]!==a||e[8]!==d||e[9]!==o||e[10]!==p?(m=p&&g.jsx("div",{className:"flex w-full items-center text-xs text-muted-foreground opacity-0 pointer-events-none transition-all duration-200 group-hover/part:opacity-100 group-hover/part:pointer-events-auto mt-2",children:g.jsxs("div",{className:"flex items-center gap-1",children:[s&&g.jsx(Mt,{onClick:d,variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground size-6 whitespace-nowrap",children:o?g.jsx(qt,{size:12}):g.jsx(Yr,{size:12})}),a]})}),e[6]=s,e[7]=a,e[8]=d,e[9]=o,e[10]=p,e[11]=m):m=e[11];let E;return e[12]!==h||e[13]!==m?(E=g.jsxs("div",{className:"group/part relative",children:[h,m]}),e[12]=h,e[13]=m,e[14]=E):E=e[14],E}function iy(t){const e=W.c(28),{toolName:n,input:r,output:i,isError:a}=t;let s;if(e[0]!==i){const l=JSON.stringify(i,null,2);s=l.length>2e3?l.slice(0,2e3)+"...[TRUNCATED]":l,e[0]=i,e[1]=s}else s=e[1];const u=s;if(n==="READ_MCP_TOOLS"){const l=r?.id;if(l){let f;return e[2]!==l?(f=g.jsx(Bu,{connectionId:l}),e[2]=l,e[3]=f):f=e[3],f}}if(n==="CALL_MCP_TOOL"){const l=r?.connectionId;let f;e[4]!==l?(f=l&&g.jsx(Bu,{connectionId:l,compact:!0}),e[4]=l,e[5]=f):f=e[5];let d;e[6]!==i?(d=JSON.stringify(i,null,2),e[6]=i,e[7]=d):d=e[7];let p;e[8]!==d?(p=g.jsx("div",{className:"absolute top-1 right-1 z-10",children:g.jsx(ay,{text:d})}),e[8]=d,e[9]=p):p=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=g.jsx("div",{className:"font-semibold text-muted-foreground mb-0.5 text-[10px] uppercase tracking-wider",children:"Input"}),e[10]=h):h=e[10];let m;e[11]!==r?(m=JSON.stringify(r,null,2),e[11]=r,e[12]=m):m=e[12];let E;e[13]!==m?(E=g.jsx("pre",{className:"whitespace-pre-wrap break-all text-muted-foreground mb-2",children:m}),e[13]=m,e[14]=E):E=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=g.jsx("div",{className:"font-semibold text-muted-foreground mb-0.5 text-[10px] uppercase tracking-wider",children:"Output"}),e[15]=x):x=e[15];const T=`whitespace-pre-wrap break-all ${a?"text-destructive":"text-foreground"}`;let k;e[16]!==u||e[17]!==T?(k=g.jsx("pre",{className:T,children:u}),e[16]=u,e[17]=T,e[18]=k):k=e[18];let b;e[19]!==k||e[20]!==p||e[21]!==E?(b=g.jsxs("div",{className:"relative bg-muted rounded-md p-2 text-xs font-mono overflow-auto max-h-[200px]",children:[p,h,E,x,k]}),e[19]=k,e[20]=p,e[21]=E,e[22]=b):b=e[22];let N;return e[23]!==b||e[24]!==f?(N=g.jsxs("div",{className:"flex flex-col gap-2",children:[f,b]}),e[23]=b,e[24]=f,e[25]=N):N=e[25],N}let o;return e[26]!==u?(o=g.jsx("div",{className:"bg-muted rounded-md p-2 text-xs font-mono overflow-auto max-h-[200px]",children:g.jsx("pre",{className:"whitespace-pre-wrap break-all",children:u})}),e[26]=u,e[27]=o):o=e[27],o}function Bu(t){const e=W.c(15),{connectionId:n,compact:r}=t,i=bf(n),{org:a}=mn(),{slug:s}=a,u=Xd();if(!i)return null;let o;e[0]!==i.id||e[1]!==u||e[2]!==s?(o=()=>{u({to:"/$org/mcps/$connectionId",params:{org:s,connectionId:i.id}})},e[0]=i.id,e[1]=u,e[2]=s,e[3]=o):o=e[3];const l=o;if(r){let d;e[4]!==i.title?(d=g.jsx("span",{className:"font-medium text-foreground",children:i.title}),e[4]=i.title,e[5]=d):d=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=g.jsx(Rf,{size:12}),e[6]=p):p=e[6];let h;e[7]!==l?(h=g.jsx("button",{type:"button",onClick:l,className:"hover:text-foreground transition-colors",title:"Open connection",children:p}),e[7]=l,e[8]=h):h=e[8];let m;return e[9]!==d||e[10]!==h?(m=g.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/50 px-2 py-1 rounded-md w-fit",children:[d,h]}),e[9]=d,e[10]=h,e[11]=m):m=e[11],m}let f;return e[12]!==i||e[13]!==l?(f=g.jsx(vf,{connection:i,onClick:l}),e[12]=i,e[13]=l,e[14]=f):f=e[14],f}function ay({text:t}){const e=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(t),kr.success("Copied to clipboard");else throw new Error("Clipboard API unavailable")}catch(n){try{const r=document.createElement("textarea");r.value=t,r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const i=document.execCommand("copy");if(document.body.removeChild(r),i)kr.success("Copied to clipboard");else throw new Error("Fallback copy failed")}catch(r){console.error("Copy failed",n,r),kr.error("Failed to copy to clipboard")}}};return g.jsx(Mt,{size:"icon",variant:"ghost",className:"h-5 w-5 hover:bg-background/50",onClick:e,children:g.jsx(Yr,{size:12})})}function sy(t){const e=W.c(39),{part:n}=t,{state:r}=n;let i;e[0]!==n?(i="toolName"in n?n.toolName:n.type.replace("tool-",""),e[0]=n,e[1]=i):i=e[1];const a=i;let s;e[2]!==r?(s=r==="output-error"?g.jsx(wf,{className:"h-3.5 w-3.5 text-destructive"}):g.jsx(jo,{className:"h-3.5 w-3.5"}),e[2]=r,e[3]=s):s=e[3];const u=r==="output-error"&&"text-destructive/90";let o;e[4]!==u?(o=re(u),e[4]=u,e[5]=o):o=e[5];const l=r==="input-streaming"&&`Streaming ${a} arguments`,f=r==="input-available"&&`Calling ${a}`,d=r==="output-available"&&`Called ${a}`,p=r==="output-error"&&`Error calling ${a}`;let h;e[6]!==o||e[7]!==l||e[8]!==f||e[9]!==d||e[10]!==p?(h=g.jsxs("span",{className:o,children:[l,f,d,p]}),e[6]=o,e[7]=l,e[8]=f,e[9]=d,e[10]=p,e[11]=h):h=e[11];let m;e[12]!==r?(m=(r==="input-streaming"||r==="input-available")&&g.jsx("span",{className:"animate-spin",children:g.jsx(Of,{size:"xs"})}),e[12]=r,e[13]=m):m=e[13];let E;e[14]!==m||e[15]!==s||e[16]!==h?(E=g.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[s,h,m]}),e[14]=m,e[15]=s,e[16]=h,e[17]=E):E=e[17];const x=r==="output-error"?"border-destructive/50":"border-border";let T;e[18]!==x?(T=re("transition-all duration-200 ease-in-out","border-l-2 pl-3",x),e[18]=x,e[19]=T):T=e[19];let k;e[20]!==n.input||e[21]!==r?(k=(r==="input-streaming"||r==="input-available")&&!!n.input&&g.jsx("div",{className:"text-xs font-mono text-muted-foreground bg-muted/30 p-2 rounded",children:JSON.stringify(n.input,null,2)}),e[20]=n.input,e[21]=r,e[22]=k):k=e[22];let b;e[23]!==n.input||e[24]!==n.output||e[25]!==r||e[26]!==a?(b=r==="output-available"&&g.jsx(iy,{toolName:a,input:n.input,output:n.output}),e[23]=n.input,e[24]=n.output,e[25]=r,e[26]=a,e[27]=b):b=e[27];let N;e[28]!==n||e[29]!==r?(N=r==="output-error"&&g.jsx("div",{className:"text-xs font-mono bg-destructive/10 text-destructive p-2 rounded border border-destructive/20",children:"errorText"in n&&typeof n.errorText=="string"?n.errorText:"An unknown error occurred"}),e[28]=n,e[29]=r,e[30]=N):N=e[30];let v;e[31]!==T||e[32]!==k||e[33]!==b||e[34]!==N?(v=g.jsxs("div",{className:T,children:[k,b,N]}),e[31]=T,e[32]=k,e[33]=b,e[34]=N,e[35]=v):v=e[35];let C;return e[36]!==E||e[37]!==v?(C=g.jsxs("div",{className:"flex flex-col gap-1.5 py-1",children:[E,v]}),e[36]=E,e[37]=v,e[38]=C):C=e[38],C}const uy={openrouter:t=>{const e=t?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function oy(t){if(!t?.providerMetadata)return null;for(const e of Object.values(uy)){const n=e(t.providerMetadata);if(n!==null)return n}return null}function ly(t){return t.reduce((e,n)=>{const r=n.metadata?.usage;return r?{inputTokens:e.inputTokens+(r.inputTokens??0),outputTokens:e.outputTokens+(r.outputTokens??0),totalTokens:e.totalTokens+(r.totalTokens??0),cost:e.cost+(oy(r)??0)}:e},{inputTokens:0,outputTokens:0,totalTokens:0,cost:0})}function Gc(t){const e=W.c(38),{messages:n}=t;let r,i,a,s,u,o,l,f,d,p,h,m;if(e[0]!==n){m=Symbol.for("react.early_return_sentinel");e:{const N=ly(n);if(!N){m=null;break e}const{totalTokens:v,inputTokens:C,outputTokens:L,cost:M}=N;if(a=M,!v&&!C&&!L){m=null;break e}i=go;let F;e[13]===Symbol.for("react.memo_cache_sentinel")?(F=g.jsx(Do,{size:12}),e[13]=F):F=e[13];const w=g.jsxs(Mt,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap",children:[F,g.jsx("span",{className:"text-[10px] font-mono tabular-nums",children:v.toLocaleString()})]});e[14]!==w?(h=g.jsx(bo,{asChild:!0,children:w}),e[14]=w,e[15]=h):h=e[15],r=Eo,d="top",p="font-mono text-[11px]",u="grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",e[16]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx("span",{className:"text-muted",children:"in"}),e[16]=o):o=e[16],l=g.jsx("span",{children:C.toLocaleString()}),e[17]===Symbol.for("react.memo_cache_sentinel")?(f=g.jsx("span",{className:"text-muted",children:"out"}),e[17]=f):f=e[17],s=L.toLocaleString()}e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=s,e[5]=u,e[6]=o,e[7]=l,e[8]=f,e[9]=d,e[10]=p,e[11]=h,e[12]=m}else r=e[1],i=e[2],a=e[3],s=e[4],u=e[5],o=e[6],l=e[7],f=e[8],d=e[9],p=e[10],h=e[11],m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m;let E;e[18]!==s?(E=g.jsx("span",{children:s}),e[18]=s,e[19]=E):E=e[19];let x;e[20]!==a?(x=a>0&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-muted",children:"cost"}),g.jsxs("span",{children:["$",a.toFixed(4)]})]}),e[20]=a,e[21]=x):x=e[21];let T;e[22]!==E||e[23]!==x||e[24]!==u||e[25]!==o||e[26]!==l||e[27]!==f?(T=g.jsxs("div",{className:u,children:[o,l,f,E,x]}),e[22]=E,e[23]=x,e[24]=u,e[25]=o,e[26]=l,e[27]=f,e[28]=T):T=e[28];let k;e[29]!==r||e[30]!==T||e[31]!==d||e[32]!==p?(k=g.jsx(r,{side:d,className:p,children:T}),e[29]=r,e[30]=T,e[31]=d,e[32]=p,e[33]=k):k=e[33];let b;return e[34]!==i||e[35]!==k||e[36]!==h?(b=g.jsxs(i,{children:[h,k]}),e[34]=i,e[35]=k,e[36]=h,e[37]=b):b=e[37],b}const cy={planning:{icon:g.jsx(zo,{className:"text-muted-foreground animate-pulse",size:20}),label:"Planning next moves"},thinking:{icon:g.jsx(Vr,{className:"text-muted-foreground animate-pulse",size:20}),label:"Thinking"}},dy=1200;function fy(){const t=W.c(7),[e,n]=V.useState("planning");let r,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const o=setTimeout(()=>{n("thinking")},dy);return()=>{clearTimeout(o)}},i=[],t[0]=r,t[1]=i):(r=t[0],i=t[1]),V.useEffect(r,i);const a=cy[e];let s;t[2]!==a.label?(s=g.jsxs("span",{className:"text-sm font-medium text-muted-foreground text-shimmer",children:[a.label,"..."]}),t[2]=a.label,t[3]=s):s=t[3];let u;return t[4]!==a.icon||t[5]!==s?(u=g.jsxs("div",{className:"flex items-center gap-2 py-2",children:[a.icon,s]}),t[4]=a.icon,t[5]=s,t[6]=u):u=t[6],u}function hy(t){const e=W.c(5),{duration:n}=t,r=n/1e3;let i;e[0]!==r?(i=r.toFixed(1),e[0]=r,e[1]=i):i=e[1];const a=i;let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx(Bo,{className:"text-muted-foreground",size:16}),e[2]=s):s=e[2];let u;return e[3]!==a?(u=g.jsxs("div",{className:"flex items-center gap-2 py-2 opacity-60",children:[s,g.jsxs("span",{className:"text-xs text-muted-foreground",children:["Thought · ",a,"s"]})]}),e[3]=a,e[4]=u):u=e[4],u}function py(t,e,n,r){const i=t.type.startsWith("tool-")||t.type==="dynamic-tool";if(t.type==="step-start"||t.type==="file"||t.type==="source-url"||t.type==="source-document")return null;if(i)return g.jsx(sy,{part:t,id:e},`${e}-${n}`);switch(t.type){case"text":return g.jsx(Wc,{id:e,text:t.text,copyable:!0,extraActions:r},`${e}-${n}`);case"reasoning":return g.jsx(ny,{part:t,id:e},`${e}-${n}`)}throw new Error(`Unknown part type: ${t.type}`)}function my(t){const e=W.c(27),{message:n,status:r,className:i}=t,{id:a,parts:s}=n,l=r==="streaming"||r==="submitted",f=V.useRef(null);let d;e[0]!==a?(d=()=>{const w=localStorage.getItem(`msg-duration-${a}`);return w?Number(w):null},e[0]=a,e[1]=d):d=e[1];const[p,h]=V.useState(d);let m,E;e[2]!==l?(m=()=>{l&&f.current===null&&(f.current=Date.now())},E=[l],e[2]=l,e[3]=m,e[4]=E):(m=e[3],E=e[4]),V.useEffect(m,E);let x,T;e[5]!==p||e[6]!==a||e[7]!==s.length?(x=()=>{if(s.length>0&&p===null&&f.current!==null){const w=Date.now()-f.current;h(w),localStorage.setItem(`msg-duration-${a}`,w.toString())}},T=[s.length,p,a],e[5]=p,e[6]=a,e[7]=s.length,e[8]=x,e[9]=T):(x=e[8],T=e[9]),V.useEffect(x,T);const k=s.length>0,b=k&&!l&&p!==null;let N;e[10]!==n?(N=g.jsx(Gc,{messages:[n]}),e[10]=n,e[11]=N):N=e[11];const v=N;let C;e[12]!==i?(C=re("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",i),e[12]=i,e[13]=C):C=e[13];let L;e[14]!==p||e[15]!==k||e[16]!==a||e[17]!==l||e[18]!==s||e[19]!==b||e[20]!==v?(L=k?g.jsxs(g.Fragment,{children:[b&&g.jsx(hy,{duration:p}),s.map((w,B)=>py(w,a,B,B===s.length-1?v:void 0))]}):l?g.jsx(fy,{}):null,e[14]=p,e[15]=k,e[16]=a,e[17]=l,e[18]=s,e[19]=b,e[20]=v,e[21]=L):L=e[21];let M;e[22]!==L?(M=g.jsx("div",{className:"flex flex-col gap-2 min-w-0 w-full items-start",children:g.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-sm wrap-break-word overflow-wrap-anywhere bg-transparent",children:L})}),e[22]=L,e[23]=M):M=e[23];let F;return e[24]!==C||e[25]!==M?(F=g.jsx("div",{className:C,children:M}),e[24]=C,e[25]=M,e[26]=F):F=e[26],F}const Qc=V.createContext(null);function Kc(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function gy(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(!V.isValidElement(r))continue;if(r.props?.message?.role==="assistant"){const a=t[n-1],s=V.isValidElement(a)&&a.props?.message?.role,u=a&&V.isValidElement(a)&&s==="user"?a:null;e.push({user:u,assistant:r})}}return e}function by(t){const e=W.c(27),{children:n,className:r,minHeightOffset:i}=t,a=V.useRef(null);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const u=V.useRef(s);let o,l,f,d,p,h,m;if(e[1]!==n||e[2]!==r||e[3]!==i){const k=V.Children.toArray(n),b=k[k.length-1];l=b&&V.isValidElement(b)&&b.type===Kc?b:null;const N=l?k.slice(0,-1):k,v=gy(N);let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=M=>{const F=u.current[M];if(F&&a.current){const w=a.current.offsetTop,B=F.offsetTop;a.current.scrollTo({top:B-w,behavior:"smooth"})}},e[11]=C):C=e[11];const L=C;o=Qc.Provider,e[12]===Symbol.for("react.memo_cache_sentinel")?(m={scrollToPair:L},e[12]=m):m=e[12],p=a,e[13]!==r?(h=re("w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",r),e[13]=r,e[14]=h):h=e[14],f="flex flex-col min-w-0 max-w-2xl mx-auto w-full",d=v.map((M,F)=>{const w=F===v.length-1;return g.jsxs("div",{ref:B=>{u.current[F]=B},className:"flex flex-col gap-2 pb-2",style:w&&i?{minHeight:`calc(100vh - ${i}px)`}:void 0,children:[g.jsx("div",{className:"sticky top-0 z-50 bg-background w-full h-4"}),g.jsx("div",{className:"sticky top-4 z-50",children:M.user&&V.isValidElement(M.user)?V.cloneElement(M.user,{pairIndex:F}):M.user}),M.assistant]},F)}),e[1]=n,e[2]=r,e[3]=i,e[4]=o,e[5]=l,e[6]=f,e[7]=d,e[8]=p,e[9]=h,e[10]=m}else o=e[4],l=e[5],f=e[6],d=e[7],p=e[8],h=e[9],m=e[10];let E;e[15]!==l||e[16]!==f||e[17]!==d?(E=g.jsxs("div",{className:f,children:[d,l]}),e[15]=l,e[16]=f,e[17]=d,e[18]=E):E=e[18];let x;e[19]!==p||e[20]!==h||e[21]!==E?(x=g.jsx("div",{ref:p,className:h,children:E}),e[19]=p,e[20]=h,e[21]=E,e[22]=x):x=e[22];let T;return e[23]!==o||e[24]!==m||e[25]!==x?(T=g.jsx(o,{value:m,children:x}),e[23]=o,e[24]=m,e[25]=x,e[26]=T):T=e[26],T}function Ey(t){const e=W.c(29),{message:n,className:r,pairIndex:i}=t,{id:a,parts:s}=n,u=V.useRef(null),o=V.useContext(Qc),[l,f]=V.useState(!1);if(!s||s.length===0)return null;const p=s.reduce(Ty,0)>60;let h;e[0]!==o||e[1]!==i?(h=()=>{i!==void 0&&o?.scrollToPair(i)},e[0]=o,e[1]=i,e[2]=h):h=e[2];const m=h;let E;e[3]!==r?(E=re("message-block w-full min-w-0 group relative flex items-start gap-4 px-2 text-foreground flex-row-reverse",r),e[3]=r,e[4]=E):E=e[4];const x=p&&!l&&"overflow-hidden relative max-h-[60px]";let T;e[5]!==x?(T=re(x),e[5]=x,e[6]=T):T=e[6];let k;if(e[7]!==a||e[8]!==s){let M;e[10]!==a?(M=(F,w)=>F.type==="text"?g.jsx(Wc,{id:a,text:F.text},`${a}-${w}`):null,e[10]=a,e[11]=M):M=e[11],k=s.map(M),e[7]=a,e[8]=s,e[9]=k}else k=e[9];let b;e[12]!==l||e[13]!==p?(b=p&&!l&&g.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-muted to-transparent pointer-events-none"}),e[12]=l,e[13]=p,e[14]=b):b=e[14];let N;e[15]!==T||e[16]!==k||e[17]!==b?(N=g.jsxs("div",{className:T,children:[k,b]}),e[15]=T,e[16]=k,e[17]=b,e[18]=N):N=e[18];let v;e[19]!==l||e[20]!==p?(v=p&&g.jsx("div",{className:"flex justify-center",children:g.jsx(Mt,{onClick:M=>{M.stopPropagation(),f(!l)},variant:"ghost",size:"xs",className:"text-xs w-full text-muted-foreground hover:text-foreground",children:l?g.jsx(If,{className:"text-sm"}):g.jsx(xo,{className:"text-sm"})})}),e[19]=l,e[20]=p,e[21]=v):v=e[21];let C;e[22]!==m||e[23]!==N||e[24]!==v?(C=g.jsxs("div",{onClick:m,className:"w-full border min-w-0 shadow-[0_3px_6px_-1px_rgba(0,0,0,0.1)] rounded-lg text-[0.9375rem] break-words overflow-wrap-anywhere bg-muted px-4 py-2 cursor-pointer transition-colors",children:[N,v]}),e[22]=m,e[23]=N,e[24]=v,e[25]=C):C=e[25];let L;return e[26]!==E||e[27]!==C?(L=g.jsxs("div",{ref:u,className:E,children:[" ",C]}),e[26]=E,e[27]=C,e[28]=L):L=e[28],L}function Ty(t,e){return e.type==="text"?t+e.text.length:t}function _y(t,e){const n=W.c(4);let r;n[0]!==e?(r={},n[0]=e,n[1]=r):r=n[1];const i=r,a=t??Ef;let s;return n[2]!==a?(s=_f(a),n[2]=a,n[3]=s):s=n[3],Tf(a,"LLM",s,i)}function xy(){const t=W.c(8),e=xf();let n;t[0]!==e?(n={connections:e,binding:"LLMS"},t[0]=e,t[1]=n):n=t[1];const[r]=Pf(n),i=_y(r?.id);if(!i||!r){let s;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[2]=s):s=t[2],s}let a;if(t[3]!==r||t[4]!==i){let s;t[6]!==r?(s=u=>({...u,name:u.title,contextWindow:u.limits?.contextWindow,outputLimit:u.limits?.maxOutputTokens,inputCost:u.costs?.input,outputCost:u.costs?.output,provider:u.provider,connectionId:r.id,connectionName:r.title}),t[6]=r,t[7]=s):s=t[7],a=i.map(s).sort(yy),t[3]=r,t[4]=i,t[5]=a}else a=t[5];return a}function yy(t,e){return t.name.localeCompare(e.name)}const ky={reasoning:{icon:g.jsx(Vr,{className:"size-4"}),bg:"bg-purple-100",text:"text-purple-700",label:"Reasoning"},"image-upload":{icon:g.jsx(Mo,{className:"size-4"}),bg:"bg-teal-100",text:"text-teal-700",label:"Can analyze images"},"file-upload":{icon:g.jsx(Lf,{className:"size-4"}),bg:"bg-blue-100",text:"text-blue-700",label:"Can analyze files"},"web-search":{icon:g.jsx(To,{className:"size-4"}),bg:"bg-amber-100",text:"text-amber-700",label:"Can search the web to answer questions"}},Xc=V.memo(function(e){const n=W.c(11),{capability:r}=e,i=ky[r];let a;n[0]!==r||n[1]!==i?(a=i||{icon:g.jsx(qt,{className:"size-4"}),bg:"bg-slate-200",text:"text-slate-700",label:r},n[0]=r,n[1]=i,n[2]=a):a=n[2];const s=a,u=`flex items-center justify-center h-6 w-6 rounded-sm ${s.bg} ${s.text}`;let o;n[3]!==s.icon||n[4]!==u?(o=g.jsx(bo,{asChild:!0,children:g.jsx("div",{className:u,children:s.icon})}),n[3]=s.icon,n[4]=u,n[5]=o):o=n[5];let l;n[6]!==s.label?(l=g.jsx(Eo,{children:g.jsx("p",{children:s.label})}),n[6]=s.label,n[7]=l):l=n[7];let f;return n[8]!==o||n[9]!==l?(f=g.jsxs(go,{children:[o,l]}),n[8]=o,n[9]=l,n[10]=f):f=n[10],f}),Fu=V.memo(function(e){const n=W.c(54),{model:r,compact:i}=e,a=i===void 0?!1:i;if(!r){let T;return n[0]===Symbol.for("react.memo_cache_sentinel")?(T=g.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),n[0]=T):T=n[0],T}const s=r.contextWindow||r.inputCost||r.outputCost||r.outputLimit;if(!s&&!a){let T;n[1]!==r.logo||n[2]!==r.name?(T=r.logo&&g.jsx("img",{src:r.logo,className:"w-6 h-6",alt:r.name}),n[1]=r.logo,n[2]=r.name,n[3]=T):T=n[3];let k;n[4]!==r.name?(k=g.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[4]=r.name,n[5]=k):k=n[5];let b;n[6]!==T||n[7]!==k?(b=g.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[T,k]}),n[6]=T,n[7]=k,n[8]=b):b=n[8];let N;n[9]!==r.description?(N=r.description&&g.jsx("p",{className:"text-sm text-muted-foreground",children:r.description}),n[9]=r.description,n[10]=N):N=n[10];let v;return n[11]!==b||n[12]!==N?(v=g.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[b,N]}),n[11]=b,n[12]=N,n[13]=v):v=n[13],v}if(!s&&a)return null;if(a){let T;n[14]!==r.contextWindow?(T=r.contextWindow&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Context"}),g.jsxs("span",{className:"text-foreground font-medium",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[14]=r.contextWindow,n[15]=T):T=n[15];let k;n[16]!==r.inputCost?(k=r.inputCost&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Input cost"}),g.jsxs("span",{className:"text-foreground font-medium",children:["$",r.inputCost.toFixed(2)," / 1M"]})]}),n[16]=r.inputCost,n[17]=k):k=n[17];let b;n[18]!==r.outputCost?(b=r.outputCost&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Output cost"}),g.jsxs("span",{className:"text-foreground font-medium",children:["$",r.outputCost.toFixed(2)," / 1M"]})]}),n[18]=r.outputCost,n[19]=b):b=n[19];let N;n[20]!==r.outputLimit?(N=r.outputLimit&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),g.jsxs("span",{className:"text-foreground font-medium",children:[r.outputLimit.toLocaleString()," tokens"]})]}),n[20]=r.outputLimit,n[21]=N):N=n[21];let v;return n[22]!==T||n[23]!==k||n[24]!==b||n[25]!==N?(v=g.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-xl text-xs",children:[T,k,b,N]}),n[22]=T,n[23]=k,n[24]=b,n[25]=N,n[26]=v):v=n[26],v}let u;n[27]!==r.logo||n[28]!==r.name?(u=r.logo&&g.jsx("img",{src:r.logo,className:"w-6 h-6",alt:r.name}),n[27]=r.logo,n[28]=r.name,n[29]=u):u=n[29];let o;n[30]!==r.name?(o=g.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[30]=r.name,n[31]=o):o=n[31];let l;n[32]!==u||n[33]!==o?(l=g.jsxs("div",{className:"flex items-center gap-3",children:[u,o]}),n[32]=u,n[33]=o,n[34]=l):l=n[34];let f;n[35]!==r.capabilities?(f=r.capabilities&&r.capabilities.length>0&&g.jsx("div",{className:"flex items-center gap-2",children:r.capabilities.map(Sy)}),n[35]=r.capabilities,n[36]=f):f=n[36];let d;n[37]!==l||n[38]!==f?(d=g.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[l,f]}),n[37]=l,n[38]=f,n[39]=d):d=n[39];let p;n[40]!==r.contextWindow?(p=r.contextWindow&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(mf,{className:"w-3.5 h-3.5 text-muted-foreground"}),g.jsx("p",{className:"text-sm text-foreground",children:"Context window"})]}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[40]=r.contextWindow,n[41]=p):p=n[41];let h;n[42]!==r.inputCost||n[43]!==r.outputCost?(h=(r.inputCost||r.outputCost)&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(Po,{className:"w-3.5 h-3.5 text-muted-foreground"}),g.jsx("p",{className:"text-sm text-foreground",children:"Costs"})]}),g.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.inputCost!==null&&r.inputCost!==void 0&&g.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.inputCost.toFixed(2)," / 1M tokens (input)"]}),r.outputCost!==null&&r.outputCost!==void 0&&g.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.outputCost.toFixed(2)," / 1M tokens (output)"]})]})]}),n[42]=r.inputCost,n[43]=r.outputCost,n[44]=h):h=n[44];let m;n[45]!==r.outputLimit?(m=r.outputLimit&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(Fo,{className:"w-4.5 h-4.5 text-muted-foreground/70"}),g.jsx("p",{className:"text-sm text-foreground",children:"Output limit"})]}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.outputLimit.toLocaleString()," token limit"]})]}),n[45]=r.outputLimit,n[46]=m):m=n[46];let E;n[47]!==p||n[48]!==h||n[49]!==m?(E=g.jsxs("div",{className:"flex flex-col gap-4",children:[p,h,m]}),n[47]=p,n[48]=h,n[49]=m,n[50]=E):E=n[50];let x;return n[51]!==E||n[52]!==d?(x=g.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[d,E]}),n[51]=E,n[52]=d,n[53]=x):x=n[53],x}),Ay=V.memo(function(e){const n=W.c(27),{model:r,onHover:i,isSelected:a,hasExpandedInfo:s}=e,u=s?"rounded-t-xl":"rounded-xl";let o;n[0]!==u?(o=re("flex items-center gap-2 h-10 py-4 px-3 hover:bg-accent cursor-pointer",u),n[0]=u,n[1]=o):o=n[1];let l;n[2]!==r||n[3]!==i?(l=()=>i(r),n[2]=r,n[3]=i,n[4]=l):l=n[4];let f;n[5]!==r.logo||n[6]!==r.name?(f=r.logo&&g.jsx("img",{src:r.logo,className:"w-5 h-5 shrink-0",alt:r.name}),n[5]=r.logo,n[6]=r.name,n[7]=f):f=n[7];let d;n[8]!==r.name?(d=g.jsx("span",{className:"text-sm text-foreground",children:r.name}),n[8]=r.name,n[9]=d):d=n[9];let p;n[10]!==s||n[11]!==r.capabilities?(p=s&&r.capabilities&&r.capabilities.length>0&&g.jsx("div",{className:"md:hidden flex items-center gap-1.5 ml-auto",children:r.capabilities.map(Ny)}),n[10]=s,n[11]=r.capabilities,n[12]=p):p=n[12];let h;n[13]!==s||n[14]!==a?(h=a&&!s&&g.jsx(qt,{className:"w-4 h-4 text-foreground ml-auto"}),n[13]=s,n[14]=a,n[15]=h):h=n[15];let m;n[16]!==s||n[17]!==a?(m=a&&s&&g.jsx(qt,{className:"w-4 h-4 text-foreground ml-2 shrink-0"}),n[16]=s,n[17]=a,n[18]=m):m=n[18];let E;return n[19]!==o||n[20]!==l||n[21]!==f||n[22]!==d||n[23]!==p||n[24]!==h||n[25]!==m?(E=g.jsxs("div",{className:o,onMouseEnter:l,children:[f,d,p,h,m]}),n[19]=o,n[20]=l,n[21]=f,n[22]=d,n[23]=p,n[24]=h,n[25]=m,n[26]=E):E=n[26],E});function Cy(t){const e=W.c(9),{model:n}=t;if(!n){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("span",{className:"text-sm text-muted-foreground",children:"Select model"}),e[0]=s):s=e[0],s}let r;e[1]!==n.logo||e[2]!==n.name?(r=n.logo&&g.jsx("img",{src:n.logo,className:"w-4 h-4",alt:n.name}),e[1]=n.logo,e[2]=n.name,e[3]=r):r=e[3];let i;e[4]!==n.name?(i=g.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:n.name}),e[4]=n.name,e[5]=i):i=e[5];let a;return e[6]!==r||e[7]!==i?(a=g.jsxs("div",{className:"flex items-center gap-2",children:[r,i]}),e[6]=r,e[7]=i,e[8]=a):a=e[8],a}function Iy(t){const e=W.c(57),{selectedModel:n,onModelChange:r,variant:i,className:a,placeholder:s}=t,u=i===void 0?"borderless":i,o=s===void 0?"Select model":s,[l,f]=V.useState(!1),[d,p]=V.useState(null),[h,m]=V.useState(!1),E=xy();let x;e[0]!==E||e[1]!==n?(x=n?E.find(ce=>ce.id===n.id&&ce.connectionId===n.connectionId)?.id:void 0,e[0]=E,e[1]=n,e[2]=x):x=e[2];const T=x;let k;if(e[3]!==E||e[4]!==T){let ce;e[6]!==T?(ce=me=>me.id===T,e[6]=T,e[7]=ce):ce=e[7],k=E.find(ce),e[3]=E,e[4]=T,e[5]=k}else k=e[5];const b=k;let N;e[8]!==E||e[9]!==r?(N=ce=>{const me=E.find(ge=>ge.id===ce);me&&(r({id:me.id,connectionId:me.connectionId,provider:me.provider??void 0}),f(!1))},e[8]=E,e[9]=r,e[10]=N):N=e[10];const v=N;if(E.length===0)return null;const C=T||"",L=u==="borderless"&&"md:border-none";let M;e[11]!==a||e[12]!==L?(M=re("h-8! text-sm hover:bg-accent rounded-lg py-1 px-2 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0",L,a),e[11]=a,e[12]=L,e[13]=M):M=e[13];let F;e[14]!==b?(F=g.jsx(Cy,{model:b}),e[14]=b,e[15]=F):F=e[15];let w;e[16]!==o||e[17]!==F?(w=g.jsx(Vo,{placeholder:o,children:F}),e[16]=o,e[17]=F,e[18]=w):w=e[18];let B;e[19]!==w||e[20]!==M?(B=g.jsx(qo,{className:M,children:w}),e[19]=w,e[20]=M,e[21]=B):B=e[21];let $;e[22]!==h?($=()=>m(!h),e[22]=h,e[23]=$):$=e[23];const J=h?"text-foreground":"text-muted-foreground";let q;e[24]!==J?(q=re("w-5 h-5 transition-colors",J),e[24]=J,e[25]=q):q=e[25];let z;e[26]!==q?(z=g.jsx(Df,{className:q}),e[26]=q,e[27]=z):z=e[27];let Q;e[28]!==$||e[29]!==z?(Q=g.jsx("button",{type:"button",onClick:$,className:"md:hidden flex items-center justify-center h-8 w-8 rounded-lg hover:bg-accent transition-colors","aria-label":"Toggle model info",children:z}),e[28]=$,e[29]=z,e[30]=Q):Q=e[30];let ie;if(e[31]!==v||e[32]!==E||e[33]!==T||e[34]!==h){let ce;e[36]!==v||e[37]!==T||e[38]!==h?(ce=me=>g.jsxs("div",{onClick:()=>v(me.id),className:re("rounded-xl mb-1",me.id===T&&"bg-accent"),children:[g.jsx(Ay,{model:me,onHover:p,isSelected:me.id===T,hasExpandedInfo:h}),h&&g.jsx("div",{className:"md:hidden",children:g.jsx(Fu,{model:me,compact:!0})})]},me.id),e[36]=v,e[37]=T,e[38]=h,e[39]=ce):ce=e[39],ie=E.map(ce),e[31]=v,e[32]=E,e[33]=T,e[34]=h,e[35]=ie}else ie=e[35];let be;e[40]!==ie?(be=g.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 md:border-r",children:ie}),e[40]=ie,e[41]=be):be=e[41];const Re=d||b||null;let I;e[42]!==Re?(I=g.jsx("div",{className:"hidden md:block md:w-[300px] p-3",children:g.jsx(Fu,{model:Re})}),e[42]=Re,e[43]=I):I=e[43];let Ie;e[44]!==be||e[45]!==I?(Ie=g.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[be,I]}),e[44]=be,e[45]=I,e[46]=Ie):Ie=e[46];let Ee;e[47]!==o||e[48]!==Q||e[49]!==Ie?(Ee=g.jsx(Yo,{title:o,className:"w-full md:w-auto md:min-w-[600px] [&_button[aria-label='Scroll down']]:!hidden [&_button[aria-label='Scroll up']]:!hidden",headerActions:Q,children:Ie}),e[47]=o,e[48]=Q,e[49]=Ie,e[50]=Ee):Ee=e[50];let S;return e[51]!==v||e[52]!==l||e[53]!==B||e[54]!==Ee||e[55]!==C?(S=g.jsxs(Zo,{open:l,onOpenChange:f,value:C,onValueChange:v,children:[B,Ee]}),e[51]=v,e[52]=l,e[53]=B,e[54]=Ee,e[55]=C,e[56]=S):S=e[56],S}function Sy(t){return g.jsx(Xc,{capability:t},t)}function Ny(t){return g.jsx(Xc,{capability:t},t)}function wy({messageCount:t,sentinelRef:e}){const n=V.useRef(t),r=V.useRef(0);t>n.current&&r.current!==t&&queueMicrotask(()=>{e.current?.scrollIntoView({behavior:"smooth",block:"start"}),r.current=t}),n.current=t}function $r(t,e){const n=V.Children.toArray(t);for(const r of n)if(V.isValidElement(r)&&r.type===e)return r;return null}function vy(t,e){return V.Children.toArray(t).filter(n=>V.isValidElement(n)?!e.includes(n.type):!0)}function Ry(t){const e=W.c(5),{className:n,children:r}=t;let i;e[0]!==n?(i=re("h-full",n),e[0]=n,e[1]=i):i=e[1];let a;return e[2]!==r||e[3]!==i?(a=g.jsx(Wr,{className:i,children:r}),e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function Oy(t){const e=W.c(11),{children:n}=t;let r;e[0]!==n?(r=$r(n,Jc),e[0]=n,e[1]=r):r=e[1];const i=r;let a;e[2]!==n?(a=$r(n,ed),e[2]=n,e[3]=a):a=e[3];const s=a,u=i?.props.children;let o;e[4]!==u?(o=g.jsx("div",{className:"flex items-center gap-2",children:u}),e[4]=u,e[5]=o):o=e[5];const l=s?.props.children;let f;e[6]!==l?(f=g.jsx("div",{className:"flex items-center gap-1",children:l}),e[6]=l,e[7]=f):f=e[7];let d;return e[8]!==o||e[9]!==f?(d=g.jsxs(Wr.Header,{children:[o,f]}),e[8]=o,e[9]=f,e[10]=d):d=e[10],d}function Jc(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function ed(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function Ly(t){const e=W.c(3),{children:n,className:r}=t;let i;return e[0]!==n||e[1]!==r?(i=g.jsx(Wr.Content,{className:r,children:n}),e[0]=n,e[1]=r,e[2]=i):i=e[2],i}function Dy(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx("div",{className:"h-full w-full flex items-center justify-center max-w-2xl mx-auto",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Py(t){const e=W.c(12),{messages:n,status:r,minHeightOffset:i}=t,a=i===void 0?240:i,s=V.useRef(null);let u;e[0]!==n.length?(u={messageCount:n.length,sentinelRef:s},e[0]=n.length,e[1]=u):u=e[1],wy(u);let o;if(e[2]!==n||e[3]!==r){let d;e[5]!==n.length||e[6]!==r?(d=(p,h)=>p.role==="user"?g.jsx(Ey,{message:p},p.id):p.role==="assistant"?g.jsx(my,{message:p,status:h===n.length-1?r:void 0},p.id):null,e[5]=n.length,e[6]=r,e[7]=d):d=e[7],o=n.map(d),e[2]=n,e[3]=r,e[4]=o}else o=e[4];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=g.jsx(Kc,{children:g.jsx("div",{ref:s,className:"h-0"})}),e[8]=l):l=e[8];let f;return e[9]!==a||e[10]!==o?(f=g.jsxs(by,{minHeightOffset:a,children:[o,l]}),e[9]=a,e[10]=o,e[11]=f):f=e[11],f}function My(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(Wr.Footer,{className:"max-w-2xl mx-auto w-full min-w-0",children:n}),e[0]=n,e[1]=r):r=e[1],r}function ia(t){return null}function aa(t){return null}function By(t){const e=W.c(31),{onSubmit:n,onStop:r,disabled:i,isStreaming:a,placeholder:s,usageMessages:u,children:o}=t,[l,f]=V.useState("");let d,p,h,m,E;if(e[0]!==o||e[1]!==l||e[2]!==a||e[3]!==n){const N=$r(o,ia),v=$r(o,aa);let C;e[9]!==o?(C=vy(o,[ia,aa]),e[9]=o,e[10]=C):C=e[10],p=C;let L;e[11]!==l||e[12]!==a||e[13]!==n?(L=async M=>{if(M?.preventDefault(),!l?.trim()||a)return;const F=l.trim();try{await n(F),f("")}catch(w){const B=w;console.error("Failed to send message:",B);const $=B instanceof Error?B.message:"Failed to send message";kr.error($)}},e[11]=l,e[12]=a,e[13]=n,e[14]=L):L=e[14],d=L,h="flex items-center gap-2 min-w-0",m=v?g.jsx("div",{className:re("flex items-center gap-2 flex-wrap min-w-0",v.props.disabled&&"pointer-events-none opacity-60"),children:g.jsx(wp,{selectedGatewayId:v.props.selectedGatewayId,onGatewayChange:v.props.onGatewayChange,placeholder:"Gateway",variant:"bordered",className:v.props.className})}):null,E=N?g.jsx("div",{className:re("flex items-center gap-2 flex-wrap min-w-0",N.props.disabled&&"pointer-events-none opacity-60"),children:g.jsx(Iy,{selectedModel:N.props.selectedModel,onModelChange:N.props.onModelChange,placeholder:"Model",variant:"borderless",className:N.props.className})}):null,e[0]=o,e[1]=l,e[2]=a,e[3]=n,e[4]=d,e[5]=p,e[6]=h,e[7]=m,e[8]=E}else d=e[4],p=e[5],h=e[6],m=e[7],E=e[8];let x;e[15]!==u?(x=u?g.jsx(Gc,{messages:u}):null,e[15]=u,e[16]=x):x=e[16];let T;e[17]!==p||e[18]!==h||e[19]!==m||e[20]!==E||e[21]!==x?(T=g.jsxs("div",{className:h,children:[m,E,p,x]}),e[17]=p,e[18]=h,e[19]=m,e[20]=E,e[21]=x,e[22]=T):T=e[22];const k=T;let b;return e[23]!==i||e[24]!==d||e[25]!==l||e[26]!==a||e[27]!==k||e[28]!==r||e[29]!==s?(b=g.jsx(gp,{value:l,onChange:f,onSubmit:d,onStop:r,disabled:i,isStreaming:a,placeholder:s,leftActions:k}),e[23]=i,e[24]=d,e[25]=l,e[26]=a,e[27]=k,e[28]=r,e[29]=s,e[30]=b):b=e[30],b}const fI=Object.assign(Ry,{Header:Object.assign(Oy,{Left:Jc,Right:ed}),Main:Ly,Messages:Py,EmptyState:Dy,Footer:My,Input:Object.assign(By,{ModelSelector:ia,GatewaySelector:aa})});function Gt(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Fy(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=Gt(i),n.then(a=>{a.onclose=()=>n=void 0},()=>{}),n};return(i,a)=>r().then(s=>a(s.transaction(e,i).objectStore(e)))}let Li;function li(){return Li||(Li=Fy("keyval-store","keyval")),Li}function Ja(t,e=li()){return e("readonly",n=>Gt(n.get(t)))}function Wn(t,e,n=li()){return n("readwrite",r=>(r.put(e,t),Gt(r.transaction)))}function td(t,e=li()){return e("readwrite",n=>(n.delete(t),Gt(n.transaction)))}function Uy(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Gt(t.transaction)}function nd(t=li()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Gt(e.getAllKeys()),Gt(e.getAll())]).then(([r,i])=>r.map((a,s)=>[a,i[s]]));const n=[];return t("readonly",r=>Uy(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function Hy(t,e){const n=`${t}:threads:${e}`;return await Ja(n)??null}async function zy(t){const e=`${t}:threads:`;return(await nd()).filter(([i])=>typeof i=="string"&&i.startsWith(e)).map(([,i])=>i).filter(i=>!i.hidden).sort((i,a)=>String(a.updated_at).localeCompare(String(i.updated_at)))}function jy(t,e){const n=`${t}:messages:`;return nd().then(r=>r.filter(([a])=>typeof a=="string"&&a.startsWith(n)).map(([,a])=>a).filter(a=>a.metadata?.thread_id===e||a.threadId===e).sort((a,s)=>{const u=a.metadata?.created_at||a.createdAt||"",o=s.metadata?.created_at||s.createdAt||"";return String(u).localeCompare(String(o))}))}function hI(){const t=W.c(12),{locator:e}=mn();let n;t[0]!==e?(n=We.threads(e),t[0]=e,t[1]=n):n=t[1];let r;t[2]!==e?(r=()=>zy(e),t[2]=e,t[3]=r):r=t[3];let i;t[4]!==n||t[5]!==r?(i={queryKey:n,queryFn:r,staleTime:3e4},t[4]=n,t[5]=r,t[6]=i):i=t[6];const{data:a,refetch:s}=Ea(i);let u;t[7]!==a?(u=a??[],t[7]=a,t[8]=u):u=t[8];let o;return t[9]!==s||t[10]!==u?(o={threads:u,refetch:s},t[9]=s,t[10]=u,t[11]=o):o=t[11],o}function $y(t){const e=W.c(11),{locator:n}=mn();let r;e[0]!==n||e[1]!==t?(r=We.threadMessages(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;e[3]!==n||e[4]!==t?(i=()=>jy(n,t),e[3]=n,e[4]=t,e[5]=i):i=e[5];let a;e[6]!==r||e[7]!==i?(a={queryKey:r,queryFn:i,staleTime:3e4},e[6]=r,e[7]=i,e[8]=a):a=e[8];const{data:s}=Ea(a);let u;return e[9]!==s?(u=s??[],e[9]=s,e[10]=u):u=e[10],u}function Zy(){const t=W.c(28),{locator:e}=mn(),n=po();let r;t[0]!==e?(r=async x=>{const T=`${e}:threads:${x.id}`;return await Wn(T,x),x},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=()=>{n.invalidateQueries({queryKey:We.threads(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=$t(a);let u;t[8]!==e?(u=async x=>{const{id:T,updates:k}=x,b=`${e}:threads:${T}`,N=await Ja(b);if(!N)throw new Error(`Thread ${T} not found`);const v={...N,...k};return await Wn(b,v),v},t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=x=>{n.invalidateQueries({queryKey:We.threads(e)}),n.invalidateQueries({queryKey:We.thread(e,x.id)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=$t(l);let d;t[16]!==e?(d=async x=>{const T=`${e}:threads:${x}`;return await td(T),x},t[16]=e,t[17]=d):d=t[17];let p;t[18]!==e||t[19]!==n?(p=()=>{n.invalidateQueries({queryKey:We.threads(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h={mutationFn:d,onSuccess:p},t[21]=d,t[22]=p,t[23]=h):h=t[23];const m=$t(h);let E;return t[24]!==m||t[25]!==s||t[26]!==f?(E={insert:s,update:f,delete:m},t[24]=m,t[25]=s,t[26]=f,t[27]=E):E=t[27],E}function Yy(){const t=W.c(37),{locator:e}=mn(),n=po();let r;t[0]!==e?(r=async N=>{const v=`${e}:messages:${N.id}`;return await Wn(v,N),N},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=N=>{const v=N.metadata?.thread_id||N.threadId;v&&n.invalidateQueries({queryKey:We.threadMessages(e,v)}),n.invalidateQueries({queryKey:We.messages(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=$t(a);let u;t[8]!==e?(u=async N=>(await Promise.all(N.map(v=>{const C=`${e}:messages:${v.id}`;return Wn(C,v)})),N),t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=N=>{const v=new Set;for(const C of N){const L=C.metadata?.thread_id||C.threadId;L&&v.add(L)}for(const C of v)n.invalidateQueries({queryKey:We.threadMessages(e,C)});n.invalidateQueries({queryKey:We.messages(e)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=$t(l);let d;t[16]!==e?(d=async N=>{const{id:v,updates:C}=N,L=`${e}:messages:${v}`,M=await Ja(L);if(!M)throw new Error(`Message ${v} not found`);const F={...M,...C};return await Wn(L,F),F},t[16]=e,t[17]=d):d=t[17];let p;t[18]!==e||t[19]!==n?(p=N=>{const v=N.metadata?.thread_id||N.threadId;v&&n.invalidateQueries({queryKey:We.threadMessages(e,v)}),n.invalidateQueries({queryKey:We.messages(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h={mutationFn:d,onSuccess:p},t[21]=d,t[22]=p,t[23]=h):h=t[23];const m=$t(h);let E;t[24]!==e?(E=async N=>{const v=`${e}:messages:${N}`;return await td(v),N},t[24]=e,t[25]=E):E=t[25];let x;t[26]!==e||t[27]!==n?(x=()=>{n.invalidateQueries({queryKey:We.messages(e)})},t[26]=e,t[27]=n,t[28]=x):x=t[28];let T;t[29]!==x||t[30]!==E?(T={mutationFn:E,onSuccess:x},t[29]=x,t[30]=E,t[31]=T):T=t[31];const k=$t(T);let b;return t[32]!==k||t[33]!==s||t[34]!==f||t[35]!==m?(b={insert:s,insertMany:f,update:m,delete:k},t[32]=k,t[33]=s,t[34]=f,t[35]=m,t[36]=b):b=t[36],b}var rd="vercel.ai.error",qy=Symbol.for(rd),Uu,Hu,Pt=class id extends(Hu=Error,Uu=qy,Hu){constructor({name:e,message:n,cause:r}){super(n),this[Uu]=!0,this.name=e,this.cause=r}static isInstance(e){return id.hasMarker(e,rd)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function ad(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var sd="AI_InvalidArgumentError",ud=`vercel.ai.error.${sd}`,Vy=Symbol.for(ud),zu,ju,Wy=class extends(ju=Pt,zu=Vy,ju){constructor({message:t,cause:e,argument:n}){super({name:sd,message:t,cause:e}),this[zu]=!0,this.argument=n}static isInstance(t){return Pt.hasMarker(t,ud)}},od="AI_JSONParseError",ld=`vercel.ai.error.${od}`,Gy=Symbol.for(ld),$u,Zu,Yu=class extends(Zu=Pt,$u=Gy,Zu){constructor({text:t,cause:e}){super({name:od,message:`JSON parsing failed: Text: ${t}.
|
|
115
115
|
Error message: ${ad(e)}`,cause:e}),this[$u]=!0,this.text=t}static isInstance(t){return Pt.hasMarker(t,ld)}},cd="AI_TypeValidationError",dd=`vercel.ai.error.${cd}`,Qy=Symbol.for(dd),qu,Vu,hn=class sa extends(Vu=Pt,qu=Qy,Vu){constructor({value:e,cause:n}){super({name:cd,message:`Type validation failed: Value: ${JSON.stringify(e)}.
|
|
116
|
-
Error message: ${ad(n)}`,cause:n}),this[qu]=!0,this.value=e}static isInstance(e){return Pt.hasMarker(e,dd)}static wrap({value:e,cause:n}){return sa.isInstance(n)&&n.value===e?n:new sa({value:e,cause:n})}};const Ky=D("ZodISODateTime",(t,e)=>{Mh.init(t,e),ve.init(t,e)});function Xy(t){return j0(Ky,t)}const Jy=D("ZodISODate",(t,e)=>{Bh.init(t,e),ve.init(t,e)});function ek(t){return $0(Jy,t)}const tk=D("ZodISOTime",(t,e)=>{Fh.init(t,e),ve.init(t,e)});function nk(t){return Z0(tk,t)}const rk=D("ZodISODuration",(t,e)=>{Uh.init(t,e),ve.init(t,e)});function ik(t){return Y0(rk,t)}const ak=(t,e)=>{Jd.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>tf(t,n)},flatten:{value:n=>ef(t,n)},addIssue:{value:n=>t.issues.push(n)},addIssues:{value:n=>t.issues.push(...n)},isEmpty:{get(){return t.issues.length===0}}})},ci=D("ZodError",ak,{Parent:Error}),sk=rf(ci),uk=sf(ci),ok=af(ci),fd=nf(ci),we=D("ZodType",(t,e)=>(ke.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),t.clone=(n,r)=>hf(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>sk(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>ok(t,n,r),t.parseAsync=async(n,r)=>uk(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>fd(t,n,r),t.spa=t.safeParseAsync,t.refine=(n,r)=>t.check(rA(n,r)),t.superRefine=n=>t.check(iA(n)),t.overwrite=n=>t.check(ir(n)),t.optional=()=>Qu(t),t.nullable=()=>Ku(t),t.nullish=()=>Qu(Ku(t)),t.nonoptional=n=>Wk(t,n),t.array=()=>xn(t),t.or=n=>Ye([t,n]),t.and=n=>Fk(t,n),t.transform=n=>Xu(t,jk(n)),t.default=n=>Yk(t,n),t.prefault=n=>Vk(t,n),t.catch=n=>Qk(t,n),t.pipe=n=>Xu(t,n),t.readonly=()=>Jk(t),t.describe=n=>{const r=t.clone();return Ln.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return Ln.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Ln.get(t);const r=t.clone();return Ln.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),hd=D("_ZodString",(t,e)=>{_a.init(t,e),we.init(t,e);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(X0(...r)),t.includes=(...r)=>t.check(tp(...r)),t.startsWith=(...r)=>t.check(np(...r)),t.endsWith=(...r)=>t.check(rp(...r)),t.min=(...r)=>t.check(Lr(...r)),t.max=(...r)=>t.check(Oo(...r)),t.length=(...r)=>t.check(Lo(...r)),t.nonempty=(...r)=>t.check(Lr(1,...r)),t.lowercase=r=>t.check(J0(r)),t.uppercase=r=>t.check(ep(r)),t.trim=()=>t.check(ap()),t.normalize=(...r)=>t.check(ip(...r)),t.toLowerCase=()=>t.check(sp()),t.toUpperCase=()=>t.check(up())}),lk=D("ZodString",(t,e)=>{_a.init(t,e),hd.init(t,e),t.email=n=>t.check(x0(ck,n)),t.url=n=>t.check(I0(dk,n)),t.jwt=n=>t.check(z0(Ik,n)),t.emoji=n=>t.check(S0(fk,n)),t.guid=n=>t.check(bs(Wu,n)),t.uuid=n=>t.check(y0(xr,n)),t.uuidv4=n=>t.check(k0(xr,n)),t.uuidv6=n=>t.check(A0(xr,n)),t.uuidv7=n=>t.check(C0(xr,n)),t.nanoid=n=>t.check(N0(hk,n)),t.guid=n=>t.check(bs(Wu,n)),t.cuid=n=>t.check(w0(pk,n)),t.cuid2=n=>t.check(v0(mk,n)),t.ulid=n=>t.check(R0(gk,n)),t.base64=n=>t.check(F0(kk,n)),t.base64url=n=>t.check(U0(Ak,n)),t.xid=n=>t.check(O0(bk,n)),t.ksuid=n=>t.check(L0(Ek,n)),t.ipv4=n=>t.check(D0(Tk,n)),t.ipv6=n=>t.check(P0(_k,n)),t.cidrv4=n=>t.check(M0(xk,n)),t.cidrv6=n=>t.check(B0(yk,n)),t.e164=n=>t.check(H0(Ck,n)),t.datetime=n=>t.check(Xy(n)),t.date=n=>t.check(ek(n)),t.time=n=>t.check(nk(n)),t.duration=n=>t.check(ik(n))});function Y(t){return _0(lk,t)}const ve=D("ZodStringFormat",(t,e)=>{Ne.init(t,e),hd.init(t,e)}),ck=D("ZodEmail",(t,e)=>{Sh.init(t,e),ve.init(t,e)}),Wu=D("ZodGUID",(t,e)=>{Ch.init(t,e),ve.init(t,e)}),xr=D("ZodUUID",(t,e)=>{Ih.init(t,e),ve.init(t,e)}),dk=D("ZodURL",(t,e)=>{Nh.init(t,e),ve.init(t,e)}),fk=D("ZodEmoji",(t,e)=>{wh.init(t,e),ve.init(t,e)}),hk=D("ZodNanoID",(t,e)=>{vh.init(t,e),ve.init(t,e)}),pk=D("ZodCUID",(t,e)=>{Rh.init(t,e),ve.init(t,e)}),mk=D("ZodCUID2",(t,e)=>{Oh.init(t,e),ve.init(t,e)}),gk=D("ZodULID",(t,e)=>{Lh.init(t,e),ve.init(t,e)}),bk=D("ZodXID",(t,e)=>{Dh.init(t,e),ve.init(t,e)}),Ek=D("ZodKSUID",(t,e)=>{Ph.init(t,e),ve.init(t,e)}),Tk=D("ZodIPv4",(t,e)=>{Hh.init(t,e),ve.init(t,e)}),_k=D("ZodIPv6",(t,e)=>{zh.init(t,e),ve.init(t,e)}),xk=D("ZodCIDRv4",(t,e)=>{jh.init(t,e),ve.init(t,e)}),yk=D("ZodCIDRv6",(t,e)=>{$h.init(t,e),ve.init(t,e)}),kk=D("ZodBase64",(t,e)=>{Zh.init(t,e),ve.init(t,e)}),Ak=D("ZodBase64URL",(t,e)=>{qh.init(t,e),ve.init(t,e)}),Ck=D("ZodE164",(t,e)=>{Vh.init(t,e),ve.init(t,e)}),Ik=D("ZodJWT",(t,e)=>{Gh.init(t,e),ve.init(t,e)}),pd=D("ZodNumber",(t,e)=>{wo.init(t,e),we.init(t,e),t.gt=(r,i)=>t.check(Ts(r,i)),t.gte=(r,i)=>t.check(hi(r,i)),t.min=(r,i)=>t.check(hi(r,i)),t.lt=(r,i)=>t.check(Es(r,i)),t.lte=(r,i)=>t.check(fi(r,i)),t.max=(r,i)=>t.check(fi(r,i)),t.int=r=>t.check(Gu(r)),t.safe=r=>t.check(Gu(r)),t.positive=r=>t.check(Ts(0,r)),t.nonnegative=r=>t.check(hi(0,r)),t.negative=r=>t.check(Es(0,r)),t.nonpositive=r=>t.check(fi(0,r)),t.multipleOf=(r,i)=>t.check(_s(r,i)),t.step=(r,i)=>t.check(_s(r,i)),t.finite=()=>t;const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Sk(t){return q0(pd,t)}const Nk=D("ZodNumberFormat",(t,e)=>{Qh.init(t,e),pd.init(t,e)});function Gu(t){return V0(Nk,t)}const wk=D("ZodBoolean",(t,e)=>{Kh.init(t,e),we.init(t,e)});function je(t){return W0(wk,t)}const vk=D("ZodNull",(t,e)=>{Xh.init(t,e),we.init(t,e)});function Rk(t){return G0(vk,t)}const Ok=D("ZodUnknown",(t,e)=>{Jh.init(t,e),we.init(t,e)});function gt(){return Q0(Ok)}const Lk=D("ZodNever",(t,e)=>{e0.init(t,e),we.init(t,e)});function md(t){return K0(Lk,t)}const Dk=D("ZodArray",(t,e)=>{t0.init(t,e),we.init(t,e),t.element=e.element,t.min=(n,r)=>t.check(Lr(n,r)),t.nonempty=n=>t.check(Lr(1,n)),t.max=(n,r)=>t.check(Oo(n,r)),t.length=(n,r)=>t.check(Lo(n,r)),t.unwrap=()=>t.element});function xn(t,e){return op(Dk,t,e)}const gd=D("ZodObject",(t,e)=>{n0.init(t,e),we.init(t,e),de(t,"shape",()=>e.shape),t.keyof=()=>Ed(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:gt()}),t.loose=()=>t.clone({...t._zod.def,catchall:gt()}),t.strict=()=>t.clone({...t._zod.def,catchall:md()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>uf(t,n),t.merge=n=>of(t,n),t.pick=n=>lf(t,n),t.omit=n=>cf(t,n),t.partial=(...n)=>df(Td,t,n[0]),t.required=(...n)=>ff(_d,t,n[0])});function _e(t,e){const n={type:"object",get shape(){return mo(this,"shape",{...t}),this.shape},...G(e)};return new gd(n)}function Ae(t,e){return new gd({type:"object",get shape(){return mo(this,"shape",{...t}),this.shape},catchall:md(),...G(e)})}const bd=D("ZodUnion",(t,e)=>{vo.init(t,e),we.init(t,e),t.options=e.options});function Ye(t,e){return new bd({type:"union",options:t,...G(e)})}const Pk=D("ZodDiscriminatedUnion",(t,e)=>{bd.init(t,e),r0.init(t,e)});function Mk(t,e,n){return new Pk({type:"union",options:e,discriminator:t,...G(n)})}const Bk=D("ZodIntersection",(t,e)=>{i0.init(t,e),we.init(t,e)});function Fk(t,e){return new Bk({type:"intersection",left:t,right:e})}const Uk=D("ZodRecord",(t,e)=>{a0.init(t,e),we.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function er(t,e,n){return new Uk({type:"record",keyType:t,valueType:e,...G(n)})}const ua=D("ZodEnum",(t,e)=>{s0.init(t,e),we.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const a={};for(const s of r)if(n.has(s))a[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ua({...e,checks:[],...G(i),entries:a})},t.exclude=(r,i)=>{const a={...e.entries};for(const s of r)if(n.has(s))delete a[s];else throw new Error(`Key ${s} not found in enum`);return new ua({...e,checks:[],...G(i),entries:a})}});function Ed(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new ua({type:"enum",entries:n,...G(e)})}const Hk=D("ZodLiteral",(t,e)=>{u0.init(t,e),we.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function X(t,e){return new Hk({type:"literal",values:Array.isArray(t)?t:[t],...G(e)})}const zk=D("ZodTransform",(t,e)=>{o0.init(t,e),we.init(t,e),t._zod.parse=(n,r)=>{n.addIssue=a=>{if(typeof a=="string")n.issues.push(Gn(a,n.value,e));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!0),n.issues.push(Gn(s))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(a=>(n.value=a,n)):(n.value=i,n)}});function jk(t){return new zk({type:"transform",transform:t})}const Td=D("ZodOptional",(t,e)=>{l0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qu(t){return new Td({type:"optional",innerType:t})}const $k=D("ZodNullable",(t,e)=>{c0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ku(t){return new $k({type:"nullable",innerType:t})}const Zk=D("ZodDefault",(t,e)=>{d0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Yk(t,e){return new Zk({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const qk=D("ZodPrefault",(t,e)=>{f0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Vk(t,e){return new qk({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const _d=D("ZodNonOptional",(t,e)=>{h0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Wk(t,e){return new _d({type:"nonoptional",innerType:t,...G(e)})}const Gk=D("ZodCatch",(t,e)=>{p0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Qk(t,e){return new Gk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Kk=D("ZodPipe",(t,e)=>{m0.init(t,e),we.init(t,e),t.in=e.in,t.out=e.out});function Xu(t,e){return new Kk({type:"pipe",in:t,out:e})}const Xk=D("ZodReadonly",(t,e)=>{g0.init(t,e),we.init(t,e)});function Jk(t){return new Xk({type:"readonly",innerType:t})}const eA=D("ZodLazy",(t,e)=>{b0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.getter()});function tA(t){return new eA({type:"lazy",getter:t})}const es=D("ZodCustom",(t,e)=>{E0.init(t,e),we.init(t,e)});function nA(t){const e=new Ge({check:"custom"});return e._zod.check=t,e}function xd(t,e){return lp(es,t??(()=>!0),e)}function rA(t,e={}){return cp(es,t,e)}function iA(t){const e=nA(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Gn(r,n.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),n.issues.push(Gn(i))}},t(n.value,n)));return e}function Zr(t,e={error:`Input not instance of ${t.name}`}){const n=new es({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...G(e)});return n._zod.bag.Class=t,n}var fr=({prefix:t,size:e=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=()=>{const a=n.length,s=new Array(e);for(let u=0;u<e;u++)s[u]=n[Math.random()*a|0];return s.join("")};if(t==null)return i;if(n.includes(r))throw new Wy({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${t}${r}${i()}`},aA=fr();function Ju(t=globalThis){var e,n,r;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(r=(n=t.process)==null?void 0:n.versions)!=null&&r.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function zt(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((n,r)=>{e[r.toLowerCase()]=n});else{Array.isArray(t)||(t=Object.entries(t));for(const[n,r]of t)r!=null&&(e[n.toLowerCase()]=r)}return e}function eo(t,...e){const n=new Headers(zt(t)),r=n.get("user-agent")||"";return n.set("user-agent",[r,...e].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var sA=/"__proto__"\s*:/,uA=/"constructor"\s*:/;function to(t){const e=JSON.parse(t);return e===null||typeof e!="object"||sA.test(t)===!1&&uA.test(t)===!1?e:oA(e)}function oA(t){let e=[t];for(;e.length;){const n=e;e=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in r){const a=r[i];a&&typeof a=="object"&&e.push(a)}}}return t}function lA(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return to(t)}try{return to(t)}finally{Error.stackTraceLimit=e}}function Nr(t){if(t.type==="object"){t.additionalProperties=!1;const e=t.properties;if(e!=null)for(const n in e)e[n]=Nr(e[n])}return t.type==="array"&&t.items!=null&&(Array.isArray(t.items)?t.items=t.items.map(e=>Nr(e)):t.items=Nr(t.items)),t}var cA=Symbol("Let zodToJsonSchema decide on which parser to use"),no={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"},dA=t=>typeof t=="string"?{...no,name:t}:{...no,...t};function nt(){return{}}function fA(t,e){var n,r,i;const a={type:"array"};return(n=t.type)!=null&&n._def&&((i=(r=t.type)==null?void 0:r._def)==null?void 0:i.typeName)!==re.ZodAny&&(a.items=pe(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(a.minItems=t.minLength.value),t.maxLength&&(a.maxItems=t.maxLength.value),t.exactLength&&(a.minItems=t.exactLength.value,a.maxItems=t.exactLength.value),a}function hA(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function pA(){return{type:"boolean"}}function yd(t,e){return pe(t.type._def,e)}var mA=(t,e)=>pe(t.innerType._def,e);function kd(t,e,n){const r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,a)=>kd(t,e,i))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return gA(t)}}var gA=t=>{const e={type:"integer",format:"unix-time"};for(const n of t.checks)switch(n.kind){case"min":e.minimum=n.value;break;case"max":e.maximum=n.value;break}return e};function bA(t,e){return{...pe(t.innerType._def,e),default:t.defaultValue()}}function EA(t,e){return e.effectStrategy==="input"?pe(t.schema._def,e):nt()}function TA(t){return{type:"string",enum:Array.from(t.values)}}var _A=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function xA(t,e){const n=[pe(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),pe(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return n.forEach(i=>{if(_A(i))r.push(...i.allOf);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:s,...u}=i;a=u}r.push(a)}}),r.length?{allOf:r}:void 0}function yA(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Di=void 0,lt={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:()=>(Di===void 0&&(Di=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Di),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 Ad(t,e){const n={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":ct(n,"email",r.message,e);break;case"format:idn-email":ct(n,"idn-email",r.message,e);break;case"pattern:zod":ze(n,lt.email,r.message,e);break}break;case"url":ct(n,"uri",r.message,e);break;case"uuid":ct(n,"uuid",r.message,e);break;case"regex":ze(n,r.regex,r.message,e);break;case"cuid":ze(n,lt.cuid,r.message,e);break;case"cuid2":ze(n,lt.cuid2,r.message,e);break;case"startsWith":ze(n,RegExp(`^${Pi(r.value,e)}`),r.message,e);break;case"endsWith":ze(n,RegExp(`${Pi(r.value,e)}$`),r.message,e);break;case"datetime":ct(n,"date-time",r.message,e);break;case"date":ct(n,"date",r.message,e);break;case"time":ct(n,"time",r.message,e);break;case"duration":ct(n,"duration",r.message,e);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{ze(n,RegExp(Pi(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&ct(n,"ipv4",r.message,e),r.version!=="v4"&&ct(n,"ipv6",r.message,e);break}case"base64url":ze(n,lt.base64url,r.message,e);break;case"jwt":ze(n,lt.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&ze(n,lt.ipv4Cidr,r.message,e),r.version!=="v4"&&ze(n,lt.ipv6Cidr,r.message,e);break}case"emoji":ze(n,lt.emoji(),r.message,e);break;case"ulid":{ze(n,lt.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ct(n,"binary",r.message,e);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{ze(n,lt.base64,r.message,e);break}}break}case"nanoid":ze(n,lt.nanoid,r.message,e)}return n}function Pi(t,e){return e.patternStrategy==="escape"?AA(t):t}var kA=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function AA(t){let e="";for(let n=0;n<t.length;n++)kA.has(t[n])||(e+="\\"),e+=t[n];return e}function ct(t,e,n,r){var i;t.format||(i=t.anyOf)!=null&&i.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...n&&r.errorMessages&&{errorMessage:{format:n}}})):t.format=e}function ze(t,e,n,r){var i;t.pattern||(i=t.allOf)!=null&&i.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:ro(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):t.pattern=ro(e,r)}function ro(t,e){var n;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=r.i?t.source.toLowerCase():t.source;let a="",s=!1,u=!1,o=!1;for(let l=0;l<i.length;l++){if(s){a+=i[l],s=!1;continue}if(r.i){if(u){if(i[l].match(/[a-z]/)){o?(a+=i[l],a+=`${i[l-2]}-${i[l]}`.toUpperCase(),o=!1):i[l+1]==="-"&&((n=i[l+2])!=null&&n.match(/[a-z]/))?(a+=i[l],o=!0):a+=`${i[l]}${i[l].toUpperCase()}`;continue}}else if(i[l].match(/[a-z]/)){a+=`[${i[l]}${i[l].toUpperCase()}]`;continue}}if(r.m){if(i[l]==="^"){a+=`(^|(?<=[\r
|
|
116
|
+
Error message: ${ad(n)}`,cause:n}),this[qu]=!0,this.value=e}static isInstance(e){return Pt.hasMarker(e,dd)}static wrap({value:e,cause:n}){return sa.isInstance(n)&&n.value===e?n:new sa({value:e,cause:n})}};const Ky=D("ZodISODateTime",(t,e)=>{Mh.init(t,e),ve.init(t,e)});function Xy(t){return j0(Ky,t)}const Jy=D("ZodISODate",(t,e)=>{Bh.init(t,e),ve.init(t,e)});function ek(t){return $0(Jy,t)}const tk=D("ZodISOTime",(t,e)=>{Fh.init(t,e),ve.init(t,e)});function nk(t){return Z0(tk,t)}const rk=D("ZodISODuration",(t,e)=>{Uh.init(t,e),ve.init(t,e)});function ik(t){return Y0(rk,t)}const ak=(t,e)=>{Jd.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>tf(t,n)},flatten:{value:n=>ef(t,n)},addIssue:{value:n=>t.issues.push(n)},addIssues:{value:n=>t.issues.push(...n)},isEmpty:{get(){return t.issues.length===0}}})},ci=D("ZodError",ak,{Parent:Error}),sk=rf(ci),uk=sf(ci),ok=af(ci),fd=nf(ci),we=D("ZodType",(t,e)=>(ke.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),t.clone=(n,r)=>hf(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>sk(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>ok(t,n,r),t.parseAsync=async(n,r)=>uk(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>fd(t,n,r),t.spa=t.safeParseAsync,t.refine=(n,r)=>t.check(rA(n,r)),t.superRefine=n=>t.check(iA(n)),t.overwrite=n=>t.check(ir(n)),t.optional=()=>Qu(t),t.nullable=()=>Ku(t),t.nullish=()=>Qu(Ku(t)),t.nonoptional=n=>Wk(t,n),t.array=()=>xn(t),t.or=n=>Ye([t,n]),t.and=n=>Fk(t,n),t.transform=n=>Xu(t,jk(n)),t.default=n=>Yk(t,n),t.prefault=n=>Vk(t,n),t.catch=n=>Qk(t,n),t.pipe=n=>Xu(t,n),t.readonly=()=>Jk(t),t.describe=n=>{const r=t.clone();return Ln.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return Ln.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Ln.get(t);const r=t.clone();return Ln.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),hd=D("_ZodString",(t,e)=>{_a.init(t,e),we.init(t,e);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(X0(...r)),t.includes=(...r)=>t.check(tp(...r)),t.startsWith=(...r)=>t.check(np(...r)),t.endsWith=(...r)=>t.check(rp(...r)),t.min=(...r)=>t.check(Lr(...r)),t.max=(...r)=>t.check(Oo(...r)),t.length=(...r)=>t.check(Lo(...r)),t.nonempty=(...r)=>t.check(Lr(1,...r)),t.lowercase=r=>t.check(J0(r)),t.uppercase=r=>t.check(ep(r)),t.trim=()=>t.check(ap()),t.normalize=(...r)=>t.check(ip(...r)),t.toLowerCase=()=>t.check(sp()),t.toUpperCase=()=>t.check(up())}),lk=D("ZodString",(t,e)=>{_a.init(t,e),hd.init(t,e),t.email=n=>t.check(x0(ck,n)),t.url=n=>t.check(I0(dk,n)),t.jwt=n=>t.check(z0(Ik,n)),t.emoji=n=>t.check(S0(fk,n)),t.guid=n=>t.check(bs(Wu,n)),t.uuid=n=>t.check(y0(xr,n)),t.uuidv4=n=>t.check(k0(xr,n)),t.uuidv6=n=>t.check(A0(xr,n)),t.uuidv7=n=>t.check(C0(xr,n)),t.nanoid=n=>t.check(N0(hk,n)),t.guid=n=>t.check(bs(Wu,n)),t.cuid=n=>t.check(w0(pk,n)),t.cuid2=n=>t.check(v0(mk,n)),t.ulid=n=>t.check(R0(gk,n)),t.base64=n=>t.check(F0(kk,n)),t.base64url=n=>t.check(U0(Ak,n)),t.xid=n=>t.check(O0(bk,n)),t.ksuid=n=>t.check(L0(Ek,n)),t.ipv4=n=>t.check(D0(Tk,n)),t.ipv6=n=>t.check(P0(_k,n)),t.cidrv4=n=>t.check(M0(xk,n)),t.cidrv6=n=>t.check(B0(yk,n)),t.e164=n=>t.check(H0(Ck,n)),t.datetime=n=>t.check(Xy(n)),t.date=n=>t.check(ek(n)),t.time=n=>t.check(nk(n)),t.duration=n=>t.check(ik(n))});function Y(t){return _0(lk,t)}const ve=D("ZodStringFormat",(t,e)=>{Ne.init(t,e),hd.init(t,e)}),ck=D("ZodEmail",(t,e)=>{Sh.init(t,e),ve.init(t,e)}),Wu=D("ZodGUID",(t,e)=>{Ch.init(t,e),ve.init(t,e)}),xr=D("ZodUUID",(t,e)=>{Ih.init(t,e),ve.init(t,e)}),dk=D("ZodURL",(t,e)=>{Nh.init(t,e),ve.init(t,e)}),fk=D("ZodEmoji",(t,e)=>{wh.init(t,e),ve.init(t,e)}),hk=D("ZodNanoID",(t,e)=>{vh.init(t,e),ve.init(t,e)}),pk=D("ZodCUID",(t,e)=>{Rh.init(t,e),ve.init(t,e)}),mk=D("ZodCUID2",(t,e)=>{Oh.init(t,e),ve.init(t,e)}),gk=D("ZodULID",(t,e)=>{Lh.init(t,e),ve.init(t,e)}),bk=D("ZodXID",(t,e)=>{Dh.init(t,e),ve.init(t,e)}),Ek=D("ZodKSUID",(t,e)=>{Ph.init(t,e),ve.init(t,e)}),Tk=D("ZodIPv4",(t,e)=>{Hh.init(t,e),ve.init(t,e)}),_k=D("ZodIPv6",(t,e)=>{zh.init(t,e),ve.init(t,e)}),xk=D("ZodCIDRv4",(t,e)=>{jh.init(t,e),ve.init(t,e)}),yk=D("ZodCIDRv6",(t,e)=>{$h.init(t,e),ve.init(t,e)}),kk=D("ZodBase64",(t,e)=>{Zh.init(t,e),ve.init(t,e)}),Ak=D("ZodBase64URL",(t,e)=>{qh.init(t,e),ve.init(t,e)}),Ck=D("ZodE164",(t,e)=>{Vh.init(t,e),ve.init(t,e)}),Ik=D("ZodJWT",(t,e)=>{Gh.init(t,e),ve.init(t,e)}),pd=D("ZodNumber",(t,e)=>{wo.init(t,e),we.init(t,e),t.gt=(r,i)=>t.check(Ts(r,i)),t.gte=(r,i)=>t.check(hi(r,i)),t.min=(r,i)=>t.check(hi(r,i)),t.lt=(r,i)=>t.check(Es(r,i)),t.lte=(r,i)=>t.check(fi(r,i)),t.max=(r,i)=>t.check(fi(r,i)),t.int=r=>t.check(Gu(r)),t.safe=r=>t.check(Gu(r)),t.positive=r=>t.check(Ts(0,r)),t.nonnegative=r=>t.check(hi(0,r)),t.negative=r=>t.check(Es(0,r)),t.nonpositive=r=>t.check(fi(0,r)),t.multipleOf=(r,i)=>t.check(_s(r,i)),t.step=(r,i)=>t.check(_s(r,i)),t.finite=()=>t;const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Sk(t){return q0(pd,t)}const Nk=D("ZodNumberFormat",(t,e)=>{Qh.init(t,e),pd.init(t,e)});function Gu(t){return V0(Nk,t)}const wk=D("ZodBoolean",(t,e)=>{Kh.init(t,e),we.init(t,e)});function je(t){return W0(wk,t)}const vk=D("ZodNull",(t,e)=>{Xh.init(t,e),we.init(t,e)});function Rk(t){return G0(vk,t)}const Ok=D("ZodUnknown",(t,e)=>{Jh.init(t,e),we.init(t,e)});function gt(){return Q0(Ok)}const Lk=D("ZodNever",(t,e)=>{e0.init(t,e),we.init(t,e)});function md(t){return K0(Lk,t)}const Dk=D("ZodArray",(t,e)=>{t0.init(t,e),we.init(t,e),t.element=e.element,t.min=(n,r)=>t.check(Lr(n,r)),t.nonempty=n=>t.check(Lr(1,n)),t.max=(n,r)=>t.check(Oo(n,r)),t.length=(n,r)=>t.check(Lo(n,r)),t.unwrap=()=>t.element});function xn(t,e){return op(Dk,t,e)}const gd=D("ZodObject",(t,e)=>{n0.init(t,e),we.init(t,e),de(t,"shape",()=>e.shape),t.keyof=()=>Ed(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:gt()}),t.loose=()=>t.clone({...t._zod.def,catchall:gt()}),t.strict=()=>t.clone({...t._zod.def,catchall:md()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>uf(t,n),t.merge=n=>of(t,n),t.pick=n=>lf(t,n),t.omit=n=>cf(t,n),t.partial=(...n)=>df(Td,t,n[0]),t.required=(...n)=>ff(_d,t,n[0])});function _e(t,e){const n={type:"object",get shape(){return mo(this,"shape",{...t}),this.shape},...G(e)};return new gd(n)}function Ae(t,e){return new gd({type:"object",get shape(){return mo(this,"shape",{...t}),this.shape},catchall:md(),...G(e)})}const bd=D("ZodUnion",(t,e)=>{vo.init(t,e),we.init(t,e),t.options=e.options});function Ye(t,e){return new bd({type:"union",options:t,...G(e)})}const Pk=D("ZodDiscriminatedUnion",(t,e)=>{bd.init(t,e),r0.init(t,e)});function Mk(t,e,n){return new Pk({type:"union",options:e,discriminator:t,...G(n)})}const Bk=D("ZodIntersection",(t,e)=>{i0.init(t,e),we.init(t,e)});function Fk(t,e){return new Bk({type:"intersection",left:t,right:e})}const Uk=D("ZodRecord",(t,e)=>{a0.init(t,e),we.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function er(t,e,n){return new Uk({type:"record",keyType:t,valueType:e,...G(n)})}const ua=D("ZodEnum",(t,e)=>{s0.init(t,e),we.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const a={};for(const s of r)if(n.has(s))a[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ua({...e,checks:[],...G(i),entries:a})},t.exclude=(r,i)=>{const a={...e.entries};for(const s of r)if(n.has(s))delete a[s];else throw new Error(`Key ${s} not found in enum`);return new ua({...e,checks:[],...G(i),entries:a})}});function Ed(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new ua({type:"enum",entries:n,...G(e)})}const Hk=D("ZodLiteral",(t,e)=>{u0.init(t,e),we.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function X(t,e){return new Hk({type:"literal",values:Array.isArray(t)?t:[t],...G(e)})}const zk=D("ZodTransform",(t,e)=>{o0.init(t,e),we.init(t,e),t._zod.parse=(n,r)=>{n.addIssue=a=>{if(typeof a=="string")n.issues.push(Gn(a,n.value,e));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!0),n.issues.push(Gn(s))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(a=>(n.value=a,n)):(n.value=i,n)}});function jk(t){return new zk({type:"transform",transform:t})}const Td=D("ZodOptional",(t,e)=>{l0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qu(t){return new Td({type:"optional",innerType:t})}const $k=D("ZodNullable",(t,e)=>{c0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ku(t){return new $k({type:"nullable",innerType:t})}const Zk=D("ZodDefault",(t,e)=>{d0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Yk(t,e){return new Zk({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const qk=D("ZodPrefault",(t,e)=>{f0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Vk(t,e){return new qk({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const _d=D("ZodNonOptional",(t,e)=>{h0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Wk(t,e){return new _d({type:"nonoptional",innerType:t,...G(e)})}const Gk=D("ZodCatch",(t,e)=>{p0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Qk(t,e){return new Gk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Kk=D("ZodPipe",(t,e)=>{m0.init(t,e),we.init(t,e),t.in=e.in,t.out=e.out});function Xu(t,e){return new Kk({type:"pipe",in:t,out:e})}const Xk=D("ZodReadonly",(t,e)=>{g0.init(t,e),we.init(t,e)});function Jk(t){return new Xk({type:"readonly",innerType:t})}const eA=D("ZodLazy",(t,e)=>{b0.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.getter()});function tA(t){return new eA({type:"lazy",getter:t})}const es=D("ZodCustom",(t,e)=>{E0.init(t,e),we.init(t,e)});function nA(t){const e=new Ge({check:"custom"});return e._zod.check=t,e}function xd(t,e){return lp(es,t??(()=>!0),e)}function rA(t,e={}){return cp(es,t,e)}function iA(t){const e=nA(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Gn(r,n.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),n.issues.push(Gn(i))}},t(n.value,n)));return e}function Zr(t,e={error:`Input not instance of ${t.name}`}){const n=new es({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...G(e)});return n._zod.bag.Class=t,n}var fr=({prefix:t,size:e=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=()=>{const a=n.length,s=new Array(e);for(let u=0;u<e;u++)s[u]=n[Math.random()*a|0];return s.join("")};if(t==null)return i;if(n.includes(r))throw new Wy({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${t}${r}${i()}`},aA=fr();function Ju(t=globalThis){var e,n,r;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(r=(n=t.process)==null?void 0:n.versions)!=null&&r.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function zt(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((n,r)=>{e[r.toLowerCase()]=n});else{Array.isArray(t)||(t=Object.entries(t));for(const[n,r]of t)r!=null&&(e[n.toLowerCase()]=r)}return e}function eo(t,...e){const n=new Headers(zt(t)),r=n.get("user-agent")||"";return n.set("user-agent",[r,...e].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var sA=/"__proto__"\s*:/,uA=/"constructor"\s*:/;function to(t){const e=JSON.parse(t);return e===null||typeof e!="object"||sA.test(t)===!1&&uA.test(t)===!1?e:oA(e)}function oA(t){let e=[t];for(;e.length;){const n=e;e=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in r){const a=r[i];a&&typeof a=="object"&&e.push(a)}}}return t}function lA(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return to(t)}try{return to(t)}finally{Error.stackTraceLimit=e}}function Nr(t){if(t.type==="object"){t.additionalProperties=!1;const e=t.properties;if(e!=null)for(const n in e)e[n]=Nr(e[n])}return t.type==="array"&&t.items!=null&&(Array.isArray(t.items)?t.items=t.items.map(e=>Nr(e)):t.items=Nr(t.items)),t}var cA=Symbol("Let zodToJsonSchema decide on which parser to use"),no={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"},dA=t=>typeof t=="string"?{...no,name:t}:{...no,...t};function nt(){return{}}function fA(t,e){var n,r,i;const a={type:"array"};return(n=t.type)!=null&&n._def&&((i=(r=t.type)==null?void 0:r._def)==null?void 0:i.typeName)!==ne.ZodAny&&(a.items=pe(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(a.minItems=t.minLength.value),t.maxLength&&(a.maxItems=t.maxLength.value),t.exactLength&&(a.minItems=t.exactLength.value,a.maxItems=t.exactLength.value),a}function hA(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function pA(){return{type:"boolean"}}function yd(t,e){return pe(t.type._def,e)}var mA=(t,e)=>pe(t.innerType._def,e);function kd(t,e,n){const r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,a)=>kd(t,e,i))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return gA(t)}}var gA=t=>{const e={type:"integer",format:"unix-time"};for(const n of t.checks)switch(n.kind){case"min":e.minimum=n.value;break;case"max":e.maximum=n.value;break}return e};function bA(t,e){return{...pe(t.innerType._def,e),default:t.defaultValue()}}function EA(t,e){return e.effectStrategy==="input"?pe(t.schema._def,e):nt()}function TA(t){return{type:"string",enum:Array.from(t.values)}}var _A=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function xA(t,e){const n=[pe(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),pe(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return n.forEach(i=>{if(_A(i))r.push(...i.allOf);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:s,...u}=i;a=u}r.push(a)}}),r.length?{allOf:r}:void 0}function yA(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Di=void 0,lt={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:()=>(Di===void 0&&(Di=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Di),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 Ad(t,e){const n={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":ct(n,"email",r.message,e);break;case"format:idn-email":ct(n,"idn-email",r.message,e);break;case"pattern:zod":ze(n,lt.email,r.message,e);break}break;case"url":ct(n,"uri",r.message,e);break;case"uuid":ct(n,"uuid",r.message,e);break;case"regex":ze(n,r.regex,r.message,e);break;case"cuid":ze(n,lt.cuid,r.message,e);break;case"cuid2":ze(n,lt.cuid2,r.message,e);break;case"startsWith":ze(n,RegExp(`^${Pi(r.value,e)}`),r.message,e);break;case"endsWith":ze(n,RegExp(`${Pi(r.value,e)}$`),r.message,e);break;case"datetime":ct(n,"date-time",r.message,e);break;case"date":ct(n,"date",r.message,e);break;case"time":ct(n,"time",r.message,e);break;case"duration":ct(n,"duration",r.message,e);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{ze(n,RegExp(Pi(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&ct(n,"ipv4",r.message,e),r.version!=="v4"&&ct(n,"ipv6",r.message,e);break}case"base64url":ze(n,lt.base64url,r.message,e);break;case"jwt":ze(n,lt.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&ze(n,lt.ipv4Cidr,r.message,e),r.version!=="v4"&&ze(n,lt.ipv6Cidr,r.message,e);break}case"emoji":ze(n,lt.emoji(),r.message,e);break;case"ulid":{ze(n,lt.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ct(n,"binary",r.message,e);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{ze(n,lt.base64,r.message,e);break}}break}case"nanoid":ze(n,lt.nanoid,r.message,e)}return n}function Pi(t,e){return e.patternStrategy==="escape"?AA(t):t}var kA=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function AA(t){let e="";for(let n=0;n<t.length;n++)kA.has(t[n])||(e+="\\"),e+=t[n];return e}function ct(t,e,n,r){var i;t.format||(i=t.anyOf)!=null&&i.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...n&&r.errorMessages&&{errorMessage:{format:n}}})):t.format=e}function ze(t,e,n,r){var i;t.pattern||(i=t.allOf)!=null&&i.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:ro(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):t.pattern=ro(e,r)}function ro(t,e){var n;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=r.i?t.source.toLowerCase():t.source;let a="",s=!1,u=!1,o=!1;for(let l=0;l<i.length;l++){if(s){a+=i[l],s=!1;continue}if(r.i){if(u){if(i[l].match(/[a-z]/)){o?(a+=i[l],a+=`${i[l-2]}-${i[l]}`.toUpperCase(),o=!1):i[l+1]==="-"&&((n=i[l+2])!=null&&n.match(/[a-z]/))?(a+=i[l],o=!0):a+=`${i[l]}${i[l].toUpperCase()}`;continue}}else if(i[l].match(/[a-z]/)){a+=`[${i[l]}${i[l].toUpperCase()}]`;continue}}if(r.m){if(i[l]==="^"){a+=`(^|(?<=[\r
|
|
117
117
|
]))`;continue}else if(i[l]==="$"){a+=`($|(?=[\r
|
|
118
118
|
]))`;continue}}if(r.s&&i[l]==="."){a+=u?`${i[l]}\r
|
|
119
119
|
`:`[${i[l]}\r
|
|
120
|
-
]`;continue}a+=i[l],i[l]==="\\"?s=!0:u&&i[l]==="]"?u=!1:!u&&i[l]==="["&&(u=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function Cd(t,e){var n,r,i,a,s,u;const o={type:"object",additionalProperties:(n=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===re.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:l,...f}=Ad(t.keyType._def,e);return{...o,propertyNames:f}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===re.ZodEnum)return{...o,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===re.ZodBranded&&t.keyType._def.type._def.typeName===re.ZodString&&((u=t.keyType._def.type._def.checks)!=null&&u.length)){const{type:l,...f}=yd(t.keyType._def,e);return{...o,propertyNames:f}}}return o}function CA(t,e){if(e.mapStrategy==="record")return Cd(t,e);const n=pe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||nt(),r=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||nt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function IA(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function SA(){return{not:nt()}}function NA(){return{type:"null"}}var oa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function wA(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in oa&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=oa[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,u)=>u.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return vA(t,e)}var vA=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>pe(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function RA(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[oa[t.innerType._def.typeName],"null"]};const n=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function OA(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function LA(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let u=i[s];if(u===void 0||u._def===void 0)continue;const o=PA(u),l=pe(u._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});l!==void 0&&(n.properties[s]=l,o||r.push(s))}r.length&&(n.required=r);const a=DA(t,e);return a!==void 0&&(n.additionalProperties=a),n}function DA(t,e){if(t.catchall._def.typeName!=="ZodNever")return pe(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function PA(t){try{return t.isOptional()}catch{return!0}}var MA=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return pe(t.innerType._def,e);const r=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:nt()},r]}:nt()},BA=(t,e)=>{if(e.pipeStrategy==="input")return pe(t.in._def,e);if(e.pipeStrategy==="output")return pe(t.out._def,e);const n=pe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=pe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function FA(t,e){return pe(t.type._def,e)}function UA(t,e){const r={type:"array",uniqueItems:!0,items:pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function HA(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:pe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function zA(){return{not:nt()}}function jA(){return nt()}var $A=(t,e)=>pe(t.innerType._def,e),ZA=(t,e,n)=>{switch(e){case re.ZodString:return Ad(t,n);case re.ZodNumber:return OA(t);case re.ZodObject:return LA(t,n);case re.ZodBigInt:return hA(t);case re.ZodBoolean:return pA();case re.ZodDate:return kd(t,n);case re.ZodUndefined:return zA();case re.ZodNull:return NA();case re.ZodArray:return fA(t,n);case re.ZodUnion:case re.ZodDiscriminatedUnion:return wA(t,n);case re.ZodIntersection:return xA(t,n);case re.ZodTuple:return HA(t,n);case re.ZodRecord:return Cd(t,n);case re.ZodLiteral:return yA(t);case re.ZodEnum:return TA(t);case re.ZodNativeEnum:return IA(t);case re.ZodNullable:return RA(t,n);case re.ZodOptional:return MA(t,n);case re.ZodMap:return CA(t,n);case re.ZodSet:return UA(t,n);case re.ZodLazy:return()=>t.getter()._def;case re.ZodPromise:return FA(t,n);case re.ZodNaN:case re.ZodNever:return SA();case re.ZodEffects:return EA(t,n);case re.ZodAny:return nt();case re.ZodUnknown:return jA();case re.ZodDefault:return bA(t,n);case re.ZodBranded:return yd(t,n);case re.ZodReadonly:return $A(t,n);case re.ZodCatch:return mA(t,n);case re.ZodPipeline:return BA(t,n);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(r=>{})()}},YA=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function pe(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const o=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(o!==cA)return o}if(i&&!n){const o=qA(i,e);if(o!==void 0)return o}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=ZA(t,t.typeName,e),u=typeof s=="function"?pe(s(),e):s;if(u&&VA(t,e,u),e.postProcess){const o=e.postProcess(u,t,e);return a.jsonSchema=u,o}return a.jsonSchema=u,u}var qA=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:YA(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),nt()):e.$refStrategy==="seen"?nt():void 0}},VA=(t,e,n)=>(t.description&&(n.description=t.description),n),WA=t=>{const e=dA(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},GA=(t,e)=>{var n;const r=WA(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,d])=>{var p;return{...l,[f]:(p=pe(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0))!=null?p:nt()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=pe(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:nt(),u=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;u!==void 0&&(s.title=u);const o=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return o.$schema="http://json-schema.org/draft-07/schema#",o},la=Symbol.for("vercel.ai.schema");function QA(t){let e;return()=>(e==null&&(e=t()),e)}function di(t,{validate:e}={}){return{[la]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function KA(t){return typeof t=="object"&&t!==null&&la in t&&t[la]===!0&&"jsonSchema"in t&&"validate"in t}function ts(t){return t==null?di({properties:{},additionalProperties:!1}):KA(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Id(t):XA(t):t()}function XA(t){return di(()=>t["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new hn({value:e,cause:n.issues})}}})}function JA(t,e){var n;const r=(n=void 0)!=null?n:!1;return di(()=>GA(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function eC(t,e){var n;const r=(n=void 0)!=null?n:!1;return di(()=>Nr(dp(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await fd(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function tC(t){return"_zod"in t}function Id(t,e){return tC(t)?eC(t):JA(t)}async function io({value:t,schema:e}){const n=await tr({value:t,schema:e});if(!n.success)throw hn.wrap({value:t,cause:n.error});return n.value}async function tr({value:t,schema:e}){const n=ts(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:hn.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:hn.wrap({value:t,cause:r}),rawValue:t}}}async function Qt({text:t,schema:e}){try{const n=lA(t);return e==null?{success:!0,value:n,rawValue:n}:await tr({value:n,schema:e})}catch(n){return{success:!1,error:Yu.isInstance(n)?n:new Yu({text:t,cause:n}),rawValue:void 0}}}function nC({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Mf).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Qt({text:n,schema:e}))}}))}async function Ot(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var rC=Object.defineProperty,iC=(t,e)=>{for(var n in e)rC(t,n,{get:e[n],enumerable:!0})},Sd="AI_NoObjectGeneratedError",Nd=`vercel.ai.error.${Sd}`,aC=Symbol.for(Nd),wd,Dt=class extends Pt{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:Sd,message:t,cause:e}),this[wd]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return Pt.hasMarker(t,Nd)}};wd=aC;var ao="6.0.3",vd=Ye([Y(),Zr(Uint8Array),Zr(ArrayBuffer),xd(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),nr=tA(()=>Ye([Rk(),Y(),Sk(),je(),er(Y(),nr.optional()),xn(nr)])),oe=er(Y(),er(Y(),nr.optional())),Rd=_e({type:X("text"),text:Y(),providerOptions:oe.optional()}),sC=_e({type:X("image"),image:Ye([vd,Zr(URL)]),mediaType:Y().optional(),providerOptions:oe.optional()}),Od=_e({type:X("file"),data:Ye([vd,Zr(URL)]),filename:Y().optional(),mediaType:Y(),providerOptions:oe.optional()}),uC=_e({type:X("reasoning"),text:Y(),providerOptions:oe.optional()}),oC=_e({type:X("tool-call"),toolCallId:Y(),toolName:Y(),input:gt(),providerOptions:oe.optional(),providerExecuted:je().optional()}),lC=Mk("type",[_e({type:X("text"),value:Y(),providerOptions:oe.optional()}),_e({type:X("json"),value:nr,providerOptions:oe.optional()}),_e({type:X("execution-denied"),reason:Y().optional(),providerOptions:oe.optional()}),_e({type:X("error-text"),value:Y(),providerOptions:oe.optional()}),_e({type:X("error-json"),value:nr,providerOptions:oe.optional()}),_e({type:X("content"),value:xn(Ye([_e({type:X("text"),text:Y(),providerOptions:oe.optional()}),_e({type:X("media"),data:Y(),mediaType:Y()}),_e({type:X("file-data"),data:Y(),mediaType:Y(),filename:Y().optional(),providerOptions:oe.optional()}),_e({type:X("file-url"),url:Y(),providerOptions:oe.optional()}),_e({type:X("file-id"),fileId:Ye([Y(),er(Y(),Y())]),providerOptions:oe.optional()}),_e({type:X("image-data"),data:Y(),mediaType:Y(),providerOptions:oe.optional()}),_e({type:X("image-url"),url:Y(),providerOptions:oe.optional()}),_e({type:X("image-file-id"),fileId:Ye([Y(),er(Y(),Y())]),providerOptions:oe.optional()}),_e({type:X("custom"),providerOptions:oe.optional()})]))})]),Ld=_e({type:X("tool-result"),toolCallId:Y(),toolName:Y(),output:lC,providerOptions:oe.optional()}),cC=_e({type:X("tool-approval-request"),approvalId:Y(),toolCallId:Y()}),dC=_e({type:X("tool-approval-response"),approvalId:Y(),approved:je(),reason:Y().optional()}),fC=_e({role:X("system"),content:Y(),providerOptions:oe.optional()}),hC=_e({role:X("user"),content:Ye([Y(),xn(Ye([Rd,sC,Od]))]),providerOptions:oe.optional()}),pC=_e({role:X("assistant"),content:Ye([Y(),xn(Ye([Rd,Od,uC,oC,Ld,cC]))]),providerOptions:oe.optional()}),mC=_e({role:X("tool"),content:xn(Ye([Ld,dC])),providerOptions:oe.optional()});Ye([fC,hC,pC,mC]);function Dd(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),u=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&u?n[r]=Dd(a,i):n[r]=i}return n}var gC={};iC(gC,{array:()=>_C,choice:()=>xC,json:()=>yC,object:()=>TC,text:()=>EC});function bC(t){const e=["ROOT"];let n=-1,r=null;function i(o,l,f){switch(o){case'"':{n=l,e.pop(),e.push(f),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=l,r=l,e.pop(),e.push(f),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(f),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l,e.pop(),e.push(f),e.push("INSIDE_NUMBER");break}case"{":{n=l,e.pop(),e.push(f),e.push("INSIDE_OBJECT_START");break}case"[":{n=l,e.pop(),e.push(f),e.push("INSIDE_ARRAY_START");break}}}function a(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=l,e.pop();break}}}function s(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}}}for(let o=0;o<t.length;o++){const l=t[o];switch(e[e.length-1]){case"ROOT":i(l,o,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=o,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(l,o,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(l,o);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),n=o;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=o}break}case"INSIDE_ARRAY_START":{l==="]"?(n=o,e.pop()):(n=o,i(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=o,e.pop();break}default:{n=o;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(l,o,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=o;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=o;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const d=t.substring(r,o+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(l,o):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o)):n=o;break}}}let u=t.slice(0,n+1);for(let o=e.length-1;o>=0;o--)switch(e[o]){case"INSIDE_STRING":{u+='"';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":{u+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{u+="]";break}case"INSIDE_LITERAL":{const f=t.substring(r,t.length);"true".startsWith(f)?u+="true".slice(f.length):"false".startsWith(f)?u+="false".slice(f.length):"null".startsWith(f)&&(u+="null".slice(f.length))}}return u}async function hr(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await Qt({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await Qt({text:bC(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var EC=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}}}),TC=({schema:t,name:e,description:n})=>{const r=ts(t);return{responseFormat:Ot(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await Qt({text:i});if(!s.success)throw new Dt({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=await tr({value:s.value,schema:r});if(!u.success)throw new Dt({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return u.value},async parsePartialOutput({text:i}){const a=await hr(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},_C=({element:t,name:e,description:n})=>{const r=ts(t);return{responseFormat:Ot(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await Qt({text:i});if(!s.success)throw new Dt({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=s.value;if(u==null||typeof u!="object"||!("elements"in u)||!Array.isArray(u.elements))throw new Dt({message:"No object generated: response did not match schema.",cause:new hn({value:u,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const o of u.elements){const l=await tr({value:o,schema:r});if(!l.success)throw new Dt({message:"No object generated: response did not match schema.",cause:l.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return u.elements},async parsePartialOutput({text:i}){const a=await hr(i);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"||!("elements"in s)||!Array.isArray(s.elements))return;const u=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,o=[];for(const l of u){const f=await tr({value:l,schema:r});f.success&&o.push(f.value)}return{partial:o}}}}}},xC=({options:t,name:e,description:n})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await Qt({text:r});if(!a.success)throw new Dt({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new Dt({message:"No object generated: response did not match schema.",cause:new hn({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await hr(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(u=>u.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}}}),yC=({name:t,description:e}={})=>({responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await Qt({text:n});if(!i.success)throw new Dt({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await hr(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}}});fr({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
|
|
120
|
+
]`;continue}a+=i[l],i[l]==="\\"?s=!0:u&&i[l]==="]"?u=!1:!u&&i[l]==="["&&(u=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function Cd(t,e){var n,r,i,a,s,u;const o={type:"object",additionalProperties:(n=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ne.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:l,...f}=Ad(t.keyType._def,e);return{...o,propertyNames:f}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ne.ZodEnum)return{...o,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ne.ZodBranded&&t.keyType._def.type._def.typeName===ne.ZodString&&((u=t.keyType._def.type._def.checks)!=null&&u.length)){const{type:l,...f}=yd(t.keyType._def,e);return{...o,propertyNames:f}}}return o}function CA(t,e){if(e.mapStrategy==="record")return Cd(t,e);const n=pe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||nt(),r=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||nt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function IA(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function SA(){return{not:nt()}}function NA(){return{type:"null"}}var oa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function wA(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in oa&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=oa[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,u)=>u.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return vA(t,e)}var vA=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>pe(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function RA(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[oa[t.innerType._def.typeName],"null"]};const n=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function OA(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function LA(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let u=i[s];if(u===void 0||u._def===void 0)continue;const o=PA(u),l=pe(u._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});l!==void 0&&(n.properties[s]=l,o||r.push(s))}r.length&&(n.required=r);const a=DA(t,e);return a!==void 0&&(n.additionalProperties=a),n}function DA(t,e){if(t.catchall._def.typeName!=="ZodNever")return pe(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function PA(t){try{return t.isOptional()}catch{return!0}}var MA=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return pe(t.innerType._def,e);const r=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:nt()},r]}:nt()},BA=(t,e)=>{if(e.pipeStrategy==="input")return pe(t.in._def,e);if(e.pipeStrategy==="output")return pe(t.out._def,e);const n=pe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=pe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function FA(t,e){return pe(t.type._def,e)}function UA(t,e){const r={type:"array",uniqueItems:!0,items:pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function HA(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:pe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function zA(){return{not:nt()}}function jA(){return nt()}var $A=(t,e)=>pe(t.innerType._def,e),ZA=(t,e,n)=>{switch(e){case ne.ZodString:return Ad(t,n);case ne.ZodNumber:return OA(t);case ne.ZodObject:return LA(t,n);case ne.ZodBigInt:return hA(t);case ne.ZodBoolean:return pA();case ne.ZodDate:return kd(t,n);case ne.ZodUndefined:return zA();case ne.ZodNull:return NA();case ne.ZodArray:return fA(t,n);case ne.ZodUnion:case ne.ZodDiscriminatedUnion:return wA(t,n);case ne.ZodIntersection:return xA(t,n);case ne.ZodTuple:return HA(t,n);case ne.ZodRecord:return Cd(t,n);case ne.ZodLiteral:return yA(t);case ne.ZodEnum:return TA(t);case ne.ZodNativeEnum:return IA(t);case ne.ZodNullable:return RA(t,n);case ne.ZodOptional:return MA(t,n);case ne.ZodMap:return CA(t,n);case ne.ZodSet:return UA(t,n);case ne.ZodLazy:return()=>t.getter()._def;case ne.ZodPromise:return FA(t,n);case ne.ZodNaN:case ne.ZodNever:return SA();case ne.ZodEffects:return EA(t,n);case ne.ZodAny:return nt();case ne.ZodUnknown:return jA();case ne.ZodDefault:return bA(t,n);case ne.ZodBranded:return yd(t,n);case ne.ZodReadonly:return $A(t,n);case ne.ZodCatch:return mA(t,n);case ne.ZodPipeline:return BA(t,n);case ne.ZodFunction:case ne.ZodVoid:case ne.ZodSymbol:return;default:return(r=>{})()}},YA=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function pe(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const o=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(o!==cA)return o}if(i&&!n){const o=qA(i,e);if(o!==void 0)return o}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=ZA(t,t.typeName,e),u=typeof s=="function"?pe(s(),e):s;if(u&&VA(t,e,u),e.postProcess){const o=e.postProcess(u,t,e);return a.jsonSchema=u,o}return a.jsonSchema=u,u}var qA=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:YA(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),nt()):e.$refStrategy==="seen"?nt():void 0}},VA=(t,e,n)=>(t.description&&(n.description=t.description),n),WA=t=>{const e=dA(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},GA=(t,e)=>{var n;const r=WA(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,d])=>{var p;return{...l,[f]:(p=pe(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0))!=null?p:nt()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=pe(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:nt(),u=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;u!==void 0&&(s.title=u);const o=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return o.$schema="http://json-schema.org/draft-07/schema#",o},la=Symbol.for("vercel.ai.schema");function QA(t){let e;return()=>(e==null&&(e=t()),e)}function di(t,{validate:e}={}){return{[la]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function KA(t){return typeof t=="object"&&t!==null&&la in t&&t[la]===!0&&"jsonSchema"in t&&"validate"in t}function ts(t){return t==null?di({properties:{},additionalProperties:!1}):KA(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Id(t):XA(t):t()}function XA(t){return di(()=>t["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new hn({value:e,cause:n.issues})}}})}function JA(t,e){var n;const r=(n=void 0)!=null?n:!1;return di(()=>GA(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function eC(t,e){var n;const r=(n=void 0)!=null?n:!1;return di(()=>Nr(dp(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await fd(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function tC(t){return"_zod"in t}function Id(t,e){return tC(t)?eC(t):JA(t)}async function io({value:t,schema:e}){const n=await tr({value:t,schema:e});if(!n.success)throw hn.wrap({value:t,cause:n.error});return n.value}async function tr({value:t,schema:e}){const n=ts(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:hn.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:hn.wrap({value:t,cause:r}),rawValue:t}}}async function Qt({text:t,schema:e}){try{const n=lA(t);return e==null?{success:!0,value:n,rawValue:n}:await tr({value:n,schema:e})}catch(n){return{success:!1,error:Yu.isInstance(n)?n:new Yu({text:t,cause:n}),rawValue:void 0}}}function nC({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Mf).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Qt({text:n,schema:e}))}}))}async function Ot(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var rC=Object.defineProperty,iC=(t,e)=>{for(var n in e)rC(t,n,{get:e[n],enumerable:!0})},Sd="AI_NoObjectGeneratedError",Nd=`vercel.ai.error.${Sd}`,aC=Symbol.for(Nd),wd,Dt=class extends Pt{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:Sd,message:t,cause:e}),this[wd]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return Pt.hasMarker(t,Nd)}};wd=aC;var ao="6.0.3",vd=Ye([Y(),Zr(Uint8Array),Zr(ArrayBuffer),xd(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),nr=tA(()=>Ye([Rk(),Y(),Sk(),je(),er(Y(),nr.optional()),xn(nr)])),oe=er(Y(),er(Y(),nr.optional())),Rd=_e({type:X("text"),text:Y(),providerOptions:oe.optional()}),sC=_e({type:X("image"),image:Ye([vd,Zr(URL)]),mediaType:Y().optional(),providerOptions:oe.optional()}),Od=_e({type:X("file"),data:Ye([vd,Zr(URL)]),filename:Y().optional(),mediaType:Y(),providerOptions:oe.optional()}),uC=_e({type:X("reasoning"),text:Y(),providerOptions:oe.optional()}),oC=_e({type:X("tool-call"),toolCallId:Y(),toolName:Y(),input:gt(),providerOptions:oe.optional(),providerExecuted:je().optional()}),lC=Mk("type",[_e({type:X("text"),value:Y(),providerOptions:oe.optional()}),_e({type:X("json"),value:nr,providerOptions:oe.optional()}),_e({type:X("execution-denied"),reason:Y().optional(),providerOptions:oe.optional()}),_e({type:X("error-text"),value:Y(),providerOptions:oe.optional()}),_e({type:X("error-json"),value:nr,providerOptions:oe.optional()}),_e({type:X("content"),value:xn(Ye([_e({type:X("text"),text:Y(),providerOptions:oe.optional()}),_e({type:X("media"),data:Y(),mediaType:Y()}),_e({type:X("file-data"),data:Y(),mediaType:Y(),filename:Y().optional(),providerOptions:oe.optional()}),_e({type:X("file-url"),url:Y(),providerOptions:oe.optional()}),_e({type:X("file-id"),fileId:Ye([Y(),er(Y(),Y())]),providerOptions:oe.optional()}),_e({type:X("image-data"),data:Y(),mediaType:Y(),providerOptions:oe.optional()}),_e({type:X("image-url"),url:Y(),providerOptions:oe.optional()}),_e({type:X("image-file-id"),fileId:Ye([Y(),er(Y(),Y())]),providerOptions:oe.optional()}),_e({type:X("custom"),providerOptions:oe.optional()})]))})]),Ld=_e({type:X("tool-result"),toolCallId:Y(),toolName:Y(),output:lC,providerOptions:oe.optional()}),cC=_e({type:X("tool-approval-request"),approvalId:Y(),toolCallId:Y()}),dC=_e({type:X("tool-approval-response"),approvalId:Y(),approved:je(),reason:Y().optional()}),fC=_e({role:X("system"),content:Y(),providerOptions:oe.optional()}),hC=_e({role:X("user"),content:Ye([Y(),xn(Ye([Rd,sC,Od]))]),providerOptions:oe.optional()}),pC=_e({role:X("assistant"),content:Ye([Y(),xn(Ye([Rd,Od,uC,oC,Ld,cC]))]),providerOptions:oe.optional()}),mC=_e({role:X("tool"),content:xn(Ye([Ld,dC])),providerOptions:oe.optional()});Ye([fC,hC,pC,mC]);function Dd(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),u=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&u?n[r]=Dd(a,i):n[r]=i}return n}var gC={};iC(gC,{array:()=>_C,choice:()=>xC,json:()=>yC,object:()=>TC,text:()=>EC});function bC(t){const e=["ROOT"];let n=-1,r=null;function i(o,l,f){switch(o){case'"':{n=l,e.pop(),e.push(f),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=l,r=l,e.pop(),e.push(f),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(f),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l,e.pop(),e.push(f),e.push("INSIDE_NUMBER");break}case"{":{n=l,e.pop(),e.push(f),e.push("INSIDE_OBJECT_START");break}case"[":{n=l,e.pop(),e.push(f),e.push("INSIDE_ARRAY_START");break}}}function a(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=l,e.pop();break}}}function s(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}}}for(let o=0;o<t.length;o++){const l=t[o];switch(e[e.length-1]){case"ROOT":i(l,o,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=o,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(l,o,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(l,o);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),n=o;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=o}break}case"INSIDE_ARRAY_START":{l==="]"?(n=o,e.pop()):(n=o,i(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=o,e.pop();break}default:{n=o;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(l,o,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=o;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=o;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const d=t.substring(r,o+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(l,o):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o)):n=o;break}}}let u=t.slice(0,n+1);for(let o=e.length-1;o>=0;o--)switch(e[o]){case"INSIDE_STRING":{u+='"';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":{u+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{u+="]";break}case"INSIDE_LITERAL":{const f=t.substring(r,t.length);"true".startsWith(f)?u+="true".slice(f.length):"false".startsWith(f)?u+="false".slice(f.length):"null".startsWith(f)&&(u+="null".slice(f.length))}}return u}async function hr(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await Qt({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await Qt({text:bC(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var EC=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}}}),TC=({schema:t,name:e,description:n})=>{const r=ts(t);return{responseFormat:Ot(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await Qt({text:i});if(!s.success)throw new Dt({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=await tr({value:s.value,schema:r});if(!u.success)throw new Dt({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return u.value},async parsePartialOutput({text:i}){const a=await hr(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},_C=({element:t,name:e,description:n})=>{const r=ts(t);return{responseFormat:Ot(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await Qt({text:i});if(!s.success)throw new Dt({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=s.value;if(u==null||typeof u!="object"||!("elements"in u)||!Array.isArray(u.elements))throw new Dt({message:"No object generated: response did not match schema.",cause:new hn({value:u,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const o of u.elements){const l=await tr({value:o,schema:r});if(!l.success)throw new Dt({message:"No object generated: response did not match schema.",cause:l.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return u.elements},async parsePartialOutput({text:i}){const a=await hr(i);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"||!("elements"in s)||!Array.isArray(s.elements))return;const u=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,o=[];for(const l of u){const f=await tr({value:l,schema:r});f.success&&o.push(f.value)}return{partial:o}}}}}},xC=({options:t,name:e,description:n})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await Qt({text:r});if(!a.success)throw new Dt({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new Dt({message:"No object generated: response did not match schema.",cause:new hn({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await hr(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(u=>u.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}}}),yC=({name:t,description:e}={})=>({responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await Qt({text:n});if(!i.success)throw new Dt({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await hr(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}}});fr({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
|
|
121
121
|
|
|
122
122
|
`)},flush(t){t.enqueue(`data: [DONE]
|
|
123
123
|
|
|
124
|
-
`)}})}});var kC=QA(()=>Id(Ye([Ae({type:X("text-start"),id:Y(),providerMetadata:oe.optional()}),Ae({type:X("text-delta"),id:Y(),delta:Y(),providerMetadata:oe.optional()}),Ae({type:X("text-end"),id:Y(),providerMetadata:oe.optional()}),Ae({type:X("error"),errorText:Y()}),Ae({type:X("tool-input-start"),toolCallId:Y(),toolName:Y(),providerExecuted:je().optional(),dynamic:je().optional(),title:Y().optional()}),Ae({type:X("tool-input-delta"),toolCallId:Y(),inputTextDelta:Y()}),Ae({type:X("tool-input-available"),toolCallId:Y(),toolName:Y(),input:gt(),providerExecuted:je().optional(),providerMetadata:oe.optional(),dynamic:je().optional(),title:Y().optional()}),Ae({type:X("tool-input-error"),toolCallId:Y(),toolName:Y(),input:gt(),providerExecuted:je().optional(),providerMetadata:oe.optional(),dynamic:je().optional(),errorText:Y(),title:Y().optional()}),Ae({type:X("tool-approval-request"),approvalId:Y(),toolCallId:Y()}),Ae({type:X("tool-output-available"),toolCallId:Y(),output:gt(),providerExecuted:je().optional(),dynamic:je().optional(),preliminary:je().optional()}),Ae({type:X("tool-output-error"),toolCallId:Y(),errorText:Y(),providerExecuted:je().optional(),dynamic:je().optional()}),Ae({type:X("tool-output-denied"),toolCallId:Y()}),Ae({type:X("reasoning-start"),id:Y(),providerMetadata:oe.optional()}),Ae({type:X("reasoning-delta"),id:Y(),delta:Y(),providerMetadata:oe.optional()}),Ae({type:X("reasoning-end"),id:Y(),providerMetadata:oe.optional()}),Ae({type:X("source-url"),sourceId:Y(),url:Y(),title:Y().optional(),providerMetadata:oe.optional()}),Ae({type:X("source-document"),sourceId:Y(),mediaType:Y(),title:Y(),filename:Y().optional(),providerMetadata:oe.optional()}),Ae({type:X("file"),url:Y(),mediaType:Y(),providerMetadata:oe.optional()}),Ae({type:xd(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:Y().optional(),data:gt(),transient:je().optional()}),Ae({type:X("start-step")}),Ae({type:X("finish-step")}),Ae({type:X("start"),messageId:Y().optional(),messageMetadata:gt().optional()}),Ae({type:X("finish"),finishReason:Ed(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:gt().optional()}),Ae({type:X("abort")}),Ae({type:X("message-metadata"),messageMetadata:gt()})])));function AC(t){return t.type.startsWith("data-")}function ca(t){return t.type.startsWith("tool-")}function CC(t){return t.type==="dynamic-tool"}function da(t){return ca(t)||CC(t)}function so(t){return t.type.split("-").slice(1).join("-")}function IC({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function SC({stream:t,messageMetadataSchema:e,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:s}){return t.pipeThrough(new TransformStream({async transform(u,o){await r(async({state:l,write:f})=>{var d,p,h,m;function E(b){const v=l.message.parts.filter(da).find(C=>C.toolCallId===b);if(v==null)throw new Error(`no tool invocation found for tool call ${b}`);return v}function x(b){var N;const v=l.message.parts.find(M=>ca(M)&&M.toolCallId===b.toolCallId),C=b,L=v;v!=null?(v.state=b.state,L.input=C.input,L.output=C.output,L.errorText=C.errorText,L.rawInput=C.rawInput,L.preliminary=C.preliminary,b.title!==void 0&&(L.title=b.title),L.providerExecuted=(N=C.providerExecuted)!=null?N:v.providerExecuted,C.providerMetadata!=null&&v.state==="input-available"&&(v.callProviderMetadata=C.providerMetadata)):l.message.parts.push({type:`tool-${b.toolName}`,toolCallId:b.toolCallId,state:b.state,title:b.title,input:C.input,output:C.output,rawInput:C.rawInput,errorText:C.errorText,providerExecuted:C.providerExecuted,preliminary:C.preliminary,...C.providerMetadata!=null?{callProviderMetadata:C.providerMetadata}:{}})}function T(b){var N,v;const C=l.message.parts.find(F=>F.type==="dynamic-tool"&&F.toolCallId===b.toolCallId),L=b,M=C;C!=null?(C.state=b.state,M.toolName=b.toolName,M.input=L.input,M.output=L.output,M.errorText=L.errorText,M.rawInput=(N=L.rawInput)!=null?N:M.rawInput,M.preliminary=L.preliminary,b.title!==void 0&&(M.title=b.title),M.providerExecuted=(v=L.providerExecuted)!=null?v:C.providerExecuted,L.providerMetadata!=null&&C.state==="input-available"&&(C.callProviderMetadata=L.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:b.toolName,toolCallId:b.toolCallId,state:b.state,input:L.input,output:L.output,errorText:L.errorText,preliminary:L.preliminary,providerExecuted:L.providerExecuted,title:b.title,...L.providerMetadata!=null?{callProviderMetadata:L.providerMetadata}:{}})}async function k(b){if(b!=null){const N=l.message.metadata!=null?Dd(l.message.metadata,b):b;e!=null&&await io({value:N,schema:e}),l.message.metadata=N}}switch(u.type){case"text-start":{const b={type:"text",text:"",providerMetadata:u.providerMetadata,state:"streaming"};l.activeTextParts[u.id]=b,l.message.parts.push(b),f();break}case"text-delta":{const b=l.activeTextParts[u.id];b.text+=u.delta,b.providerMetadata=(d=u.providerMetadata)!=null?d:b.providerMetadata,f();break}case"text-end":{const b=l.activeTextParts[u.id];b.state="done",b.providerMetadata=(p=u.providerMetadata)!=null?p:b.providerMetadata,delete l.activeTextParts[u.id],f();break}case"reasoning-start":{const b={type:"reasoning",text:"",providerMetadata:u.providerMetadata,state:"streaming"};l.activeReasoningParts[u.id]=b,l.message.parts.push(b),f();break}case"reasoning-delta":{const b=l.activeReasoningParts[u.id];b.text+=u.delta,b.providerMetadata=(h=u.providerMetadata)!=null?h:b.providerMetadata,f();break}case"reasoning-end":{const b=l.activeReasoningParts[u.id];b.providerMetadata=(m=u.providerMetadata)!=null?m:b.providerMetadata,b.state="done",delete l.activeReasoningParts[u.id],f();break}case"file":{l.message.parts.push({type:"file",mediaType:u.mediaType,url:u.url}),f();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:u.sourceId,url:u.url,title:u.title,providerMetadata:u.providerMetadata}),f();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:u.sourceId,mediaType:u.mediaType,title:u.title,filename:u.filename,providerMetadata:u.providerMetadata}),f();break}case"tool-input-start":{const b=l.message.parts.filter(ca);l.partialToolCalls[u.toolCallId]={text:"",toolName:u.toolName,index:b.length,dynamic:u.dynamic,title:u.title},u.dynamic?T({toolCallId:u.toolCallId,toolName:u.toolName,state:"input-streaming",input:void 0,providerExecuted:u.providerExecuted,title:u.title}):x({toolCallId:u.toolCallId,toolName:u.toolName,state:"input-streaming",input:void 0,providerExecuted:u.providerExecuted,title:u.title}),f();break}case"tool-input-delta":{const b=l.partialToolCalls[u.toolCallId];b.text+=u.inputTextDelta;const{value:N}=await hr(b.text);b.dynamic?T({toolCallId:u.toolCallId,toolName:b.toolName,state:"input-streaming",input:N,title:b.title}):x({toolCallId:u.toolCallId,toolName:b.toolName,state:"input-streaming",input:N,title:b.title}),f();break}case"tool-input-available":{u.dynamic?T({toolCallId:u.toolCallId,toolName:u.toolName,state:"input-available",input:u.input,providerExecuted:u.providerExecuted,providerMetadata:u.providerMetadata,title:u.title}):x({toolCallId:u.toolCallId,toolName:u.toolName,state:"input-available",input:u.input,providerExecuted:u.providerExecuted,providerMetadata:u.providerMetadata,title:u.title}),f(),a&&!u.providerExecuted&&await a({toolCall:u});break}case"tool-input-error":{u.dynamic?T({toolCallId:u.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:u.errorText,providerExecuted:u.providerExecuted,providerMetadata:u.providerMetadata}):x({toolCallId:u.toolCallId,toolName:u.toolName,state:"output-error",input:void 0,rawInput:u.input,errorText:u.errorText,providerExecuted:u.providerExecuted,providerMetadata:u.providerMetadata}),f();break}case"tool-approval-request":{const b=E(u.toolCallId);b.state="approval-requested",b.approval={id:u.approvalId},f();break}case"tool-output-denied":{const b=E(u.toolCallId);b.state="output-denied",f();break}case"tool-output-available":{const b=E(u.toolCallId);b.type==="dynamic-tool"?T({toolCallId:u.toolCallId,toolName:b.toolName,state:"output-available",input:b.input,output:u.output,preliminary:u.preliminary,providerExecuted:u.providerExecuted,title:b.title}):x({toolCallId:u.toolCallId,toolName:so(b),state:"output-available",input:b.input,output:u.output,providerExecuted:u.providerExecuted,preliminary:u.preliminary,title:b.title}),f();break}case"tool-output-error":{const b=E(u.toolCallId);b.type==="dynamic-tool"?T({toolCallId:u.toolCallId,toolName:b.toolName,state:"output-error",input:b.input,errorText:u.errorText,providerExecuted:u.providerExecuted,title:b.title}):x({toolCallId:u.toolCallId,toolName:so(b),state:"output-error",input:b.input,rawInput:b.rawInput,errorText:u.errorText,providerExecuted:u.providerExecuted,title:b.title}),f();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{u.messageId!=null&&(l.message.id=u.messageId),await k(u.messageMetadata),(u.messageId!=null||u.messageMetadata!=null)&&f();break}case"finish":{u.finishReason!=null&&(l.finishReason=u.finishReason),await k(u.messageMetadata),u.messageMetadata!=null&&f();break}case"message-metadata":{await k(u.messageMetadata),u.messageMetadata!=null&&f();break}case"error":{i?.(new Error(u.errorText));break}default:if(AC(u)){n?.[u.type]!=null&&await io({value:u.data,schema:n[u.type]});const b=u;if(b.transient){s?.(b);break}const N=b.id!=null?l.message.parts.find(v=>b.type===v.type&&b.id===v.id):void 0;N!=null?N.data=b.data:l.message.parts.push(b),s?.(b),f()}}o.enqueue(u)})}}))}async function NC({stream:t,onError:e}){const n=t.getReader();try{for(;;){const{done:r}=await n.read();if(r)break}}catch(r){e?.(r)}finally{n.releaseLock()}}fr({prefix:"aitxt",size:24});fr({prefix:"aiobj",size:24});var wC=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(t){return new Promise((e,n)=>{this.queue.push(async()=>{try{await t(),e()}catch(r){n(r)}}),this.processQueue()})}};fr({prefix:"aiobj",size:24});async function vC(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:n,type:r}=e,i=await new Promise((a,s)=>{const u=new FileReader;u.onload=o=>{var l;a((l=o.target)==null?void 0:l.result)},u.onerror=o=>s(o),u.readAsDataURL(e)});return{type:"file",mediaType:r,filename:n,url:i}}))}var RC=class{constructor({api:t="/api/chat",credentials:e,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:s}){this.api=t,this.credentials=e,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=s}async sendMessages({abortSignal:t,...e}){var n,r,i,a,s;const u=await Ot(this.body),o=await Ot(this.headers),l=await Ot(this.credentials),f={...zt(o),...zt(e.headers)},d=await((n=this.prepareSendMessagesRequest)==null?void 0:n.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...u,...e.body},headers:f,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),p=(r=d?.api)!=null?r:this.api,h=d?.headers!==void 0?zt(d.headers):f,m=d?.body!==void 0?d.body:{...u,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},E=(i=d?.credentials)!=null?i:l,T=await((a=this.fetch)!=null?a:globalThis.fetch)(p,{method:"POST",headers:eo({"Content-Type":"application/json",...h},`ai-sdk/${ao}`,Ju()),body:JSON.stringify(m),credentials:E,signal:t});if(!T.ok)throw new Error((s=await T.text())!=null?s:"Failed to fetch the chat response.");if(!T.body)throw new Error("The response body is empty.");return this.processResponseStream(T.body)}async reconnectToStream(t){var e,n,r,i,a;const s=await Ot(this.body),u=await Ot(this.headers),o=await Ot(this.credentials),l={...zt(u),...zt(t.headers)},f=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...s,...t.body},headers:l,credentials:o,requestMetadata:t.metadata})),d=(n=f?.api)!=null?n:`${this.api}/${t.chatId}/stream`,p=f?.headers!==void 0?zt(f.headers):l,h=(r=f?.credentials)!=null?r:o,E=await((i=this.fetch)!=null?i:globalThis.fetch)(d,{method:"GET",headers:eo(p,`ai-sdk/${ao}`,Ju()),credentials:h});if(E.status===204)return null;if(!E.ok)throw new Error((a=await E.text())!=null?a:"Failed to fetch the chat response.");if(!E.body)throw new Error("The response body is empty.");return this.processResponseStream(E.body)}},Pd=class extends RC{constructor(t={}){super(t)}processResponseStream(t){return nC({stream:t,schema:kC}).pipeThrough(new TransformStream({async transform(e,n){if(!e.success)throw e.error;n.enqueue(e.value)}}))}},OC=class{constructor({generateId:t=aA,id:e=t(),transport:n=new Pd,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:s,onToolCall:u,onFinish:o,onData:l,sendAutomaticallyWhen:f}){this.activeResponse=void 0,this.jobExecutor=new wC,this.sendMessage=async(d,p)=>{var h,m,E,x;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(h=this.lastMessage)==null?void 0:h.id,...p});return}let T;if("text"in d||"files"in d?T={parts:[...Array.isArray(d.files)?d.files:await vC(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:T=d,d.messageId!=null){const k=this.state.messages.findIndex(b=>b.id===d.messageId);if(k===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[k].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,k+1),this.state.replaceMessage(k,{...T,id:d.messageId,role:(m=T.role)!=null?m:"user",metadata:d.metadata})}else this.state.pushMessage({...T,id:(E=T.id)!=null?E:this.generateId(),role:(x=T.role)!=null?x:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...p})},this.regenerate=async({messageId:d,...p}={})=>{const h=d==null?this.state.messages.length-1:this.state.messages.findIndex(m=>m.id===d);if(h===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[h].role==="assistant"?h:h+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...p})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:p,reason:h})=>this.jobExecutor.run(async()=>{var m,E;const x=this.state.messages,T=x[x.length-1],k=b=>da(b)&&b.state==="approval-requested"&&b.approval.id===d?{...b,state:"approval-responded",approval:{id:d,approved:p,reason:h}}:b;this.state.replaceMessage(x.length-1,{...T,parts:T.parts.map(k)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(k)),this.status!=="streaming"&&this.status!=="submitted"&&((m=this.sendAutomaticallyWhen)!=null&&m.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.id})}),this.addToolOutput=async({state:d="output-available",tool:p,toolCallId:h,output:m,errorText:E})=>this.jobExecutor.run(async()=>{var x,T;const k=this.state.messages,b=k[k.length-1],N=v=>da(v)&&v.toolCallId===h?{...v,state:d,output:m,errorText:E}:v;this.state.replaceMessage(k.length-1,{...b,parts:b.parts.map(N)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(N)),this.status!=="streaming"&&this.status!=="submitted"&&((x=this.sendAutomaticallyWhen)!=null&&x.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(T=this.lastMessage)==null?void 0:T.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=n,this.generateId=t,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=s,this.onToolCall=u,this.onFinish=o,this.onData=l,this.sendAutomaticallyWhen=f}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}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(t){this.state.messages=t}async makeRequest({trigger:t,metadata:e,headers:n,body:r,messageId:i}){var a,s,u,o;this.setStatus({status:"submitted",error:void 0});const l=this.lastMessage;let f=!1,d=!1,p=!1;try{const h={state:IC({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};h.abortController.signal.addEventListener("abort",()=>{f=!0}),this.activeResponse=h;let m;if(t==="resume-stream"){const x=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:n,body:r});if(x==null){this.setStatus({status:"ready"});return}m=x}else m=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:h.abortController.signal,metadata:e,headers:n,body:r,trigger:t,messageId:i});const E=x=>this.jobExecutor.run(()=>x({state:h.state,write:()=>{var T;this.setStatus({status:"streaming"}),h.state.message.id===((T=this.lastMessage)==null?void 0:T.id)?this.state.replaceMessage(this.state.messages.length-1,h.state.message):this.state.pushMessage(h.state.message)}}));await NC({stream:SC({stream:m,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:E,onError:x=>{throw x}}),onError:x=>{throw x}}),this.setStatus({status:"ready"})}catch(h){if(f||h.name==="AbortError")return f=!0,this.setStatus({status:"ready"}),null;p=!0,h instanceof TypeError&&(h.message.toLowerCase().includes("fetch")||h.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h})}finally{try{(s=this.onFinish)==null||s.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:f,isDisconnect:d,isError:p,finishReason:(a=this.activeResponse)==null?void 0:a.state.finishReason})}catch(h){console.error(h)}this.activeResponse=void 0}(u=this.sendAutomaticallyWhen)!=null&&u.call(this,{messages:this.state.messages})&&!p&&await this.makeRequest({trigger:"submit-message",messageId:(o=this.lastMessage)==null?void 0:o.id,metadata:e,headers:n,body:r})}},Mi,uo;function LC(){if(uo)return Mi;uo=1;function t(e,n){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let r,i=0;return function(...s){clearTimeout(r);const u=Date.now(),o=u-i,l=n-o;l<=0?(i=u,e.apply(this,s)):r=setTimeout(()=>{i=Date.now(),e.apply(this,s)},l)}}return Mi=t,Mi}var DC=LC();const PC=ba(DC);var Md=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Ce=(t,e,n)=>(Md(t,e,"read from private field"),n?n.call(t):e.get(t)),pt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Rt=(t,e,n,r)=>(Md(t,e,"write to private field"),e.set(t,n),n);function MC(t,e){return e!=null?PC(t,e):t}var it,wr,vr,Pn,Mn,Bn,sn,fa,ha,BC=class{constructor(t=[]){pt(this,it,void 0),pt(this,wr,"ready"),pt(this,vr,void 0),pt(this,Pn,new Set),pt(this,Mn,new Set),pt(this,Bn,new Set),this.pushMessage=e=>{Rt(this,it,Ce(this,it).concat(e)),Ce(this,sn).call(this)},this.popMessage=()=>{Rt(this,it,Ce(this,it).slice(0,-1)),Ce(this,sn).call(this)},this.replaceMessage=(e,n)=>{Rt(this,it,[...Ce(this,it).slice(0,e),this.snapshot(n),...Ce(this,it).slice(e+1)]),Ce(this,sn).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,n)=>{const r=n?MC(e,n):e;return Ce(this,Pn).add(r),()=>{Ce(this,Pn).delete(r)}},this["~registerStatusCallback"]=e=>(Ce(this,Mn).add(e),()=>{Ce(this,Mn).delete(e)}),this["~registerErrorCallback"]=e=>(Ce(this,Bn).add(e),()=>{Ce(this,Bn).delete(e)}),pt(this,sn,()=>{Ce(this,Pn).forEach(e=>e())}),pt(this,fa,()=>{Ce(this,Mn).forEach(e=>e())}),pt(this,ha,()=>{Ce(this,Bn).forEach(e=>e())}),Rt(this,it,t)}get status(){return Ce(this,wr)}set status(t){Rt(this,wr,t),Ce(this,fa).call(this)}get error(){return Ce(this,vr)}set error(t){Rt(this,vr,t),Ce(this,ha).call(this)}get messages(){return Ce(this,it)}set messages(t){Rt(this,it,[...t]),Ce(this,sn).call(this)}};it=new WeakMap;wr=new WeakMap;vr=new WeakMap;Pn=new WeakMap;Mn=new WeakMap;Bn=new WeakMap;sn=new WeakMap;fa=new WeakMap;ha=new WeakMap;var un,oo=class extends OC{constructor({messages:t,...e}){const n=new BC(t);super({...e,state:n}),pt(this,un,void 0),this["~registerMessagesCallback"]=(r,i)=>Ce(this,un)["~registerMessagesCallback"](r,i),this["~registerStatusCallback"]=r=>Ce(this,un)["~registerStatusCallback"](r),this["~registerErrorCallback"]=r=>Ce(this,un)["~registerErrorCallback"](r),Rt(this,un,n)}};un=new WeakMap;function FC({experimental_throttle:t,resume:e=!1,...n}={}){const r=V.useRef("chat"in n?n.chat:new oo(n));("chat"in n&&n.chat!==r.current||"id"in n&&r.current.id!==n.id)&&(r.current="chat"in n?n.chat:new oo(n));const a=V.useCallback(f=>r.current["~registerMessagesCallback"](f,t),[t,r.current.id]),s=V.useSyncExternalStore(a,()=>r.current.messages,()=>r.current.messages),u=V.useSyncExternalStore(r.current["~registerStatusCallback"],()=>r.current.status,()=>r.current.status),o=V.useSyncExternalStore(r.current["~registerErrorCallback"],()=>r.current.error,()=>r.current.error),l=V.useCallback(f=>{typeof f=="function"&&(f=f(r.current.messages)),r.current.messages=f},[r]);return V.useEffect(()=>{e&&r.current.resumeStream()},[e,r]),{id:r.current.id,messages:s,setMessages:l,sendMessage:r.current.sendMessage,regenerate:r.current.regenerate,clearError:r.current.clearError,stop:r.current.stop,error:o,resumeStream:r.current.resumeStream,status:u,addToolResult:r.current.addToolOutput,addToolOutput:r.current.addToolOutput,addToolApprovalResponse:r.current.addToolApprovalResponse}}const UC="You are a helpful assistant.",HC=t=>new Pd({api:`/api/${t}/models/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:n})=>({body:{messages:e,stream:!0,...n}})});function pI(t){const e=W.c(30),{threadId:n,systemPrompt:r,onCreateThread:i,onError:a}=t,{org:s,locator:u}=mn(),{slug:o}=s,l=Zy(),f=Yy(),d=$y(n),p=r||UC;let h;e[0]!==p?(h={id:"system",role:"system",parts:[{type:"text",text:p}]},e[0]=p,e[1]=h):h=e[1];const E=h;let x;e[2]!==d||e[3]!==E?(x=[E,...d],e[2]=d,e[3]=E,e[4]=x):x=e[4];const T=x,k=`${n}:${p}`;let b;e[5]!==o?(b=HC(o),e[5]=o,e[6]=b):b=e[6];const N=b;let v;e[7]!==u||e[8]!==f||e[9]!==i||e[10]!==l||e[11]!==n?(v=async Q=>{const{finishReason:ie,messages:be,isAbort:Re,isDisconnect:I,isError:Ie}=Q;if(ie!=="stop"||Re||I||Ie)return;const Ee=be.slice(-2).filter(Boolean);if(Ee.length!==2)return;f.insertMany.mutate(Ee);const S=Ee.find(jC)?.parts?.find(zC)?.text.slice(0,100)||"",ce=await Hy(u,n);if(!ce){if(i)i({id:n,title:S});else{const me=new Date().toISOString(),ge={id:n,title:S,created_at:me,updated_at:me,hidden:!1};l.insert.mutate(ge)}return}l.update.mutate({id:n,updates:{title:ce.title||S,updated_at:new Date().toISOString()}})},e[7]=u,e[8]=f,e[9]=i,e[10]=l,e[11]=n,e[12]=v):v=e[12];const C=v;let L;e[13]!==a?(L=Q=>{console.error("[chat] Chat error:",Q),a?.(Q)},e[13]=a,e[14]=L):L=e[14];let M;e[15]!==T||e[16]!==k||e[17]!==C||e[18]!==L||e[19]!==N?(M={id:k,messages:T,transport:N,onFinish:C,onError:L},e[15]=T,e[16]=k,e[17]=C,e[18]=L,e[19]=N,e[20]=M):M=e[20];const F=FC(M);let w;e[21]!==F?(w=async(Q,ie)=>{!Q?.trim()||F.status==="submitted"||F.status==="streaming"||await F.sendMessage({id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:Q}],metadata:ie},{metadata:ie})},e[21]=F,e[22]=w):w=e[22];const B=w,$=F.messages,J=F.status;let q;e[23]!==F?(q=F.stop.bind(F),e[23]=F,e[24]=q):q=e[24];let z;return e[25]!==F.messages||e[26]!==F.status||e[27]!==B||e[28]!==q?(z={messages:$,status:J,sendMessage:B,stop:q},e[25]=F.messages,e[26]=F.status,e[27]=B,e[28]=q,e[29]=z):z=e[29],z}function zC(t){return t.type==="text"}function jC(t){return t.parts?.find($C)}function $C(t){return t.type==="text"}async function ZC(t){const e=`/mcp/gateway/${t}`,n={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const r=await fetch(e,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-chat",version:"1.0.0"}}})});if(!r.ok)return[];if((await r.json()).error)return[];const a=await fetch(e,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!a.ok)return[];const s=await a.json();return s.error?[]:s.result?.prompts||[]}catch{return[]}}function mI(t){const e=W.c(7);let n;e[0]!==t?(n=We.gatewayPrompts(t),e[0]=t,e[1]=n):n=e[1];let r;e[2]!==t?(r=()=>ZC(t),e[2]=t,e[3]=r):r=e[3];let i;return e[4]!==n||e[5]!==r?(i={queryKey:n,queryFn:r,staleTime:6e4,retry:!1},e[4]=n,e[5]=r,e[6]=i):i=e[6],Ea(i)}function gI(t){const e=W.c(19),{prompts:n,onSelect:r,className:i}=t;if(n.length===0)return null;let a,s,u,o;if(e[0]!==i||e[1]!==r||e[2]!==n){const d=n.slice(0,4);e[7]!==i?(u=te("flex flex-col gap-3 w-full",i),e[7]=i,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Try asking"}),e[9]=o):o=e[9],a="grid grid-cols-1 sm:grid-cols-2 gap-2";let p;e[10]!==r?(p=h=>g.jsxs("button",{type:"button",onClick:()=>r(h),className:te("flex items-start gap-3 p-3 rounded-xl","bg-muted/50 hover:bg-muted transition-colors","text-left cursor-pointer group","border border-transparent hover:border-border"),children:[g.jsx("div",{className:"shrink-0 mt-0.5",children:g.jsx(Uo,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})}),g.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[g.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:(h.title??h.name).replace(/_/g," ")}),h.description&&g.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h.description})]})]},h.name),e[10]=r,e[11]=p):p=e[11],s=d.map(p),e[0]=i,e[1]=r,e[2]=n,e[3]=a,e[4]=s,e[5]=u,e[6]=o}else a=e[3],s=e[4],u=e[5],o=e[6];let l;e[12]!==a||e[13]!==s?(l=g.jsx("div",{className:a,children:s}),e[12]=a,e[13]=s,e[14]=l):l=e[14];let f;return e[15]!==u||e[16]!==o||e[17]!==l?(f=g.jsxs("div",{className:u,children:[o,l]}),e[15]=u,e[16]=o,e[17]=l,e[18]=f):f=e[18],f}function bI(){const t=W.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=g.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsxs("div",{className:"flex items-center gap-3",children:[e,g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),g.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),t[1]=n):n=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:g.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[n,g.jsxs("div",{className:"flex items-end gap-2",children:[g.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),g.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),t[2]=r):r=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:g.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[g.jsx(yr,{align:"right",width:"w-3/4"}),g.jsx(yr,{align:"left",width:"w-full",lines:3}),g.jsx(yr,{align:"right",width:"w-2/3"}),g.jsx(yr,{align:"left",width:"w-5/6",lines:2})]})}),t[3]=i):i=t[3];let a;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=g.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:g.jsx("div",{className:"relative flex-1",children:g.jsxs("div",{className:"space-y-2 p-2",children:[g.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),g.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),t[4]=a):a=t[4];let s;t[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("div",{className:"flex items-center gap-1",children:g.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),t[5]=s):s=t[5];let u;return t[6]===Symbol.for("react.memo_cache_sentinel")?(u=g.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[r,i,g.jsx("div",{className:"px-4 py-4",children:g.jsx("div",{className:"mx-auto w-full max-w-2xl",children:g.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[a,g.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[s,g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),g.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=u):u=t[6],u}function yr(t){const e=W.c(22),{align:n,width:r,lines:i}=t,a=r===void 0?"w-full":r,s=i===void 0?1:i,u=n==="right"?"flex-row-reverse":"flex-row";let o;e[0]!==u?(o=te("flex w-full gap-4 px-4 py-2",u),e[0]=u,e[1]=o):o=e[1];const l=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let f;e[2]!==l?(f=te("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=f):f=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=g.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=d):d=e[4];const p=n==="right"?"bg-muted":"bg-transparent border border-border/40";let h;e[5]!==p||e[6]!==a?(h=te("min-w-0 rounded-2xl p-4",p,a),e[5]=p,e[6]=a,e[7]=h):h=e[7];let m;e[8]!==s?(m=Array.from({length:s}),e[8]=s,e[9]=m):m=e[9];let E;e[10]!==s||e[11]!==m?(E=g.jsx("div",{className:"space-y-2",children:m.map((b,N)=>g.jsx("div",{className:te("h-3 rounded bg-muted-foreground/20 animate-pulse",N===s-1?"w-3/4":"w-full"),style:{animationDelay:`${N*.1}s`}},N))}),e[10]=s,e[11]=m,e[12]=E):E=e[12];let x;e[13]!==E||e[14]!==h?(x=g.jsx("div",{className:h,children:E}),e[13]=E,e[14]=h,e[15]=x):x=e[15];let T;e[16]!==x||e[17]!==f?(T=g.jsxs("div",{className:f,children:[d,x]}),e[16]=x,e[17]=f,e[18]=T):T=e[18];let k;return e[19]!==T||e[20]!==o?(k=g.jsx("div",{className:o,children:T}),e[19]=T,e[20]=o,e[21]=k):k=e[21],k}export{fI as C,Ep as D,wp as G,gI as I,Iy as M,hI as a,Cp as b,xy as c,pI as d,mI as e,xp as f,yp as g,kp as h,ys as i,bp as j,bI as k,Zy as u};
|
|
124
|
+
`)}})}});var kC=QA(()=>Id(Ye([Ae({type:X("text-start"),id:Y(),providerMetadata:oe.optional()}),Ae({type:X("text-delta"),id:Y(),delta:Y(),providerMetadata:oe.optional()}),Ae({type:X("text-end"),id:Y(),providerMetadata:oe.optional()}),Ae({type:X("error"),errorText:Y()}),Ae({type:X("tool-input-start"),toolCallId:Y(),toolName:Y(),providerExecuted:je().optional(),dynamic:je().optional(),title:Y().optional()}),Ae({type:X("tool-input-delta"),toolCallId:Y(),inputTextDelta:Y()}),Ae({type:X("tool-input-available"),toolCallId:Y(),toolName:Y(),input:gt(),providerExecuted:je().optional(),providerMetadata:oe.optional(),dynamic:je().optional(),title:Y().optional()}),Ae({type:X("tool-input-error"),toolCallId:Y(),toolName:Y(),input:gt(),providerExecuted:je().optional(),providerMetadata:oe.optional(),dynamic:je().optional(),errorText:Y(),title:Y().optional()}),Ae({type:X("tool-approval-request"),approvalId:Y(),toolCallId:Y()}),Ae({type:X("tool-output-available"),toolCallId:Y(),output:gt(),providerExecuted:je().optional(),dynamic:je().optional(),preliminary:je().optional()}),Ae({type:X("tool-output-error"),toolCallId:Y(),errorText:Y(),providerExecuted:je().optional(),dynamic:je().optional()}),Ae({type:X("tool-output-denied"),toolCallId:Y()}),Ae({type:X("reasoning-start"),id:Y(),providerMetadata:oe.optional()}),Ae({type:X("reasoning-delta"),id:Y(),delta:Y(),providerMetadata:oe.optional()}),Ae({type:X("reasoning-end"),id:Y(),providerMetadata:oe.optional()}),Ae({type:X("source-url"),sourceId:Y(),url:Y(),title:Y().optional(),providerMetadata:oe.optional()}),Ae({type:X("source-document"),sourceId:Y(),mediaType:Y(),title:Y(),filename:Y().optional(),providerMetadata:oe.optional()}),Ae({type:X("file"),url:Y(),mediaType:Y(),providerMetadata:oe.optional()}),Ae({type:xd(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:Y().optional(),data:gt(),transient:je().optional()}),Ae({type:X("start-step")}),Ae({type:X("finish-step")}),Ae({type:X("start"),messageId:Y().optional(),messageMetadata:gt().optional()}),Ae({type:X("finish"),finishReason:Ed(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:gt().optional()}),Ae({type:X("abort")}),Ae({type:X("message-metadata"),messageMetadata:gt()})])));function AC(t){return t.type.startsWith("data-")}function ca(t){return t.type.startsWith("tool-")}function CC(t){return t.type==="dynamic-tool"}function da(t){return ca(t)||CC(t)}function so(t){return t.type.split("-").slice(1).join("-")}function IC({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function SC({stream:t,messageMetadataSchema:e,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:s}){return t.pipeThrough(new TransformStream({async transform(u,o){await r(async({state:l,write:f})=>{var d,p,h,m;function E(b){const v=l.message.parts.filter(da).find(C=>C.toolCallId===b);if(v==null)throw new Error(`no tool invocation found for tool call ${b}`);return v}function x(b){var N;const v=l.message.parts.find(M=>ca(M)&&M.toolCallId===b.toolCallId),C=b,L=v;v!=null?(v.state=b.state,L.input=C.input,L.output=C.output,L.errorText=C.errorText,L.rawInput=C.rawInput,L.preliminary=C.preliminary,b.title!==void 0&&(L.title=b.title),L.providerExecuted=(N=C.providerExecuted)!=null?N:v.providerExecuted,C.providerMetadata!=null&&v.state==="input-available"&&(v.callProviderMetadata=C.providerMetadata)):l.message.parts.push({type:`tool-${b.toolName}`,toolCallId:b.toolCallId,state:b.state,title:b.title,input:C.input,output:C.output,rawInput:C.rawInput,errorText:C.errorText,providerExecuted:C.providerExecuted,preliminary:C.preliminary,...C.providerMetadata!=null?{callProviderMetadata:C.providerMetadata}:{}})}function T(b){var N,v;const C=l.message.parts.find(F=>F.type==="dynamic-tool"&&F.toolCallId===b.toolCallId),L=b,M=C;C!=null?(C.state=b.state,M.toolName=b.toolName,M.input=L.input,M.output=L.output,M.errorText=L.errorText,M.rawInput=(N=L.rawInput)!=null?N:M.rawInput,M.preliminary=L.preliminary,b.title!==void 0&&(M.title=b.title),M.providerExecuted=(v=L.providerExecuted)!=null?v:C.providerExecuted,L.providerMetadata!=null&&C.state==="input-available"&&(C.callProviderMetadata=L.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:b.toolName,toolCallId:b.toolCallId,state:b.state,input:L.input,output:L.output,errorText:L.errorText,preliminary:L.preliminary,providerExecuted:L.providerExecuted,title:b.title,...L.providerMetadata!=null?{callProviderMetadata:L.providerMetadata}:{}})}async function k(b){if(b!=null){const N=l.message.metadata!=null?Dd(l.message.metadata,b):b;e!=null&&await io({value:N,schema:e}),l.message.metadata=N}}switch(u.type){case"text-start":{const b={type:"text",text:"",providerMetadata:u.providerMetadata,state:"streaming"};l.activeTextParts[u.id]=b,l.message.parts.push(b),f();break}case"text-delta":{const b=l.activeTextParts[u.id];b.text+=u.delta,b.providerMetadata=(d=u.providerMetadata)!=null?d:b.providerMetadata,f();break}case"text-end":{const b=l.activeTextParts[u.id];b.state="done",b.providerMetadata=(p=u.providerMetadata)!=null?p:b.providerMetadata,delete l.activeTextParts[u.id],f();break}case"reasoning-start":{const b={type:"reasoning",text:"",providerMetadata:u.providerMetadata,state:"streaming"};l.activeReasoningParts[u.id]=b,l.message.parts.push(b),f();break}case"reasoning-delta":{const b=l.activeReasoningParts[u.id];b.text+=u.delta,b.providerMetadata=(h=u.providerMetadata)!=null?h:b.providerMetadata,f();break}case"reasoning-end":{const b=l.activeReasoningParts[u.id];b.providerMetadata=(m=u.providerMetadata)!=null?m:b.providerMetadata,b.state="done",delete l.activeReasoningParts[u.id],f();break}case"file":{l.message.parts.push({type:"file",mediaType:u.mediaType,url:u.url}),f();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:u.sourceId,url:u.url,title:u.title,providerMetadata:u.providerMetadata}),f();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:u.sourceId,mediaType:u.mediaType,title:u.title,filename:u.filename,providerMetadata:u.providerMetadata}),f();break}case"tool-input-start":{const b=l.message.parts.filter(ca);l.partialToolCalls[u.toolCallId]={text:"",toolName:u.toolName,index:b.length,dynamic:u.dynamic,title:u.title},u.dynamic?T({toolCallId:u.toolCallId,toolName:u.toolName,state:"input-streaming",input:void 0,providerExecuted:u.providerExecuted,title:u.title}):x({toolCallId:u.toolCallId,toolName:u.toolName,state:"input-streaming",input:void 0,providerExecuted:u.providerExecuted,title:u.title}),f();break}case"tool-input-delta":{const b=l.partialToolCalls[u.toolCallId];b.text+=u.inputTextDelta;const{value:N}=await hr(b.text);b.dynamic?T({toolCallId:u.toolCallId,toolName:b.toolName,state:"input-streaming",input:N,title:b.title}):x({toolCallId:u.toolCallId,toolName:b.toolName,state:"input-streaming",input:N,title:b.title}),f();break}case"tool-input-available":{u.dynamic?T({toolCallId:u.toolCallId,toolName:u.toolName,state:"input-available",input:u.input,providerExecuted:u.providerExecuted,providerMetadata:u.providerMetadata,title:u.title}):x({toolCallId:u.toolCallId,toolName:u.toolName,state:"input-available",input:u.input,providerExecuted:u.providerExecuted,providerMetadata:u.providerMetadata,title:u.title}),f(),a&&!u.providerExecuted&&await a({toolCall:u});break}case"tool-input-error":{u.dynamic?T({toolCallId:u.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:u.errorText,providerExecuted:u.providerExecuted,providerMetadata:u.providerMetadata}):x({toolCallId:u.toolCallId,toolName:u.toolName,state:"output-error",input:void 0,rawInput:u.input,errorText:u.errorText,providerExecuted:u.providerExecuted,providerMetadata:u.providerMetadata}),f();break}case"tool-approval-request":{const b=E(u.toolCallId);b.state="approval-requested",b.approval={id:u.approvalId},f();break}case"tool-output-denied":{const b=E(u.toolCallId);b.state="output-denied",f();break}case"tool-output-available":{const b=E(u.toolCallId);b.type==="dynamic-tool"?T({toolCallId:u.toolCallId,toolName:b.toolName,state:"output-available",input:b.input,output:u.output,preliminary:u.preliminary,providerExecuted:u.providerExecuted,title:b.title}):x({toolCallId:u.toolCallId,toolName:so(b),state:"output-available",input:b.input,output:u.output,providerExecuted:u.providerExecuted,preliminary:u.preliminary,title:b.title}),f();break}case"tool-output-error":{const b=E(u.toolCallId);b.type==="dynamic-tool"?T({toolCallId:u.toolCallId,toolName:b.toolName,state:"output-error",input:b.input,errorText:u.errorText,providerExecuted:u.providerExecuted,title:b.title}):x({toolCallId:u.toolCallId,toolName:so(b),state:"output-error",input:b.input,rawInput:b.rawInput,errorText:u.errorText,providerExecuted:u.providerExecuted,title:b.title}),f();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{u.messageId!=null&&(l.message.id=u.messageId),await k(u.messageMetadata),(u.messageId!=null||u.messageMetadata!=null)&&f();break}case"finish":{u.finishReason!=null&&(l.finishReason=u.finishReason),await k(u.messageMetadata),u.messageMetadata!=null&&f();break}case"message-metadata":{await k(u.messageMetadata),u.messageMetadata!=null&&f();break}case"error":{i?.(new Error(u.errorText));break}default:if(AC(u)){n?.[u.type]!=null&&await io({value:u.data,schema:n[u.type]});const b=u;if(b.transient){s?.(b);break}const N=b.id!=null?l.message.parts.find(v=>b.type===v.type&&b.id===v.id):void 0;N!=null?N.data=b.data:l.message.parts.push(b),s?.(b),f()}}o.enqueue(u)})}}))}async function NC({stream:t,onError:e}){const n=t.getReader();try{for(;;){const{done:r}=await n.read();if(r)break}}catch(r){e?.(r)}finally{n.releaseLock()}}fr({prefix:"aitxt",size:24});fr({prefix:"aiobj",size:24});var wC=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(t){return new Promise((e,n)=>{this.queue.push(async()=>{try{await t(),e()}catch(r){n(r)}}),this.processQueue()})}};fr({prefix:"aiobj",size:24});async function vC(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:n,type:r}=e,i=await new Promise((a,s)=>{const u=new FileReader;u.onload=o=>{var l;a((l=o.target)==null?void 0:l.result)},u.onerror=o=>s(o),u.readAsDataURL(e)});return{type:"file",mediaType:r,filename:n,url:i}}))}var RC=class{constructor({api:t="/api/chat",credentials:e,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:s}){this.api=t,this.credentials=e,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=s}async sendMessages({abortSignal:t,...e}){var n,r,i,a,s;const u=await Ot(this.body),o=await Ot(this.headers),l=await Ot(this.credentials),f={...zt(o),...zt(e.headers)},d=await((n=this.prepareSendMessagesRequest)==null?void 0:n.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...u,...e.body},headers:f,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),p=(r=d?.api)!=null?r:this.api,h=d?.headers!==void 0?zt(d.headers):f,m=d?.body!==void 0?d.body:{...u,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},E=(i=d?.credentials)!=null?i:l,T=await((a=this.fetch)!=null?a:globalThis.fetch)(p,{method:"POST",headers:eo({"Content-Type":"application/json",...h},`ai-sdk/${ao}`,Ju()),body:JSON.stringify(m),credentials:E,signal:t});if(!T.ok)throw new Error((s=await T.text())!=null?s:"Failed to fetch the chat response.");if(!T.body)throw new Error("The response body is empty.");return this.processResponseStream(T.body)}async reconnectToStream(t){var e,n,r,i,a;const s=await Ot(this.body),u=await Ot(this.headers),o=await Ot(this.credentials),l={...zt(u),...zt(t.headers)},f=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...s,...t.body},headers:l,credentials:o,requestMetadata:t.metadata})),d=(n=f?.api)!=null?n:`${this.api}/${t.chatId}/stream`,p=f?.headers!==void 0?zt(f.headers):l,h=(r=f?.credentials)!=null?r:o,E=await((i=this.fetch)!=null?i:globalThis.fetch)(d,{method:"GET",headers:eo(p,`ai-sdk/${ao}`,Ju()),credentials:h});if(E.status===204)return null;if(!E.ok)throw new Error((a=await E.text())!=null?a:"Failed to fetch the chat response.");if(!E.body)throw new Error("The response body is empty.");return this.processResponseStream(E.body)}},Pd=class extends RC{constructor(t={}){super(t)}processResponseStream(t){return nC({stream:t,schema:kC}).pipeThrough(new TransformStream({async transform(e,n){if(!e.success)throw e.error;n.enqueue(e.value)}}))}},OC=class{constructor({generateId:t=aA,id:e=t(),transport:n=new Pd,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:s,onToolCall:u,onFinish:o,onData:l,sendAutomaticallyWhen:f}){this.activeResponse=void 0,this.jobExecutor=new wC,this.sendMessage=async(d,p)=>{var h,m,E,x;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(h=this.lastMessage)==null?void 0:h.id,...p});return}let T;if("text"in d||"files"in d?T={parts:[...Array.isArray(d.files)?d.files:await vC(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:T=d,d.messageId!=null){const k=this.state.messages.findIndex(b=>b.id===d.messageId);if(k===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[k].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,k+1),this.state.replaceMessage(k,{...T,id:d.messageId,role:(m=T.role)!=null?m:"user",metadata:d.metadata})}else this.state.pushMessage({...T,id:(E=T.id)!=null?E:this.generateId(),role:(x=T.role)!=null?x:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...p})},this.regenerate=async({messageId:d,...p}={})=>{const h=d==null?this.state.messages.length-1:this.state.messages.findIndex(m=>m.id===d);if(h===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[h].role==="assistant"?h:h+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...p})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:p,reason:h})=>this.jobExecutor.run(async()=>{var m,E;const x=this.state.messages,T=x[x.length-1],k=b=>da(b)&&b.state==="approval-requested"&&b.approval.id===d?{...b,state:"approval-responded",approval:{id:d,approved:p,reason:h}}:b;this.state.replaceMessage(x.length-1,{...T,parts:T.parts.map(k)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(k)),this.status!=="streaming"&&this.status!=="submitted"&&((m=this.sendAutomaticallyWhen)!=null&&m.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.id})}),this.addToolOutput=async({state:d="output-available",tool:p,toolCallId:h,output:m,errorText:E})=>this.jobExecutor.run(async()=>{var x,T;const k=this.state.messages,b=k[k.length-1],N=v=>da(v)&&v.toolCallId===h?{...v,state:d,output:m,errorText:E}:v;this.state.replaceMessage(k.length-1,{...b,parts:b.parts.map(N)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(N)),this.status!=="streaming"&&this.status!=="submitted"&&((x=this.sendAutomaticallyWhen)!=null&&x.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(T=this.lastMessage)==null?void 0:T.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=n,this.generateId=t,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=s,this.onToolCall=u,this.onFinish=o,this.onData=l,this.sendAutomaticallyWhen=f}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}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(t){this.state.messages=t}async makeRequest({trigger:t,metadata:e,headers:n,body:r,messageId:i}){var a,s,u,o;this.setStatus({status:"submitted",error:void 0});const l=this.lastMessage;let f=!1,d=!1,p=!1;try{const h={state:IC({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};h.abortController.signal.addEventListener("abort",()=>{f=!0}),this.activeResponse=h;let m;if(t==="resume-stream"){const x=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:n,body:r});if(x==null){this.setStatus({status:"ready"});return}m=x}else m=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:h.abortController.signal,metadata:e,headers:n,body:r,trigger:t,messageId:i});const E=x=>this.jobExecutor.run(()=>x({state:h.state,write:()=>{var T;this.setStatus({status:"streaming"}),h.state.message.id===((T=this.lastMessage)==null?void 0:T.id)?this.state.replaceMessage(this.state.messages.length-1,h.state.message):this.state.pushMessage(h.state.message)}}));await NC({stream:SC({stream:m,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:E,onError:x=>{throw x}}),onError:x=>{throw x}}),this.setStatus({status:"ready"})}catch(h){if(f||h.name==="AbortError")return f=!0,this.setStatus({status:"ready"}),null;p=!0,h instanceof TypeError&&(h.message.toLowerCase().includes("fetch")||h.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h})}finally{try{(s=this.onFinish)==null||s.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:f,isDisconnect:d,isError:p,finishReason:(a=this.activeResponse)==null?void 0:a.state.finishReason})}catch(h){console.error(h)}this.activeResponse=void 0}(u=this.sendAutomaticallyWhen)!=null&&u.call(this,{messages:this.state.messages})&&!p&&await this.makeRequest({trigger:"submit-message",messageId:(o=this.lastMessage)==null?void 0:o.id,metadata:e,headers:n,body:r})}},Mi,uo;function LC(){if(uo)return Mi;uo=1;function t(e,n){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let r,i=0;return function(...s){clearTimeout(r);const u=Date.now(),o=u-i,l=n-o;l<=0?(i=u,e.apply(this,s)):r=setTimeout(()=>{i=Date.now(),e.apply(this,s)},l)}}return Mi=t,Mi}var DC=LC();const PC=ba(DC);var Md=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Ce=(t,e,n)=>(Md(t,e,"read from private field"),n?n.call(t):e.get(t)),pt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Rt=(t,e,n,r)=>(Md(t,e,"write to private field"),e.set(t,n),n);function MC(t,e){return e!=null?PC(t,e):t}var it,wr,vr,Pn,Mn,Bn,sn,fa,ha,BC=class{constructor(t=[]){pt(this,it,void 0),pt(this,wr,"ready"),pt(this,vr,void 0),pt(this,Pn,new Set),pt(this,Mn,new Set),pt(this,Bn,new Set),this.pushMessage=e=>{Rt(this,it,Ce(this,it).concat(e)),Ce(this,sn).call(this)},this.popMessage=()=>{Rt(this,it,Ce(this,it).slice(0,-1)),Ce(this,sn).call(this)},this.replaceMessage=(e,n)=>{Rt(this,it,[...Ce(this,it).slice(0,e),this.snapshot(n),...Ce(this,it).slice(e+1)]),Ce(this,sn).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,n)=>{const r=n?MC(e,n):e;return Ce(this,Pn).add(r),()=>{Ce(this,Pn).delete(r)}},this["~registerStatusCallback"]=e=>(Ce(this,Mn).add(e),()=>{Ce(this,Mn).delete(e)}),this["~registerErrorCallback"]=e=>(Ce(this,Bn).add(e),()=>{Ce(this,Bn).delete(e)}),pt(this,sn,()=>{Ce(this,Pn).forEach(e=>e())}),pt(this,fa,()=>{Ce(this,Mn).forEach(e=>e())}),pt(this,ha,()=>{Ce(this,Bn).forEach(e=>e())}),Rt(this,it,t)}get status(){return Ce(this,wr)}set status(t){Rt(this,wr,t),Ce(this,fa).call(this)}get error(){return Ce(this,vr)}set error(t){Rt(this,vr,t),Ce(this,ha).call(this)}get messages(){return Ce(this,it)}set messages(t){Rt(this,it,[...t]),Ce(this,sn).call(this)}};it=new WeakMap;wr=new WeakMap;vr=new WeakMap;Pn=new WeakMap;Mn=new WeakMap;Bn=new WeakMap;sn=new WeakMap;fa=new WeakMap;ha=new WeakMap;var un,oo=class extends OC{constructor({messages:t,...e}){const n=new BC(t);super({...e,state:n}),pt(this,un,void 0),this["~registerMessagesCallback"]=(r,i)=>Ce(this,un)["~registerMessagesCallback"](r,i),this["~registerStatusCallback"]=r=>Ce(this,un)["~registerStatusCallback"](r),this["~registerErrorCallback"]=r=>Ce(this,un)["~registerErrorCallback"](r),Rt(this,un,n)}};un=new WeakMap;function FC({experimental_throttle:t,resume:e=!1,...n}={}){const r=V.useRef("chat"in n?n.chat:new oo(n));("chat"in n&&n.chat!==r.current||"id"in n&&r.current.id!==n.id)&&(r.current="chat"in n?n.chat:new oo(n));const a=V.useCallback(f=>r.current["~registerMessagesCallback"](f,t),[t,r.current.id]),s=V.useSyncExternalStore(a,()=>r.current.messages,()=>r.current.messages),u=V.useSyncExternalStore(r.current["~registerStatusCallback"],()=>r.current.status,()=>r.current.status),o=V.useSyncExternalStore(r.current["~registerErrorCallback"],()=>r.current.error,()=>r.current.error),l=V.useCallback(f=>{typeof f=="function"&&(f=f(r.current.messages)),r.current.messages=f},[r]);return V.useEffect(()=>{e&&r.current.resumeStream()},[e,r]),{id:r.current.id,messages:s,setMessages:l,sendMessage:r.current.sendMessage,regenerate:r.current.regenerate,clearError:r.current.clearError,stop:r.current.stop,error:o,resumeStream:r.current.resumeStream,status:u,addToolResult:r.current.addToolOutput,addToolOutput:r.current.addToolOutput,addToolApprovalResponse:r.current.addToolApprovalResponse}}const UC="You are a helpful assistant.",HC=t=>new Pd({api:`/api/${t}/models/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:n})=>({body:{messages:e,stream:!0,...n}})});function pI(t){const e=W.c(30),{threadId:n,systemPrompt:r,onCreateThread:i,onError:a}=t,{org:s,locator:u}=mn(),{slug:o}=s,l=Zy(),f=Yy(),d=$y(n),p=r||UC;let h;e[0]!==p?(h={id:"system",role:"system",parts:[{type:"text",text:p}]},e[0]=p,e[1]=h):h=e[1];const E=h;let x;e[2]!==d||e[3]!==E?(x=[E,...d],e[2]=d,e[3]=E,e[4]=x):x=e[4];const T=x,k=`${n}:${p}`;let b;e[5]!==o?(b=HC(o),e[5]=o,e[6]=b):b=e[6];const N=b;let v;e[7]!==u||e[8]!==f||e[9]!==i||e[10]!==l||e[11]!==n?(v=async Q=>{const{finishReason:ie,messages:be,isAbort:Re,isDisconnect:I,isError:Ie}=Q;if(ie!=="stop"||Re||I||Ie)return;const Ee=be.slice(-2).filter(Boolean);if(Ee.length!==2)return;f.insertMany.mutate(Ee);const S=Ee.find(jC)?.parts?.find(zC)?.text.slice(0,100)||"",ce=await Hy(u,n);if(!ce){if(i)i({id:n,title:S});else{const me=new Date().toISOString(),ge={id:n,title:S,created_at:me,updated_at:me,hidden:!1};l.insert.mutate(ge)}return}l.update.mutate({id:n,updates:{title:ce.title||S,updated_at:new Date().toISOString()}})},e[7]=u,e[8]=f,e[9]=i,e[10]=l,e[11]=n,e[12]=v):v=e[12];const C=v;let L;e[13]!==a?(L=Q=>{console.error("[chat] Chat error:",Q),a?.(Q)},e[13]=a,e[14]=L):L=e[14];let M;e[15]!==T||e[16]!==k||e[17]!==C||e[18]!==L||e[19]!==N?(M={id:k,messages:T,transport:N,onFinish:C,onError:L},e[15]=T,e[16]=k,e[17]=C,e[18]=L,e[19]=N,e[20]=M):M=e[20];const F=FC(M);let w;e[21]!==F?(w=async(Q,ie)=>{!Q?.trim()||F.status==="submitted"||F.status==="streaming"||await F.sendMessage({id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:Q}],metadata:ie},{metadata:ie})},e[21]=F,e[22]=w):w=e[22];const B=w,$=F.messages,J=F.status;let q;e[23]!==F?(q=F.stop.bind(F),e[23]=F,e[24]=q):q=e[24];let z;return e[25]!==F.messages||e[26]!==F.status||e[27]!==B||e[28]!==q?(z={messages:$,status:J,sendMessage:B,stop:q},e[25]=F.messages,e[26]=F.status,e[27]=B,e[28]=q,e[29]=z):z=e[29],z}function zC(t){return t.type==="text"}function jC(t){return t.parts?.find($C)}function $C(t){return t.type==="text"}async function ZC(t){const e=`/mcp/gateway/${t}`,n={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const r=await fetch(e,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-chat",version:"1.0.0"}}})});if(!r.ok)return[];if((await r.json()).error)return[];const a=await fetch(e,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!a.ok)return[];const s=await a.json();return s.error?[]:s.result?.prompts||[]}catch{return[]}}function mI(t){const e=W.c(7);let n;e[0]!==t?(n=We.gatewayPrompts(t),e[0]=t,e[1]=n):n=e[1];let r;e[2]!==t?(r=()=>ZC(t),e[2]=t,e[3]=r):r=e[3];let i;return e[4]!==n||e[5]!==r?(i={queryKey:n,queryFn:r,staleTime:6e4,retry:!1},e[4]=n,e[5]=r,e[6]=i):i=e[6],Ea(i)}function gI(t){const e=W.c(19),{prompts:n,onSelect:r,className:i}=t;if(n.length===0)return null;let a,s,u,o;if(e[0]!==i||e[1]!==r||e[2]!==n){const d=n.slice(0,4);e[7]!==i?(u=re("flex flex-col gap-3 flex-1",i),e[7]=i,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Try asking"}),e[9]=o):o=e[9],a="grid grid-cols-1 sm:grid-cols-2 gap-2";let p;e[10]!==r?(p=h=>g.jsxs("button",{type:"button",onClick:()=>r(h),className:re("flex items-start gap-3 p-3 rounded-xl","bg-muted/50 hover:bg-muted transition-colors","text-left cursor-pointer group","border border-transparent hover:border-border"),children:[g.jsx("div",{className:"shrink-0 mt-0.5",children:g.jsx(Uo,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})}),g.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[g.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:(h.title??h.name).replace(/_/g," ")}),h.description&&g.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h.description})]})]},h.name),e[10]=r,e[11]=p):p=e[11],s=d.map(p),e[0]=i,e[1]=r,e[2]=n,e[3]=a,e[4]=s,e[5]=u,e[6]=o}else a=e[3],s=e[4],u=e[5],o=e[6];let l;e[12]!==a||e[13]!==s?(l=g.jsx("div",{className:a,children:s}),e[12]=a,e[13]=s,e[14]=l):l=e[14];let f;return e[15]!==u||e[16]!==o||e[17]!==l?(f=g.jsxs("div",{className:u,children:[o,l]}),e[15]=u,e[16]=o,e[17]=l,e[18]=f):f=e[18],f}function bI(){const t=W.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=g.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsxs("div",{className:"flex items-center gap-3",children:[e,g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),g.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),t[1]=n):n=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:g.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[n,g.jsxs("div",{className:"flex items-end gap-2",children:[g.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),g.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),t[2]=r):r=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:g.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[g.jsx(yr,{align:"right",width:"w-3/4"}),g.jsx(yr,{align:"left",width:"w-full",lines:3}),g.jsx(yr,{align:"right",width:"w-2/3"}),g.jsx(yr,{align:"left",width:"w-5/6",lines:2})]})}),t[3]=i):i=t[3];let a;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=g.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:g.jsx("div",{className:"relative flex-1",children:g.jsxs("div",{className:"space-y-2 p-2",children:[g.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),g.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),t[4]=a):a=t[4];let s;t[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("div",{className:"flex items-center gap-1",children:g.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),t[5]=s):s=t[5];let u;return t[6]===Symbol.for("react.memo_cache_sentinel")?(u=g.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[r,i,g.jsx("div",{className:"px-4 py-4",children:g.jsx("div",{className:"mx-auto w-full max-w-2xl",children:g.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[a,g.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[s,g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),g.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=u):u=t[6],u}function yr(t){const e=W.c(22),{align:n,width:r,lines:i}=t,a=r===void 0?"w-full":r,s=i===void 0?1:i,u=n==="right"?"flex-row-reverse":"flex-row";let o;e[0]!==u?(o=re("flex w-full gap-4 px-4 py-2",u),e[0]=u,e[1]=o):o=e[1];const l=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let f;e[2]!==l?(f=re("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=f):f=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=g.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=d):d=e[4];const p=n==="right"?"bg-muted":"bg-transparent border border-border/40";let h;e[5]!==p||e[6]!==a?(h=re("min-w-0 rounded-2xl p-4",p,a),e[5]=p,e[6]=a,e[7]=h):h=e[7];let m;e[8]!==s?(m=Array.from({length:s}),e[8]=s,e[9]=m):m=e[9];let E;e[10]!==s||e[11]!==m?(E=g.jsx("div",{className:"space-y-2",children:m.map((b,N)=>g.jsx("div",{className:re("h-3 rounded bg-muted-foreground/20 animate-pulse",N===s-1?"w-3/4":"w-full"),style:{animationDelay:`${N*.1}s`}},N))}),e[10]=s,e[11]=m,e[12]=E):E=e[12];let x;e[13]!==E||e[14]!==h?(x=g.jsx("div",{className:h,children:E}),e[13]=E,e[14]=h,e[15]=x):x=e[15];let T;e[16]!==x||e[17]!==f?(T=g.jsxs("div",{className:f,children:[d,x]}),e[16]=x,e[17]=f,e[18]=T):T=e[18];let k;return e[19]!==T||e[20]!==o?(k=g.jsx("div",{className:o,children:T}),e[19]=T,e[20]=o,e[21]=k):k=e[21],k}export{fI as C,Ep as D,wp as G,gI as I,Iy as M,hI as a,Cp as b,xy as c,pI as d,mI as e,xp as f,yp as g,kp as h,ys as i,bp as j,bI as k,Zy as u};
|