@openchamber/web 2.7.1 → 2.7.2-canary.20261113.19
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/assets/{AboutDialog-Byc63m0u.js → AboutDialog-DZBVspvU.js} +1 -1
- package/dist/assets/{AboutLogo-BwwjES_b.js → AboutLogo-ChxCGRUm.js} +1 -1
- package/dist/assets/{ArchiveView-DIg8Bq5r.js → ArchiveView-BZJ26vYO.js} +1 -1
- package/dist/assets/{ChangeRequestDiffUnavailable-DtCWp1bf.js → ChangeRequestDiffUnavailable-DWvRZnAG.js} +1 -1
- package/dist/assets/{CommandPalette-D1G7W43z.js → CommandPalette-ynDRBNPC.js} +1 -1
- package/dist/assets/{DataFileArtifact-BPwh4rIZ.js → DataFileArtifact-z9fPrgyu.js} +1 -1
- package/dist/assets/{DiffView-B9-zXR21.js → DiffView-BZ72jtft.js} +1 -1
- package/dist/assets/{FilesView-CTKhKCjC.js → FilesView-C6unlf1o.js} +3 -3
- package/dist/assets/{GitView-2p131yFW.js → GitView-C5sudp8H.js} +1 -1
- package/dist/assets/{GuestPanelContent-BY7I-Y-o.js → GuestPanelContent-VypuCChp.js} +1 -1
- package/dist/assets/{HelpDialog-BfDxlsKj.js → HelpDialog-BCLY1SdQ.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-DX9AlNKS.js → IntegrationsCatalogView-CCC5vFCc.js} +1 -1
- package/dist/assets/{JsonTreeView-Ghbn2jaO.js → JsonTreeView-B1jPqBE_.js} +1 -1
- package/dist/assets/{MarkdownDiffPreview-CcER_eYB.js → MarkdownDiffPreview-BRsvVmm6.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DjBAwXof.js → MarkdownRendererImpl-Bja7xPRh.js} +4 -4
- package/dist/assets/{MemoryDebugPanel-MrH6vI6i.js → MemoryDebugPanel-BiidelAZ.js} +1 -1
- package/dist/assets/{NoteEditor-DnaXw3v6.js → NoteEditor-CDhrox_N.js} +1 -1
- package/dist/assets/{OfficeArtifact-av3so80I.js → OfficeArtifact-CSzZ3l3x.js} +2 -2
- package/dist/assets/{OfficeDocumentDiff-C-XvqPYx.js → OfficeDocumentDiff-DIZPU2-t.js} +1 -1
- package/dist/assets/{OnboardingScreen-Dlbi5e0G.js → OnboardingScreen-BNELvFqK.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-BZzdMaVU.js → OpenCodeStatusDialog-riJvcyNM.js} +1 -1
- package/dist/assets/{OverviewView-CQ82APO2.js → OverviewView-DrjJJdxp.js} +1 -1
- package/dist/assets/{PatchDiff-EZ_WbikC.js → PatchDiff-CbSen5Gt.js} +1 -1
- package/dist/assets/{PlanView-jUry4bXu.js → PlanView-Bi7nN60G.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-Bt6OXdLD.js → ProjectActionsDialog-5SwtkdoL.js} +1 -1
- package/dist/assets/{ReplyCommand-CLNJlG5f.js → ReplyCommand-B-b5HiGJ.js} +1 -1
- package/dist/assets/{ReplyUiBlock-DthlzVWC.js → ReplyUiBlock-SITDS2N8.js} +1 -1
- package/dist/assets/{ReviewCards-qePUMD-z.js → ReviewCards-ClKfTGPh.js} +1 -1
- package/dist/assets/{RunOverview-CvD2Q7KM.js → RunOverview-Zx7ypz3K.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-Dtdb6owf.js → ScheduledTasksDialog-BqkQPZwR.js} +1 -1
- package/dist/assets/{SettingsView-JBCXhydZ.js → SettingsView-CcxtXPxF.js} +1 -1
- package/dist/assets/{SettingsWindow-RJIA1rl5.js → SettingsWindow-rjA8cpzb.js} +1 -1
- package/dist/assets/{SidebarSectionsManager-4i4NcHs0.js → SidebarSectionsManager-DFbc8Xwd.js} +1 -1
- package/dist/assets/{SourceBoardView-BuYJw-Sp.js → SourceBoardView-ClskEpR_.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-B4-bPo9e.js → SpaceAccessDialog-VIsmK3Lq.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DjTQ5PZT.js → SpaceApplyDialog-CE4GGYR-.js} +1 -1
- package/dist/assets/{SpaceRow-CYk17vzn.js → SpaceRow-DoksNK04.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-DRDEgMzx.js → SpaceSetupOutput-CCkZT6Bi.js} +1 -1
- package/dist/assets/{SpacesView-BSt0xE6N.js → SpacesView-BBtBwQ17.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-CTwpN0TO.js → SubmoduleDiffSummary-DoIUrBdP.js} +1 -1
- package/dist/assets/{TableArtifact-BGTFUrHC.js → TableArtifact-CxUbqjYv.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DcQ4eDvb.js → ToolOutputDialog-DPLjXvqn.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-idv0MY3G.js → ToolPartDiffPreview-B2wDDrfp.js} +1 -1
- package/dist/assets/{UiBlock-CVYWc3Px.js → UiBlock-DwXhgpqK.js} +2 -2
- package/dist/assets/{UsageStatsView-Cgo61IDa.js → UsageStatsView-BqLNssJZ.js} +1 -1
- package/dist/assets/{WalkthroughView-CYr8y2pi.js → WalkthroughView-B7KbSsAT.js} +1 -1
- package/dist/assets/{WorktreesView-Duwvqggr.js → WorktreesView-C-AdzkFm.js} +1 -1
- package/dist/assets/{appThemeRegistry-DgyhfFpu.js → appThemeRegistry-3vWr61EA.js} +1 -1
- package/dist/assets/{ar-zwtOisVI.js → ar-D4S57MOa.js} +1 -1
- package/dist/assets/{codeHighlight-DQ8KOMKI.js → codeHighlight-vTDDxBjH.js} +1 -1
- package/dist/assets/{columnWidthMemory-Ol4D51DU.js → columnWidthMemory-CaG5_n8B.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-P_6wH9ys.js → computeVirtualFileMetrics-oAeWRt0Z.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-9zXH1DLm.js → contextFileOpenGuard-BTdwRRDI.js} +1 -1
- package/dist/assets/{date-time-CRucRasX.js → date-time-De4cJmG-.js} +1 -1
- package/dist/assets/{de-5cm4El6N.js → de-YPT7BRkX.js} +1 -1
- package/dist/assets/{documentClient-BbTBnbCU.js → documentClient-ByzYQ2D3.js} +2 -2
- package/dist/assets/{documentHost-Dxv6OV6h.js → documentHost-DaJ0XQTx.js} +1 -1
- package/dist/assets/{editorCodeMetrics-BzYZ4PzQ.js → editorCodeMetrics-CkrWYimB.js} +1 -1
- package/dist/assets/{es-CYh9u5rf.js → es-BqIzbLh0.js} +1 -1
- package/dist/assets/{fileContentPoller-p6RiDNz7.js → fileContentPoller-BXbgYIo0.js} +1 -1
- package/dist/assets/{flexokiTheme-BNUmLj3l.js → flexokiTheme-Yh7J7UaE.js} +1 -1
- package/dist/assets/{fr-gZGCwYzk.js → fr-Bm6tuRAq.js} +1 -1
- package/dist/assets/{he-DWb3dvEl.js → he-B2vIErcj.js} +1 -1
- package/dist/assets/{highlights-DWR6MS75.js → highlights-B2QjzKD7.js} +1 -1
- package/dist/assets/{index-BcEWRtz8.js → index-CsjRKzmq.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-u4U22OVN.js → initializeSharedPreferences-vJOU8q9Y.js} +1 -1
- package/dist/assets/{install-CkKsKExH.js → install-BXZHlgVP.js} +1 -1
- package/dist/assets/{install-request-C0o_6GEa.js → install-request-e6fA_Hb1.js} +1 -1
- package/dist/assets/{isDiffPlainText-B70cjgtm.js → isDiffPlainText-CBdbdXoZ.js} +1 -1
- package/dist/assets/{isFilePlainText-DNNat5m3.js → isFilePlainText-DTR6Yek4.js} +1 -1
- package/dist/assets/{ja-CAeb9wyo.js → ja-D6qPQWDj.js} +1 -1
- package/dist/assets/{katex.min-2cmqKX7p.js → katex.min-BRXXWH9j.js} +4 -4
- package/dist/assets/{ko-DuYqVIuP.js → ko-CISJffvx.js} +1 -1
- package/dist/assets/{main-D9Ri_lHo.js → main-C4tbgFgt.js} +2 -2
- package/dist/assets/{main-kUMMbMdC.js → main-Dhneuvk9.js} +4 -4
- package/dist/assets/{miniChat-HoE2mQuK.js → miniChat-BjuV8rx7.js} +2 -2
- package/dist/assets/{mobile-BFQ0eaJT.js → mobile-iSTV6yUg.js} +2 -2
- package/dist/assets/{moveWorkspacePath-BkzUq9fV.js → moveWorkspacePath-BEX7mjeu.js} +1 -1
- package/dist/assets/{nl-BPlUOQoY.js → nl-B61i4I1-.js} +1 -1
- package/dist/assets/{officeDocument-C74tIqpD.js → officeDocument-CaOOikR3.js} +1 -1
- package/dist/assets/{parseDiffFromFile-COnIA377.js → parseDiffFromFile-BSeCTEcW.js} +1 -1
- package/dist/assets/{pierreDiffTint-9AmpxGGB.js → pierreDiffTint-BKAarfyR.js} +1 -1
- package/dist/assets/{pl-DZRSuGdV.js → pl-B7tMuoTp.js} +1 -1
- package/dist/assets/{pt-BR-fU-ttTba.js → pt-BR-DM4sowqf.js} +1 -1
- package/dist/assets/{relocateRestoredSession-DawfZWX6.js → relocateRestoredSession-B9bwH9_3.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-q30Gq6wf.js → renderElectronMiniChatApp-Ds-rupUf.js} +2 -2
- package/dist/assets/{renderMarkdownForExport-0rL6OK8T.js → renderMarkdownForExport-CO6kiTFz.js} +1 -1
- package/dist/assets/{renderMobileApp-B_PjVgBu.js → renderMobileApp-vACiOPun.js} +3 -3
- package/dist/assets/{resolveLanguages-dF0QdGAX.js → resolveLanguages-DwXFSp4e.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BsAAA4Nf.js → runtimeEndpointReset-0CHuG78d.js} +5 -5
- package/dist/assets/{scheduledTasksApi-CB-Xtp2P.js → scheduledTasksApi-B5hRhk34.js} +1 -1
- package/dist/assets/{shiki-CVNu2J2E.js → shiki-BNrvceeX.js} +1 -1
- package/dist/assets/{space-apply-BmOleF8W.js → space-apply-DlPRGjzD.js} +1 -1
- package/dist/assets/{space-close-DqG3RGoP.js → space-close-DP8YXlG0.js} +1 -1
- package/dist/assets/{spaceNetwork-DUGLrihG.js → spaceNetwork-DBQETFXl.js} +1 -1
- package/dist/assets/{stream-tokenizer-Bzos6Fhy.js → stream-tokenizer-DTPG8KqC.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-BRUbLAuj.js → textMateThemeFromAppTheme-OzgrN6CB.js} +1 -1
- package/dist/assets/{tr-CD93vntx.js → tr-yjYoCwBy.js} +1 -1
- package/dist/assets/{uk-DTqcJvdn.js → uk-5yOoSRye.js} +1 -1
- package/dist/assets/{useAppFontEffects-xaAfmUwn.js → useAppFontEffects-BkjZnJsc.js} +15 -15
- package/dist/assets/{useBranchPullRequestRequest-CIftwmmA.js → useBranchPullRequestRequest-FtZEfVLl.js} +1 -1
- package/dist/assets/{useCallableModelProviders-DYpBJMqj.js → useCallableModelProviders-CiB4Z_LE.js} +1 -1
- package/dist/assets/{useDiffFindSurface-CqxU53Ed.js → useDiffFindSurface-CwoUylJl.js} +1 -1
- package/dist/assets/{useGitCleanLine-CmVX9s9E.js → useGitCleanLine-e7HoRw02.js} +1 -1
- package/dist/assets/{useInlineCommentController-C-V8vqSj.js → useInlineCommentController-CJmX7RR7.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-BfOLz9Xm.js → useMarkdownLocalAssets-Cqxh_vbH.js} +1 -1
- package/dist/assets/{useRootScrollLock-Ciuj2iZ_.js → useRootScrollLock-BDtmtwPT.js} +1 -1
- package/dist/assets/{useWalkthroughReview-BdjnKO7o.js → useWalkthroughReview-CeQ95bk7.js} +1 -1
- package/dist/assets/{useWholeFileComment-DkYtu1tm.js → useWholeFileComment-CHOMIHNo.js} +1 -1
- package/dist/assets/{useWorktreeArchiveActions-DGzuZU_x.js → useWorktreeArchiveActions-BhGDka1f.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-CSQf665k.js → vendor-codemirror-language-data-ClBHCVu_.js} +2 -2
- package/dist/assets/{zh-CN-BJ4oeBCY.js → zh-CN-CCV5QMTb.js} +1 -1
- package/dist/assets/{zh-TW-BMW1G3F_.js → zh-TW-CKda-uV0.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownDiffPreview-
|
|
2
|
-
import{R as b,f as z,j as h,a as mr}from"./vendor-react--VO_rL_p.js";import{iG as xn,iH as hr,iI as Mt,iJ as pr,iK as gr,iL as wr,iM as yr,iN as xr,iO as br,iP as bn,iQ as kr,bB as jt,iR as vr,iS as Sr,iT as Cr,iU as Mr,iV as jr,iW as Dt,iX as Er,iY as kn,iZ as Ue,i_ as Ce,i$ as Rr,u as ge,j0 as Et,j1 as Nr,a3 as ot,B as ve,z as Pr,I as he,j2 as Rt,bk as _r,j3 as vn,j4 as Lr,j5 as Sn,A as yt,j6 as Ar,bl as Cn,j7 as Ir,eQ as Tr,j8 as Mn,j9 as $r,ja as Or,jb as Dr,jc as Fr,cp as zr,jd as Wr,je as Ur,jf as Br,jg as Kr,jh as Vr,ji as Hr,jj as qr,jk as Gr,jl as Xr,jm as Zr,jn as Yr,jo as Jr,jp as Qr,jq as Ft,jr as es,js as zt,jt as ts,ju as ns,c6 as Oe,b9 as rs,jv as Wt,jw as ss,jx as is,jy as os,ap as as,jz as ls,jA as cs,ez as ds,aS as jn,jB as us,jC as fs,jD as ms,b8 as ut,a6 as Ut,a7 as Bt,a8 as Kt,a9 as Vt,n as hs,dx as He,jE as ps,V as gs,jF as Ht,jG as ws,jH as ys,jI as Te,jJ as xs,jK as bs,X as ks,jL as vs,jM as Ss,bL as En,an as Cs,ao as Ms,dj as js,jN as Es,jO as Rs,jP as Ns,jQ as Ps,jR as _s,jS as Ls,ak as As}from"./useAppFontEffects-
|
|
3
|
-
`,s.index-1)+1,a=n.slice(i,s.index);if(/^(?: {4}|\t| {0,3}>)/.test(a)||/(?:^|[^\\])(?:\\\\)*\\$/.test(a))continue;if(r+=/^<\//.test(s[4])?-1:1,r===0)return{bodyEnd:s.index,end:t.lastIndex}}return{bodyEnd:n.length,end:n.length}}function vi(){const n=t=>{const r=this.parse(t);if(!wi(r))throw new Error("Disclosure parsing requires a Markdown root");return t.startsWith("\uFEFF")&&Qe(r,t,1),r},e=(t,r)=>{if(!("children"in t))return;const s=t.children;if(t.type==="blockquote"){const i=t.position?.start?.offset,a=t.position?.end?.offset;if(i===void 0||a===void 0)return;const o=[];let l="",c=i;for(const f of r.slice(i,a).split(new RegExp("(?<=\\n)"))){const u=/^ {0,3}> ?/.exec(f)?.[0].length??0;for(let p=u;p<f.length;p++)o.push(c+p),l+=f[p];c+=f.length}o.push(a);const d=n(l);e(d,l);const m=f=>{if(f.position)for(const u of[f.position.start,f.position.end]){if(!u||u.offset===void 0)continue;u.offset=o[u.offset]??a;const p=r.slice(0,u.offset).split(/\r\n|\r|\n/);u.line=p.length,u.column=p[p.length-1].length+1}if("children"in f)for(const u of f.children)m(u)};m(d),s.splice(0,s.length,...d.children);return}for(let i=0;i<s.length;i++){const a=s[i];if(a.type!=="html"){e(a,r);continue}const o=a.position?.start?.offset;if(o===void 0)continue;const l=yi.exec(r.slice(o));if(!l)continue;const c=o+l[0].length,{bodyEnd:d,end:m}=ki(r,c),f=r.slice(c,d),u=n(f);e(u,f),Qe(u,r,c);const p=/<summary\s*>/i.exec(l[0]),g=o+(p?.index??0)+(p?.[0].length??0),w=l[2]??"",M=xi.exec(w),v=M?M[3]:w,x=n(v);Qe(x,r,g+(M?.[1].length??0));const k=x.children[0],S=k?.type==="paragraph"?k.children:[{type:"text",value:v}],C=bi.find(O=>String(O)===M?.[2]),y={type:"ocDisclosureSummary",data:{hName:"summary"},children:C?[{type:"heading",depth:C,children:S}]:S},j={type:"ocDisclosure",data:{hName:"details",hProperties:l[1]?{open:!0}:{}},children:[y,...u.children]};let P=1,I=a.position?.end?.offset??m;for(;i+P<s.length;){const O=s[i+P];if((O.position?.start?.offset??r.length)>=m)break;I=O.position?.end?.offset??m,P++}const R=n(r.slice(m,I));Qe(R,r,m);const N=R.children;s.splice(i,P,j,...N)}};return(t,r)=>e(t,r.toString())}const Si=function(n,e,t){const r=this.previous===null||this.previous<-2;let s=!1,i=!1;function a(u){return n.enter("ocMath"),n.enter("ocMathMarker"),n.consume(u),o}function o(u){return u!==40&&u!==91||(s=u===91,s&&!r)?t(u):(n.consume(u),n.exit("ocMathMarker"),n.enter("ocMathValue"),l)}function l(u){return u===null?t(u):u===92?n.check(d,m,c)(u):c(u)}function c(u){return i=!0,u!==null&&u<=-3?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),l):(n.consume(u),l)}const d={tokenize(u,p,g){return w;function w(x){return u.consume(x),M}function M(x){return!i||x!==(s?93:41)?g(x):(u.consume(x),s?v:p)}function v(x){return x===32||x===9?(u.consume(x),v):x===null||x<0?p(x):g(x)}}};function m(u){return n.exit("ocMathValue"),n.enter("ocMathMarker"),n.consume(u),f}function f(u){return n.consume(u),n.exit("ocMathMarker"),n.exit("ocMath"),e}return a},Ci=function(n,e,t){const r=this.previous,s=this.parser.constructs.text[60];let i="";return a;function a(d){return r!==null&&r>=48&&r<=57?t(d):(n.enter("ocMath"),n.consume(d),o)}function o(d){return d===null||d<0||d===34?t(d):d===60&&s?n.check(s,t,l)(d):d===40&&i.endsWith("]")||!i&&/\s/.test(String.fromCharCode(d))?t(d):d===36?!i||/^\s|\s$/.test(i)||/^[\d.,\s]+$/.test(i)||/^\d[\d.,]*(?:[;:]|\s+(?:and|to)\b)/.test(i)?t(d):(n.consume(d),c):l(d)}function l(d){return d===null?t(d):(i+=String.fromCharCode(d),n.consume(d),o)}function c(d){return d!==null&&d>=48&&d<=57?t(d):(n.exit("ocMath"),e(d))}},Mi={enter:{ocMath(n){const e=this.sliceSerialize(n).startsWith("\\[");this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math",e?"math-display":"math-inline"]},hChildren:[]}},n)}},exit:{ocMath(n){const e=this.sliceSerialize(n),t=e.startsWith("$")?1:2,r=e.slice(t,-t),s=this.stack[this.stack.length-1];s.type==="inlineMath"&&(s.value=r,s.data&&(s.data.hChildren=[{type:"text",value:r}])),this.exit(n)}}};function ji(n,e){const t=n.position?.start?.offset,r=n.position?.end?.offset;if(t===void 0||r===void 0)return!0;const s=e.slice(t,r);return!s.startsWith("$")||s.startsWith("$$")?!0:!/^[\d.,\s]+$/.test(n.value)&&!/^\s|\s$/.test(n.value)&&!/\d/.test(e.slice(r,r+1))}function Ei(){const n=this.data();return(n.micromarkExtensions??=[]).push({text:{92:{name:"ocMath",tokenize:Si},36:{name:"ocDollarMath",tokenize:Ci}}}),(n.fromMarkdownExtensions??=[]).push(Mi),(e,t)=>{const r=t.toString();function s(i){if(!("children"in i))return;const a=i.children;if(i.type==="link"){const o=a.map(l=>l.type==="inlineMath"||l.type==="math"?r.slice(l.position?.start?.offset,l.position?.end?.offset):l.type==="text"?l.value:"").join("");if(o===i.url){i.children=[{type:"text",value:o}];return}}for(let o=0;o<a.length;o++){const l=a[o];if(l.type==="inlineMath"||l.type==="math"){const c=l.position?.start?.offset,d=l.position?.end?.offset;ji(l,r)?l.type==="inlineMath"&&r.slice(c,d).startsWith("$$")&&(l.data??={},l.data.hProperties={className:["language-math","math-display"]}):a.splice(o,1,{type:"text",value:r.slice(c,d)})}else s(l)}}s(e)}}const Yt="openchamber://extensions/install?",On=n=>{if(!n.toLowerCase().startsWith(Yt))return null;const e=new URLSearchParams(n.slice(Yt.length)),t=e.get("path");if(t)return t.startsWith("/")||/^[a-z]:[\\/]/i.test(t)?{kind:"path",source:t}:null;const r=e.get("url");if(!r)return null;try{return new URL(r).protocol==="https:"?{kind:"url",source:r}:null}catch{return null}},Ri=new Set(["align","alt","checked","colSpan","controls","disabled","height","href","media","open","playsInline","preload","rel","rowSpan","src","srcSet","start","target","title","type","width"]),Ge=Pn();function ct(n){try{const e=new URL(n);return e.protocol==="file:"&&(!e.hostname||e.hostname==="localhost")}catch{return!1}}function kt(n){return/\s/.test(n)||/^[\s\\]*[/\\]{2}/.test(n)||n.includes("\\")?!1:/^https?:\/\//i.test(n)||!/^[a-z][a-z\d+.-]*:/i.test(n)}function Ni(n,e){return n!==n.trim()||/\s/.test(n)?!1:kt(n)||ct(n)||xn(n)||/^(?:mailto|tel|sms|callto|cid|xmpp|irc|ircs|news|nntp|feed|webcal):/i.test(n)||!e&&(hr(n)||On(n)!==null)}function Pi({isVSCode:n}){return(e,t)=>{const r=t.toString();function s(i){const a=[];for(const o of i.children){if(o.type==="doctype")continue;if(o.type!=="element"){a.push(o);continue}if(["script","style","iframe","object","embed","svg","math","form"].includes(o.tagName))continue;const l=o.position?.start?.offset,c=l!==void 0&&r[l]==="<";if(!(o.tagName==="input"&&o.properties.type!=="checkbox")){for(const d of Object.keys(o.properties)){const f=c&&d==="className"&&o.tagName==="code"&&Array.isArray(o.properties.className)&&o.properties.className.every(u=>/^language-[\w#+.-]+$/.test(String(u)))||!c&&(d==="className"&&["code","li","ul","ol","section","h2","a"].includes(o.tagName)||d==="metastring"&&o.tagName==="code"||["id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataFootnotes"].includes(d)||d==="dataOcAlert"&&o.tagName==="blockquote"||d==="dataOcReference"&&o.tagName==="a"||d==="dataOcGuestLink"&&o.tagName==="a");!Ri.has(d)&&!f&&delete o.properties[d]}if(o.properties.href!==void 0){const d=Ge.safeParse(o.properties.href);d.success&&Ni(d.data,n)?o.properties.dataOcLinkSource=d.data:delete o.properties.href}if(o.tagName==="a"&&(o.properties.href="#oc-link"),o.properties.src!==void 0){const d=Ge.safeParse(o.properties.src);if(d.success){const m=d.data,f=o.tagName==="img"&&/^data:image\/(?:png|jpeg|gif|webp);base64,(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(m);m===m.trim()&&(kt(m)||ct(m)||f)?(o.properties.dataOcMediaSource=m,ct(m)&&delete o.properties.src):delete o.properties.src}else delete o.properties.src}if(o.tagName==="img"&&(o.properties.src="/__oc_markdown_media__"),o.properties.srcSet!==void 0){const d=Ge.safeParse(o.properties.srcSet);d.success&&d.data.split(",").every(f=>{const[u,p,...g]=f.trim().split(/\s+/);return!!u&&kt(u)&&g.length===0&&(!p||/^(?:\d+w|\d+(?:\.\d+)?x)$/.test(p))})||delete o.properties.srcSet}for(const d of["width","height"])o.properties[d]!==void 0&&!/^\d+(?:\.\d+)?%?$/.test(String(o.properties[d]))&&delete o.properties[d];o.tagName==="video"&&(o.properties.controls=!0,o.properties.playsInline=!0,o.properties.preload="none"),s(o),a.push(o)}}i.children=a}s(e)}}function _i(){return n=>{function e(t){for(const r of t.children)if(r.type==="element"){if(r.tagName==="a"){const s=Ge.safeParse(r.properties.dataOcLinkSource);s.success?r.properties.href=s.data:delete r.properties.href,delete r.properties.dataOcLinkSource}if(r.tagName==="img"){const s=Ge.safeParse(r.properties.dataOcMediaSource);s.success&&!ct(s.data)&&!/^data:/i.test(s.data)?r.properties.src=s.data:delete r.properties.src}e(r)}}e(n)}}const Li=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote"]),Ai=new Set(["code","pre","ul","ol","blockquote","table","details"]),Ii=new Set(["p","h1","h2","h3","h4","h5","h6","li","br","div"]);function Dn(n){if(n.type==="text")return n.value;if(n.type!=="element"||Ai.has(n.tagName))return" ";const e=n.children.map(Dn).join("");return Ii.has(n.tagName)?` ${e} `:e}function Fn(n){const e=n.children.map(t=>t.type==="element"?Fn(t):void 0);if(Li.has(n.tagName)){const t=zs(n.children.map(Dn).join(""));return t&&(n.properties={...n.properties,dir:t}),t}if(n.tagName==="ul"||n.tagName==="ol"){const t=new Set(e.filter(Boolean));t.size===1&&(n.properties={...n.properties,dir:[...t][0]})}}function Ti(){return n=>{for(const e of n.children)e.type==="element"&&Fn(e)}}const zn={singleTilde:!1},$i=at.gfm,Oi=[[$i[0],zn],...Object.values(at).filter(n=>n!==at.gfm)],Di=lt.remarkPluginsAfter.at(-1),Fi={...lt,remarkPluginsAfter:[...lt.remarkPluginsAfter.slice(0,-1),[Di,zn]]};function zi(n=!1){return n?lt:Fi}const Jt=Xs({singleDollarTextMath:!1}),Wi={...Jt,remarkPlugin:function(){return this.use([Jt.remarkPlugin]),Ei.call(this)}},Ui={tagNames:["a","abbr","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","mark","ol","p","picture","pre","q","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var","video"],strip:["script","style","iframe","object","embed","svg","math","form"],attributes:{"*":["align","alt","checked","colSpan","height","media","open","rowSpan","start","title","width"],a:["href","id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataOcLinkSource","dataOcReference","dataOcGuestLink"],code:[["className",/^language-[\w#+.:-]+$/,"math-inline","math-display"],"metastring"],img:["src","srcSet","alt","dataOcMediaSource"],source:["src","srcSet","type","media","dataOcMediaSource"],video:["src","controls","playsInline","preload","dataOcMediaSource"],input:["type","checked","disabled"],li:[["className","task-list-item"]],ul:[["className","contains-task-list"]],ol:[["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],h2:["id",["className","sr-only"]],blockquote:[["dataOcAlert",...Tn]]},protocols:{src:["http","https"]},clobberPrefix:"",required:{input:{type:"checkbox",disabled:!0}}};function Bi(){return n=>{function e(t){if(!("children"in t)||t.type==="link"||t.type==="linkReference")return;const r=t.children;for(let s=0;s<r.length;s++){const i=r[s];if(i.type!=="text"){e(i);continue}const a=Array.from(i.value.matchAll(/\bopenchamber:\/\/session\/[A-Za-z0-9_-]{1,128}(?:\?message=[A-Za-z0-9_-]{1,128})?/g));if(a.length===0)continue;const o=[];let l=0;for(const c of a)c.index>l&&o.push({type:"text",value:i.value.slice(l,c.index)}),o.push({type:"link",url:c[0],children:[{type:"text",value:c[0]}]}),l=c.index+c[0].length;l<i.value.length&&o.push({type:"text",value:i.value.slice(l)}),r.splice(s,1,...o),s+=o.length-1}}e(n)}}function Ki(){const n=this.data();(n.micromarkExtensions??=[]).push({disable:{null:["htmlFlow","htmlText","characterReference"]}})}function Vi(){return(n,e)=>{const t=String(e.value).replace(/^\uFEFF/,"");n.children=n.children.filter(r=>{const s=r.position?.start.offset,i=r.position?.end.offset;return s===void 0||i===void 0||!Mt(t.slice(s,i))})}}function et(n,e,t){return{remarkPlugins:[...t?Object.values(at):Oi,vi,gi,Vi,Bi],rehypePlugins:[...n?[qt.raw]:[],[Pi,{isVSCode:e}],[Js,Ui],qt.harden,_i,Ti]}}const Hi=[!1,!0].flatMap(n=>[et(!1,!1,n),et(!1,!0,n),et(!0,!1,n),et(!0,!0,n)]);function qi(n,e,t=!1){return Hi[(t?4:0)+(n?2:0)+(e?1:0)]}const Gi=new Set(["inlineCode","code","html","math","inlineMath"]);function Xi(n){return e=>{const t=r=>{if(!Gi.has(r.type)){if(r.type==="text"){r.value=pr(r.value,n);return}if("children"in r)for(const s of r.children)t(s)}};t(e)}}const Zi=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Yi=n=>{const{issuePrefix:e,changeRequestPrefix:t}=n.descriptor.terminology,r=[...new Set([e,t])].sort((s,i)=>i.length-s.length).map(Zi).join("|");return new RegExp([String.raw`(?<![\w/#!@&.-])(?<project>[\w.-]+(?:/[\w.-]+)+)?(?<prefix>${r})(?<number>\d+)(?![\w-])`,String.raw`(?<![\w@./+-])@(?<user>[A-Za-z0-9](?:[A-Za-z0-9_.-]*[A-Za-z0-9_])?)(?![\w@/-])`,String.raw`(?<![\w/@#.-])(?<sha>[0-9a-f]{7,40})(?![\w/-])`].join("|"),"g")},Ji=(n,e,t)=>{const{issuePrefix:r,changeRequestPrefix:s}=n.descriptor.terminology;if(e.number&&e.prefix){const i=e.prefix===r?"issue":e.prefix===s?"pull":null,a=Number(e.number);if(!i||!Number.isSafeInteger(a)||a<1||e.project&&!n.descriptor.repository.nestedNamespaces&&e.project.split("/").length>2)return null;const o=gr(n,i,a,e.project?wr(e.project):n);return o?{url:o,children:[{type:"text",value:t}]}:null}if(e.user){const i=yr(n,e.user);return i?{url:i,children:[{type:"text",value:t}]}:null}if(e.sha&&/\d/.test(e.sha)&&/[a-f]/.test(e.sha)){const i=xr(n,e.sha);return i?{url:i,children:[{type:"inlineCode",value:e.sha.slice(0,7)}]}:null}return null},Qi=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},eo=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function to(n){const e=Yi(n),t=r=>{const s=[];let i=0;for(const a of r.matchAll(e)){const o=a.groups?Ji(n,a.groups,a[0]):null;if(!o)continue;a.index>i&&s.push({type:"text",value:r.slice(i,a.index)});const l={type:"link",url:o.url,children:o.children,data:{hProperties:{dataOcReference:""}}};s.push(l),i=a.index+a[0].length}return s.length===0?null:(i<r.length&&s.push({type:"text",value:r.slice(i)}),s)};return r=>{const s=i=>{if(eo.has(i.type)||!("children"in i))return;const a=i.children;let o=0;for(let l=0;l<a.length;l++){const c=a[l];if(c.type==="html"){o=Math.max(0,o+Qi(c.value));continue}if(o>0)continue;if(c.type!=="text"){s(c);continue}const d=t(c.value);d&&(a.splice(l,1,...d),l+=d.length-1)}};s(r)}}const no=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},ro=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function so(n){const e=br(n),t=r=>{if(!e)return null;const s=[];let i=0;for(const a of r.matchAll(e)){const o=bn(n,a[0]);if(!o)continue;a.index>i&&s.push({type:"text",value:r.slice(i,a.index)});const l={type:"link",url:"",children:[{type:"text",value:a[0]}],data:{hProperties:{dataOcGuestLink:o.guestId}}};s.push(l),i=a.index+a[0].length}return s.length===0?null:(i<r.length&&s.push({type:"text",value:r.slice(i)}),s)};return r=>{if(!e)return;const s=i=>{if(ro.has(i.type)||!("children"in i))return;const a=i.children;let o=0;for(let l=0;l<a.length;l++){const c=a[l];if(c.type==="html"){o=Math.max(0,o+no(c.value));continue}if(o>0)continue;if(c.type!=="text"){s(c);continue}const d=t(c.value);d&&(a.splice(l,1,...d),l+=d.length-1)}};s(r)}}const io=/^\/api\/source-control\/[^/?#]+\/uploads\/[0-9a-f]{32}\/[^/?#]+\?/,tt=new Map;class oo{constructor(e){this.options=e}options;controller=new AbortController;disposed=!1;sources=new Map;batch;refreshing;documentUrls=new Map;runtimeKey=ue();resolver=Ne();connect(){!this.disposed&&this.controller.signal.aborted&&(this.controller=new AbortController)}register(e){return this.sources.set(e,(this.sources.get(e)??0)+1),()=>{const t=(this.sources.get(e)??1)-1;t?this.sources.set(e,t):this.sources.delete(e)}}check(e){if(e.aborted||this.disposed||this.runtimeKey!==ue()||this.resolver!==Ne())throw new DOMException("Media owner changed","AbortError")}async resolve(e,t=!1,r=!1){const s=this.controller.signal;this.check(s);const{mode:i,directory:a,sessionId:o,messageId:l,documentAssets:c}=this.options;if(i==="assistant"&&(await Promise.resolve(),this.check(s),![...this.sources.keys()].slice(0,12).includes(e)))throw new Error("Message media limit");if(/^(?:https?:)?\/\//i.test(e)){if(i!=="document"&&!t)throw new Error("Remote chat image");return e}if(/^data:/i.test(e))return kr(e,s);if(i==="document"){if(!c){if(t||!io.test(e))return e;const w=this.readDocumentImage(e,e,void 0,s);return w.catch(()=>{this.documentUrls.get(e)===w&&this.documentUrls.delete(e)}),w}if(!Qs(e))throw new Error("Document source is unavailable");const u=ei(c.filePath,e),p=c.workspaceRoot,g={path:u,directory:p||void 0,allowOutsideWorkspace:p&&jt(u,p)?void 0:"true"};if(t){if(Se())throw new Error("Video bridge is unavailable");return await xt(),this.check(s),Ne().authenticatedAsset("/api/fs/raw",g)}return this.readDocumentImage(u,"/api/fs/raw",g,s)}if(i==="local")return e;if(Se()){if(t)throw new Error("Video bridge is unavailable");const u=await vr(e,a,s);return this.check(s),u}if(!o||!l)throw new Error("Missing media owner");await Promise.resolve(),this.check(s);const m=[...this.sources.keys()].slice(0,12);if(!m.includes(e))throw new Error("Message media limit");if(!this.batch||r){if(r&&this.refreshing)this.batch=this.refreshing;else if(this.batch=Sr({sources:m.filter(Dt),directory:a,sessionId:o,messageId:l,signal:s}),r){const u=this.batch;this.refreshing=u,u.finally(()=>{this.refreshing===u&&(this.refreshing=void 0)}).catch(()=>{})}}const f=(await this.batch).get(e);if(this.check(s),f?.status!=="ready")throw new Error("Image is unavailable");if(!t&&Cr()){const u=await Mr(f,a,s);return this.check(s),u}return await xt(),this.check(s),jr(f,a)}readDocumentImage(e,t,r,s){const i=this.documentUrls.get(e);if(i)return i;const a=(async()=>{const o=await ft(t,{query:r,signal:AbortSignal.any([s,AbortSignal.timeout(3e4)])});if(!o.ok)throw new Error(`Image read failed (${o.status})`);const l=await o.blob();if(l.size>25*1024*1024)throw new Error("Image too large for preview");return this.check(s),URL.createObjectURL(l)})();return this.documentUrls.set(e,a),a}async load(e){const t=this.controller.signal,{mode:r,directory:s,sessionId:i,messageId:a}=this.options;if(r==="assistant"&&!Se()&&Dt(e)){if(!i||!a)throw new Error("Missing media owner");return Er({source:e,directory:s,sessionId:i,messageId:a,signal:t})}const o=await this.resolve(e);if(!/^(?:data|blob):/i.test(o))throw new Error("Image cannot be saved");return(await fetch(o,{signal:t})).blob()}addGallery(e){const t=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`;let r=tt.get(t);return r||(r=new Set,tt.set(t,r)),r.add(e),()=>{r.delete(e),r.size||tt.delete(t)}}async openGallery(e,t){const r=this.controller.signal;this.check(r);const s=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`,i=[...tt.get(s)??[]].filter(d=>d.element.isConnected).sort((d,m)=>d.element.compareDocumentPosition(m.element)&4?-1:1),a=await Promise.allSettled(i.map(d=>d.resolve()));this.check(r);const o=i.flatMap((d,m)=>{const f=a[m];return f?.status==="fulfilled"?[{url:f.value,filename:d.filename,element:d.element,load:d.load}]:[]}),l=o.findIndex(d=>d.element===e),c=o[l];c&&t({open:!0,title:c.filename,content:"",metadata:{tool:"markdown-image-preview",filename:c.filename},image:{url:c.url,filename:c.filename,load:c.load,gallery:o.map(({url:d,filename:m,load:f})=>({url:d,filename:m,load:f})),index:l}})}disconnect(){this.controller.abort();for(const e of this.documentUrls.values())e.then(t=>URL.revokeObjectURL(t),()=>{});this.documentUrls.clear(),this.batch=void 0,this.refreshing=void 0}dispose(){this.disposed=!0,this.disconnect()}}const Wn=b.createContext(null),Be=b.createContext(!1),pe=()=>b.useContext(Wn);function ao(n){const e=z.c(23),{content:t,mode:r,sessionId:s,messageId:i,directory:a,settled:o,documentAssets:l,onShowPopup:c,children:d}=n,[m,f]=b.useReducer(lo,0);let u,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>Nn(()=>f()),p=[],e[0]=u,e[1]=p):(u=e[0],p=e[1]),b.useEffect(u,p);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=ue(),e[2]=g):g=e[2];const w=g;let M;e[3]===Symbol.for("react.memo_cache_sentinel")?(M=Ne(),e[3]=M):M=e[3];const v=M,x=l?.filePath,k=l?.workspaceRoot;let S;e[4]!==a||e[5]!==x||e[6]!==i||e[7]!==r||e[8]!==s||e[9]!==k?(S=new oo({mode:r,directory:a,sessionId:s,messageId:i,documentAssets:x?{filePath:x,workspaceRoot:k??null}:void 0}),e[4]=a,e[5]=x,e[6]=i,e[7]=r,e[8]=s,e[9]=k,e[10]=S):S=e[10];const C=S;let y,j;e[11]!==C?(y=()=>{if(w!==ue()||v!==Ne()){C.dispose(),f();return}C.connect();const N=Ws(()=>C.dispose());return()=>{N(),C.disconnect()}},j=[C,v,w],e[11]=C,e[12]=y,e[13]=j):(y=e[12],j=e[13]),b.useLayoutEffect(y,j);let P;e[14]!==l||e[15]!==r||e[16]!==c||e[17]!==C||e[18]!==o?(P={owner:C,mode:r,settled:o,documentAssets:l,onShowPopup:c},e[14]=l,e[15]=r,e[16]=c,e[17]=C,e[18]=o,e[19]=P):P=e[19];const I=P;let R;return e[20]!==d||e[21]!==I?(R=h.jsx(Wn.Provider,{value:I,children:d}),e[20]=d,e[21]=I,e[22]=R):R=e[22],R}function lo(n){return n+1}const Un=b.createContext(null),Pt=b.createContext(null);function oe(){const n=b.useContext(Pt);if(!n)throw new Error("Markdown components require MarkdownContent");return n}const _t=n=>/^(?:https?:)?\/\//i.test(n),Bn=n=>n==="streamdown:incomplete-image",Kn=(n,e)=>n["data-oc-media-source"]??e??"",Vn=b.createContext(null),co=n=>{const e=n.ownerDocument.defaultView;for(let t=n.parentElement;t&&e;t=t.parentElement)if(t.scrollHeight>t.clientHeight&&/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null};function Lt(n,e){const t=z.c(7),r=e===void 0?!1:e,s=b.useRef(null);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u=>{s.current=u},t[0]=i):i=t[0];const a=i,[o,l]=b.useState(!1);let c,d;t[1]!==n||t[2]!==r?(c=()=>{if(!n||!s.current)return;const u=s.current.ownerDocument.defaultView?.IntersectionObserver;if(!u){l(!0);return}const p=new u(g=>{g.some(uo)&&(l(!0),p.disconnect())},r?{root:co(s.current),rootMargin:"100% 0px"}:{rootMargin:"200px"});return p.observe(s.current),()=>p.disconnect()},d=[n,r],t[1]=n,t[2]=r,t[3]=c,t[4]=d):(c=t[3],d=t[4]),b.useEffect(c,d);const m=!n||o;let f;return t[5]!==m?(f={ref:s,setRef:a,near:m},t[5]=m,t[6]=f):f=t[6],f}function uo(n){return n.isIntersecting}function fo(n){const e=z.c(4);let t;e[0]!==n?(t=i=>{if(!n)return ho;const a=window.matchMedia(n);return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},e[0]=n,e[1]=t):t=e[1];const r=t;let s;return e[2]!==n?(s=()=>!n||window.matchMedia(n).matches,e[2]=n,e[3]=s):s=e[3],b.useSyncExternalStore(r,s,mo)}function mo(){return!0}function ho(){}const At=b.createContext(null);function Xe(n){const e=z.c(23),{source:t,name:r,title:s,linked:i,state:a}=n,{t:o}=ge(),l=b.useContext(Pt),c=pe(),d=Et(l?.directory??c?.owner?.options.directory??"");let m;e[0]!==a||e[1]!==o||e[2]!==s?(m=a==="failed"?o("common.image.loadFailed"):s,e[0]=a,e[1]=o,e[2]=s,e[3]=m):m=e[3];let f;e[4]!==t?(f=Ce(t),e[4]=t,e[5]=f):f=e[5];let u;e[6]!==a?(u=a==="loading"?h.jsx(Pr,{className:"size-3.5","aria-hidden":!0}):h.jsx(he,{name:a==="failed"?"error-warning":"file-image",className:"size-3.5 shrink-0"}),e[6]=a,e[7]=u):u=e[7];let p;e[8]!==r||e[9]!==a||e[10]!==m||e[11]!==f||e[12]!==u?(p=h.jsxs("span",{title:m,"data-oc-media-source":f,"data-oc-media-label":"true","data-oc-media-state":a,className:"inline-flex items-center gap-1 align-text-bottom text-muted-foreground",children:[u,r]}),e[8]=r,e[9]=a,e[10]=m,e[11]=f,e[12]=u,e[13]=p):p=e[13];const g=p;if(!_t(t)||i||Nr(t))return g;let w;e[14]!==d||e[15]!==l?.disableLinkSafety||e[16]!==l?.purpose||e[17]!==t?(w=v=>{l?.purpose||l?.disableLinkSafety||v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||(v.preventDefault(),v.stopPropagation(),d(t))},e[14]=d,e[15]=l?.disableLinkSafety,e[16]=l?.purpose,e[17]=t,e[18]=w):w=e[18];let M;return e[19]!==g||e[20]!==t||e[21]!==w?(M=h.jsx("a",{href:t,className:"external-link",target:"_blank",rel:"noopener noreferrer",onClick:w,children:g}),e[19]=g,e[20]=t,e[21]=w,e[22]=M):M=e[22],M}function Hn(n,e,t){const r=z.c(22),s=t===void 0?!1:t,i=pe(),a=i?.owner,[o,l]=b.useState(null),[c,d]=b.useState(null);let m;r[0]!==i?.mode?(m=()=>{i?.mode==="document"&&l(po)},r[0]=i?.mode,r[1]=m):m=r[1];const f=i?.mode;let u;r[2]!==f?(u=[f],r[2]=f,r[3]=u):u=r[3],b.useLayoutEffect(m,u);let p,g;r[4]!==e||r[5]!==a||r[6]!==n||r[7]!==s?(p=()=>{if(!a||!n||!e)return;const S=a.controller.signal;let C=!1;return a.resolve(n,s).then(y=>{!C&&!S.aborted&&(d(null),l({owner:a,signal:S,source:n,url:y}))},()=>{!C&&!S.aborted&&d({owner:a,signal:S,source:n,url:""})}),()=>{C=!0}},g=[a,n,e,s],r[4]=e,r[5]=a,r[6]=n,r[7]=s,r[8]=p,r[9]=g):(p=r[8],g=r[9]),b.useEffect(p,g);const w=c?.owner===a&&c?.source===n,M=o&&o.owner===a&&o.source===n&&(i?.mode!=="document"||!o.signal.aborted)&&!w?o.url:void 0;let v;r[10]!==a||r[11]!==n?(v=()=>{a&&d({owner:a,signal:a.controller.signal,source:n,url:""})},r[10]=a,r[11]=n,r[12]=v):v=r[12];let x;r[13]!==a||r[14]!==n||r[15]!==s?(x=async()=>{if(!a)throw new Error("Missing media owner");const S=a.controller.signal,C=await a.resolve(n,s,!0);S.aborted||(d(null),l({owner:a,signal:S,source:n,url:C}))},r[13]=a,r[14]=n,r[15]=s,r[16]=x):x=r[16];let k;return r[17]!==w||r[18]!==M||r[19]!==v||r[20]!==x?(k={url:M,failed:w,fail:v,retry:x},r[17]=w,r[18]=M,r[19]=v,r[20]=x,r[21]=k):k=r[21],k}function po(n){return n?.signal.aborted?null:n}const go=(n,e)=>{const t=e===void 0?"":String(e).trim(),r=n===void 0?"":String(n).trim();return/^\d+$/.test(t)?/^\d+$/.test(r)&&Number(t)>0?{aspectRatio:`${r}/${t}`}:{height:`${t}px`}:{}};function wo(n){const e=z.c(9),t=Kn(n,n.src),r=pe(),s=b.useContext(Be);if(Bn(t))return null;if(!s&&Rr(t,n.alt??""))return h.jsx(It,{src:t,title:n.title||n.alt,node:n.node});if(!t){let a;return e[0]!==r?.mode||e[1]!==n.alt||e[2]!==n.height||e[3]!==n.title||e[4]!==n.width?(a=r?.mode==="document"?h.jsx("img",{alt:n.alt,title:n.title,width:n.width,height:n.height}):null,e[0]=r?.mode,e[1]=n.alt,e[2]=n.height,e[3]=n.title,e[4]=n.width,e[5]=a):a=e[5],a}if(r?.mode!=="document"&&(_t(t)||s))return h.jsx(Xe,{source:t,name:Ue(t,n.alt),title:n.title,linked:s});let i;return e[6]!==n||e[7]!==t?(i=h.jsx(yo,{...n,source:t}),e[6]=n,e[7]=t,e[8]=i):i=e[8],i}function yo(n){const e=z.c(92);let t,r,s,i,a,o,l,c,d,m,f;if(e[0]!==n){const{source:ee,node:me,src:Ze,srcSet:we,alt:Ke,title:ye,className:xe,style:be,width:ke,height:Le,onLoad:$,onError:ae,...de}=n;o=ee,l=we,d=Ke,m=ye,t=xe,c=be,f=ke,r=Le,i=$,s=ae,a=de,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=o,e[7]=l,e[8]=c,e[9]=d,e[10]=m,e[11]=f}else t=e[1],r=e[2],s=e[3],i=e[4],a=e[5],o=e[6],l=e[7],c=e[8],d=e[9],m=e[10],f=e[11];const u=d===void 0?"":d,p=pe(),g=b.useContext(Be),w=b.useContext(Vn),M=w?.report,v=b.useId();let x;e[12]!==u||e[13]!==o?(x=Ue(o,u),e[12]=u,e[13]=o,e[14]=x):x=e[14];const k=x,S=p?.mode==="assistant",C=p?.mode==="document",y=b.useContext(At),{ref:j,setRef:P,near:I}=Lt(S||C&&y===null,C),R=y??I,N=p?.owner,O=S&&!!p?.onShowPopup&&!g;let E,A;e[15]!==N||e[16]!==o?(E=()=>N?.register(o),A=[N,o],e[15]=N,e[16]=o,e[17]=E,e[18]=A):(E=e[17],A=e[18]),b.useEffect(E,A);const W=!!(p&&R&&(!S||p.settled)),{url:L,failed:_,fail:U}=Hn(o,W),K=qn(l,W),[Z,J]=b.useState(null),T=!!(L&&Z?.url===L),D=Z&&Z.url===L?Z.size:void 0;let G,V;e[19]!==T||e[20]!==v||e[21]!==M||e[22]!==D?(G=()=>(M?.(v,T&&D?D:null),()=>M?.(v,null)),V=[M,v,T,D],e[19]=T,e[20]=v,e[21]=M,e[22]=D,e[23]=G,e[24]=V):(G=e[23],V=e[24]),b.useEffect(G,V);let q,F;e[25]!==T||e[26]!==O||e[27]!==k||e[28]!==N||e[29]!==j||e[30]!==o||e[31]!==L?(q=()=>{const ee=j.current;if(!(!N||!T||!ee||!O))return N.addGallery({source:o,filename:k,element:ee,resolve:()=>L?.startsWith("data:")?Promise.resolve(L):N.resolve(o,!1,!0),load:()=>N.load(o)})},F=[N,T,o,k,j,O,L],e[25]=T,e[26]=O,e[27]=k,e[28]=N,e[29]=j,e[30]=o,e[31]=L,e[32]=q,e[33]=F):(q=e[32],F=e[33]),b.useEffect(q,F);let H;e[34]!==u||e[35]!==t||e[36]!==C||e[37]!==T||e[38]!==U||e[39]!==r||e[40]!==k||e[41]!==s||e[42]!==i||e[43]!==a||e[44]!==K||e[45]!==w?.ready||e[46]!==P||e[47]!==o||e[48]!==l||e[49]!==c||e[50]!==m||e[51]!==L||e[52]!==f?(H=L||C?h.jsx("img",{...a,ref:C?P:void 0,src:L,srcSet:K,alt:u||k,title:m,width:f,height:r,className:ot(C?t:"block h-auto max-h-[30rem] w-auto max-w-full object-contain",C?!L&&"invisible":!T&&"hidden"),style:C?{...c,...go(f,r)}:{...c,width:w?.ready?"100%":c?.width},"data-oc-media-source":Ce(o),"data-oc-media-srcset":l,decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:ee=>{const me=ee.currentTarget;L&&me.naturalWidth&&me.naturalHeight&&J({url:L,size:{width:me.naturalWidth,height:me.naturalHeight}}),i?.(ee)},onError:ee=>{U(),s?.(ee)}}):null,e[34]=u,e[35]=t,e[36]=C,e[37]=T,e[38]=U,e[39]=r,e[40]=k,e[41]=s,e[42]=i,e[43]=a,e[44]=K,e[45]=w?.ready,e[46]=P,e[47]=o,e[48]=l,e[49]=c,e[50]=m,e[51]=L,e[52]=f,e[53]=H):H=e[53];const Y=H,X=D?D.width/D.height:1;let te;e[54]!==X||e[55]!==w?.ready||e[56]!==D?(te=w?.ready&&D?{flex:`${X} 1 0px`,minWidth:`${8*X}rem`,maxWidth:`min(${D.width}px, ${30*X}rem)`,margin:0}:void 0,e[54]=X,e[55]=w?.ready,e[56]=D,e[57]=te):te=e[57];const le=te;if(C){let ee;return e[58]!==_||e[59]!==Y||e[60]!==g||e[61]!==k||e[62]!==o||e[63]!==m?(ee=_?h.jsx(Xe,{source:o,name:k,title:m,linked:g,state:"failed"}):Y,e[58]=_,e[59]=Y,e[60]=g,e[61]=k,e[62]=o,e[63]=m,e[64]=ee):ee=e[64],ee}const ie=T?"inline-block max-w-[min(100%,30rem)] align-top my-1 me-1":void 0;let B;e[65]!==o?(B=Ce(o),e[65]=o,e[66]=B):B=e[66];let Q;e[67]!==W||e[68]!==T||e[69]!==_||e[70]!==g||e[71]!==k||e[72]!==o||e[73]!==m?(Q=!T&&h.jsx(Xe,{source:o,name:k,title:m,linked:g,state:_?"failed":W?"loading":void 0}),e[67]=W,e[68]=T,e[69]=_,e[70]=g,e[71]=k,e[72]=o,e[73]=m,e[74]=Q):Q=e[74];const ce=L&&!O&&Y;let ne;e[75]!==p||e[76]!==T||e[77]!==O||e[78]!==Y||e[79]!==k||e[80]!==N||e[81]!==j||e[82]!==L?(ne=L&&O&&h.jsx(ve,{variant:"ghost",className:ot("block h-auto max-w-full overflow-hidden rounded-lg bg-muted/10 p-0 cursor-zoom-in",!T&&"hidden"),"aria-label":k,"data-oc-media-gallery":"true",onClick:()=>{const ee=j.current;ee&&p?.onShowPopup&&N?.openGallery(ee,p.onShowPopup).catch(xo)},children:Y}),e[75]=p,e[76]=T,e[77]=O,e[78]=Y,e[79]=k,e[80]=N,e[81]=j,e[82]=L,e[83]=ne):ne=e[83];let re;return e[84]!==le||e[85]!==P||e[86]!==ie||e[87]!==B||e[88]!==Q||e[89]!==ce||e[90]!==ne?(re=h.jsxs("span",{ref:P,className:ie,style:le,"data-oc-media-source":B,children:[Q,ce,ne]}),e[84]=le,e[85]=P,e[86]=ie,e[87]=B,e[88]=Q,e[89]=ce,e[90]=ne,e[91]=re):re=e[91],re}function xo(){}function qn(n,e){const t=z.c(12),r=pe(),s=r?.owner,[i,a]=b.useState(null);let o,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(vo)},l=[],t[0]=o,t[1]=l):(o=t[0],l=t[1]),b.useLayoutEffect(o,l);let c;t[2]!==e||t[3]!==r?.mode||t[4]!==s||t[5]!==n?(c=()=>{if(!n||!s||!e||r?.mode!=="document")return;const f=s.controller.signal;let u=!1;const p=n.split(",").flatMap(ko);return Promise.all(p.map(async g=>{const{source:w,descriptor:M}=g,v=await s.resolve(w);return M?`${v} ${M}`:v})).then(g=>{!u&&!f.aborted&&a({owner:s,signal:f,source:n,value:g.join(", ")})},bo),()=>{u=!0}},t[2]=e,t[3]=r?.mode,t[4]=s,t[5]=n,t[6]=c):c=t[6];const d=r?.mode;let m;return t[7]!==e||t[8]!==s||t[9]!==n||t[10]!==d?(m=[s,d,n,e],t[7]=e,t[8]=s,t[9]=n,t[10]=d,t[11]=m):m=t[11],b.useEffect(c,m),i&&i.owner===s&&!i.signal.aborted&&i.source===n?i.value:void 0}function bo(){}function ko(n){const[e,...t]=n.trim().split(/\s+/);return e?[{source:e,descriptor:t.join(" ")}]:[]}function vo(n){return n?.signal.aborted?null:n}function So(n){const e=z.c(10);let t,r;if(e[0]!==n){const{node:d,children:m,...f}=n;t=m,r=f,e[0]=n,e[1]=t,e[2]=r}else t=e[1],r=e[2];const s=pe()?.mode==="document",{setRef:i,near:a}=Lt(s,!0),o=s?a:null;let l;e[3]!==t||e[4]!==o?(l=h.jsx(At.Provider,{value:o,children:t}),e[3]=t,e[4]=o,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==l?(c=h.jsx("picture",{...r,ref:i,children:l}),e[6]=r,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function Co(n){const e=z.c(13);let t,r,s;if(e[0]!==n){const{node:u,srcSet:p,media:g,...w}=n;s=p,t=g,r=w,e[0]=n,e[1]=t,e[2]=r,e[3]=s}else t=e[1],r=e[2],s=e[3];const i=pe(),a=b.useContext(At),o=i?.documentAssets?.colorScheme;let l;e[4]!==t||e[5]!==o?(l=o?t?.replace(/\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)/gi,(u,p)=>p.toLowerCase()===o?"(min-width: 0px)":"(max-width: -1px)"):t,e[4]=t,e[5]=o,e[6]=l):l=e[6];const c=l,d=fo(i?.mode==="document"?c:void 0),m=qn(s,i?.mode==="document"&&a!==!1&&d);if(i?.mode!=="document")return null;let f;return e[7]!==t||e[8]!==r||e[9]!==m||e[10]!==s||e[11]!==c?(f=h.jsx("source",{...r,srcSet:m,media:c,"data-oc-media-srcset":s,"data-oc-media-query":t}),e[7]=t,e[8]=r,e[9]=m,e[10]=s,e[11]=c,e[12]=f):f=e[12],f}function It(n){const e=Kn(n,n.src),t=pe(),r=t?.owner,s=b.useContext(Be),i=_t(e),{setRef:a,near:o}=Lt(t?.mode==="assistant"&&!i);b.useEffect(()=>i?void 0:r?.register(e),[r,e,i]);const{url:l,fail:c,retry:d}=Hn(e,!!(t&&!i&&!s&&(t.mode!=="assistant"||t.settled&&o)),!0),[m,f]=b.useState(null),u=m?.owner===r&&m?.source===e?m:null,p=b.useMemo(()=>({lastRetry:0,resume:null}),[r,e]),g=b.useRef(p);g.current=p;const w=b.useRef(null),M=n.title||Ue(e),v=i?u?.failed?void 0:u?.url??e:l,x=!!(v&&(i||t?.mode!=="assistant"||u?.ready===v));return!e||Bn(e)?null:s?h.jsx(Xe,{source:e,name:M,linked:!0}):h.jsxs("span",{ref:a,className:"inline-block max-w-full align-top","data-oc-media-source":Ce(e),children:[!x&&h.jsx(Xe,{source:e,name:M,linked:!1}),v&&h.jsx("video",{ref:w,src:v,title:M,controls:!0,playsInline:!0,hidden:!x,preload:i&&t?.mode!=="document"?"none":"metadata",className:n.className,"data-oc-media-source":Ce(e),onLoadedMetadata:k=>{f({owner:r,source:e,url:u?.url,ready:v});const S=p.resume;S&&(k.currentTarget.currentTime=S.time,S.playing&&k.currentTarget.play().catch(()=>{}),p.resume=null),n.onLoadedMetadata?.(k)},onError:k=>{if(i){const C=Ne(),y=new URL(e,window.location.href),j=new URL(C.api("/api/fs/raw"),window.location.href);if(!(y.origin===j.origin&&y.pathname===j.pathname&&y.searchParams.has("oc_url_token"))||Date.now()-p.lastRetry<1e4){f({owner:r,source:e,failed:!0});return}p.lastRetry=Date.now(),p.resume={time:k.currentTarget.currentTime,playing:!k.currentTarget.paused};const I=r?.controller.signal;y.searchParams.delete("oc_url_token"),xt().then(()=>{I?.aborted||g.current!==p||C!==Ne()||f({owner:r,source:e,url:C.authenticatedAsset("/api/fs/raw",y.searchParams)})},()=>{!I?.aborted&&g.current===p&&f({owner:r,source:e,failed:!0})});return}if(Date.now()-p.lastRetry<1e4){c();return}p.lastRetry=Date.now(),p.resume={time:k.currentTarget.currentTime,playing:!k.currentTarget.paused};const S=r?.controller.signal;d().then(()=>{!S?.aborted&&g.current===p&&w.current?.load()},()=>{!S?.aborted&&g.current===p&&c()})}})]})}function Mo(n){const e=z.c(32);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=new Map,e[4]=i):i=e[4];const[a,o]=b.useState(i);let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(R,N)=>{o(O=>{if(O.get(R)===N||!N&&!O.has(R))return O;const E=new Map(O);return N?E.set(R,N):E.delete(R),E})},e[5]=l):l=e[5];const c=l,d=r?.children.filter(No),m=d?.length===1?d[0]:void 0,f=m?.type==="element"&&m.tagName==="a"?m.properties.href:void 0,u=m?.type==="element"&&m.children.length===1&&m.children[0]?.type==="text"?m.children[0].value:"",p=d?.length??0,g=p>1&&d?.every(Ro),w=pe()?.mode,M=!!(w==="assistant"&&g&&a.size===p);let v;e[6]!==M?(v={report:c,ready:M},e[6]=M,e[7]=v):v=e[7];const x=v;if(w==="document"&&u&&u===f&&kn(u)){let R;e[8]!==u?(R=h.jsx(It,{src:u}),e[8]=u,e[9]=R):R=e[9];let N;return e[10]!==s||e[11]!==R?(N=h.jsx("p",{...s,"data-streamdown":"paragraph",children:R}),e[10]=s,e[11]=R,e[12]=N):N=e[12],N}let k,S;e[13]!==a?(k=[...a.values()],S=k.reduce(Eo,0),e[13]=a,e[14]=k,e[15]=S):(k=e[14],S=e[15]);const C=S;let y;if(e[16]!==p||e[17]!==k||e[18]!==s.style||e[19]!==C||e[20]!==M){if(y={...s.style},M){y.display="flex",y.flexWrap="wrap",y.alignItems="flex-start",y.gap="0.5rem";let R;e[22]!==k?(R=k.map(jo),e[22]=k,e[23]=R):R=e[23],y.maxWidth=`calc(min(30rem, ${Math.min(...R)}px) * ${C} + ${(p-1)*.5}rem)`}e[16]=p,e[17]=k,e[18]=s.style,e[19]=C,e[20]=M,e[21]=y}else y=e[21];const j=M?"true":void 0;let P;e[24]!==t||e[25]!==y||e[26]!==s||e[27]!==j?(P=h.jsx("p",{...s,"data-streamdown":"paragraph","data-oc-media-row":j,style:y,children:t}),e[24]=t,e[25]=y,e[26]=s,e[27]=j,e[28]=P):P=e[28];let I;return e[29]!==P||e[30]!==x?(I=h.jsx(Vn.Provider,{value:x,children:P}),e[29]=P,e[30]=x,e[31]=I):I=e[31],I}function jo(n){return n.height}function Eo(n,e){return n+e.width/e.height}function Ro(n){return n.type==="element"&&n.tagName==="img"}function No(n){return n.type!=="text"||n.value.trim()}const Po=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Qt=Array.from(Po).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),_o=n=>Rt(n),Gn=n=>{let e;try{e=new URL(n.trim())}catch{return null}if(e.protocol!=="file:"||e.hostname&&e.hostname!=="localhost")return null;try{const t=decodeURIComponent(e.pathname);return/^\/[A-Za-z]:\//.test(t)?t.slice(1):t.startsWith("/")?t:null}catch{return null}},dt=n=>{let e=(n||"").trim();return e?((e.startsWith("`")&&e.endsWith("`")||e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e=e.replace(/[.,;!?]+$/g,""),e.endsWith(")")&&!e.includes("(")&&(e=e.slice(0,-1)),e.endsWith("]")&&!e.includes("[")&&(e=e.slice(0,-1)),e):""},nt=n=>{let e=dt(n);if(!e)return"";const t=e.indexOf(";");t>=0&&(e=e.slice(0,t)),e=e.replace(/#.*$/,"");const r=e.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);r&&(e=r[1]??e);const s=Qt.length>0?e.match(new RegExp(`^(.*(?:/|^)(${Qt})):.*$`,"i")):null;return s&&(e=s[1]??e),dt(e)},Lo=n=>{const e=dt(n);if(!e)return null;const t=e.indexOf(";"),r=t>=0?dt(e.slice(0,t)):e;if(!r)return null;const s=r.match(/^(.*?):(\d+)-(\d+)$/);if(s){const l=nt(s[1]??""),c=Number.parseInt(s[2]??"",10),d=Number.parseInt(s[3]??"",10);return!l||!Number.isFinite(c)||!Number.isFinite(d)||d<c?null:{path:l,line:c,endLine:d}}const i=r.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(i){const l=nt(i[1]??""),c=Number.parseInt(i[2]??"",10),d=i[3]?Number.parseInt(i[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const a=r.match(/^(.*?):(\d+)(?::(\d+))?$/);if(a){const l=nt(a[1]??""),c=Number.parseInt(a[2]??"",10),d=a[3]?Number.parseInt(a[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const o=nt(r);return o?{path:o}:null},Ao=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,Io=4,To=1e3,$o=200,Me=new Map;let rt=0;const en=[],Oo=()=>Se()?$o:To,Xn=(n,e)=>`${n}\0${e}`,Do=(n,e)=>{const t=Rt(n,{preserveWhitespace:!0});if(!t)return Promise.resolve(!1);const r=Xn(e,t),s=Me.get(r);if(s)return Me.delete(r),Me.set(r,s),s;const i=new Promise(o=>{const l=()=>{rt+=1,ft(`/api/fs/stat?path=${encodeURIComponent(t)}&optional=true`,{method:"GET",cache:"no-store",headers:e?{"x-opencode-directory":e}:void 0}).then(async c=>{if(!c.ok){o(!1);return}const d=await c.json().catch(()=>null);o(d?.exists!==!1)}).catch(()=>o(!1)).finally(()=>{rt=Math.max(0,rt-1),en.shift()?.()})};if(rt<Io){l();return}en.push(l)}),a=Oo();for(;Me.size>=a;){const o=Me.keys().next().value;if(typeof o!="string")break;Me.delete(o)}return Me.set(r,i),i},Fo=_n({exists:Ys().optional()}),zo=async(n,e)=>{const t=new URLSearchParams({path:Rt(n,{preserveWhitespace:!0}),optional:"true"});jt(n,e)||t.set("allowOutsideWorkspace","true");try{const r=await ft(`/api/fs/stat?${t.toString()}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}});if(!r.ok)return"failed";const s=Fo.safeParse(await r.json().catch(()=>null));return s.success?s.data.exists===!1?"missing":"exists":"failed"}catch{return"failed"}},Wo=_n({paths:Zs(Pn())}),qe=new Map,Uo=200,Zn=(n,e)=>ft(`/api/fs/find-by-name?name=${encodeURIComponent(n)}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}}).then(async t=>{if(!t.ok)return null;const r=Wo.safeParse(await t.json().catch(()=>null));return r.success?r.data.paths:null}).catch(()=>null),Bo=(n,e)=>{if(!n||!e||Se())return Promise.resolve(null);const t=Xn(e,n),r=qe.get(t);if(r)return r;const s=Zn(n,e).then(i=>i?.length===1?i[0]:null);for(;qe.size>=Uo;){const i=qe.keys().next();if(i.done)break;qe.delete(i.value)}return qe.set(t,s),s};function De(n,e){if("key"in n&&n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),n.stopPropagation(),!("key"in n)&&Ar(n.currentTarget.closest("[data-markdown-content]"))))return;const t=/Mac|iPhone|iPad/.test(navigator.platform);e(t?n.metaKey:n.ctrlKey)}const tn=new Sn({maxEntries:64,maxBytes:1024*1024});function mt(){const n=z.c(5),{directory:e}=oe(),t=b.useContext(vn),r=t?.editor,s=t?.runtime.isVSCode,i=Lr();let a;return n[0]!==e||n[1]!==r||n[2]!==s||n[3]!==i?(a=async(o,l,c,d)=>{const m=c===void 0?!1:c,u=_e(o,e,"click",d===void 0?"path":d);if(!u)return;const p=l??u.resolvedPath;if(m&&Bs()&&await Ks(p))return;if(s&&r){r.openFile(p,u.line,u.column);return}const g=fe.getState();u.line?g.openContextFileAtLine(e,p,u.line,u.column??1):g.openContextFile(e,p),i?.openFiles()},n[0]=e,n[1]=r,n[2]=s,n[3]=i,n[4]=a):a=n[4],a}function Ko(){const n=z.c(5),{directory:e}=oe(),t=mt(),r=b.useRef(!1);let s,i;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>(r.current=!0,()=>{r.current=!1}),i=[],n[0]=s,n[1]=i):(s=n[0],i=n[1]),b.useEffect(s,i);let a;return n[2]!==e||n[3]!==t?(a=async o=>{const l=_e(o,e);if(!l)return;const c=ue(),d=await zo(l.resolvedPath,e),m=d==="missing"&&!/[\\/]/.test(l.path)?await Zn(l.path,e):[];!r.current||ue()!==c||(d==="failed"||!m||m.length>1?Zt(l.resolvedPath,{reason:"unreadable",message:null}):d==="missing"&&m.length===0?Zt(l.resolvedPath,{reason:"missing"}):await t(o,m[0]??l.resolvedPath))},n[2]=e,n[3]=t,n[4]=a):a=n[4],a}function Vo(){const n=z.c(5),e=b.useContext(vn),{t}=ge(),r=e?.files,s=e?.runtime.platform;let i;e:{let a;n[0]!==r?(a=r?.revealPath?.bind(r),n[0]=r,n[1]=a):a=n[1];const o=a;if(!o||!s||s==="vscode"||Us(s)){i=null;break e}let l;n[2]!==o||n[3]!==t?(l=c=>{o(c).catch(()=>{yt.error(t("sidebarFilesTree.toast.revealFailed"))})},n[2]=o,n[3]=t,n[4]=l):l=n[4],i=l}return i}const Ho=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),qo=(n,e,t)=>{if(!n||!t&&(n.startsWith("--")||n.includes("://")||/[<>]/.test(n)||/\s{2,}/.test(n))||!t&&e==="probe"&&n.includes("@")&&!n.includes("/"))return!1;const s=_o(n).split("/").filter(Boolean).pop()??"";if(!s||s==="."||s==="..")return!1;const i=s.toLowerCase();return Ho.has(i)||i.startsWith(".")&&i.length>1?!0:s.endsWith(".")?!1:e==="click"?/\.[A-Za-z0-9_-]{1,16}$/.test(s):/\.[A-Za-z][A-Za-z0-9_-]{0,15}$/.test(s)};function _e(n,e,t="probe",r="path"){const s=/^\s*file:/i.test(n),i=Lo(s?Gn(n)??n:n),a=r==="href"&&!s;if(i&&a){if(i.path.startsWith("//")||/^[A-Za-z][A-Za-z\d+.-]*:/.test(i.path)&&!/^[A-Za-z]:[\\/]/.test(i.path))return null;try{i.path=decodeURIComponent(i.path)}catch{}}if(!i||!e||!qo(i.path,t,a))return null;const o=_r(e,i.path,{preserveWhitespace:a});return o?{...i,resolvedPath:o}:null}async function Yn(n,e,t="path"){const r=_e(n,e,"probe",t);return r?!jt(r.resolvedPath,e)||await Do(r.resolvedPath,e)?r.resolvedPath:/[\\/]/.test(r.path)?null:Bo(r.path,e):null}async function Go(n,e,t,r=s=>Yn(s,e)){if(n.length>2e5)return[];let s=tn.get(n);if(!s){s=Array.from(n.matchAll(Ao),l=>({raw:l[0],start:l.index}));const o=n.length*2+s.reduce((l,c)=>l+c.raw.length*2+32,0);o<=1024*1024&&tn.set(n,s,o)}const i=s.filter(o=>_e(o.raw,e)).slice(0,t);return(await Promise.all(i.map(async o=>{const l=await r(o.raw);return l?{start:o.start,end:o.start+o.raw.length,raw:o.raw,path:l}:null}))).filter(o=>o!==null)}const Xo=n=>{const e=Hs.getState().ordered;return Or(Dr.getState().ordered)(n)||Fr(e,zr.getState().identities).match(n)?!0:Wr(n,e)!==null},Jn=(n,e,t,r)=>{const s=Cn.getState().guests.find(a=>a.id===n.guestId);if(!s||!Ir(s,"links"))return!1;if(n.action==="attach")return n.url?(Tr.getState().setPendingGuestIssue(Vs({providerId:s.id,id:n.identifier,title:n.identifier,url:n.url})),!0):!1;if(!Mn(s))return e==="link"?!1:(yt.info(r("chat.chatInput.toast.guestNotOnPhone",{name:s.name})),!0);const i=n.url?{kind:"link",identifier:n.identifier,url:n.url}:{kind:"link",identifier:n.identifier};return $r(s,i,t)?!0:e==="link"?!1:(yt.info(r("chat.guestLink.noProject",{name:s.name})),!0)};function Qn(n,e){const t=z.c(8),r=e===void 0?"path":e,{directory:s,fileReferences:i,confirmFile:a}=oe();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=ue(),t[0]=o):o=t[0];const l=o,[c,d]=b.useState(null);let m,f;return t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==n?(m=()=>{if(!i)return;let u=!0;return a(n,r).then(p=>{u&&l===ue()&&d(p?{raw:n,inputKind:r,directory:s,runtimeKey:l,path:p}:null)}),()=>{u=!1}},f=[n,r,s,i,l,a],t[1]=a,t[2]=s,t[3]=i,t[4]=r,t[5]=n,t[6]=m,t[7]=f):(m=t[6],f=t[7]),b.useEffect(m,f),i&&c?.raw===n&&c.inputKind===r&&c.directory===s&&c.runtimeKey===l?c.path:null}const Zo=32;function Yo(n){const e=z.c(24);let t,r,s;e[0]!==n?({children:r,node:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]!==t?.children?(i=t?.children.map(Jo).join("")??"",e[4]=t?.children,e[5]=i):i=e[5];const a=i,o=Qn(a),l=mt(),c=Ko(),{directory:d,fileNavigation:m,fileReferences:f}=oe();let u;e[6]!==l||e[7]!==o||e[8]!==a?(u=R=>{o&&De(R,N=>{l(a,o,N)})},e[6]=l,e[7]=o,e[8]=a,e[9]=u):u=e[9];const p=u,g=m&&!f&&_e(a,d)!==null;let w;e[10]!==c||e[11]!==a?(w=R=>{R.currentTarget.closest('a, button, [role="button"], summary')||De(R,()=>{c(a)})},e[10]=c,e[11]=a,e[12]=w):w=e[12];const M=w,v=a.length>0&&a.length<=Zo?"":void 0,x=o?"true":void 0,k=o?a:void 0,S=o??void 0,C=o?"button":void 0,y=o?0:void 0,j=o?p:g?M:void 0,P=o?p:void 0;let I;return e[13]!==r||e[14]!==s||e[15]!==j||e[16]!==P||e[17]!==v||e[18]!==x||e[19]!==k||e[20]!==S||e[21]!==C||e[22]!==y?(I=h.jsx("code",{...s,dir:"ltr","data-streamdown":"inline-code","data-short":v,"data-openchamber-file-link":x,"data-openchamber-file-ref":k,"data-openchamber-file-path":S,role:C,tabIndex:y,onClick:j,onKeyDown:P,children:r}),e[13]=r,e[14]=s,e[15]=j,e[16]=P,e[17]=v,e[18]=x,e[19]=k,e[20]=S,e[21]=C,e[22]=y,e[23]=I):I=e[23],I}function Jo(n){return n.type==="text"?n.value:""}function Qo(n){const e=z.c(10),{purpose:t}=oe();if(t){let s,i;if(e[0]!==n){const{node:l,children:c,...d}=n;s=c,i=d,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];let a;e[3]!==s?(a=h.jsx(Be.Provider,{value:!0,children:s}),e[3]=s,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=h.jsx("a",{...i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o}let r;return e[8]!==n?(r=h.jsx(na,{...n}),e[8]=n,e[9]=r):r=e[9],r}function ea(n){const e=z.c(3),{src:t}=n,[r,s]=b.useState(!1);if(r)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(!0),e[0]=i):i=e[0];let a;return e[1]!==t?(a=h.jsx("span",{"data-message-image-export-exclude":"true",className:"me-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle",children:h.jsx("img",{src:t,alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",className:"size-3.5 rounded-sm",onError:i})}),e[1]=t,e[2]=a):a=e[2],a}const er=n=>{if(!n)return"";let e="";const t=r=>{r.type==="text"?e+=r.value:r.type==="element"&&r.children.forEach(t)};return n.children.forEach(t),e.trim()},nn=n=>n.metaKey||n.ctrlKey||n.shiftKey||n.altKey;function ta(n){const e=z.c(25),{identifier:t,className:r,children:s}=n,{guestLinks:i,directory:a}=oe(),{t:o}=ge();let l;e[0]!==i||e[1]!==t?(l=i?bn(i,t):null,e[0]=i,e[1]=t,e[2]=l):l=e[2];const c=l;let d;e[3]!==c?(d=S=>c?S.guests.find(C=>C.id===c.guestId):void 0,e[3]=c,e[4]=d):d=e[4];const m=Cn(d),f=m?.name,u=Et(a);if(!c||!m||!f){let S;return e[5]!==s?(S=h.jsx(h.Fragment,{children:s}),e[5]=s,e[6]=S):S=e[6],S}const p=c.action==="open"&&!Mn(m)?c.url:void 0;let g;e[7]!==c||e[8]!==a||e[9]!==u||e[10]!==p||e[11]!==o?(g=S=>{"key"in S&&S.key!=="Enter"&&S.key!==" "||(S.preventDefault(),S.stopPropagation(),p?u(p):Jn(c,"identifier",a,o))},e[7]=c,e[8]=a,e[9]=u,e[10]=p,e[11]=o,e[12]=g):g=e[12];const w=g;let M;e[13]!==c.action||e[14]!==t||e[15]!==f||e[16]!==p||e[17]!==o?(M=p||(c.action==="open"?o("chat.guestLink.open",{identifier:t,name:f}):o("chat.guestLink.attach",{identifier:t,name:f})),e[13]=c.action,e[14]=t,e[15]=f,e[16]=p,e[17]=o,e[18]=M):M=e[18];const v=M,x=r?`${r} cursor-pointer`:"cursor-pointer";let k;return e[19]!==w||e[20]!==s||e[21]!==c.guestId||e[22]!==v||e[23]!==x?(k=h.jsx("a",{role:"button",tabIndex:0,className:x,"data-oc-guest-link":c.guestId,title:v,"aria-label":v,onClick:w,onKeyDown:w,children:s}),e[19]=w,e[20]=s,e[21]=c.guestId,e[22]=v,e[23]=x,e[24]=k):k=e[24],k}function na(n){const e=z.c(23);let t,r,s,i;if(e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]),r?.properties.dataOcGuestLink!==void 0){let o;e[5]!==r?(o=er(r),e[5]=r,e[6]=o):o=e[6];let l;return e[7]!==s||e[8]!==i.className||e[9]!==o?(l=h.jsx(ta,{identifier:o,className:i.className,children:s}),e[7]=s,e[8]=i.className,e[9]=o,e[10]=l):l=e[10],l}if(!t){let o;if(e[11]!==i){const{target:d,rel:m,...f}=i;o=f,e[11]=i,e[12]=o}else o=e[12];let l;e[13]!==s?(l=h.jsx(Be.Provider,{value:!0,children:s}),e[13]=s,e[14]=l):l=e[14];let c;return e[15]!==o||e[16]!==l?(c=h.jsx("a",{...o,children:l}),e[15]=o,e[16]=l,e[17]=c):c=e[17],c}let a;return e[18]!==t||e[19]!==r||e[20]!==s||e[21]!==i?(a=h.jsx(ra,{href:t,node:r,...i,children:s}),e[18]=t,e[19]=r,e[20]=s,e[21]=i,e[22]=a):a=e[22],a}function ra(n){const e=z.c(120);let t,r,s,i;e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]);let a;e[5]!==s?(a=h.jsx(Be.Provider,{value:!0,children:s}),e[5]=s,e[6]=a):a=e[6];const o=a,l=oe(),{directory:c}=l,{t:d}=ge(),m=Et(c),f=mt(),u=pe(),p=fe(ia);let g;e[7]!==r?(g=er(r),e[7]=r,e[8]=g):g=e[8];const w=g;let M;e[9]!==t?(M=Ur(t),e[9]=t,e[10]=M):M=e[10];const v=M,x=Br(t);let k;e[11]!==t?(k=Kr(t),e[11]=t,e[12]=k):k=e[12];const S=k,C=Se()?null:Vr(t,Hr());let y;e[13]!==t?(y=Se()?null:On(t),e[13]=t,e[14]=y):y=e[14];const j=y,P=b.useContext(qr),I=C?P.get(Gr(C)):void 0,R=b.useContext(Xr);let N;e[15]!==t||e[16]!==R?(N=R.get(t),e[15]=t,e[16]=R,e[17]=N):N=e[17];const O=N;let E;e[18]!==t?(E=xn(t),e[18]=t,e[19]=E):E=e[19];const A=E;let W;e[20]!==c||e[21]!==t||e[22]!==l.fileNavigation?(W=l.fileNavigation&&_e(t,c,"click","href"),e[20]=c,e[21]=t,e[22]=l.fileNavigation,e[23]=W):W=e[23];const L=W,_=Vo();let U;e[24]!==L||e[25]!==t||e[26]!==l.fileNavigation||e[27]!==_?(U=l.fileNavigation&&!L&&_?Gn(t):null,e[24]=L,e[25]=t,e[26]=l.fileNavigation,e[27]=_,e[28]=U):U=e[28];const K=U,Z=!!(L||K||A||C||v||x||S),J=Z?t:w,T=Qn(J,Z?"href":"path"),D=!!(T&&!Z);let G;e[29]!==t?(G=Zr(t),e[29]=t,e[30]=G):G=e[30];const V=G,q=r?.properties.dataOcReference!==void 0;let F;e[31]!==V||e[32]!==t||e[33]!==T||e[34]!==q?(F=V&&!T&&!q?Yr(t):null,e[31]=V,e[32]=t,e[33]=T,e[34]=q,e[35]=F):F=e[35];const H=F;let Y;e[36]!==c||e[37]!==t||e[38]!==p||e[39]!==l.loopbackPreview?(Y=l.loopbackPreview&&Jr(t)&&c&&!(qs()&&p),e[36]=c,e[37]=t,e[38]=p,e[39]=l.loopbackPreview,e[40]=Y):Y=e[40];const X=Y,te=l.guestLinks&&V&&!C&&!A&&!L&&!K&&!D&&!v&&!x&&!S&&!j?Qr(l.guestLinks,t):null;let le;e[41]!==A||e[42]!==c||e[43]!==V||e[44]!==L||e[45]!==K||e[46]!==te||e[47]!==t||e[48]!==u||e[49]!==m||e[50]!==f||e[51]!==T||e[52]!==l.disableLinkSafety||e[53]!==_||e[54]!==C||e[55]!==v||e[56]!==d||e[57]!==w||e[58]!==D?(le=$=>{if(!(u?.documentAssets&&ti($,u.documentAssets))){if(D&&T){De($,ae=>{f(w,T,ae)});return}if(C&&(!V||!($.metaKey||$.ctrlKey||$.shiftKey||$.altKey))){$.preventDefault(),rs(C.sessionId,C.messageId);return}if(A){$.preventDefault(),$.stopPropagation(),Wt(t);return}if(!v){if(L){De($,ae=>{f(t,T??void 0,ae,"href")});return}if(K&&_){De($,()=>_(K));return}if(t.startsWith("#")&&!u?.documentAssets){$.preventDefault();const ae=decodeURIComponent(t.slice(1)),de=$.currentTarget.closest("[data-markdown-content]");(de?Array.from(de.querySelectorAll("[id]")).find(Ve=>Ve.id===ae):null)?.scrollIntoView({block:"nearest"});return}if(te&&!nn($)&&!Xo(t)&&Jn(te,"link",c,d)){$.preventDefault(),$.stopPropagation();return}V&&!l.disableLinkSafety&&!nn($)&&($.preventDefault(),$.stopPropagation(),m(t))}}},e[41]=A,e[42]=c,e[43]=V,e[44]=L,e[45]=K,e[46]=te,e[47]=t,e[48]=u,e[49]=m,e[50]=f,e[51]=T,e[52]=l.disableLinkSafety,e[53]=_,e[54]=C,e[55]=v,e[56]=d,e[57]=w,e[58]=D,e[59]=le):le=e[59];const ie=le;if(S){const $=S.openable?Ft:es,ae=S.openable?S.filename:void 0,de=S.openable?"button":void 0,Ye=S.openable?0:void 0,Ve=`#${S.iconId}`;let Ae;e[60]!==Ve?(Ae=h.jsx("svg",{className:"size-[1.1em] shrink-0","aria-hidden":"true",children:h.jsx("use",{href:Ve})}),e[60]=Ve,e[61]=Ae):Ae=e[61];let Ie;e[62]!==S.filename?(Ie=h.jsx("span",{className:zt,children:S.filename}),e[62]=S.filename,e[63]=Ie):Ie=e[63];let Je;return e[64]!==S.filename||e[65]!==S.iconId||e[66]!==$||e[67]!==ae||e[68]!==de||e[69]!==Ye||e[70]!==Ae||e[71]!==Ie?(Je=h.jsxs("span",{className:$,"data-attachment-citation":S.iconId,"data-attachment-open":ae,role:de,tabIndex:Ye,title:S.filename,children:[Ae,Ie]}),e[64]=S.filename,e[65]=S.iconId,e[66]=$,e[67]=ae,e[68]=de,e[69]=Ye,e[70]=Ae,e[71]=Ie,e[72]=Je):Je=e[72],Je}if(j){let $;e[73]!==j.kind||e[74]!==j.source?($=()=>si({source:j.source,confirmed:j.kind==="path"}),e[73]=j.kind,e[74]=j.source,e[75]=$):$=e[75];let ae;e[76]===Symbol.for("react.memo_cache_sentinel")?(ae=h.jsx(he,{name:"download",className:"size-4"}),e[76]=ae):ae=e[76];let de;return e[77]!==o||e[78]!==$?(de=h.jsxs(ve,{type:"button",variant:"outline",size:"sm",className:"my-1 align-middle",onClick:$,children:[ae,o]}),e[77]=o,e[78]=$,e[79]=de):de=e[79],de}if(C&&I){let $;return e[80]!==I||e[81]!==C?($=h.jsx(ss,{chip:I,target:C}),e[80]=I,e[81]=C,e[82]=$):$=e[82],$}if(O){let $;return e[83]!==O.chip||e[84]!==O.url?($=h.jsx(ts,{chip:O.chip,url:O.url}),e[83]=O.chip,e[84]=O.url,e[85]=$):$=e[85],$}if(x)return h.jsx("a",{"data-openchamber-agent-mention":"true",className:"text-primary hover:underline",href:ns(x),target:"_blank",rel:"noopener noreferrer",children:o});let B;e[86]!==H?(B=H&&h.jsx(ea,{src:H}),e[86]=H,e[87]=B):B=e[87];const Q=w===t?"ltr":i.dir,ce=v?Ft:i.className,ne=v??void 0,re=v?`$${v}`:i.title,ee=T?"true":void 0,me=T?J:void 0,Ze=T??void 0;let we;e[88]!==A||e[89]!==t?(we=$=>{A&&($.preventDefault(),$.button===1&&Wt(t))},e[88]=A,e[89]=t,e[90]=we):we=e[90];const Ke=A?sa:void 0;let ye;e[91]!==v?(ye=v&&h.jsx(he,{name:"book-open",className:"size-[1.1em] shrink-0"}),e[91]=v,e[92]=ye):ye=e[92];let xe;e[93]!==o||e[94]!==v?(xe=v?h.jsx("span",{className:zt,children:v}):o,e[93]=o,e[94]=v,e[95]=xe):xe=e[95];let be;e[96]!==ie||e[97]!==t||e[98]!==i||e[99]!==Q||e[100]!==ce||e[101]!==ne||e[102]!==re||e[103]!==ee||e[104]!==me||e[105]!==Ze||e[106]!==we||e[107]!==Ke||e[108]!==ye||e[109]!==xe?(be=h.jsxs("a",{...i,href:t,target:"_blank",rel:"noopener noreferrer",dir:Q,className:ce,"data-skill-name":ne,title:re,"data-openchamber-file-link":ee,"data-openchamber-file-ref":me,"data-openchamber-file-path":Ze,onClick:ie,onAuxClick:we,onDragStart:Ke,children:[ye,xe]}),e[96]=ie,e[97]=t,e[98]=i,e[99]=Q,e[100]=ce,e[101]=ne,e[102]=re,e[103]=ee,e[104]=me,e[105]=Ze,e[106]=we,e[107]=Ke,e[108]=ye,e[109]=xe,e[110]=be):be=e[110];let ke;e[111]!==c||e[112]!==t||e[113]!==X||e[114]!==d?(ke=X&&h.jsx(Oe,{label:d("terminalView.preview.openTitle"),children:h.jsx(ve,{variant:"ghost",size:"xs",className:"ms-1 align-middle","data-export-ignore":!0,"aria-label":d("terminalView.preview.open"),onClick:()=>fe.getState().openContextPreview(c,t),children:h.jsx(he,{name:"global",className:"size-3.5"})})}),e[111]=c,e[112]=t,e[113]=X,e[114]=d,e[115]=ke):ke=e[115];let Le;return e[116]!==B||e[117]!==be||e[118]!==ke?(Le=h.jsxs(h.Fragment,{children:[B,be,ke]}),e[116]=B,e[117]=be,e[118]=ke,e[119]=Le):Le=e[119],Le}function sa(n){return n.preventDefault()}function ia(n){return n.openLinksInBrowserPanel}const oa=()=>Nt(()=>import("./MarkdownDiffPreview-CcER_eYB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200])).then(n=>n.default),aa=()=>{};function la(n){const e=z.c(7),{source:t,incomplete:r}=n;let s;e[0]!==r||e[1]!==t?(s=!r&&!is(t),e[0]=r,e[1]=t,e[2]=s):s=e[2];const i=s,a=os(i,oa,aa);let o;return e[3]!==a||e[4]!==i||e[5]!==t?(o=h.jsx("div",{"data-streamdown":"code-block-body","data-language":"diff",children:i&&a?h.jsx(a,{source:t}):h.jsx(as,{diff:t})}),e[3]=a,e[4]=i,e[5]=t,e[6]=o):o=e[6],o}const ca=b.memo(function(e){const t=z.c(5),{tokens:r}=e,s=r.length===0||r.length===1&&r[0].content==="";let i;t[0]!==s||t[1]!==r?(i=s?`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownDiffPreview-BRsvVmm6.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-BkjZnJsc.js","assets/katex.min-BRXXWH9j.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-B_hXR7jf.js","assets/vendor-opencode-client-NJGkA1Ku.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-DKWxHuRR.css","assets/vendor-base-ui-CHqK1aDI.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-Bw3q1rnq.js","assets/vendor-tanstack-virtual-core-B4TJYmIq.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-ClBHCVu_.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-iLtL-MFj.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/ToolPartDiffPreview-B2wDDrfp.js","assets/PatchDiff-CbSen5Gt.js","assets/parseDiffFromFile-BSeCTEcW.js","assets/computeVirtualFileMetrics-oAeWRt0Z.js","assets/themeResolver-Dybtoo13.js","assets/vendor-pierre-theming-D_TRfu0q.js","assets/hastToHtml-BHV14OWE.js","assets/vendor-hast-util-to-html-Jw3IXh58.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-diff-C3JhlQdm.js","assets/useNextRenderData-CVFf78p9.js","assets/isDiffPlainText-CBdbdXoZ.js","assets/getFiletypeFromFileName-BgI9McTw.js","assets/pierreDiffTint-BKAarfyR.js","assets/appThemeRegistry-3vWr61EA.js","assets/textMateThemeFromAppTheme-OzgrN6CB.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/editorCodeMetrics-CkrWYimB.js","assets/ReplyCommand-B-b5HiGJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{R as b,f as z,j as h,a as mr}from"./vendor-react--VO_rL_p.js";import{iG as xn,iH as hr,iI as Mt,iJ as pr,iK as gr,iL as wr,iM as yr,iN as xr,iO as br,iP as bn,iQ as kr,bB as jt,iR as vr,iS as Sr,iT as Cr,iU as Mr,iV as jr,iW as Dt,iX as Er,iY as kn,iZ as Ue,i_ as Ce,i$ as Rr,u as ge,j0 as Et,j1 as Nr,a3 as ot,B as ve,z as Pr,I as he,j2 as Rt,bk as _r,j3 as vn,j4 as Lr,j5 as Sn,A as yt,j6 as Ar,bl as Cn,j7 as Ir,eQ as Tr,j8 as Mn,j9 as $r,ja as Or,jb as Dr,jc as Fr,cp as zr,jd as Wr,je as Ur,jf as Br,jg as Kr,jh as Vr,ji as Hr,jj as qr,jk as Gr,jl as Xr,jm as Zr,jn as Yr,jo as Jr,jp as Qr,jq as Ft,jr as es,js as zt,jt as ts,ju as ns,c6 as Oe,b9 as rs,jv as Wt,jw as ss,jx as is,jy as os,ap as as,jz as ls,jA as cs,ez as ds,aS as jn,jB as us,jC as fs,jD as ms,b8 as ut,a6 as Ut,a7 as Bt,a8 as Kt,a9 as Vt,n as hs,dx as He,jE as ps,V as gs,jF as Ht,jG as ws,jH as ys,jI as Te,jJ as xs,jK as bs,X as ks,jL as vs,jM as Ss,bL as En,an as Cs,ao as Ms,dj as js,jN as Es,jO as Rs,jP as Ns,jQ as Ps,jR as _s,jS as Ls,ak as As}from"./useAppFontEffects-BkjZnJsc.js";import{o as qt,X as at,j as Is,w as We,D as Ts,I as $s,k as Os,W as Ds,L as Rn,U as Fs}from"./vendor-streamdown-BbSYZ3NF.js";import{ch as zs,b3 as ue,bn as Ne,m as Se,bk as xt,j as ft,bf as Nn,ci as Ws,cj as Us,b7 as Bs,ck as Ks,u as fe,cl as Vs,cm as Hs,bG as qs,cn as Gs}from"./katex.min-BRXXWH9j.js";import{B as lt}from"./vendor-streamdown-cjk-CeadmtR2.js";import{g as Xs}from"./vendor-streamdown-math-SFa9Faw2.js";import{s as Pn,o as _n,c as Zs,f as Ys}from"./vendor-zod-B_hXR7jf.js";import{a as Js}from"./vendor-markdown-BTUqNk6W.js";import{i as Qs,r as ei,o as ti,M as Ln,b as ni,B as Gt,a as Xt,c as ri}from"./useMarkdownLocalAssets-Cqxh_vbH.js";import{r as si}from"./install-request-e6fA_Hb1.js";import{t as Zt}from"./contextFileOpenGuard-BTdwRRDI.js";import{_ as Nt}from"./vendor-vite-runtime-DD1OZmLC.js";import{l as ii,s as oi,C as ai}from"./columnWidthMemory-CaG5_n8B.js";import{r as li,a as ci}from"./vendor-beautiful-mermaid-BFZosqFp.js";import{b as An}from"./vendor-shiki-BBVtYVEV.js";import{a as di}from"./textMateThemeFromAppTheme-OzgrN6CB.js";import{p as ui,i as fi,a as bt,b as mi,s as In}from"./vendor-yaml-CE-D_49-.js";const Tn=["note","tip","important","warning","caution"],$n=n=>Tn.find(e=>e===n)??null,hi=/^\[!(note|tip|important|warning|caution)\][\t ]*(?:\r?\n|$)/i;function pi(n){const e=n.children[0];if(e?.type!=="paragraph")return;const t=e.children[0];if(t?.type!=="text")return;const r=hi.exec(t.value),s=$n(r?.[1].toLowerCase());if(!r||!s)return;t.value=t.value.slice(r[0].length),t.value||e.children.shift(),e.children[0]?.type==="break"&&e.children.shift(),e.children.length===0&&n.children.shift(),n.data={...n.data,hProperties:{...n.data?.hProperties,dataOcAlert:s}}}function gi(){return n=>{const e=t=>{if(t.type==="blockquote"&&pi(t),"children"in t)for(const r of t.children)e(r)};e(n)}}function wi(n){return n.type==="root"}const yi=/^ {0,3}<details(?:\s+(open(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?))?\s*>\s*<summary\s*>([\s\S]*?)<\/summary\s*>/i;function Qe(n,e,t){const r=e.slice(0,t).split(/\r\n|\r|\n/),s=r.length-1,i=r[r.length-1].length;function a(o){if(o.position)for(const l of[o.position.start,o.position.end])l&&(l.line===1&&(l.column+=i),l.line+=s,l.offset!==void 0&&(l.offset+=t));if("children"in o)for(const l of o.children)a(l)}a(n)}const xi=/^(\s*<h([1-6])(?:\s+[^\s"'<>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'<>=]+))?)*\s*>)([\s\S]*?)<\/h\2\s*>\s*$/i,bi=[1,2,3,4,5,6];function ki(n,e){const t=/(^ {0,3}(`{3,}|~{3,})[^\n]*(?:\n|$))|(`+)|(<\/?details\b[^>]*>)/gim;t.lastIndex=e;let r=1,s;for(;s=t.exec(n);)if(s[2]){const i=s[2],a=new RegExp(`^ {0,3}${i[0]}{${i.length},}[\\t ]*(?:\\r?\\n|$)`,"gm");if(a.lastIndex=t.lastIndex,!a.exec(n))break;t.lastIndex=a.lastIndex}else if(s[3]){const i=/`+/g;i.lastIndex=t.lastIndex;let a;for(;a=i.exec(n);)if(a[0].length===s[3].length){t.lastIndex=i.lastIndex;break}}else if(s[4]){const i=n.lastIndexOf(`
|
|
3
|
+
`,s.index-1)+1,a=n.slice(i,s.index);if(/^(?: {4}|\t| {0,3}>)/.test(a)||/(?:^|[^\\])(?:\\\\)*\\$/.test(a))continue;if(r+=/^<\//.test(s[4])?-1:1,r===0)return{bodyEnd:s.index,end:t.lastIndex}}return{bodyEnd:n.length,end:n.length}}function vi(){const n=t=>{const r=this.parse(t);if(!wi(r))throw new Error("Disclosure parsing requires a Markdown root");return t.startsWith("\uFEFF")&&Qe(r,t,1),r},e=(t,r)=>{if(!("children"in t))return;const s=t.children;if(t.type==="blockquote"){const i=t.position?.start?.offset,a=t.position?.end?.offset;if(i===void 0||a===void 0)return;const o=[];let l="",c=i;for(const f of r.slice(i,a).split(new RegExp("(?<=\\n)"))){const u=/^ {0,3}> ?/.exec(f)?.[0].length??0;for(let p=u;p<f.length;p++)o.push(c+p),l+=f[p];c+=f.length}o.push(a);const d=n(l);e(d,l);const m=f=>{if(f.position)for(const u of[f.position.start,f.position.end]){if(!u||u.offset===void 0)continue;u.offset=o[u.offset]??a;const p=r.slice(0,u.offset).split(/\r\n|\r|\n/);u.line=p.length,u.column=p[p.length-1].length+1}if("children"in f)for(const u of f.children)m(u)};m(d),s.splice(0,s.length,...d.children);return}for(let i=0;i<s.length;i++){const a=s[i];if(a.type!=="html"){e(a,r);continue}const o=a.position?.start?.offset;if(o===void 0)continue;const l=yi.exec(r.slice(o));if(!l)continue;const c=o+l[0].length,{bodyEnd:d,end:m}=ki(r,c),f=r.slice(c,d),u=n(f);e(u,f),Qe(u,r,c);const p=/<summary\s*>/i.exec(l[0]),g=o+(p?.index??0)+(p?.[0].length??0),w=l[2]??"",M=xi.exec(w),v=M?M[3]:w,x=n(v);Qe(x,r,g+(M?.[1].length??0));const k=x.children[0],S=k?.type==="paragraph"?k.children:[{type:"text",value:v}],C=bi.find(O=>String(O)===M?.[2]),y={type:"ocDisclosureSummary",data:{hName:"summary"},children:C?[{type:"heading",depth:C,children:S}]:S},j={type:"ocDisclosure",data:{hName:"details",hProperties:l[1]?{open:!0}:{}},children:[y,...u.children]};let P=1,I=a.position?.end?.offset??m;for(;i+P<s.length;){const O=s[i+P];if((O.position?.start?.offset??r.length)>=m)break;I=O.position?.end?.offset??m,P++}const R=n(r.slice(m,I));Qe(R,r,m);const N=R.children;s.splice(i,P,j,...N)}};return(t,r)=>e(t,r.toString())}const Si=function(n,e,t){const r=this.previous===null||this.previous<-2;let s=!1,i=!1;function a(u){return n.enter("ocMath"),n.enter("ocMathMarker"),n.consume(u),o}function o(u){return u!==40&&u!==91||(s=u===91,s&&!r)?t(u):(n.consume(u),n.exit("ocMathMarker"),n.enter("ocMathValue"),l)}function l(u){return u===null?t(u):u===92?n.check(d,m,c)(u):c(u)}function c(u){return i=!0,u!==null&&u<=-3?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),l):(n.consume(u),l)}const d={tokenize(u,p,g){return w;function w(x){return u.consume(x),M}function M(x){return!i||x!==(s?93:41)?g(x):(u.consume(x),s?v:p)}function v(x){return x===32||x===9?(u.consume(x),v):x===null||x<0?p(x):g(x)}}};function m(u){return n.exit("ocMathValue"),n.enter("ocMathMarker"),n.consume(u),f}function f(u){return n.consume(u),n.exit("ocMathMarker"),n.exit("ocMath"),e}return a},Ci=function(n,e,t){const r=this.previous,s=this.parser.constructs.text[60];let i="";return a;function a(d){return r!==null&&r>=48&&r<=57?t(d):(n.enter("ocMath"),n.consume(d),o)}function o(d){return d===null||d<0||d===34?t(d):d===60&&s?n.check(s,t,l)(d):d===40&&i.endsWith("]")||!i&&/\s/.test(String.fromCharCode(d))?t(d):d===36?!i||/^\s|\s$/.test(i)||/^[\d.,\s]+$/.test(i)||/^\d[\d.,]*(?:[;:]|\s+(?:and|to)\b)/.test(i)?t(d):(n.consume(d),c):l(d)}function l(d){return d===null?t(d):(i+=String.fromCharCode(d),n.consume(d),o)}function c(d){return d!==null&&d>=48&&d<=57?t(d):(n.exit("ocMath"),e(d))}},Mi={enter:{ocMath(n){const e=this.sliceSerialize(n).startsWith("\\[");this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math",e?"math-display":"math-inline"]},hChildren:[]}},n)}},exit:{ocMath(n){const e=this.sliceSerialize(n),t=e.startsWith("$")?1:2,r=e.slice(t,-t),s=this.stack[this.stack.length-1];s.type==="inlineMath"&&(s.value=r,s.data&&(s.data.hChildren=[{type:"text",value:r}])),this.exit(n)}}};function ji(n,e){const t=n.position?.start?.offset,r=n.position?.end?.offset;if(t===void 0||r===void 0)return!0;const s=e.slice(t,r);return!s.startsWith("$")||s.startsWith("$$")?!0:!/^[\d.,\s]+$/.test(n.value)&&!/^\s|\s$/.test(n.value)&&!/\d/.test(e.slice(r,r+1))}function Ei(){const n=this.data();return(n.micromarkExtensions??=[]).push({text:{92:{name:"ocMath",tokenize:Si},36:{name:"ocDollarMath",tokenize:Ci}}}),(n.fromMarkdownExtensions??=[]).push(Mi),(e,t)=>{const r=t.toString();function s(i){if(!("children"in i))return;const a=i.children;if(i.type==="link"){const o=a.map(l=>l.type==="inlineMath"||l.type==="math"?r.slice(l.position?.start?.offset,l.position?.end?.offset):l.type==="text"?l.value:"").join("");if(o===i.url){i.children=[{type:"text",value:o}];return}}for(let o=0;o<a.length;o++){const l=a[o];if(l.type==="inlineMath"||l.type==="math"){const c=l.position?.start?.offset,d=l.position?.end?.offset;ji(l,r)?l.type==="inlineMath"&&r.slice(c,d).startsWith("$$")&&(l.data??={},l.data.hProperties={className:["language-math","math-display"]}):a.splice(o,1,{type:"text",value:r.slice(c,d)})}else s(l)}}s(e)}}const Yt="openchamber://extensions/install?",On=n=>{if(!n.toLowerCase().startsWith(Yt))return null;const e=new URLSearchParams(n.slice(Yt.length)),t=e.get("path");if(t)return t.startsWith("/")||/^[a-z]:[\\/]/i.test(t)?{kind:"path",source:t}:null;const r=e.get("url");if(!r)return null;try{return new URL(r).protocol==="https:"?{kind:"url",source:r}:null}catch{return null}},Ri=new Set(["align","alt","checked","colSpan","controls","disabled","height","href","media","open","playsInline","preload","rel","rowSpan","src","srcSet","start","target","title","type","width"]),Ge=Pn();function ct(n){try{const e=new URL(n);return e.protocol==="file:"&&(!e.hostname||e.hostname==="localhost")}catch{return!1}}function kt(n){return/\s/.test(n)||/^[\s\\]*[/\\]{2}/.test(n)||n.includes("\\")?!1:/^https?:\/\//i.test(n)||!/^[a-z][a-z\d+.-]*:/i.test(n)}function Ni(n,e){return n!==n.trim()||/\s/.test(n)?!1:kt(n)||ct(n)||xn(n)||/^(?:mailto|tel|sms|callto|cid|xmpp|irc|ircs|news|nntp|feed|webcal):/i.test(n)||!e&&(hr(n)||On(n)!==null)}function Pi({isVSCode:n}){return(e,t)=>{const r=t.toString();function s(i){const a=[];for(const o of i.children){if(o.type==="doctype")continue;if(o.type!=="element"){a.push(o);continue}if(["script","style","iframe","object","embed","svg","math","form"].includes(o.tagName))continue;const l=o.position?.start?.offset,c=l!==void 0&&r[l]==="<";if(!(o.tagName==="input"&&o.properties.type!=="checkbox")){for(const d of Object.keys(o.properties)){const f=c&&d==="className"&&o.tagName==="code"&&Array.isArray(o.properties.className)&&o.properties.className.every(u=>/^language-[\w#+.-]+$/.test(String(u)))||!c&&(d==="className"&&["code","li","ul","ol","section","h2","a"].includes(o.tagName)||d==="metastring"&&o.tagName==="code"||["id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataFootnotes"].includes(d)||d==="dataOcAlert"&&o.tagName==="blockquote"||d==="dataOcReference"&&o.tagName==="a"||d==="dataOcGuestLink"&&o.tagName==="a");!Ri.has(d)&&!f&&delete o.properties[d]}if(o.properties.href!==void 0){const d=Ge.safeParse(o.properties.href);d.success&&Ni(d.data,n)?o.properties.dataOcLinkSource=d.data:delete o.properties.href}if(o.tagName==="a"&&(o.properties.href="#oc-link"),o.properties.src!==void 0){const d=Ge.safeParse(o.properties.src);if(d.success){const m=d.data,f=o.tagName==="img"&&/^data:image\/(?:png|jpeg|gif|webp);base64,(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(m);m===m.trim()&&(kt(m)||ct(m)||f)?(o.properties.dataOcMediaSource=m,ct(m)&&delete o.properties.src):delete o.properties.src}else delete o.properties.src}if(o.tagName==="img"&&(o.properties.src="/__oc_markdown_media__"),o.properties.srcSet!==void 0){const d=Ge.safeParse(o.properties.srcSet);d.success&&d.data.split(",").every(f=>{const[u,p,...g]=f.trim().split(/\s+/);return!!u&&kt(u)&&g.length===0&&(!p||/^(?:\d+w|\d+(?:\.\d+)?x)$/.test(p))})||delete o.properties.srcSet}for(const d of["width","height"])o.properties[d]!==void 0&&!/^\d+(?:\.\d+)?%?$/.test(String(o.properties[d]))&&delete o.properties[d];o.tagName==="video"&&(o.properties.controls=!0,o.properties.playsInline=!0,o.properties.preload="none"),s(o),a.push(o)}}i.children=a}s(e)}}function _i(){return n=>{function e(t){for(const r of t.children)if(r.type==="element"){if(r.tagName==="a"){const s=Ge.safeParse(r.properties.dataOcLinkSource);s.success?r.properties.href=s.data:delete r.properties.href,delete r.properties.dataOcLinkSource}if(r.tagName==="img"){const s=Ge.safeParse(r.properties.dataOcMediaSource);s.success&&!ct(s.data)&&!/^data:/i.test(s.data)?r.properties.src=s.data:delete r.properties.src}e(r)}}e(n)}}const Li=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote"]),Ai=new Set(["code","pre","ul","ol","blockquote","table","details"]),Ii=new Set(["p","h1","h2","h3","h4","h5","h6","li","br","div"]);function Dn(n){if(n.type==="text")return n.value;if(n.type!=="element"||Ai.has(n.tagName))return" ";const e=n.children.map(Dn).join("");return Ii.has(n.tagName)?` ${e} `:e}function Fn(n){const e=n.children.map(t=>t.type==="element"?Fn(t):void 0);if(Li.has(n.tagName)){const t=zs(n.children.map(Dn).join(""));return t&&(n.properties={...n.properties,dir:t}),t}if(n.tagName==="ul"||n.tagName==="ol"){const t=new Set(e.filter(Boolean));t.size===1&&(n.properties={...n.properties,dir:[...t][0]})}}function Ti(){return n=>{for(const e of n.children)e.type==="element"&&Fn(e)}}const zn={singleTilde:!1},$i=at.gfm,Oi=[[$i[0],zn],...Object.values(at).filter(n=>n!==at.gfm)],Di=lt.remarkPluginsAfter.at(-1),Fi={...lt,remarkPluginsAfter:[...lt.remarkPluginsAfter.slice(0,-1),[Di,zn]]};function zi(n=!1){return n?lt:Fi}const Jt=Xs({singleDollarTextMath:!1}),Wi={...Jt,remarkPlugin:function(){return this.use([Jt.remarkPlugin]),Ei.call(this)}},Ui={tagNames:["a","abbr","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","mark","ol","p","picture","pre","q","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var","video"],strip:["script","style","iframe","object","embed","svg","math","form"],attributes:{"*":["align","alt","checked","colSpan","height","media","open","rowSpan","start","title","width"],a:["href","id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataOcLinkSource","dataOcReference","dataOcGuestLink"],code:[["className",/^language-[\w#+.:-]+$/,"math-inline","math-display"],"metastring"],img:["src","srcSet","alt","dataOcMediaSource"],source:["src","srcSet","type","media","dataOcMediaSource"],video:["src","controls","playsInline","preload","dataOcMediaSource"],input:["type","checked","disabled"],li:[["className","task-list-item"]],ul:[["className","contains-task-list"]],ol:[["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],h2:["id",["className","sr-only"]],blockquote:[["dataOcAlert",...Tn]]},protocols:{src:["http","https"]},clobberPrefix:"",required:{input:{type:"checkbox",disabled:!0}}};function Bi(){return n=>{function e(t){if(!("children"in t)||t.type==="link"||t.type==="linkReference")return;const r=t.children;for(let s=0;s<r.length;s++){const i=r[s];if(i.type!=="text"){e(i);continue}const a=Array.from(i.value.matchAll(/\bopenchamber:\/\/session\/[A-Za-z0-9_-]{1,128}(?:\?message=[A-Za-z0-9_-]{1,128})?/g));if(a.length===0)continue;const o=[];let l=0;for(const c of a)c.index>l&&o.push({type:"text",value:i.value.slice(l,c.index)}),o.push({type:"link",url:c[0],children:[{type:"text",value:c[0]}]}),l=c.index+c[0].length;l<i.value.length&&o.push({type:"text",value:i.value.slice(l)}),r.splice(s,1,...o),s+=o.length-1}}e(n)}}function Ki(){const n=this.data();(n.micromarkExtensions??=[]).push({disable:{null:["htmlFlow","htmlText","characterReference"]}})}function Vi(){return(n,e)=>{const t=String(e.value).replace(/^\uFEFF/,"");n.children=n.children.filter(r=>{const s=r.position?.start.offset,i=r.position?.end.offset;return s===void 0||i===void 0||!Mt(t.slice(s,i))})}}function et(n,e,t){return{remarkPlugins:[...t?Object.values(at):Oi,vi,gi,Vi,Bi],rehypePlugins:[...n?[qt.raw]:[],[Pi,{isVSCode:e}],[Js,Ui],qt.harden,_i,Ti]}}const Hi=[!1,!0].flatMap(n=>[et(!1,!1,n),et(!1,!0,n),et(!0,!1,n),et(!0,!0,n)]);function qi(n,e,t=!1){return Hi[(t?4:0)+(n?2:0)+(e?1:0)]}const Gi=new Set(["inlineCode","code","html","math","inlineMath"]);function Xi(n){return e=>{const t=r=>{if(!Gi.has(r.type)){if(r.type==="text"){r.value=pr(r.value,n);return}if("children"in r)for(const s of r.children)t(s)}};t(e)}}const Zi=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Yi=n=>{const{issuePrefix:e,changeRequestPrefix:t}=n.descriptor.terminology,r=[...new Set([e,t])].sort((s,i)=>i.length-s.length).map(Zi).join("|");return new RegExp([String.raw`(?<![\w/#!@&.-])(?<project>[\w.-]+(?:/[\w.-]+)+)?(?<prefix>${r})(?<number>\d+)(?![\w-])`,String.raw`(?<![\w@./+-])@(?<user>[A-Za-z0-9](?:[A-Za-z0-9_.-]*[A-Za-z0-9_])?)(?![\w@/-])`,String.raw`(?<![\w/@#.-])(?<sha>[0-9a-f]{7,40})(?![\w/-])`].join("|"),"g")},Ji=(n,e,t)=>{const{issuePrefix:r,changeRequestPrefix:s}=n.descriptor.terminology;if(e.number&&e.prefix){const i=e.prefix===r?"issue":e.prefix===s?"pull":null,a=Number(e.number);if(!i||!Number.isSafeInteger(a)||a<1||e.project&&!n.descriptor.repository.nestedNamespaces&&e.project.split("/").length>2)return null;const o=gr(n,i,a,e.project?wr(e.project):n);return o?{url:o,children:[{type:"text",value:t}]}:null}if(e.user){const i=yr(n,e.user);return i?{url:i,children:[{type:"text",value:t}]}:null}if(e.sha&&/\d/.test(e.sha)&&/[a-f]/.test(e.sha)){const i=xr(n,e.sha);return i?{url:i,children:[{type:"inlineCode",value:e.sha.slice(0,7)}]}:null}return null},Qi=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},eo=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function to(n){const e=Yi(n),t=r=>{const s=[];let i=0;for(const a of r.matchAll(e)){const o=a.groups?Ji(n,a.groups,a[0]):null;if(!o)continue;a.index>i&&s.push({type:"text",value:r.slice(i,a.index)});const l={type:"link",url:o.url,children:o.children,data:{hProperties:{dataOcReference:""}}};s.push(l),i=a.index+a[0].length}return s.length===0?null:(i<r.length&&s.push({type:"text",value:r.slice(i)}),s)};return r=>{const s=i=>{if(eo.has(i.type)||!("children"in i))return;const a=i.children;let o=0;for(let l=0;l<a.length;l++){const c=a[l];if(c.type==="html"){o=Math.max(0,o+Qi(c.value));continue}if(o>0)continue;if(c.type!=="text"){s(c);continue}const d=t(c.value);d&&(a.splice(l,1,...d),l+=d.length-1)}};s(r)}}const no=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},ro=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function so(n){const e=br(n),t=r=>{if(!e)return null;const s=[];let i=0;for(const a of r.matchAll(e)){const o=bn(n,a[0]);if(!o)continue;a.index>i&&s.push({type:"text",value:r.slice(i,a.index)});const l={type:"link",url:"",children:[{type:"text",value:a[0]}],data:{hProperties:{dataOcGuestLink:o.guestId}}};s.push(l),i=a.index+a[0].length}return s.length===0?null:(i<r.length&&s.push({type:"text",value:r.slice(i)}),s)};return r=>{if(!e)return;const s=i=>{if(ro.has(i.type)||!("children"in i))return;const a=i.children;let o=0;for(let l=0;l<a.length;l++){const c=a[l];if(c.type==="html"){o=Math.max(0,o+no(c.value));continue}if(o>0)continue;if(c.type!=="text"){s(c);continue}const d=t(c.value);d&&(a.splice(l,1,...d),l+=d.length-1)}};s(r)}}const io=/^\/api\/source-control\/[^/?#]+\/uploads\/[0-9a-f]{32}\/[^/?#]+\?/,tt=new Map;class oo{constructor(e){this.options=e}options;controller=new AbortController;disposed=!1;sources=new Map;batch;refreshing;documentUrls=new Map;runtimeKey=ue();resolver=Ne();connect(){!this.disposed&&this.controller.signal.aborted&&(this.controller=new AbortController)}register(e){return this.sources.set(e,(this.sources.get(e)??0)+1),()=>{const t=(this.sources.get(e)??1)-1;t?this.sources.set(e,t):this.sources.delete(e)}}check(e){if(e.aborted||this.disposed||this.runtimeKey!==ue()||this.resolver!==Ne())throw new DOMException("Media owner changed","AbortError")}async resolve(e,t=!1,r=!1){const s=this.controller.signal;this.check(s);const{mode:i,directory:a,sessionId:o,messageId:l,documentAssets:c}=this.options;if(i==="assistant"&&(await Promise.resolve(),this.check(s),![...this.sources.keys()].slice(0,12).includes(e)))throw new Error("Message media limit");if(/^(?:https?:)?\/\//i.test(e)){if(i!=="document"&&!t)throw new Error("Remote chat image");return e}if(/^data:/i.test(e))return kr(e,s);if(i==="document"){if(!c){if(t||!io.test(e))return e;const w=this.readDocumentImage(e,e,void 0,s);return w.catch(()=>{this.documentUrls.get(e)===w&&this.documentUrls.delete(e)}),w}if(!Qs(e))throw new Error("Document source is unavailable");const u=ei(c.filePath,e),p=c.workspaceRoot,g={path:u,directory:p||void 0,allowOutsideWorkspace:p&&jt(u,p)?void 0:"true"};if(t){if(Se())throw new Error("Video bridge is unavailable");return await xt(),this.check(s),Ne().authenticatedAsset("/api/fs/raw",g)}return this.readDocumentImage(u,"/api/fs/raw",g,s)}if(i==="local")return e;if(Se()){if(t)throw new Error("Video bridge is unavailable");const u=await vr(e,a,s);return this.check(s),u}if(!o||!l)throw new Error("Missing media owner");await Promise.resolve(),this.check(s);const m=[...this.sources.keys()].slice(0,12);if(!m.includes(e))throw new Error("Message media limit");if(!this.batch||r){if(r&&this.refreshing)this.batch=this.refreshing;else if(this.batch=Sr({sources:m.filter(Dt),directory:a,sessionId:o,messageId:l,signal:s}),r){const u=this.batch;this.refreshing=u,u.finally(()=>{this.refreshing===u&&(this.refreshing=void 0)}).catch(()=>{})}}const f=(await this.batch).get(e);if(this.check(s),f?.status!=="ready")throw new Error("Image is unavailable");if(!t&&Cr()){const u=await Mr(f,a,s);return this.check(s),u}return await xt(),this.check(s),jr(f,a)}readDocumentImage(e,t,r,s){const i=this.documentUrls.get(e);if(i)return i;const a=(async()=>{const o=await ft(t,{query:r,signal:AbortSignal.any([s,AbortSignal.timeout(3e4)])});if(!o.ok)throw new Error(`Image read failed (${o.status})`);const l=await o.blob();if(l.size>25*1024*1024)throw new Error("Image too large for preview");return this.check(s),URL.createObjectURL(l)})();return this.documentUrls.set(e,a),a}async load(e){const t=this.controller.signal,{mode:r,directory:s,sessionId:i,messageId:a}=this.options;if(r==="assistant"&&!Se()&&Dt(e)){if(!i||!a)throw new Error("Missing media owner");return Er({source:e,directory:s,sessionId:i,messageId:a,signal:t})}const o=await this.resolve(e);if(!/^(?:data|blob):/i.test(o))throw new Error("Image cannot be saved");return(await fetch(o,{signal:t})).blob()}addGallery(e){const t=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`;let r=tt.get(t);return r||(r=new Set,tt.set(t,r)),r.add(e),()=>{r.delete(e),r.size||tt.delete(t)}}async openGallery(e,t){const r=this.controller.signal;this.check(r);const s=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`,i=[...tt.get(s)??[]].filter(d=>d.element.isConnected).sort((d,m)=>d.element.compareDocumentPosition(m.element)&4?-1:1),a=await Promise.allSettled(i.map(d=>d.resolve()));this.check(r);const o=i.flatMap((d,m)=>{const f=a[m];return f?.status==="fulfilled"?[{url:f.value,filename:d.filename,element:d.element,load:d.load}]:[]}),l=o.findIndex(d=>d.element===e),c=o[l];c&&t({open:!0,title:c.filename,content:"",metadata:{tool:"markdown-image-preview",filename:c.filename},image:{url:c.url,filename:c.filename,load:c.load,gallery:o.map(({url:d,filename:m,load:f})=>({url:d,filename:m,load:f})),index:l}})}disconnect(){this.controller.abort();for(const e of this.documentUrls.values())e.then(t=>URL.revokeObjectURL(t),()=>{});this.documentUrls.clear(),this.batch=void 0,this.refreshing=void 0}dispose(){this.disposed=!0,this.disconnect()}}const Wn=b.createContext(null),Be=b.createContext(!1),pe=()=>b.useContext(Wn);function ao(n){const e=z.c(23),{content:t,mode:r,sessionId:s,messageId:i,directory:a,settled:o,documentAssets:l,onShowPopup:c,children:d}=n,[m,f]=b.useReducer(lo,0);let u,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>Nn(()=>f()),p=[],e[0]=u,e[1]=p):(u=e[0],p=e[1]),b.useEffect(u,p);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=ue(),e[2]=g):g=e[2];const w=g;let M;e[3]===Symbol.for("react.memo_cache_sentinel")?(M=Ne(),e[3]=M):M=e[3];const v=M,x=l?.filePath,k=l?.workspaceRoot;let S;e[4]!==a||e[5]!==x||e[6]!==i||e[7]!==r||e[8]!==s||e[9]!==k?(S=new oo({mode:r,directory:a,sessionId:s,messageId:i,documentAssets:x?{filePath:x,workspaceRoot:k??null}:void 0}),e[4]=a,e[5]=x,e[6]=i,e[7]=r,e[8]=s,e[9]=k,e[10]=S):S=e[10];const C=S;let y,j;e[11]!==C?(y=()=>{if(w!==ue()||v!==Ne()){C.dispose(),f();return}C.connect();const N=Ws(()=>C.dispose());return()=>{N(),C.disconnect()}},j=[C,v,w],e[11]=C,e[12]=y,e[13]=j):(y=e[12],j=e[13]),b.useLayoutEffect(y,j);let P;e[14]!==l||e[15]!==r||e[16]!==c||e[17]!==C||e[18]!==o?(P={owner:C,mode:r,settled:o,documentAssets:l,onShowPopup:c},e[14]=l,e[15]=r,e[16]=c,e[17]=C,e[18]=o,e[19]=P):P=e[19];const I=P;let R;return e[20]!==d||e[21]!==I?(R=h.jsx(Wn.Provider,{value:I,children:d}),e[20]=d,e[21]=I,e[22]=R):R=e[22],R}function lo(n){return n+1}const Un=b.createContext(null),Pt=b.createContext(null);function oe(){const n=b.useContext(Pt);if(!n)throw new Error("Markdown components require MarkdownContent");return n}const _t=n=>/^(?:https?:)?\/\//i.test(n),Bn=n=>n==="streamdown:incomplete-image",Kn=(n,e)=>n["data-oc-media-source"]??e??"",Vn=b.createContext(null),co=n=>{const e=n.ownerDocument.defaultView;for(let t=n.parentElement;t&&e;t=t.parentElement)if(t.scrollHeight>t.clientHeight&&/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null};function Lt(n,e){const t=z.c(7),r=e===void 0?!1:e,s=b.useRef(null);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u=>{s.current=u},t[0]=i):i=t[0];const a=i,[o,l]=b.useState(!1);let c,d;t[1]!==n||t[2]!==r?(c=()=>{if(!n||!s.current)return;const u=s.current.ownerDocument.defaultView?.IntersectionObserver;if(!u){l(!0);return}const p=new u(g=>{g.some(uo)&&(l(!0),p.disconnect())},r?{root:co(s.current),rootMargin:"100% 0px"}:{rootMargin:"200px"});return p.observe(s.current),()=>p.disconnect()},d=[n,r],t[1]=n,t[2]=r,t[3]=c,t[4]=d):(c=t[3],d=t[4]),b.useEffect(c,d);const m=!n||o;let f;return t[5]!==m?(f={ref:s,setRef:a,near:m},t[5]=m,t[6]=f):f=t[6],f}function uo(n){return n.isIntersecting}function fo(n){const e=z.c(4);let t;e[0]!==n?(t=i=>{if(!n)return ho;const a=window.matchMedia(n);return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},e[0]=n,e[1]=t):t=e[1];const r=t;let s;return e[2]!==n?(s=()=>!n||window.matchMedia(n).matches,e[2]=n,e[3]=s):s=e[3],b.useSyncExternalStore(r,s,mo)}function mo(){return!0}function ho(){}const At=b.createContext(null);function Xe(n){const e=z.c(23),{source:t,name:r,title:s,linked:i,state:a}=n,{t:o}=ge(),l=b.useContext(Pt),c=pe(),d=Et(l?.directory??c?.owner?.options.directory??"");let m;e[0]!==a||e[1]!==o||e[2]!==s?(m=a==="failed"?o("common.image.loadFailed"):s,e[0]=a,e[1]=o,e[2]=s,e[3]=m):m=e[3];let f;e[4]!==t?(f=Ce(t),e[4]=t,e[5]=f):f=e[5];let u;e[6]!==a?(u=a==="loading"?h.jsx(Pr,{className:"size-3.5","aria-hidden":!0}):h.jsx(he,{name:a==="failed"?"error-warning":"file-image",className:"size-3.5 shrink-0"}),e[6]=a,e[7]=u):u=e[7];let p;e[8]!==r||e[9]!==a||e[10]!==m||e[11]!==f||e[12]!==u?(p=h.jsxs("span",{title:m,"data-oc-media-source":f,"data-oc-media-label":"true","data-oc-media-state":a,className:"inline-flex items-center gap-1 align-text-bottom text-muted-foreground",children:[u,r]}),e[8]=r,e[9]=a,e[10]=m,e[11]=f,e[12]=u,e[13]=p):p=e[13];const g=p;if(!_t(t)||i||Nr(t))return g;let w;e[14]!==d||e[15]!==l?.disableLinkSafety||e[16]!==l?.purpose||e[17]!==t?(w=v=>{l?.purpose||l?.disableLinkSafety||v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||(v.preventDefault(),v.stopPropagation(),d(t))},e[14]=d,e[15]=l?.disableLinkSafety,e[16]=l?.purpose,e[17]=t,e[18]=w):w=e[18];let M;return e[19]!==g||e[20]!==t||e[21]!==w?(M=h.jsx("a",{href:t,className:"external-link",target:"_blank",rel:"noopener noreferrer",onClick:w,children:g}),e[19]=g,e[20]=t,e[21]=w,e[22]=M):M=e[22],M}function Hn(n,e,t){const r=z.c(22),s=t===void 0?!1:t,i=pe(),a=i?.owner,[o,l]=b.useState(null),[c,d]=b.useState(null);let m;r[0]!==i?.mode?(m=()=>{i?.mode==="document"&&l(po)},r[0]=i?.mode,r[1]=m):m=r[1];const f=i?.mode;let u;r[2]!==f?(u=[f],r[2]=f,r[3]=u):u=r[3],b.useLayoutEffect(m,u);let p,g;r[4]!==e||r[5]!==a||r[6]!==n||r[7]!==s?(p=()=>{if(!a||!n||!e)return;const S=a.controller.signal;let C=!1;return a.resolve(n,s).then(y=>{!C&&!S.aborted&&(d(null),l({owner:a,signal:S,source:n,url:y}))},()=>{!C&&!S.aborted&&d({owner:a,signal:S,source:n,url:""})}),()=>{C=!0}},g=[a,n,e,s],r[4]=e,r[5]=a,r[6]=n,r[7]=s,r[8]=p,r[9]=g):(p=r[8],g=r[9]),b.useEffect(p,g);const w=c?.owner===a&&c?.source===n,M=o&&o.owner===a&&o.source===n&&(i?.mode!=="document"||!o.signal.aborted)&&!w?o.url:void 0;let v;r[10]!==a||r[11]!==n?(v=()=>{a&&d({owner:a,signal:a.controller.signal,source:n,url:""})},r[10]=a,r[11]=n,r[12]=v):v=r[12];let x;r[13]!==a||r[14]!==n||r[15]!==s?(x=async()=>{if(!a)throw new Error("Missing media owner");const S=a.controller.signal,C=await a.resolve(n,s,!0);S.aborted||(d(null),l({owner:a,signal:S,source:n,url:C}))},r[13]=a,r[14]=n,r[15]=s,r[16]=x):x=r[16];let k;return r[17]!==w||r[18]!==M||r[19]!==v||r[20]!==x?(k={url:M,failed:w,fail:v,retry:x},r[17]=w,r[18]=M,r[19]=v,r[20]=x,r[21]=k):k=r[21],k}function po(n){return n?.signal.aborted?null:n}const go=(n,e)=>{const t=e===void 0?"":String(e).trim(),r=n===void 0?"":String(n).trim();return/^\d+$/.test(t)?/^\d+$/.test(r)&&Number(t)>0?{aspectRatio:`${r}/${t}`}:{height:`${t}px`}:{}};function wo(n){const e=z.c(9),t=Kn(n,n.src),r=pe(),s=b.useContext(Be);if(Bn(t))return null;if(!s&&Rr(t,n.alt??""))return h.jsx(It,{src:t,title:n.title||n.alt,node:n.node});if(!t){let a;return e[0]!==r?.mode||e[1]!==n.alt||e[2]!==n.height||e[3]!==n.title||e[4]!==n.width?(a=r?.mode==="document"?h.jsx("img",{alt:n.alt,title:n.title,width:n.width,height:n.height}):null,e[0]=r?.mode,e[1]=n.alt,e[2]=n.height,e[3]=n.title,e[4]=n.width,e[5]=a):a=e[5],a}if(r?.mode!=="document"&&(_t(t)||s))return h.jsx(Xe,{source:t,name:Ue(t,n.alt),title:n.title,linked:s});let i;return e[6]!==n||e[7]!==t?(i=h.jsx(yo,{...n,source:t}),e[6]=n,e[7]=t,e[8]=i):i=e[8],i}function yo(n){const e=z.c(92);let t,r,s,i,a,o,l,c,d,m,f;if(e[0]!==n){const{source:ee,node:me,src:Ze,srcSet:we,alt:Ke,title:ye,className:xe,style:be,width:ke,height:Le,onLoad:$,onError:ae,...de}=n;o=ee,l=we,d=Ke,m=ye,t=xe,c=be,f=ke,r=Le,i=$,s=ae,a=de,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=o,e[7]=l,e[8]=c,e[9]=d,e[10]=m,e[11]=f}else t=e[1],r=e[2],s=e[3],i=e[4],a=e[5],o=e[6],l=e[7],c=e[8],d=e[9],m=e[10],f=e[11];const u=d===void 0?"":d,p=pe(),g=b.useContext(Be),w=b.useContext(Vn),M=w?.report,v=b.useId();let x;e[12]!==u||e[13]!==o?(x=Ue(o,u),e[12]=u,e[13]=o,e[14]=x):x=e[14];const k=x,S=p?.mode==="assistant",C=p?.mode==="document",y=b.useContext(At),{ref:j,setRef:P,near:I}=Lt(S||C&&y===null,C),R=y??I,N=p?.owner,O=S&&!!p?.onShowPopup&&!g;let E,A;e[15]!==N||e[16]!==o?(E=()=>N?.register(o),A=[N,o],e[15]=N,e[16]=o,e[17]=E,e[18]=A):(E=e[17],A=e[18]),b.useEffect(E,A);const W=!!(p&&R&&(!S||p.settled)),{url:L,failed:_,fail:U}=Hn(o,W),K=qn(l,W),[Z,J]=b.useState(null),T=!!(L&&Z?.url===L),D=Z&&Z.url===L?Z.size:void 0;let G,V;e[19]!==T||e[20]!==v||e[21]!==M||e[22]!==D?(G=()=>(M?.(v,T&&D?D:null),()=>M?.(v,null)),V=[M,v,T,D],e[19]=T,e[20]=v,e[21]=M,e[22]=D,e[23]=G,e[24]=V):(G=e[23],V=e[24]),b.useEffect(G,V);let q,F;e[25]!==T||e[26]!==O||e[27]!==k||e[28]!==N||e[29]!==j||e[30]!==o||e[31]!==L?(q=()=>{const ee=j.current;if(!(!N||!T||!ee||!O))return N.addGallery({source:o,filename:k,element:ee,resolve:()=>L?.startsWith("data:")?Promise.resolve(L):N.resolve(o,!1,!0),load:()=>N.load(o)})},F=[N,T,o,k,j,O,L],e[25]=T,e[26]=O,e[27]=k,e[28]=N,e[29]=j,e[30]=o,e[31]=L,e[32]=q,e[33]=F):(q=e[32],F=e[33]),b.useEffect(q,F);let H;e[34]!==u||e[35]!==t||e[36]!==C||e[37]!==T||e[38]!==U||e[39]!==r||e[40]!==k||e[41]!==s||e[42]!==i||e[43]!==a||e[44]!==K||e[45]!==w?.ready||e[46]!==P||e[47]!==o||e[48]!==l||e[49]!==c||e[50]!==m||e[51]!==L||e[52]!==f?(H=L||C?h.jsx("img",{...a,ref:C?P:void 0,src:L,srcSet:K,alt:u||k,title:m,width:f,height:r,className:ot(C?t:"block h-auto max-h-[30rem] w-auto max-w-full object-contain",C?!L&&"invisible":!T&&"hidden"),style:C?{...c,...go(f,r)}:{...c,width:w?.ready?"100%":c?.width},"data-oc-media-source":Ce(o),"data-oc-media-srcset":l,decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:ee=>{const me=ee.currentTarget;L&&me.naturalWidth&&me.naturalHeight&&J({url:L,size:{width:me.naturalWidth,height:me.naturalHeight}}),i?.(ee)},onError:ee=>{U(),s?.(ee)}}):null,e[34]=u,e[35]=t,e[36]=C,e[37]=T,e[38]=U,e[39]=r,e[40]=k,e[41]=s,e[42]=i,e[43]=a,e[44]=K,e[45]=w?.ready,e[46]=P,e[47]=o,e[48]=l,e[49]=c,e[50]=m,e[51]=L,e[52]=f,e[53]=H):H=e[53];const Y=H,X=D?D.width/D.height:1;let te;e[54]!==X||e[55]!==w?.ready||e[56]!==D?(te=w?.ready&&D?{flex:`${X} 1 0px`,minWidth:`${8*X}rem`,maxWidth:`min(${D.width}px, ${30*X}rem)`,margin:0}:void 0,e[54]=X,e[55]=w?.ready,e[56]=D,e[57]=te):te=e[57];const le=te;if(C){let ee;return e[58]!==_||e[59]!==Y||e[60]!==g||e[61]!==k||e[62]!==o||e[63]!==m?(ee=_?h.jsx(Xe,{source:o,name:k,title:m,linked:g,state:"failed"}):Y,e[58]=_,e[59]=Y,e[60]=g,e[61]=k,e[62]=o,e[63]=m,e[64]=ee):ee=e[64],ee}const ie=T?"inline-block max-w-[min(100%,30rem)] align-top my-1 me-1":void 0;let B;e[65]!==o?(B=Ce(o),e[65]=o,e[66]=B):B=e[66];let Q;e[67]!==W||e[68]!==T||e[69]!==_||e[70]!==g||e[71]!==k||e[72]!==o||e[73]!==m?(Q=!T&&h.jsx(Xe,{source:o,name:k,title:m,linked:g,state:_?"failed":W?"loading":void 0}),e[67]=W,e[68]=T,e[69]=_,e[70]=g,e[71]=k,e[72]=o,e[73]=m,e[74]=Q):Q=e[74];const ce=L&&!O&&Y;let ne;e[75]!==p||e[76]!==T||e[77]!==O||e[78]!==Y||e[79]!==k||e[80]!==N||e[81]!==j||e[82]!==L?(ne=L&&O&&h.jsx(ve,{variant:"ghost",className:ot("block h-auto max-w-full overflow-hidden rounded-lg bg-muted/10 p-0 cursor-zoom-in",!T&&"hidden"),"aria-label":k,"data-oc-media-gallery":"true",onClick:()=>{const ee=j.current;ee&&p?.onShowPopup&&N?.openGallery(ee,p.onShowPopup).catch(xo)},children:Y}),e[75]=p,e[76]=T,e[77]=O,e[78]=Y,e[79]=k,e[80]=N,e[81]=j,e[82]=L,e[83]=ne):ne=e[83];let re;return e[84]!==le||e[85]!==P||e[86]!==ie||e[87]!==B||e[88]!==Q||e[89]!==ce||e[90]!==ne?(re=h.jsxs("span",{ref:P,className:ie,style:le,"data-oc-media-source":B,children:[Q,ce,ne]}),e[84]=le,e[85]=P,e[86]=ie,e[87]=B,e[88]=Q,e[89]=ce,e[90]=ne,e[91]=re):re=e[91],re}function xo(){}function qn(n,e){const t=z.c(12),r=pe(),s=r?.owner,[i,a]=b.useState(null);let o,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(vo)},l=[],t[0]=o,t[1]=l):(o=t[0],l=t[1]),b.useLayoutEffect(o,l);let c;t[2]!==e||t[3]!==r?.mode||t[4]!==s||t[5]!==n?(c=()=>{if(!n||!s||!e||r?.mode!=="document")return;const f=s.controller.signal;let u=!1;const p=n.split(",").flatMap(ko);return Promise.all(p.map(async g=>{const{source:w,descriptor:M}=g,v=await s.resolve(w);return M?`${v} ${M}`:v})).then(g=>{!u&&!f.aborted&&a({owner:s,signal:f,source:n,value:g.join(", ")})},bo),()=>{u=!0}},t[2]=e,t[3]=r?.mode,t[4]=s,t[5]=n,t[6]=c):c=t[6];const d=r?.mode;let m;return t[7]!==e||t[8]!==s||t[9]!==n||t[10]!==d?(m=[s,d,n,e],t[7]=e,t[8]=s,t[9]=n,t[10]=d,t[11]=m):m=t[11],b.useEffect(c,m),i&&i.owner===s&&!i.signal.aborted&&i.source===n?i.value:void 0}function bo(){}function ko(n){const[e,...t]=n.trim().split(/\s+/);return e?[{source:e,descriptor:t.join(" ")}]:[]}function vo(n){return n?.signal.aborted?null:n}function So(n){const e=z.c(10);let t,r;if(e[0]!==n){const{node:d,children:m,...f}=n;t=m,r=f,e[0]=n,e[1]=t,e[2]=r}else t=e[1],r=e[2];const s=pe()?.mode==="document",{setRef:i,near:a}=Lt(s,!0),o=s?a:null;let l;e[3]!==t||e[4]!==o?(l=h.jsx(At.Provider,{value:o,children:t}),e[3]=t,e[4]=o,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==l?(c=h.jsx("picture",{...r,ref:i,children:l}),e[6]=r,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function Co(n){const e=z.c(13);let t,r,s;if(e[0]!==n){const{node:u,srcSet:p,media:g,...w}=n;s=p,t=g,r=w,e[0]=n,e[1]=t,e[2]=r,e[3]=s}else t=e[1],r=e[2],s=e[3];const i=pe(),a=b.useContext(At),o=i?.documentAssets?.colorScheme;let l;e[4]!==t||e[5]!==o?(l=o?t?.replace(/\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)/gi,(u,p)=>p.toLowerCase()===o?"(min-width: 0px)":"(max-width: -1px)"):t,e[4]=t,e[5]=o,e[6]=l):l=e[6];const c=l,d=fo(i?.mode==="document"?c:void 0),m=qn(s,i?.mode==="document"&&a!==!1&&d);if(i?.mode!=="document")return null;let f;return e[7]!==t||e[8]!==r||e[9]!==m||e[10]!==s||e[11]!==c?(f=h.jsx("source",{...r,srcSet:m,media:c,"data-oc-media-srcset":s,"data-oc-media-query":t}),e[7]=t,e[8]=r,e[9]=m,e[10]=s,e[11]=c,e[12]=f):f=e[12],f}function It(n){const e=Kn(n,n.src),t=pe(),r=t?.owner,s=b.useContext(Be),i=_t(e),{setRef:a,near:o}=Lt(t?.mode==="assistant"&&!i);b.useEffect(()=>i?void 0:r?.register(e),[r,e,i]);const{url:l,fail:c,retry:d}=Hn(e,!!(t&&!i&&!s&&(t.mode!=="assistant"||t.settled&&o)),!0),[m,f]=b.useState(null),u=m?.owner===r&&m?.source===e?m:null,p=b.useMemo(()=>({lastRetry:0,resume:null}),[r,e]),g=b.useRef(p);g.current=p;const w=b.useRef(null),M=n.title||Ue(e),v=i?u?.failed?void 0:u?.url??e:l,x=!!(v&&(i||t?.mode!=="assistant"||u?.ready===v));return!e||Bn(e)?null:s?h.jsx(Xe,{source:e,name:M,linked:!0}):h.jsxs("span",{ref:a,className:"inline-block max-w-full align-top","data-oc-media-source":Ce(e),children:[!x&&h.jsx(Xe,{source:e,name:M,linked:!1}),v&&h.jsx("video",{ref:w,src:v,title:M,controls:!0,playsInline:!0,hidden:!x,preload:i&&t?.mode!=="document"?"none":"metadata",className:n.className,"data-oc-media-source":Ce(e),onLoadedMetadata:k=>{f({owner:r,source:e,url:u?.url,ready:v});const S=p.resume;S&&(k.currentTarget.currentTime=S.time,S.playing&&k.currentTarget.play().catch(()=>{}),p.resume=null),n.onLoadedMetadata?.(k)},onError:k=>{if(i){const C=Ne(),y=new URL(e,window.location.href),j=new URL(C.api("/api/fs/raw"),window.location.href);if(!(y.origin===j.origin&&y.pathname===j.pathname&&y.searchParams.has("oc_url_token"))||Date.now()-p.lastRetry<1e4){f({owner:r,source:e,failed:!0});return}p.lastRetry=Date.now(),p.resume={time:k.currentTarget.currentTime,playing:!k.currentTarget.paused};const I=r?.controller.signal;y.searchParams.delete("oc_url_token"),xt().then(()=>{I?.aborted||g.current!==p||C!==Ne()||f({owner:r,source:e,url:C.authenticatedAsset("/api/fs/raw",y.searchParams)})},()=>{!I?.aborted&&g.current===p&&f({owner:r,source:e,failed:!0})});return}if(Date.now()-p.lastRetry<1e4){c();return}p.lastRetry=Date.now(),p.resume={time:k.currentTarget.currentTime,playing:!k.currentTarget.paused};const S=r?.controller.signal;d().then(()=>{!S?.aborted&&g.current===p&&w.current?.load()},()=>{!S?.aborted&&g.current===p&&c()})}})]})}function Mo(n){const e=z.c(32);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=new Map,e[4]=i):i=e[4];const[a,o]=b.useState(i);let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(R,N)=>{o(O=>{if(O.get(R)===N||!N&&!O.has(R))return O;const E=new Map(O);return N?E.set(R,N):E.delete(R),E})},e[5]=l):l=e[5];const c=l,d=r?.children.filter(No),m=d?.length===1?d[0]:void 0,f=m?.type==="element"&&m.tagName==="a"?m.properties.href:void 0,u=m?.type==="element"&&m.children.length===1&&m.children[0]?.type==="text"?m.children[0].value:"",p=d?.length??0,g=p>1&&d?.every(Ro),w=pe()?.mode,M=!!(w==="assistant"&&g&&a.size===p);let v;e[6]!==M?(v={report:c,ready:M},e[6]=M,e[7]=v):v=e[7];const x=v;if(w==="document"&&u&&u===f&&kn(u)){let R;e[8]!==u?(R=h.jsx(It,{src:u}),e[8]=u,e[9]=R):R=e[9];let N;return e[10]!==s||e[11]!==R?(N=h.jsx("p",{...s,"data-streamdown":"paragraph",children:R}),e[10]=s,e[11]=R,e[12]=N):N=e[12],N}let k,S;e[13]!==a?(k=[...a.values()],S=k.reduce(Eo,0),e[13]=a,e[14]=k,e[15]=S):(k=e[14],S=e[15]);const C=S;let y;if(e[16]!==p||e[17]!==k||e[18]!==s.style||e[19]!==C||e[20]!==M){if(y={...s.style},M){y.display="flex",y.flexWrap="wrap",y.alignItems="flex-start",y.gap="0.5rem";let R;e[22]!==k?(R=k.map(jo),e[22]=k,e[23]=R):R=e[23],y.maxWidth=`calc(min(30rem, ${Math.min(...R)}px) * ${C} + ${(p-1)*.5}rem)`}e[16]=p,e[17]=k,e[18]=s.style,e[19]=C,e[20]=M,e[21]=y}else y=e[21];const j=M?"true":void 0;let P;e[24]!==t||e[25]!==y||e[26]!==s||e[27]!==j?(P=h.jsx("p",{...s,"data-streamdown":"paragraph","data-oc-media-row":j,style:y,children:t}),e[24]=t,e[25]=y,e[26]=s,e[27]=j,e[28]=P):P=e[28];let I;return e[29]!==P||e[30]!==x?(I=h.jsx(Vn.Provider,{value:x,children:P}),e[29]=P,e[30]=x,e[31]=I):I=e[31],I}function jo(n){return n.height}function Eo(n,e){return n+e.width/e.height}function Ro(n){return n.type==="element"&&n.tagName==="img"}function No(n){return n.type!=="text"||n.value.trim()}const Po=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Qt=Array.from(Po).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),_o=n=>Rt(n),Gn=n=>{let e;try{e=new URL(n.trim())}catch{return null}if(e.protocol!=="file:"||e.hostname&&e.hostname!=="localhost")return null;try{const t=decodeURIComponent(e.pathname);return/^\/[A-Za-z]:\//.test(t)?t.slice(1):t.startsWith("/")?t:null}catch{return null}},dt=n=>{let e=(n||"").trim();return e?((e.startsWith("`")&&e.endsWith("`")||e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e=e.replace(/[.,;!?]+$/g,""),e.endsWith(")")&&!e.includes("(")&&(e=e.slice(0,-1)),e.endsWith("]")&&!e.includes("[")&&(e=e.slice(0,-1)),e):""},nt=n=>{let e=dt(n);if(!e)return"";const t=e.indexOf(";");t>=0&&(e=e.slice(0,t)),e=e.replace(/#.*$/,"");const r=e.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);r&&(e=r[1]??e);const s=Qt.length>0?e.match(new RegExp(`^(.*(?:/|^)(${Qt})):.*$`,"i")):null;return s&&(e=s[1]??e),dt(e)},Lo=n=>{const e=dt(n);if(!e)return null;const t=e.indexOf(";"),r=t>=0?dt(e.slice(0,t)):e;if(!r)return null;const s=r.match(/^(.*?):(\d+)-(\d+)$/);if(s){const l=nt(s[1]??""),c=Number.parseInt(s[2]??"",10),d=Number.parseInt(s[3]??"",10);return!l||!Number.isFinite(c)||!Number.isFinite(d)||d<c?null:{path:l,line:c,endLine:d}}const i=r.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(i){const l=nt(i[1]??""),c=Number.parseInt(i[2]??"",10),d=i[3]?Number.parseInt(i[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const a=r.match(/^(.*?):(\d+)(?::(\d+))?$/);if(a){const l=nt(a[1]??""),c=Number.parseInt(a[2]??"",10),d=a[3]?Number.parseInt(a[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const o=nt(r);return o?{path:o}:null},Ao=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,Io=4,To=1e3,$o=200,Me=new Map;let rt=0;const en=[],Oo=()=>Se()?$o:To,Xn=(n,e)=>`${n}\0${e}`,Do=(n,e)=>{const t=Rt(n,{preserveWhitespace:!0});if(!t)return Promise.resolve(!1);const r=Xn(e,t),s=Me.get(r);if(s)return Me.delete(r),Me.set(r,s),s;const i=new Promise(o=>{const l=()=>{rt+=1,ft(`/api/fs/stat?path=${encodeURIComponent(t)}&optional=true`,{method:"GET",cache:"no-store",headers:e?{"x-opencode-directory":e}:void 0}).then(async c=>{if(!c.ok){o(!1);return}const d=await c.json().catch(()=>null);o(d?.exists!==!1)}).catch(()=>o(!1)).finally(()=>{rt=Math.max(0,rt-1),en.shift()?.()})};if(rt<Io){l();return}en.push(l)}),a=Oo();for(;Me.size>=a;){const o=Me.keys().next().value;if(typeof o!="string")break;Me.delete(o)}return Me.set(r,i),i},Fo=_n({exists:Ys().optional()}),zo=async(n,e)=>{const t=new URLSearchParams({path:Rt(n,{preserveWhitespace:!0}),optional:"true"});jt(n,e)||t.set("allowOutsideWorkspace","true");try{const r=await ft(`/api/fs/stat?${t.toString()}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}});if(!r.ok)return"failed";const s=Fo.safeParse(await r.json().catch(()=>null));return s.success?s.data.exists===!1?"missing":"exists":"failed"}catch{return"failed"}},Wo=_n({paths:Zs(Pn())}),qe=new Map,Uo=200,Zn=(n,e)=>ft(`/api/fs/find-by-name?name=${encodeURIComponent(n)}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}}).then(async t=>{if(!t.ok)return null;const r=Wo.safeParse(await t.json().catch(()=>null));return r.success?r.data.paths:null}).catch(()=>null),Bo=(n,e)=>{if(!n||!e||Se())return Promise.resolve(null);const t=Xn(e,n),r=qe.get(t);if(r)return r;const s=Zn(n,e).then(i=>i?.length===1?i[0]:null);for(;qe.size>=Uo;){const i=qe.keys().next();if(i.done)break;qe.delete(i.value)}return qe.set(t,s),s};function De(n,e){if("key"in n&&n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),n.stopPropagation(),!("key"in n)&&Ar(n.currentTarget.closest("[data-markdown-content]"))))return;const t=/Mac|iPhone|iPad/.test(navigator.platform);e(t?n.metaKey:n.ctrlKey)}const tn=new Sn({maxEntries:64,maxBytes:1024*1024});function mt(){const n=z.c(5),{directory:e}=oe(),t=b.useContext(vn),r=t?.editor,s=t?.runtime.isVSCode,i=Lr();let a;return n[0]!==e||n[1]!==r||n[2]!==s||n[3]!==i?(a=async(o,l,c,d)=>{const m=c===void 0?!1:c,u=_e(o,e,"click",d===void 0?"path":d);if(!u)return;const p=l??u.resolvedPath;if(m&&Bs()&&await Ks(p))return;if(s&&r){r.openFile(p,u.line,u.column);return}const g=fe.getState();u.line?g.openContextFileAtLine(e,p,u.line,u.column??1):g.openContextFile(e,p),i?.openFiles()},n[0]=e,n[1]=r,n[2]=s,n[3]=i,n[4]=a):a=n[4],a}function Ko(){const n=z.c(5),{directory:e}=oe(),t=mt(),r=b.useRef(!1);let s,i;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>(r.current=!0,()=>{r.current=!1}),i=[],n[0]=s,n[1]=i):(s=n[0],i=n[1]),b.useEffect(s,i);let a;return n[2]!==e||n[3]!==t?(a=async o=>{const l=_e(o,e);if(!l)return;const c=ue(),d=await zo(l.resolvedPath,e),m=d==="missing"&&!/[\\/]/.test(l.path)?await Zn(l.path,e):[];!r.current||ue()!==c||(d==="failed"||!m||m.length>1?Zt(l.resolvedPath,{reason:"unreadable",message:null}):d==="missing"&&m.length===0?Zt(l.resolvedPath,{reason:"missing"}):await t(o,m[0]??l.resolvedPath))},n[2]=e,n[3]=t,n[4]=a):a=n[4],a}function Vo(){const n=z.c(5),e=b.useContext(vn),{t}=ge(),r=e?.files,s=e?.runtime.platform;let i;e:{let a;n[0]!==r?(a=r?.revealPath?.bind(r),n[0]=r,n[1]=a):a=n[1];const o=a;if(!o||!s||s==="vscode"||Us(s)){i=null;break e}let l;n[2]!==o||n[3]!==t?(l=c=>{o(c).catch(()=>{yt.error(t("sidebarFilesTree.toast.revealFailed"))})},n[2]=o,n[3]=t,n[4]=l):l=n[4],i=l}return i}const Ho=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),qo=(n,e,t)=>{if(!n||!t&&(n.startsWith("--")||n.includes("://")||/[<>]/.test(n)||/\s{2,}/.test(n))||!t&&e==="probe"&&n.includes("@")&&!n.includes("/"))return!1;const s=_o(n).split("/").filter(Boolean).pop()??"";if(!s||s==="."||s==="..")return!1;const i=s.toLowerCase();return Ho.has(i)||i.startsWith(".")&&i.length>1?!0:s.endsWith(".")?!1:e==="click"?/\.[A-Za-z0-9_-]{1,16}$/.test(s):/\.[A-Za-z][A-Za-z0-9_-]{0,15}$/.test(s)};function _e(n,e,t="probe",r="path"){const s=/^\s*file:/i.test(n),i=Lo(s?Gn(n)??n:n),a=r==="href"&&!s;if(i&&a){if(i.path.startsWith("//")||/^[A-Za-z][A-Za-z\d+.-]*:/.test(i.path)&&!/^[A-Za-z]:[\\/]/.test(i.path))return null;try{i.path=decodeURIComponent(i.path)}catch{}}if(!i||!e||!qo(i.path,t,a))return null;const o=_r(e,i.path,{preserveWhitespace:a});return o?{...i,resolvedPath:o}:null}async function Yn(n,e,t="path"){const r=_e(n,e,"probe",t);return r?!jt(r.resolvedPath,e)||await Do(r.resolvedPath,e)?r.resolvedPath:/[\\/]/.test(r.path)?null:Bo(r.path,e):null}async function Go(n,e,t,r=s=>Yn(s,e)){if(n.length>2e5)return[];let s=tn.get(n);if(!s){s=Array.from(n.matchAll(Ao),l=>({raw:l[0],start:l.index}));const o=n.length*2+s.reduce((l,c)=>l+c.raw.length*2+32,0);o<=1024*1024&&tn.set(n,s,o)}const i=s.filter(o=>_e(o.raw,e)).slice(0,t);return(await Promise.all(i.map(async o=>{const l=await r(o.raw);return l?{start:o.start,end:o.start+o.raw.length,raw:o.raw,path:l}:null}))).filter(o=>o!==null)}const Xo=n=>{const e=Hs.getState().ordered;return Or(Dr.getState().ordered)(n)||Fr(e,zr.getState().identities).match(n)?!0:Wr(n,e)!==null},Jn=(n,e,t,r)=>{const s=Cn.getState().guests.find(a=>a.id===n.guestId);if(!s||!Ir(s,"links"))return!1;if(n.action==="attach")return n.url?(Tr.getState().setPendingGuestIssue(Vs({providerId:s.id,id:n.identifier,title:n.identifier,url:n.url})),!0):!1;if(!Mn(s))return e==="link"?!1:(yt.info(r("chat.chatInput.toast.guestNotOnPhone",{name:s.name})),!0);const i=n.url?{kind:"link",identifier:n.identifier,url:n.url}:{kind:"link",identifier:n.identifier};return $r(s,i,t)?!0:e==="link"?!1:(yt.info(r("chat.guestLink.noProject",{name:s.name})),!0)};function Qn(n,e){const t=z.c(8),r=e===void 0?"path":e,{directory:s,fileReferences:i,confirmFile:a}=oe();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=ue(),t[0]=o):o=t[0];const l=o,[c,d]=b.useState(null);let m,f;return t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==n?(m=()=>{if(!i)return;let u=!0;return a(n,r).then(p=>{u&&l===ue()&&d(p?{raw:n,inputKind:r,directory:s,runtimeKey:l,path:p}:null)}),()=>{u=!1}},f=[n,r,s,i,l,a],t[1]=a,t[2]=s,t[3]=i,t[4]=r,t[5]=n,t[6]=m,t[7]=f):(m=t[6],f=t[7]),b.useEffect(m,f),i&&c?.raw===n&&c.inputKind===r&&c.directory===s&&c.runtimeKey===l?c.path:null}const Zo=32;function Yo(n){const e=z.c(24);let t,r,s;e[0]!==n?({children:r,node:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]!==t?.children?(i=t?.children.map(Jo).join("")??"",e[4]=t?.children,e[5]=i):i=e[5];const a=i,o=Qn(a),l=mt(),c=Ko(),{directory:d,fileNavigation:m,fileReferences:f}=oe();let u;e[6]!==l||e[7]!==o||e[8]!==a?(u=R=>{o&&De(R,N=>{l(a,o,N)})},e[6]=l,e[7]=o,e[8]=a,e[9]=u):u=e[9];const p=u,g=m&&!f&&_e(a,d)!==null;let w;e[10]!==c||e[11]!==a?(w=R=>{R.currentTarget.closest('a, button, [role="button"], summary')||De(R,()=>{c(a)})},e[10]=c,e[11]=a,e[12]=w):w=e[12];const M=w,v=a.length>0&&a.length<=Zo?"":void 0,x=o?"true":void 0,k=o?a:void 0,S=o??void 0,C=o?"button":void 0,y=o?0:void 0,j=o?p:g?M:void 0,P=o?p:void 0;let I;return e[13]!==r||e[14]!==s||e[15]!==j||e[16]!==P||e[17]!==v||e[18]!==x||e[19]!==k||e[20]!==S||e[21]!==C||e[22]!==y?(I=h.jsx("code",{...s,dir:"ltr","data-streamdown":"inline-code","data-short":v,"data-openchamber-file-link":x,"data-openchamber-file-ref":k,"data-openchamber-file-path":S,role:C,tabIndex:y,onClick:j,onKeyDown:P,children:r}),e[13]=r,e[14]=s,e[15]=j,e[16]=P,e[17]=v,e[18]=x,e[19]=k,e[20]=S,e[21]=C,e[22]=y,e[23]=I):I=e[23],I}function Jo(n){return n.type==="text"?n.value:""}function Qo(n){const e=z.c(10),{purpose:t}=oe();if(t){let s,i;if(e[0]!==n){const{node:l,children:c,...d}=n;s=c,i=d,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];let a;e[3]!==s?(a=h.jsx(Be.Provider,{value:!0,children:s}),e[3]=s,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=h.jsx("a",{...i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o}let r;return e[8]!==n?(r=h.jsx(na,{...n}),e[8]=n,e[9]=r):r=e[9],r}function ea(n){const e=z.c(3),{src:t}=n,[r,s]=b.useState(!1);if(r)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(!0),e[0]=i):i=e[0];let a;return e[1]!==t?(a=h.jsx("span",{"data-message-image-export-exclude":"true",className:"me-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle",children:h.jsx("img",{src:t,alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",className:"size-3.5 rounded-sm",onError:i})}),e[1]=t,e[2]=a):a=e[2],a}const er=n=>{if(!n)return"";let e="";const t=r=>{r.type==="text"?e+=r.value:r.type==="element"&&r.children.forEach(t)};return n.children.forEach(t),e.trim()},nn=n=>n.metaKey||n.ctrlKey||n.shiftKey||n.altKey;function ta(n){const e=z.c(25),{identifier:t,className:r,children:s}=n,{guestLinks:i,directory:a}=oe(),{t:o}=ge();let l;e[0]!==i||e[1]!==t?(l=i?bn(i,t):null,e[0]=i,e[1]=t,e[2]=l):l=e[2];const c=l;let d;e[3]!==c?(d=S=>c?S.guests.find(C=>C.id===c.guestId):void 0,e[3]=c,e[4]=d):d=e[4];const m=Cn(d),f=m?.name,u=Et(a);if(!c||!m||!f){let S;return e[5]!==s?(S=h.jsx(h.Fragment,{children:s}),e[5]=s,e[6]=S):S=e[6],S}const p=c.action==="open"&&!Mn(m)?c.url:void 0;let g;e[7]!==c||e[8]!==a||e[9]!==u||e[10]!==p||e[11]!==o?(g=S=>{"key"in S&&S.key!=="Enter"&&S.key!==" "||(S.preventDefault(),S.stopPropagation(),p?u(p):Jn(c,"identifier",a,o))},e[7]=c,e[8]=a,e[9]=u,e[10]=p,e[11]=o,e[12]=g):g=e[12];const w=g;let M;e[13]!==c.action||e[14]!==t||e[15]!==f||e[16]!==p||e[17]!==o?(M=p||(c.action==="open"?o("chat.guestLink.open",{identifier:t,name:f}):o("chat.guestLink.attach",{identifier:t,name:f})),e[13]=c.action,e[14]=t,e[15]=f,e[16]=p,e[17]=o,e[18]=M):M=e[18];const v=M,x=r?`${r} cursor-pointer`:"cursor-pointer";let k;return e[19]!==w||e[20]!==s||e[21]!==c.guestId||e[22]!==v||e[23]!==x?(k=h.jsx("a",{role:"button",tabIndex:0,className:x,"data-oc-guest-link":c.guestId,title:v,"aria-label":v,onClick:w,onKeyDown:w,children:s}),e[19]=w,e[20]=s,e[21]=c.guestId,e[22]=v,e[23]=x,e[24]=k):k=e[24],k}function na(n){const e=z.c(23);let t,r,s,i;if(e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]),r?.properties.dataOcGuestLink!==void 0){let o;e[5]!==r?(o=er(r),e[5]=r,e[6]=o):o=e[6];let l;return e[7]!==s||e[8]!==i.className||e[9]!==o?(l=h.jsx(ta,{identifier:o,className:i.className,children:s}),e[7]=s,e[8]=i.className,e[9]=o,e[10]=l):l=e[10],l}if(!t){let o;if(e[11]!==i){const{target:d,rel:m,...f}=i;o=f,e[11]=i,e[12]=o}else o=e[12];let l;e[13]!==s?(l=h.jsx(Be.Provider,{value:!0,children:s}),e[13]=s,e[14]=l):l=e[14];let c;return e[15]!==o||e[16]!==l?(c=h.jsx("a",{...o,children:l}),e[15]=o,e[16]=l,e[17]=c):c=e[17],c}let a;return e[18]!==t||e[19]!==r||e[20]!==s||e[21]!==i?(a=h.jsx(ra,{href:t,node:r,...i,children:s}),e[18]=t,e[19]=r,e[20]=s,e[21]=i,e[22]=a):a=e[22],a}function ra(n){const e=z.c(120);let t,r,s,i;e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]);let a;e[5]!==s?(a=h.jsx(Be.Provider,{value:!0,children:s}),e[5]=s,e[6]=a):a=e[6];const o=a,l=oe(),{directory:c}=l,{t:d}=ge(),m=Et(c),f=mt(),u=pe(),p=fe(ia);let g;e[7]!==r?(g=er(r),e[7]=r,e[8]=g):g=e[8];const w=g;let M;e[9]!==t?(M=Ur(t),e[9]=t,e[10]=M):M=e[10];const v=M,x=Br(t);let k;e[11]!==t?(k=Kr(t),e[11]=t,e[12]=k):k=e[12];const S=k,C=Se()?null:Vr(t,Hr());let y;e[13]!==t?(y=Se()?null:On(t),e[13]=t,e[14]=y):y=e[14];const j=y,P=b.useContext(qr),I=C?P.get(Gr(C)):void 0,R=b.useContext(Xr);let N;e[15]!==t||e[16]!==R?(N=R.get(t),e[15]=t,e[16]=R,e[17]=N):N=e[17];const O=N;let E;e[18]!==t?(E=xn(t),e[18]=t,e[19]=E):E=e[19];const A=E;let W;e[20]!==c||e[21]!==t||e[22]!==l.fileNavigation?(W=l.fileNavigation&&_e(t,c,"click","href"),e[20]=c,e[21]=t,e[22]=l.fileNavigation,e[23]=W):W=e[23];const L=W,_=Vo();let U;e[24]!==L||e[25]!==t||e[26]!==l.fileNavigation||e[27]!==_?(U=l.fileNavigation&&!L&&_?Gn(t):null,e[24]=L,e[25]=t,e[26]=l.fileNavigation,e[27]=_,e[28]=U):U=e[28];const K=U,Z=!!(L||K||A||C||v||x||S),J=Z?t:w,T=Qn(J,Z?"href":"path"),D=!!(T&&!Z);let G;e[29]!==t?(G=Zr(t),e[29]=t,e[30]=G):G=e[30];const V=G,q=r?.properties.dataOcReference!==void 0;let F;e[31]!==V||e[32]!==t||e[33]!==T||e[34]!==q?(F=V&&!T&&!q?Yr(t):null,e[31]=V,e[32]=t,e[33]=T,e[34]=q,e[35]=F):F=e[35];const H=F;let Y;e[36]!==c||e[37]!==t||e[38]!==p||e[39]!==l.loopbackPreview?(Y=l.loopbackPreview&&Jr(t)&&c&&!(qs()&&p),e[36]=c,e[37]=t,e[38]=p,e[39]=l.loopbackPreview,e[40]=Y):Y=e[40];const X=Y,te=l.guestLinks&&V&&!C&&!A&&!L&&!K&&!D&&!v&&!x&&!S&&!j?Qr(l.guestLinks,t):null;let le;e[41]!==A||e[42]!==c||e[43]!==V||e[44]!==L||e[45]!==K||e[46]!==te||e[47]!==t||e[48]!==u||e[49]!==m||e[50]!==f||e[51]!==T||e[52]!==l.disableLinkSafety||e[53]!==_||e[54]!==C||e[55]!==v||e[56]!==d||e[57]!==w||e[58]!==D?(le=$=>{if(!(u?.documentAssets&&ti($,u.documentAssets))){if(D&&T){De($,ae=>{f(w,T,ae)});return}if(C&&(!V||!($.metaKey||$.ctrlKey||$.shiftKey||$.altKey))){$.preventDefault(),rs(C.sessionId,C.messageId);return}if(A){$.preventDefault(),$.stopPropagation(),Wt(t);return}if(!v){if(L){De($,ae=>{f(t,T??void 0,ae,"href")});return}if(K&&_){De($,()=>_(K));return}if(t.startsWith("#")&&!u?.documentAssets){$.preventDefault();const ae=decodeURIComponent(t.slice(1)),de=$.currentTarget.closest("[data-markdown-content]");(de?Array.from(de.querySelectorAll("[id]")).find(Ve=>Ve.id===ae):null)?.scrollIntoView({block:"nearest"});return}if(te&&!nn($)&&!Xo(t)&&Jn(te,"link",c,d)){$.preventDefault(),$.stopPropagation();return}V&&!l.disableLinkSafety&&!nn($)&&($.preventDefault(),$.stopPropagation(),m(t))}}},e[41]=A,e[42]=c,e[43]=V,e[44]=L,e[45]=K,e[46]=te,e[47]=t,e[48]=u,e[49]=m,e[50]=f,e[51]=T,e[52]=l.disableLinkSafety,e[53]=_,e[54]=C,e[55]=v,e[56]=d,e[57]=w,e[58]=D,e[59]=le):le=e[59];const ie=le;if(S){const $=S.openable?Ft:es,ae=S.openable?S.filename:void 0,de=S.openable?"button":void 0,Ye=S.openable?0:void 0,Ve=`#${S.iconId}`;let Ae;e[60]!==Ve?(Ae=h.jsx("svg",{className:"size-[1.1em] shrink-0","aria-hidden":"true",children:h.jsx("use",{href:Ve})}),e[60]=Ve,e[61]=Ae):Ae=e[61];let Ie;e[62]!==S.filename?(Ie=h.jsx("span",{className:zt,children:S.filename}),e[62]=S.filename,e[63]=Ie):Ie=e[63];let Je;return e[64]!==S.filename||e[65]!==S.iconId||e[66]!==$||e[67]!==ae||e[68]!==de||e[69]!==Ye||e[70]!==Ae||e[71]!==Ie?(Je=h.jsxs("span",{className:$,"data-attachment-citation":S.iconId,"data-attachment-open":ae,role:de,tabIndex:Ye,title:S.filename,children:[Ae,Ie]}),e[64]=S.filename,e[65]=S.iconId,e[66]=$,e[67]=ae,e[68]=de,e[69]=Ye,e[70]=Ae,e[71]=Ie,e[72]=Je):Je=e[72],Je}if(j){let $;e[73]!==j.kind||e[74]!==j.source?($=()=>si({source:j.source,confirmed:j.kind==="path"}),e[73]=j.kind,e[74]=j.source,e[75]=$):$=e[75];let ae;e[76]===Symbol.for("react.memo_cache_sentinel")?(ae=h.jsx(he,{name:"download",className:"size-4"}),e[76]=ae):ae=e[76];let de;return e[77]!==o||e[78]!==$?(de=h.jsxs(ve,{type:"button",variant:"outline",size:"sm",className:"my-1 align-middle",onClick:$,children:[ae,o]}),e[77]=o,e[78]=$,e[79]=de):de=e[79],de}if(C&&I){let $;return e[80]!==I||e[81]!==C?($=h.jsx(ss,{chip:I,target:C}),e[80]=I,e[81]=C,e[82]=$):$=e[82],$}if(O){let $;return e[83]!==O.chip||e[84]!==O.url?($=h.jsx(ts,{chip:O.chip,url:O.url}),e[83]=O.chip,e[84]=O.url,e[85]=$):$=e[85],$}if(x)return h.jsx("a",{"data-openchamber-agent-mention":"true",className:"text-primary hover:underline",href:ns(x),target:"_blank",rel:"noopener noreferrer",children:o});let B;e[86]!==H?(B=H&&h.jsx(ea,{src:H}),e[86]=H,e[87]=B):B=e[87];const Q=w===t?"ltr":i.dir,ce=v?Ft:i.className,ne=v??void 0,re=v?`$${v}`:i.title,ee=T?"true":void 0,me=T?J:void 0,Ze=T??void 0;let we;e[88]!==A||e[89]!==t?(we=$=>{A&&($.preventDefault(),$.button===1&&Wt(t))},e[88]=A,e[89]=t,e[90]=we):we=e[90];const Ke=A?sa:void 0;let ye;e[91]!==v?(ye=v&&h.jsx(he,{name:"book-open",className:"size-[1.1em] shrink-0"}),e[91]=v,e[92]=ye):ye=e[92];let xe;e[93]!==o||e[94]!==v?(xe=v?h.jsx("span",{className:zt,children:v}):o,e[93]=o,e[94]=v,e[95]=xe):xe=e[95];let be;e[96]!==ie||e[97]!==t||e[98]!==i||e[99]!==Q||e[100]!==ce||e[101]!==ne||e[102]!==re||e[103]!==ee||e[104]!==me||e[105]!==Ze||e[106]!==we||e[107]!==Ke||e[108]!==ye||e[109]!==xe?(be=h.jsxs("a",{...i,href:t,target:"_blank",rel:"noopener noreferrer",dir:Q,className:ce,"data-skill-name":ne,title:re,"data-openchamber-file-link":ee,"data-openchamber-file-ref":me,"data-openchamber-file-path":Ze,onClick:ie,onAuxClick:we,onDragStart:Ke,children:[ye,xe]}),e[96]=ie,e[97]=t,e[98]=i,e[99]=Q,e[100]=ce,e[101]=ne,e[102]=re,e[103]=ee,e[104]=me,e[105]=Ze,e[106]=we,e[107]=Ke,e[108]=ye,e[109]=xe,e[110]=be):be=e[110];let ke;e[111]!==c||e[112]!==t||e[113]!==X||e[114]!==d?(ke=X&&h.jsx(Oe,{label:d("terminalView.preview.openTitle"),children:h.jsx(ve,{variant:"ghost",size:"xs",className:"ms-1 align-middle","data-export-ignore":!0,"aria-label":d("terminalView.preview.open"),onClick:()=>fe.getState().openContextPreview(c,t),children:h.jsx(he,{name:"global",className:"size-3.5"})})}),e[111]=c,e[112]=t,e[113]=X,e[114]=d,e[115]=ke):ke=e[115];let Le;return e[116]!==B||e[117]!==be||e[118]!==ke?(Le=h.jsxs(h.Fragment,{children:[B,be,ke]}),e[116]=B,e[117]=be,e[118]=ke,e[119]=Le):Le=e[119],Le}function sa(n){return n.preventDefault()}function ia(n){return n.openLinksInBrowserPanel}const oa=()=>Nt(()=>import("./MarkdownDiffPreview-BRsvVmm6.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200])).then(n=>n.default),aa=()=>{};function la(n){const e=z.c(7),{source:t,incomplete:r}=n;let s;e[0]!==r||e[1]!==t?(s=!r&&!is(t),e[0]=r,e[1]=t,e[2]=s):s=e[2];const i=s,a=os(i,oa,aa);let o;return e[3]!==a||e[4]!==i||e[5]!==t?(o=h.jsx("div",{"data-streamdown":"code-block-body","data-language":"diff",children:i&&a?h.jsx(a,{source:t}):h.jsx(as,{diff:t})}),e[3]=a,e[4]=i,e[5]=t,e[6]=o):o=e[6],o}const ca=b.memo(function(e){const t=z.c(5),{tokens:r}=e,s=r.length===0||r.length===1&&r[0].content==="";let i;t[0]!==s||t[1]!==r?(i=s?`
|
|
4
4
|
`:r.map(wa),t[0]=s,t[1]=r,t[2]=i):i=t[2];let a;return t[3]!==i?(a=h.jsx("span",{className:"block before:content-[counter(line)] before:[counter-increment:line]",children:i}),t[3]=i,t[4]=a):a=t[4],a}),da=b.memo(function({source:e,language:t,incomplete:r,plugin:s}){const i=b.useMemo(()=>({code:e,language:t,isIncomplete:r,themes:s.getThemes()}),[e,t,r,s]),a=b.useMemo(()=>s.cached(i),[s,i]),[o,l]=b.useState(null),c=b.useRef(null),d=b.useMemo(()=>{const f=c.current;return f?.plugin===s&&f.input.language===i.language&&i.code.startsWith(f.input.code)?f.lineage:Symbol()},[i,s]),m=b.useMemo(()=>{const f=o?.lineage===d?o:null;if(f?.input===i)return f;if(a)return{input:i,result:a};const u=c.current,p=u?.lineage===d?u.display:null;return f&&(!p||f.input.code.length>=p.input.code.length)?f:p||{input:i,result:{tokens:i.code.split(`
|
|
5
|
-
`).map(g=>[{content:g}])}}},[i,a,d,o]);return b.useLayoutEffect(()=>(c.current={input:i,plugin:s,lineage:d,display:m,exact:a!==null},()=>{c.current=null}),[i,s,d,m,a]),b.useEffect(()=>{const f=p=>{const g=c.current;g?.lineage!==d||!g.input.code.startsWith(i.code)||g.exact&&g.input!==i||i.code.length<g.display.input.code.length||l(w=>w?.input===g.input&&i!==g.input||w?.lineage===d&&(w.input.code.length>i.code.length||w.input===i&&w.result===p)?w:{input:i,result:p,lineage:d})},u=s.highlight(i,f);u&&f(u)},[s,i,d]),h.jsx("div",{"data-streamdown":"code-block-body","data-language":t,children:h.jsx("pre",{children:h.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:m.result.tokens.map((f,u)=>h.jsx(ca,{tokens:f},u))})})})}),ua=/<script|\son[a-z]+\s*=/i,tr=n=>/language-([^\s]+)/.exec(n??"")?.[1]??"",Tt=n=>(n?.children.map(e=>e.type==="text"?e.value:"").join("")??"").replace(/\n$/,""),fa=fs(()=>Nt(()=>import("./ReplyCommand-CLNJlG5f.js"),__vite__mapDeps([201,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(n=>n.ReplyCommandCode));function ma(n){const e=z.c(8),{reply:t,...r}=n,{directory:s}=oe(),i=fa();if(!i)return h.jsx(vt,{...r,command:null});const a=Tt(r.node);let o;e[0]!==r?(o=c=>h.jsx(vt,{...r,command:c}),e[0]=r,e[1]=o):o=e[1];let l;return e[2]!==i||e[3]!==s||e[4]!==t||e[5]!==a||e[6]!==o?(l=h.jsx(i,{reply:t,directory:s,source:a,children:o}),e[2]=i,e[3]=s,e[4]=t,e[5]=a,e[6]=o,e[7]=l):l=e[7],l}function ha(n){const e=z.c(9),{settledReply:t}=oe(),r=ls();let s;e[0]!==n.className||e[1]!==n.node||e[2]!==t||e[3]!==r?(s=t!==null&&r!=="peek"&&cs(tr(n.className))&&Tt(n.node).trim().length>0,e[0]=n.className,e[1]=n.node,e[2]=t,e[3]=r,e[4]=s):s=e[4];const i=s;let a;return e[5]!==n||e[6]!==i||e[7]!==t?(a=i?h.jsx(ma,{...n,reply:t}):h.jsx(vt,{...n,command:null}),e[5]=n,e[6]=i,e[7]=t,e[8]=a):a=e[8],a}function vt(n){const e=z.c(79);let t,r,s,i,a;e[0]!==n?({children:t,className:r,node:i,command:s,...a}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a):(t=e[1],r=e[2],s=e[3],i=e[4],a=e[5]);const o=oe(),{t:l}=ge(),c=fe(ga),d=Is(),m=mt(),[f,u]=b.useState(!1),[p,g]=b.useState(null),w=b.useRef(null);let M,v;e[6]===Symbol.for("react.memo_cache_sentinel")?(M=()=>()=>{w.current&&clearTimeout(w.current)},v=[],e[6]=M,e[7]=v):(M=e[6],v=e[7]),b.useEffect(M,v);const x=b.useContext(ds);let k,S,C;e[8]!==r||e[9]!==x?(k=tr(r),S=x!==null&&ms(k),C=k.toLowerCase()==="diff"||S,e[8]=r,e[9]=x,e[10]=k,e[11]=S,e[12]=C):(k=e[10],S=e[11],C=e[12]);const y=C;let j;e[13]!==i?.children?(j=i?.children.map(pa).join("")??"",e[13]=i?.children,e[14]=j):j=e[14];const P=j;let I;e[15]!==i?(I=Tt(i),e[15]=i,e[16]=I):I=e[16];const R=I,{purpose:N,onExportCode:O}=o;let E,A;if(e[17]!==P||e[18]!==k||e[19]!==O||e[20]!==N?(E=()=>{N&&k!=="mermaid"&&O?.(P,k)},A=[N,O,P,k],e[17]=P,e[18]=k,e[19]=O,e[20]=N,e[21]=E,e[22]=A):(E=e[21],A=e[22]),b.useLayoutEffect(E,A),k==="svg"&&o.svgFences&&!ua.test(P)&&p!==P){let F;e[23]!==P?(F=()=>g(P),e[23]=P,e[24]=F):F=e[24];let H;e[25]!==t||e[26]!==r||e[27]!==i||e[28]!==a?(H=h.jsx(We.code,{...a,node:i,className:r,children:t}),e[25]=t,e[26]=r,e[27]=i,e[28]=a,e[29]=H):H=e[29];let Y;return e[30]!==F||e[31]!==H?(Y=h.jsx(Un.Provider,{value:F,children:H}),e[30]=F,e[31]=H,e[32]=Y):Y=e[32],Y}if(k==="mermaid"||k==="openui-lang"&&o.uiBlocks){let F;return e[33]!==t||e[34]!==r||e[35]!==i||e[36]!==a?(F=h.jsx(We.code,{...a,node:i,className:r,children:t}),e[33]=t,e[34]=r,e[35]=i,e[36]=a,e[37]=F):F=e[37],F}let W;e[38]!==m||e[39]!==o.fileNavigation?(W=F=>{if(!o.fileNavigation||!(F.target instanceof Element))return;const H=F.target.closest('[data-openchamber-file-link="true"]'),Y=H?.getAttribute("data-openchamber-file-ref");Y&&De(F,X=>{m(Y,H?.getAttribute("data-openchamber-file-path")??void 0,X)})},e[38]=m,e[39]=o.fileNavigation,e[40]=W):W=e[40];const L=W;let _;e[41]!==R?(_=async()=>{(await ut(R)).ok&&(u(!0),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>u(!1),2e3))},e[41]=R,e[42]=_):_=e[42];const U=_,K=c?"true":"false";let Z;e[43]!==k||e[44]!==y||e[45]!==S||e[46]!==l?(Z=S?l("chat.markdown.suggestion.title"):y?l("markdownRenderer.code.proposal"):k.toLowerCase()||"text",e[43]=k,e[44]=y,e[45]=S,e[46]=l,e[47]=Z):Z=e[47];let J;e[48]!==Z?(J=h.jsx(Ts,{language:Z}),e[48]=Z,e[49]=J):J=e[49];let T;e[50]!==s?.button||e[51]!==f||e[52]!==U||e[53]!==y||e[54]!==N||e[55]!==l||e[56]!==c?(T=!N&&h.jsx("div",{className:"pointer-events-none absolute top-0 end-0 flex items-center",children:h.jsxs("div",{"data-streamdown":"code-block-actions",className:"pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur",children:[s?.button,!y&&h.jsx(Oe,{label:l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),children:h.jsx(ve,{variant:"ghost",size:"xs","data-export-ignore":!0,className:c?jn:void 0,"aria-label":l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),"aria-pressed":c,onClick:()=>fe.getState().setCodeBlockLineWrap(!c),children:h.jsx(he,{name:"text-wrap",className:"size-3.5"})})}),h.jsx(Oe,{label:l(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),children:h.jsx(ve,{variant:"ghost",size:"xs","data-export-ignore":!0,"aria-label":l(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),onClick:U,children:h.jsx(he,{name:f?"check":"file-copy",className:"size-3.5"})})})]})}),e[50]=s?.button,e[51]=f,e[52]=U,e[53]=y,e[54]=N,e[55]=l,e[56]=c,e[57]=T):T=e[57];let D;e[58]!==R||e[59]!==d||e[60]!==k||e[61]!==o.code||e[62]!==y||e[63]!==N||e[64]!==S||e[65]!==x?(D=y&&!N?h.jsx(la,{source:S?us(R,x.excerpt):R,incomplete:d}):h.jsx(da,{source:R,language:k,incomplete:d,plugin:o.code}),e[58]=R,e[59]=d,e[60]=k,e[61]=o.code,e[62]=y,e[63]=N,e[64]=S,e[65]=x,e[66]=D):D=e[66];const G=s?.output;let V;e[67]!==d||e[68]!==k||e[69]!==J||e[70]!==T||e[71]!==D||e[72]!==G?(V=h.jsxs($s,{language:k,isIncomplete:d,dir:"ltr",children:[J,T,D,G]}),e[67]=d,e[68]=k,e[69]=J,e[70]=T,e[71]=D,e[72]=G,e[73]=V):V=e[73];let q;return e[74]!==R||e[75]!==L||e[76]!==K||e[77]!==V?(q=h.jsx("div",{"data-code-wrap":K,"data-oc-code-source":R,onClick:L,onKeyDown:L,children:V}),e[74]=R,e[75]=L,e[76]=K,e[77]=V,e[78]=q):q=e[78],q}function pa(n){return n.type==="text"?n.value:""}function ga(n){return n.codeBlockLineWrap}function wa(n,e){const t={...n.htmlStyle,color:n.color,backgroundColor:n.bgColor};return h.jsx("span",{style:t,...n.htmlAttrs,children:n.content},e)}const ya=["csv","tsv","md"],xa=["csv","md"],rn=n=>n==="md"?"Markdown":n.toUpperCase(),sn=n=>n.replace(/\\/g,"\\\\").replace(/\|/g,"\\|"),nr=b.createContext(new Map),rr=b.createContext(null),sr=n=>n.type==="text"?n.value:n.type==="element"?n.children.map(sr).join(""):"",ba=n=>{const e=n?.children.find(t=>t.type==="element"&&t.tagName==="thead");return e?sr(e):""};function on(n){const e=z.c(36);let t,r,s;e[0]!==n?({node:t,style:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const i=b.useContext(nr),a=t?i.get(t):void 0,o=b.useContext(rr),{t:l}=ge(),c=t?.tagName==="th"?We.th:We.td,d=a?"normal":"nowrap";let m;e[4]!==s||e[5]!==d?(m={...s,"--oc-table-code-wrap":d},e[4]=s,e[5]=d,e[6]=m):m=e[6];const f=m;let u;e[7]!==t||e[8]!==o?.columnOf?(u=t?.tagName==="th"?o?.columnOf.get(t):void 0,e[7]=t,e[8]=o?.columnOf,e[9]=u):u=e[9];const p=u;if(!o||p===void 0){let j;return e[10]!==c||e[11]!==f||e[12]!==t||e[13]!==r?(j=h.jsx(c,{...r,node:t,style:f}),e[10]=c,e[11]=f,e[12]=t,e[13]=r,e[14]=j):j=e[14],j}let g;e[15]!==f?(g={...f,position:"relative"},e[15]=f,e[16]=g):g=e[16];const w=r.children,M=String(p+1);let v;e[17]!==l||e[18]!==M?(v=l("filesView.artifact.table.resizeColumn",{column:M}),e[17]=l,e[18]=M,e[19]=v):v=e[19];let x,k,S;e[20]!==p||e[21]!==o?(k=j=>o.onResize(p,j),S=j=>o.onResizeEnd(p,j),x=()=>o.onReset(p),e[20]=p,e[21]=o,e[22]=x,e[23]=k,e[24]=S):(x=e[22],k=e[23],S=e[24]);let C;e[25]!==x||e[26]!==v||e[27]!==k||e[28]!==S?(C=h.jsx(ai,{label:v,onResize:k,onResizeEnd:S,onReset:x}),e[25]=x,e[26]=v,e[27]=k,e[28]=S,e[29]=C):C=e[29];let y;return e[30]!==c||e[31]!==t||e[32]!==r||e[33]!==C||e[34]!==g?(y=h.jsxs(c,{...r,node:t,style:g,children:[w,C]}),e[30]=c,e[31]=t,e[32]=r,e[33]=C,e[34]=g,e[35]=y):y=e[35],y}const st=120,ka=280;function va(n,e,t){const r=n.map(a=>Math.min(Math.max(st,e||320),a));if(!t||e<=0)return r;let s=r.map((a,o)=>o),i=e;for(;s.length;){const a=i/s.length,o=s.filter(l=>r[l]<=a);if(!o.length){const l=a<st?ka:Math.floor(a);for(const c of s)r[c]=Math.max(Math.min(st,n[c]),Math.min(n[c],l));break}for(const l of o)i-=r[l];s=s.filter(l=>r[l]>a)}return r}function Sa(n,e){const t=e.ownerDocument.createElement("div");t.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden";const r=n.map(a=>{const o=a.ownerDocument.createElement(a.localName);for(const{name:l,value:c}of Array.from(a.attributes))o.setAttribute(l,c);return o.append(...Array.from(a.childNodes,l=>l.cloneNode(!0))),o.style.cssText="display:block;width:max-content",t.append(o),o});e.append(t);const s=r.map(a=>a.getBoundingClientRect().width);for(const a of r)a.style.width="min-content";const i=r.map((a,o)=>Math.ceil(Math.max(Math.min(s[o],st),a.getBoundingClientRect().width))+1);return t.remove(),i}function ir(n,e){if(n.nodeType===Node.TEXT_NODE){const t=n.textContent??"";return e?sn(t):t}if(n instanceof HTMLAnchorElement){const t=n.getAttribute("href");if(t){const r=t.replace(/ /g,"%20");if(!e)return r;const s=sn(n.textContent??"").replace(/\[/g,"\\[").replace(/\]/g,"\\]"),i=r.replace(/\|/g,"%7C"),a=/[()]/.test(i)?`<${i.replace(/</g,"%3C").replace(/>/g,"%3E")}>`:i;return`[${s}](${a})`}}return Array.from(n.childNodes).map(t=>ir(t,e)).join("")}function an(n,e){const t=Array.from(n.rows).map(s=>Array.from(s.cells).map(i=>ir(i,e==="md").trim())),r={headers:t[0]??[],rows:t.slice(1)};return e==="csv"?Os(r):e==="tsv"?Ds(r):[r.headers,r.headers.map(()=>"---"),...r.rows].map(s=>`| ${s.join(" | ")} |`).join(`
|
|
5
|
+
`).map(g=>[{content:g}])}}},[i,a,d,o]);return b.useLayoutEffect(()=>(c.current={input:i,plugin:s,lineage:d,display:m,exact:a!==null},()=>{c.current=null}),[i,s,d,m,a]),b.useEffect(()=>{const f=p=>{const g=c.current;g?.lineage!==d||!g.input.code.startsWith(i.code)||g.exact&&g.input!==i||i.code.length<g.display.input.code.length||l(w=>w?.input===g.input&&i!==g.input||w?.lineage===d&&(w.input.code.length>i.code.length||w.input===i&&w.result===p)?w:{input:i,result:p,lineage:d})},u=s.highlight(i,f);u&&f(u)},[s,i,d]),h.jsx("div",{"data-streamdown":"code-block-body","data-language":t,children:h.jsx("pre",{children:h.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:m.result.tokens.map((f,u)=>h.jsx(ca,{tokens:f},u))})})})}),ua=/<script|\son[a-z]+\s*=/i,tr=n=>/language-([^\s]+)/.exec(n??"")?.[1]??"",Tt=n=>(n?.children.map(e=>e.type==="text"?e.value:"").join("")??"").replace(/\n$/,""),fa=fs(()=>Nt(()=>import("./ReplyCommand-B-b5HiGJ.js"),__vite__mapDeps([201,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(n=>n.ReplyCommandCode));function ma(n){const e=z.c(8),{reply:t,...r}=n,{directory:s}=oe(),i=fa();if(!i)return h.jsx(vt,{...r,command:null});const a=Tt(r.node);let o;e[0]!==r?(o=c=>h.jsx(vt,{...r,command:c}),e[0]=r,e[1]=o):o=e[1];let l;return e[2]!==i||e[3]!==s||e[4]!==t||e[5]!==a||e[6]!==o?(l=h.jsx(i,{reply:t,directory:s,source:a,children:o}),e[2]=i,e[3]=s,e[4]=t,e[5]=a,e[6]=o,e[7]=l):l=e[7],l}function ha(n){const e=z.c(9),{settledReply:t}=oe(),r=ls();let s;e[0]!==n.className||e[1]!==n.node||e[2]!==t||e[3]!==r?(s=t!==null&&r!=="peek"&&cs(tr(n.className))&&Tt(n.node).trim().length>0,e[0]=n.className,e[1]=n.node,e[2]=t,e[3]=r,e[4]=s):s=e[4];const i=s;let a;return e[5]!==n||e[6]!==i||e[7]!==t?(a=i?h.jsx(ma,{...n,reply:t}):h.jsx(vt,{...n,command:null}),e[5]=n,e[6]=i,e[7]=t,e[8]=a):a=e[8],a}function vt(n){const e=z.c(79);let t,r,s,i,a;e[0]!==n?({children:t,className:r,node:i,command:s,...a}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a):(t=e[1],r=e[2],s=e[3],i=e[4],a=e[5]);const o=oe(),{t:l}=ge(),c=fe(ga),d=Is(),m=mt(),[f,u]=b.useState(!1),[p,g]=b.useState(null),w=b.useRef(null);let M,v;e[6]===Symbol.for("react.memo_cache_sentinel")?(M=()=>()=>{w.current&&clearTimeout(w.current)},v=[],e[6]=M,e[7]=v):(M=e[6],v=e[7]),b.useEffect(M,v);const x=b.useContext(ds);let k,S,C;e[8]!==r||e[9]!==x?(k=tr(r),S=x!==null&&ms(k),C=k.toLowerCase()==="diff"||S,e[8]=r,e[9]=x,e[10]=k,e[11]=S,e[12]=C):(k=e[10],S=e[11],C=e[12]);const y=C;let j;e[13]!==i?.children?(j=i?.children.map(pa).join("")??"",e[13]=i?.children,e[14]=j):j=e[14];const P=j;let I;e[15]!==i?(I=Tt(i),e[15]=i,e[16]=I):I=e[16];const R=I,{purpose:N,onExportCode:O}=o;let E,A;if(e[17]!==P||e[18]!==k||e[19]!==O||e[20]!==N?(E=()=>{N&&k!=="mermaid"&&O?.(P,k)},A=[N,O,P,k],e[17]=P,e[18]=k,e[19]=O,e[20]=N,e[21]=E,e[22]=A):(E=e[21],A=e[22]),b.useLayoutEffect(E,A),k==="svg"&&o.svgFences&&!ua.test(P)&&p!==P){let F;e[23]!==P?(F=()=>g(P),e[23]=P,e[24]=F):F=e[24];let H;e[25]!==t||e[26]!==r||e[27]!==i||e[28]!==a?(H=h.jsx(We.code,{...a,node:i,className:r,children:t}),e[25]=t,e[26]=r,e[27]=i,e[28]=a,e[29]=H):H=e[29];let Y;return e[30]!==F||e[31]!==H?(Y=h.jsx(Un.Provider,{value:F,children:H}),e[30]=F,e[31]=H,e[32]=Y):Y=e[32],Y}if(k==="mermaid"||k==="openui-lang"&&o.uiBlocks){let F;return e[33]!==t||e[34]!==r||e[35]!==i||e[36]!==a?(F=h.jsx(We.code,{...a,node:i,className:r,children:t}),e[33]=t,e[34]=r,e[35]=i,e[36]=a,e[37]=F):F=e[37],F}let W;e[38]!==m||e[39]!==o.fileNavigation?(W=F=>{if(!o.fileNavigation||!(F.target instanceof Element))return;const H=F.target.closest('[data-openchamber-file-link="true"]'),Y=H?.getAttribute("data-openchamber-file-ref");Y&&De(F,X=>{m(Y,H?.getAttribute("data-openchamber-file-path")??void 0,X)})},e[38]=m,e[39]=o.fileNavigation,e[40]=W):W=e[40];const L=W;let _;e[41]!==R?(_=async()=>{(await ut(R)).ok&&(u(!0),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>u(!1),2e3))},e[41]=R,e[42]=_):_=e[42];const U=_,K=c?"true":"false";let Z;e[43]!==k||e[44]!==y||e[45]!==S||e[46]!==l?(Z=S?l("chat.markdown.suggestion.title"):y?l("markdownRenderer.code.proposal"):k.toLowerCase()||"text",e[43]=k,e[44]=y,e[45]=S,e[46]=l,e[47]=Z):Z=e[47];let J;e[48]!==Z?(J=h.jsx(Ts,{language:Z}),e[48]=Z,e[49]=J):J=e[49];let T;e[50]!==s?.button||e[51]!==f||e[52]!==U||e[53]!==y||e[54]!==N||e[55]!==l||e[56]!==c?(T=!N&&h.jsx("div",{className:"pointer-events-none absolute top-0 end-0 flex items-center",children:h.jsxs("div",{"data-streamdown":"code-block-actions",className:"pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur",children:[s?.button,!y&&h.jsx(Oe,{label:l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),children:h.jsx(ve,{variant:"ghost",size:"xs","data-export-ignore":!0,className:c?jn:void 0,"aria-label":l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),"aria-pressed":c,onClick:()=>fe.getState().setCodeBlockLineWrap(!c),children:h.jsx(he,{name:"text-wrap",className:"size-3.5"})})}),h.jsx(Oe,{label:l(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),children:h.jsx(ve,{variant:"ghost",size:"xs","data-export-ignore":!0,"aria-label":l(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),onClick:U,children:h.jsx(he,{name:f?"check":"file-copy",className:"size-3.5"})})})]})}),e[50]=s?.button,e[51]=f,e[52]=U,e[53]=y,e[54]=N,e[55]=l,e[56]=c,e[57]=T):T=e[57];let D;e[58]!==R||e[59]!==d||e[60]!==k||e[61]!==o.code||e[62]!==y||e[63]!==N||e[64]!==S||e[65]!==x?(D=y&&!N?h.jsx(la,{source:S?us(R,x.excerpt):R,incomplete:d}):h.jsx(da,{source:R,language:k,incomplete:d,plugin:o.code}),e[58]=R,e[59]=d,e[60]=k,e[61]=o.code,e[62]=y,e[63]=N,e[64]=S,e[65]=x,e[66]=D):D=e[66];const G=s?.output;let V;e[67]!==d||e[68]!==k||e[69]!==J||e[70]!==T||e[71]!==D||e[72]!==G?(V=h.jsxs($s,{language:k,isIncomplete:d,dir:"ltr",children:[J,T,D,G]}),e[67]=d,e[68]=k,e[69]=J,e[70]=T,e[71]=D,e[72]=G,e[73]=V):V=e[73];let q;return e[74]!==R||e[75]!==L||e[76]!==K||e[77]!==V?(q=h.jsx("div",{"data-code-wrap":K,"data-oc-code-source":R,onClick:L,onKeyDown:L,children:V}),e[74]=R,e[75]=L,e[76]=K,e[77]=V,e[78]=q):q=e[78],q}function pa(n){return n.type==="text"?n.value:""}function ga(n){return n.codeBlockLineWrap}function wa(n,e){const t={...n.htmlStyle,color:n.color,backgroundColor:n.bgColor};return h.jsx("span",{style:t,...n.htmlAttrs,children:n.content},e)}const ya=["csv","tsv","md"],xa=["csv","md"],rn=n=>n==="md"?"Markdown":n.toUpperCase(),sn=n=>n.replace(/\\/g,"\\\\").replace(/\|/g,"\\|"),nr=b.createContext(new Map),rr=b.createContext(null),sr=n=>n.type==="text"?n.value:n.type==="element"?n.children.map(sr).join(""):"",ba=n=>{const e=n?.children.find(t=>t.type==="element"&&t.tagName==="thead");return e?sr(e):""};function on(n){const e=z.c(36);let t,r,s;e[0]!==n?({node:t,style:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const i=b.useContext(nr),a=t?i.get(t):void 0,o=b.useContext(rr),{t:l}=ge(),c=t?.tagName==="th"?We.th:We.td,d=a?"normal":"nowrap";let m;e[4]!==s||e[5]!==d?(m={...s,"--oc-table-code-wrap":d},e[4]=s,e[5]=d,e[6]=m):m=e[6];const f=m;let u;e[7]!==t||e[8]!==o?.columnOf?(u=t?.tagName==="th"?o?.columnOf.get(t):void 0,e[7]=t,e[8]=o?.columnOf,e[9]=u):u=e[9];const p=u;if(!o||p===void 0){let j;return e[10]!==c||e[11]!==f||e[12]!==t||e[13]!==r?(j=h.jsx(c,{...r,node:t,style:f}),e[10]=c,e[11]=f,e[12]=t,e[13]=r,e[14]=j):j=e[14],j}let g;e[15]!==f?(g={...f,position:"relative"},e[15]=f,e[16]=g):g=e[16];const w=r.children,M=String(p+1);let v;e[17]!==l||e[18]!==M?(v=l("filesView.artifact.table.resizeColumn",{column:M}),e[17]=l,e[18]=M,e[19]=v):v=e[19];let x,k,S;e[20]!==p||e[21]!==o?(k=j=>o.onResize(p,j),S=j=>o.onResizeEnd(p,j),x=()=>o.onReset(p),e[20]=p,e[21]=o,e[22]=x,e[23]=k,e[24]=S):(x=e[22],k=e[23],S=e[24]);let C;e[25]!==x||e[26]!==v||e[27]!==k||e[28]!==S?(C=h.jsx(ai,{label:v,onResize:k,onResizeEnd:S,onReset:x}),e[25]=x,e[26]=v,e[27]=k,e[28]=S,e[29]=C):C=e[29];let y;return e[30]!==c||e[31]!==t||e[32]!==r||e[33]!==C||e[34]!==g?(y=h.jsxs(c,{...r,node:t,style:g,children:[w,C]}),e[30]=c,e[31]=t,e[32]=r,e[33]=C,e[34]=g,e[35]=y):y=e[35],y}const st=120,ka=280;function va(n,e,t){const r=n.map(a=>Math.min(Math.max(st,e||320),a));if(!t||e<=0)return r;let s=r.map((a,o)=>o),i=e;for(;s.length;){const a=i/s.length,o=s.filter(l=>r[l]<=a);if(!o.length){const l=a<st?ka:Math.floor(a);for(const c of s)r[c]=Math.max(Math.min(st,n[c]),Math.min(n[c],l));break}for(const l of o)i-=r[l];s=s.filter(l=>r[l]>a)}return r}function Sa(n,e){const t=e.ownerDocument.createElement("div");t.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden";const r=n.map(a=>{const o=a.ownerDocument.createElement(a.localName);for(const{name:l,value:c}of Array.from(a.attributes))o.setAttribute(l,c);return o.append(...Array.from(a.childNodes,l=>l.cloneNode(!0))),o.style.cssText="display:block;width:max-content",t.append(o),o});e.append(t);const s=r.map(a=>a.getBoundingClientRect().width);for(const a of r)a.style.width="min-content";const i=r.map((a,o)=>Math.ceil(Math.max(Math.min(s[o],st),a.getBoundingClientRect().width))+1);return t.remove(),i}function ir(n,e){if(n.nodeType===Node.TEXT_NODE){const t=n.textContent??"";return e?sn(t):t}if(n instanceof HTMLAnchorElement){const t=n.getAttribute("href");if(t){const r=t.replace(/ /g,"%20");if(!e)return r;const s=sn(n.textContent??"").replace(/\[/g,"\\[").replace(/\]/g,"\\]"),i=r.replace(/\|/g,"%7C"),a=/[()]/.test(i)?`<${i.replace(/</g,"%3C").replace(/>/g,"%3E")}>`:i;return`[${s}](${a})`}}return Array.from(n.childNodes).map(t=>ir(t,e)).join("")}function an(n,e){const t=Array.from(n.rows).map(s=>Array.from(s.cells).map(i=>ir(i,e==="md").trim())),r={headers:t[0]??[],rows:t.slice(1)};return e==="csv"?Os(r):e==="tsv"?Ds(r):[r.headers,r.headers.map(()=>"---"),...r.rows].map(s=>`| ${s.join(" | ")} |`).join(`
|
|
6
6
|
`)}function Ca({node:n,className:e,children:t,...r}){const{purpose:s,settled:i,tableWidthScope:a}=oe(),o=fe(E=>E.tableCellWrap),l=b.useRef(null),c=b.useRef(null),[d,m]=b.useState(null),f=d?.node===n?d:null;b.useLayoutEffect(()=>{const E=l.current,A=c.current?.parentElement;if(!E||!A||!i)return;const W=E.ownerDocument.defaultView;if(!W)return;const L=()=>{const U=W.getComputedStyle(A),K=Math.max(0,A.clientWidth-(parseFloat(U.paddingInlineStart)||0)-(parseFloat(U.paddingInlineEnd)||0)-2),Z=W.getComputedStyle(E).font;if(f&&f.font!==Z){m(null);return}if(f){f.available!==K&&m({...f,available:K});return}if(K<=0)return;const J=[],T=Array.from(E.rows),D=T.filter(q=>q.parentElement?.tagName==="TBODY");for(const q of D.length?D:T)Array.from(q.cells).forEach((F,H)=>{J[H]=Math.max(J[H]??0,Math.ceil(F.getBoundingClientRect().width))});const G=T.find(q=>q.parentElement?.tagName==="THEAD"),V=G?Array.from(G.cells):[];D.length&&V.length&&E.parentElement&&Sa(V,E.parentElement).forEach((q,F)=>{J[F]=Math.max(J[F]??0,q)}),m({node:n,natural:J,available:K,font:Z})};L();const _=new ResizeObserver(L);return _.observe(A),()=>_.disconnect()},[n,f,i]);const u=a&&!s?`${a}#${ba(n)}`:null,[p,g]=b.useState(()=>u?ii(u):{}),[w,M]=b.useState(null),v=b.useMemo(()=>f?va(f.natural,f.available,o):null,[f,o]),x=b.useMemo(()=>{const E=w?{...p,[w.column]:w.width}:p;return v?.map((A,W)=>E[W]??A)??null},[v,p,w]),k=b.useMemo(()=>{if(!u||!v)return null;const E=_=>{g(_),M(null),oi(u,_)},L=n?.children.find(_=>_.type==="element"&&_.tagName==="thead")?.children.find(_=>_.type==="element"&&_.tagName==="tr")?.children.filter(_=>_.type==="element")??[];return{columnOf:new Map(L.map((_,U)=>[_,U])),onResize:(_,U)=>M({column:_,width:U}),onResizeEnd:(_,U)=>E({...p,[_]:U}),onReset:_=>{const{[_]:U,...K}=p;E(K)}}},[u,v,n,p]),S=x?.map((E,A)=>h.jsx("col",{style:{width:E}},A)),C=x&&f?x.map((E,A)=>f.natural[A]>E?"1":"0").join(""):"",y=b.useMemo(()=>{const E=new Map;for(const A of n?.children??[])if(A.type==="element")for(const W of A.children){if(W.type!=="element"||W.tagName!=="tr")continue;W.children.filter(_=>_.type==="element").forEach((_,U)=>E.set(_,C[U]==="1"))}return E},[n,C]),[j,P]=b.useState(!1),I=b.useRef(null),{t:R}=ge();b.useEffect(()=>()=>{I.current&&clearTimeout(I.current)},[]);const N=async E=>{!l.current||!(await ut(an(l.current,E))).ok||(P(!0),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>P(!1),2e3))},O=E=>{const A=l.current;if(!A)return;const W=URL.createObjectURL(new Blob([an(A,E)],{type:E==="csv"?"text/csv;charset=utf-8":"text/markdown;charset=utf-8"})),L=document.createElement("a");L.href=W,L.download=`table.${E}`,L.click(),URL.revokeObjectURL(W)};return h.jsxs("div",{ref:c,"data-streamdown":"table-wrapper","data-table-wrap":o?"true":"false",className:"group flex flex-col",children:[!s&&h.jsxs("div",{"data-streamdown":"table-controls","data-export-ignore":!0,className:"flex items-center justify-end gap-1",children:[h.jsx(Oe,{label:R(o?"markdownRenderer.table.actions.disableWrapTitle":"markdownRenderer.table.actions.enableWrapTitle"),children:h.jsx(ve,{variant:"ghost",size:"xs",className:o?jn:void 0,"aria-label":R(o?"markdownRenderer.table.actions.disableWrapTitle":"markdownRenderer.table.actions.enableWrapTitle"),"aria-pressed":o,onClick:()=>fe.getState().setTableCellWrap(!o),children:h.jsx(he,{name:"text-wrap",className:"size-3.5"})})}),h.jsxs(Ut,{children:[h.jsx(Oe,{label:R(j?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.table.actions.copyTitle"),children:h.jsx(Bt,{asChild:!0,children:h.jsx(ve,{variant:"ghost",size:"xs","aria-label":R(j?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.table.actions.copyTitle"),children:h.jsx(he,{name:j?"check":"file-copy",className:"size-3.5"})})})}),h.jsx(Kt,{align:"end",children:ya.map(E=>h.jsx(Vt,{onSelect:()=>{N(E)},children:rn(E)},E))})]}),h.jsxs(Ut,{children:[h.jsx(Oe,{label:R("markdownRenderer.table.actions.downloadTitle"),children:h.jsx(Bt,{asChild:!0,children:h.jsx(ve,{variant:"ghost",size:"xs","aria-label":R("markdownRenderer.table.actions.downloadTitle"),children:h.jsx(he,{name:"download",className:"size-3.5"})})})}),h.jsx(Kt,{align:"end",children:xa.map(E=>h.jsx(Vt,{onSelect:()=>O(E),children:rn(E)},E))})]})]}),h.jsx(hs,{outerClassName:"overlay-scrollbar-wrapper--no-gutter min-w-0",fillContainer:!1,children:h.jsxs("table",{...r,ref:l,"data-streamdown":"table","data-oc-table-layout":x?"fixed":i?"natural":"pending",style:x?{...r.style,width:x.reduce((E,A)=>E+A,0),tableLayout:"fixed"}:r.style,className:ot("border-collapse",e),children:[S&&h.jsx("colgroup",{children:S}),h.jsx(rr.Provider,{value:k,children:h.jsx(nr.Provider,{value:y,children:t})})]})})]})}const se=n=>Number.isFinite(n)&&n>0,ln=n=>{if(n==null)return null;const e=String(n).trim().match(/^([+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[eE][+-]?\d+)?)(?:px)?$/);if(!e)return null;const t=Number(e[1]);return se(t)?t:null},ht=(n,e,t)=>Math.min(t,Math.max(e,n)),Ma=6,cn=1.25,ja=1.0015,Ea=.5,Ra=12,dn=3,Na=400,Pa='[data-streamdown="mermaid-block"]',un=n=>[n.x,n.y,n.width,n.height].map(e=>{const t=Number(e.toFixed(Ma));return Object.is(t,-0)?"0":String(t)}).join(" "),_a=n=>{const e=n.viewBox?.trim().split(/[\s,]+/).map(s=>Number.parseFloat(s));if(e?.length===4){const[s,i,a,o]=e;if(Number.isFinite(s)&&Number.isFinite(i)&&se(a)&&se(o))return{x:s,y:i,width:a,height:o}}const t=ln(n.width),r=ln(n.height);return t===null||r===null?null:{x:0,y:0,width:t,height:r}},or=(n,e)=>{if(!se(e.width)||!se(e.height))return n;const t=n.width/n.height,r=e.width/e.height;if(t>r){const i=n.width/r;return{x:n.x,y:n.y-(i-n.height)/2,width:n.width,height:i}}const s=n.height*r;return{x:n.x-(s-n.width)/2,y:n.y,width:s,height:n.height}},La=({currentBox:n,viewport:e,delta:t})=>!se(e.width)||!se(e.height)||!se(n.width)||!se(n.height)?n:{x:n.x-t.x/e.width*n.width,y:n.y-t.y/e.height*n.height,width:n.width,height:n.height},Aa=(n,e)=>{const t=e.x-n.x,r=e.y-n.y;return t*t+r*r>dn*dn},pt=n=>{const[e,t]=n;return!e||!t?null:{distance:Math.hypot(t.x-e.x,t.y-e.y),center:{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}},Ia=({currentBox:n,contentBox:e,viewport:t,pointer:r,zoomFactor:s,minScale:i,maxScale:a})=>{if(!se(t.width)||!se(t.height)||!se(s)||!se(n.width)||!se(n.height)||!se(e.width)||!se(e.height)||!se(i)||!se(a))return n;const o=Math.min(i,a),l=Math.max(i,a),c=or(e,t),d=c.width/n.width,m=ht(d*s,o,l),f=c.width/m,u=f/(n.width/n.height),p=ht(r.x/t.width,0,1),g=ht(r.y/t.height,0,1),w=n.x+p*n.width,M=n.y+g*n.height;return{x:w-p*f,y:M-g*u,width:f,height:u}},$t=new WeakMap,Pe=new Set;let Ee=null,Fe=null;const ze=new Set;let Re=null;const Ta=n=>{ze.add(n),Re===null&&(Re=window.requestAnimationFrame(()=>{Re=window.requestAnimationFrame(()=>{Re=null;const e=Array.from(ze);ze.clear(),ar(e);for(const t of e)cr(t)})}))},fn=n=>{ze.delete(n),ze.size===0&&Re!==null&&(window.cancelAnimationFrame(Re),Re=null)},$a=n=>n.querySelector('[data-streamdown="mermaid-viewport"]')??n.querySelector('[data-streamdown="mermaid"]'),$e=n=>{const e=n.getBoundingClientRect();return{width:e.width,height:e.height}},mn=(n,e)=>{const t=e.getBoundingClientRect();return{x:n.clientX-t.left,y:n.clientY-t.top}},Oa=n=>n instanceof Element&&!!n.closest('button, a, [role="button"]'),ar=n=>{const e=n.map(t=>$e(t.viewport));n.forEach((t,r)=>{const s=e[r];s&&t.fitToViewport(s)})},lr=()=>{Fe!==null||Pe.size===0||(Fe=window.requestAnimationFrame(()=>{Fe=null,ar(Array.from(Pe))}))},Da=()=>{if(Ee)return Ee;const n=globalThis.ResizeObserver;return n?(Ee=new n(e=>{for(const t of e)t.target instanceof HTMLElement&&$t.get(t.target)?.fitToViewport({width:t.contentRect.width,height:t.contentRect.height})}),Ee):null},cr=n=>{if(Pe.has(n))return;const e=Pe.size===0;Pe.add(n),$t.set(n.viewport,n),Da()?.observe(n.viewport),e&&window.addEventListener("resize",lr)},Fa=n=>{Pe.delete(n)&&(Ee?.unobserve(n.viewport),$t.delete(n.viewport),!(Pe.size>0)&&(Ee?.disconnect(),Ee=null,window.removeEventListener("resize",lr),Fe!==null&&(window.cancelAnimationFrame(Fe),Fe=null)))},za=n=>{const e=$a(n),t=n.querySelector('[data-streamdown="mermaid"] svg');if(!e||!t)return null;const r=_a({viewBox:t.getAttribute("data-oc-mermaid-original-viewbox")??t.getAttribute("viewBox"),width:t.getAttribute("width"),height:t.getAttribute("height")});if(!r)return t.setAttribute("data-oc-mermaid-fitted",""),null;t.setAttribute("data-oc-mermaid-original-viewbox",un(r));let s=r,i=null,a=null,o=null,l=null;const c=new Map;let d=null;const m=y=>{s=y,t.setAttribute("viewBox",un(y)),t.removeAttribute("width"),t.removeAttribute("height")},f=y=>{!se(y.width)||!se(y.height)||(m(or(r,y)),t.setAttribute("data-oc-mermaid-fitted",""))},u=()=>{fn(C),f($e(e)),cr(C)},p=()=>{ze.has(C)&&u()},g=(y,j)=>{p(),m(Ia({currentBox:s,contentBox:r,viewport:$e(e),pointer:y,zoomFactor:j,minScale:Ea,maxScale:Ra}))},w=()=>{const y=$e(e);g({x:y.width/2,y:y.height/2},cn)},M=()=>{const y=$e(e);g({x:y.width/2,y:y.height/2},1/cn)},v=y=>{!y.ctrlKey&&!y.metaKey||(y.preventDefault(),y.stopPropagation(),g(mn(y,e),Math.pow(ja,-y.deltaY)))},x=y=>{if(!(y.button!==0||Oa(y.target))){if(p(),y.isPrimary&&(c.clear(),d=null),c.set(y.pointerId,{x:y.clientX,y:y.clientY}),c.size>1){i=null,d=pt(Array.from(c.values()))?.distance??null,e.setPointerCapture?.(y.pointerId),n.setAttribute("data-mermaid-suppress-click","true"),y.preventDefault();return}i=y.pointerId,a={x:y.clientX,y:y.clientY},o=a,l!==null&&(window.clearTimeout(l),l=null),n.removeAttribute("data-mermaid-suppress-click"),e.setPointerCapture?.(y.pointerId),n.setAttribute("data-mermaid-panning","true"),y.preventDefault()}},k=y=>{const j={x:y.clientX,y:y.clientY};if(d!==null&&c.has(y.pointerId)){c.set(y.pointerId,j);const P=pt(Array.from(c.values()));if(P){const I=mn({clientX:P.center.x,clientY:P.center.y},e);g(I,P.distance/d),d=P.distance}y.preventDefault();return}i!==y.pointerId||!o||(m(La({currentBox:s,viewport:$e(e),delta:{x:j.x-o.x,y:j.y-o.y}})),o=j,a&&Aa(a,j)&&n.setAttribute("data-mermaid-suppress-click","true"),y.preventDefault())},S=y=>{if(c.delete(y.pointerId)){if(e.releasePointerCapture?.(y.pointerId),c.size>0){i=null,d=c.size>1?pt(Array.from(c.values()))?.distance??null:null;return}d=null,i=null,a=null,o=null,n.removeAttribute("data-mermaid-panning"),n.hasAttribute("data-mermaid-suppress-click")&&(l=window.setTimeout(()=>{n.removeAttribute("data-mermaid-suppress-click"),l=null},Na))}};e.addEventListener("wheel",v,{passive:!1}),e.addEventListener("pointerdown",x),e.addEventListener("pointermove",k),e.addEventListener("pointerup",S),e.addEventListener("pointercancel",S);const C={viewport:e,zoomIn:w,zoomOut:M,fit:u,fitToViewport:f,cleanup:()=>{fn(C),Fa(C),e.removeEventListener("wheel",v),e.removeEventListener("pointerdown",x),e.removeEventListener("pointermove",k),e.removeEventListener("pointerup",S),e.removeEventListener("pointercancel",S),l!==null&&window.clearTimeout(l),c.clear(),n.removeAttribute("data-mermaid-panning"),n.removeAttribute("data-mermaid-suppress-click")}};return Ta(C),C},je=new Map,Wa={bg:"var(--surface-elevated)",fg:"var(--surface-foreground)",line:"var(--surface-muted-foreground)",accent:"var(--primary-base)",muted:"var(--surface-muted-foreground)",surface:"var(--surface-muted)",border:"var(--interactive-border)"};function Ua(n,e){const t=`${e}:${n}`,r=je.get(t);if(r)return je.delete(t),je.set(t,r),r;let s;try{s=e==="ascii"?{ascii:li(n)}:{svg:ci(n,{...Wa,transparent:!0,font:"system-ui, sans-serif"})}}catch{s={}}if(je.set(t,s),je.size>100){const i=je.keys().next().value;i!==void 0&&je.delete(i)}return s}const Ba=b.memo(function(e){const t=z.c(5),{svg:r,viewer:s}=e,i=s?"":void 0;let a;t[0]!==r?(a={__html:r},t[0]=r,t[1]=a):a=t[1];let o;return t[2]!==i||t[3]!==a?(o=h.jsx("div",{"data-streamdown":"mermaid","data-oc-mermaid-viewer":i,dangerouslySetInnerHTML:a}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o});function Ka(n){const e=z.c(70),{code:t,isIncomplete:r}=n,{theme:s,purpose:i,mermaidControls:a,onShowPopup:o}=oe(),l=fe(Va),{t:c}=ge(),d=b.useRef(null),m=b.useRef(null),[f,u]=b.useState(!1),p=b.useRef(null);let g;e[0]!==t?(g=t.trimEnd(),e[0]=t,e[1]=g):g=e[1];const w=g;let M;e[2]!==r||e[3]!==l||e[4]!==w?(M=r?null:Ua(w,l),e[2]=r,e[3]=l,e[4]=w,e[5]=M):M=e[5];const v=M,x=v?.svg,k=v?.ascii||w;let S,C;e[6]!==i||e[7]!==x?(S=()=>{if(!d.current||!x||i)return;const X=za(d.current);return m.current=X,()=>{X?.cleanup(),m.current=null}},C=[x,i],e[6]=i,e[7]=x,e[8]=S,e[9]=C):(S=e[8],C=e[9]),b.useEffect(S,C);let y,j;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=()=>()=>{p.current&&clearTimeout(p.current)},j=[],e[10]=y,e[11]=j):(y=e[10],j=e[11]),b.useEffect(y,j);let P;e[12]!==x||e[13]!==s.colors.interactive.border||e[14]!==s.colors.primary.base||e[15]!==s.colors.surface.elevated||e[16]!==s.colors.surface.foreground||e[17]!==s.colors.surface.muted||e[18]!==s.colors.surface.mutedForeground?(P=()=>{const X={"var(--surface-elevated)":s.colors.surface.elevated,"var(--surface-foreground)":s.colors.surface.foreground,"var(--surface-muted-foreground)":s.colors.surface.mutedForeground,"var(--primary-base)":s.colors.primary.base,"var(--surface-muted)":s.colors.surface.muted,"var(--interactive-border)":s.colors.interactive.border};let te=x??"";for(const[le,ie]of Object.entries(X))te=te.replaceAll(le,ie);return te},e[12]=x,e[13]=s.colors.interactive.border,e[14]=s.colors.primary.base,e[15]=s.colors.surface.elevated,e[16]=s.colors.surface.foreground,e[17]=s.colors.surface.muted,e[18]=s.colors.surface.mutedForeground,e[19]=P):P=e[19];const I=P;let R;e[20]!==o||e[21]!==i||e[22]!==w||e[23]!==c?(R=X=>{if(i||!o||!w||!(X.target instanceof Element)||X.target.closest('button, a, [role="button"]'))return;const te=d.current;if(!te)return;if(te.hasAttribute("data-mermaid-suppress-click")){te.removeAttribute("data-mermaid-suppress-click");return}const le=Array.from(te.closest("[data-markdown-content]")?.querySelectorAll(Pa)??[]),ie=`${c("layout.mainTab.diagram")} ${le.indexOf(te)+1}`;o({open:!0,title:ie,content:"",metadata:{tool:"mermaid-preview",filename:ie},mermaid:{source:w,url:`data:text/plain;charset=utf-8,${encodeURIComponent(w)}`,filename:ie}})},e[20]=o,e[21]=i,e[22]=w,e[23]=c,e[24]=R):R=e[24];const N=R;let O;e[25]!==w||e[26]!==x||e[27]!==k?(O=async()=>{(await ut(x?w:k)).ok&&(u(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>u(!1),2e3))},e[25]=w,e[26]=x,e[27]=k,e[28]=O):O=e[28];const E=O;let A;e[29]!==I||e[30]!==x?(A=()=>{if(!x)return;const X=URL.createObjectURL(new Blob([I()],{type:"image/svg+xml;charset=utf-8"})),te=document.createElement("a");te.href=X,te.download="diagram.svg",te.click(),URL.revokeObjectURL(X)},e[29]=I,e[30]=x,e[31]=A):A=e[31];const W=A,L=a.showPanZoomControls&&!!x,_=a.download&&!!x,U=!i&&(L||a.copy||_);let K;e[32]!==L||e[33]!==c?(K=L&&h.jsxs(h.Fragment,{children:[h.jsx(He,{label:c("markdownRenderer.mermaid.actions.zoomInTitle"),icon:"zoom-in",onClick:()=>m.current?.zoomIn()}),h.jsx(He,{label:c("markdownRenderer.mermaid.actions.zoomOutTitle"),icon:"zoom-out",onClick:()=>m.current?.zoomOut()}),h.jsx(He,{label:c("markdownRenderer.mermaid.actions.resetViewTitle"),icon:"focus-3",onClick:()=>m.current?.fit()})]}),e[32]=L,e[33]=c,e[34]=K):K=e[34];let Z;e[35]!==a.copy||e[36]!==f||e[37]!==E||e[38]!==c?(Z=a.copy&&h.jsx(He,{label:c(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.mermaid.actions.copyTitle"),icon:"file-copy",done:f,onClick:()=>{E()}}),e[35]=a.copy,e[36]=f,e[37]=E,e[38]=c,e[39]=Z):Z=e[39];let J;e[40]!==_||e[41]!==W||e[42]!==c?(J=_&&h.jsx(He,{label:c("markdownRenderer.mermaid.actions.downloadSvgTitle"),icon:"download",onClick:W}),e[40]=_,e[41]=W,e[42]=c,e[43]=J):J=e[43];let T;e[44]!==K||e[45]!==Z||e[46]!==J?(T=h.jsxs(h.Fragment,{children:[K,Z,J]}),e[44]=K,e[45]=Z,e[46]=J,e[47]=T):T=e[47];const D=T;let G;e[48]!==D||e[49]!==a.toolbarSlot||e[50]!==U?(G=U&&a.toolbarSlot?mr.createPortal(D,a.toolbarSlot):null,e[48]=D,e[49]=a.toolbarSlot,e[50]=U,e[51]=G):G=e[51];let V;e[52]!==D||e[53]!==a.toolbarSlot||e[54]!==U?(V=U&&!a.toolbarSlot&&h.jsx("div",{"data-streamdown":"mermaid-toolbar","data-export-ignore":!0,className:"flex h-6 items-center justify-end gap-0.5 opacity-0 transition-opacity duration-150 focus-within:opacity-100 group-hover/mermaid:opacity-100 pointer-coarse:opacity-100",children:D}),e[52]=D,e[53]=a.toolbarSlot,e[54]=U,e[55]=V):V=e[55];const q=x?"svg":"ascii";let F;e[56]!==I||e[57]!==i||e[58]!==x||e[59]!==k?(F=h.jsx("div",{"data-streamdown":"mermaid-scroll",children:x?h.jsx("div",{"data-streamdown":"mermaid-viewport",children:h.jsx(Ba,{svg:i?I():x,viewer:!i})}):h.jsx("pre",{"data-streamdown":"mermaid-ascii",children:k})}),e[56]=I,e[57]=i,e[58]=x,e[59]=k,e[60]=F):F=e[60];let H;e[61]!==N||e[62]!==w||e[63]!==q||e[64]!==F?(H=h.jsx("div",{ref:d,dir:"ltr","data-streamdown":"mermaid-block","data-oc-mermaid-source":w,"data-mermaid-render":q,onClick:N,children:F}),e[61]=N,e[62]=w,e[63]=q,e[64]=F,e[65]=H):H=e[65];let Y;return e[66]!==G||e[67]!==V||e[68]!==H?(Y=h.jsxs("div",{"data-streamdown":"mermaid-frame",className:"group/mermaid",children:[G,V,H]}),e[66]=G,e[67]=V,e[68]=H,e[69]=Y):Y=e[69],Y}function Va(n){return n.mermaidRenderingMode}const Ha=n=>`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;function qa(n){const e=z.c(10),{code:t}=n,r=b.useContext(Un);let s;e[0]!==t?(s=Ha(t),e[0]=t,e[1]=s):s=e[1];let i;e[2]!==r?(i=()=>r?.(),e[2]=r,e[3]=i):i=e[3];let a;e[4]!==s||e[5]!==i?(a=h.jsx("img",{src:s,alt:"svg",className:"max-w-full rounded-md bg-white",onError:i}),e[4]=s,e[5]=i,e[6]=a):a=e[6];let o;return e[7]!==t||e[8]!==a?(o=h.jsx("div",{"data-streamdown":"svg-block","data-oc-svg-source":t,children:a}),e[7]=t,e[8]=a,e[9]=o):o=e[9],o}function Ga(n){const e=z.c(8),{code:t,isIncomplete:r}=n,{settledReply:s,directory:i}=oe(),a=ps();if(!a){let d;return e[0]!==t?(d=h.jsx("pre",{dir:"ltr",children:h.jsx("code",{children:t})}),e[0]=t,e[1]=d):d=e[1],d}const o=!r,l=i??"";let c;return e[2]!==a||e[3]!==t||e[4]!==s||e[5]!==o||e[6]!==l?(c=h.jsx(a,{code:t,complete:o,reply:s,directory:l}),e[2]=a,e[3]=t,e[4]=s,e[5]=o,e[6]=l,e[7]=c):c=e[7],c}const Xa={note:"information",tip:"lightbulb",important:"feedback",warning:"alert",caution:"error-warning"},Za={note:"chat.markdown.alert.note",tip:"chat.markdown.alert.tip",important:"chat.markdown.alert.important",warning:"chat.markdown.alert.warning",caution:"chat.markdown.alert.caution"},Ya=n=>{const e=z.c(31);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const{t:i}=ge();let a,o,l,c,d;if(e[4]!==t||e[5]!==r?.properties.dataOcAlert||e[6]!==s){d=Symbol.for("react.early_return_sentinel");e:{if(a=$n(r?.properties.dataOcAlert),!a){let v;e[12]!==t||e[13]!==s?(v=h.jsx("blockquote",{dir:"auto",...s,children:t}),e[12]=t,e[13]=s,e[14]=v):v=e[14],d=v;break e}l="auto",c=s,o=a.toUpperCase()}e[4]=t,e[5]=r?.properties.dataOcAlert,e[6]=s,e[7]=a,e[8]=o,e[9]=l,e[10]=c,e[11]=d}else a=e[7],o=e[8],l=e[9],c=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;const m=Xa[a];let f;e[15]!==m?(f=h.jsx(he,{name:m,className:"size-4 shrink-0"}),e[15]=m,e[16]=f):f=e[16];const u=Za[a];let p;e[17]!==i||e[18]!==u?(p=i(u),e[17]=i,e[18]=u,e[19]=p):p=e[19];let g;e[20]!==p?(g=h.jsx("span",{children:p}),e[20]=p,e[21]=g):g=e[21];let w;e[22]!==o||e[23]!==f||e[24]!==g?(w=h.jsxs("p",{"data-oc-alert-title":o,children:[f,g]}),e[22]=o,e[23]=f,e[24]=g,e[25]=w):w=e[25];let M;return e[26]!==t||e[27]!==w||e[28]!==l||e[29]!==c?(M=h.jsxs("blockquote",{dir:l,...c,children:[w,t]}),e[26]=t,e[27]=w,e[28]=l,e[29]=c,e[30]=M):M=e[30],M},Ja="openchamber-md",it={background:"transparent",foreground:"var(--md-syntax-foreground)",comment:"var(--md-syntax-comment)",keyword:"var(--md-syntax-keyword)",string:"var(--md-syntax-string)",number:"var(--md-syntax-number)",function:"var(--md-syntax-function)",variable:"var(--md-syntax-variable)",type:"var(--md-syntax-type)",operator:"var(--md-syntax-operator)"},Qa=Object.fromEntries(Object.keys(gs({base:it})).map(n=>[n,`var(--md-token-${n})`])),hn={name:Ja,colors:{"editor.background":"transparent","editor.foreground":it.foreground},tokenColors:[...di({base:it,tokens:Qa}),{scope:["markup.bold","punctuation.definition.bold"],settings:{fontStyle:"bold"}},{scope:["markup.italic","punctuation.definition.italic"],settings:{fontStyle:"italic"}},{scope:["markup.heading","markup.heading entity.name"],settings:{foreground:it.keyword,fontStyle:"bold"}},{scope:["markup.inserted","punctuation.definition.inserted"],settings:{foreground:"var(--md-syntax-inserted)"}},{scope:["markup.deleted","punctuation.definition.deleted","invalid","invalid.illegal"],settings:{foreground:"var(--md-syntax-deleted)"}}]};function el(n){n=n.map(a=>{const o=[];for(const l of a){const c=o.at(-1);c&&/^\s+$/.test(c.content)&&c.offset+c.content.length===l.offset&&c.bgColor===l.bgColor&&(c.fontStyle??0)===(l.fontStyle??0)&&!((l.fontStyle??0)&12)?o[o.length-1]={...l,offset:c.offset,content:c.content+l.content}:o.push(l)}return o});const e=new Uint32Array(n.length+1),t=new Uint32Array(n.reduce((a,o)=>a+o.length,0)*3),r=[],s=new Map;let i=0;return n.forEach((a,o)=>{e[o]=i;for(const l of a){const c=Math.max(0,l.fontStyle??0),d=JSON.stringify([l.color,l.bgColor,c]);let m=s.get(d);m===void 0&&(m=r.length,s.set(d,m),r.push({color:l.color,bgColor:l.bgColor,fontStyle:c})),t[i++]=l.offset,t[i++]=l.content.length,t[i++]=m}}),e[n.length]=i,{lines:e,spans:t,styles:r}}function gt(n,e){const{lines:t,spans:r}=e,s=e.styles.map(({color:a,bgColor:o,fontStyle:l})=>{const c={};return l&1&&(c.fontStyle="italic"),l&2&&(c.fontWeight="bold"),l&12&&(c.textDecoration=[l&4?"underline":"",l&8?"line-through":""].filter(Boolean).join(" ")),{color:a,bgColor:o,htmlStyle:c}}),i=[];for(let a=0;a<t.length-1;a++){const o=[];for(let l=t[a];l<t[a+1];l+=3){const c=r[l];o.push({...s[r[l+2]],offset:c,content:n.slice(c,c+r[l+1])})}i.push(o)}return{tokens:i}}const pn=(n,e)=>`highlight:${e}:${Ss(n)}`;function gn(n,e){if(e.startsWith(n.code))return n.result.tokens.length-1;const t=Math.min(n.code.length,e.length);let r=0,s=0;for(;r<t&&n.code.charCodeAt(r)===e.charCodeAt(r);)e[r]===`
|
|
7
7
|
`&&s++,r++;return s}const tl=(n,e)=>n.length===e.length&&n.every((t,r)=>{const s=e[r];return t.content===s.content&&t.offset===s.offset&&t.color===s.color&&t.bgColor===s.bgColor&&JSON.stringify(t.htmlStyle)===JSON.stringify(s.htmlStyle)});class nl{worker=null;workerUrl=null;creation=null;loading=null;pending=new Map;inflight=new Map;completed=new Sn({maxEntries:2e3,maxBytes:24*1024*1024});recent=[];snapshots=[];disposed=!1;sequence=0;lineage=0;mainThreadPrevious=[];constructor(){Ht()}cached(e,t,r=!1){const s=pn(e,t),i=this.completed.get(s);if(i)return"result"in i?i.result:void 0;const a=this.recent.find(o=>o.key===s)?.result;return a&&!r&&this.remember(s,a),a??this.highlightOnMainThread(s,e,t,r)}highlightOnMainThread(e,t,r,s){const i=ws(r);if(!i||this.disposed)return;const a=gt(t,el(ys(i,t)));let o,l=0;for(const c of this.mainThreadPrevious){if(c.language!==r)continue;const d=gn(c,t);d>l&&(l=d,o=c)}for(let c=0;o&&c<l;c++)tl(o.result.tokens[c],a.tokens[c])&&(a.tokens[c]=o.result.tokens[c]);return this.mainThreadPrevious=[{code:t,language:r,result:a},...this.mainThreadPrevious.filter(c=>c!==o)].slice(0,4),s?this.recent=[{key:e,result:a},...this.recent.filter(c=>c.key!==e)].slice(0,4):this.remember(e,a),a}remember(e,t){let r=Te(e);for(const s of t.tokens){r+=32;for(const i of s)r+=160+Te(i.content)+Te(i.color??"")+Te(i.bgColor??"")}this.completed.set(e,{result:t},r)}highlight(e,t,r){if(this.disposed)return Promise.resolve(null);const s=pn(e,t),i=this.cached(e,t,r);return i?Promise.resolve(i):xs()?this.highlightInWorker(s,e,t,r):Ht().then(()=>this.cached(e,t,r)??this.highlightInWorker(s,e,t,r))}highlightInWorker(e,t,r,s){if(this.disposed)return Promise.resolve(null);const i=this.completed.get(e);if(i&&"failed"in i)return Promise.resolve(null);if(s)return this.highlightSource(e,t,r,!0).catch(()=>null);const a=this.inflight.get(e);if(a)return a;const o=this.highlightSource(e,t,r,!1).catch(()=>null).finally(()=>{this.inflight.get(e)===o&&this.inflight.delete(e)});return this.inflight.set(e,o),o}async highlightSource(e,t,r,s){const i=bs.incrementalHighlight(),a=s&&i&&t.length<=256*1024&&!t.includes("\r");let o,l=0;if(a)for(const u of this.snapshots){if(u.language!==r)continue;const p=gn(u,t);p>l&&(l=p,o=u)}const c=++this.sequence,d={id:c,code:t,language:r,fullPass:!i};a&&(d.fromLine=l);let m=await this.request(d);if(this.disposed||(m.status==="timeout"&&this.completed.set(e,{failed:!0},Te(e)),m.status!=="ok"||"error"in m.response))return null;let f=gt(t,m.response.result);if(o&&(f.tokens=o.result.tokens.slice(0,l).concat(f.tokens)),f.tokens.length!==t.split(/\r\n|\n|\r/).length){if(!a||(m=await this.request({id:++this.sequence,code:t,language:r,fullPass:!i}),this.disposed)||(m.status==="timeout"&&this.completed.set(e,{failed:!0},Te(e)),m.status!=="ok"||"error"in m.response)||(f=gt(t,m.response.result),f.tokens.length!==t.split(/\r\n|\n|\r/).length))return null}else if(a){const u=o?.lineage??this.lineage++,p=this.snapshots.find(g=>g.lineage===u);(!p||p.seq<c)&&(this.snapshots=[{code:t,language:r,result:f,lineage:u,seq:c},...this.snapshots.filter(g=>g.lineage!==u)].slice(0,4))}return s?this.recent=[{key:e,result:f},...this.recent.filter(u=>u.key!==e)].slice(0,4):this.remember(e,f),f}request(e){return new Promise(t=>{const r={request:e,resolve:t};this.pending.set(e.id,r),this.dispatch(r)})}async createWorker(){const e=globalThis.Worker;if(!e)return null;if(ks(null)){const t=new AbortController;this.loading=t;const{default:r}=await Nt(async()=>{const{default:o}=await import("./streamdown-code.worker-DReY_YXE.js");return{default:o}},[]),s=await fetch(r,{signal:t.signal});if(!s.ok)throw new Error("Code worker could not load");const i=await s.blob();if(this.disposed||t.signal.aborted)return null;const a=URL.createObjectURL(i);try{return{worker:new e(a,{type:"module",name:"streamdown-code"}),objectUrl:a}}catch(o){throw URL.revokeObjectURL(a),o}}return{worker:new Worker(new URL("/assets/streamdown-code.worker-B8rcm_vK.js",import.meta.url),{type:"module",name:"streamdown-code"})}}getWorker(){return this.worker?Promise.resolve(this.worker):(this.creation??=this.createWorker().then(e=>{if(!e)return null;const{worker:t,objectUrl:r}=e;return this.disposed?(t.terminate(),r&&URL.revokeObjectURL(r),null):(this.worker=t,this.workerUrl=r??null,t.onmessage=({data:s})=>{if(this.worker!==t)return;const i=this.pending.get(s.id);i&&this.finish(i,{status:"ok",response:s})},t.onerror=t.onmessageerror=()=>{this.worker===t&&this.failAll()},t)}).catch(()=>null).finally(()=>{this.creation=null}),this.creation)}async dispatch(e){const t=await this.getWorker();if(!(this.disposed||this.pending.get(e.request.id)!==e)){if(!t){this.finish(e,{status:"failed"});return}e.timer=setTimeout(()=>this.timeout(e),vs);try{t.postMessage(e.request)}catch{this.failAll()}}}timeout(e){if(this.pending.get(e.request.id)===e){for(const t of this.pending.values())clearTimeout(t.timer);this.stopWorker(),this.finish(e,{status:"timeout"});for(const t of this.pending.values())this.dispatch(t)}}finish(e,t){clearTimeout(e.timer),this.pending.delete(e.request.id),e.resolve(t)}failAll(){this.stopWorker();for(const e of this.pending.values())this.finish(e,{status:"failed"});this.inflight.clear()}stopWorker(){this.loading?.abort(),this.loading=null,this.worker?.terminate(),this.worker=null,this.workerUrl&&URL.revokeObjectURL(this.workerUrl),this.workerUrl=null}dispose(){this.disposed=!0,this.failAll(),this.completed.clear(),this.recent=[],this.snapshots=[],this.mainThreadPrevious=[]}}const wn=new nl,rl=An.map(n=>n.id),sl=new Set(An.flatMap(n=>[n.id,...n.aliases??[]])),il=[hn,hn];function wt(n){return n.trim().toLowerCase()||"text"}function St(n){return{tokens:n.split(`
|
|
8
8
|
`).map(e=>[{content:e}])}}function ol(n,e){const t=e?200:n.isIncomplete?300:1200;let r=1;for(let s=0;s<n.code.length;s++)if(n.code.charCodeAt(s)===10&&++r>t)return!1;return!0}function al(n,e){if(!e.length)return n;let t=0;const r=n.tokens.map(s=>{let i=t,a=!1;const o=s.flatMap(l=>{const c=l.offset??i,d=c+l.content.length;i=d;const m=e.filter(p=>p.start<d&&p.end>c);if(!m.length)return[l];a=!0;const f=new Set([c,d]);for(const p of m)p.start>c&&p.start<d&&f.add(p.start),p.end>c&&p.end<d&&f.add(p.end);const u=[...f].sort((p,g)=>p-g);return u.slice(0,-1).map((p,g)=>{const w=u[g+1],M=m.find(v=>v.start<=p&&v.end>=w);return{...l,offset:p,content:l.content.slice(p-c,w-c),htmlAttrs:M?{...l.htmlAttrs,"data-openchamber-file-link":"true","data-openchamber-file-ref":M.raw,"data-openchamber-file-path":M.path,role:"button",tabIndex:"0"}:l.htmlAttrs}})});return t=i+1,a?o:s});return{...n,tokens:r}}function dr(n){const e=new WeakMap,t=new Map,r=s=>{const i=n.prepared?.get(s.language)?.get(s.code);if(i)return i;if(n.purpose==="copy"||!ol(s,n.isVSCode))return St(s.code);const a=wt(s.language),o=wn.cached(s.code,a,s.isIncomplete??!1);return o?e.get(o)??o:null};return{name:"shiki",type:"code-highlighter",getSupportedLanguages:()=>rl,getThemes:()=>il,supportsLanguage:s=>sl.has(wt(s)),cached:r,highlight(s,i){const a=c=>{const d=e.get(c);if(d)return d;if(n.resolvePaths){let m=t.get(s.code);m||(m=n.resolvePaths(s.code),t.set(s.code,m),m.finally(()=>t.delete(s.code)).catch(()=>{})),m.then(f=>{if(!f.length)return;const u=e.get(c)??al(c,f);e.set(c,u),e.set(u,u),i?.(u)}).catch(()=>{})}return c},o=r(s);if(o)return n.prepared?.get(s.language)?.has(s.code)?o:a(o);const l=wt(s.language);return wn.highlight(s.code,l,s.isIncomplete??!1).then(c=>i?.(a(c??St(s.code)))),null}}}async function ec(n,e){const t=dr({isVSCode:!1});return new Promise(r=>{const s=setTimeout(()=>r(St(n)),5e3),i=o=>{clearTimeout(s),r(o)},a=t.highlight({code:n,language:e,themes:t.getThemes()},i);a&&i(a)})}const ll=/^(?:\uFEFF)?(---|\+\+\+)[^\S\r\n]*\r?\n([\s\S]*?)\r?\n\1[^\S\r\n]*(?:\r?\n|$)/,Ct=n=>bt(n)?String(n.value??""):In(n).trimEnd(),cl=n=>n?bt(n)?{kind:"text",text:Ct(n)}:mi(n)&&n.items.every(e=>bt(e))?{kind:"list",items:n.items.map(e=>Ct(e))}:{kind:"code",text:In(n).trimEnd()}:{kind:"text",text:""},dl=(n,e)=>{if(n!=="---")return{kind:"raw",text:e};const t=ui(e);return t.errors.length>0?{kind:"raw",text:e}:t.contents===null?null:fi(t.contents)?{kind:"properties",properties:t.contents.items.map(r=>({key:r.key?Ct(r.key):"",value:cl(r.value)}))}:{kind:"raw",text:e}},ul=n=>{const e=n.match(ll);return e?{frontmatter:dl(e[1],e[2]),body:n.slice(e[0].length)}:{frontmatter:null,body:n}},fl=24,ml=(n,e)=>{let t=0;for(const r of n.split(`
|