@openchamber/web 2.7.2 → 2.7.3-canary.20261115.21
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-l-zrh7nU.js → AboutDialog-gL1x0YFW.js} +1 -1
- package/dist/assets/{AboutLogo-K3wdJM69.js → AboutLogo-cbKkZDLU.js} +1 -1
- package/dist/assets/{ArchiveView-DjRZQdOo.js → ArchiveView-0QjF07oK.js} +1 -1
- package/dist/assets/{ChangeRequestDiffUnavailable-BtH6Ad8g.js → ChangeRequestDiffUnavailable-kfarKKvU.js} +1 -1
- package/dist/assets/{CommandPalette-C7Uc4nDE.js → CommandPalette-D4bXVkJf.js} +1 -1
- package/dist/assets/{DataFileArtifact-DtnZXuug.js → DataFileArtifact-DWC11mPC.js} +1 -1
- package/dist/assets/{DiffView-CS0gR_am.js → DiffView-CSSPNDYJ.js} +1 -1
- package/dist/assets/{FilesView-tcU8_bnh.js → FilesView-D0FOaLpo.js} +3 -3
- package/dist/assets/{GitView-Ccs7O5Rf.js → GitView-CJl97ZjN.js} +1 -1
- package/dist/assets/{GuestPanelContent-CJ_wlnNr.js → GuestPanelContent-BCxvKv4H.js} +1 -1
- package/dist/assets/{HelpDialog-iH44R9qu.js → HelpDialog-DjficTGt.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-D9icTaJt.js → IntegrationsCatalogView-BvS1pCRR.js} +1 -1
- package/dist/assets/{JsonTreeView-BjPbJlHc.js → JsonTreeView-DQ6XLAW4.js} +1 -1
- package/dist/assets/{MarkdownDiffPreview-gCh_8R1F.js → MarkdownDiffPreview-C8KpNQaC.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-fohUB8r2.js → MarkdownRendererImpl-B1SjhV-G.js} +4 -4
- package/dist/assets/{MemoryDebugPanel-fX9cD8th.js → MemoryDebugPanel-BWT5owg7.js} +1 -1
- package/dist/assets/{NoteEditor-CTPSChrc.js → NoteEditor-DfHpXxIN.js} +1 -1
- package/dist/assets/{OfficeArtifact-BRviGdkx.js → OfficeArtifact-BAYHzDft.js} +2 -2
- package/dist/assets/{OfficeDocumentDiff-Hp2baXgN.js → OfficeDocumentDiff-Csvxzve7.js} +1 -1
- package/dist/assets/{OnboardingScreen-CDhZHMEt.js → OnboardingScreen-NWWMu7OG.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-CBiLhgh9.js → OpenCodeStatusDialog-DtnVfNI4.js} +1 -1
- package/dist/assets/{OverviewView-DmNAg498.js → OverviewView-BXMN0Z8_.js} +1 -1
- package/dist/assets/{PatchDiff-rhuT-3au.js → PatchDiff-DxGkHtIk.js} +1 -1
- package/dist/assets/{PlanView-VhIl4wzm.js → PlanView-DE4sxgkq.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-B_jMMuJ0.js → ProjectActionsDialog-C5q25ipO.js} +1 -1
- package/dist/assets/{ReceivedPagePanel-CCDFxXT4.js → ReceivedPagePanel-CfXyzCii.js} +5 -5
- package/dist/assets/{ReplyCommand-CUHB1iPz.js → ReplyCommand-OczgxN8d.js} +1 -1
- package/dist/assets/{ReplyUiBlock-TNOJJ_HH.js → ReplyUiBlock-D1HJeVU_.js} +1 -1
- package/dist/assets/{ReviewCards-UN_E9jl0.js → ReviewCards-D7jBPhS_.js} +1 -1
- package/dist/assets/{RunOverview-C7FUT8DD.js → RunOverview-BDblAbDp.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-DdXypryy.js → ScheduledTasksDialog-NDtZLq5t.js} +1 -1
- package/dist/assets/{SettingsView-uSZDjIcc.js → SettingsView-UjifxDq7.js} +1 -1
- package/dist/assets/{SettingsWindow-CoijA05f.js → SettingsWindow-D2K9vSYk.js} +1 -1
- package/dist/assets/{SidebarSectionsManager-d6IaYpHW.js → SidebarSectionsManager-QqwIUOdu.js} +1 -1
- package/dist/assets/{SourceBoardView-BrQkCEgn.js → SourceBoardView-CKJDJ2f4.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-CymnxxLO.js → SpaceAccessDialog-G331hiT_.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DVJkF4lG.js → SpaceApplyDialog-x0rDuJEc.js} +1 -1
- package/dist/assets/{SpaceRow-CJFX1Zsr.js → SpaceRow-CsS43yrt.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-Btttdq6K.js → SpaceSetupOutput-BEXQGXPw.js} +1 -1
- package/dist/assets/{SpacesView-GxzOEIeI.js → SpacesView-DFcnInBv.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-D0Nj5PJN.js → SubmoduleDiffSummary-CTqIH0Cp.js} +1 -1
- package/dist/assets/{TableArtifact-DiRnrtL5.js → TableArtifact-Beve8fiv.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DnvhhdiH.js → ToolOutputDialog-Bn2g6tIX.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-CHdkL7BJ.js → ToolPartDiffPreview-mgtjJMMz.js} +1 -1
- package/dist/assets/{UiBlock-CvZ92eyw.js → UiBlock-DkgJyZVl.js} +2 -2
- package/dist/assets/{UsageStatsView-Dbo3dCgC.js → UsageStatsView-CLJFagDC.js} +1 -1
- package/dist/assets/{WalkthroughView-l9TMdlPB.js → WalkthroughView-Dm4-RaV3.js} +1 -1
- package/dist/assets/{WorktreesView-DNa5Soxq.js → WorktreesView-DyZy4OjB.js} +1 -1
- package/dist/assets/{appThemeRegistry-C3TUDJ7r.js → appThemeRegistry-C4Av1s90.js} +1 -1
- package/dist/assets/{codeHighlight-DyrRLTkb.js → codeHighlight-Bmb7zcc2.js} +1 -1
- package/dist/assets/{columnWidthMemory-D0i9Kdhi.js → columnWidthMemory-D8H-O0YE.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-YMtW3BEg.js → computeVirtualFileMetrics-Bc_YiqAD.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-USev-3h1.js → contextFileOpenGuard-D-HtBtn6.js} +1 -1
- package/dist/assets/{date-time-DSQbTMhf.js → date-time-DfmOsLQo.js} +1 -1
- package/dist/assets/{diffsHighlighter-DZ_8ZCaS.js → diffsHighlighter-CFc933Ip.js} +1 -1
- package/dist/assets/{documentClient-5O0az-Ma.js → documentClient-D-gfZAFK.js} +2 -2
- package/dist/assets/{documentHost-BqOqnqk5.js → documentHost-fBeQzdlp.js} +1 -1
- package/dist/assets/{editorCodeMetrics-a0NLS65y.js → editorCodeMetrics-CNBjOGNA.js} +1 -1
- package/dist/assets/{fileContentPoller-B8a010z5.js → fileContentPoller-DRoVO_sh.js} +1 -1
- package/dist/assets/{flexokiTheme-DJaL_u7G.js → flexokiTheme-CcqiI7j-.js} +1 -1
- package/dist/assets/{highlights-CSy_17b-.js → highlights-_5vZZ38i.js} +1 -1
- package/dist/assets/{index-CvHejcGo.js → index-BbbQXJ_t.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-MLG8op-A.js → initializeSharedPreferences-B1ISDxLb.js} +1 -1
- package/dist/assets/{install-NTaAzPnj.js → install-DY6TBn2e.js} +1 -1
- package/dist/assets/{install-request-D5VhmtWC.js → install-request-CzRei4tp.js} +1 -1
- package/dist/assets/{isDiffPlainText-B6ZzF_T5.js → isDiffPlainText-Cx5SgKlQ.js} +1 -1
- package/dist/assets/{isFilePlainText-Bitg2337.js → isFilePlainText-Bcn3vV6J.js} +1 -1
- package/dist/assets/{katex.min-B3YMLLh4.js → katex.min-DklPh68d.js} +3 -3
- package/dist/assets/{main-Bqwtrv5m.js → main-D0ACoTpS.js} +2 -2
- package/dist/assets/{main-B61P9v4A.js → main-QZk4AKac.js} +4 -4
- package/dist/assets/{miniChat-CZx_2XHj.js → miniChat-DeYRMPYt.js} +2 -2
- package/dist/assets/{mobile-DiLdHL_W.js → mobile-DjT3KVMo.js} +2 -2
- package/dist/assets/{moveWorkspacePath-CpN2DOGn.js → moveWorkspacePath-DibtVw_Q.js} +1 -1
- package/dist/assets/{officeDocument-Ca0s-jYd.js → officeDocument-CBwDUdTr.js} +1 -1
- package/dist/assets/{parseDiffFromFile-CL7WjMrZ.js → parseDiffFromFile-D28_u-uC.js} +1 -1
- package/dist/assets/{pierreDiffTint-C4cPKKnP.js → pierreDiffTint-CLCzflgS.js} +1 -1
- package/dist/assets/{relocateRestoredSession-Bw3yb1_0.js → relocateRestoredSession-BPqdEuzx.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-DB0hWKLa.js → renderElectronMiniChatApp-C0v7P53f.js} +2 -2
- package/dist/assets/{renderMarkdownForExport-CICPn_1e.js → renderMarkdownForExport-DvKl_kjS.js} +1 -1
- package/dist/assets/{renderMobileApp-CYhEWO14.js → renderMobileApp-EVllBWS5.js} +3 -3
- package/dist/assets/{resolveLanguages-gKOTFspE.js → resolveLanguages-DqxtADuz.js} +1 -1
- package/dist/assets/{scheduledTasksApi-C1TDMoZd.js → scheduledTasksApi-v463mt0u.js} +1 -1
- package/dist/assets/{shiki-B0-fz3dN.js → shiki-3oNYFbTw.js} +1 -1
- package/dist/assets/{space-apply-DnoCDzwj.js → space-apply-j71ap5Rs.js} +1 -1
- package/dist/assets/{space-close-Bqfdl7kv.js → space-close-Bj32J79L.js} +1 -1
- package/dist/assets/{spaceNetwork-D5Fcyb33.js → spaceNetwork-BV5W32NY.js} +1 -1
- package/dist/assets/{stream-tokenizer-FniCZxxb.js → stream-tokenizer-wGP5G2_C.js} +1 -1
- package/dist/assets/{useAppFontEffects-CpxtKEGw.js → useAppFontEffects-BDLOJuy5.js} +15 -15
- package/dist/assets/{useBranchPullRequestRequest-DVy6rEsu.js → useBranchPullRequestRequest-DMiPjfPQ.js} +1 -1
- package/dist/assets/{useCallableModelProviders-DngJbZnV.js → useCallableModelProviders-aGFpVUZL.js} +1 -1
- package/dist/assets/{useDiffFindSurface-DY6lBBpH.js → useDiffFindSurface-mA0rc6AR.js} +1 -1
- package/dist/assets/{useGitCleanLine-CxdK3EQ3.js → useGitCleanLine-BwAypcLn.js} +1 -1
- package/dist/assets/{useInlineCommentController-Z8ADSR8f.js → useInlineCommentController-Wnopn0Ar.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-CZIMWgjn.js → useMarkdownLocalAssets-BjT607tF.js} +1 -1
- package/dist/assets/{useRootScrollLock-C9UIEqnb.js → useRootScrollLock-DPhGk2Eu.js} +1 -1
- package/dist/assets/{useWalkthroughReview-BWxwaV05.js → useWalkthroughReview-BrULG_dy.js} +1 -1
- package/dist/assets/{useWholeFileComment-zterYCFS.js → useWholeFileComment-CQj6q_QX.js} +1 -1
- package/dist/assets/{useWorktreeArchiveActions-CKnDdsvh.js → useWorktreeArchiveActions-CpegLYyZ.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-BI6j-q9C.js → vendor-codemirror-language-data-CFvXza4M.js} +2 -2
- package/dist/index.html +3 -3
- 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 y,f as U,j as f,a as mr}from"./vendor-react--VO_rL_p.js";import{iM as xn,iN as hr,iO as jt,iP as pr,iQ as gr,iR as wr,iS as xr,iT as yr,iU as br,iV as yn,iW as kr,bE as Mt,iX as vr,iY as Sr,iZ as Cr,i_ as jr,i$ as Mr,j0 as Dt,j1 as Er,j2 as bn,j3 as We,j4 as Ce,j5 as Rr,u as ge,j6 as Et,j7 as Nr,a2 as ot,B as ve,z as Pr,I as he,j8 as Rt,bn as _r,j9 as kn,ja as Ar,jb as vn,A as xt,jc as Ir,bo as Sn,jd as Lr,f1 as Tr,je as Cn,jf as $r,jg as Or,jh as Dr,ji as Fr,cs as zr,jj as Wr,jk as Ur,jl as Br,jm as Kr,jn as Vr,jo as Hr,jp as Gr,jq as qr,jr as Zr,js as Xr,jt as Yr,ju as Qr,jv as Jr,jw as Ft,jx as es,jy as zt,jz as ts,jA as ns,c9 as $e,bc as rs,jB as Wt,jC as ss,jD as is,jE as os,ap as as,jF as ls,jG as cs,eE as ds,aV as jn,jH as us,jI as fs,jJ as ms,jK as hs,bb as ut,a5 as Ut,a6 as Bt,a7 as Kt,a8 as Vt,n as ps,dC as Ve,jL as gs,Q as Ht,jM as ws,jN as xs,jO as Je,jP as ys,bO as Mn,an as bs,ao as ks,dp as vs,jQ as Ss,jR as Cs,jS as js,jT as Ms,jU as Es,jV as Rs,ak as Ns}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 gi(){const n=t=>{const r=this.parse(t);if(!ui(r))throw new Error("Disclosure parsing requires a Markdown root");return t.startsWith("\uFEFF")&&et(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 m of r.slice(i,a).split(new RegExp("(?<=\\n)"))){const u=/^ {0,3}> ?/.exec(m)?.[0].length??0;for(let p=u;p<m.length;p++)o.push(c+p),l+=m[p];c+=m.length}o.push(a);const d=n(l);e(d,l);const h=m=>{if(m.position)for(const u of[m.position.start,m.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 m)for(const u of m.children)h(u)};h(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=fi.exec(r.slice(o));if(!l)continue;const c=o+l[0].length,{bodyEnd:d,end:h}=pi(r,c),m=r.slice(c,d),u=n(m);e(u,m),et(u,r,c);const p=/<summary\s*>/i.exec(l[0]),x=o+(p?.index??0)+(p?.[0].length??0),w=l[2]??"",S=mi.exec(w),k=S?S[3]:w,C=n(k);et(C,r,x+(S?.[1].length??0));const b=C.children[0],v=b?.type==="paragraph"?b.children:[{type:"text",value:k}],j=hi.find(F=>String(F)===S?.[2]),g={type:"ocDisclosureSummary",data:{hName:"summary"},children:j?[{type:"heading",depth:j,children:v}]:v},M={type:"ocDisclosure",data:{hName:"details",hProperties:l[1]?{open:!0}:{}},children:[g,...u.children]};let P=1,$=a.position?.end?.offset??h;for(;i+P<s.length;){const F=s[i+P];if((F.position?.start?.offset??r.length)>=h)break;$=F.position?.end?.offset??h,P++}const R=n(r.slice(h,$));et(R,r,h);const N=R.children;s.splice(i,P,M,...N)}};return(t,r)=>e(t,r.toString())}const wi=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,h,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,x){return w;function w(C){return u.consume(C),S}function S(C){return!i||C!==(s?93:41)?x(C):(u.consume(C),s?k:p)}function k(C){return C===32||C===9?(u.consume(C),k):C===null||C<0?p(C):x(C)}}};function h(u){return n.exit("ocMathValue"),n.enter("ocMathMarker"),n.consume(u),m}function m(u){return n.consume(u),n.exit("ocMathMarker"),n.exit("ocMath"),e}return a},xi=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))}},yi={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 bi(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 ki(){const n=this.data();return(n.micromarkExtensions??=[]).push({text:{92:{name:"ocMath",tokenize:wi},36:{name:"ocDollarMath",tokenize:xi}}}),(n.fromMarkdownExtensions??=[]).push(yi),(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;bi(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?",Tn=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}},vi=new Set(["align","alt","checked","colSpan","controls","disabled","height","href","media","open","playsInline","preload","rel","rowSpan","src","srcSet","start","target","title","type","width"]),qe=Nn();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 Si(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)||Tn(n)!==null)}function Ci({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 m=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");!vi.has(d)&&!m&&delete o.properties[d]}if(o.properties.href!==void 0){const d=qe.safeParse(o.properties.href);d.success&&Si(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=qe.safeParse(o.properties.src);if(d.success){const h=d.data,m=o.tagName==="img"&&/^data:image\/(?:png|jpeg|gif|webp);base64,(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(h);h===h.trim()&&(kt(h)||ct(h)||m)?(o.properties.dataOcMediaSource=h,ct(h)&&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=qe.safeParse(o.properties.srcSet);d.success&&d.data.split(",").every(m=>{const[u,p,...x]=m.trim().split(/\s+/);return!!u&&kt(u)&&x.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 ji(){return n=>{function e(t){for(const r of t.children)if(r.type==="element"){if(r.tagName==="a"){const s=qe.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=qe.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 Mi=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote"]),Ei=new Set(["code","pre","ul","ol","blockquote","table","details"]),Ri=new Set(["p","h1","h2","h3","h4","h5","h6","li","br","div"]);function $n(n){if(n.type==="text")return n.value;if(n.type!=="element"||Ei.has(n.tagName))return" ";const e=n.children.map($n).join("");return Ri.has(n.tagName)?` ${e} `:e}function On(n){const e=n.children.map(t=>t.type==="element"?On(t):void 0);if(Mi.has(n.tagName)){const t=$s(n.children.map($n).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 Ni(){return n=>{for(const e of n.children)e.type==="element"&&On(e)}}const Dn={singleTilde:!1},Pi=at.gfm,_i=[[Pi[0],Dn],...Object.values(at).filter(n=>n!==at.gfm)],Ai=lt.remarkPluginsAfter.at(-1),Ii={...lt,remarkPluginsAfter:[...lt.remarkPluginsAfter.slice(0,-1),[Ai,Dn]]};function Li(n=!1){return n?lt:Ii}const Qt=Hs({singleDollarTextMath:!1}),Ti={...Qt,remarkPlugin:function(){return this.use([Qt.remarkPlugin]),ki.call(this)}},$i={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",...In]]},protocols:{src:["http","https"]},clobberPrefix:"",required:{input:{type:"checkbox",disabled:!0}}};function Oi(){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 Di(){const n=this.data();(n.micromarkExtensions??=[]).push({disable:{null:["htmlFlow","htmlText","characterReference"]}})}function Fi(){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||!jt(t.slice(s,i))})}}function tt(n,e,t){return{remarkPlugins:[...t?Object.values(at):_i,gi,di,Fi,Oi],rehypePlugins:[...n?[Gt.raw]:[],[Ci,{isVSCode:e}],[Zs,$i],Gt.harden,ji,Ni]}}const zi=[!1,!0].flatMap(n=>[tt(!1,!1,n),tt(!1,!0,n),tt(!0,!1,n),tt(!0,!0,n)]);function Wi(n,e,t=!1){return zi[(t?4:0)+(n?2:0)+(e?1:0)]}const Ui=new Set(["inlineCode","code","html","math","inlineMath"]);function Bi(n){return e=>{const t=r=>{if(!Ui.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 Ki=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Vi=n=>{const{issuePrefix:e,changeRequestPrefix:t}=n.descriptor.terminology,r=[...new Set([e,t])].sort((s,i)=>i.length-s.length).map(Ki).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")},Hi=(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=xr(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=yr(n,e.sha);return i?{url:i,children:[{type:"inlineCode",value:e.sha.slice(0,7)}]}:null}return null},Gi=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},qi=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function Zi(n){const e=Vi(n),t=r=>{const s=[];let i=0;for(const a of r.matchAll(e)){const o=a.groups?Hi(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(qi.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+Gi(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 Xi=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},Yi=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function Qi(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=yn(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(Yi.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+Xi(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 Ji=/^\/api\/source-control\/[^/?#]+\/uploads\/[0-9a-f]{32}\/[^/?#]+\?/,nt=new Map;class eo{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||!Ji.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(!Xs(e))throw new Error("Document source is unavailable");const u=Ys(c.filePath,e),p=c.workspaceRoot,x={path:u,directory:p||void 0,allowOutsideWorkspace:p&&Mt(u,p)?void 0:"true"};if(t){if(Se())throw new Error("Video bridge is unavailable");return await yt(),this.check(s),Ne().authenticatedAsset("/api/fs/raw",x)}return this.readDocumentImage(u,"/api/fs/raw",x,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 h=[...this.sources.keys()].slice(0,12);if(!h.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:h.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 m=(await this.batch).get(e);if(this.check(s),m?.status!=="ready")throw new Error("Image is unavailable");if(!t&&Cr()){const u=await jr(m,a,s);return this.check(s),u}return await yt(),this.check(s),Mr(m,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=nt.get(t);return r||(r=new Set,nt.set(t,r)),r.add(e),()=>{r.delete(e),r.size||nt.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=[...nt.get(s)??[]].filter(d=>d.element.isConnected).sort((d,h)=>d.element.compareDocumentPosition(h.element)&4?-1:1),a=await Promise.allSettled(i.map(d=>d.resolve()));this.check(r);const o=i.flatMap((d,h)=>{const m=a[h];return m?.status==="fulfilled"?[{url:m.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:h,load:m})=>({url:d,filename:h,load:m})),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 Fn=y.createContext(null),Ue=y.createContext(!1),pe=()=>y.useContext(Fn);function to(n){const e=U.c(23),{content:t,mode:r,sessionId:s,messageId:i,directory:a,settled:o,documentAssets:l,onShowPopup:c,children:d}=n,[h,m]=y.useReducer(no,0);let u,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>Rn(()=>m()),p=[],e[0]=u,e[1]=p):(u=e[0],p=e[1]),y.useEffect(u,p);let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=ue(),e[2]=x):x=e[2];const w=x;let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=Ne(),e[3]=S):S=e[3];const k=S,C=l?.filePath,b=l?.workspaceRoot;let v;e[4]!==a||e[5]!==C||e[6]!==i||e[7]!==r||e[8]!==s||e[9]!==b?(v=new eo({mode:r,directory:a,sessionId:s,messageId:i,documentAssets:C?{filePath:C,workspaceRoot:b??null}:void 0}),e[4]=a,e[5]=C,e[6]=i,e[7]=r,e[8]=s,e[9]=b,e[10]=v):v=e[10];const j=v;let g,M;e[11]!==j?(g=()=>{if(w!==ue()||k!==Ne()){j.dispose(),m();return}j.connect();const N=Os(()=>j.dispose());return()=>{N(),j.disconnect()}},M=[j,k,w],e[11]=j,e[12]=g,e[13]=M):(g=e[12],M=e[13]),y.useLayoutEffect(g,M);let P;e[14]!==l||e[15]!==r||e[16]!==c||e[17]!==j||e[18]!==o?(P={owner:j,mode:r,settled:o,documentAssets:l,onShowPopup:c},e[14]=l,e[15]=r,e[16]=c,e[17]=j,e[18]=o,e[19]=P):P=e[19];const $=P;let R;return e[20]!==d||e[21]!==$?(R=f.jsx(Fn.Provider,{value:$,children:d}),e[20]=d,e[21]=$,e[22]=R):R=e[22],R}function no(n){return n+1}const zn=y.createContext(null),Pt=y.createContext(null);function ae(){const n=y.useContext(Pt);if(!n)throw new Error("Markdown components require MarkdownContent");return n}const _t=n=>/^(?:https?:)?\/\//i.test(n),Wn=n=>n==="streamdown:incomplete-image",Un=(n,e)=>n["data-oc-media-source"]??e??"",Bn=y.createContext(null),ro=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 At(n,e){const t=U.c(7),r=e===void 0?!1:e,s=y.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]=y.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(x=>{x.some(so)&&(l(!0),p.disconnect())},r?{root:ro(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]),y.useEffect(c,d);const h=!n||o;let m;return t[5]!==h?(m={ref:s,setRef:a,near:h},t[5]=h,t[6]=m):m=t[6],m}function so(n){return n.isIntersecting}function io(n){const e=U.c(4);let t;e[0]!==n?(t=i=>{if(!n)return ao;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],y.useSyncExternalStore(r,s,oo)}function oo(){return!0}function ao(){}const It=y.createContext(null);function Ze(n){const e=U.c(23),{source:t,name:r,title:s,linked:i,state:a}=n,{t:o}=ge(),l=y.useContext(Pt),c=pe(),d=Et(l?.directory??c?.owner?.options.directory??"");let h;e[0]!==a||e[1]!==o||e[2]!==s?(h=a==="failed"?o("common.image.loadFailed"):s,e[0]=a,e[1]=o,e[2]=s,e[3]=h):h=e[3];let m;e[4]!==t?(m=Ce(t),e[4]=t,e[5]=m):m=e[5];let u;e[6]!==a?(u=a==="loading"?f.jsx(Pr,{className:"size-3.5","aria-hidden":!0}):f.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]!==h||e[11]!==m||e[12]!==u?(p=f.jsxs("span",{title:h,"data-oc-media-source":m,"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]=h,e[11]=m,e[12]=u,e[13]=p):p=e[13];const x=p;if(!_t(t)||i||Nr(t))return x;let w;e[14]!==d||e[15]!==l?.disableLinkSafety||e[16]!==l?.purpose||e[17]!==t?(w=k=>{l?.purpose||l?.disableLinkSafety||k.metaKey||k.ctrlKey||k.shiftKey||k.altKey||(k.preventDefault(),k.stopPropagation(),d(t))},e[14]=d,e[15]=l?.disableLinkSafety,e[16]=l?.purpose,e[17]=t,e[18]=w):w=e[18];let S;return e[19]!==x||e[20]!==t||e[21]!==w?(S=f.jsx("a",{href:t,className:"external-link",target:"_blank",rel:"noopener noreferrer",onClick:w,children:x}),e[19]=x,e[20]=t,e[21]=w,e[22]=S):S=e[22],S}function Kn(n,e,t){const r=U.c(22),s=t===void 0?!1:t,i=pe(),a=i?.owner,[o,l]=y.useState(null),[c,d]=y.useState(null);let h;r[0]!==i?.mode?(h=()=>{i?.mode==="document"&&l(lo)},r[0]=i?.mode,r[1]=h):h=r[1];const m=i?.mode;let u;r[2]!==m?(u=[m],r[2]=m,r[3]=u):u=r[3],y.useLayoutEffect(h,u);let p,x;r[4]!==e||r[5]!==a||r[6]!==n||r[7]!==s?(p=()=>{if(!a||!n||!e)return;const v=a.controller.signal;let j=!1;return a.resolve(n,s).then(g=>{!j&&!v.aborted&&(d(null),l({owner:a,signal:v,source:n,url:g}))},()=>{!j&&!v.aborted&&d({owner:a,signal:v,source:n,url:""})}),()=>{j=!0}},x=[a,n,e,s],r[4]=e,r[5]=a,r[6]=n,r[7]=s,r[8]=p,r[9]=x):(p=r[8],x=r[9]),y.useEffect(p,x);const w=c?.owner===a&&c?.source===n,S=o&&o.owner===a&&o.source===n&&(i?.mode!=="document"||!o.signal.aborted)&&!w?o.url:void 0;let k;r[10]!==a||r[11]!==n?(k=()=>{a&&d({owner:a,signal:a.controller.signal,source:n,url:""})},r[10]=a,r[11]=n,r[12]=k):k=r[12];let C;r[13]!==a||r[14]!==n||r[15]!==s?(C=async()=>{if(!a)throw new Error("Missing media owner");const v=a.controller.signal,j=await a.resolve(n,s,!0);v.aborted||(d(null),l({owner:a,signal:v,source:n,url:j}))},r[13]=a,r[14]=n,r[15]=s,r[16]=C):C=r[16];let b;return r[17]!==w||r[18]!==S||r[19]!==k||r[20]!==C?(b={url:S,failed:w,fail:k,retry:C},r[17]=w,r[18]=S,r[19]=k,r[20]=C,r[21]=b):b=r[21],b}function lo(n){return n?.signal.aborted?null:n}const co=(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 uo(n){const e=U.c(9),t=Un(n,n.src),r=pe(),s=y.useContext(Ue);if(Wn(t))return null;if(!s&&Rr(t,n.alt??""))return f.jsx(Lt,{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"?f.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 f.jsx(Ze,{source:t,name:We(t,n.alt),title:n.title,linked:s});let i;return e[6]!==n||e[7]!==t?(i=f.jsx(fo,{...n,source:t}),e[6]=n,e[7]=t,e[8]=i):i=e[8],i}function fo(n){const e=U.c(92);let t,r,s,i,a,o,l,c,d,h,m;if(e[0]!==n){const{source:Q,node:me,src:Xe,srcSet:we,alt:Be,title:xe,className:ye,style:be,width:ke,height:Ae,onLoad:D,onError:ce,...de}=n;o=Q,l=we,d=Be,h=xe,t=ye,c=be,m=ke,r=Ae,i=D,s=ce,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]=h,e[11]=m}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],h=e[10],m=e[11];const u=d===void 0?"":d,p=pe(),x=y.useContext(Ue),w=y.useContext(Bn),S=w?.report,k=y.useId();let C;e[12]!==u||e[13]!==o?(C=We(o,u),e[12]=u,e[13]=o,e[14]=C):C=e[14];const b=C,v=p?.mode==="assistant",j=p?.mode==="document",g=y.useContext(It),{ref:M,setRef:P,near:$}=At(v||j&&g===null,j),R=g??$,N=p?.owner,F=v&&!!p?.onShowPopup&&!x;let E,I;e[15]!==N||e[16]!==o?(E=()=>N?.register(o),I=[N,o],e[15]=N,e[16]=o,e[17]=E,e[18]=I):(E=e[17],I=e[18]),y.useEffect(E,I);const B=!!(p&&R&&(!v||p.settled)),{url:A,failed:_,fail:K}=Kn(o,B),q=Vn(l,B),[J,ee]=y.useState(null),T=!!(A&&J?.url===A),z=J&&J.url===A?J.size:void 0;let Z,V;e[19]!==T||e[20]!==k||e[21]!==S||e[22]!==z?(Z=()=>(S?.(k,T&&z?z:null),()=>S?.(k,null)),V=[S,k,T,z],e[19]=T,e[20]=k,e[21]=S,e[22]=z,e[23]=Z,e[24]=V):(Z=e[23],V=e[24]),y.useEffect(Z,V);let H,O;e[25]!==T||e[26]!==F||e[27]!==b||e[28]!==N||e[29]!==M||e[30]!==o||e[31]!==A?(H=()=>{const Q=M.current;if(!(!N||!T||!Q||!F))return N.addGallery({source:o,filename:b,element:Q,resolve:()=>A?.startsWith("data:")?Promise.resolve(A):N.resolve(o,!1,!0),load:()=>N.load(o)})},O=[N,T,o,b,M,F,A],e[25]=T,e[26]=F,e[27]=b,e[28]=N,e[29]=M,e[30]=o,e[31]=A,e[32]=H,e[33]=O):(H=e[32],O=e[33]),y.useEffect(H,O);let G;e[34]!==u||e[35]!==t||e[36]!==j||e[37]!==T||e[38]!==K||e[39]!==r||e[40]!==b||e[41]!==s||e[42]!==i||e[43]!==a||e[44]!==q||e[45]!==w?.ready||e[46]!==P||e[47]!==o||e[48]!==l||e[49]!==c||e[50]!==h||e[51]!==A||e[52]!==m?(G=A||j?f.jsx("img",{...a,ref:j?P:void 0,src:A,srcSet:q,alt:u||b,title:h,width:m,height:r,className:ot(j?t:"block h-auto max-h-[30rem] w-auto max-w-full object-contain",j?!A&&"invisible":!T&&"hidden"),style:j?{...c,...co(m,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:Q=>{const me=Q.currentTarget;A&&me.naturalWidth&&me.naturalHeight&&ee({url:A,size:{width:me.naturalWidth,height:me.naturalHeight}}),i?.(Q)},onError:Q=>{K(),s?.(Q)}}):null,e[34]=u,e[35]=t,e[36]=j,e[37]=T,e[38]=K,e[39]=r,e[40]=b,e[41]=s,e[42]=i,e[43]=a,e[44]=q,e[45]=w?.ready,e[46]=P,e[47]=o,e[48]=l,e[49]=c,e[50]=h,e[51]=A,e[52]=m,e[53]=G):G=e[53];const X=G,te=z?z.width/z.height:1;let se;e[54]!==te||e[55]!==w?.ready||e[56]!==z?(se=w?.ready&&z?{flex:`${te} 1 0px`,minWidth:`${8*te}rem`,maxWidth:`min(${z.width}px, ${30*te}rem)`,margin:0}:void 0,e[54]=te,e[55]=w?.ready,e[56]=z,e[57]=se):se=e[57];const oe=se;if(j){let Q;return e[58]!==_||e[59]!==X||e[60]!==x||e[61]!==b||e[62]!==o||e[63]!==h?(Q=_?f.jsx(Ze,{source:o,name:b,title:h,linked:x,state:"failed"}):X,e[58]=_,e[59]=X,e[60]=x,e[61]=b,e[62]=o,e[63]=h,e[64]=Q):Q=e[64],Q}const le=T?"inline-block max-w-[min(100%,30rem)] align-top my-1 me-1":void 0;let L;e[65]!==o?(L=Ce(o),e[65]=o,e[66]=L):L=e[66];let W;e[67]!==B||e[68]!==T||e[69]!==_||e[70]!==x||e[71]!==b||e[72]!==o||e[73]!==h?(W=!T&&f.jsx(Ze,{source:o,name:b,title:h,linked:x,state:_?"failed":B?"loading":void 0}),e[67]=B,e[68]=T,e[69]=_,e[70]=x,e[71]=b,e[72]=o,e[73]=h,e[74]=W):W=e[74];const ie=A&&!F&&X;let Y;e[75]!==p||e[76]!==T||e[77]!==F||e[78]!==X||e[79]!==b||e[80]!==N||e[81]!==M||e[82]!==A?(Y=A&&F&&f.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":b,"data-oc-media-gallery":"true",onClick:()=>{const Q=M.current;Q&&p?.onShowPopup&&N?.openGallery(Q,p.onShowPopup).catch(mo)},children:X}),e[75]=p,e[76]=T,e[77]=F,e[78]=X,e[79]=b,e[80]=N,e[81]=M,e[82]=A,e[83]=Y):Y=e[83];let ne;return e[84]!==oe||e[85]!==P||e[86]!==le||e[87]!==L||e[88]!==W||e[89]!==ie||e[90]!==Y?(ne=f.jsxs("span",{ref:P,className:le,style:oe,"data-oc-media-source":L,children:[W,ie,Y]}),e[84]=oe,e[85]=P,e[86]=le,e[87]=L,e[88]=W,e[89]=ie,e[90]=Y,e[91]=ne):ne=e[91],ne}function mo(){}function Vn(n,e){const t=U.c(12),r=pe(),s=r?.owner,[i,a]=y.useState(null);let o,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(go)},l=[],t[0]=o,t[1]=l):(o=t[0],l=t[1]),y.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 m=s.controller.signal;let u=!1;const p=n.split(",").flatMap(po);return Promise.all(p.map(async x=>{const{source:w,descriptor:S}=x,k=await s.resolve(w);return S?`${k} ${S}`:k})).then(x=>{!u&&!m.aborted&&a({owner:s,signal:m,source:n,value:x.join(", ")})},ho),()=>{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 h;return t[7]!==e||t[8]!==s||t[9]!==n||t[10]!==d?(h=[s,d,n,e],t[7]=e,t[8]=s,t[9]=n,t[10]=d,t[11]=h):h=t[11],y.useEffect(c,h),i&&i.owner===s&&!i.signal.aborted&&i.source===n?i.value:void 0}function ho(){}function po(n){const[e,...t]=n.trim().split(/\s+/);return e?[{source:e,descriptor:t.join(" ")}]:[]}function go(n){return n?.signal.aborted?null:n}function wo(n){const e=U.c(10);let t,r;if(e[0]!==n){const{node:d,children:h,...m}=n;t=h,r=m,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}=At(s,!0),o=s?a:null;let l;e[3]!==t||e[4]!==o?(l=f.jsx(It.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=f.jsx("picture",{...r,ref:i,children:l}),e[6]=r,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function xo(n){const e=U.c(13);let t,r,s;if(e[0]!==n){const{node:u,srcSet:p,media:x,...w}=n;s=p,t=x,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=y.useContext(It),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=io(i?.mode==="document"?c:void 0),h=Vn(s,i?.mode==="document"&&a!==!1&&d);if(i?.mode!=="document")return null;let m;return e[7]!==t||e[8]!==r||e[9]!==h||e[10]!==s||e[11]!==c?(m=f.jsx("source",{...r,srcSet:h,media:c,"data-oc-media-srcset":s,"data-oc-media-query":t}),e[7]=t,e[8]=r,e[9]=h,e[10]=s,e[11]=c,e[12]=m):m=e[12],m}function Lt(n){const e=Un(n,n.src),t=pe(),r=t?.owner,s=y.useContext(Ue),i=_t(e),{setRef:a,near:o}=At(t?.mode==="assistant"&&!i);y.useEffect(()=>i?void 0:r?.register(e),[r,e,i]);const{url:l,fail:c,retry:d}=Kn(e,!!(t&&!i&&!s&&(t.mode!=="assistant"||t.settled&&o)),!0),[h,m]=y.useState(null),u=h?.owner===r&&h?.source===e?h:null,p=y.useMemo(()=>({lastRetry:0,resume:null}),[r,e]),x=y.useRef(p);x.current=p;const w=y.useRef(null),S=n.title||We(e),k=i?u?.failed?void 0:u?.url??e:l,C=!!(k&&(i||t?.mode!=="assistant"||u?.ready===k));return!e||Wn(e)?null:s?f.jsx(Ze,{source:e,name:S,linked:!0}):f.jsxs("span",{ref:a,className:"inline-block max-w-full align-top","data-oc-media-source":Ce(e),children:[!C&&f.jsx(Ze,{source:e,name:S,linked:!1}),k&&f.jsx("video",{ref:w,src:k,title:S,controls:!0,playsInline:!0,hidden:!C,preload:i&&t?.mode!=="document"?"none":"metadata",className:n.className,"data-oc-media-source":Ce(e),onLoadedMetadata:b=>{m({owner:r,source:e,url:u?.url,ready:k});const v=p.resume;v&&(b.currentTarget.currentTime=v.time,v.playing&&b.currentTarget.play().catch(()=>{}),p.resume=null),n.onLoadedMetadata?.(b)},onError:b=>{if(i){const j=Ne(),g=new URL(e,window.location.href),M=new URL(j.api("/api/fs/raw"),window.location.href);if(!(g.origin===M.origin&&g.pathname===M.pathname&&g.searchParams.has("oc_url_token"))||Date.now()-p.lastRetry<1e4){m({owner:r,source:e,failed:!0});return}p.lastRetry=Date.now(),p.resume={time:b.currentTarget.currentTime,playing:!b.currentTarget.paused};const $=r?.controller.signal;g.searchParams.delete("oc_url_token"),yt().then(()=>{$?.aborted||x.current!==p||j!==Ne()||m({owner:r,source:e,url:j.authenticatedAsset("/api/fs/raw",g.searchParams)})},()=>{!$?.aborted&&x.current===p&&m({owner:r,source:e,failed:!0})});return}if(Date.now()-p.lastRetry<1e4){c();return}p.lastRetry=Date.now(),p.resume={time:b.currentTarget.currentTime,playing:!b.currentTarget.paused};const v=r?.controller.signal;d().then(()=>{!v?.aborted&&x.current===p&&w.current?.load()},()=>{!v?.aborted&&x.current===p&&c()})}})]})}function yo(n){const e=U.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]=y.useState(i);let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(R,N)=>{o(F=>{if(F.get(R)===N||!N&&!F.has(R))return F;const E=new Map(F);return N?E.set(R,N):E.delete(R),E})},e[5]=l):l=e[5];const c=l,d=r?.children.filter(So),h=d?.length===1?d[0]:void 0,m=h?.type==="element"&&h.tagName==="a"?h.properties.href:void 0,u=h?.type==="element"&&h.children.length===1&&h.children[0]?.type==="text"?h.children[0].value:"",p=d?.length??0,x=p>1&&d?.every(vo),w=pe()?.mode,S=!!(w==="assistant"&&x&&a.size===p);let k;e[6]!==S?(k={report:c,ready:S},e[6]=S,e[7]=k):k=e[7];const C=k;if(w==="document"&&u&&u===m&&bn(u)){let R;e[8]!==u?(R=f.jsx(Lt,{src:u}),e[8]=u,e[9]=R):R=e[9];let N;return e[10]!==s||e[11]!==R?(N=f.jsx("p",{...s,"data-streamdown":"paragraph",children:R}),e[10]=s,e[11]=R,e[12]=N):N=e[12],N}let b,v;e[13]!==a?(b=[...a.values()],v=b.reduce(ko,0),e[13]=a,e[14]=b,e[15]=v):(b=e[14],v=e[15]);const j=v;let g;if(e[16]!==p||e[17]!==b||e[18]!==s.style||e[19]!==j||e[20]!==S){if(g={...s.style},S){g.display="flex",g.flexWrap="wrap",g.alignItems="flex-start",g.gap="0.5rem";let R;e[22]!==b?(R=b.map(bo),e[22]=b,e[23]=R):R=e[23],g.maxWidth=`calc(min(30rem, ${Math.min(...R)}px) * ${j} + ${(p-1)*.5}rem)`}e[16]=p,e[17]=b,e[18]=s.style,e[19]=j,e[20]=S,e[21]=g}else g=e[21];const M=S?"true":void 0;let P;e[24]!==t||e[25]!==g||e[26]!==s||e[27]!==M?(P=f.jsx("p",{...s,"data-streamdown":"paragraph","data-oc-media-row":M,style:g,children:t}),e[24]=t,e[25]=g,e[26]=s,e[27]=M,e[28]=P):P=e[28];let $;return e[29]!==P||e[30]!==C?($=f.jsx(Bn.Provider,{value:C,children:P}),e[29]=P,e[30]=C,e[31]=$):$=e[31],$}function bo(n){return n.height}function ko(n,e){return n+e.width/e.height}function vo(n){return n.type==="element"&&n.tagName==="img"}function So(n){return n.type!=="text"||n.value.trim()}const Co=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Jt=Array.from(Co).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),jo=n=>Rt(n),Hn=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):""},rt=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=Jt.length>0?e.match(new RegExp(`^(.*(?:/|^)(${Jt})):.*$`,"i")):null;return s&&(e=s[1]??e),dt(e)},Mo=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=rt(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=rt(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=rt(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=rt(r);return o?{path:o}:null},Eo=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,Ro=4,No=1e3,Po=200,je=new Map;let st=0;const en=[],_o=()=>Se()?Po:No,Gn=(n,e)=>`${n}\0${e}`,Ao=(n,e)=>{const t=Rt(n,{preserveWhitespace:!0});if(!t)return Promise.resolve(!1);const r=Gn(e,t),s=je.get(r);if(s)return je.delete(r),je.set(r,s),s;const i=new Promise(o=>{const l=()=>{st+=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(()=>{st=Math.max(0,st-1),en.shift()?.()})};if(st<Ro){l();return}en.push(l)}),a=_o();for(;je.size>=a;){const o=je.keys().next().value;if(typeof o!="string")break;je.delete(o)}return je.set(r,i),i},Io=Pn({exists:qs().optional()}),Lo=async(n,e)=>{const t=new URLSearchParams({path:Rt(n,{preserveWhitespace:!0}),optional:"true"});Mt(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=Io.safeParse(await r.json().catch(()=>null));return s.success?s.data.exists===!1?"missing":"exists":"failed"}catch{return"failed"}},To=Pn({paths:Gs(Nn())}),He=new Map,$o=200,qn=(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=To.safeParse(await t.json().catch(()=>null));return r.success?r.data.paths:null}).catch(()=>null),Oo=(n,e)=>{if(!n||!e||Se())return Promise.resolve(null);const t=Gn(e,n),r=He.get(t);if(r)return r;const s=qn(n,e).then(i=>i?.length===1?i[0]:null);for(;He.size>=$o;){const i=He.keys().next();if(i.done)break;He.delete(i.value)}return He.set(t,s),s};function Oe(n,e){if("key"in n&&n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),n.stopPropagation(),!("key"in n)&&Ir(n.currentTarget.closest("[data-markdown-content]"))))return;const t=/Mac|iPhone|iPad/.test(navigator.platform);e(t?n.metaKey:n.ctrlKey)}const tn=new vn({maxEntries:64,maxBytes:1024*1024});function mt(){const n=U.c(5),{directory:e}=ae(),t=y.useContext(kn),r=t?.editor,s=t?.runtime.isVSCode,i=Ar();let a;return n[0]!==e||n[1]!==r||n[2]!==s||n[3]!==i?(a=async(o,l,c,d)=>{const h=c===void 0?!1:c,u=_e(o,e,"click",d===void 0?"path":d);if(!u)return;const p=l??u.resolvedPath;if(h&&Fs()&&await zs(p))return;if(s&&r){r.openFile(p,u.line,u.column);return}const x=fe.getState();u.line?x.openContextFileAtLine(e,p,u.line,u.column??1):x.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 Do(){const n=U.c(5),{directory:e}=ae(),t=mt(),r=y.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]),y.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 Lo(l.resolvedPath,e),h=d==="missing"&&!/[\\/]/.test(l.path)?await qn(l.path,e):[];!r.current||ue()!==c||(d==="failed"||!h||h.length>1?Xt(l.resolvedPath,{reason:"unreadable",message:null}):d==="missing"&&h.length===0?Xt(l.resolvedPath,{reason:"missing"}):await t(o,h[0]??l.resolvedPath))},n[2]=e,n[3]=t,n[4]=a):a=n[4],a}function Fo(){const n=U.c(5),e=y.useContext(kn),{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"||Ds(s)){i=null;break e}let l;n[2]!==o||n[3]!==t?(l=c=>{o(c).catch(()=>{xt.error(t("sidebarFilesTree.toast.revealFailed"))})},n[2]=o,n[3]=t,n[4]=l):l=n[4],i=l}return i}const zo=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Wo=(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=jo(n).split("/").filter(Boolean).pop()??"";if(!s||s==="."||s==="..")return!1;const i=s.toLowerCase();return zo.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=Mo(s?Hn(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||!Wo(i.path,t,a))return null;const o=_r(e,i.path,{preserveWhitespace:a});return o?{...i,resolvedPath:o}:null}async function Zn(n,e,t="path"){const r=_e(n,e,"probe",t);return r?!Mt(r.resolvedPath,e)||await Ao(r.resolvedPath,e)?r.resolvedPath:/[\\/]/.test(r.path)?null:Oo(r.path,e):null}async function Uo(n,e,t,r=s=>Zn(s,e)){if(n.length>2e5)return[];let s=tn.get(n);if(!s){s=Array.from(n.matchAll(Eo),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 Bo=n=>{const e=Us.getState().ordered;return Or(Dr.getState().ordered)(n)||Fr(e,zr.getState().identities).match(n)?!0:Wr(n,e)!==null},Xn=(n,e,t,r)=>{const s=Sn.getState().guests.find(a=>a.id===n.guestId);if(!s||!Lr(s,"links"))return!1;if(n.action==="attach")return n.url?(Tr.getState().setPendingGuestIssue(Ws({providerId:s.id,id:n.identifier,title:n.identifier,url:n.url})),!0):!1;if(!Cn(s))return e==="link"?!1:(xt.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:(xt.info(r("chat.guestLink.noProject",{name:s.name})),!0)};function Yn(n,e){const t=U.c(8),r=e===void 0?"path":e,{directory:s,fileReferences:i,confirmFile:a}=ae();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=ue(),t[0]=o):o=t[0];const l=o,[c,d]=y.useState(null);let h,m;return t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==n?(h=()=>{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}},m=[n,r,s,i,l,a],t[1]=a,t[2]=s,t[3]=i,t[4]=r,t[5]=n,t[6]=h,t[7]=m):(h=t[6],m=t[7]),y.useEffect(h,m),i&&c?.raw===n&&c.inputKind===r&&c.directory===s&&c.runtimeKey===l?c.path:null}const Ko=32;function Vo(n){const e=U.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(Ho).join("")??"",e[4]=t?.children,e[5]=i):i=e[5];const a=i,o=Yn(a),l=mt(),c=Do(),{directory:d,fileNavigation:h,fileReferences:m}=ae();let u;e[6]!==l||e[7]!==o||e[8]!==a?(u=R=>{o&&Oe(R,N=>{l(a,o,N)})},e[6]=l,e[7]=o,e[8]=a,e[9]=u):u=e[9];const p=u,x=h&&!m&&_e(a,d)!==null;let w;e[10]!==c||e[11]!==a?(w=R=>{R.currentTarget.closest('a, button, [role="button"], summary')||Oe(R,()=>{c(a)})},e[10]=c,e[11]=a,e[12]=w):w=e[12];const S=w,k=a.length>0&&a.length<=Ko?"":void 0,C=o?"true":void 0,b=o?a:void 0,v=o??void 0,j=o?"button":void 0,g=o?0:void 0,M=o?p:x?S:void 0,P=o?p:void 0;let $;return e[13]!==r||e[14]!==s||e[15]!==M||e[16]!==P||e[17]!==k||e[18]!==C||e[19]!==b||e[20]!==v||e[21]!==j||e[22]!==g?($=f.jsx("code",{...s,dir:"ltr","data-streamdown":"inline-code","data-short":k,"data-openchamber-file-link":C,"data-openchamber-file-ref":b,"data-openchamber-file-path":v,role:j,tabIndex:g,onClick:M,onKeyDown:P,children:r}),e[13]=r,e[14]=s,e[15]=M,e[16]=P,e[17]=k,e[18]=C,e[19]=b,e[20]=v,e[21]=j,e[22]=g,e[23]=$):$=e[23],$}function Ho(n){return n.type==="text"?n.value:""}function Go(n){const e=U.c(10),{purpose:t}=ae();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=f.jsx(Ue.Provider,{value:!0,children:s}),e[3]=s,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=f.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=f.jsx(Xo,{...n}),e[8]=n,e[9]=r):r=e[9],r}function qo(n){const e=U.c(3),{src:t}=n,[r,s]=y.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=f.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:f.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 Qn=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 Zo(n){const e=U.c(25),{identifier:t,className:r,children:s}=n,{guestLinks:i,directory:a}=ae(),{t:o}=ge();let l;e[0]!==i||e[1]!==t?(l=i?yn(i,t):null,e[0]=i,e[1]=t,e[2]=l):l=e[2];const c=l;let d;e[3]!==c?(d=v=>c?v.guests.find(j=>j.id===c.guestId):void 0,e[3]=c,e[4]=d):d=e[4];const h=Sn(d),m=h?.name,u=Et(a);if(!c||!h||!m){let v;return e[5]!==s?(v=f.jsx(f.Fragment,{children:s}),e[5]=s,e[6]=v):v=e[6],v}const p=c.action==="open"&&!Cn(h)?c.url:void 0;let x;e[7]!==c||e[8]!==a||e[9]!==u||e[10]!==p||e[11]!==o?(x=v=>{"key"in v&&v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),v.stopPropagation(),p?u(p):Xn(c,"identifier",a,o))},e[7]=c,e[8]=a,e[9]=u,e[10]=p,e[11]=o,e[12]=x):x=e[12];const w=x;let S;e[13]!==c.action||e[14]!==t||e[15]!==m||e[16]!==p||e[17]!==o?(S=p||(c.action==="open"?o("chat.guestLink.open",{identifier:t,name:m}):o("chat.guestLink.attach",{identifier:t,name:m})),e[13]=c.action,e[14]=t,e[15]=m,e[16]=p,e[17]=o,e[18]=S):S=e[18];const k=S,C=r?`${r} cursor-pointer`:"cursor-pointer";let b;return e[19]!==w||e[20]!==s||e[21]!==c.guestId||e[22]!==k||e[23]!==C?(b=f.jsx("a",{role:"button",tabIndex:0,className:C,"data-oc-guest-link":c.guestId,title:k,"aria-label":k,onClick:w,onKeyDown:w,children:s}),e[19]=w,e[20]=s,e[21]=c.guestId,e[22]=k,e[23]=C,e[24]=b):b=e[24],b}function Xo(n){const e=U.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=Qn(r),e[5]=r,e[6]=o):o=e[6];let l;return e[7]!==s||e[8]!==i.className||e[9]!==o?(l=f.jsx(Zo,{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:h,...m}=i;o=m,e[11]=i,e[12]=o}else o=e[12];let l;e[13]!==s?(l=f.jsx(Ue.Provider,{value:!0,children:s}),e[13]=s,e[14]=l):l=e[14];let c;return e[15]!==o||e[16]!==l?(c=f.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=f.jsx(Yo,{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 Yo(n){const e=U.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=f.jsx(Ue.Provider,{value:!0,children:s}),e[5]=s,e[6]=a):a=e[6];const o=a,l=ae(),{directory:c}=l,{t:d}=ge(),h=Et(c),m=mt(),u=pe(),p=fe(Jo);let x;e[7]!==r?(x=Qn(r),e[7]=r,e[8]=x):x=e[8];const w=x;let S;e[9]!==t?(S=Ur(t),e[9]=t,e[10]=S):S=e[10];const k=S,C=Br(t);let b;e[11]!==t?(b=Kr(t),e[11]=t,e[12]=b):b=e[12];const v=b,j=Se()?null:Vr(t,Hr());let g;e[13]!==t?(g=Se()?null:Tn(t),e[13]=t,e[14]=g):g=e[14];const M=g,P=y.useContext(Gr),$=j?P.get(qr(j)):void 0,R=y.useContext(Zr);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 F=N;let E;e[18]!==t?(E=xn(t),e[18]=t,e[19]=E):E=e[19];const I=E;let B;e[20]!==c||e[21]!==t||e[22]!==l.fileNavigation?(B=l.fileNavigation&&_e(t,c,"click","href"),e[20]=c,e[21]=t,e[22]=l.fileNavigation,e[23]=B):B=e[23];const A=B,_=Fo();let K;e[24]!==A||e[25]!==t||e[26]!==l.fileNavigation||e[27]!==_?(K=l.fileNavigation&&!A&&_?Hn(t):null,e[24]=A,e[25]=t,e[26]=l.fileNavigation,e[27]=_,e[28]=K):K=e[28];const q=K,J=!!(A||q||I||j||k||C||v),ee=J?t:w,T=Yn(ee,J?"href":"path"),z=!!(T&&!J);let Z;e[29]!==t?(Z=Xr(t),e[29]=t,e[30]=Z):Z=e[30];const V=Z,H=r?.properties.dataOcReference!==void 0;let O;e[31]!==V||e[32]!==t||e[33]!==T||e[34]!==H?(O=V&&!T&&!H?Yr(t):null,e[31]=V,e[32]=t,e[33]=T,e[34]=H,e[35]=O):O=e[35];const G=O;let X;e[36]!==c||e[37]!==t||e[38]!==p||e[39]!==l.loopbackPreview?(X=l.loopbackPreview&&Qr(t)&&c&&!(Bs()&&p),e[36]=c,e[37]=t,e[38]=p,e[39]=l.loopbackPreview,e[40]=X):X=e[40];const te=X,se=l.guestLinks&&V&&!j&&!I&&!A&&!q&&!z&&!k&&!C&&!v&&!M?Jr(l.guestLinks,t):null;let oe;e[41]!==I||e[42]!==c||e[43]!==V||e[44]!==A||e[45]!==q||e[46]!==se||e[47]!==t||e[48]!==u||e[49]!==h||e[50]!==m||e[51]!==T||e[52]!==l.disableLinkSafety||e[53]!==_||e[54]!==j||e[55]!==k||e[56]!==d||e[57]!==w||e[58]!==z?(oe=D=>{if(!(u?.documentAssets&&Qs(D,u.documentAssets))){if(z&&T){Oe(D,ce=>{m(w,T,ce)});return}if(j&&(!V||!(D.metaKey||D.ctrlKey||D.shiftKey||D.altKey))){D.preventDefault(),rs(j.sessionId,j.messageId);return}if(I){D.preventDefault(),D.stopPropagation(),Wt(t);return}if(!k){if(A){Oe(D,ce=>{m(t,T??void 0,ce,"href")});return}if(q&&_){Oe(D,()=>_(q));return}if(t.startsWith("#")&&!u?.documentAssets){D.preventDefault();const ce=decodeURIComponent(t.slice(1)),de=D.currentTarget.closest("[data-markdown-content]");(de?Array.from(de.querySelectorAll("[id]")).find(Ke=>Ke.id===ce):null)?.scrollIntoView({block:"nearest"});return}if(se&&!nn(D)&&!Bo(t)&&Xn(se,"link",c,d)){D.preventDefault(),D.stopPropagation();return}V&&!l.disableLinkSafety&&!nn(D)&&(D.preventDefault(),D.stopPropagation(),h(t))}}},e[41]=I,e[42]=c,e[43]=V,e[44]=A,e[45]=q,e[46]=se,e[47]=t,e[48]=u,e[49]=h,e[50]=m,e[51]=T,e[52]=l.disableLinkSafety,e[53]=_,e[54]=j,e[55]=k,e[56]=d,e[57]=w,e[58]=z,e[59]=oe):oe=e[59];const le=oe;if(v){const D=v.openable?Ft:es,ce=v.openable?v.filename:void 0,de=v.openable?"button":void 0,Ye=v.openable?0:void 0,Ke=`#${v.iconId}`;let Ie;e[60]!==Ke?(Ie=f.jsx("svg",{className:"size-[1.1em] shrink-0","aria-hidden":"true",children:f.jsx("use",{href:Ke})}),e[60]=Ke,e[61]=Ie):Ie=e[61];let Le;e[62]!==v.filename?(Le=f.jsx("span",{className:zt,children:v.filename}),e[62]=v.filename,e[63]=Le):Le=e[63];let Qe;return e[64]!==v.filename||e[65]!==v.iconId||e[66]!==D||e[67]!==ce||e[68]!==de||e[69]!==Ye||e[70]!==Ie||e[71]!==Le?(Qe=f.jsxs("span",{className:D,"data-attachment-citation":v.iconId,"data-attachment-open":ce,role:de,tabIndex:Ye,title:v.filename,children:[Ie,Le]}),e[64]=v.filename,e[65]=v.iconId,e[66]=D,e[67]=ce,e[68]=de,e[69]=Ye,e[70]=Ie,e[71]=Le,e[72]=Qe):Qe=e[72],Qe}if(M){let D;e[73]!==M.kind||e[74]!==M.source?(D=()=>ti({source:M.source,confirmed:M.kind==="path"}),e[73]=M.kind,e[74]=M.source,e[75]=D):D=e[75];let ce;e[76]===Symbol.for("react.memo_cache_sentinel")?(ce=f.jsx(he,{name:"download",className:"size-4"}),e[76]=ce):ce=e[76];let de;return e[77]!==o||e[78]!==D?(de=f.jsxs(ve,{type:"button",variant:"outline",size:"sm",className:"my-1 align-middle",onClick:D,children:[ce,o]}),e[77]=o,e[78]=D,e[79]=de):de=e[79],de}if(j&&$){let D;return e[80]!==$||e[81]!==j?(D=f.jsx(ss,{chip:$,target:j}),e[80]=$,e[81]=j,e[82]=D):D=e[82],D}if(F){let D;return e[83]!==F.chip||e[84]!==F.url?(D=f.jsx(ts,{chip:F.chip,url:F.url}),e[83]=F.chip,e[84]=F.url,e[85]=D):D=e[85],D}if(C)return f.jsx("a",{"data-openchamber-agent-mention":"true",className:"text-primary hover:underline",href:ns(C),target:"_blank",rel:"noopener noreferrer",children:o});let L;e[86]!==G?(L=G&&f.jsx(qo,{src:G}),e[86]=G,e[87]=L):L=e[87];const W=w===t?"ltr":i.dir,ie=k?Ft:i.className,Y=k??void 0,ne=k?`$${k}`:i.title,Q=T?"true":void 0,me=T?ee:void 0,Xe=T??void 0;let we;e[88]!==I||e[89]!==t?(we=D=>{I&&(D.preventDefault(),D.button===1&&Wt(t))},e[88]=I,e[89]=t,e[90]=we):we=e[90];const Be=I?Qo:void 0;let xe;e[91]!==k?(xe=k&&f.jsx(he,{name:"book-open",className:"size-[1.1em] shrink-0"}),e[91]=k,e[92]=xe):xe=e[92];let ye;e[93]!==o||e[94]!==k?(ye=k?f.jsx("span",{className:zt,children:k}):o,e[93]=o,e[94]=k,e[95]=ye):ye=e[95];let be;e[96]!==le||e[97]!==t||e[98]!==i||e[99]!==W||e[100]!==ie||e[101]!==Y||e[102]!==ne||e[103]!==Q||e[104]!==me||e[105]!==Xe||e[106]!==we||e[107]!==Be||e[108]!==xe||e[109]!==ye?(be=f.jsxs("a",{...i,href:t,target:"_blank",rel:"noopener noreferrer",dir:W,className:ie,"data-skill-name":Y,title:ne,"data-openchamber-file-link":Q,"data-openchamber-file-ref":me,"data-openchamber-file-path":Xe,onClick:le,onAuxClick:we,onDragStart:Be,children:[xe,ye]}),e[96]=le,e[97]=t,e[98]=i,e[99]=W,e[100]=ie,e[101]=Y,e[102]=ne,e[103]=Q,e[104]=me,e[105]=Xe,e[106]=we,e[107]=Be,e[108]=xe,e[109]=ye,e[110]=be):be=e[110];let ke;e[111]!==c||e[112]!==t||e[113]!==te||e[114]!==d?(ke=te&&f.jsx($e,{label:d("terminalView.preview.openTitle"),children:f.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:f.jsx(he,{name:"global",className:"size-3.5"})})}),e[111]=c,e[112]=t,e[113]=te,e[114]=d,e[115]=ke):ke=e[115];let Ae;return e[116]!==L||e[117]!==be||e[118]!==ke?(Ae=f.jsxs(f.Fragment,{children:[L,be,ke]}),e[116]=L,e[117]=be,e[118]=ke,e[119]=Ae):Ae=e[119],Ae}function Qo(n){return n.preventDefault()}function Jo(n){return n.openLinksInBrowserPanel}const ea=()=>Nt(()=>import("./MarkdownDiffPreview-gCh_8R1F.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])).then(n=>n.default),ta=()=>{};function na(n){const e=U.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,ea,ta);let o;return e[3]!==a||e[4]!==i||e[5]!==t?(o=f.jsx("div",{"data-streamdown":"code-block-body","data-language":"diff",children:i&&a?f.jsx(a,{source:t}):f.jsx(as,{diff:t})}),e[3]=a,e[4]=i,e[5]=t,e[6]=o):o=e[6],o}const ra=y.memo(function(e){const t=U.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-C8KpNQaC.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-BDLOJuy5.js","assets/katex.min-DklPh68d.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-DV_WH382.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-BWbKx7qU.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-CFvXza4M.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-mgtjJMMz.js","assets/PatchDiff-DxGkHtIk.js","assets/parseDiffFromFile-D28_u-uC.js","assets/computeVirtualFileMetrics-Bc_YiqAD.js","assets/themeResolver-DjCwdtoe.js","assets/vendor-pierre-theming-Dn546TCS.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-Cx5SgKlQ.js","assets/getFiletypeFromFileName-BgI9McTw.js","assets/pierreDiffTint-CLCzflgS.js","assets/appThemeRegistry-C4Av1s90.js","assets/diffsHighlighter-CFc933Ip.js","assets/editorCodeMetrics-CNBjOGNA.js","assets/ReplyCommand-OczgxN8d.js","assets/vendor-beautiful-mermaid-ejhkvCZj.js","assets/vendor-elkjs-BbOXcsZg.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{R as y,f as U,j as f,a as mr}from"./vendor-react--VO_rL_p.js";import{iM as xn,iN as hr,iO as jt,iP as pr,iQ as gr,iR as wr,iS as xr,iT as yr,iU as br,iV as yn,iW as kr,bE as Mt,iX as vr,iY as Sr,iZ as Cr,i_ as jr,i$ as Mr,j0 as Dt,j1 as Er,j2 as bn,j3 as We,j4 as Ce,j5 as Rr,u as ge,j6 as Et,j7 as Nr,a2 as ot,B as ve,z as Pr,I as he,j8 as Rt,bn as _r,j9 as kn,ja as Ar,jb as vn,A as xt,jc as Ir,bo as Sn,jd as Lr,f1 as Tr,je as Cn,jf as $r,jg as Or,jh as Dr,ji as Fr,cs as zr,jj as Wr,jk as Ur,jl as Br,jm as Kr,jn as Vr,jo as Hr,jp as Gr,jq as qr,jr as Zr,js as Xr,jt as Yr,ju as Qr,jv as Jr,jw as Ft,jx as es,jy as zt,jz as ts,jA as ns,c9 as $e,bc as rs,jB as Wt,jC as ss,jD as is,jE as os,ap as as,jF as ls,jG as cs,eE as ds,aV as jn,jH as us,jI as fs,jJ as ms,jK as hs,bb as ut,a5 as Ut,a6 as Bt,a7 as Kt,a8 as Vt,n as ps,dC as Ve,jL as gs,Q as Ht,jM as ws,jN as xs,jO as Je,jP as ys,bO as Mn,an as bs,ao as ks,dp as vs,jQ as Ss,jR as Cs,jS as js,jT as Ms,jU as Es,jV as Rs,ak as Ns}from"./useAppFontEffects-BDLOJuy5.js";import{o as Gt,X as at,j as Ps,w as ze,D as _s,I as As,k as Is,W as Ls,L as En,U as Ts}from"./vendor-streamdown-BbSYZ3NF.js";import{b8 as $s,W as ue,ae as Ne,m as Se,ab as yt,j as ft,a6 as Rn,b9 as Os,ba as Ds,_ as Fs,bb as zs,u as fe,bc as Ws,bd as Us,aA as Bs,U as Ks,be as Vs}from"./katex.min-DklPh68d.js";import{B as lt}from"./vendor-streamdown-cjk-CeadmtR2.js";import{g as Hs}from"./vendor-streamdown-math-SFa9Faw2.js";import{s as Nn,o as Pn,c as Gs,e as qs}from"./vendor-zod-DV_WH382.js";import{a as Zs}from"./vendor-markdown-BTUqNk6W.js";import{i as Xs,r as Ys,o as Qs,M as _n,b as Js,B as qt,a as Zt,c as ei}from"./useMarkdownLocalAssets-BjT607tF.js";import{r as ti}from"./install-request-CzRei4tp.js";import{t as Xt}from"./contextFileOpenGuard-D-HtBtn6.js";import{_ as Nt}from"./vendor-vite-runtime-DD1OZmLC.js";import{l as ni,s as ri,C as si}from"./columnWidthMemory-D8H-O0YE.js";import{p as ii,i as oi,a as bt,b as ai,s as An}from"./vendor-yaml-CE-D_49-.js";const In=["note","tip","important","warning","caution"],Ln=n=>In.find(e=>e===n)??null,li=/^\[!(note|tip|important|warning|caution)\][\t ]*(?:\r?\n|$)/i;function ci(n){const e=n.children[0];if(e?.type!=="paragraph")return;const t=e.children[0];if(t?.type!=="text")return;const r=li.exec(t.value),s=Ln(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 di(){return n=>{const e=t=>{if(t.type==="blockquote"&&ci(t),"children"in t)for(const r of t.children)e(r)};e(n)}}function ui(n){return n.type==="root"}const fi=/^ {0,3}<details(?:\s+(open(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?))?\s*>\s*<summary\s*>([\s\S]*?)<\/summary\s*>/i;function et(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 mi=/^(\s*<h([1-6])(?:\s+[^\s"'<>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'<>=]+))?)*\s*>)([\s\S]*?)<\/h\2\s*>\s*$/i,hi=[1,2,3,4,5,6];function pi(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 gi(){const n=t=>{const r=this.parse(t);if(!ui(r))throw new Error("Disclosure parsing requires a Markdown root");return t.startsWith("\uFEFF")&&et(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 m of r.slice(i,a).split(new RegExp("(?<=\\n)"))){const u=/^ {0,3}> ?/.exec(m)?.[0].length??0;for(let p=u;p<m.length;p++)o.push(c+p),l+=m[p];c+=m.length}o.push(a);const d=n(l);e(d,l);const h=m=>{if(m.position)for(const u of[m.position.start,m.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 m)for(const u of m.children)h(u)};h(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=fi.exec(r.slice(o));if(!l)continue;const c=o+l[0].length,{bodyEnd:d,end:h}=pi(r,c),m=r.slice(c,d),u=n(m);e(u,m),et(u,r,c);const p=/<summary\s*>/i.exec(l[0]),x=o+(p?.index??0)+(p?.[0].length??0),w=l[2]??"",S=mi.exec(w),k=S?S[3]:w,C=n(k);et(C,r,x+(S?.[1].length??0));const b=C.children[0],v=b?.type==="paragraph"?b.children:[{type:"text",value:k}],j=hi.find(F=>String(F)===S?.[2]),g={type:"ocDisclosureSummary",data:{hName:"summary"},children:j?[{type:"heading",depth:j,children:v}]:v},M={type:"ocDisclosure",data:{hName:"details",hProperties:l[1]?{open:!0}:{}},children:[g,...u.children]};let P=1,$=a.position?.end?.offset??h;for(;i+P<s.length;){const F=s[i+P];if((F.position?.start?.offset??r.length)>=h)break;$=F.position?.end?.offset??h,P++}const R=n(r.slice(h,$));et(R,r,h);const N=R.children;s.splice(i,P,M,...N)}};return(t,r)=>e(t,r.toString())}const wi=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,h,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,x){return w;function w(C){return u.consume(C),S}function S(C){return!i||C!==(s?93:41)?x(C):(u.consume(C),s?k:p)}function k(C){return C===32||C===9?(u.consume(C),k):C===null||C<0?p(C):x(C)}}};function h(u){return n.exit("ocMathValue"),n.enter("ocMathMarker"),n.consume(u),m}function m(u){return n.consume(u),n.exit("ocMathMarker"),n.exit("ocMath"),e}return a},xi=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))}},yi={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 bi(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 ki(){const n=this.data();return(n.micromarkExtensions??=[]).push({text:{92:{name:"ocMath",tokenize:wi},36:{name:"ocDollarMath",tokenize:xi}}}),(n.fromMarkdownExtensions??=[]).push(yi),(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;bi(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?",Tn=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}},vi=new Set(["align","alt","checked","colSpan","controls","disabled","height","href","media","open","playsInline","preload","rel","rowSpan","src","srcSet","start","target","title","type","width"]),qe=Nn();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 Si(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)||Tn(n)!==null)}function Ci({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 m=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");!vi.has(d)&&!m&&delete o.properties[d]}if(o.properties.href!==void 0){const d=qe.safeParse(o.properties.href);d.success&&Si(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=qe.safeParse(o.properties.src);if(d.success){const h=d.data,m=o.tagName==="img"&&/^data:image\/(?:png|jpeg|gif|webp);base64,(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(h);h===h.trim()&&(kt(h)||ct(h)||m)?(o.properties.dataOcMediaSource=h,ct(h)&&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=qe.safeParse(o.properties.srcSet);d.success&&d.data.split(",").every(m=>{const[u,p,...x]=m.trim().split(/\s+/);return!!u&&kt(u)&&x.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 ji(){return n=>{function e(t){for(const r of t.children)if(r.type==="element"){if(r.tagName==="a"){const s=qe.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=qe.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 Mi=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote"]),Ei=new Set(["code","pre","ul","ol","blockquote","table","details"]),Ri=new Set(["p","h1","h2","h3","h4","h5","h6","li","br","div"]);function $n(n){if(n.type==="text")return n.value;if(n.type!=="element"||Ei.has(n.tagName))return" ";const e=n.children.map($n).join("");return Ri.has(n.tagName)?` ${e} `:e}function On(n){const e=n.children.map(t=>t.type==="element"?On(t):void 0);if(Mi.has(n.tagName)){const t=$s(n.children.map($n).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 Ni(){return n=>{for(const e of n.children)e.type==="element"&&On(e)}}const Dn={singleTilde:!1},Pi=at.gfm,_i=[[Pi[0],Dn],...Object.values(at).filter(n=>n!==at.gfm)],Ai=lt.remarkPluginsAfter.at(-1),Ii={...lt,remarkPluginsAfter:[...lt.remarkPluginsAfter.slice(0,-1),[Ai,Dn]]};function Li(n=!1){return n?lt:Ii}const Qt=Hs({singleDollarTextMath:!1}),Ti={...Qt,remarkPlugin:function(){return this.use([Qt.remarkPlugin]),ki.call(this)}},$i={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",...In]]},protocols:{src:["http","https"]},clobberPrefix:"",required:{input:{type:"checkbox",disabled:!0}}};function Oi(){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 Di(){const n=this.data();(n.micromarkExtensions??=[]).push({disable:{null:["htmlFlow","htmlText","characterReference"]}})}function Fi(){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||!jt(t.slice(s,i))})}}function tt(n,e,t){return{remarkPlugins:[...t?Object.values(at):_i,gi,di,Fi,Oi],rehypePlugins:[...n?[Gt.raw]:[],[Ci,{isVSCode:e}],[Zs,$i],Gt.harden,ji,Ni]}}const zi=[!1,!0].flatMap(n=>[tt(!1,!1,n),tt(!1,!0,n),tt(!0,!1,n),tt(!0,!0,n)]);function Wi(n,e,t=!1){return zi[(t?4:0)+(n?2:0)+(e?1:0)]}const Ui=new Set(["inlineCode","code","html","math","inlineMath"]);function Bi(n){return e=>{const t=r=>{if(!Ui.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 Ki=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Vi=n=>{const{issuePrefix:e,changeRequestPrefix:t}=n.descriptor.terminology,r=[...new Set([e,t])].sort((s,i)=>i.length-s.length).map(Ki).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")},Hi=(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=xr(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=yr(n,e.sha);return i?{url:i,children:[{type:"inlineCode",value:e.sha.slice(0,7)}]}:null}return null},Gi=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},qi=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function Zi(n){const e=Vi(n),t=r=>{const s=[];let i=0;for(const a of r.matchAll(e)){const o=a.groups?Hi(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(qi.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+Gi(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 Xi=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},Yi=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function Qi(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=yn(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(Yi.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+Xi(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 Ji=/^\/api\/source-control\/[^/?#]+\/uploads\/[0-9a-f]{32}\/[^/?#]+\?/,nt=new Map;class eo{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||!Ji.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(!Xs(e))throw new Error("Document source is unavailable");const u=Ys(c.filePath,e),p=c.workspaceRoot,x={path:u,directory:p||void 0,allowOutsideWorkspace:p&&Mt(u,p)?void 0:"true"};if(t){if(Se())throw new Error("Video bridge is unavailable");return await yt(),this.check(s),Ne().authenticatedAsset("/api/fs/raw",x)}return this.readDocumentImage(u,"/api/fs/raw",x,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 h=[...this.sources.keys()].slice(0,12);if(!h.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:h.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 m=(await this.batch).get(e);if(this.check(s),m?.status!=="ready")throw new Error("Image is unavailable");if(!t&&Cr()){const u=await jr(m,a,s);return this.check(s),u}return await yt(),this.check(s),Mr(m,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=nt.get(t);return r||(r=new Set,nt.set(t,r)),r.add(e),()=>{r.delete(e),r.size||nt.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=[...nt.get(s)??[]].filter(d=>d.element.isConnected).sort((d,h)=>d.element.compareDocumentPosition(h.element)&4?-1:1),a=await Promise.allSettled(i.map(d=>d.resolve()));this.check(r);const o=i.flatMap((d,h)=>{const m=a[h];return m?.status==="fulfilled"?[{url:m.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:h,load:m})=>({url:d,filename:h,load:m})),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 Fn=y.createContext(null),Ue=y.createContext(!1),pe=()=>y.useContext(Fn);function to(n){const e=U.c(23),{content:t,mode:r,sessionId:s,messageId:i,directory:a,settled:o,documentAssets:l,onShowPopup:c,children:d}=n,[h,m]=y.useReducer(no,0);let u,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>Rn(()=>m()),p=[],e[0]=u,e[1]=p):(u=e[0],p=e[1]),y.useEffect(u,p);let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=ue(),e[2]=x):x=e[2];const w=x;let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=Ne(),e[3]=S):S=e[3];const k=S,C=l?.filePath,b=l?.workspaceRoot;let v;e[4]!==a||e[5]!==C||e[6]!==i||e[7]!==r||e[8]!==s||e[9]!==b?(v=new eo({mode:r,directory:a,sessionId:s,messageId:i,documentAssets:C?{filePath:C,workspaceRoot:b??null}:void 0}),e[4]=a,e[5]=C,e[6]=i,e[7]=r,e[8]=s,e[9]=b,e[10]=v):v=e[10];const j=v;let g,M;e[11]!==j?(g=()=>{if(w!==ue()||k!==Ne()){j.dispose(),m();return}j.connect();const N=Os(()=>j.dispose());return()=>{N(),j.disconnect()}},M=[j,k,w],e[11]=j,e[12]=g,e[13]=M):(g=e[12],M=e[13]),y.useLayoutEffect(g,M);let P;e[14]!==l||e[15]!==r||e[16]!==c||e[17]!==j||e[18]!==o?(P={owner:j,mode:r,settled:o,documentAssets:l,onShowPopup:c},e[14]=l,e[15]=r,e[16]=c,e[17]=j,e[18]=o,e[19]=P):P=e[19];const $=P;let R;return e[20]!==d||e[21]!==$?(R=f.jsx(Fn.Provider,{value:$,children:d}),e[20]=d,e[21]=$,e[22]=R):R=e[22],R}function no(n){return n+1}const zn=y.createContext(null),Pt=y.createContext(null);function ae(){const n=y.useContext(Pt);if(!n)throw new Error("Markdown components require MarkdownContent");return n}const _t=n=>/^(?:https?:)?\/\//i.test(n),Wn=n=>n==="streamdown:incomplete-image",Un=(n,e)=>n["data-oc-media-source"]??e??"",Bn=y.createContext(null),ro=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 At(n,e){const t=U.c(7),r=e===void 0?!1:e,s=y.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]=y.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(x=>{x.some(so)&&(l(!0),p.disconnect())},r?{root:ro(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]),y.useEffect(c,d);const h=!n||o;let m;return t[5]!==h?(m={ref:s,setRef:a,near:h},t[5]=h,t[6]=m):m=t[6],m}function so(n){return n.isIntersecting}function io(n){const e=U.c(4);let t;e[0]!==n?(t=i=>{if(!n)return ao;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],y.useSyncExternalStore(r,s,oo)}function oo(){return!0}function ao(){}const It=y.createContext(null);function Ze(n){const e=U.c(23),{source:t,name:r,title:s,linked:i,state:a}=n,{t:o}=ge(),l=y.useContext(Pt),c=pe(),d=Et(l?.directory??c?.owner?.options.directory??"");let h;e[0]!==a||e[1]!==o||e[2]!==s?(h=a==="failed"?o("common.image.loadFailed"):s,e[0]=a,e[1]=o,e[2]=s,e[3]=h):h=e[3];let m;e[4]!==t?(m=Ce(t),e[4]=t,e[5]=m):m=e[5];let u;e[6]!==a?(u=a==="loading"?f.jsx(Pr,{className:"size-3.5","aria-hidden":!0}):f.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]!==h||e[11]!==m||e[12]!==u?(p=f.jsxs("span",{title:h,"data-oc-media-source":m,"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]=h,e[11]=m,e[12]=u,e[13]=p):p=e[13];const x=p;if(!_t(t)||i||Nr(t))return x;let w;e[14]!==d||e[15]!==l?.disableLinkSafety||e[16]!==l?.purpose||e[17]!==t?(w=k=>{l?.purpose||l?.disableLinkSafety||k.metaKey||k.ctrlKey||k.shiftKey||k.altKey||(k.preventDefault(),k.stopPropagation(),d(t))},e[14]=d,e[15]=l?.disableLinkSafety,e[16]=l?.purpose,e[17]=t,e[18]=w):w=e[18];let S;return e[19]!==x||e[20]!==t||e[21]!==w?(S=f.jsx("a",{href:t,className:"external-link",target:"_blank",rel:"noopener noreferrer",onClick:w,children:x}),e[19]=x,e[20]=t,e[21]=w,e[22]=S):S=e[22],S}function Kn(n,e,t){const r=U.c(22),s=t===void 0?!1:t,i=pe(),a=i?.owner,[o,l]=y.useState(null),[c,d]=y.useState(null);let h;r[0]!==i?.mode?(h=()=>{i?.mode==="document"&&l(lo)},r[0]=i?.mode,r[1]=h):h=r[1];const m=i?.mode;let u;r[2]!==m?(u=[m],r[2]=m,r[3]=u):u=r[3],y.useLayoutEffect(h,u);let p,x;r[4]!==e||r[5]!==a||r[6]!==n||r[7]!==s?(p=()=>{if(!a||!n||!e)return;const v=a.controller.signal;let j=!1;return a.resolve(n,s).then(g=>{!j&&!v.aborted&&(d(null),l({owner:a,signal:v,source:n,url:g}))},()=>{!j&&!v.aborted&&d({owner:a,signal:v,source:n,url:""})}),()=>{j=!0}},x=[a,n,e,s],r[4]=e,r[5]=a,r[6]=n,r[7]=s,r[8]=p,r[9]=x):(p=r[8],x=r[9]),y.useEffect(p,x);const w=c?.owner===a&&c?.source===n,S=o&&o.owner===a&&o.source===n&&(i?.mode!=="document"||!o.signal.aborted)&&!w?o.url:void 0;let k;r[10]!==a||r[11]!==n?(k=()=>{a&&d({owner:a,signal:a.controller.signal,source:n,url:""})},r[10]=a,r[11]=n,r[12]=k):k=r[12];let C;r[13]!==a||r[14]!==n||r[15]!==s?(C=async()=>{if(!a)throw new Error("Missing media owner");const v=a.controller.signal,j=await a.resolve(n,s,!0);v.aborted||(d(null),l({owner:a,signal:v,source:n,url:j}))},r[13]=a,r[14]=n,r[15]=s,r[16]=C):C=r[16];let b;return r[17]!==w||r[18]!==S||r[19]!==k||r[20]!==C?(b={url:S,failed:w,fail:k,retry:C},r[17]=w,r[18]=S,r[19]=k,r[20]=C,r[21]=b):b=r[21],b}function lo(n){return n?.signal.aborted?null:n}const co=(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 uo(n){const e=U.c(9),t=Un(n,n.src),r=pe(),s=y.useContext(Ue);if(Wn(t))return null;if(!s&&Rr(t,n.alt??""))return f.jsx(Lt,{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"?f.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 f.jsx(Ze,{source:t,name:We(t,n.alt),title:n.title,linked:s});let i;return e[6]!==n||e[7]!==t?(i=f.jsx(fo,{...n,source:t}),e[6]=n,e[7]=t,e[8]=i):i=e[8],i}function fo(n){const e=U.c(92);let t,r,s,i,a,o,l,c,d,h,m;if(e[0]!==n){const{source:Q,node:me,src:Xe,srcSet:we,alt:Be,title:xe,className:ye,style:be,width:ke,height:Ae,onLoad:D,onError:ce,...de}=n;o=Q,l=we,d=Be,h=xe,t=ye,c=be,m=ke,r=Ae,i=D,s=ce,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]=h,e[11]=m}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],h=e[10],m=e[11];const u=d===void 0?"":d,p=pe(),x=y.useContext(Ue),w=y.useContext(Bn),S=w?.report,k=y.useId();let C;e[12]!==u||e[13]!==o?(C=We(o,u),e[12]=u,e[13]=o,e[14]=C):C=e[14];const b=C,v=p?.mode==="assistant",j=p?.mode==="document",g=y.useContext(It),{ref:M,setRef:P,near:$}=At(v||j&&g===null,j),R=g??$,N=p?.owner,F=v&&!!p?.onShowPopup&&!x;let E,I;e[15]!==N||e[16]!==o?(E=()=>N?.register(o),I=[N,o],e[15]=N,e[16]=o,e[17]=E,e[18]=I):(E=e[17],I=e[18]),y.useEffect(E,I);const B=!!(p&&R&&(!v||p.settled)),{url:A,failed:_,fail:K}=Kn(o,B),q=Vn(l,B),[J,ee]=y.useState(null),T=!!(A&&J?.url===A),z=J&&J.url===A?J.size:void 0;let Z,V;e[19]!==T||e[20]!==k||e[21]!==S||e[22]!==z?(Z=()=>(S?.(k,T&&z?z:null),()=>S?.(k,null)),V=[S,k,T,z],e[19]=T,e[20]=k,e[21]=S,e[22]=z,e[23]=Z,e[24]=V):(Z=e[23],V=e[24]),y.useEffect(Z,V);let H,O;e[25]!==T||e[26]!==F||e[27]!==b||e[28]!==N||e[29]!==M||e[30]!==o||e[31]!==A?(H=()=>{const Q=M.current;if(!(!N||!T||!Q||!F))return N.addGallery({source:o,filename:b,element:Q,resolve:()=>A?.startsWith("data:")?Promise.resolve(A):N.resolve(o,!1,!0),load:()=>N.load(o)})},O=[N,T,o,b,M,F,A],e[25]=T,e[26]=F,e[27]=b,e[28]=N,e[29]=M,e[30]=o,e[31]=A,e[32]=H,e[33]=O):(H=e[32],O=e[33]),y.useEffect(H,O);let G;e[34]!==u||e[35]!==t||e[36]!==j||e[37]!==T||e[38]!==K||e[39]!==r||e[40]!==b||e[41]!==s||e[42]!==i||e[43]!==a||e[44]!==q||e[45]!==w?.ready||e[46]!==P||e[47]!==o||e[48]!==l||e[49]!==c||e[50]!==h||e[51]!==A||e[52]!==m?(G=A||j?f.jsx("img",{...a,ref:j?P:void 0,src:A,srcSet:q,alt:u||b,title:h,width:m,height:r,className:ot(j?t:"block h-auto max-h-[30rem] w-auto max-w-full object-contain",j?!A&&"invisible":!T&&"hidden"),style:j?{...c,...co(m,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:Q=>{const me=Q.currentTarget;A&&me.naturalWidth&&me.naturalHeight&&ee({url:A,size:{width:me.naturalWidth,height:me.naturalHeight}}),i?.(Q)},onError:Q=>{K(),s?.(Q)}}):null,e[34]=u,e[35]=t,e[36]=j,e[37]=T,e[38]=K,e[39]=r,e[40]=b,e[41]=s,e[42]=i,e[43]=a,e[44]=q,e[45]=w?.ready,e[46]=P,e[47]=o,e[48]=l,e[49]=c,e[50]=h,e[51]=A,e[52]=m,e[53]=G):G=e[53];const X=G,te=z?z.width/z.height:1;let se;e[54]!==te||e[55]!==w?.ready||e[56]!==z?(se=w?.ready&&z?{flex:`${te} 1 0px`,minWidth:`${8*te}rem`,maxWidth:`min(${z.width}px, ${30*te}rem)`,margin:0}:void 0,e[54]=te,e[55]=w?.ready,e[56]=z,e[57]=se):se=e[57];const oe=se;if(j){let Q;return e[58]!==_||e[59]!==X||e[60]!==x||e[61]!==b||e[62]!==o||e[63]!==h?(Q=_?f.jsx(Ze,{source:o,name:b,title:h,linked:x,state:"failed"}):X,e[58]=_,e[59]=X,e[60]=x,e[61]=b,e[62]=o,e[63]=h,e[64]=Q):Q=e[64],Q}const le=T?"inline-block max-w-[min(100%,30rem)] align-top my-1 me-1":void 0;let L;e[65]!==o?(L=Ce(o),e[65]=o,e[66]=L):L=e[66];let W;e[67]!==B||e[68]!==T||e[69]!==_||e[70]!==x||e[71]!==b||e[72]!==o||e[73]!==h?(W=!T&&f.jsx(Ze,{source:o,name:b,title:h,linked:x,state:_?"failed":B?"loading":void 0}),e[67]=B,e[68]=T,e[69]=_,e[70]=x,e[71]=b,e[72]=o,e[73]=h,e[74]=W):W=e[74];const ie=A&&!F&&X;let Y;e[75]!==p||e[76]!==T||e[77]!==F||e[78]!==X||e[79]!==b||e[80]!==N||e[81]!==M||e[82]!==A?(Y=A&&F&&f.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":b,"data-oc-media-gallery":"true",onClick:()=>{const Q=M.current;Q&&p?.onShowPopup&&N?.openGallery(Q,p.onShowPopup).catch(mo)},children:X}),e[75]=p,e[76]=T,e[77]=F,e[78]=X,e[79]=b,e[80]=N,e[81]=M,e[82]=A,e[83]=Y):Y=e[83];let ne;return e[84]!==oe||e[85]!==P||e[86]!==le||e[87]!==L||e[88]!==W||e[89]!==ie||e[90]!==Y?(ne=f.jsxs("span",{ref:P,className:le,style:oe,"data-oc-media-source":L,children:[W,ie,Y]}),e[84]=oe,e[85]=P,e[86]=le,e[87]=L,e[88]=W,e[89]=ie,e[90]=Y,e[91]=ne):ne=e[91],ne}function mo(){}function Vn(n,e){const t=U.c(12),r=pe(),s=r?.owner,[i,a]=y.useState(null);let o,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(go)},l=[],t[0]=o,t[1]=l):(o=t[0],l=t[1]),y.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 m=s.controller.signal;let u=!1;const p=n.split(",").flatMap(po);return Promise.all(p.map(async x=>{const{source:w,descriptor:S}=x,k=await s.resolve(w);return S?`${k} ${S}`:k})).then(x=>{!u&&!m.aborted&&a({owner:s,signal:m,source:n,value:x.join(", ")})},ho),()=>{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 h;return t[7]!==e||t[8]!==s||t[9]!==n||t[10]!==d?(h=[s,d,n,e],t[7]=e,t[8]=s,t[9]=n,t[10]=d,t[11]=h):h=t[11],y.useEffect(c,h),i&&i.owner===s&&!i.signal.aborted&&i.source===n?i.value:void 0}function ho(){}function po(n){const[e,...t]=n.trim().split(/\s+/);return e?[{source:e,descriptor:t.join(" ")}]:[]}function go(n){return n?.signal.aborted?null:n}function wo(n){const e=U.c(10);let t,r;if(e[0]!==n){const{node:d,children:h,...m}=n;t=h,r=m,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}=At(s,!0),o=s?a:null;let l;e[3]!==t||e[4]!==o?(l=f.jsx(It.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=f.jsx("picture",{...r,ref:i,children:l}),e[6]=r,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function xo(n){const e=U.c(13);let t,r,s;if(e[0]!==n){const{node:u,srcSet:p,media:x,...w}=n;s=p,t=x,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=y.useContext(It),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=io(i?.mode==="document"?c:void 0),h=Vn(s,i?.mode==="document"&&a!==!1&&d);if(i?.mode!=="document")return null;let m;return e[7]!==t||e[8]!==r||e[9]!==h||e[10]!==s||e[11]!==c?(m=f.jsx("source",{...r,srcSet:h,media:c,"data-oc-media-srcset":s,"data-oc-media-query":t}),e[7]=t,e[8]=r,e[9]=h,e[10]=s,e[11]=c,e[12]=m):m=e[12],m}function Lt(n){const e=Un(n,n.src),t=pe(),r=t?.owner,s=y.useContext(Ue),i=_t(e),{setRef:a,near:o}=At(t?.mode==="assistant"&&!i);y.useEffect(()=>i?void 0:r?.register(e),[r,e,i]);const{url:l,fail:c,retry:d}=Kn(e,!!(t&&!i&&!s&&(t.mode!=="assistant"||t.settled&&o)),!0),[h,m]=y.useState(null),u=h?.owner===r&&h?.source===e?h:null,p=y.useMemo(()=>({lastRetry:0,resume:null}),[r,e]),x=y.useRef(p);x.current=p;const w=y.useRef(null),S=n.title||We(e),k=i?u?.failed?void 0:u?.url??e:l,C=!!(k&&(i||t?.mode!=="assistant"||u?.ready===k));return!e||Wn(e)?null:s?f.jsx(Ze,{source:e,name:S,linked:!0}):f.jsxs("span",{ref:a,className:"inline-block max-w-full align-top","data-oc-media-source":Ce(e),children:[!C&&f.jsx(Ze,{source:e,name:S,linked:!1}),k&&f.jsx("video",{ref:w,src:k,title:S,controls:!0,playsInline:!0,hidden:!C,preload:i&&t?.mode!=="document"?"none":"metadata",className:n.className,"data-oc-media-source":Ce(e),onLoadedMetadata:b=>{m({owner:r,source:e,url:u?.url,ready:k});const v=p.resume;v&&(b.currentTarget.currentTime=v.time,v.playing&&b.currentTarget.play().catch(()=>{}),p.resume=null),n.onLoadedMetadata?.(b)},onError:b=>{if(i){const j=Ne(),g=new URL(e,window.location.href),M=new URL(j.api("/api/fs/raw"),window.location.href);if(!(g.origin===M.origin&&g.pathname===M.pathname&&g.searchParams.has("oc_url_token"))||Date.now()-p.lastRetry<1e4){m({owner:r,source:e,failed:!0});return}p.lastRetry=Date.now(),p.resume={time:b.currentTarget.currentTime,playing:!b.currentTarget.paused};const $=r?.controller.signal;g.searchParams.delete("oc_url_token"),yt().then(()=>{$?.aborted||x.current!==p||j!==Ne()||m({owner:r,source:e,url:j.authenticatedAsset("/api/fs/raw",g.searchParams)})},()=>{!$?.aborted&&x.current===p&&m({owner:r,source:e,failed:!0})});return}if(Date.now()-p.lastRetry<1e4){c();return}p.lastRetry=Date.now(),p.resume={time:b.currentTarget.currentTime,playing:!b.currentTarget.paused};const v=r?.controller.signal;d().then(()=>{!v?.aborted&&x.current===p&&w.current?.load()},()=>{!v?.aborted&&x.current===p&&c()})}})]})}function yo(n){const e=U.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]=y.useState(i);let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(R,N)=>{o(F=>{if(F.get(R)===N||!N&&!F.has(R))return F;const E=new Map(F);return N?E.set(R,N):E.delete(R),E})},e[5]=l):l=e[5];const c=l,d=r?.children.filter(So),h=d?.length===1?d[0]:void 0,m=h?.type==="element"&&h.tagName==="a"?h.properties.href:void 0,u=h?.type==="element"&&h.children.length===1&&h.children[0]?.type==="text"?h.children[0].value:"",p=d?.length??0,x=p>1&&d?.every(vo),w=pe()?.mode,S=!!(w==="assistant"&&x&&a.size===p);let k;e[6]!==S?(k={report:c,ready:S},e[6]=S,e[7]=k):k=e[7];const C=k;if(w==="document"&&u&&u===m&&bn(u)){let R;e[8]!==u?(R=f.jsx(Lt,{src:u}),e[8]=u,e[9]=R):R=e[9];let N;return e[10]!==s||e[11]!==R?(N=f.jsx("p",{...s,"data-streamdown":"paragraph",children:R}),e[10]=s,e[11]=R,e[12]=N):N=e[12],N}let b,v;e[13]!==a?(b=[...a.values()],v=b.reduce(ko,0),e[13]=a,e[14]=b,e[15]=v):(b=e[14],v=e[15]);const j=v;let g;if(e[16]!==p||e[17]!==b||e[18]!==s.style||e[19]!==j||e[20]!==S){if(g={...s.style},S){g.display="flex",g.flexWrap="wrap",g.alignItems="flex-start",g.gap="0.5rem";let R;e[22]!==b?(R=b.map(bo),e[22]=b,e[23]=R):R=e[23],g.maxWidth=`calc(min(30rem, ${Math.min(...R)}px) * ${j} + ${(p-1)*.5}rem)`}e[16]=p,e[17]=b,e[18]=s.style,e[19]=j,e[20]=S,e[21]=g}else g=e[21];const M=S?"true":void 0;let P;e[24]!==t||e[25]!==g||e[26]!==s||e[27]!==M?(P=f.jsx("p",{...s,"data-streamdown":"paragraph","data-oc-media-row":M,style:g,children:t}),e[24]=t,e[25]=g,e[26]=s,e[27]=M,e[28]=P):P=e[28];let $;return e[29]!==P||e[30]!==C?($=f.jsx(Bn.Provider,{value:C,children:P}),e[29]=P,e[30]=C,e[31]=$):$=e[31],$}function bo(n){return n.height}function ko(n,e){return n+e.width/e.height}function vo(n){return n.type==="element"&&n.tagName==="img"}function So(n){return n.type!=="text"||n.value.trim()}const Co=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Jt=Array.from(Co).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),jo=n=>Rt(n),Hn=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):""},rt=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=Jt.length>0?e.match(new RegExp(`^(.*(?:/|^)(${Jt})):.*$`,"i")):null;return s&&(e=s[1]??e),dt(e)},Mo=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=rt(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=rt(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=rt(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=rt(r);return o?{path:o}:null},Eo=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,Ro=4,No=1e3,Po=200,je=new Map;let st=0;const en=[],_o=()=>Se()?Po:No,Gn=(n,e)=>`${n}\0${e}`,Ao=(n,e)=>{const t=Rt(n,{preserveWhitespace:!0});if(!t)return Promise.resolve(!1);const r=Gn(e,t),s=je.get(r);if(s)return je.delete(r),je.set(r,s),s;const i=new Promise(o=>{const l=()=>{st+=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(()=>{st=Math.max(0,st-1),en.shift()?.()})};if(st<Ro){l();return}en.push(l)}),a=_o();for(;je.size>=a;){const o=je.keys().next().value;if(typeof o!="string")break;je.delete(o)}return je.set(r,i),i},Io=Pn({exists:qs().optional()}),Lo=async(n,e)=>{const t=new URLSearchParams({path:Rt(n,{preserveWhitespace:!0}),optional:"true"});Mt(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=Io.safeParse(await r.json().catch(()=>null));return s.success?s.data.exists===!1?"missing":"exists":"failed"}catch{return"failed"}},To=Pn({paths:Gs(Nn())}),He=new Map,$o=200,qn=(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=To.safeParse(await t.json().catch(()=>null));return r.success?r.data.paths:null}).catch(()=>null),Oo=(n,e)=>{if(!n||!e||Se())return Promise.resolve(null);const t=Gn(e,n),r=He.get(t);if(r)return r;const s=qn(n,e).then(i=>i?.length===1?i[0]:null);for(;He.size>=$o;){const i=He.keys().next();if(i.done)break;He.delete(i.value)}return He.set(t,s),s};function Oe(n,e){if("key"in n&&n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),n.stopPropagation(),!("key"in n)&&Ir(n.currentTarget.closest("[data-markdown-content]"))))return;const t=/Mac|iPhone|iPad/.test(navigator.platform);e(t?n.metaKey:n.ctrlKey)}const tn=new vn({maxEntries:64,maxBytes:1024*1024});function mt(){const n=U.c(5),{directory:e}=ae(),t=y.useContext(kn),r=t?.editor,s=t?.runtime.isVSCode,i=Ar();let a;return n[0]!==e||n[1]!==r||n[2]!==s||n[3]!==i?(a=async(o,l,c,d)=>{const h=c===void 0?!1:c,u=_e(o,e,"click",d===void 0?"path":d);if(!u)return;const p=l??u.resolvedPath;if(h&&Fs()&&await zs(p))return;if(s&&r){r.openFile(p,u.line,u.column);return}const x=fe.getState();u.line?x.openContextFileAtLine(e,p,u.line,u.column??1):x.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 Do(){const n=U.c(5),{directory:e}=ae(),t=mt(),r=y.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]),y.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 Lo(l.resolvedPath,e),h=d==="missing"&&!/[\\/]/.test(l.path)?await qn(l.path,e):[];!r.current||ue()!==c||(d==="failed"||!h||h.length>1?Xt(l.resolvedPath,{reason:"unreadable",message:null}):d==="missing"&&h.length===0?Xt(l.resolvedPath,{reason:"missing"}):await t(o,h[0]??l.resolvedPath))},n[2]=e,n[3]=t,n[4]=a):a=n[4],a}function Fo(){const n=U.c(5),e=y.useContext(kn),{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"||Ds(s)){i=null;break e}let l;n[2]!==o||n[3]!==t?(l=c=>{o(c).catch(()=>{xt.error(t("sidebarFilesTree.toast.revealFailed"))})},n[2]=o,n[3]=t,n[4]=l):l=n[4],i=l}return i}const zo=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Wo=(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=jo(n).split("/").filter(Boolean).pop()??"";if(!s||s==="."||s==="..")return!1;const i=s.toLowerCase();return zo.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=Mo(s?Hn(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||!Wo(i.path,t,a))return null;const o=_r(e,i.path,{preserveWhitespace:a});return o?{...i,resolvedPath:o}:null}async function Zn(n,e,t="path"){const r=_e(n,e,"probe",t);return r?!Mt(r.resolvedPath,e)||await Ao(r.resolvedPath,e)?r.resolvedPath:/[\\/]/.test(r.path)?null:Oo(r.path,e):null}async function Uo(n,e,t,r=s=>Zn(s,e)){if(n.length>2e5)return[];let s=tn.get(n);if(!s){s=Array.from(n.matchAll(Eo),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 Bo=n=>{const e=Us.getState().ordered;return Or(Dr.getState().ordered)(n)||Fr(e,zr.getState().identities).match(n)?!0:Wr(n,e)!==null},Xn=(n,e,t,r)=>{const s=Sn.getState().guests.find(a=>a.id===n.guestId);if(!s||!Lr(s,"links"))return!1;if(n.action==="attach")return n.url?(Tr.getState().setPendingGuestIssue(Ws({providerId:s.id,id:n.identifier,title:n.identifier,url:n.url})),!0):!1;if(!Cn(s))return e==="link"?!1:(xt.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:(xt.info(r("chat.guestLink.noProject",{name:s.name})),!0)};function Yn(n,e){const t=U.c(8),r=e===void 0?"path":e,{directory:s,fileReferences:i,confirmFile:a}=ae();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=ue(),t[0]=o):o=t[0];const l=o,[c,d]=y.useState(null);let h,m;return t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==n?(h=()=>{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}},m=[n,r,s,i,l,a],t[1]=a,t[2]=s,t[3]=i,t[4]=r,t[5]=n,t[6]=h,t[7]=m):(h=t[6],m=t[7]),y.useEffect(h,m),i&&c?.raw===n&&c.inputKind===r&&c.directory===s&&c.runtimeKey===l?c.path:null}const Ko=32;function Vo(n){const e=U.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(Ho).join("")??"",e[4]=t?.children,e[5]=i):i=e[5];const a=i,o=Yn(a),l=mt(),c=Do(),{directory:d,fileNavigation:h,fileReferences:m}=ae();let u;e[6]!==l||e[7]!==o||e[8]!==a?(u=R=>{o&&Oe(R,N=>{l(a,o,N)})},e[6]=l,e[7]=o,e[8]=a,e[9]=u):u=e[9];const p=u,x=h&&!m&&_e(a,d)!==null;let w;e[10]!==c||e[11]!==a?(w=R=>{R.currentTarget.closest('a, button, [role="button"], summary')||Oe(R,()=>{c(a)})},e[10]=c,e[11]=a,e[12]=w):w=e[12];const S=w,k=a.length>0&&a.length<=Ko?"":void 0,C=o?"true":void 0,b=o?a:void 0,v=o??void 0,j=o?"button":void 0,g=o?0:void 0,M=o?p:x?S:void 0,P=o?p:void 0;let $;return e[13]!==r||e[14]!==s||e[15]!==M||e[16]!==P||e[17]!==k||e[18]!==C||e[19]!==b||e[20]!==v||e[21]!==j||e[22]!==g?($=f.jsx("code",{...s,dir:"ltr","data-streamdown":"inline-code","data-short":k,"data-openchamber-file-link":C,"data-openchamber-file-ref":b,"data-openchamber-file-path":v,role:j,tabIndex:g,onClick:M,onKeyDown:P,children:r}),e[13]=r,e[14]=s,e[15]=M,e[16]=P,e[17]=k,e[18]=C,e[19]=b,e[20]=v,e[21]=j,e[22]=g,e[23]=$):$=e[23],$}function Ho(n){return n.type==="text"?n.value:""}function Go(n){const e=U.c(10),{purpose:t}=ae();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=f.jsx(Ue.Provider,{value:!0,children:s}),e[3]=s,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=f.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=f.jsx(Xo,{...n}),e[8]=n,e[9]=r):r=e[9],r}function qo(n){const e=U.c(3),{src:t}=n,[r,s]=y.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=f.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:f.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 Qn=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 Zo(n){const e=U.c(25),{identifier:t,className:r,children:s}=n,{guestLinks:i,directory:a}=ae(),{t:o}=ge();let l;e[0]!==i||e[1]!==t?(l=i?yn(i,t):null,e[0]=i,e[1]=t,e[2]=l):l=e[2];const c=l;let d;e[3]!==c?(d=v=>c?v.guests.find(j=>j.id===c.guestId):void 0,e[3]=c,e[4]=d):d=e[4];const h=Sn(d),m=h?.name,u=Et(a);if(!c||!h||!m){let v;return e[5]!==s?(v=f.jsx(f.Fragment,{children:s}),e[5]=s,e[6]=v):v=e[6],v}const p=c.action==="open"&&!Cn(h)?c.url:void 0;let x;e[7]!==c||e[8]!==a||e[9]!==u||e[10]!==p||e[11]!==o?(x=v=>{"key"in v&&v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),v.stopPropagation(),p?u(p):Xn(c,"identifier",a,o))},e[7]=c,e[8]=a,e[9]=u,e[10]=p,e[11]=o,e[12]=x):x=e[12];const w=x;let S;e[13]!==c.action||e[14]!==t||e[15]!==m||e[16]!==p||e[17]!==o?(S=p||(c.action==="open"?o("chat.guestLink.open",{identifier:t,name:m}):o("chat.guestLink.attach",{identifier:t,name:m})),e[13]=c.action,e[14]=t,e[15]=m,e[16]=p,e[17]=o,e[18]=S):S=e[18];const k=S,C=r?`${r} cursor-pointer`:"cursor-pointer";let b;return e[19]!==w||e[20]!==s||e[21]!==c.guestId||e[22]!==k||e[23]!==C?(b=f.jsx("a",{role:"button",tabIndex:0,className:C,"data-oc-guest-link":c.guestId,title:k,"aria-label":k,onClick:w,onKeyDown:w,children:s}),e[19]=w,e[20]=s,e[21]=c.guestId,e[22]=k,e[23]=C,e[24]=b):b=e[24],b}function Xo(n){const e=U.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=Qn(r),e[5]=r,e[6]=o):o=e[6];let l;return e[7]!==s||e[8]!==i.className||e[9]!==o?(l=f.jsx(Zo,{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:h,...m}=i;o=m,e[11]=i,e[12]=o}else o=e[12];let l;e[13]!==s?(l=f.jsx(Ue.Provider,{value:!0,children:s}),e[13]=s,e[14]=l):l=e[14];let c;return e[15]!==o||e[16]!==l?(c=f.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=f.jsx(Yo,{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 Yo(n){const e=U.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=f.jsx(Ue.Provider,{value:!0,children:s}),e[5]=s,e[6]=a):a=e[6];const o=a,l=ae(),{directory:c}=l,{t:d}=ge(),h=Et(c),m=mt(),u=pe(),p=fe(Jo);let x;e[7]!==r?(x=Qn(r),e[7]=r,e[8]=x):x=e[8];const w=x;let S;e[9]!==t?(S=Ur(t),e[9]=t,e[10]=S):S=e[10];const k=S,C=Br(t);let b;e[11]!==t?(b=Kr(t),e[11]=t,e[12]=b):b=e[12];const v=b,j=Se()?null:Vr(t,Hr());let g;e[13]!==t?(g=Se()?null:Tn(t),e[13]=t,e[14]=g):g=e[14];const M=g,P=y.useContext(Gr),$=j?P.get(qr(j)):void 0,R=y.useContext(Zr);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 F=N;let E;e[18]!==t?(E=xn(t),e[18]=t,e[19]=E):E=e[19];const I=E;let B;e[20]!==c||e[21]!==t||e[22]!==l.fileNavigation?(B=l.fileNavigation&&_e(t,c,"click","href"),e[20]=c,e[21]=t,e[22]=l.fileNavigation,e[23]=B):B=e[23];const A=B,_=Fo();let K;e[24]!==A||e[25]!==t||e[26]!==l.fileNavigation||e[27]!==_?(K=l.fileNavigation&&!A&&_?Hn(t):null,e[24]=A,e[25]=t,e[26]=l.fileNavigation,e[27]=_,e[28]=K):K=e[28];const q=K,J=!!(A||q||I||j||k||C||v),ee=J?t:w,T=Yn(ee,J?"href":"path"),z=!!(T&&!J);let Z;e[29]!==t?(Z=Xr(t),e[29]=t,e[30]=Z):Z=e[30];const V=Z,H=r?.properties.dataOcReference!==void 0;let O;e[31]!==V||e[32]!==t||e[33]!==T||e[34]!==H?(O=V&&!T&&!H?Yr(t):null,e[31]=V,e[32]=t,e[33]=T,e[34]=H,e[35]=O):O=e[35];const G=O;let X;e[36]!==c||e[37]!==t||e[38]!==p||e[39]!==l.loopbackPreview?(X=l.loopbackPreview&&Qr(t)&&c&&!(Bs()&&p),e[36]=c,e[37]=t,e[38]=p,e[39]=l.loopbackPreview,e[40]=X):X=e[40];const te=X,se=l.guestLinks&&V&&!j&&!I&&!A&&!q&&!z&&!k&&!C&&!v&&!M?Jr(l.guestLinks,t):null;let oe;e[41]!==I||e[42]!==c||e[43]!==V||e[44]!==A||e[45]!==q||e[46]!==se||e[47]!==t||e[48]!==u||e[49]!==h||e[50]!==m||e[51]!==T||e[52]!==l.disableLinkSafety||e[53]!==_||e[54]!==j||e[55]!==k||e[56]!==d||e[57]!==w||e[58]!==z?(oe=D=>{if(!(u?.documentAssets&&Qs(D,u.documentAssets))){if(z&&T){Oe(D,ce=>{m(w,T,ce)});return}if(j&&(!V||!(D.metaKey||D.ctrlKey||D.shiftKey||D.altKey))){D.preventDefault(),rs(j.sessionId,j.messageId);return}if(I){D.preventDefault(),D.stopPropagation(),Wt(t);return}if(!k){if(A){Oe(D,ce=>{m(t,T??void 0,ce,"href")});return}if(q&&_){Oe(D,()=>_(q));return}if(t.startsWith("#")&&!u?.documentAssets){D.preventDefault();const ce=decodeURIComponent(t.slice(1)),de=D.currentTarget.closest("[data-markdown-content]");(de?Array.from(de.querySelectorAll("[id]")).find(Ke=>Ke.id===ce):null)?.scrollIntoView({block:"nearest"});return}if(se&&!nn(D)&&!Bo(t)&&Xn(se,"link",c,d)){D.preventDefault(),D.stopPropagation();return}V&&!l.disableLinkSafety&&!nn(D)&&(D.preventDefault(),D.stopPropagation(),h(t))}}},e[41]=I,e[42]=c,e[43]=V,e[44]=A,e[45]=q,e[46]=se,e[47]=t,e[48]=u,e[49]=h,e[50]=m,e[51]=T,e[52]=l.disableLinkSafety,e[53]=_,e[54]=j,e[55]=k,e[56]=d,e[57]=w,e[58]=z,e[59]=oe):oe=e[59];const le=oe;if(v){const D=v.openable?Ft:es,ce=v.openable?v.filename:void 0,de=v.openable?"button":void 0,Ye=v.openable?0:void 0,Ke=`#${v.iconId}`;let Ie;e[60]!==Ke?(Ie=f.jsx("svg",{className:"size-[1.1em] shrink-0","aria-hidden":"true",children:f.jsx("use",{href:Ke})}),e[60]=Ke,e[61]=Ie):Ie=e[61];let Le;e[62]!==v.filename?(Le=f.jsx("span",{className:zt,children:v.filename}),e[62]=v.filename,e[63]=Le):Le=e[63];let Qe;return e[64]!==v.filename||e[65]!==v.iconId||e[66]!==D||e[67]!==ce||e[68]!==de||e[69]!==Ye||e[70]!==Ie||e[71]!==Le?(Qe=f.jsxs("span",{className:D,"data-attachment-citation":v.iconId,"data-attachment-open":ce,role:de,tabIndex:Ye,title:v.filename,children:[Ie,Le]}),e[64]=v.filename,e[65]=v.iconId,e[66]=D,e[67]=ce,e[68]=de,e[69]=Ye,e[70]=Ie,e[71]=Le,e[72]=Qe):Qe=e[72],Qe}if(M){let D;e[73]!==M.kind||e[74]!==M.source?(D=()=>ti({source:M.source,confirmed:M.kind==="path"}),e[73]=M.kind,e[74]=M.source,e[75]=D):D=e[75];let ce;e[76]===Symbol.for("react.memo_cache_sentinel")?(ce=f.jsx(he,{name:"download",className:"size-4"}),e[76]=ce):ce=e[76];let de;return e[77]!==o||e[78]!==D?(de=f.jsxs(ve,{type:"button",variant:"outline",size:"sm",className:"my-1 align-middle",onClick:D,children:[ce,o]}),e[77]=o,e[78]=D,e[79]=de):de=e[79],de}if(j&&$){let D;return e[80]!==$||e[81]!==j?(D=f.jsx(ss,{chip:$,target:j}),e[80]=$,e[81]=j,e[82]=D):D=e[82],D}if(F){let D;return e[83]!==F.chip||e[84]!==F.url?(D=f.jsx(ts,{chip:F.chip,url:F.url}),e[83]=F.chip,e[84]=F.url,e[85]=D):D=e[85],D}if(C)return f.jsx("a",{"data-openchamber-agent-mention":"true",className:"text-primary hover:underline",href:ns(C),target:"_blank",rel:"noopener noreferrer",children:o});let L;e[86]!==G?(L=G&&f.jsx(qo,{src:G}),e[86]=G,e[87]=L):L=e[87];const W=w===t?"ltr":i.dir,ie=k?Ft:i.className,Y=k??void 0,ne=k?`$${k}`:i.title,Q=T?"true":void 0,me=T?ee:void 0,Xe=T??void 0;let we;e[88]!==I||e[89]!==t?(we=D=>{I&&(D.preventDefault(),D.button===1&&Wt(t))},e[88]=I,e[89]=t,e[90]=we):we=e[90];const Be=I?Qo:void 0;let xe;e[91]!==k?(xe=k&&f.jsx(he,{name:"book-open",className:"size-[1.1em] shrink-0"}),e[91]=k,e[92]=xe):xe=e[92];let ye;e[93]!==o||e[94]!==k?(ye=k?f.jsx("span",{className:zt,children:k}):o,e[93]=o,e[94]=k,e[95]=ye):ye=e[95];let be;e[96]!==le||e[97]!==t||e[98]!==i||e[99]!==W||e[100]!==ie||e[101]!==Y||e[102]!==ne||e[103]!==Q||e[104]!==me||e[105]!==Xe||e[106]!==we||e[107]!==Be||e[108]!==xe||e[109]!==ye?(be=f.jsxs("a",{...i,href:t,target:"_blank",rel:"noopener noreferrer",dir:W,className:ie,"data-skill-name":Y,title:ne,"data-openchamber-file-link":Q,"data-openchamber-file-ref":me,"data-openchamber-file-path":Xe,onClick:le,onAuxClick:we,onDragStart:Be,children:[xe,ye]}),e[96]=le,e[97]=t,e[98]=i,e[99]=W,e[100]=ie,e[101]=Y,e[102]=ne,e[103]=Q,e[104]=me,e[105]=Xe,e[106]=we,e[107]=Be,e[108]=xe,e[109]=ye,e[110]=be):be=e[110];let ke;e[111]!==c||e[112]!==t||e[113]!==te||e[114]!==d?(ke=te&&f.jsx($e,{label:d("terminalView.preview.openTitle"),children:f.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:f.jsx(he,{name:"global",className:"size-3.5"})})}),e[111]=c,e[112]=t,e[113]=te,e[114]=d,e[115]=ke):ke=e[115];let Ae;return e[116]!==L||e[117]!==be||e[118]!==ke?(Ae=f.jsxs(f.Fragment,{children:[L,be,ke]}),e[116]=L,e[117]=be,e[118]=ke,e[119]=Ae):Ae=e[119],Ae}function Qo(n){return n.preventDefault()}function Jo(n){return n.openLinksInBrowserPanel}const ea=()=>Nt(()=>import("./MarkdownDiffPreview-C8KpNQaC.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])).then(n=>n.default),ta=()=>{};function na(n){const e=U.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,ea,ta);let o;return e[3]!==a||e[4]!==i||e[5]!==t?(o=f.jsx("div",{"data-streamdown":"code-block-body","data-language":"diff",children:i&&a?f.jsx(a,{source:t}):f.jsx(as,{diff:t})}),e[3]=a,e[4]=i,e[5]=t,e[6]=o):o=e[6],o}const ra=y.memo(function(e){const t=U.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(ua),t[0]=s,t[1]=r,t[2]=i):i=t[2];let a;return t[3]!==i?(a=f.jsx("span",{className:"block before:content-[counter(line)] before:[counter-increment:line]",children:i}),t[3]=i,t[4]=a):a=t[4],a}),sa=y.memo(function({source:e,language:t,incomplete:r,plugin:s}){const i=y.useMemo(()=>({...Jn(e,t),isIncomplete:r,themes:s.getThemes()}),[e,t,r,s]),a=y.useMemo(()=>s.cached(i),[s,i]),[o,l]=y.useState(null),c=y.useRef(null),d=y.useMemo(()=>{const m=c.current;return m?.plugin===s&&m.input.language===i.language&&i.code.startsWith(m.input.code)?m.lineage:Symbol()},[i,s]),h=y.useMemo(()=>{const m=o?.lineage===d?o:null;if(m?.input===i)return m;if(a)return{input:i,result:a};const u=c.current,p=u?.lineage===d?u.display:null;return m&&(!p||m.input.code.length>=p.input.code.length)?m:p||{input:i,result:{tokens:i.code.split(`
|
|
5
|
-
`).map(x=>[{content:x}])}}},[i,a,d,o]);return y.useLayoutEffect(()=>(c.current={input:i,plugin:s,lineage:d,display:h,exact:a!==null},()=>{c.current=null}),[i,s,d,h,a]),y.useEffect(()=>{const m=p=>{const x=c.current;x?.lineage!==d||!x.input.code.startsWith(i.code)||x.exact&&x.input!==i||i.code.length<x.display.input.code.length||l(w=>w?.input===x.input&&i!==x.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,m);u&&m(u)},[s,i,d]),f.jsx("div",{"data-streamdown":"code-block-body","data-language":t,children:f.jsx("pre",{children:f.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:h.result.tokens.map((m,u)=>f.jsx(ra,{tokens:m},u))})})})}),Jn=(n,e)=>e.toLowerCase()==="ansi"?{code:ms(n),language:"text"}:{code:n,language:e},ia=/<script|\son[a-z]+\s*=/i,er=n=>/language-([^\s]+)/.exec(n??"")?.[1]??"",Tt=n=>(n?.children.map(e=>e.type==="text"?e.value:"").join("")??"").replace(/\n$/,""),oa=fs(()=>Nt(()=>import("./ReplyCommand-CUHB1iPz.js"),__vite__mapDeps([200,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 aa(n){const e=U.c(8),{reply:t,...r}=n,{directory:s}=ae(),i=oa();if(!i)return f.jsx(vt,{...r,command:null});const a=Tt(r.node);let o;e[0]!==r?(o=c=>f.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=f.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 la(n){const e=U.c(9),{settledReply:t}=ae(),r=ls();let s;e[0]!==n.className||e[1]!==n.node||e[2]!==t||e[3]!==r?(s=t!==null&&r!=="peek"&&cs(er(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?f.jsx(aa,{...n,reply:t}):f.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=U.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=ae(),{t:l}=ge(),c=fe(da),d=Ps(),h=mt(),[m,u]=y.useState(!1),[p,x]=y.useState(null),w=y.useRef(null);let S,k;e[6]===Symbol.for("react.memo_cache_sentinel")?(S=()=>()=>{w.current&&clearTimeout(w.current)},k=[],e[6]=S,e[7]=k):(S=e[6],k=e[7]),y.useEffect(S,k);const C=y.useContext(ds);let b,v,j;e[8]!==r||e[9]!==C?(b=er(r),v=C!==null&&hs(b),j=b.toLowerCase()==="diff"||v,e[8]=r,e[9]=C,e[10]=b,e[11]=v,e[12]=j):(b=e[10],v=e[11],j=e[12]);const g=j;let M;e[13]!==i?.children?(M=i?.children.map(ca).join("")??"",e[13]=i?.children,e[14]=M):M=e[14];const P=M;let $;e[15]!==i?($=Tt(i),e[15]=i,e[16]=$):$=e[16];const R=$,{purpose:N,onExportCode:F}=o;let E,I;if(e[17]!==P||e[18]!==b||e[19]!==F||e[20]!==N?(E=()=>{if(N&&b!=="mermaid"){const O=Jn(P,b);F?.(O.code,O.language)}},I=[N,F,P,b],e[17]=P,e[18]=b,e[19]=F,e[20]=N,e[21]=E,e[22]=I):(E=e[21],I=e[22]),y.useLayoutEffect(E,I),b==="svg"&&o.svgFences&&!ia.test(P)&&p!==P){let O;e[23]!==P?(O=()=>x(P),e[23]=P,e[24]=O):O=e[24];let G;e[25]!==t||e[26]!==r||e[27]!==i||e[28]!==a?(G=f.jsx(ze.code,{...a,node:i,className:r,children:t}),e[25]=t,e[26]=r,e[27]=i,e[28]=a,e[29]=G):G=e[29];let X;return e[30]!==O||e[31]!==G?(X=f.jsx(zn.Provider,{value:O,children:G}),e[30]=O,e[31]=G,e[32]=X):X=e[32],X}if(b==="mermaid"||b==="openui-lang"&&o.uiBlocks){let O;return e[33]!==t||e[34]!==r||e[35]!==i||e[36]!==a?(O=f.jsx(ze.code,{...a,node:i,className:r,children:t}),e[33]=t,e[34]=r,e[35]=i,e[36]=a,e[37]=O):O=e[37],O}let B;e[38]!==h||e[39]!==o.fileNavigation?(B=O=>{if(!o.fileNavigation||!(O.target instanceof Element))return;const G=O.target.closest('[data-openchamber-file-link="true"]'),X=G?.getAttribute("data-openchamber-file-ref");X&&Oe(O,te=>{h(X,G?.getAttribute("data-openchamber-file-path")??void 0,te)})},e[38]=h,e[39]=o.fileNavigation,e[40]=B):B=e[40];const A=B;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 K=_,q=c?"true":"false";let J;e[43]!==b||e[44]!==g||e[45]!==v||e[46]!==l?(J=v?l("chat.markdown.suggestion.title"):g?l("markdownRenderer.code.proposal"):b.toLowerCase()||"text",e[43]=b,e[44]=g,e[45]=v,e[46]=l,e[47]=J):J=e[47];let ee;e[48]!==J?(ee=f.jsx(_s,{language:J}),e[48]=J,e[49]=ee):ee=e[49];let T;e[50]!==s?.button||e[51]!==m||e[52]!==K||e[53]!==g||e[54]!==N||e[55]!==l||e[56]!==c?(T=!N&&f.jsx("div",{className:"pointer-events-none absolute top-0 end-0 flex items-center",children:f.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,!g&&f.jsx($e,{label:l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),children:f.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:f.jsx(he,{name:"text-wrap",className:"size-3.5"})})}),f.jsx($e,{label:l(m?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),children:f.jsx(ve,{variant:"ghost",size:"xs","data-export-ignore":!0,"aria-label":l(m?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),onClick:K,children:f.jsx(he,{name:m?"check":"file-copy",className:"size-3.5"})})})]})}),e[50]=s?.button,e[51]=m,e[52]=K,e[53]=g,e[54]=N,e[55]=l,e[56]=c,e[57]=T):T=e[57];let z;e[58]!==R||e[59]!==d||e[60]!==b||e[61]!==o.code||e[62]!==g||e[63]!==N||e[64]!==v||e[65]!==C?(z=g&&!N?f.jsx(na,{source:v?us(R,C.excerpt):R,incomplete:d}):f.jsx(sa,{source:R,language:b,incomplete:d,plugin:o.code}),e[58]=R,e[59]=d,e[60]=b,e[61]=o.code,e[62]=g,e[63]=N,e[64]=v,e[65]=C,e[66]=z):z=e[66];const Z=s?.output;let V;e[67]!==d||e[68]!==b||e[69]!==ee||e[70]!==T||e[71]!==z||e[72]!==Z?(V=f.jsxs(As,{language:b,isIncomplete:d,dir:"ltr",children:[ee,T,z,Z]}),e[67]=d,e[68]=b,e[69]=ee,e[70]=T,e[71]=z,e[72]=Z,e[73]=V):V=e[73];let H;return e[74]!==R||e[75]!==A||e[76]!==q||e[77]!==V?(H=f.jsx("div",{"data-code-wrap":q,"data-oc-code-source":R,onClick:A,onKeyDown:A,children:V}),e[74]=R,e[75]=A,e[76]=q,e[77]=V,e[78]=H):H=e[78],H}function ca(n){return n.type==="text"?n.value:""}function da(n){return n.codeBlockLineWrap}function ua(n,e){const t={...n.htmlStyle,color:n.color,backgroundColor:n.bgColor};return f.jsx("span",{style:t,...n.htmlAttrs,children:n.content},e)}const fa=["csv","tsv","md"],ma=["csv","md"],rn=n=>n==="md"?"Markdown":n.toUpperCase(),sn=n=>n.replace(/\\/g,"\\\\").replace(/\|/g,"\\|"),tr=y.createContext(new Map),nr=y.createContext(null),rr=n=>n.type==="text"?n.value:n.type==="element"?n.children.map(rr).join(""):"",ha=n=>{const e=n?.children.find(t=>t.type==="element"&&t.tagName==="thead");return e?rr(e):""};function on(n){const e=U.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=y.useContext(tr),a=t?i.get(t):void 0,o=y.useContext(nr),{t:l}=ge(),c=t?.tagName==="th"?ze.th:ze.td,d=a?"normal":"nowrap";let h;e[4]!==s||e[5]!==d?(h={...s,"--oc-table-code-wrap":d},e[4]=s,e[5]=d,e[6]=h):h=e[6];const m=h;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 M;return e[10]!==c||e[11]!==m||e[12]!==t||e[13]!==r?(M=f.jsx(c,{...r,node:t,style:m}),e[10]=c,e[11]=m,e[12]=t,e[13]=r,e[14]=M):M=e[14],M}let x;e[15]!==m?(x={...m,position:"relative"},e[15]=m,e[16]=x):x=e[16];const w=r.children,S=String(p+1);let k;e[17]!==l||e[18]!==S?(k=l("filesView.artifact.table.resizeColumn",{column:S}),e[17]=l,e[18]=S,e[19]=k):k=e[19];let C,b,v;e[20]!==p||e[21]!==o?(b=M=>o.onResize(p,M),v=M=>o.onResizeEnd(p,M),C=()=>o.onReset(p),e[20]=p,e[21]=o,e[22]=C,e[23]=b,e[24]=v):(C=e[22],b=e[23],v=e[24]);let j;e[25]!==C||e[26]!==k||e[27]!==b||e[28]!==v?(j=f.jsx(si,{label:k,onResize:b,onResizeEnd:v,onReset:C}),e[25]=C,e[26]=k,e[27]=b,e[28]=v,e[29]=j):j=e[29];let g;return e[30]!==c||e[31]!==t||e[32]!==r||e[33]!==j||e[34]!==x?(g=f.jsxs(c,{...r,node:t,style:x,children:[w,j]}),e[30]=c,e[31]=t,e[32]=r,e[33]=j,e[34]=x,e[35]=g):g=e[35],g}const it=120,pa=280;function ga(n,e,t){const r=n.map(a=>Math.min(Math.max(it,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<it?pa:Math.floor(a);for(const c of s)r[c]=Math.max(Math.min(it,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 wa(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],it),a.getBoundingClientRect().width))+1);return t.remove(),i}function sr(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=>sr(t,e)).join("")}function an(n,e){const t=Array.from(n.rows).map(s=>Array.from(s.cells).map(i=>sr(i,e==="md").trim())),r={headers:t[0]??[],rows:t.slice(1)};return e==="csv"?Is(r):e==="tsv"?Ls(r):[r.headers,r.headers.map(()=>"---"),...r.rows].map(s=>`| ${s.join(" | ")} |`).join(`
|
|
5
|
+
`).map(x=>[{content:x}])}}},[i,a,d,o]);return y.useLayoutEffect(()=>(c.current={input:i,plugin:s,lineage:d,display:h,exact:a!==null},()=>{c.current=null}),[i,s,d,h,a]),y.useEffect(()=>{const m=p=>{const x=c.current;x?.lineage!==d||!x.input.code.startsWith(i.code)||x.exact&&x.input!==i||i.code.length<x.display.input.code.length||l(w=>w?.input===x.input&&i!==x.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,m);u&&m(u)},[s,i,d]),f.jsx("div",{"data-streamdown":"code-block-body","data-language":t,children:f.jsx("pre",{children:f.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:h.result.tokens.map((m,u)=>f.jsx(ra,{tokens:m},u))})})})}),Jn=(n,e)=>e.toLowerCase()==="ansi"?{code:ms(n),language:"text"}:{code:n,language:e},ia=/<script|\son[a-z]+\s*=/i,er=n=>/language-([^\s]+)/.exec(n??"")?.[1]??"",Tt=n=>(n?.children.map(e=>e.type==="text"?e.value:"").join("")??"").replace(/\n$/,""),oa=fs(()=>Nt(()=>import("./ReplyCommand-OczgxN8d.js"),__vite__mapDeps([200,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 aa(n){const e=U.c(8),{reply:t,...r}=n,{directory:s}=ae(),i=oa();if(!i)return f.jsx(vt,{...r,command:null});const a=Tt(r.node);let o;e[0]!==r?(o=c=>f.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=f.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 la(n){const e=U.c(9),{settledReply:t}=ae(),r=ls();let s;e[0]!==n.className||e[1]!==n.node||e[2]!==t||e[3]!==r?(s=t!==null&&r!=="peek"&&cs(er(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?f.jsx(aa,{...n,reply:t}):f.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=U.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=ae(),{t:l}=ge(),c=fe(da),d=Ps(),h=mt(),[m,u]=y.useState(!1),[p,x]=y.useState(null),w=y.useRef(null);let S,k;e[6]===Symbol.for("react.memo_cache_sentinel")?(S=()=>()=>{w.current&&clearTimeout(w.current)},k=[],e[6]=S,e[7]=k):(S=e[6],k=e[7]),y.useEffect(S,k);const C=y.useContext(ds);let b,v,j;e[8]!==r||e[9]!==C?(b=er(r),v=C!==null&&hs(b),j=b.toLowerCase()==="diff"||v,e[8]=r,e[9]=C,e[10]=b,e[11]=v,e[12]=j):(b=e[10],v=e[11],j=e[12]);const g=j;let M;e[13]!==i?.children?(M=i?.children.map(ca).join("")??"",e[13]=i?.children,e[14]=M):M=e[14];const P=M;let $;e[15]!==i?($=Tt(i),e[15]=i,e[16]=$):$=e[16];const R=$,{purpose:N,onExportCode:F}=o;let E,I;if(e[17]!==P||e[18]!==b||e[19]!==F||e[20]!==N?(E=()=>{if(N&&b!=="mermaid"){const O=Jn(P,b);F?.(O.code,O.language)}},I=[N,F,P,b],e[17]=P,e[18]=b,e[19]=F,e[20]=N,e[21]=E,e[22]=I):(E=e[21],I=e[22]),y.useLayoutEffect(E,I),b==="svg"&&o.svgFences&&!ia.test(P)&&p!==P){let O;e[23]!==P?(O=()=>x(P),e[23]=P,e[24]=O):O=e[24];let G;e[25]!==t||e[26]!==r||e[27]!==i||e[28]!==a?(G=f.jsx(ze.code,{...a,node:i,className:r,children:t}),e[25]=t,e[26]=r,e[27]=i,e[28]=a,e[29]=G):G=e[29];let X;return e[30]!==O||e[31]!==G?(X=f.jsx(zn.Provider,{value:O,children:G}),e[30]=O,e[31]=G,e[32]=X):X=e[32],X}if(b==="mermaid"||b==="openui-lang"&&o.uiBlocks){let O;return e[33]!==t||e[34]!==r||e[35]!==i||e[36]!==a?(O=f.jsx(ze.code,{...a,node:i,className:r,children:t}),e[33]=t,e[34]=r,e[35]=i,e[36]=a,e[37]=O):O=e[37],O}let B;e[38]!==h||e[39]!==o.fileNavigation?(B=O=>{if(!o.fileNavigation||!(O.target instanceof Element))return;const G=O.target.closest('[data-openchamber-file-link="true"]'),X=G?.getAttribute("data-openchamber-file-ref");X&&Oe(O,te=>{h(X,G?.getAttribute("data-openchamber-file-path")??void 0,te)})},e[38]=h,e[39]=o.fileNavigation,e[40]=B):B=e[40];const A=B;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 K=_,q=c?"true":"false";let J;e[43]!==b||e[44]!==g||e[45]!==v||e[46]!==l?(J=v?l("chat.markdown.suggestion.title"):g?l("markdownRenderer.code.proposal"):b.toLowerCase()||"text",e[43]=b,e[44]=g,e[45]=v,e[46]=l,e[47]=J):J=e[47];let ee;e[48]!==J?(ee=f.jsx(_s,{language:J}),e[48]=J,e[49]=ee):ee=e[49];let T;e[50]!==s?.button||e[51]!==m||e[52]!==K||e[53]!==g||e[54]!==N||e[55]!==l||e[56]!==c?(T=!N&&f.jsx("div",{className:"pointer-events-none absolute top-0 end-0 flex items-center",children:f.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,!g&&f.jsx($e,{label:l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),children:f.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:f.jsx(he,{name:"text-wrap",className:"size-3.5"})})}),f.jsx($e,{label:l(m?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),children:f.jsx(ve,{variant:"ghost",size:"xs","data-export-ignore":!0,"aria-label":l(m?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),onClick:K,children:f.jsx(he,{name:m?"check":"file-copy",className:"size-3.5"})})})]})}),e[50]=s?.button,e[51]=m,e[52]=K,e[53]=g,e[54]=N,e[55]=l,e[56]=c,e[57]=T):T=e[57];let z;e[58]!==R||e[59]!==d||e[60]!==b||e[61]!==o.code||e[62]!==g||e[63]!==N||e[64]!==v||e[65]!==C?(z=g&&!N?f.jsx(na,{source:v?us(R,C.excerpt):R,incomplete:d}):f.jsx(sa,{source:R,language:b,incomplete:d,plugin:o.code}),e[58]=R,e[59]=d,e[60]=b,e[61]=o.code,e[62]=g,e[63]=N,e[64]=v,e[65]=C,e[66]=z):z=e[66];const Z=s?.output;let V;e[67]!==d||e[68]!==b||e[69]!==ee||e[70]!==T||e[71]!==z||e[72]!==Z?(V=f.jsxs(As,{language:b,isIncomplete:d,dir:"ltr",children:[ee,T,z,Z]}),e[67]=d,e[68]=b,e[69]=ee,e[70]=T,e[71]=z,e[72]=Z,e[73]=V):V=e[73];let H;return e[74]!==R||e[75]!==A||e[76]!==q||e[77]!==V?(H=f.jsx("div",{"data-code-wrap":q,"data-oc-code-source":R,onClick:A,onKeyDown:A,children:V}),e[74]=R,e[75]=A,e[76]=q,e[77]=V,e[78]=H):H=e[78],H}function ca(n){return n.type==="text"?n.value:""}function da(n){return n.codeBlockLineWrap}function ua(n,e){const t={...n.htmlStyle,color:n.color,backgroundColor:n.bgColor};return f.jsx("span",{style:t,...n.htmlAttrs,children:n.content},e)}const fa=["csv","tsv","md"],ma=["csv","md"],rn=n=>n==="md"?"Markdown":n.toUpperCase(),sn=n=>n.replace(/\\/g,"\\\\").replace(/\|/g,"\\|"),tr=y.createContext(new Map),nr=y.createContext(null),rr=n=>n.type==="text"?n.value:n.type==="element"?n.children.map(rr).join(""):"",ha=n=>{const e=n?.children.find(t=>t.type==="element"&&t.tagName==="thead");return e?rr(e):""};function on(n){const e=U.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=y.useContext(tr),a=t?i.get(t):void 0,o=y.useContext(nr),{t:l}=ge(),c=t?.tagName==="th"?ze.th:ze.td,d=a?"normal":"nowrap";let h;e[4]!==s||e[5]!==d?(h={...s,"--oc-table-code-wrap":d},e[4]=s,e[5]=d,e[6]=h):h=e[6];const m=h;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 M;return e[10]!==c||e[11]!==m||e[12]!==t||e[13]!==r?(M=f.jsx(c,{...r,node:t,style:m}),e[10]=c,e[11]=m,e[12]=t,e[13]=r,e[14]=M):M=e[14],M}let x;e[15]!==m?(x={...m,position:"relative"},e[15]=m,e[16]=x):x=e[16];const w=r.children,S=String(p+1);let k;e[17]!==l||e[18]!==S?(k=l("filesView.artifact.table.resizeColumn",{column:S}),e[17]=l,e[18]=S,e[19]=k):k=e[19];let C,b,v;e[20]!==p||e[21]!==o?(b=M=>o.onResize(p,M),v=M=>o.onResizeEnd(p,M),C=()=>o.onReset(p),e[20]=p,e[21]=o,e[22]=C,e[23]=b,e[24]=v):(C=e[22],b=e[23],v=e[24]);let j;e[25]!==C||e[26]!==k||e[27]!==b||e[28]!==v?(j=f.jsx(si,{label:k,onResize:b,onResizeEnd:v,onReset:C}),e[25]=C,e[26]=k,e[27]=b,e[28]=v,e[29]=j):j=e[29];let g;return e[30]!==c||e[31]!==t||e[32]!==r||e[33]!==j||e[34]!==x?(g=f.jsxs(c,{...r,node:t,style:x,children:[w,j]}),e[30]=c,e[31]=t,e[32]=r,e[33]=j,e[34]=x,e[35]=g):g=e[35],g}const it=120,pa=280;function ga(n,e,t){const r=n.map(a=>Math.min(Math.max(it,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<it?pa:Math.floor(a);for(const c of s)r[c]=Math.max(Math.min(it,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 wa(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],it),a.getBoundingClientRect().width))+1);return t.remove(),i}function sr(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=>sr(t,e)).join("")}function an(n,e){const t=Array.from(n.rows).map(s=>Array.from(s.cells).map(i=>sr(i,e==="md").trim())),r={headers:t[0]??[],rows:t.slice(1)};return e==="csv"?Is(r):e==="tsv"?Ls(r):[r.headers,r.headers.map(()=>"---"),...r.rows].map(s=>`| ${s.join(" | ")} |`).join(`
|
|
6
6
|
`)}function xa({node:n,className:e,children:t,...r}){const{purpose:s,settled:i,tableWidthScope:a}=ae(),o=fe(E=>E.tableCellWrap),l=y.useRef(null),c=y.useRef(null),[d,h]=y.useState(null),m=d?.node===n?d:null;y.useLayoutEffect(()=>{const E=l.current,I=c.current?.parentElement;if(!E||!I||!i)return;const B=E.ownerDocument.defaultView;if(!B)return;const A=()=>{const K=B.getComputedStyle(I),q=Math.max(0,I.clientWidth-(parseFloat(K.paddingInlineStart)||0)-(parseFloat(K.paddingInlineEnd)||0)-2),J=B.getComputedStyle(E).font;if(m&&m.font!==J){h(null);return}if(m){m.available!==q&&h({...m,available:q});return}if(q<=0)return;const ee=[],T=Array.from(E.rows),z=T.filter(H=>H.parentElement?.tagName==="TBODY");for(const H of z.length?z:T)Array.from(H.cells).forEach((O,G)=>{ee[G]=Math.max(ee[G]??0,Math.ceil(O.getBoundingClientRect().width))});const Z=T.find(H=>H.parentElement?.tagName==="THEAD"),V=Z?Array.from(Z.cells):[];z.length&&V.length&&E.parentElement&&wa(V,E.parentElement).forEach((H,O)=>{ee[O]=Math.max(ee[O]??0,H)}),h({node:n,natural:ee,available:q,font:J})};A();const _=new ResizeObserver(A);return _.observe(I),()=>_.disconnect()},[n,m,i]);const u=a&&!s?`${a}#${ha(n)}`:null,[p,x]=y.useState(()=>u?ni(u):{}),[w,S]=y.useState(null),k=y.useMemo(()=>m?ga(m.natural,m.available,o):null,[m,o]),C=y.useMemo(()=>{const E=w?{...p,[w.column]:w.width}:p;return k?.map((I,B)=>E[B]??I)??null},[k,p,w]),b=y.useMemo(()=>{if(!u||!k)return null;const E=_=>{x(_),S(null),ri(u,_)},A=n?.children.find(_=>_.type==="element"&&_.tagName==="thead")?.children.find(_=>_.type==="element"&&_.tagName==="tr")?.children.filter(_=>_.type==="element")??[];return{columnOf:new Map(A.map((_,K)=>[_,K])),onResize:(_,K)=>S({column:_,width:K}),onResizeEnd:(_,K)=>E({...p,[_]:K}),onReset:_=>{const{[_]:K,...q}=p;E(q)}}},[u,k,n,p]),v=C?.map((E,I)=>f.jsx("col",{style:{width:E}},I)),j=C&&m?C.map((E,I)=>m.natural[I]>E?"1":"0").join(""):"",g=y.useMemo(()=>{const E=new Map;for(const I of n?.children??[])if(I.type==="element")for(const B of I.children){if(B.type!=="element"||B.tagName!=="tr")continue;B.children.filter(_=>_.type==="element").forEach((_,K)=>E.set(_,j[K]==="1"))}return E},[n,j]),[M,P]=y.useState(!1),$=y.useRef(null),{t:R}=ge();y.useEffect(()=>()=>{$.current&&clearTimeout($.current)},[]);const N=async E=>{!l.current||!(await ut(an(l.current,E))).ok||(P(!0),$.current&&clearTimeout($.current),$.current=setTimeout(()=>P(!1),2e3))},F=E=>{const I=l.current;if(!I)return;const B=URL.createObjectURL(new Blob([an(I,E)],{type:E==="csv"?"text/csv;charset=utf-8":"text/markdown;charset=utf-8"})),A=document.createElement("a");A.href=B,A.download=`table.${E}`,A.click(),URL.revokeObjectURL(B)};return f.jsxs("div",{ref:c,"data-streamdown":"table-wrapper","data-table-wrap":o?"true":"false",className:"group flex flex-col",children:[!s&&f.jsxs("div",{"data-streamdown":"table-controls","data-export-ignore":!0,className:"flex items-center justify-end gap-1",children:[f.jsx($e,{label:R(o?"markdownRenderer.table.actions.disableWrapTitle":"markdownRenderer.table.actions.enableWrapTitle"),children:f.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:f.jsx(he,{name:"text-wrap",className:"size-3.5"})})}),f.jsxs(Ut,{children:[f.jsx($e,{label:R(M?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.table.actions.copyTitle"),children:f.jsx(Bt,{asChild:!0,children:f.jsx(ve,{variant:"ghost",size:"xs","aria-label":R(M?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.table.actions.copyTitle"),children:f.jsx(he,{name:M?"check":"file-copy",className:"size-3.5"})})})}),f.jsx(Kt,{align:"end",children:fa.map(E=>f.jsx(Vt,{onSelect:()=>{N(E)},children:rn(E)},E))})]}),f.jsxs(Ut,{children:[f.jsx($e,{label:R("markdownRenderer.table.actions.downloadTitle"),children:f.jsx(Bt,{asChild:!0,children:f.jsx(ve,{variant:"ghost",size:"xs","aria-label":R("markdownRenderer.table.actions.downloadTitle"),children:f.jsx(he,{name:"download",className:"size-3.5"})})})}),f.jsx(Kt,{align:"end",children:ma.map(E=>f.jsx(Vt,{onSelect:()=>F(E),children:rn(E)},E))})]})]}),f.jsx(ps,{outerClassName:"overlay-scrollbar-wrapper--no-gutter min-w-0",fillContainer:!1,children:f.jsxs("table",{...r,ref:l,"data-streamdown":"table","data-oc-table-layout":C?"fixed":i?"natural":"pending",style:C?{...r.style,width:C.reduce((E,I)=>E+I,0),tableLayout:"fixed"}:r.style,className:ot("border-collapse",e),children:[v&&f.jsx("colgroup",{children:v}),f.jsx(nr.Provider,{value:b,children:f.jsx(tr.Provider,{value:g,children:t})})]})})]})}const re=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 re(t)?t:null},ht=(n,e,t)=>Math.min(t,Math.max(e,n)),ya=6,cn=1.25,ba=1.0015,ka=.5,va=12,dn=3,Sa=400,Ca='[data-streamdown="mermaid-block"]',un=n=>[n.x,n.y,n.width,n.height].map(e=>{const t=Number(e.toFixed(ya));return Object.is(t,-0)?"0":String(t)}).join(" "),ja=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)&&re(a)&&re(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}},ir=(n,e)=>{if(!re(e.width)||!re(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}},Ma=({currentBox:n,viewport:e,delta:t})=>!re(e.width)||!re(e.height)||!re(n.width)||!re(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},Ea=(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}}},Ra=({currentBox:n,contentBox:e,viewport:t,pointer:r,zoomFactor:s,minScale:i,maxScale:a})=>{if(!re(t.width)||!re(t.height)||!re(s)||!re(n.width)||!re(n.height)||!re(e.width)||!re(e.height)||!re(i)||!re(a))return n;const o=Math.min(i,a),l=Math.max(i,a),c=ir(e,t),d=c.width/n.width,h=ht(d*s,o,l),m=c.width/h,u=m/(n.width/n.height),p=ht(r.x/t.width,0,1),x=ht(r.y/t.height,0,1),w=n.x+p*n.width,S=n.y+x*n.height;return{x:w-p*m,y:S-x*u,width:m,height:u}},$t=new WeakMap,Pe=new Set;let Ee=null,De=null;const Fe=new Set;let Re=null;const Na=n=>{Fe.add(n),Re===null&&(Re=window.requestAnimationFrame(()=>{Re=window.requestAnimationFrame(()=>{Re=null;const e=Array.from(Fe);Fe.clear(),or(e);for(const t of e)lr(t)})}))},fn=n=>{Fe.delete(n),Fe.size===0&&Re!==null&&(window.cancelAnimationFrame(Re),Re=null)},Pa=n=>n.querySelector('[data-streamdown="mermaid-viewport"]')??n.querySelector('[data-streamdown="mermaid"]'),Te=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}},_a=n=>n instanceof Element&&!!n.closest('button, a, [role="button"]'),or=n=>{const e=n.map(t=>Te(t.viewport));n.forEach((t,r)=>{const s=e[r];s&&t.fitToViewport(s)})},ar=()=>{De!==null||Pe.size===0||(De=window.requestAnimationFrame(()=>{De=null,or(Array.from(Pe))}))},Aa=()=>{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},lr=n=>{if(Pe.has(n))return;const e=Pe.size===0;Pe.add(n),$t.set(n.viewport,n),Aa()?.observe(n.viewport),e&&window.addEventListener("resize",ar)},Ia=n=>{Pe.delete(n)&&(Ee?.unobserve(n.viewport),$t.delete(n.viewport),!(Pe.size>0)&&(Ee?.disconnect(),Ee=null,window.removeEventListener("resize",ar),De!==null&&(window.cancelAnimationFrame(De),De=null)))},La=n=>{const e=Pa(n),t=n.querySelector('[data-streamdown="mermaid"] svg');if(!e||!t)return null;const r=ja({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 h=g=>{s=g,t.setAttribute("viewBox",un(g)),t.removeAttribute("width"),t.removeAttribute("height")},m=g=>{!re(g.width)||!re(g.height)||(h(ir(r,g)),t.setAttribute("data-oc-mermaid-fitted",""))},u=()=>{fn(j),m(Te(e)),lr(j)},p=()=>{Fe.has(j)&&u()},x=(g,M)=>{p(),h(Ra({currentBox:s,contentBox:r,viewport:Te(e),pointer:g,zoomFactor:M,minScale:ka,maxScale:va}))},w=()=>{const g=Te(e);x({x:g.width/2,y:g.height/2},cn)},S=()=>{const g=Te(e);x({x:g.width/2,y:g.height/2},1/cn)},k=g=>{!g.ctrlKey&&!g.metaKey||(g.preventDefault(),g.stopPropagation(),x(mn(g,e),Math.pow(ba,-g.deltaY)))},C=g=>{if(!(g.button!==0||_a(g.target))){if(p(),g.isPrimary&&(c.clear(),d=null),c.set(g.pointerId,{x:g.clientX,y:g.clientY}),c.size>1){i=null,d=pt(Array.from(c.values()))?.distance??null,e.setPointerCapture?.(g.pointerId),n.setAttribute("data-mermaid-suppress-click","true"),g.preventDefault();return}i=g.pointerId,a={x:g.clientX,y:g.clientY},o=a,l!==null&&(window.clearTimeout(l),l=null),n.removeAttribute("data-mermaid-suppress-click"),e.setPointerCapture?.(g.pointerId),n.setAttribute("data-mermaid-panning","true"),g.preventDefault()}},b=g=>{const M={x:g.clientX,y:g.clientY};if(d!==null&&c.has(g.pointerId)){c.set(g.pointerId,M);const P=pt(Array.from(c.values()));if(P){const $=mn({clientX:P.center.x,clientY:P.center.y},e);x($,P.distance/d),d=P.distance}g.preventDefault();return}i!==g.pointerId||!o||(h(Ma({currentBox:s,viewport:Te(e),delta:{x:M.x-o.x,y:M.y-o.y}})),o=M,a&&Ea(a,M)&&n.setAttribute("data-mermaid-suppress-click","true"),g.preventDefault())},v=g=>{if(c.delete(g.pointerId)){if(e.releasePointerCapture?.(g.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},Sa))}};e.addEventListener("wheel",k,{passive:!1}),e.addEventListener("pointerdown",C),e.addEventListener("pointermove",b),e.addEventListener("pointerup",v),e.addEventListener("pointercancel",v);const j={viewport:e,zoomIn:w,zoomOut:S,fit:u,fitToViewport:m,cleanup:()=>{fn(j),Ia(j),e.removeEventListener("wheel",k),e.removeEventListener("pointerdown",C),e.removeEventListener("pointermove",b),e.removeEventListener("pointerup",v),e.removeEventListener("pointercancel",v),l!==null&&window.clearTimeout(l),c.clear(),n.removeAttribute("data-mermaid-panning"),n.removeAttribute("data-mermaid-suppress-click")}};return Na(j),j};let cr=null,Ge=null;const Ta=()=>cr;function $a(){if(Ge)return Ge;const n=Ks(()=>Nt(()=>import("./vendor-beautiful-mermaid-ejhkvCZj.js"),__vite__mapDeps([201,202,1,2,40]))).then(e=>cr=e);return n.catch(()=>{Ge===n&&(Ge=null)}),Ge=n,n}const Me=new Map,Oa={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 Da(n,e,t){const{renderMermaidASCII:r,renderMermaidSVG:s}=n,i=`${t}:${e}`,a=Me.get(i);if(a)return Me.delete(i),Me.set(i,a),a;let o;try{o=t==="ascii"?{ascii:r(e)}:{svg:s(e,{...Oa,transparent:!0,font:"system-ui, sans-serif"})}}catch{o={}}if(Me.set(i,o),Me.size>100){const l=Me.keys().next().value;l!==void 0&&Me.delete(l)}return o}const Fa=y.memo(function(e){const t=U.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=f.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 za(n){const e=U.c(75),{code:t,isIncomplete:r}=n,{theme:s,purpose:i,mermaidControls:a,onShowPopup:o}=ae(),l=fe(Ua),{t:c}=ge(),d=y.useRef(null),h=y.useRef(null),[m,u]=y.useState(!1),p=y.useRef(null);let x;e[0]!==t?(x=t.trimEnd(),e[0]=t,e[1]=x):x=e[1];const w=x,[S,k]=y.useState(Ta);let C,b;e[2]!==r||e[3]!==S?(C=()=>{if(S||r)return;let L=!1;return $a().then(W=>{L||k(()=>W)},Wa),()=>{L=!0}},b=[S,r],e[2]=r,e[3]=S,e[4]=C,e[5]=b):(C=e[4],b=e[5]),y.useEffect(C,b);let v;e[6]!==r||e[7]!==l||e[8]!==S||e[9]!==w?(v=r||!S?null:Da(S,w,l),e[6]=r,e[7]=l,e[8]=S,e[9]=w,e[10]=v):v=e[10];const j=v,g=j?.svg,M=j?.ascii||w;let P,$;e[11]!==i||e[12]!==g?(P=()=>{if(!d.current||!g||i)return;const L=La(d.current);return h.current=L,()=>{L?.cleanup(),h.current=null}},$=[g,i],e[11]=i,e[12]=g,e[13]=P,e[14]=$):(P=e[13],$=e[14]),y.useEffect(P,$);let R,N;e[15]===Symbol.for("react.memo_cache_sentinel")?(R=()=>()=>{p.current&&clearTimeout(p.current)},N=[],e[15]=R,e[16]=N):(R=e[15],N=e[16]),y.useEffect(R,N);let F;e[17]!==g||e[18]!==s.colors.interactive.border||e[19]!==s.colors.primary.base||e[20]!==s.colors.surface.elevated||e[21]!==s.colors.surface.foreground||e[22]!==s.colors.surface.muted||e[23]!==s.colors.surface.mutedForeground?(F=()=>{const L={"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 W=g??"";for(const[ie,Y]of Object.entries(L))W=W.replaceAll(ie,Y);return W},e[17]=g,e[18]=s.colors.interactive.border,e[19]=s.colors.primary.base,e[20]=s.colors.surface.elevated,e[21]=s.colors.surface.foreground,e[22]=s.colors.surface.muted,e[23]=s.colors.surface.mutedForeground,e[24]=F):F=e[24];const E=F;let I;e[25]!==o||e[26]!==i||e[27]!==w||e[28]!==c?(I=L=>{if(i||!o||!w||!(L.target instanceof Element)||L.target.closest('button, a, [role="button"]'))return;const W=d.current;if(!W)return;if(W.hasAttribute("data-mermaid-suppress-click")){W.removeAttribute("data-mermaid-suppress-click");return}const ie=Array.from(W.closest("[data-markdown-content]")?.querySelectorAll(Ca)??[]),Y=`${c("layout.mainTab.diagram")} ${ie.indexOf(W)+1}`;o({open:!0,title:Y,content:"",metadata:{tool:"mermaid-preview",filename:Y},mermaid:{source:w,url:`data:text/plain;charset=utf-8,${encodeURIComponent(w)}`,filename:Y}})},e[25]=o,e[26]=i,e[27]=w,e[28]=c,e[29]=I):I=e[29];const B=I;let A;e[30]!==w||e[31]!==g||e[32]!==M?(A=async()=>{(await ut(g?w:M)).ok&&(u(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>u(!1),2e3))},e[30]=w,e[31]=g,e[32]=M,e[33]=A):A=e[33];const _=A;let K;e[34]!==E||e[35]!==g?(K=()=>{if(!g)return;const L=URL.createObjectURL(new Blob([E()],{type:"image/svg+xml;charset=utf-8"})),W=document.createElement("a");W.href=L,W.download="diagram.svg",W.click(),URL.revokeObjectURL(L)},e[34]=E,e[35]=g,e[36]=K):K=e[36];const q=K,J=a.showPanZoomControls&&!!g,ee=a.download&&!!g,T=!i&&(J||a.copy||ee);let z;e[37]!==J||e[38]!==c?(z=J&&f.jsxs(f.Fragment,{children:[f.jsx(Ve,{label:c("markdownRenderer.mermaid.actions.zoomInTitle"),icon:"zoom-in",onClick:()=>h.current?.zoomIn()}),f.jsx(Ve,{label:c("markdownRenderer.mermaid.actions.zoomOutTitle"),icon:"zoom-out",onClick:()=>h.current?.zoomOut()}),f.jsx(Ve,{label:c("markdownRenderer.mermaid.actions.resetViewTitle"),icon:"focus-3",onClick:()=>h.current?.fit()})]}),e[37]=J,e[38]=c,e[39]=z):z=e[39];let Z;e[40]!==a.copy||e[41]!==m||e[42]!==_||e[43]!==c?(Z=a.copy&&f.jsx(Ve,{label:c(m?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.mermaid.actions.copyTitle"),icon:"file-copy",done:m,onClick:()=>{_()}}),e[40]=a.copy,e[41]=m,e[42]=_,e[43]=c,e[44]=Z):Z=e[44];let V;e[45]!==ee||e[46]!==q||e[47]!==c?(V=ee&&f.jsx(Ve,{label:c("markdownRenderer.mermaid.actions.downloadSvgTitle"),icon:"download",onClick:q}),e[45]=ee,e[46]=q,e[47]=c,e[48]=V):V=e[48];let H;e[49]!==z||e[50]!==Z||e[51]!==V?(H=f.jsxs(f.Fragment,{children:[z,Z,V]}),e[49]=z,e[50]=Z,e[51]=V,e[52]=H):H=e[52];const O=H;let G;e[53]!==O||e[54]!==a.toolbarSlot||e[55]!==T?(G=T&&a.toolbarSlot?mr.createPortal(O,a.toolbarSlot):null,e[53]=O,e[54]=a.toolbarSlot,e[55]=T,e[56]=G):G=e[56];let X;e[57]!==O||e[58]!==a.toolbarSlot||e[59]!==T?(X=T&&!a.toolbarSlot&&f.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:O}),e[57]=O,e[58]=a.toolbarSlot,e[59]=T,e[60]=X):X=e[60];const te=g?"svg":"ascii";let se;e[61]!==E||e[62]!==i||e[63]!==g||e[64]!==M?(se=f.jsx("div",{"data-streamdown":"mermaid-scroll",children:g?f.jsx("div",{"data-streamdown":"mermaid-viewport",children:f.jsx(Fa,{svg:i?E():g,viewer:!i})}):f.jsx("pre",{"data-streamdown":"mermaid-ascii",children:M})}),e[61]=E,e[62]=i,e[63]=g,e[64]=M,e[65]=se):se=e[65];let oe;e[66]!==B||e[67]!==w||e[68]!==te||e[69]!==se?(oe=f.jsx("div",{ref:d,dir:"ltr","data-streamdown":"mermaid-block","data-oc-mermaid-source":w,"data-mermaid-render":te,onClick:B,children:se}),e[66]=B,e[67]=w,e[68]=te,e[69]=se,e[70]=oe):oe=e[70];let le;return e[71]!==G||e[72]!==X||e[73]!==oe?(le=f.jsxs("div",{"data-streamdown":"mermaid-frame",className:"group/mermaid",children:[G,X,oe]}),e[71]=G,e[72]=X,e[73]=oe,e[74]=le):le=e[74],le}function Wa(){}function Ua(n){return n.mermaidRenderingMode}const Ba=n=>`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;function Ka(n){const e=U.c(10),{code:t}=n,r=y.useContext(zn);let s;e[0]!==t?(s=Ba(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=f.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=f.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 Va(n){const e=U.c(8),{code:t,isIncomplete:r}=n,{settledReply:s,directory:i}=ae(),a=gs();if(!a){let d;return e[0]!==t?(d=f.jsx("pre",{dir:"ltr",children:f.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=f.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 Ha={note:"information",tip:"lightbulb",important:"feedback",warning:"alert",caution:"error-warning"},Ga={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"},qa=n=>{const e=U.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=Ln(r?.properties.dataOcAlert),!a){let k;e[12]!==t||e[13]!==s?(k=f.jsx("blockquote",{dir:"auto",...s,children:t}),e[12]=t,e[13]=s,e[14]=k):k=e[14],d=k;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 h=Ha[a];let m;e[15]!==h?(m=f.jsx(he,{name:h,className:"size-4 shrink-0"}),e[15]=h,e[16]=m):m=e[16];const u=Ga[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 x;e[20]!==p?(x=f.jsx("span",{children:p}),e[20]=p,e[21]=x):x=e[21];let w;e[22]!==o||e[23]!==m||e[24]!==x?(w=f.jsxs("p",{"data-oc-alert-title":o,children:[m,x]}),e[22]=o,e[23]=m,e[24]=x,e[25]=w):w=e[25];let S;return e[26]!==t||e[27]!==w||e[28]!==l||e[29]!==c?(S=f.jsxs("blockquote",{dir:l,...c,children:[w,t]}),e[26]=t,e[27]=w,e[28]=l,e[29]=c,e[30]=S):S=e[30],S},Za=(n,e)=>`highlight:${e}:${ys(n)}`,Xa=1,Ya=2,gt=4,wt=8,hn=new Map;function Qa(n){return n.map(e=>{const t=[];for(const r of e){const s=t.at(-1);s&&/^\s+$/.test(s.content)&&s.offset+s.content.length===r.offset&&s.bgColor===r.bgColor&&(s.fontStyle??0)===(r.fontStyle??0)&&!((r.fontStyle??0)&(gt|wt))?t[t.length-1]={...r,offset:s.offset,content:s.content+r.content}:t.push(r)}return t.map(({content:r,offset:s,color:i,bgColor:a,fontStyle:o=0})=>{const l=`${i}|${a}|${o}`;let c=hn.get(l);if(!c){const d={};o&Xa&&(d.fontStyle="italic"),o&Ya&&(d.fontWeight="bold"),o&(gt|wt)&&(d.textDecoration=[o>?"underline":"",o&wt?"line-through":""].filter(Boolean).join(" ")),c={color:i,bgColor:a,htmlStyle:d},hn.set(l,c)}return{...c,offset:s,content:r}})})}function Ja(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 el=(n,e)=>n.length===e.length&&n.every((t,r)=>{const s=e[r];return t.content===s.content&&t.offset===s.offset&&t.htmlStyle===s.htmlStyle});class tl{completed=new vn({maxEntries:2e3,maxBytes:24*1024*1024});recent=[];previous=[];constructor(){Ht()}cached(e,t,r=!1){const s=Za(e,t),i=this.completed.get(s);if(i)return i;const a=this.recent.find(o=>o.key===s)?.result;return a&&!r&&this.remember(s,a),a??this.tokenize(s,e,t,r)}highlight(e,t,r){const s=this.cached(e,t,r);return s?Promise.resolve(s):Ht().then(()=>this.cached(e,t,r)??null)}tokenize(e,t,r,s){const i=ws(r,t);if(!i)return;const a={tokens:Qa(xs(i))};let o,l=0;for(const c of this.previous){if(c.language!==r)continue;const d=Ja(c,t);d>l&&(l=d,o=c)}for(let c=0;o&&c<l;c++)el(o.result.tokens[c],a.tokens[c])&&(a.tokens[c]=o.result.tokens[c]);return this.previous=[{code:t,language:r,result:a},...this.previous.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=Je(e);for(const s of t.tokens){r+=32;for(const i of s)r+=160+Je(i.content)+Je(i.color??"")+Je(i.bgColor??"")}this.completed.set(e,t,r)}}const pn=new tl,nl=[{name:"openchamber-md"},{name:"openchamber-md"}];function gn(n){return n.trim().toLowerCase()||"text"}function St(n){return{tokens:n.split(`
|
|
8
8
|
`).map(e=>[{content:e}])}}function rl(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 sl(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 h=e.filter(p=>p.start<d&&p.end>c);if(!h.length)return[l];a=!0;const m=new Set([c,d]);for(const p of h)p.start>c&&p.start<d&&m.add(p.start),p.end>c&&p.end<d&&m.add(p.end);const u=[...m].sort((p,x)=>p-x);return u.slice(0,-1).map((p,x)=>{const w=u[x+1],S=h.find(k=>k.start<=p&&k.end>=w);return{...l,offset:p,content:l.content.slice(p-c,w-c),htmlAttrs:S?{...l.htmlAttrs,"data-openchamber-file-link":"true","data-openchamber-file-ref":S.raw,"data-openchamber-file-path":S.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"||!rl(s,n.isVSCode))return St(s.code);const a=gn(s.language),o=pn.cached(s.code,a,s.isIncomplete??!1);return o?e.get(o)??o:null};return{name:"shiki",type:"code-highlighter",getSupportedLanguages:()=>[],getThemes:()=>nl,supportsLanguage:()=>!0,cached:r,highlight(s,i){const a=c=>{const d=e.get(c);if(d)return d;if(n.resolvePaths){let h=t.get(s.code);h||(h=n.resolvePaths(s.code),t.set(s.code,h),h.finally(()=>t.delete(s.code)).catch(()=>{})),h.then(m=>{if(!m.length)return;const u=e.get(c)??sl(c,m);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=gn(s.language);return pn.highlight(s.code,l,s.isIncomplete??!1).then(c=>i?.(a(c??St(s.code)))),null}}}async function ql(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 il=/^(?:\uFEFF)?(---|\+\+\+)[^\S\r\n]*\r?\n([\s\S]*?)\r?\n\1[^\S\r\n]*(?:\r?\n|$)/,Ct=n=>bt(n)?String(n.value??""):An(n).trimEnd(),ol=n=>n?bt(n)?{kind:"text",text:Ct(n)}:ai(n)&&n.items.every(e=>bt(e))?{kind:"list",items:n.items.map(e=>Ct(e))}:{kind:"code",text:An(n).trimEnd()}:{kind:"text",text:""},al=(n,e)=>{if(n!=="---")return{kind:"raw",text:e};const t=ii(e);return t.errors.length>0?{kind:"raw",text:e}:t.contents===null?null:oi(t.contents)?{kind:"properties",properties:t.contents.items.map(r=>({key:r.key?Ct(r.key):"",value:ol(r.value)}))}:{kind:"raw",text:e}},ll=n=>{const e=n.match(il);return e?{frontmatter:al(e[1],e[2]),body:n.slice(e[0].length)}:{frontmatter:null,body:n}},cl=24,dl=(n,e)=>{let t=0;for(const r of n.split(`
|