@openchambery/web 1.19.7-beta.20 → 1.19.7-beta.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/AssistantView-sV1PVQiM.js +2 -0
- package/dist/assets/{DiagramView-CSXRZQ5S.js → DiagramView-D2hqP5VV.js} +1 -1
- package/dist/assets/MarkdownLoadingSkeleton-Vezjvk9B.js +3 -0
- package/dist/assets/MarkdownRenderer-x091Z--3.js +2 -0
- package/dist/assets/MarkdownRendererImpl-DML8BSro.js +7 -0
- package/dist/assets/{MarkstreamRendererImpl-CowOCU5W.js → MarkstreamRendererImpl-BK-HM2k3.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-ACMbLTqb.js → MobileDetailNavigation-DcxkWiks.js} +1 -1
- package/dist/assets/{MobileShareBridge-CXR-B1xW.js → MobileShareBridge-TAGcOiyb.js} +1 -1
- package/dist/assets/{MobileSurface-CKBSKqUH.js → MobileSurface-zqlZzEFQ.js} +1 -1
- package/dist/assets/{MultiRunWindow-el9_nl25.js → MultiRunWindow-iH1d9S14.js} +1 -1
- package/dist/assets/{SettingsView-CVSiIRia.js → SettingsView-CzW23DZA.js} +3 -3
- package/dist/assets/{SettingsWindow-BXYswtp5.js → SettingsWindow-DZXCWZid.js} +1 -1
- package/dist/assets/{TerminalView-Bh0IQwa5.js → TerminalView-pU0wpD8s.js} +1 -1
- package/dist/assets/{ToolOutputDialog-XeIJ2etT.js → ToolOutputDialog-Bt7JChFG.js} +2 -2
- package/dist/assets/appThemeRegistry-BI7WR2Wo.js +1 -0
- package/dist/assets/fileReferenceActions-Di_DoDex.js +1 -0
- package/dist/assets/{gitApi-Uvb9w70Y.js → gitApi-CeFszLvk.js} +1 -1
- package/dist/assets/{insertionBoundaries-Bgec5nsP.js → insertionBoundaries-DDJNusn2.js} +1 -1
- package/dist/assets/{main-COfQt8Sj.js → main-CjnOsKDL.js} +8 -8
- package/dist/assets/{main-PPlpRj1-.js → main-j-Ij13jc.js} +2 -2
- package/dist/assets/markdown-worker-BuveaH3O.js +1 -0
- package/dist/assets/markdownHeightCache-CvUyZT4q.js +1 -0
- package/dist/assets/{miniChat-EZGRqQZr.js → miniChat-DgxavREE.js} +2 -2
- package/dist/assets/{mobile-DQNqMo5J.js → mobile-C0rwPMPM.js} +2 -2
- package/dist/assets/{multirun-EViX73vm.js → multirun-ot7-bKg7.js} +1 -1
- package/dist/assets/{projectMeta-Bv1L_nEb.js → projectMeta-3yOEc0oI.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-Nsq4Wc4s.js → renderElectronMiniChatApp-BPNvFA_N.js} +2 -2
- package/dist/assets/renderMobileApp-CNog29Xy.js +28 -0
- package/dist/assets/{runtimeConfig-DKUQS4iY.js → runtimeConfig-D28kNEYO.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BMeu9Hqj.js → runtimeEndpointReset-CorvFIRk.js} +1 -1
- package/dist/assets/{sessionLookup-Sb2HN3G2.js → sessionLookup-CbatbQf7.js} +1 -1
- package/dist/assets/{markdownHeightCache-Bj707yG-.js → toolHelpers-DEvVP9U0.js} +1 -1
- package/dist/assets/{useAppFontEffects-B_6vc0u3.js → useAppFontEffects-CDpeZWK4.js} +32 -32
- package/dist/assets/{useDesktopWindowControlsLayout-B2L5PWHW.js → useDesktopWindowControlsLayout-D-xPByG0.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-CBd5vt8N.js → useEffectiveDirectory-Dp-tez_r.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-CUGaydRW.js → useMobileNavigationStore-DE1Pe9A9.js} +2 -2
- package/dist/assets/{useSessionAutoCleanup-Clhzc1wn.js → useSessionAutoCleanup-jNJ_WC38.js} +1 -1
- package/dist/assets/useWorkerHighlightedLines-MDnGj3yv.js +7 -0
- package/dist/index.html +2 -2
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/server/lib/notifications/APNS.md +19 -13
- package/server/lib/notifications/DOCUMENTATION.md +4 -3
- package/server/lib/notifications/runtime.js +101 -42
- package/server/lib/notifications/runtime.test.js +65 -4
- package/dist/assets/AssistantView-C0p-8f2B.js +0 -2
- package/dist/assets/MarkdownRendererImpl-C6rkoZYH.js +0 -7
- package/dist/assets/appThemeRegistry-rSdmh4sW.js +0 -2
- package/dist/assets/fileReferenceActions-3pPDAJSl.js +0 -1
- package/dist/assets/markdown-worker-wEFz5Hm_.js +0 -3
- package/dist/assets/renderMobileApp-5WJDYaMR.js +0 -28
- package/dist/assets/useWorkerHighlightedLines-C4iQlbPQ.js +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{E as t,t as n}from"./useUIStore-CqqO11ZI.js";import{$t as r}from"./persistence-CSZp1CNB.js";import{nt as i,rt as a}from"./vendor-base-ui-CnHfUmDN.js";import{t as o}from"./platform-CenlWqxu.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{n as c}from"./vendor-katex--B5dHUyk.js";import{n as l,r as u,u as d}from"./vendor-reactuses-core-DDoDDyM9.js";import{n as f,t as p}from"./clipboard-BXxLshVq.js";import{Oi as m}from"./useMobileNavigationStore-CUGaydRW.js";import{t as h}from"./utils-B0mQXN9L.js";import{t as g}from"./useThemeSystem-DMzWVJaW.js";import{c as _,f as v,h as y,n as b,o as x,r as S,s as C,t as w}from"./markdownTheme-CVS01wHf.js";import{n as T}from"./useRuntimeAPIs-DSLXJybW.js";import{a as E,i as D,n as O,r as k}from"./url-CE_gAfNa.js";import{i as A,r as j,t as ee}from"./markdownHeightCache-Bj707yG-.js";import{n as te}from"./useEffectiveDirectory-CBd5vt8N.js";import{c as ne,i as M,l as N,n as re,o as P,r as ie,u as F}from"./FadeInOnReveal-BWJcUp5P.js";import{a as ae,i as oe,n as I,t as se}from"./markdown-worker-wEFz5Hm_.js";import{t as L}from"./vendor-morphdom-BbKiNDAu.js";import{n as R,t as z}from"./vendor-beautiful-mermaid-DykqIK5D.js";import{t as B}from"./vendor-dompurify-CeJNOzik.js";import{t as V}from"./vendor-marked-WVekxjAN.js";import{t as H}from"./vendor-remend-C3cXc-tf.js";import{a as ce,c as le,d as U,f as ue,i as de,l as fe,m as W,n as pe,r as me,s as he,t as ge}from"./fileReferenceActions-3pPDAJSl.js";var G=e(a(),1),_e=s(),K=`data-md-stream-fence`,q=`data-md-stream-line`,ve=`data-md-stream-src`,ye=`data-md-stream-applied`,be=(e,t)=>{let n=Math.min(e.length,t.length);for(let r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n},xe=e=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.hasAttribute(`data-md-stream-line`)),Se=(e,t)=>{let n=document.createElement(`span`);return n.setAttribute(q,String(t)),n.className=`line`,n.innerHTML=e,n},Ce=(e,t)=>{let n=xe(e),r=be(n.map(e=>e.innerHTML),t);if(n.length===0&&e.childNodes.length>0&&t.length>0){e.replaceChildren();for(let n=0;n<t.length;n+=1)e.appendChild(Se(t[n]??``,n));return{reused:0,replaced:0,added:t.length,removed:0}}let i=0;if(r<n.length&&r<t.length){let e=n[r];e&&(e.innerHTML=t[r]??``,e.setAttribute(q,String(r)),i=1)}let a=0;for(let e=n.length-1;e>=r+i;--e)n[e]?.remove(),a+=1;let o=0;for(let n=r+i;n<t.length;n+=1)e.appendChild(Se(t[n]??``,n)),o+=1;return{reused:r,replaced:i,added:o,removed:a}},we=e=>{if(e.includes(`data-md-stream-fence=`))return e;let t=e.toLowerCase().lastIndexOf(`<pre`);return t<0?e:`${e.slice(0,t)}${e.slice(t).replace(/<pre\b/i,`<pre ${K}="true"`)}`},Te=(e,t)=>{if(!(e instanceof HTMLElement)||!(t instanceof HTMLElement)||e.getAttribute(`data-md-stream-fence`)!==`true`||t.getAttribute(`data-md-stream-fence`)!==`true`)return!1;let n=e.tagName===`CODE`?e:e.querySelector(`code`),r=t.tagName===`CODE`?t:t.querySelector(`code`);return n instanceof HTMLElement&&r instanceof HTMLElement&&n.setAttribute(ve,r.textContent??``),!0},Ee=e=>e.getAttribute(`data-md-stream-src`)??e.textContent??``,De=e=>{let t=e.querySelectorAll(`pre[${K}="true"]`),n=[];return t.forEach(e=>{let t=e.querySelector(`code`);t instanceof HTMLElement&&n.push(t)}),n},Oe=e=>e.closest(`pre`)?.getAttribute(`data-md-lang`)||e.className.match(/language-([^\s"]+)/)?.[1]||`text`,ke=async(e,t,n)=>{if(n?.signal?.aborted)return;let r=De(e);await Promise.all(r.map(async r=>{let i=Ee(r);if(!i||n?.signal?.aborted||r.getAttribute(`data-md-stream-applied`)===i)return;let a=Oe(r);if(a===`mermaid`)return;let o=await t(i,a,n);!o||n?.signal?.aborted||!e.contains(r)||(Ce(r,o),r.setAttribute(ye,i),r.removeAttribute(ve))}))},Ae=`text`,je=/^(\d+):(\d+):(.+)$/,Me={ts:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`tsx`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`jsx`,vue:`vue`,svelte:`svelte`,astro:`astro`,json:`json`,jsonc:`jsonc`,json5:`json5`,jsonl:`json`,ndjson:`json`,geojson:`json`,yaml:`yaml`,yml:`yaml`,toml:`toml`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`properties`,env:`dotenv`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,styl:`stylus`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,md:`markdown`,markdown:`markdown`,mdown:`markdown`,mkd:`markdown`,mdx:`mdx`,py:`python`,pyw:`python`,pyi:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,kts:`kotlin`,swift:`swift`,scala:`scala`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,m:`objective-c`,mm:`objective-cpp`,cs:`csharp`,fs:`fsharp`,fsx:`fsharp`,vb:`vb`,php:`php`,pl:`perl`,pm:`perl`,lua:`lua`,r:`r`,dart:`dart`,ex:`elixir`,exs:`elixir`,erl:`erlang`,hrl:`erlang`,hs:`haskell`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,groovy:`groovy`,jl:`julia`,ml:`ocaml`,mli:`ocaml`,zig:`zig`,nix:`nix`,sol:`solidity`,prisma:`prisma`,proto:`proto`,graphql:`graphql`,gql:`graphql`,sql:`sql`,sh:`shellscript`,bash:`shellscript`,zsh:`shellscript`,fish:`shellscript`,ps1:`powershell`,psm1:`powershell`,bat:`bat`,cmd:`bat`,tf:`terraform`,tfvars:`terraform`,hcl:`hcl`,diff:`diff`,patch:`diff`,csv:`csv`,tex:`latex`,vim:`viml`,wgsl:`wgsl`,glsl:`glsl`,wat:`wasm`,mermaid:`mermaid`,mmd:`mermaid`},Ne={dockerfile:`docker`,containerfile:`docker`,makefile:`make`,gnumakefile:`make`,"cmakelists.txt":`cmake`,gemfile:`ruby`,rakefile:`ruby`,podfile:`ruby`,".env":`dotenv`,".bashrc":`shellscript`,".zshrc":`shellscript`,".profile":`shellscript`},Pe=e=>{let t=e.split(/[\\/]/).pop()?.toLowerCase()??``;if(!t)return Ae;let n=Ne[t];if(n)return n;let r=t.lastIndexOf(`.`);return r<=0?Ae:Me[t.slice(r+1)]??Ae},Fe=e=>{let t=e?.trim()??``;if(!t)return{lang:Ae,label:Ae,reference:!1};let n=je.exec(t);if(!n){let e=t.toLowerCase();return{lang:e,label:e,reference:!1}}let[,r=``,i=``,a=``]=n,o=r===i?r:`${r}-${i}`;return{lang:Pe(a),label:`${a}:${o}`,reference:!0}},Ie=e=>e===` `||e===` `||e===`
|
|
2
|
-
`||e===`\r`,Le=e=>e!==void 0&&e>=`0`&&e<=`9`,Re=e=>e===`\\`||e===`^`||e===`_`||e===`{`||e===`}`||e===`=`||e===`+`||e===`*`||e===`/`||e===`-`,ze=e=>{for(let t=0;t<e.length;t+=1){let n=e[t];if(n!==void 0&&Re(n))return!0}return!1},Be=e=>{for(let t=0;t<e.length;t+=1){let n=e[t];if(n===`"`||n===`'`||Ie(n))return!0}return!1},Ve=e=>{let t=0;for(;t<e.length;){let n=e.indexOf(`$`,t);if(n<0)return;let r=e[n+1];if(r===`$`||r!==void 0&&!Ie(r))return n;t=n+1}},He=e=>{if(e[0]===`$`){if(e[1]===`$`){let t=e.indexOf(`$$`,2);return t<0?void 0:{raw:e.slice(0,t+2),text:e.slice(2,t),display:!0}}if(!(e.length<3||Ie(e[1])))for(let t=1;t<e.length;t+=1){let n=e[t];if(n===`\\`){t+=1;continue}if(n!==`$`)continue;if(e[t+1]===`$`||Ie(e[t-1]))return;if(Le(e[t+1]))continue;if(t===1)return;let r=e.slice(1,t);return Le(e[1])&&!ze(r)&&Be(r)?void 0:{raw:e.slice(0,t+1),text:r,display:!1}}}},J=e=>e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`),Ue=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},We=e=>`${Ue(e.raw)}:${e.mode}:${+!!e.highlight}`,Ge=e=>/^\[[^\]]+\]:\s+\S+/m.test(e)||/^\[\^[^\]]+\]:\s+/m.test(e),Ke=e=>{let t=e.match(/^[ \t]{0,3}(`{3,}|~{3,})/);if(!t)return!1;let n=t[1];if(!n)return!1;let r=n[0],i=n.length,a=e.trimEnd().split(`
|
|
3
|
-
`).at(-1)?.trim()??``;return!RegExp(`^[\\t ]{0,3}${r}{${i},}[\\t ]*$`).test(a)},qe=e=>{try{return H(e,{linkMode:`text-only`})}catch{return e}},Je=(e,t)=>{let n=t?`live`:`full`;if(Ge(e))return[{raw:e,src:qe(e),mode:n,highlight:!0}];let r;try{r=V.lexer(e)}catch{return[{raw:e,src:qe(e),mode:n,highlight:!0}]}let i=-1;for(let e=r.length-1;e>=0;--e)if(r[e]?.type!==`space`){i=e;break}if(i<0)return[{raw:e,src:qe(e),mode:n,highlight:!0}];let a=[];for(let e=0;e<r.length;e+=1){let t=r[e];if(!t||t.type===`space`)continue;let o=t.raw??``,s=e===i,c=t.type===`code`&&Ke(o);a.push({raw:o,src:c?o:qe(o),mode:s?n:`full`,highlight:!c})}return a.length===0?[{raw:e,src:qe(e),mode:n,highlight:!0}]:a},Ye=16,Xe=new Map,Ze=(e,t)=>{let n=`${+!!t}:${e}`,r=Xe.get(n);if(r)return Xe.delete(n),Xe.set(n,r),r;let i=Je(e,t);for(;Xe.size>=Ye;){let e=Xe.keys().next().value;if(typeof e!=`string`)break;Xe.delete(e)}return Xe.set(n,i),i},Qe=(e,t,n)=>{try{return c.renderToString(e,{displayMode:n,throwOnError:!1})}catch{return t}},$e=V.use({gfm:!0,breaks:!1,extensions:[{name:`inlineMath`,level:`inline`,start(e){let t=e.indexOf(`\\(`);return t<0?void 0:t},tokenizer(e){let t=/^\\\(([\s\S]+?)\\\)/.exec(e);if(t)return{type:`inlineMath`,raw:t[0],text:t[1]??``}},renderer(e){let t=e;return Qe(t.text,t.raw,!1)}},{name:`blockMath`,level:`block`,start(e){let t=e.indexOf(`\\[`);return t<0?void 0:t},tokenizer(e){let t=/^\\\[([\s\S]+?)\\\]/.exec(e);if(t)return{type:`blockMath`,raw:t[0],text:t[1]??``}},renderer(e){let t=e;return Qe(t.text,t.raw,!0)}},{name:`dollarMath`,level:`inline`,start(e){return Ve(e)},tokenizer(e){let t=He(e);if(t)return{type:`dollarMath`,raw:t.raw,text:t.text,display:t.display}},renderer(e){let t=e;return Qe(t.text,t.raw,t.display)}}],renderer:{link({href:e,title:t,text:n}){let r=e??``,i=ne(r);if(i)return`<a href="${J(P(i))}" data-openchamber-agent-mention="true" class="text-primary hover:underline" target="_blank" rel="noopener noreferrer">${n}</a>`;let a=N(r);if(a)return`<a href="${J(r)}" data-skill-name="${J(a)}" class="text-primary hover:underline">${n}</a>`;let o=t?` title="${J(t)}"`:``;return`<a href="${J(r)}"${o} class="external-link" target="_blank" rel="noopener noreferrer">${n}</a>`}}}),et=e=>e.replace(/\$\$([\s\S]*?)\$\$/g,(e,t)=>{try{return c.renderToString(t,{displayMode:!0,throwOnError:!1})}catch{return`$$${t}$$`}}),tt=e=>e.indexOf(`$`)===-1?e:e.split(/(<(?:pre|code|kbd)[^>]*>[\s\S]*?<\/(?:pre|code|kbd)>)/gi).map((e,t)=>t%2==1?e:et(e)).join(``),nt=e=>tt($e.parse(e)),rt=e=>{let t=nt(e.src);return e.highlight?t:we(t)},it=/<pre><code(?:\s+class="language-([^"]*)")?>([\s\S]*?)<\/code><\/pre>/g,at=1200,ot=(e,t)=>{let n=1;for(let r=0;r<e.length;r+=1)if(e.charCodeAt(r)===10&&++n>t)return!0;return!1},st=e=>e.replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/&/g,`&`),ct=e=>e.reference?`data-md-lang="${J(e.lang)}" data-md-label="${J(e.label)}"`:`data-md-lang="${J(e.lang)}"`,lt=async(e,t,n)=>{if(n.isCancelled?.())return null;let r=[...e.matchAll(it)];if(r.length===0)return e;let i=e;for(let e of r){if(n.isCancelled?.())return null;let[r,a,o]=e,s=Fe(a);if(s.lang===`mermaid`&&!s.reference)continue;let c=st(o??``);if(ot(c,n.lineLimit)){i=i.replace(r,()=>r.replace(`<pre`,`<pre ${ct(s)}`));continue}let l=await t(c,s.lang);if(n.isCancelled?.())return null;if(l){let e=l.replace(/^<pre/,`<pre ${ct(s)}`);i=i.replace(r,()=>e)}}return i},ut=(e,t)=>!t&&e.length<=480&&!e.includes("```"),dt={USE_PROFILES:{html:!0,mathMl:!0,svg:!0},ADD_TAGS:[`svg`,`path`,`g`,`rect`,`line`,`polygon`,`polyline`,`circle`,`ellipse`,`text`,`tspan`,`defs`,`marker`],ADD_ATTR:[`d`,`viewBox`,`preserveAspectRatio`,`xmlns`,`target`,`fill`,`stroke`,`stroke-width`,`transform`,`points`,`x`,`y`,`x1`,`y1`,`x2`,`y2`,`cx`,`cy`,`r`,`rx`,`ry`,`style`],FORBID_TAGS:[`script`],FORBID_CONTENTS:[`script`]},ft=!1,pt=()=>{ft||typeof window>`u`||!B.isSupported||(ft=!0,B.addHook(`uponSanitizeAttribute`,(e,t)=>{if(!(e instanceof HTMLImageElement)||t.attrName!==`src`)return;let n=typeof t.attrValue==`string`?t.attrValue:``;/^file:/i.test(n)&&(e.setAttribute(`data-md-image-source`,n),t.keepAttr=!1)}),B.addHook(`afterSanitizeAttributes`,e=>{e instanceof HTMLAnchorElement&&e.target===`_blank`&&e.setAttribute(`rel`,`noopener noreferrer`)}))},mt=e=>B.isSupported?(pt(),B.sanitize(e,dt)):``,ht=`data-md-sanitize-block`,gt=e=>{if(e.length===0)return[];if(e.length===1)return[mt(e[0])];if(!B.isSupported||typeof document>`u`)return e.map(e=>mt(e));let t=e.map((e,t)=>`<div ${ht}="${t}">${e}</div>`).join(``),n=document.createElement(`div`);n.innerHTML=mt(t);let r=e.map(()=>``);return n.querySelectorAll(`[${ht}]`).forEach(e=>{let t=Number(e.getAttribute(ht));Number.isInteger(t)&&t>=0&&t<r.length&&(r[t]=e.innerHTML)}),r},_t=()=>r()?200:at,vt=240,yt=16777216,bt=160,xt=8388608,St=new A({maxEntries:vt,maxBytes:yt}),Ct=new A({maxEntries:bt,maxBytes:xt}),wt=e=>e.length*2,Tt=(e,t)=>{St.set(e,t,wt(e)+wt(t.hash)+wt(t.html))},Et=async(e,t,n)=>lt(e,(e,r)=>se(e,r,{signal:t,priority:n}),{lineLimit:_t(),isCancelled:()=>!!t?.aborted}),Dt=async(e,t,n)=>{if(t?.aborted)return null;let r=rt(e);if(t?.aborted)return null;let i=e.highlight?await Et(r,t,n):r;if(i===null||t?.aborted)return null;let a=mt(i);return t?.aborted?null:a},Ot=e=>`${Ue(e)}:${e.length}`,kt=e=>{let t=Ct.get(Ot(e));return t?.source===e?t.html:void 0},At=(e,t)=>{let n=Ot(e);Ct.set(n,{source:e,html:t},wt(n)+wt(e)+wt(t))},jt=e=>{if(!e)return[];let t=Ze(e,!1),n=Array(t.length).fill(``),r=[],i=[];t.forEach((e,t)=>{let a=kt(e.src);if(a!==void 0){n[t]=a;return}r.push(t),i.push(rt(e))});let a=gt(i);return r.forEach((e,r)=>{let i=a[r]??``;n[e]=i;let o=t[e]?.src;o!==void 0&&At(o,i)}),n},Mt=8,Nt=()=>typeof performance<`u`?performance.now():Date.now(),Pt=e=>e?.aborted?Promise.resolve(!1):new Promise(t=>{let n=!1,r=r=>{n||(n=!0,e?.removeEventListener(`abort`,a),t(r))},i=M(()=>{r(!e?.aborted)},{priority:`visible`}),a=()=>{i(),r(!1)};e?.addEventListener(`abort`,a,{once:!0})}),Ft=(e,t)=>{let n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(!i)return null;let a=Ue(i.raw),o=`${t}:${r}:${i.mode}`,s=St.get(o);if(!s||s.hash!==a)return null;n.push({id:We(i),html:s.html})}return n},It=(e,t,n)=>{let r=gt(t.map(e=>e.html));return t.map((t,i)=>{let a=e[i],o=r[i]??``;return a&&Tt(`${n}:${i}:${a.mode}`,{hash:Ue(a.raw),html:o}),{id:t.id,html:o}})},Lt=async(e,t,n,r)=>{let i=n?`visible`:`background`,a=async(e,n)=>{if(r?.aborted)return null;let a=Ue(e.raw),o=We(e),s=`${t}:${n}:${e.mode}`,c=St.get(s);if(c&&c.hash===a)return{id:o,html:c.html};let l=await Dt(e,r,i);return l===null||r?.aborted?null:(Tt(s,{hash:a,html:l}),{id:o,html:l})};if(n)return(await Promise.all(e.map(a))).filter(e=>e!==null);let o=[],s=0;for(let t=0;t<e.length&&!r?.aborted;t+=1){let n=e[t];if(!n)continue;if(Nt()>=s){if(!await Pt(r))break;s=Nt()+Mt}let i=await a(n,t);i&&o.push(i)}return o},Rt=async(e,t,n,r)=>{if(!e)return[];let i=Ze(e,t),a=Ft(i,n);if(a)return a;let o=t?`visible`:`background`,s=[],c=[];for(let e=0;e<i.length;e+=1){let t=i[e];if(!t)continue;let r=St.get(`${n}:${e}:${t.mode}`);r&&r.hash===Ue(t.raw)||(s.push(t),c.push(e))}if(!ut(e,t)&&s.length>0)try{let e=await oe({streaming:t,highlight:!0,highlightLineLimit:_t(),signal:r,priority:o,blocks:s});if(r?.aborted)return[];if(e&&e.length===s.length)return It(i,i.map((t,r)=>{let i=c.indexOf(r);if(i>=0)return e[i]??{id:We(t),html:``,highlight:t.highlight};let a=St.get(`${n}:${r}:${t.mode}`);return{id:We(t),html:a?.html??``,highlight:t.highlight}}),n)}catch{}return Lt(i,n,t,r)},Y=e=>Number.isFinite(e)&&e>0,zt=e=>{if(typeof e==`number`)return Y(e)?e:null;if(typeof e!=`string`)return null;let t=e.trim().match(/^([+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[eE][+-]?\d+)?)(?:px)?$/);if(!t)return null;let n=Number(t[1]);return Y(n)?n:null},Bt=(e,t,n)=>Math.min(n,Math.max(t,e)),Vt=6,Ht=1.25,Ut=1.0015,Wt=16,Gt=1e3,Kt=.5,qt=12,Jt=400,Yt=`[data-markdown="mermaid-block"]`,Xt=e=>e.querySelector(Yt)!==null,Zt=e=>[e.x,e.y,e.width,e.height].map(e=>{let t=Number(e.toFixed(Vt));return Object.is(t,-0)?`0`:String(t)}).join(` `),Qt=e=>{let t=e.viewBox?.trim().split(/[\s,]+/).map(e=>Number.parseFloat(e));if(t?.length===4){let[e,n,r,i]=t;if(Number.isFinite(e)&&Number.isFinite(n)&&Y(r)&&Y(i))return{x:e,y:n,width:r,height:i}}let n=zt(e.width),r=zt(e.height);return n===null||r===null?null:{x:0,y:0,width:n,height:r}},$t=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},en=e=>{let t=e.renderMode||`unknown`,n=e.svgMarkup??``;if(!n){let n=[e.viewBox??``,e.width??``,e.height??``];return n.some(e=>e!==``)?`${t}:bounds:${n.join(`:`)}`:`${t}:no-svg`}return[t,$t(n)].join(`:`)},tn=(e,t)=>{if(!Y(t.width)||!Y(t.height))return e;let n=e.width/e.height,r=t.width/t.height;if(n>r){let t=e.width/r;return{x:e.x,y:e.y-(t-e.height)/2,width:e.width,height:t}}let i=e.height*r;return{x:e.x-(i-e.width)/2,y:e.y,width:i,height:e.height}},nn=({currentBox:e,viewport:t,delta:n})=>!Y(t.width)||!Y(t.height)||!Y(e.width)||!Y(e.height)?e:{x:e.x-n.x/t.width*e.width,y:e.y-n.y/t.height*e.height,width:e.width,height:e.height},rn=(e,t,n)=>{let r=e*(t===1?Wt:t===2?Y(n)?n:0:1);return Number.isFinite(r)?Bt(r,-1e3,Gt):0},an=e=>{let t=null;for(let n of e){if(!t){t=n;continue}return{center:{x:(t.x+n.x)/2,y:(t.y+n.y)/2},distance:Math.hypot(n.x-t.x,n.y-t.y)}}return null},on=(e,t)=>{let n=t.x-e.x,r=t.y-e.y;return n*n+r*r>9},sn=({currentBox:e,contentBox:t,viewport:n,pointer:r,zoomFactor:i,minScale:a,maxScale:o})=>{if(!Y(n.width)||!Y(n.height)||!Y(i)||!Y(e.width)||!Y(e.height)||!Y(t.width)||!Y(t.height)||!Y(a)||!Y(o))return e;let s=Math.min(a,o),c=Math.max(a,o),l=tn(t,n),u=Bt(l.width/e.width*i,s,c),d=l.width/u,f=d/(e.width/e.height),p=Bt(r.x/n.width,0,1),m=Bt(r.y/n.height,0,1),h=e.x+p*e.width,g=e.y+m*e.height;return{x:h-p*d,y:g-m*f,width:d,height:f}},cn=({currentBox:e,contentBox:t,viewport:n,previousGesture:r,gesture:i,minScale:a,maxScale:o})=>!Y(r.distance)||!Y(i.distance)?e:sn({currentBox:nn({currentBox:e,viewport:n,delta:{x:i.center.x-r.center.x,y:i.center.y-r.center.y}}),contentBox:t,viewport:n,pointer:i.center,zoomFactor:i.distance/r.distance,minScale:a,maxScale:o}),ln=new WeakMap,un=e=>e instanceof HTMLElement?ln.get(e)??null:null,dn=e=>e.querySelector(`[data-markdown="mermaid-viewport"]`)??e.querySelector(`[data-markdown="mermaid"]`),fn=e=>{let t=e.querySelector(`[data-markdown="mermaid"] svg`),n=e.querySelector(`[data-markdown="mermaid"]`);return en({renderMode:e.getAttribute(`data-mermaid-render`),svgMarkup:n?.getAttribute(`data-md-original-svg`)??t?.outerHTML??null,viewBox:t?.getAttribute(`viewBox`),width:t?.getAttribute(`width`),height:t?.getAttribute(`height`)})},pn=e=>{let t=e.getBoundingClientRect();return{width:t.width,height:t.height}},mn=(e,t)=>({x:e.clientX-t.left,y:e.clientY-t.top}),hn=(e,t)=>mn(e,t.getBoundingClientRect()),gn=e=>e instanceof Element&&!!e.closest(`button, a, [role="button"]`),_n=e=>{let t=dn(e),n=e.querySelector(`[data-markdown="mermaid"] svg`);if(!t||!n)return null;let r=Qt({viewBox:n.getAttribute(`viewBox`),width:n.getAttribute(`width`),height:n.getAttribute(`height`)});if(!r)return null;let i=r,a=null,o=null,s=null,c=new Map,l=new Set,u=null,d=null,f=e=>{i=e,n.setAttribute(`viewBox`,Zt(e)),n.removeAttribute(`width`),n.removeAttribute(`height`)},p=()=>{f(tn(r,pn(t)))},m=(e,n)=>{f(sn({currentBox:i,contentBox:r,viewport:pn(t),pointer:e,zoomFactor:n,minScale:Kt,maxScale:qt}))},h=()=>{let e=pn(t);m({x:e.width/2,y:e.height/2},Ht)},g=()=>{let e=pn(t);m({x:e.width/2,y:e.height/2},1/Ht)},_=e=>{e.preventDefault(),e.stopPropagation();let n=rn(e.deltaY,e.deltaMode,pn(t).height);m(hn(e,t),Ut**+-n)},v=e=>{try{t.setPointerCapture(e),l.add(e)}catch{}},y=e=>{if(l.delete(e))try{t.hasPointerCapture(e)&&t.releasePointerCapture(e)}catch{}},b=()=>{a=null,o=null,s=null,c.clear(),u=null},x=()=>{b(),e.removeAttribute(`data-mermaid-panning`),e.hasAttribute(`data-mermaid-suppress-click`)&&(d=window.setTimeout(()=>{e.removeAttribute(`data-mermaid-suppress-click`),d=null},Jt))},S=n=>{if(n.pointerType!==`touch`&&n.button!==0||gn(n.target))return;d!==null&&(window.clearTimeout(d),d=null),e.removeAttribute(`data-mermaid-suppress-click`);let r=hn(n,t);v(n.pointerId),e.setAttribute(`data-mermaid-panning`,`true`),n.pointerType===`touch`?(c.set(n.pointerId,r),c.size>=2?(a=null,o=null,s=null,u=an(c.values()),e.setAttribute(`data-mermaid-suppress-click`,`true`)):(a=n.pointerId,o=r,s=r)):(a=n.pointerId,o=r,s=r),n.preventDefault()},C=n=>{if(n.pointerType===`touch`){if(!c.has(n.pointerId))return;let a=hn(n,t);if(c.set(n.pointerId,a),c.size>=2){let a=an(c.values());u&&a&&f(cn({currentBox:i,contentBox:r,viewport:pn(t),previousGesture:u,gesture:a,minScale:Kt,maxScale:qt})),u=a,e.setAttribute(`data-mermaid-suppress-click`,`true`),n.preventDefault();return}}if(a!==n.pointerId||!s)return;let l=hn(n,t);f(nn({currentBox:i,viewport:pn(t),delta:{x:l.x-s.x,y:l.y-s.y}})),s=l,o&&on(o,l)&&e.setAttribute(`data-mermaid-suppress-click`,`true`),n.preventDefault()},w=e=>{if(e.pointerType===`touch`||c.has(e.pointerId)){if(!c.has(e.pointerId))return;if(c.delete(e.pointerId),u=an(c.values()),c.size>0){for(let[e,t]of c){a=e,o=t,s=t;break}c.size>=2&&(a=null,o=null,s=null),y(e.pointerId);return}x(),y(e.pointerId);return}a===e.pointerId&&(x(),y(e.pointerId))},T=()=>{p()};t.addEventListener(`wheel`,_,{passive:!1}),t.addEventListener(`pointerdown`,S),t.addEventListener(`pointermove`,C),t.addEventListener(`pointerup`,w),t.addEventListener(`pointercancel`,w),t.addEventListener(`lostpointercapture`,w),window.addEventListener(`resize`,T);let E=typeof ResizeObserver>`u`?null:new ResizeObserver(T);return E?.observe(t),p(),{zoomIn:h,zoomOut:g,fit:p,cleanup:()=>{t.removeEventListener(`wheel`,_),t.removeEventListener(`pointerdown`,S),t.removeEventListener(`pointermove`,C),t.removeEventListener(`pointerup`,w),t.removeEventListener(`pointercancel`,w),t.removeEventListener(`lostpointercapture`,w),window.removeEventListener(`resize`,T),E?.disconnect(),d!==null&&window.clearTimeout(d);for(let e of Array.from(l))y(e);b(),e.removeAttribute(`data-mermaid-panning`),e.removeAttribute(`data-mermaid-suppress-click`),ln.delete(e)}}},vn=e=>{let t=new Map,n=new Map,r=()=>{for(let[r,i]of Array.from(t.entries())){let a=fn(r);(!e.contains(r)||a!==n.get(r))&&(i.cleanup(),t.delete(r),n.delete(r))}for(let r of Array.from(e.querySelectorAll(Yt))){if(t.has(r)||r.querySelector(`[data-markdown="mermaid"] svg`)===null)continue;let e=_n(r);e&&(t.set(r,e),n.set(r,fn(r)),ln.set(r,e))}};return r(),{refresh:r,cleanup:()=>{for(let e of t.values())e.cleanup();t.clear(),n.clear()}}},X=(e,t=`size-3.5`)=>`<svg class="oc-icon ${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#oc-${e}"></use></svg>`,yn={copy:X(`file-copy`),check:X(`check`),download:X(`download`),zoomIn:X(`add`),zoomOut:X(`subtract`),fit:X(`refresh`),textWrap:X(`text-wrap`),image:X(`file-image`,`size-10`),imageDownload:X(`download`,`size-3`),imageLoading:X(`loader-4`,`size-3.5 animate-spin motion-reduce:animate-none`)},bn=`p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--interactive-focus-ring)]`,xn=(e,t)=>{e.innerHTML=t},Z=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.className=bn,r.setAttribute(`data-md-action`,n),r.setAttribute(`title`,t),r.setAttribute(`aria-label`,t),xn(r,yn[e]),r},Sn=(e,t,n)=>{let r=e.querySelector(`[data-md-code-body]`),i=e.querySelector(`pre`),a=e.querySelector(`pre code`),o=e.querySelector(`[data-md-action="toggle-code-wrap"]`);if(e.setAttribute(`data-code-wrap`,t?`true`:`false`),r?.classList.toggle(`overflow-x-auto`,!t),r?.classList.toggle(`overflow-x-hidden`,t),i?.classList.toggle(`whitespace-pre-wrap`,t),i?.classList.toggle(`break-words`,t),a?.classList.toggle(`whitespace-pre-wrap`,t),a?.classList.toggle(`break-words`,t),i&&(i.style.whiteSpace=t?`pre-wrap`:`pre`,i.style.overflowWrap=t?`anywhere`:`normal`),a&&(a.style.whiteSpace=t?`pre-wrap`:`pre`,a.style.overflowWrap=t?`anywhere`:`normal`),o){let e=t?n.disableCodeWrap:n.enableCodeWrap;o.setAttribute(`title`,e),o.setAttribute(`aria-label`,e),o.classList.toggle(`text-foreground`,t),o.classList.toggle(`opacity-100`,t),o.classList.toggle(`text-muted-foreground`,!t),o.classList.toggle(`opacity-65`,!t),o.setAttribute(`aria-pressed`,t?`true`:`false`)}},Cn=e=>{let t=document.createElement(`div`);t.setAttribute(`data-md-code-line-numbers`,``),t.setAttribute(`aria-hidden`,`true`),t.className=`min-w-8 shrink-0 select-none border-r border-border/50 pr-3 text-right font-mono text-[13px] text-muted-foreground/45`;let n=e.textContent??``,r=Math.max(1,n.endsWith(`
|
|
4
|
-
`)?n.split(`
|
|
5
|
-
`).length-1:n.split(`
|
|
6
|
-
`).length);for(let e=1;e<=r;e+=1){let n=document.createElement(`div`);n.className=`tabular-nums`,n.textContent=String(e),t.appendChild(n)}return t},wn=e=>{let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=n.nextNode();for(;r;)t.push(r),r=n.nextNode();return t},Tn=(e,t)=>{let n=0;for(let r of e){let e=n+r.data.length;if(t<=e)return{node:r,offset:Math.max(0,t-n)};n=e}let r=e.at(-1);return r?{node:r,offset:r.data.length}:null},En=(e,t)=>{let n=1/0,r=-1/0;for(let t=0;t<e.length;t+=1){let i=e[t];!i||i.width===0&&i.height===0||(i.top<n&&(n=i.top),i.bottom>r&&(r=i.bottom))}return!Number.isFinite(n)||r<=n?t:Math.max(t,r-n)},Dn=e=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`line`)),On=(e,t,n)=>{e.style.height=`${t}px`,e.style.lineHeight=`${n}px`},kn=(e,t,n)=>{let r=document.createRange();r.setStart(e.node,e.offset),r.setEnd(t.node,t.offset);let i=Math.max(En(r.getClientRects(),n),En([r.getBoundingClientRect()],n));return r.detach(),i},An=e=>{let t=e.querySelectorAll(`[data-component="markdown-code"]`);for(let e of Array.from(t)){let t=e.querySelector(`pre code`),n=e.querySelector(`[data-md-code-line-numbers]`);if(!t||!n)continue;let r=Array.from(n.children),i=window.getComputedStyle(t),a=Number.parseFloat(i.lineHeight)||20;n.style.fontFamily=i.fontFamily,n.style.fontSize=i.fontSize,n.style.lineHeight=`${a}px`;let o=Dn(t);if(o.length===r.length){let e=o.map(e=>e.getBoundingClientRect()),t=e=>(e?.textContent??``).length===0;for(let n=0;n<r.length;n+=1){let i=r[n],s=o[n],c=e[n];if(!i||!s||!c)continue;if(t(s)){On(i,a,a);continue}let l=o[n+1],u=e[n+1],d=u&&!t(l)?u.top:c.bottom;On(i,En([{top:c.top,bottom:d,width:1,height:d-c.top}],a),a)}continue}let s=t.textContent??``,c=wn(t),l=0;for(let e=0;e<r.length;e+=1){let t=s.indexOf(`
|
|
7
|
-
`,l),n=t===-1?s.length:t,i=r[e];if(!i)continue;let o=Tn(c,l),u=Tn(c,n);!o||!u||l===n?On(i,a,a):On(i,kn(o,u,a),a),l=n+1}}},jn=e=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>An(e))})},Mn=(e,t,n)=>{let r=e.querySelectorAll(`[data-component="markdown-code"]`);for(let e of Array.from(r)){let r=e.querySelector(`[data-md-code-body]`),i=e.querySelector(`pre`);r&&i&&!r.querySelector(`[data-md-code-line-numbers]`)&&(r.classList.add(`flex`,`gap-3`),r.insertBefore(Cn(i),i)),Sn(e,t,n)}jn(e)},Nn=(e,t,n,r)=>{xn(e,yn.check),e.setAttribute(`title`,t),e.setAttribute(`aria-label`,t),window.setTimeout(()=>{xn(e,yn[n]),e.setAttribute(`title`,r),e.setAttribute(`aria-label`,r)},2e3)},Pn=e=>{let t=e.querySelectorAll(`:not(pre) > code`);for(let e of Array.from(t))e.getAttribute(`data-markdown`)!==`inline-code`&&e.setAttribute(`data-markdown`,`inline-code`)},Fn=(e,t)=>{let n=e.querySelectorAll(`pre`);for(let e of Array.from(n)){if(e.querySelector(`code.language-mermaid`))continue;let n=e.parentElement;if(!n||n.closest(`[data-component="markdown-code"]`))continue;let r=e.querySelector(`code`)?.className.match(/language-([^\s"]+)/)?.[1],i=e.getAttribute(`data-md-label`)??e.getAttribute(`data-md-lang`)??Fe(r).label,a=document.createElement(`div`);a.setAttribute(`data-component`,`markdown-code`),a.className=`my-4 group overflow-hidden rounded-2xl border border-border/80 bg-[var(--surface-elevated)]`;let o=document.createElement(`div`);o.className=`flex items-center justify-between border-b border-border/70 px-3 py-1.5`;let s=document.createElement(`span`);s.className=`font-mono text-[13px] text-muted-foreground`,s.textContent=i;let c=Z(`copy`,t.labels.copy,`copy-code`),l=Z(`textWrap`,t.codeBlockLineWrap?t.labels.disableCodeWrap:t.labels.enableCodeWrap,`toggle-code-wrap`);o.appendChild(s);let u=document.createElement(`div`);u.className=`flex items-center gap-1`,u.appendChild(l),u.appendChild(c),o.appendChild(u);let d=document.createElement(`div`);d.setAttribute(`data-md-code-body`,``),d.className=`px-3 py-2.5 overflow-x-auto`,n.replaceChild(a,e),e.style.margin=`0`,e.style.background=`transparent`,e.classList.add(`min-w-0`,`w-full`,`flex-1`),d.appendChild(e),a.appendChild(o),a.appendChild(d),Sn(a,t.codeBlockLineWrap,t.labels)}},In=e=>{let t=e.querySelectorAll(`table`);for(let e of Array.from(t)){if(e.closest(`[data-markdown="table-wrapper"]`))continue;let t=document.createElement(`div`);t.className=`my-4`,t.setAttribute(`data-markdown`,`table-wrapper`);let n=document.createElement(`div`);n.setAttribute(`data-markdown`,`table-scroll`);let r=e.parentElement;if(r){r.replaceChild(t,e),e.setAttribute(`data-markdown`,`table`);for(let t of Array.from(e.querySelectorAll(`tr`)))t.setAttribute(`data-markdown`,`table-row`);for(let t of Array.from(e.querySelectorAll(`th`)))t.setAttribute(`data-markdown`,`table-header-cell`);for(let t of Array.from(e.querySelectorAll(`td`)))t.setAttribute(`data-markdown`,`table-cell`);n.appendChild(e),t.appendChild(n)}}},Ln=(e,t)=>{let n=e.querySelectorAll(`pre > code.language-mermaid`);for(let e of Array.from(n)){let n=e.parentElement;if(!n)continue;let r=(e.textContent??``).replace(/\s+$/,``),i=t.renderMermaid(r),a=document.createElement(`div`);a.setAttribute(`data-markdown`,`mermaid-block`),a.setAttribute(`data-md-source`,r),a.className=`group relative`;let o=document.createElement(`div`);o.setAttribute(`data-markdown`,`mermaid-scroll`);let s=document.createElement(`div`);if(s.setAttribute(`data-markdown`,`mermaid-toolbar`),s.className=`absolute top-1 right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,i.svg){a.setAttribute(`data-mermaid-render`,`svg`);let e=document.createElement(`div`);e.setAttribute(`data-markdown`,`mermaid-viewport`);let n=document.createElement(`div`);if(n.setAttribute(`data-markdown`,`mermaid`),n.setAttribute(`data-md-original-svg`,i.svg),n.innerHTML=i.svg,e.appendChild(n),o.appendChild(e),t.mermaidControls.showPanZoomControls&&(s.appendChild(Z(`zoomIn`,t.labels.zoomInDiagram,`mermaid-zoom-in`)),s.appendChild(Z(`zoomOut`,t.labels.zoomOutDiagram,`mermaid-zoom-out`)),s.appendChild(Z(`fit`,t.labels.resetDiagramView,`mermaid-fit`))),t.mermaidControls.copy){let e=Z(`copy`,t.labels.copyDiagram,`mermaid-copy`);e.setAttribute(`data-md-source`,r),s.appendChild(e)}if(t.mermaidControls.download){let e=Z(`download`,t.labels.downloadDiagram,`mermaid-download`);e.setAttribute(`data-md-svg`,`1`),s.appendChild(e)}}else{a.setAttribute(`data-mermaid-render`,`ascii`);let e=document.createElement(`pre`);if(e.setAttribute(`data-markdown`,`mermaid-ascii`),e.textContent=i.ascii||r,o.appendChild(e),t.mermaidControls.copy){let e=Z(`copy`,t.labels.copyDiagram,`mermaid-copy`);e.setAttribute(`data-md-source`,i.ascii||r),s.appendChild(e)}}a.appendChild(o),a.appendChild(s);let c=n.parentElement;c&&c.replaceChild(a,n)}},Rn=(e,t)=>{let n=e.querySelectorAll(`a[href]`);for(let e of Array.from(n)){if(e.getAttribute(`data-md-link-decorated`)===`true`||e.getAttribute(`data-openchamber-file-link`)===`true`)continue;let n=e.getAttribute(`href`)??``;if(!k(n))continue;e.setAttribute(`data-md-link-decorated`,`true`);let r=O(n);if(r){let t=document.createElement(`span`);t.className=`mr-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle`;let n=document.createElement(`img`);n.setAttribute(`data-md-link-favicon`,`true`),n.src=r,n.alt=``,n.setAttribute(`aria-hidden`,`true`),n.loading=`lazy`,n.decoding=`async`,n.className=`size-3.5 rounded-sm`,n.addEventListener(`error`,()=>t.remove(),{once:!0}),t.appendChild(n),e.parentNode?.insertBefore(t,e)}if(t.onPreviewLoopback&&D(n)){let r=document.createElement(`button`);r.type=`button`,r.className=`ml-1 align-middle ${bn}`,r.setAttribute(`data-md-action`,`preview-loopback`),r.setAttribute(`data-md-url`,n),r.setAttribute(`title`,t.labels.previewTitle),r.setAttribute(`aria-label`,t.labels.previewLabel),xn(r,yn.download),e.parentNode?.insertBefore(r,e.nextSibling)}}},zn=`img:not([data-md-link-favicon="true"])`,Bn=`[data-md-image-presentation="true"]`,Vn=`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="576" height="324" viewBox="0 0 576 324"%3E%3C/svg%3E`,Hn=[`block`,`max-w-full`,`rounded-xl`,`border`,`border-border/80`,`bg-[var(--surface-muted)]`,`transition-colors`,`focus-visible:outline`,`focus-visible:outline-2`,`focus-visible:outline-offset-2`,`focus-visible:outline-[var(--interactive-focus-ring)]`],Un=[`cursor-pointer`,`hover:bg-interactive-hover/60`],Wn=[`aspect-video`,`h-auto`,`w-full`,`max-w-xl`,`object-contain`],Gn=e=>{let t=e.parentElement;if(t?.matches(Bn))return t;let n=document.createElement(`span`);n.setAttribute(`data-md-image-presentation`,`true`),n.className=`relative my-4 block w-fit max-w-full`;let r=document.createElement(`span`);r.setAttribute(`data-md-image-placeholder-visual`,`true`),r.setAttribute(`aria-hidden`,`true`),r.className=`pointer-events-none absolute inset-0 flex items-center justify-center text-muted-foreground`;let i=document.createElement(`span`);i.className=`relative flex size-14 items-center justify-center rounded-2xl border border-border/80 bg-[var(--surface-elevated)] shadow-sm`,xn(i,yn.image);let a=document.createElement(`span`);a.setAttribute(`data-md-image-download-badge`,`true`),a.className=`absolute -right-1.5 -bottom-1.5 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] text-foreground shadow-sm`,xn(a,yn.imageDownload);let o=document.createElement(`span`);return o.setAttribute(`data-md-image-loading-badge`,`true`),o.className=`absolute -right-1.5 -bottom-1.5 hidden size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] text-foreground shadow-sm`,xn(o,yn.imageLoading),i.appendChild(a),i.appendChild(o),r.appendChild(i),t?.replaceChild(n,e),n.appendChild(e),n.appendChild(r),n},Kn=e=>{e.src=Vn,e.setAttribute(`data-md-placeholder-source`,Vn),e.setAttribute(`data-md-image-state`,`placeholder`),e.classList.add(...Wn)},qn=e=>{e.removeAttribute(`data-md-image-state`),e.removeAttribute(`data-md-placeholder-source`),e.removeAttribute(`aria-busy`),e.classList.remove(...Wn)},Jn=(e,t)=>{if(!t.imagePreviewEnabled)return;let n=e.querySelectorAll(zn);for(let e of Array.from(n)){let n=e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,r=_(n,t.imageEffectiveDirectory);x(r)&&(e.classList.add(...Hn,...Un),e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-md-image-source`,n),Gn(e),Kn(e))}},Yn=(e,t)=>{Pn(e),Ln(e,t),Fn(e,t),In(e),Rn(e,t),Jn(e,t),W(e)},Xn=(e,t,n)=>{let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},Zn=(e,t)=>{let n=e=>{let n=e.target;if(!(n instanceof Element))return;let r=n.closest(`[data-md-action]`);if(!r)return;let i=r.getAttribute(`data-md-action`)??``;if(i===`copy-code`){let e=r.closest(`[data-component="markdown-code"]`)?.querySelector(`code`)?.textContent??``;e&&p(e).then(()=>Nn(r,t.labels.copied,`copy`,t.labels.copy));return}if(i===`toggle-code-wrap`){e.preventDefault(),t.onToggleCodeBlockLineWrap?.();return}if(i===`mermaid-copy`){let e=r.getAttribute(`data-md-source`)??``;e&&p(e).then(()=>Nn(r,t.labels.copied,`copy`,t.labels.copyDiagram));return}if(i===`mermaid-zoom-in`||i===`mermaid-zoom-out`||i===`mermaid-fit`){e.preventDefault();let t=un(r.closest(`[data-markdown="mermaid-block"]`));i===`mermaid-zoom-in`?t?.zoomIn():i===`mermaid-zoom-out`?t?.zoomOut():t?.fit();return}if(i===`mermaid-download`){let e=r.closest(`[data-markdown="mermaid-block"]`)?.querySelector(`[data-markdown="mermaid"]`),t=e?.getAttribute(`data-md-original-svg`)??e?.innerHTML??``;t&&Xn(`diagram.svg`,t,`image/svg+xml;charset=utf-8`);return}if(i===`preview-loopback`){e.preventDefault();let n=r.getAttribute(`data-md-url`)??``;n&&t.onPreviewLoopback?.(n);return}};return e.addEventListener(`click`,n),()=>e.removeEventListener(`click`,n)},Q=i(),Qn=()=>{let e=(0,_e.c)(4),t=g(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=y(!1),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=y(!0),e[1]=i):i=e[1];let a=i,o;return e[2]===t?.currentTheme?o=e[3]:(o=t?.currentTheme??(typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?a:r),e[2]=t?.currentTheme,e[3]=o),o},$n=e=>{let t=(0,_e.c)(2),{containerRef:n,enabled:r}=e,i;t[0]===r?i=t[1]:(i=e=>{if(r===!1||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;let t=e.target;if(!(t instanceof Element)||t.closest($))return;let n=t.closest(`a[href]`);if(!(n instanceof HTMLAnchorElement)||n.getAttribute(`data-openchamber-file-link`)===`true`)return;let i=n.getAttribute(`href`)??``;k(i)&&(e.preventDefault(),e.stopPropagation(),E(i))},t[0]=r,t[1]=i);let a=l(i);u(`click`,a,n)},$=`img:not([data-md-link-favicon="true"])`,er=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,tr=({containerRef:e,effectiveDirectory:n,onShowPopup:r})=>{let i=G.useRef(null);i.current??=t();let a=i.current,o=!!r,s=l(e=>r?.(e)),c=G.useRef(()=>{}),u=G.useRef(new Map),d=G.useRef(null),f=G.useMemo(()=>e=>c.current(e),[]);return G.useLayoutEffect(()=>{let t=u.current;if(d.current!==null&&(clearTimeout(d.current),d.current=null),c.current=()=>{},!o){for(let[e,n]of t)n.controller?.abort(),n.objectUrl&&C(n.objectUrl),t.delete(e);return}let r=e.current;if(!r)return;let i=e=>{let t=Array.from(r.querySelectorAll($));if(t.indexOf(e)<0)return;let n=t.map(e=>({url:er(e),filename:e.alt||er(e)||void 0})).filter(e=>e.url),i=er(e),a=n.findIndex(e=>e.url===i),o=e.alt||i;s({open:!0,title:o,content:``,metadata:{tool:`image-preview`,filename:o},image:{url:i,filename:o,gallery:n,index:Math.max(0,a)}})},l=e=>{let n=t.get(e);n&&(n.controller?.abort(),n.objectUrl&&C(n.objectUrl),t.delete(e))},f=e=>{let t=er(e),r=_(t,n);if(x(r))return`${a}\n${n}\n${t}`},p=e=>{let n=f(e);if(!n){l(e);return}let r=t.get(e);if(r?.key===n)return r;l(e);let i={key:n};return t.set(e,i),i},m=(e,i)=>{if(i.controller||i.objectUrl||!r.contains(e))return;let a=er(e),o=_(a,n);if(!x(o)){l(e);return}let s=new AbortController;i.controller=s,e.setAttribute(`data-md-image-state`,`loading`),e.setAttribute(`aria-busy`,`true`),S(o.path,s.signal).then(n=>{let r=t.get(e);if(!r||r!==i||r.controller!==s||s.signal.aborted){C(n);return}r.controller=void 0,r.objectUrl=n,qn(e),e.setAttribute(`data-md-image-state`,`loaded`),e.src=n}).catch(()=>{let n=t.get(e);n===i&&(n.controller=void 0,e.removeAttribute(`aria-busy`),e.setAttribute(`data-md-image-state`,`placeholder`))})};c.current=e=>{for(let[n,r]of t)(!e.contains(n)||f(n)!==r.key)&&l(n);for(let t of Array.from(e.querySelectorAll($))){let e=p(t);e&&!e.objectUrl&&m(t,e)}},c.current(r);let h=e=>{let t=p(e);if(t&&!t.objectUrl){m(e,t);return}i(e)},g=e=>{let t=er(e);t&&v({sourceUrl:t,displayUrl:e.currentSrc||e.src||void 0,filename:e.alt||t,effectiveDirectory:n})},y=F(),b=e=>er(e)||e.src||`markdown-image`,w=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest($);if(n){if(y.consumeClick(b(n))){e.preventDefault(),e.stopPropagation();return}e.preventDefault(),e.stopPropagation(),h(n)}},T=e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLImageElement)||!t.matches($)||(e.preventDefault(),e.stopPropagation(),h(t))},E=e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest($);n&&y.start({pointerId:e.pointerId,key:b(n),clientX:e.clientX,clientY:e.clientY,onTrigger:()=>g(n)})},D=e=>{y.move(e.pointerId,e.clientX,e.clientY)},O=e=>{y.end(e.pointerId)},k=e=>{y.cancel(e.pointerId)},A=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest($);n&&(e.preventDefault(),e.stopPropagation(),y.openFromContextMenu(b(n),()=>g(n)))};return r.addEventListener(`click`,w),r.addEventListener(`keydown`,T),r.addEventListener(`pointerdown`,E),r.addEventListener(`pointermove`,D),r.addEventListener(`pointerup`,O),r.addEventListener(`pointercancel`,k),r.addEventListener(`contextmenu`,A),()=>{c.current=()=>{},y.reset(),r.removeEventListener(`click`,w),r.removeEventListener(`keydown`,T),r.removeEventListener(`pointerdown`,E),r.removeEventListener(`pointermove`,D),r.removeEventListener(`pointerup`,O),r.removeEventListener(`pointercancel`,k),r.removeEventListener(`contextmenu`,A),d.current=setTimeout(()=>{d.current=null;for(let e of Array.from(t.keys()))r.contains(e)&&Kn(e),l(e)},0)}},[e,n,o,a]),{reconcileMarkdownImageResources:f,transportIdentity:a}},nr={download:!0,copy:!0,showPanZoomControls:!0},rr=!0,ir=e=>{let t=e.match(/^(?:\uFEFF)?(---|\+\+\+)[^\S\r\n]*\r?\n[\s\S]*?\r?\n\1[^\S\r\n]*(?:\r?\n|$)/);return t?e.slice(t[0].length):e},ar=160,or=e=>{let t=(0,_e.c)(8),{containerRef:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,enabled:s}=e,c=G.useRef(null),l,u;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==s||t[4]!==o||t[5]!==a?(l=()=>{let e=n.current;if(!e)return;let t=!1,l=m(),u=me(),d=s,f=Er,p=()=>{let t=e.querySelectorAll(U);for(let e of Array.from(t))f(e)};if(!d){p();return}let h=e=>{let n=e===void 0?0:e;if(c.current!==null&&typeof window<`u`&&window.clearTimeout(c.current),typeof window>`u`){g();return}c.current=window.setTimeout(()=>{c.current=null,window.requestAnimationFrame(()=>{t||g()})},n)},g=()=>{let n=e.querySelectorAll(`[data-markdown="inline-code"], a, ${fe}`),i=0;for(let a of Array.from(n)){let n=pe(a),o=de(n,r);if(!o){f(a);continue}if(i>=u){f(a);continue}i+=1,(a.getAttribute(`data-openchamber-file-link`)!==`true`||a.getAttribute(`data-openchamber-file-path`)!==o.resolvedPath)&&he(o.resolvedPath,r).then(n=>{if(t||!e.contains(a))return;let i=pe(a),s=de(i,r);if(!(!s||s.resolvedPath!==o.resolvedPath)){if(!le(s.resolvedPath,n,l)){f(a);return}a.setAttribute(`data-openchamber-file-link`,`true`),a.setAttribute(`data-openchamber-file-ref`,i),a.setAttribute(`data-openchamber-file-path`,s.resolvedPath),a.setAttribute(`data-openchamber-file-binary`,String(n.isBinary)),a.setAttribute(`title`,ge),a.tagName.toLowerCase()!==`a`&&(a.setAttribute(`role`,`button`),a.setAttribute(`tabindex`,`0`))}})}},_=e=>ce(e,{effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o}),v=e=>{let t=e.target;if(!(t instanceof Element)||t.closest($))return;let n=t.closest(U);n instanceof HTMLElement&&(e.preventDefault(),e.stopPropagation(),_(n))},y=e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLElement)||t.getAttribute(`data-openchamber-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),_(t))};h(ar);let b=new MutationObserver(()=>{h(ar)});return b.observe(e,{childList:!0,subtree:!0}),e.addEventListener(`click`,v),e.addEventListener(`keydown`,y),()=>{t=!0,c.current!==null&&typeof window<`u`&&window.clearTimeout(c.current),c.current=null,b.disconnect(),e.removeEventListener(`click`,v),e.removeEventListener(`keydown`,y)}},u=[n,i,r,o,a,s],t[0]=n,t[1]=i,t[2]=r,t[3]=s,t[4]=o,t[5]=a,t[6]=l,t[7]=u):(l=t[6],u=t[7]),G.useEffect(l,u)},sr=({containerRef:e,onShowPopup:t,enableFullscreen:n,enablePanZoom:r,allowMermaidWheelEvents:i})=>{let a=l(e=>t?.(e)),o=!!t,s=l(t=>{if(!n||!o)return;let r=e.current;if(!r)return;let i=t.target;if(!(i instanceof Element)||i.closest(`button, a, [role="button"]`))return;let s=i.closest(Yt);if(!s)return;if(s instanceof HTMLElement&&s.hasAttribute(`data-mermaid-suppress-click`)){s.removeAttribute(`data-mermaid-suppress-click`);return}let c=Array.from(r.querySelectorAll(Yt)).indexOf(s);if(c<0)return;let l=s instanceof HTMLElement?s.getAttribute(`data-md-source`):null;if(!l||l.trim().length===0)return;let u=`Diagram ${c+1}`;a({open:!0,title:u,content:``,metadata:{tool:`mermaid-preview`,filename:u},mermaid:{url:`data:text/plain;charset=utf-8,${encodeURIComponent(l)}`,source:l,filename:u}})}),c=l(e=>{if(i||r)return;let t=e.target;t instanceof Element&&t.closest(`[data-markdown="mermaid-block"]`)&&e.stopPropagation()});u(`click`,s,e),G.useEffect(()=>{let t=e.current;if(t)return t.addEventListener(`wheel`,c,{capture:!0,passive:!0}),()=>{t.removeEventListener(`wheel`,c,!0)}},[e])},cr=24,lr=1,ur=12,dr=/[\s.,!?;:)\]]/,fr=(e,t)=>{let n=e<=12?2:e<=48?4:e<=96?8:Math.min(24,Math.ceil(e/8));return Math.max(1,Math.round(t/cr*n))},pr=(e,t)=>fr(e,t)*(1e3/t),mr=(e,t,n)=>{let r=Math.min(e.length,t+n);for(let t=r;t<Math.min(e.length,r+8);t+=1)if(dr.test(e[t]??``))return t+1;return r},hr=(e,t,n)=>{let[r,i]=G.useState(()=>t?0:e.length),a=G.useRef(r),o=G.useRef(0),s=G.useRef(null);return a.current=r,G.useEffect(()=>{if(!t||typeof window>`u`){o.current=0,s.current=null,i(e.length);return}a.current>e.length&&(a.current=e.length,o.current=0,i(e.length));let r=null,c=t=>{let l=Math.min(a.current,e.length);if(l>=e.length){r=null,s.current=null;return}let u=s.current;if(u===null){s.current=t,r=window.requestAnimationFrame(c);return}let d=Math.min(t-u,100);s.current=t,o.current+=pr(e.length-l,n)*(d/1e3);let f=Math.min(ur,Math.floor(o.current));if(f>=lr){o.current-=f;let t=mr(e,l,f);a.current=t,i(t)}r=window.requestAnimationFrame(c)};return a.current<e.length&&(r=window.requestAnimationFrame(c)),()=>{r!==null&&window.cancelAnimationFrame(r)}},[e,t,n]),t?e.slice(0,Math.min(r,e.length)):e},gr=new A({maxEntries:100,maxBytes:8388608}),_r=(e,t)=>{let n=gr.get(e);if(n)return n;let r=t(),i=((r.svg?.length??0)+(r.ascii?.length??0))*2;return gr.set(e,r,e.length*2+i),r},vr=e=>({bg:e.colors.surface.elevated,fg:e.colors.surface.foreground,line:e.colors.interactive.border,accent:e.colors.primary.base,muted:e.colors.surface.mutedForeground,surface:e.colors.surface.muted,border:e.colors.interactive.border,transparent:!0,font:`system-ui, sans-serif`}),yr=(e,r,i,a=nr,o=t(),s=``,c=!1)=>{let{t:u}=f(),d=G.useMemo(()=>({copy:u(`markdownRenderer.code.actions.copyTitle`),copied:u(`markdownRenderer.code.actions.copiedTitle`),enableCodeWrap:u(`markdownRenderer.code.actions.enableWrapTitle`),disableCodeWrap:u(`markdownRenderer.code.actions.disableWrapTitle`),copyDiagram:u(`markdownRenderer.mermaid.actions.copySourceTitle`),downloadDiagram:u(`markdownRenderer.mermaid.actions.downloadSvgTitle`),zoomInDiagram:u(`markdownRenderer.mermaid.actions.zoomInTitle`),zoomOutDiagram:u(`markdownRenderer.mermaid.actions.zoomOutTitle`),resetDiagramView:u(`markdownRenderer.mermaid.actions.resetViewTitle`),previewLabel:u(`terminalView.preview.open`),previewTitle:u(`terminalView.preview.openTitle`)}),[u]),p=n(e=>e.codeBlockLineWrap),m=n(e=>e.setCodeBlockLineWrap),h=l(()=>{m(!n.getState().codeBlockLineWrap)});return G.useMemo(()=>{let t=vr(e),l=n.getState().mermaidRenderingMode,u=e.metadata?.id??`theme`;return{labels:d,mermaidControls:a,codeBlockLineWrap:p,deferCodeLineNumberSync:r,onToggleCodeBlockLineWrap:h,renderMermaid:e=>_r(`${u}:${l}:${e}`,()=>{try{return l===`ascii`?{ascii:z(e)}:{svg:R(e,t)}}catch{return{}}}),onPreviewLoopback:i,imageTransportIdentity:o,imageEffectiveDirectory:s,imagePreviewEnabled:c}},[e,d,a,p,r,i,o,s,c])},br=({containerRef:e,text:t,streaming:n,cacheKey:r,syntaxVars:i,ctx:a,reconcileMarkdownImageResources:o,onRichContentReady:s})=>{G.useEffect(()=>{w()},[]);let c=G.useRef(null),u=l(()=>{s?.()}),f=l(()=>{let t=e.current;if(t){if(!c.current){if(!Xt(t))return;c.current=vn(t);return}c.current.refresh()}});G.useLayoutEffect(()=>{let r=e.current,i=r?.querySelector(`[data-markdown-content]`)??r;if(i&&t&&i.childNodes.length===0){for(let e of jt(t)){let t=document.createElement(`div`);t.setAttribute(`data-md-block`,``),t.style.display=`contents`,t.innerHTML=e,Yn(t,a),i.appendChild(t)}o(i),n||u()}},[e,a,o,n,t]),G.useEffect(()=>()=>{c.current?.cleanup(),c.current=null},[]),G.useEffect(()=>{let i=e.current;if(!i)return;let s=i.querySelector(`[data-markdown-content]`)??i,c=!0,l=new AbortController,d=()=>{},p=()=>{},m=()=>{if(!c||n||l.signal.aborted)return;s.replaceChildren();let e=document.createElement(`div`);e.setAttribute(`data-md-block`,``),e.setAttribute(`data-md-render-fallback`,`text`),e.style.display=`contents`;let r=document.createElement(`span`);r.style.whiteSpace=`pre-wrap`,r.textContent=t,e.appendChild(r),s.appendChild(e),o(s),u()},h=e=>{if(!c)return;let t=Array.from(s.children);e.forEach((e,n)=>{let r=t[n];if(r||(r=document.createElement(`div`),r.setAttribute(`data-md-block`,``),r.style.display=`contents`,s.appendChild(r)),r.getAttribute(`data-md-id`)===e.id)return;let i=document.createElement(`div`);i.innerHTML=e.html,Yn(i,a);let o=Xt(r),c=Xt(i);L(r,i,{childrenOnly:!0,onBeforeElUpdated:(e,t)=>{if(Te(e,t))return!1;if(ue(e,t),e instanceof HTMLImageElement&&t instanceof HTMLImageElement){let n=e.getAttribute(`data-md-image-source`);if(n&&n===t.getAttribute(`data-md-image-source`)){let n=e.getAttribute(`src`);n===null?t.removeAttribute(`src`):t.setAttribute(`src`,n),t.className=e.className;for(let n of[`data-md-image-state`,`data-md-placeholder-source`,`aria-busy`]){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}}}return!e.isEqualNode(t)}}),r.setAttribute(`data-md-id`,e.id),(o||c||Xt(r))&&f()});let n=Xt(s),r=!1;for(let n=t.length-1;n>=e.length;--n){let e=t[n];e&&Xt(e)&&(r=!0),e?.remove()}(r||t.length>e.length&&n)&&f(),o(s),a.deferCodeLineNumberSync||Mn(s,a.codeBlockLineWrap,a.labels),ke(s,I,{signal:l.signal,priority:`visible`}),u()},g=e=>{try{h(e)}catch{m()}},_=()=>{Rt(t,n,r,l.signal).then(e=>{if(c){if(n){g(e);return}p=M(()=>g(e),{priority:`visible`})}}).catch(m)};return n?_():d=M(_,{priority:`visible`}),()=>{c=!1,l.abort(),d(),p()}},[e,t,n,r,a,o]),G.useEffect(()=>{let t=e.current;if(t)return Zn(t,a)},[e,a]),G.useEffect(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;if(n)for(let[e,t]of Object.entries(i))n.style.setProperty(e,t)},[e,i]),G.useEffect(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;n&&(a.deferCodeLineNumberSync||Mn(n,a.codeBlockLineWrap,a.labels))},[e,a.codeBlockLineWrap,a.deferCodeLineNumberSync,a.labels]);let p=G.useRef(null),m=l(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;n&&(p.current!==null&&window.cancelAnimationFrame(p.current),p.current=window.requestAnimationFrame(()=>{p.current=null,An(n)}))});d(e,m),G.useEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current)},[])},xr=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,Sr=e=>{let t=(0,_e.c)(4),[n,r]=G.useState(e),i=G.useRef(e),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{i.current||(i.current=!0,r(!0))},t[0]=a):a=t[0];let o=l(a),s;return t[1]!==o||t[2]!==n?(s=[n,o],t[1]=o,t[2]=n,t[3]=s):s=t[3],s},Cr=(e,t,n)=>{let r=G.useRef(n);r.current=n;let i=G.useRef(t);i.current=t;let a=l(e=>{if(!r.current)return;let t=e[0];if(!t)return;let n=t.borderBoxSize?.[0],a=n?n.blockSize:t.contentRect.height,o=n?n.inlineSize:t.contentRect.width;j(i.current,a,o)});d(e,a)},wr=G.memo(e=>{let t=(0,_e.c)(52),{content:r,part:i,messageId:a,isAnimated:s,skipFadeIn:c,className:u,isStreaming:d,disableStreamAnimation:f,variant:p,onShowPopup:m,enableFileReferences:g}=e,_=s===void 0||s,v=c!==void 0&&c,y=d!==void 0&&d,x=f!==void 0&&f,S=p===void 0?`assistant`:p,C=g===void 0||g,w=Qn(),{editor:E,runtime:D}=T(),O=G.useRef(null),k=te()??``,A=n(Dr),j;t[0]!==k||t[1]!==A?(j=e=>{k&&A(k,e)},t[0]=k,t[1]=A,t[2]=j):j=t[2];let ne=l(j),M=y&&!x,N;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(N=ie(o()),t[3]=N):N=t[3];let P=hr(r,M,N.markdownPaceMs),[F,oe]=Sr(M),I;t[4]===m?I=t[5]:(I={containerRef:O,onShowPopup:m,enableFullscreen:rr,enablePanZoom:nr.showPanZoomControls},t[4]=m,t[5]=I),sr(I);let se=C&&!y,L;t[6]!==E||t[7]!==k||t[8]!==m||t[9]!==D.isVSCode||t[10]!==se?(L={containerRef:O,effectiveDirectory:k,editor:E,preferRuntimeEditor:D.isVSCode,onShowPopup:m,enabled:se},t[6]=E,t[7]=k,t[8]=m,t[9]=D.isVSCode,t[10]=se,t[11]=L):L=t[11],or(L);let R;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(R={containerRef:O},t[12]=R):R=t[12],$n(R);let z;t[13]!==k||t[14]!==m?(z={containerRef:O,effectiveDirectory:k,onShowPopup:m},t[13]=k,t[14]=m,t[15]=z):z=t[15];let{reconcileMarkdownImageResources:B,transportIdentity:V}=tr(z),H;t[16]===w?H=t[17]:(H=b(w),t[16]=w,t[17]=H);let ce=H,le=yr(w,M,k?ne:void 0,nr,V,k,!!m),U=`markdown-${i?.id?`part-${i.id}`:`message-${a}`}`,ue;t[18]!==U||t[19]!==le||t[20]!==M||t[21]!==P||t[22]!==B||t[23]!==oe||t[24]!==ce?(ue={containerRef:O,text:P,streaming:M,cacheKey:U,syntaxVars:ce,ctx:le,reconcileMarkdownImageResources:B,onRichContentReady:oe},t[18]=U,t[19]=le,t[20]=M,t[21]=P,t[22]=B,t[23]=oe,t[24]=ce,t[25]=ue):ue=t[25],br(ue);let de;t[26]!==r||t[27]!==S?(de=ee(r,S),t[26]=r,t[27]=S,t[28]=de):de=t[28],Cr(O,de,F&&!M);let fe=!F||void 0,W;t[29]===u?W=t[30]:(W=h(`relative break-words w-full min-w-0`,u),t[29]=u,t[30]=W);let pe=F?`true`:`false`,me=F?`ready`:`pending`,he;t[31]!==P||t[32]!==F||t[33]!==S?(he=!F&&(0,Q.jsx)(`div`,{className:h(xr(S),`pointer-events-none absolute inset-0 overflow-hidden`),children:(0,Q.jsx)(ae,{content:P})}),t[31]=P,t[32]=F,t[33]=S,t[34]=he):he=t[34];let ge=!F||void 0,K;t[35]!==F||t[36]!==S?(K=h(xr(S),!F&&`invisible`),t[35]=F,t[36]=S,t[37]=K):K=t[37];let q;t[38]!==ge||t[39]!==K?(q=(0,Q.jsx)(`div`,{"aria-hidden":ge,className:K,"data-markdown-content":!0}),t[38]=ge,t[39]=K,t[40]=q):q=t[40];let ve;t[41]!==fe||t[42]!==W||t[43]!==pe||t[44]!==me||t[45]!==he||t[46]!==q?(ve=(0,Q.jsxs)(`div`,{"aria-busy":fe,className:W,"data-markdown-ready":pe,"data-markdown-hydration":me,ref:O,children:[he,q]}),t[41]=fe,t[42]=W,t[43]=pe,t[44]=me,t[45]=he,t[46]=q,t[47]=ve):ve=t[47];let ye=ve;if(_){let e;return t[48]!==U||t[49]!==ye||t[50]!==v?(e=(0,Q.jsx)(re,{skipAnimation:v,children:ye},U),t[48]=U,t[49]=ye,t[50]=v,t[51]=e):e=t[51],e}return ye},(e,t)=>e.content===t.content&&e.isStreaming===t.isStreaming&&e.disableStreamAnimation===t.disableStreamAnimation&&e.variant===t.variant&&e.isAnimated===t.isAnimated&&e.skipFadeIn===t.skipFadeIn&&e.className===t.className&&e.messageId===t.messageId&&e.onShowPopup===t.onShowPopup&&e.enableFileReferences===t.enableFileReferences&&e.part?.id===t.part?.id),Tr=G.memo(e=>{let t=(0,_e.c)(46),{content:n,className:r,variant:i,disableLinkSafety:a,stripFrontmatter:o,onShowPopup:s,mermaidControls:c,allowMermaidWheelEvents:l,enableFileReferences:u}=e,d=i===void 0?`assistant`:i,f=o!==void 0&&o,p=c===void 0?nr:c,m=l!==void 0&&l,g=u===void 0||u,{editor:_,runtime:v}=T(),y=Qn(),x=G.useRef(null),[S,C]=Sr(!1),w=te()??``,E;t[0]!==n||t[1]!==f?(E=f?ir(n):n,t[0]=n,t[1]=f,t[2]=E):E=t[2];let D=E,O;t[3]!==m||t[4]!==p.showPanZoomControls||t[5]!==s?(O={containerRef:x,onShowPopup:s,enableFullscreen:rr,enablePanZoom:p.showPanZoomControls,allowMermaidWheelEvents:m},t[3]=m,t[4]=p.showPanZoomControls,t[5]=s,t[6]=O):O=t[6],sr(O);let k;t[7]!==_||t[8]!==w||t[9]!==g||t[10]!==s||t[11]!==v.isVSCode?(k={containerRef:x,effectiveDirectory:w,editor:_,preferRuntimeEditor:v.isVSCode,onShowPopup:s,enabled:g},t[7]=_,t[8]=w,t[9]=g,t[10]=s,t[11]=v.isVSCode,t[12]=k):k=t[12],or(k);let A=!a,j;t[13]===A?j=t[14]:(j={containerRef:x,enabled:A},t[13]=A,t[14]=j),$n(j);let ee;t[15]!==w||t[16]!==s?(ee={containerRef:x,effectiveDirectory:w,onShowPopup:s},t[15]=w,t[16]=s,t[17]=ee):ee=t[17];let{reconcileMarkdownImageResources:ne,transportIdentity:M}=tr(ee),N;t[18]===y?N=t[19]:(N=b(y),t[18]=y,t[19]=N);let re=N,P=yr(y,!1,void 0,p,M,w,!!s),ie=`simple:${d}`,F;t[20]!==P||t[21]!==ne||t[22]!==D||t[23]!==C||t[24]!==re||t[25]!==ie?(F={containerRef:x,text:D,streaming:!1,cacheKey:ie,syntaxVars:re,ctx:P,reconcileMarkdownImageResources:ne,onRichContentReady:C},t[20]=P,t[21]=ne,t[22]=D,t[23]=C,t[24]=re,t[25]=ie,t[26]=F):F=t[26],br(F);let oe=!S||void 0,I;t[27]===r?I=t[28]:(I=h(`relative break-words w-full min-w-0`,r),t[27]=r,t[28]=I);let se=S?`true`:`false`,L=S?`ready`:`pending`,R;t[29]!==D||t[30]!==S||t[31]!==d?(R=!S&&(0,Q.jsx)(`div`,{className:h(xr(d),`pointer-events-none absolute inset-0 overflow-hidden`),children:(0,Q.jsx)(ae,{content:D})}),t[29]=D,t[30]=S,t[31]=d,t[32]=R):R=t[32];let z=!S||void 0,B;t[33]!==S||t[34]!==d?(B=h(xr(d),!S&&`invisible`),t[33]=S,t[34]=d,t[35]=B):B=t[35];let V;t[36]!==z||t[37]!==B?(V=(0,Q.jsx)(`div`,{"aria-hidden":z,className:B,"data-markdown-content":!0}),t[36]=z,t[37]=B,t[38]=V):V=t[38];let H;return t[39]!==oe||t[40]!==I||t[41]!==se||t[42]!==L||t[43]!==R||t[44]!==V?(H=(0,Q.jsxs)(`div`,{"aria-busy":oe,className:I,"data-markdown-ready":se,"data-markdown-hydration":L,ref:x,children:[R,V]}),t[39]=oe,t[40]=I,t[41]=se,t[42]=L,t[43]=R,t[44]=V,t[45]=H):H=t[45],H},(e,t)=>{let n=e.mermaidControls??nr,r=t.mermaidControls??nr;return e.content===t.content&&e.variant===t.variant&&e.className===t.className&&e.disableLinkSafety===t.disableLinkSafety&&e.stripFrontmatter===t.stripFrontmatter&&e.onShowPopup===t.onShowPopup&&n.download===r.download&&n.copy===r.copy&&n.showPanZoomControls===r.showPanZoomControls&&e.allowMermaidWheelEvents===t.allowMermaidWheelEvents&&e.enableFileReferences===t.enableFileReferences});function Er(e){e.removeAttribute(`data-openchamber-file-link`),e.removeAttribute(`data-openchamber-file-ref`),e.removeAttribute(`data-openchamber-file-path`),e.removeAttribute(`data-openchamber-file-binary`),e.getAttribute(`title`)===`Open file`&&e.removeAttribute(`title`),e.tagName.toLowerCase()!==`a`&&(e.removeAttribute(`role`),e.removeAttribute(`tabindex`))}function Dr(e){return e.openContextPreview}export{wr as MarkdownRenderer,Tr as SimpleMarkdownRenderer};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-CowOCU5W.js","assets/rolldown-runtime-C0FnF6B9.js","assets/vendor-base-ui-CnHfUmDN.js","assets/vendor-react-DLPElpoQ.js","assets/vendor-markstream-react-C3K8YH0d.js","assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-markstream-react-CGQrpq8a.css","assets/vendor-reactuses-core-DDoDDyM9.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useMobileNavigationStore-CUGaydRW.js","assets/useUIStore-CqqO11ZI.js","assets/vendor-zustand-B4dlGEM2.js","assets/persistence-CSZp1CNB.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-CenlWqxu.js","assets/vendor-opencode-sdk-C07HQypa.js","assets/vendor-tanstack-react-query-D7pys_c9.js","assets/vendor-sonner-DVzioF3d.js","assets/clipboard-BXxLshVq.js","assets/store-BDFdnk6l.js","assets/useAssistantUIStore-BHacrxe_.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/utils-B0mQXN9L.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-DMzWVJaW.js","assets/useRuntimeAPIs-DSLXJybW.js","assets/url-CE_gAfNa.js","assets/markdownHeightCache-Bj707yG-.js","assets/useEffectiveDirectory-CBd5vt8N.js","assets/fileReferenceActions-3pPDAJSl.js","assets/path-utils-jGozTg9d.js","assets/outsideFileGrants-BB4GPvCq.js","assets/MarkstreamRendererImpl-Ca7RATbs.css","assets/MarkdownRendererImpl-C6rkoZYH.js","assets/vendor-katex--B5dHUyk.js","assets/markdownTheme-CVS01wHf.js","assets/vendor-pierre-diffs-DX7XTPG3.js","assets/vendor-hast-util-to-html-B0p1k5Xa.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-DpDied8H.js","assets/FadeInOnReveal-BWJcUp5P.js","assets/markdown-worker-wEFz5Hm_.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-beautiful-mermaid-DykqIK5D.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t}from"./vendor-zustand-B4dlGEM2.js";import{nt as n,rt as r}from"./vendor-base-ui-CnHfUmDN.js";import{n as i,t as a}from"./platform-CenlWqxu.js";import{a as o,n as s,o as c}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as l}from"./vendor-react-DLPElpoQ.js";import{r as u}from"./vendor-pierre-diffs-DX7XTPG3.js";import{n as d}from"./vendor-reactuses-core-DDoDDyM9.js";import{r as f}from"./useMobileNavigationStore-CUGaydRW.js";import{c as p,l as m}from"./dialog-BkhHBTd4.js";import{t as h}from"./utils-B0mQXN9L.js";import{n as ee,t as g}from"./markdownHeightCache-Bj707yG-.js";import{a as te}from"./markdown-worker-wEFz5Hm_.js";var _=e(r(),1),v=l(),y=`openchamber.iosNativeUi`,ne=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(y)===`1`}catch{return!1}},re=e=>{if(!(typeof window>`u`))try{e?window.localStorage.setItem(y,`1`):window.localStorage.removeItem(y)}catch{}},b=t(e=>({enabled:ne(),setEnabled:t=>{re(t),e({enabled:t})}})),ie=()=>b.getState().enabled,ae=()=>b(se),oe=()=>i()&&a()===`ios`;function se(e){return e.enabled}var ce=`oc-native-ios-composer`,x=`--oc-native-composer-height`,S=`--oc-native-composer-accessory`,le=33554432,C=`OpenChamberComposer`,w=`#22c55e`,T=32,ue=()=>({open:!1,highlightedIndex:0,rows:[]}),de=()=>({text:``,placeholder:``,modelLabel:``,modelVariantLabel:``,modelIcon:``,canSend:!1,canAbort:!1,attachmentCount:0,attachmentPreviews:[],citationRanges:[],chipRanges:[],appearance:`dark`,attachAria:``,attachTitle:``,attachPhotosLabel:``,attachFilesLabel:``,attachCancelLabel:``,sendAria:``,queueAria:``,stopAria:``,modelAria:``,agentAria:``,agentLabel:``,agentColor:w,agentIdenticon:Array.from({length:25},()=>0),suppressed:!0,showScrollToBottom:!1,scrollAria:``,autocomplete:ue()}),fe=o(C),pe=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.isMobile&&e.nativeUiEnabled!==!1;function me(e){return typeof window>`u`?!1:pe({isCapacitor:i(),platform:a(),pluginAvailable:s.isPluginAvailable(C),isMobile:e,nativeUiEnabled:ie()})}var he=e=>e.classList.contains(`dark`)?`dark`:`light`,ge=e=>{let t=e?.height;return typeof t!=`number`||!Number.isFinite(t)||t<0?0:t},_e=(e,t)=>{if(!(t>0)){e.style.removeProperty(x);return}e.style.setProperty(x,`${Math.round(t)}px`)},ve=(e,t)=>{if(!(t>0)){e.style.removeProperty(S);return}e.style.setProperty(S,`${Math.round(t)}px`)},E=(e,t)=>{e.classList.toggle(ce,t),t||(e.style.removeProperty(x),e.style.removeProperty(S))},ye=e=>p(e).flat().map(e=>+!!e),D=new Map,O=null,be=e=>{let t=D.get(e);if(t!==void 0)return t;if(typeof document>`u`||typeof getComputedStyle>`u`)return w;!O&&typeof MutationObserver<`u`&&(O=new MutationObserver(()=>{D.clear()}),O.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`]}));let n=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),r=document.createElement(`span`);r.style.color=n||`var(${e})`,document.documentElement.appendChild(r);let i=getComputedStyle(r).color;r.remove();let a=/rgba?\(\s*([\d.]+)(?:\s*,\s*|\s+)([\d.]+)(?:\s*,\s*|\s+)([\d.]+)/.exec(i);if(!a)return D.set(e,w),w;let o=e=>Math.max(0,Math.min(255,Math.round(Number(e)))).toString(16).padStart(2,`0`),s=`#${o(a[1])}${o(a[2])}${o(a[3])}`;return D.set(e,s),s},xe=e=>be(m(e).var),k=(e,t)=>e.text===t.text&&e.placeholder===t.placeholder&&e.modelLabel===t.modelLabel&&e.modelVariantLabel===t.modelVariantLabel&&e.modelIcon===t.modelIcon&&e.canSend===t.canSend&&e.canAbort===t.canAbort&&e.attachmentCount===t.attachmentCount&&Se(e.attachmentPreviews,t.attachmentPreviews)&&Ce(e.citationRanges,t.citationRanges)&&we(e.chipRanges,t.chipRanges)&&e.appearance===t.appearance&&e.attachAria===t.attachAria&&e.attachTitle===t.attachTitle&&e.attachPhotosLabel===t.attachPhotosLabel&&e.attachFilesLabel===t.attachFilesLabel&&e.attachCancelLabel===t.attachCancelLabel&&e.sendAria===t.sendAria&&e.queueAria===t.queueAria&&e.stopAria===t.stopAria&&e.modelAria===t.modelAria&&e.agentAria===t.agentAria&&e.agentLabel===t.agentLabel&&e.agentColor===t.agentColor&&e.agentIdenticon.join(``)===t.agentIdenticon.join(``)&&e.suppressed===t.suppressed&&e.showScrollToBottom===t.showScrollToBottom&&e.scrollAria===t.scrollAria&&A(e.autocomplete,t.autocomplete),A=(e,t)=>e.open===t.open&&e.highlightedIndex===t.highlightedIndex&&e.rows.length===t.rows.length&&e.rows.every((e,n)=>{let r=t.rows[n];return!!(r&&e.id===r.id&&e.title===r.title&&e.subtitle===r.subtitle&&e.badge===r.badge&&e.iconBase64===r.iconBase64)}),Se=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!(r&&e.id===r.id&&e.filename===r.filename&&e.mime===r.mime&&e.thumbnailBase64===r.thumbnailBase64&&e.removeAria===r.removeAria)}),Ce=(e,t)=>e.length===t.length&&e.every((e,n)=>e.start===t[n]?.start&&e.end===t[n]?.end),we=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!(r&&e.start===r.start&&e.end===r.end&&e.triggerLength===r.triggerLength&&e.color===r.color)}),Te=(e,t)=>{if(!e||!t||t.length===0)return[];let n=[],r=0;for(let e of t){let t=r;r+=e.text.length;let i=e.visual;if(!i)continue;let a=i.trigger.length;a<1||t+a>r||i.icon&&n.push({start:t,end:r,triggerLength:a,iconName:i.icon})}return n},Ee=(e,t)=>e.map(e=>({start:e.start,end:e.end,triggerLength:e.triggerLength,color:t})),De=e=>e.map(e=>`${e.id}:${e.filename}:${e.mimeType}:${e.dataUrl?.length??0}`).join(`|`),Oe=e=>{let t=e?.id;return typeof t==`string`&&t.trim()?t:``},j=e=>{if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return Math.floor(e);if(typeof e==`string`&&e.trim()){let t=Number(e);if(Number.isFinite(t)&&t>=0)return Math.floor(t)}return null},ke=e=>{let t=j(e?.selectionStart);if(t===null)return null;let n=j(e?.selectionEnd);return{start:t,end:n!==null&&n>=t?n:t}},Ae=e=>j(e?.index)??0,je=(e,t)=>{let n=Math.max(0,e);return typeof t!=`number`||!Number.isFinite(t)?n:Math.max(0,Math.min(Math.floor(t),n))},Me=e=>e.nextText===e.nativeOwnedText?{omitText:!0,forceText:!1}:e.nextText.length===0&&e.nativeOwnedText.length>0||e.preset?{omitText:!1,forceText:!0}:e.echoingNative?{omitText:!0,forceText:!1}:{omitText:!1,forceText:!0},Ne=e=>e.replacedText!==null&&e.incoming===e.replacedText,Pe=e=>setTimeout(e,0),Fe=e=>{e.applyDocument(e.text),Pe(e.submit)},M=(e,t)=>e===t,Ie=(e,t,n,r)=>{if(n.omitText&&e&&k(e,t))return null;let i={};if(n.omitText||(i.text=t.text,n.forceText&&(i.forceText=!0),n.forceText&&typeof r?.caret==`number`&&Number.isFinite(r.caret)&&(i.caret=Math.max(0,Math.floor(r.caret)))),!e){let{text:e,...n}=t;return Object.assign(i,n),i}let a=(n,r)=>{r(e[n],t[n])||(i[n]=t[n])};return a(`placeholder`,M),a(`modelLabel`,M),a(`modelVariantLabel`,M),a(`modelIcon`,M),a(`canSend`,M),a(`canAbort`,M),a(`attachmentCount`,M),a(`attachmentPreviews`,Se),a(`citationRanges`,Ce),a(`chipRanges`,we),a(`appearance`,M),a(`attachAria`,M),a(`attachTitle`,M),a(`attachPhotosLabel`,M),a(`attachFilesLabel`,M),a(`attachCancelLabel`,M),a(`sendAria`,M),a(`queueAria`,M),a(`stopAria`,M),a(`modelAria`,M),a(`agentAria`,M),a(`agentLabel`,M),a(`agentColor`,M),a(`agentIdenticon`,(e,t)=>e.join(``)===t.join(``)),a(`suppressed`,M),a(`showScrollToBottom`,M),a(`scrollAria`,M),a(`autocomplete`,A),Object.keys(i).length===0?null:i},Le=e=>{let t=Array.isArray(e?.skipped)?e.skipped:[],n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e.name;typeof t==`string`&&t.trim()&&n.push(t)}return n},Re=e=>{try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch{return null}},ze=(e,t=le)=>{let n=Array.isArray(e?.files)?e.files:[],r=[];for(let e of n){if(!e||typeof e!=`object`)continue;let n=e;if(typeof n.dataBase64!=`string`||n.dataBase64.length===0)continue;let i=Re(n.dataBase64);if(!i||i.byteLength===0||i.byteLength>t)continue;let a=typeof n.name==`string`&&n.name.trim()?n.name:`file`,o=typeof n.mime==`string`&&n.mime.trim()?n.mime:`application/octet-stream`;r.push(new File([new Uint8Array(i)],a,{type:o}))}return r},N=80,Be=e=>typeof document>`u`||!e||!e.startsWith(`data:image/`)?Promise.resolve(null):new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=document.createElement(`canvas`);e.width=N,e.height=N;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,N,N),r.drawImage(n,0,0,N,N);let i=e.toDataURL(`image/jpeg`,.72),a=i.indexOf(`,`);t(a>=0?i.slice(a+1):null)}catch{t(null)}},n.onerror=()=>t(null),n.src=e}),Ve=e=>typeof document>`u`||!e?Promise.resolve(null):new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=document.createElement(`canvas`);e.width=T,e.height=T;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,T,T),r.drawImage(n,0,0,T,T);let i=e.toDataURL(`image/png`),a=i.indexOf(`,`);t(a>=0?i.slice(a+1):null)}catch{t(null)}},n.onerror=()=>t(null),n.src=e}),He=()=>fe,P=((e=He)=>{let t=0,n=null,r=[],i=null,a=``,o=!1,s=!1,c=()=>{n!==null&&(clearTimeout(n),n=null)},l=(e,...t)=>{let n=i;n&&n[e](...t)},u=async()=>{if(r.length>0)return;let t=e(),n=await Promise.all([t.addListener(`textChanged`,e=>{let t=typeof e.text==`string`?e.text:``;a=t,l(`onText`,t,e.composing===!0,ke(e))}),t.addListener(`send`,e=>{let t=typeof e.text==`string`?e.text:a;a=t,l(`onSend`,t)}),t.addListener(`abort`,()=>{l(`onAbort`)}),t.addListener(`attach`,()=>{l(`onAttach`)}),t.addListener(`filesPicked`,t=>{l(`onFiles`,ze(t),Le(t)),e().focus()}),t.addListener(`removeAttachment`,e=>{let t=Oe(e);t&&l(`onRemoveAttachment`,t)}),t.addListener(`openModel`,()=>{l(`onOpenModel`)}),t.addListener(`cycleAgent`,()=>{l(`onCycleAgent`)}),t.addListener(`openAgent`,()=>{l(`onOpenAgent`)}),t.addListener(`heightChanged`,e=>{l(`onHeight`,ge(e))}),t.addListener(`scrollToBottom`,()=>{l(`onScrollToBottom`)}),t.addListener(`autocompleteAccept`,e=>{l(`onAutocompleteAccept`,Ae(e))}),t.addListener(`autocompleteDismiss`,()=>{l(`onAutocompleteDismiss`)})]);if(r.length>0){for(let e of n)e.remove();return}r=n},d=n=>{t>0||(i=null,o=!1,E(n,!1),e().dismiss())};return{bind(e){i=e},rememberText(e){a=e},rememberState(e){a=e.text},conceal(){o||t===0||(o=!0,e().hide())},reveal(){!o||t===0||(o=!1,e().show())},async warm(){s||t>0||(s=!0,await e().present(de()))},async retain(n,i){c(),t+=1,o=!1,s=!0,a=i.text,E(n,!0),r.length===0&&await u(),await e().present(i)},release(e){t=Math.max(0,t-1),!(t>0)&&(c(),n=setTimeout(()=>{n=null,d(e)},0))},shutdown(n=document.documentElement){c(),t=0,s=!1,o=!1,i=null,E(n,!1),e().dismiss()},snapshot(){return{retainCount:t,listenerCount:r.length,hidePending:n!==null,concealed:o,warmed:s}}}})(),Ue=()=>o(`OpenChamberNavigation`),We=e=>e?.kind===`chat`||e?.kind===`draft`,F=e=>e?e.kind===`draft`||e.kind===`chat`&&e.routes.length<=1:!1,Ge=(e,t)=>We(e)&&!We(t),Ke=(e=P)=>{F(f.getState().secondary)&&e.conceal()},qe=(e=P)=>{let t=f.subscribe((t,n)=>{Ge(n.secondary,t.secondary)&&e.conceal()}),n=[],r=!1;return s.getPlatform()===`ios`&&(async()=>{let t=Ue(),i=await t.addListener(`backStarted`,()=>{F(f.getState().secondary)&&e.conceal()}),a=await t.addListener(`backCancelled`,()=>{e.reveal()});if(r){i.remove(),a.remove();return}n=[i,a]})(),()=>{r=!0,t();for(let e of n)e.remove();n=[]}},I=`openchamber:chunk-import-reload`,Je=250,Ye=3e4,Xe=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function L(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function R(e){let t=L(e);return Xe.some(e=>e.test(t))}function Ze(e){return`1.19.7-beta.20:${L(e).slice(0,500)}`}function Qe(e){if(typeof window>`u`)return;let t=Date.now(),n=Ze(e),r=null;try{let e=window.sessionStorage.getItem(I);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<Ye)){try{window.sessionStorage.setItem(I,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:L(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function $e(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!R(e)||t>=n)break;await new Promise(e=>setTimeout(e,Je*(t+1)))}throw R(r)&&Qe(r),r}var z=e=>(0,_.lazy)(()=>$e(e)),B=`__openchamberMobileBackRoute`,et=()=>typeof window>`u`||i()?null:{currentState:()=>window.history.state&&typeof window.history.state==`object`?window.history.state:null,pushState:e=>window.history.pushState(e,``,window.location.href),back:()=>window.history.back(),subscribe:e=>{let t=t=>e(t.state&&typeof t.state==`object`?t.state:null);return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)}},V=e=>{let t=e?.[B];return typeof t==`number`&&Number.isFinite(t)?t:null},H=new class{routes=[];listeners=new Set;nextToken=1;history;removeHistoryListener=null;programmaticHistoryBackToken=null;pendingHistoryRemovals=new Map;animatedBackDriver=null;presentationCancelDriver=null;constructor(e=et()){this.history=e}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getTopRoute=()=>this.routes.at(-1)??null;register=e=>{let t=this.pendingHistoryRemovals.get(e.id);this.pendingHistoryRemovals.delete(e.id);let n=!!(this.history&&t!==void 0&&V(this.history.currentState())===t),r={...e,token:n&&t!==void 0?t:this.nextToken++};this.routes.push(r),this.ensureHistoryListener(),this.history&&!n&&this.history.pushState({...this.history.currentState()??{},[B]:r.token}),this.notify();let i=!0;return()=>{if(!i)return;i=!1;let e=this.routes.indexOf(r);e<0||(this.routes.splice(e,1),this.history&&V(this.history.currentState())===r.token?(this.pendingHistoryRemovals.set(r.id,r.token),queueMicrotask(()=>{if(this.pendingHistoryRemovals.get(r.id)===r.token){if(this.pendingHistoryRemovals.delete(r.id),!this.history||V(this.history.currentState())!==r.token){this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener();return}this.programmaticHistoryBackToken=r.token,this.history.back(),this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener()}})):this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener(),this.notify())}};backImmediately=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:t.onBack()!==!1};requestAnimatedBack=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:this.animatedBackDriver?.(t)?!0:this.backImmediately(e)};setAnimatedBackDriver=e=>(this.animatedBackDriver=e,()=>{this.animatedBackDriver===e&&(this.animatedBackDriver=null)});setPresentationCancelDriver=e=>(this.presentationCancelDriver=e,()=>{this.presentationCancelDriver===e&&(this.presentationCancelDriver=null)});cancelPresentation=()=>{this.presentationCancelDriver?.()};requestBrowserBack=()=>{let e=this.getTopRoute();return e?this.history&&V(this.history.currentState())===e.token?(this.history.back(),!0):e.onBack()!==!1:!1};ensureHistoryListener(){!this.history||this.removeHistoryListener||(this.removeHistoryListener=this.history.subscribe(e=>{if(this.programmaticHistoryBackToken!==null){this.programmaticHistoryBackToken=null;return}let t=this.getTopRoute();t&&V(e)!==t.token&&t.onBack()===!1&&this.history&&this.history.pushState({...this.history.currentState()??{},[B]:t.token})}))}disposeHistoryListener(){this.removeHistoryListener?.(),this.removeHistoryListener=null,this.programmaticHistoryBackToken=null,this.pendingHistoryRemovals.clear()}notify(){this.listeners.forEach(e=>e())}},tt=e=>{let t=(0,v.c)(8),{id:n,active:r,layer:i,onBack:a,surfaceRef:o,underlayRef:s}=e,c=i===void 0?`root`:i,l=d(a),u,f;t[0]!==r||t[1]!==l||t[2]!==n||t[3]!==c||t[4]!==o||t[5]!==s?(u=()=>{if(r)return H.register({id:n,layer:c,onBack:l,getSurface:()=>o.current,getUnderlay:()=>s?.current??null})},f=[r,l,n,c,o,s],t[0]=r,t[1]=l,t[2]=n,t[3]=c,t[4]=o,t[5]=s,t[6]=u,t[7]=f):(u=t[6],f=t[7]),_.useEffect(u,f)},U=o(`OpenChamberNavigation`),W=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),nt=(e,t)=>!e||!t?!1:e.onBack()!==!1,rt=e=>{let t=W(e.progress),n=e.commit?1-t:t;if(n<=.001)return 0;let r=Math.max(1,e.viewportWidth??390),i=Math.abs(e.velocityX??0)/r,a=n/Math.max(e.commit?2.4:2.8,i)*1e3,o=e.commit?90:100,s=e.commit?320:260;return Math.round(Math.min(s,Math.max(o,a)))},G=e=>{let{surface:t,underlay:n,surfaceTransition:r,surfaceAnimation:i,underlayTransition:a,underlayAnimation:o}=e;t.style.removeProperty(`transform`),t.style.removeProperty(`opacity`),t.style.removeProperty(`will-change`),t.style.removeProperty(`box-shadow`),t.style.transition=r,t.style.animation=i,n&&(n.style.removeProperty(`transform`),n.style.removeProperty(`opacity`),n.style.removeProperty(`will-change`),n.style.transition=a??``,n.style.animation=o??``)},K=(e,t)=>{let n=W(t),{surface:r}=e;r.style.transform=`translate3d(${n*100}%, 0, 0)`},it=e=>!e.surfaceConnected||e.topRouteToken!==e.routeToken||e.routeSurface!==e.outgoingSurface,at=async(e,t,n,r)=>{if(!r&&typeof e.animate==`function`){let r=e.style.transform||`translate3d(0%, 0, 0)`,i=`translate3d(${t}%, 0, 0)`,a=e.animate([{transform:r},{transform:i}],{duration:n,easing:`cubic-bezier(0.22, 1, 0.36, 1)`,fill:`forwards`}),o=!1;try{await a.finished,o=!0}catch{}finally{o&&(e.style.transform=i),a.cancel()}return}e.style.transform=`translate3d(${t}%, 0, 0)`},ot=async(e,t,n=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,r=rt({progress:Number.parseFloat(e.style.transform.match(/translate3d\(([-\d.]+)%/)?.[1]??`0`)/100,commit:t}))=>at(e,t?100:0,r,n),st=class{pending=0;enqueue(){this.pending+=1}take(){return this.pending!==0&&(--this.pending,!0)}clear(){this.pending=0}},ct=e=>{let t=(0,v.c)(4),{enabled:n,rootRoutesBlocked:r}=e,a,o;t[0]!==n||t[1]!==r?(a=()=>{if(!n||!i()||s.getPlatform()===`web`)return;let e=!1,t=null,a=null,o=0,c=0,l=0,u=new st,d=[],f=e=>!!e&&(!r||e?.layer===`overlay`),p=()=>{let e=f(H.getTopRoute());U.setEnabled({enabled:e}).catch(lt)},m=()=>{if(H.cancelPresentation(),a)return;let e=H.getTopRoute();if(!f(e))return;let n=e.getSurface();if(!n)return;n.getAnimations().forEach(ut),a=null;let r=e.layer===`root`?e.getUnderlay():null,i=n.style.transition,o=n.style.animation,s=r?.style.transition??null,c=r?.style.animation??null;r?.getAnimations().forEach(dt),n.style.transition=`none`,n.style.animation=`none`,n.style.willChange=`transform`,r&&(r.style.removeProperty(`transform`),r.style.removeProperty(`will-change`)),l+=1,t={route:e,surface:n,underlay:r,surfaceTransition:i,surfaceAnimation:o,underlayTransition:s,underlayAnimation:c},K(t,0)},h=e=>{c=W(e),!o&&(o=window.requestAnimationFrame(()=>{o=0,t&&K(t,c)}))},ee=ft,g=(n,r,i)=>{if(n&&Ke(),a)return n&&f(H.getTopRoute())?(u.enqueue(),!0):!1;o&&=(window.cancelAnimationFrame(o),0),t||m(),t&&r!==void 0&&K(t,r);let s=t,d=l;if(t=null,!s){if(!n)return!1;let e=H.getTopRoute();return nt(e,f(e))}a=s;let p=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,h=rt({progress:W(r??c),commit:n,velocityX:i,viewportWidth:window.innerWidth});return ot(s.surface,n,p,h).then(async()=>{d===l&&(!e&&n&&(s.route.onBack(),await ee(s)),d===l&&(G(s),a===s&&(a=null),!e&&u.take()&&g(!0,0,0)))}),!0},te=H.setAnimatedBackDriver(e=>e!==H.getTopRoute()||!f(e)?!1:g(!0,0,0)),_=H.subscribe(p);return(async()=>{let t=await U.addListener(`backStarted`,m),n=await U.addListener(`backProgressed`,e=>h(e.progress??0)),r=await U.addListener(`backCancelled`,e=>g(!1,e.progress,e.velocityX)),i=await U.addListener(`backInvoked`,e=>g(!0,e.progress,e.velocityX));if(e){await Promise.all([t.remove(),n.remove(),r.remove(),i.remove()]);return}d.push(t,n,r,i),p()})().catch(pt),p(),()=>{e=!0,l+=1,u.clear(),_(),te(),o&&window.cancelAnimationFrame(o),t&&G(t),a&&(a.surface.getAnimations().forEach(mt),a.underlay?.getAnimations().forEach(ht),G(a)),t=null,a=null,U.setEnabled({enabled:!1}).catch(gt),d.forEach(_t)}},o=[n,r],t[0]=n,t[1]=r,t[2]=a,t[3]=o):(a=t[2],o=t[3]),_.useEffect(a,o)};function lt(){}function ut(e){return e.cancel()}function dt(e){return e.cancel()}function ft(e){return new Promise(t=>{let n=0,r=12,i=!1,a=()=>{i||(i=!0,c(),n&&window.cancelAnimationFrame(n),t())},o=()=>{let t=H.getTopRoute();return it({surfaceConnected:e.surface.isConnected,routeToken:e.route.token,topRouteToken:t?.token??null,routeSurface:e.route.getSurface(),outgoingSurface:e.surface})},s=()=>{if(o()||r<=0){a();return}--r,n=window.requestAnimationFrame(s)},c=H.subscribe(()=>{o()&&a()});s()})}function pt(){}function mt(e){return e.cancel()}function ht(e){return e.cancel()}function gt(){}function _t(e){e.remove()}var vt=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return n?n.getItem(e)===`1`:!1}catch{return!1}},yt=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},bt=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},xt=`oc:legend-timeline`,St=e=>vt(xt,e),Ct=`oc:markstream-react`,wt=e=>yt(Ct,e),q=t(e=>({legendTimelineEnabled:St(),setLegendTimelineEnabled:t=>{bt(xt,t),e({legendTimelineEnabled:t})},markstreamReactEnabled:wt(),setMarkstreamReactEnabled:t=>{bt(Ct,t),e({markstreamReactEnabled:t})}})),J=null,Tt=()=>(J??=c(()=>import(`./MarkstreamRendererImpl-CowOCU5W.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])).catch(e=>{throw J=null,e}),J),Et=()=>{Tt().catch(()=>void 0)},Y=null,X=()=>(Y??=c(()=>import(`./MarkdownRendererImpl-C6rkoZYH.js`),__vite__mapDeps([39,1,14,15,2,16,17,3,18,19,20,5,40,10,11,12,23,24,13,21,22,25,26,27,28,29,30,41,42,43,44,45,46,47,48,49,50,51,36,31,32,33,34,52,53,54,55,56,57,58,35,37])).catch(e=>{throw Y=null,e}),Y),Dt=()=>{X().catch(()=>void 0),wt()&&Et()},Ot=class extends _.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},kt=_.createContext(!0),At=()=>_.useContext(kt),Z=n(),jt=z(()=>X().then(e=>({default:e.MarkdownRenderer}))),Mt=z(()=>Tt().then(e=>({default:e.MarkstreamRenderer}))),Nt=z(()=>X().then(e=>({default:e.SimpleMarkdownRenderer}))),Pt=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,Q=e=>{let t=(0,v.c)(15),n=q(Lt),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?ee(g(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let o=a,s;t[5]!==e.className||t[6]!==e.variant?(s=h(`relative break-words w-full min-w-0`,Pt(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=s):s=t[7];let c;t[8]!==r||t[9]!==e.animated||t[10]!==o?(c=(0,Z.jsx)(te,{animated:e.animated,content:r,reservedHeight:o}),t[8]=r,t[9]=e.animated,t[10]=o,t[11]=c):c=t[11];let l;return t[12]!==s||t[13]!==c?(l=(0,Z.jsx)(`div`,{className:s,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:c}),t[12]=s,t[13]=c,t[14]=l):l=t[14],l},Ft=e=>{let t=(0,v.c)(9),n=At(),r=q(Rt);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Q,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,Z.jsx)(_.Suspense,{fallback:(0,Z.jsx)(Q,{...e,reserveMeasuredHeight:!0}),children:(0,Z.jsx)(jt,{...e})}),t[2]=e,t[3]=i);let a=i;if(!r)return a;let o;t[4]===e?o=t[5]:(o=(0,Z.jsx)(_.Suspense,{fallback:(0,Z.jsx)(Q,{...e,reserveMeasuredHeight:!0}),children:(0,Z.jsx)(Mt,{...e})}),t[4]=e,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(Ot,{fallback:a,children:o}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s},It=e=>{let t=(0,v.c)(4);if(!At()){let n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Q,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,Z.jsx)(_.Suspense,{fallback:(0,Z.jsx)(Q,{...e}),children:(0,Z.jsx)(Nt,{...e})}),t[2]=e,t[3]=n),n};function Lt(e){return e.markstreamReactEnabled}function Rt(e){return e.markstreamReactEnabled}var zt=e=>/^#[0-9a-fA-F]{6}$/.test(e),Bt=e=>/^#[0-9a-fA-F]{8}$/.test(e),Vt=(e,t)=>/^[0-9a-fA-F]{2}$/.test(t)?zt(e)?`${e}${t}`:Bt(e)?`${e.slice(0,7)}${t}`:e:e,$=(e,t)=>typeof e==`string`&&e.trim().length>0?e:t,Ht=e=>{let t=e.colors.syntax.base,n=e.colors.syntax.tokens??{},r=(e,t)=>$(n[e],t);return[{name:`plain`,scope:[`source`,`support.type.property-name.css`],settings:{foreground:t.foreground}},{name:`classes`,scope:[`entity.name.type.class`],settings:{foreground:r(`className`,r(`class`,t.function))}},{name:`interfaces`,scope:[`entity.name.type.interface`,`entity.name.type`],settings:{foreground:r(`interface`,t.type)}},{name:`structs`,scope:[`entity.name.type.struct`],settings:{foreground:r(`struct`,t.function)}},{name:`enums`,scope:[`entity.name.type.enum`],settings:{foreground:r(`enum`,t.function)}},{name:`keys`,scope:[`meta.object-literal.key`,`support.type.property-name`],settings:{foreground:r(`key`,t.function)}},{name:`methods`,scope:[`entity.name.function.method`,`meta.function.method`],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`functions`,scope:[`entity.name.function`,`support.function`,`meta.function-call.generic`],settings:{foreground:t.function,fontStyle:`bold`}},{name:`variables`,scope:[`variable`,`meta.variable`,`variable.other.object.property`],settings:{foreground:t.variable}},{name:`variablesOther`,scope:[`variable.other.object`,`variable.other.readwrite.alias`],settings:{foreground:r(`variableOther`,r(`method`,e.colors.status.success))}},{name:`globalVariables`,scope:[`variable.other.global`,`variable.language.this`],settings:{foreground:r(`variableGlobal`,t.number)}},{name:`localVariables`,scope:[`variable.other.local`],settings:{foreground:r(`variableLocal`,e.colors.surface.elevated)}},{name:`parameters`,scope:[`variable.parameter`,`meta.parameter`],settings:{foreground:r(`parameter`,t.foreground)}},{name:`properties`,scope:[`variable.other.property`,`meta.property`],settings:{foreground:r(`variableProperty`,e.colors.status.info)}},{name:`strings`,scope:[`string`,`string.other.link`,`markup.inline.raw.string.markdown`],settings:{foreground:t.string}},{name:`stringEscapeSequences`,scope:[`constant.character.escape`,`constant.other.placeholder`],settings:{foreground:r(`stringEscape`,t.foreground)}},{name:`keywords`,scope:[`keyword`],settings:{foreground:t.keyword}},{name:`keywordsControl`,scope:[`keyword.control.import`,`keyword.control.from`,`keyword.import`],settings:{foreground:r(`keywordImport`,t.operator)}},{name:`storageModifiers`,scope:[`storage.modifier`,`keyword.modifier`,`storage.type`],settings:{foreground:r(`storageModifier`,t.keyword)}},{name:`comments`,scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:t.comment}},{name:`docComments`,scope:[`comment.documentation`,`comment.line.documentation`],settings:{foreground:r(`commentDoc`,e.colors.surface.mutedForeground)}},{name:`numbers`,scope:[`constant.numeric`],settings:{foreground:t.number}},{name:`booleans`,scope:[`constant.language`],settings:{foreground:r(`boolean`,t.type)}},{name:`operators`,scope:[`keyword.operator`],settings:{foreground:t.operator}},{name:`macros`,scope:[`entity.name.function.preprocessor`,`meta.preprocessor`],settings:{foreground:r(`macro`,t.keyword)}},{name:`preprocessor`,scope:[`meta.preprocessor`],settings:{foreground:r(`preprocessor`,r(`label`,t.number))}},{name:`urls`,scope:[`markup.underline.link`],settings:{foreground:r(`url`,e.colors.status.info)}},{name:`tags`,scope:[`entity.name.tag`],settings:{foreground:r(`tag`,t.keyword)}},{name:`jsxTags`,scope:[`support.class.component`],settings:{foreground:r(`jsxTag`,r(`label`,t.number))}},{name:`attributes`,scope:[`entity.other.attribute-name`,`meta.attribute`],settings:{foreground:r(`tagAttribute`,t.type)}},{name:`types`,scope:[`support.type`],settings:{foreground:t.type}},{name:`constants`,scope:[`variable.other.constant`,`variable.readonly`],settings:{foreground:r(`constant`,t.foreground)}},{name:`labels`,scope:[`entity.name.label`,`punctuation.definition.label`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`namespaces`,scope:[`entity.name.namespace`,`storage.modifier.namespace`,`markup.bold.markdown`],settings:{foreground:r(`namespace`,t.type)}},{name:`modules`,scope:[`entity.name.module`,`storage.modifier.module`],settings:{foreground:r(`module`,t.operator)}},{name:`typeParameters`,scope:[`variable.type.parameter`,`variable.parameter.type`],settings:{foreground:r(`typeParameter`,t.function)}},{name:`exceptions`,scope:[`keyword.control.exception`,`keyword.control.trycatch`],settings:{foreground:r(`exception`,r(`label`,t.number))}},{name:`decorators`,scope:[`meta.decorator`,`punctuation.decorator`,`entity.name.function.decorator`],settings:{foreground:r(`decorator`,t.type)}},{name:`calls`,scope:[`variable.function`],settings:{foreground:t.foreground}},{name:`punctuation`,scope:[`punctuation`,`punctuation.terminator`,`punctuation.definition.tag`,`punctuation.separator`,`punctuation.definition.string`,`punctuation.section.block`],settings:{foreground:r(`punctuation`,t.comment)}},{name:`yellow`,scope:[`storage.type.numeric.go`,`storage.type.byte.go`,`storage.type.boolean.go`,`storage.type.string.go`,`storage.type.uintptr.go`,`storage.type.error.go`,`storage.type.rune.go`,`constant.language.go`,`support.class.dart`,`keyword.other.documentation`,`storage.modifier.import.java`,`punctuation.definition.list.begin.markdown`,`punctuation.definition.quote.begin.markdown`,`meta.separator.markdown`,`entity.name.section.markdown`],settings:{foreground:t.type}},{name:`green`,scope:[],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`cyan`,scope:[`markup.italic.markdown`,`support.type.python`,`variable.legacy.builtin.python`,`support.constant.property-value.css`,`storage.modifier.attribute.swift`],settings:{foreground:t.string}},{name:`blue`,scope:[],settings:{foreground:t.keyword}},{name:`purple`,scope:[`keyword.channel.go`,`keyword.other.platform.os.swift`],settings:{foreground:t.number}},{name:`magenta`,scope:[`punctuation.definition.heading.markdown`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`red`,scope:[],settings:{foreground:t.operator}},{name:`orange`,scope:[],settings:{foreground:t.function}}]},Ut=e=>{let t=e.colors.surface,n=e.colors.interactive,r=e.colors.status,i=e.colors.syntax.base,a=e.colors.syntax.highlights??{},o=$(a.diffAddedBackground,r.successBackground),s=$(a.diffRemovedBackground,r.errorBackground);return{"editor.background":t.background,"editor.foreground":t.foreground,"editor.hoverHighlightBackground":$(n.hover,t.subtle),"editor.lineHighlightBackground":t.muted,"editor.selectionBackground":n.selection,"editor.selectionHighlightBackground":n.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":Vt(i.type,`cc`),"editor.findRangeHighlightBackground":t.muted,"editor.inactiveSelectionBackground":t.elevated,"editor.lineHighlightBorder":t.elevated,"editor.rangeHighlightBackground":$(n.active,n.borderHover),"notifications.background":t.elevated,"editorInlayHint.typeBackground":t.subtle,"editorInlayHint.typeForeground":t.foreground,"editorWhitespace.foreground":n.borderHover,"editorIndentGuide.background1":t.subtle,"editorHoverWidget.background":t.elevated,"editorLineNumber.activeForeground":$(a.lineNumberActive,t.foreground),"editorLineNumber.foreground":$(a.lineNumber,t.mutedForeground),"editorGutter.background":t.background,"editorGutter.modifiedBackground":r.info,"editorGutter.addedBackground":r.success,"editorGutter.deletedBackground":r.error,"editorBracketMatch.background":t.elevated,"editorBracketMatch.border":t.subtle,"editorError.foreground":r.error,"editorWarning.foreground":r.warning,"editorInfo.foreground":r.info,"diffEditor.insertedTextBackground":o,"diffEditor.removedTextBackground":s,"editorGroupHeader.tabsBackground":t.background,"editorGroup.border":n.border,"tab.activeBackground":t.background,"tab.inactiveBackground":t.muted,"tab.inactiveForeground":t.mutedForeground,"tab.activeForeground":t.foreground,"tab.hoverBackground":t.subtle,"tab.unfocusedHoverBackground":t.subtle,"tab.border":n.border,"tab.activeModifiedBorder":i.type,"tab.inactiveModifiedBorder":r.info,"tab.unfocusedActiveModifiedBorder":i.type,"tab.unfocusedInactiveModifiedBorder":r.info,"editorWidget.background":t.muted,"editorWidget.border":n.border,"editorSuggestWidget.background":t.background,"editorSuggestWidget.border":n.border,"editorSuggestWidget.foreground":t.foreground,"editorSuggestWidget.highlightForeground":t.mutedForeground,"editorSuggestWidget.selectedBackground":t.subtle,"peekView.border":n.border,"peekViewEditor.background":t.background,"peekViewEditor.matchHighlightBackground":t.subtle,"peekViewResult.background":t.muted,"peekViewResult.fileForeground":t.foreground,"peekViewResult.lineForeground":t.mutedForeground,"peekViewResult.matchHighlightBackground":t.subtle,"peekViewResult.selectionBackground":t.elevated,"peekViewResult.selectionForeground":t.mutedForeground,"peekViewTitle.background":t.subtle,"peekViewTitleDescription.foreground":t.mutedForeground,"peekViewTitleLabel.foreground":t.foreground,"merge.currentHeaderBackground":r.success,"merge.currentContentBackground":$(a.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":$(a.diffModified,r.info),"merge.border":n.border,"merge.commonContentBackground":t.subtle,"merge.commonHeaderBackground":t.muted,"panel.background":t.background,"panel.border":n.border,"panelTitle.activeBorder":n.borderHover,"panelTitle.activeForeground":t.foreground,"panelTitle.inactiveForeground":t.mutedForeground,"statusBar.background":t.background,"statusBar.foreground":t.foreground,"statusBar.border":n.border,"statusBar.debuggingBackground":r.error,"statusBar.debuggingForeground":r.errorForeground,"statusBar.noFolderBackground":t.subtle,"statusBar.noFolderForeground":t.mutedForeground,"titleBar.activeBackground":t.background,"titleBar.activeForeground":t.foreground,"titleBar.inactiveBackground":t.muted,"titleBar.inactiveForeground":t.mutedForeground,"titleBar.border":n.border,"menu.foreground":t.foreground,"menu.background":t.background,"menu.selectionForeground":t.foreground,"menu.selectionBackground":t.subtle,"menu.border":n.border,"editorInlayHint.foreground":t.mutedForeground,"editorInlayHint.background":t.subtle,"terminal.foreground":t.foreground,"terminal.background":t.background,"terminalCursor.foreground":t.foreground,"terminalCursor.background":t.background,"terminal.ansiRed":$(a.diffRemoved,r.error),"terminal.ansiGreen":$(a.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":$(a.diffModified,r.info),"terminal.ansiMagenta":i.keyword,"terminal.ansiCyan":i.type,"activityBar.background":t.background,"activityBar.foreground":t.foreground,"activityBar.inactiveForeground":t.mutedForeground,"activityBar.activeBorder":t.foreground,"activityBar.border":n.border,"sideBar.background":t.background,"sideBar.foreground":t.foreground,"sideBar.border":n.border,"sideBarTitle.foreground":t.foreground,"sideBarSectionHeader.background":t.muted,"sideBarSectionHeader.foreground":t.foreground,"sideBarSectionHeader.border":n.border,"sideBar.activeBackground":t.subtle,"sideBar.activeForeground":t.foreground,"sideBar.hoverBackground":t.muted,"sideBar.hoverForeground":t.foreground,"list.warningForeground":r.warning,"list.errorForeground":r.error,"list.inactiveSelectionBackground":t.subtle,"list.activeSelectionBackground":t.elevated,"list.inactiveSelectionForeground":t.foreground,"list.activeSelectionForeground":t.foreground,"list.hoverForeground":t.foreground,"list.hoverBackground":t.muted,"input.background":t.muted,"input.foreground":t.foreground,"input.border":n.border,"input.placeholderForeground":t.mutedForeground,"inputOption.activeBorder":n.border,"inputOption.activeBackground":t.elevated,"inputOption.activeForeground":t.foreground,"inputValidation.infoBackground":r.infoBackground,"inputValidation.infoBorder":r.infoBorder,"inputValidation.warningBackground":r.warningBackground,"inputValidation.warningBorder":r.warningBorder,"inputValidation.errorBackground":r.errorBackground,"inputValidation.errorBorder":r.errorBorder,"dropdown.background":t.muted,"dropdown.foreground":t.foreground,"dropdown.border":n.border,"dropdown.listBackground":t.background,"badge.background":e.colors.primary.base,"activityBarBadge.background":e.colors.primary.base,"button.background":e.colors.primary.base,"button.foreground":$(e.colors.primary.foreground,t.background),"badge.foreground":$(e.colors.primary.foreground,t.background),"activityBarBadge.foreground":$(e.colors.primary.foreground,t.background)}};function Wt(e){return{name:e.metadata.name,type:e.metadata.variant,colors:Ut(e),tokenColors:Ht(e)}}var Gt=e=>/^#[0-9a-fA-F]{8}$/.test(e),Kt=e=>Gt(e)?e.slice(0,7):e;function qt(e,t){return Object.defineProperty(e,"toString",{value:()=>t,enumerable:!1,configurable:!0}),Object.defineProperty(e,Symbol.toPrimitive,{value:()=>t,enumerable:!1,configurable:!0}),e}var Jt=new Map,Yt=new Set,Xt=(e,t)=>{let n=e.colors?.[`editor.background`],r=e.colors?.[`editor.foreground`],i=n?Kt(n):void 0,a=r?Kt(r):void 0;if(!i||!a)throw Error(`Theme "${t}" is missing editor.background/editor.foreground`);let o=e.tokenColors??[];return qt({...e,name:t,fg:a,bg:i,settings:o},t)},Zt=e=>Wt(e),Qt=e=>{let t=Jt.get(e.metadata.id);if(t)return t;let n=Xt(Zt(e),e.metadata.id);return Jt.set(e.metadata.id,n),n},$t=e=>{let t=e.metadata.id;if(Yt.has(t))return;let n=Qt(e);u(t,async()=>n),Yt.add(t)};export{Ve as A,A as C,he as D,xe as E,Ne as F,oe as I,ie as L,be as M,Me as N,ye as O,E as P,ae as R,Fe as S,k as T,Ee as _,kt as a,ue as b,H as c,z as d,qe as f,De as g,_e as h,It as i,je as j,Be as k,tt as l,ve as m,Qt as n,Dt as o,P as p,Ft as r,q as s,$t as t,ct as u,Ie as v,Te as w,He as x,me as y,b as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./useUIStore-CqqO11ZI.js";import{$t as t,Jt as n,Xt as r,Yt as i,in as a,kn as o}from"./persistence-CSZp1CNB.js";import{d as s,s as c,u as l}from"./markdownHeightCache-Bj707yG-.js";import{a as u,i as d,o as f,r as p,t as ee}from"./path-utils-jGozTg9d.js";import{t as m}from"./outsideFileGrants-BB4GPvCq.js";var h=new Set([`dockerfile`,`makefile`,`readme`,`license`,`.env`,`.gitignore`,`.npmrc`]),g=Array.from(h).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),_=e=>u(e),v=e=>p(e),y=e=>{if(!e||e.startsWith(`--`)||e.includes(`://`)||/[<>]/.test(e)||/\s{2,}/.test(e))return!1;let t=_(e),n=t.split(`/`).filter(Boolean).pop()??t;if(!n||n===`.`||n===`..`)return!1;let r=n.toLowerCase();return h.has(r)||r.startsWith(`.`)&&r.length>1?!0:!t.includes(`/`)&&/^\d+\.\d+$/.test(n)?!1:/\.[A-Za-z0-9_-]{1,16}$/.test(n)},b=e=>{let t=(e||``).trim();return t?((t.startsWith("`")&&t.endsWith("`")||t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))&&(t=t.slice(1,-1).trim()),t=t.replace(/[.,;!?]+$/g,``),t.endsWith(`)`)&&!t.includes(`(`)&&(t=t.slice(0,-1)),t.endsWith(`]`)&&!t.includes(`[`)&&(t=t.slice(0,-1)),t):``},x=e=>{let t=b(e);if(!t)return``;let n=t.indexOf(`;`);n>=0&&(t=t.slice(0,n)),t=t.replace(/#.*$/,``);let r=t.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);r&&(t=r[1]??t);let i=g.length>0?t.match(RegExp(`^(.*(?:/|^)(${g})):.*$`,`i`)):null;return i&&(t=i[1]??t),b(t)},S=e=>{let t=b(e);if(!t)return null;let n=t.indexOf(`;`),r=n>=0?b(t.slice(0,n)):t;if(!r)return null;let i=r.match(/^(.*?):(\d+)-(\d+)$/);if(i){let e=x(i[1]??``),t=Number.parseInt(i[2]??``,10),n=Number.parseInt(i[3]??``,10);return!e||!Number.isFinite(t)||!Number.isFinite(n)||n<t?null:{path:e,line:t,endLine:n}}let a=r.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(a){let e=x(a[1]??``),t=Number.parseInt(a[2]??``,10),n=a[3]?Number.parseInt(a[3],10):void 0;return!e||!Number.isFinite(t)?null:{path:e,line:t,column:Number.isFinite(n??NaN)?n:void 0}}let o=r.match(/^(.*?):(\d+)(?::(\d+))?$/);if(o){let e=x(o[1]??``),t=Number.parseInt(o[2]??``,10),n=o[3]?Number.parseInt(o[3],10):void 0;return!e||!Number.isFinite(t)?null:{path:e,line:t,column:Number.isFinite(n??NaN)?n:void 0}}let s=x(r);return s?{path:s}:null},C=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,w=`(?:(?:[0-9][\\w.@+\\- 一-鿿]*|[一-鿿][\\w.@+\\- 一-鿿]*)|[\\w.@+\\-一-鿿]+)`,T=RegExp(`(?:[A-Za-z]:[\\\\/]|\\.{1,2}\\/|\\/)?(?:${w}\\/)+${w}\\.[A-Za-z0-9]{1,8}(?::\\d+(?:-\\d+)?(?::\\d+)?)?`,`g`),E=`data-openchamber-block-path-token`,D=`[${E}]`,O=`data-openchamber-file-link`,k=`[${O}="true"]`,A=[O,`data-openchamber-file-ref`,`data-openchamber-file-path`,`data-openchamber-file-binary`,`title`,`role`,`tabindex`],j=`data-openchamber-block-paths-scanned`,M=`data-openchamber-paragraph-paths-scanned`,N=`pre, code, a, script, style, button, [${O}], ${D}`,P=2e5,F=e=>{let t=S(e);return t?y(t.path):!1},I=(e,t)=>{let n=0;for(let r of e){let e=n+r.data.length;if(t<=e)return{node:r,offset:Math.max(0,t-n)};n=e}let r=e.at(-1);return r?{node:r,offset:r.data.length}:null},L=e=>{let t=e.querySelectorAll(`pre code`);if(t.length===0)return;let n=e.ownerDocument;if(n)for(let e of Array.from(t)){if(e.getAttribute(j)===`true`)continue;if((e.textContent??``).length>P){e.setAttribute(j,`true`);continue}let t=n.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=[],i=t.nextNode();for(;i;)r.push(i),i=t.nextNode();let a=e.textContent??``;if(!a.includes(`.`)){e.setAttribute(j,`true`);continue}C.lastIndex=0;let o=[],s=C.exec(a);for(;s;){let e=s[0];e&&F(e)&&o.push({start:s.index,end:s.index+e.length,raw:e}),s=C.exec(a)}for(let{start:e,end:t,raw:i}of o.reverse()){let a=I(r,e),o=I(r,t);if(!a||!o)continue;let s=n.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=n.createElement(`span`);c.setAttribute(E,`true`),c.textContent=i,s.deleteContents(),s.insertNode(c)}e.setAttribute(j,`true`)}},te=e=>{let t=e.ownerDocument;if(!t)return;let n=e.querySelectorAll(`p, li, blockquote, h1, h2, h3, h4, h5, h6, td, th`);if(n.length!==0)for(let e of Array.from(n)){if(e.getAttribute(M)===`true`)continue;if(e.closest(N)){e.setAttribute(M,`true`);continue}let n=t.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>{let t=e.parentElement;return!t||t.closest(N)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=[],i=n.nextNode();for(;i;)r.push(i),i=n.nextNode();if(r.length===0){e.setAttribute(M,`true`);continue}let a=r.map(e=>e.data).join(``);if(!a.includes(`/`)||!a.includes(`.`)){e.setAttribute(M,`true`);continue}T.lastIndex=0;let o=[],s=T.exec(a);for(;s;){let e=s[0];if(!e){s=T.exec(a);continue}let t=s.index>=2?a.slice(s.index-2,s.index):``;if((s.index>=1?a.charAt(s.index-1):``)===`:`||t===`:/`){s=T.exec(a);continue}F(e)&&o.push({start:s.index,end:s.index+e.length,raw:e}),s=T.exec(a)}for(let{start:e,end:n,raw:i}of o.reverse()){let a=I(r,e),o=I(r,n);if(!a||!o)continue;let s=t.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=t.createElement(`span`);c.setAttribute(E,`true`),c.textContent=i,s.deleteContents(),s.insertNode(c)}e.setAttribute(M,`true`)}},ne=e=>{L(e),te(e)},re=(e,t)=>{if(e.getAttribute(`data-openchamber-file-link`)!==`true`)return;let n=(e.getAttribute(`data-openchamber-file-ref`)||e.textContent||``).trim(),r=(t.textContent||``).trim();if(!(!n||n!==r))for(let n of A){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}},R=`Open file`,z=4,B=1e3,V=200,H=80,U=40,W=new Map,G=new Map,K=0,q=[],J=()=>t()?V:B,Y=()=>t()?U:H,X=(e,t)=>{G.set(e,t)},ie=()=>{let e=W.keys().next().value;typeof e==`string`&&(W.delete(e),G.delete(e))},Z=(e,t)=>{let n=J();for(;W.size>=n;)ie();W.set(e,t)},ae=e=>{let t=_(e);if(t)return G.get(t)},Q=e=>{if(e.tagName.toLowerCase()===`a`){let t=e.getAttribute(`href`)?.trim();if(t&&F(t))return t}return(e.textContent||``).trim()},$=(e,t)=>{let n=S(e);if(!n||!y(n.path))return null;let r=v(n.path)?_(n.path):f(t,n.path);return r?{...n,resolvedPath:r}:null},oe=e=>{let t=_(e);if(!t)return Promise.resolve({exists:!1,isBinary:!1});let n=W.get(t);if(n)return W.delete(t),W.set(t,n),n;let r=new Promise(e=>{let n=()=>{K+=1,o(`/api/fs/stat?path=${encodeURIComponent(t)}&optional=true`,{method:`GET`,cache:`no-store`}).then(async n=>{if(!n.ok){let n={exists:!1,isBinary:!1};X(t,n),e(n);return}let r=await n.json().catch(()=>null),i={exists:r?.exists!==!1,isBinary:r?.isBinary===!0};X(t,i),e(i)}).catch(()=>{let n={exists:!1,isBinary:!1};X(t,n),e(n)}).finally(()=>{K=Math.max(0,K-1),q.shift()?.()})};if(K<z){n();return}q.push(n)});return Z(t,r),r},se=(e,t)=>{if(!(r()&&i()&&!d(e,t)))return oe(e);let a=_(e);if(!a)return Promise.resolve({exists:!1,isBinary:!1});let o=W.get(a);if(o)return W.delete(a),W.set(a,o),o;let s=n(e).then(e=>{let t={exists:!0,isBinary:e===!0};return X(a,t),t});return Z(a,s),s},ce=(e,t,n)=>!(!t.exists||n&&t.isBinary&&!s(e)&&!l(e)),le=(e,t)=>e||ee(e,t),ue=async(t,n,r)=>{let i=$(t,r.effectiveDirectory);if(!i)return;let o=i.resolvedPath.toLowerCase().endsWith(`.app`);if((n||o)&&!s(i.resolvedPath)&&!l(i.resolvedPath)&&await a(i.resolvedPath))return;if(s(i.resolvedPath)&&r.onShowPopup){let e=i.resolvedPath.split(`/`).filter(Boolean).pop()??i.resolvedPath;r.onShowPopup({open:!0,title:e,content:``,metadata:{tool:`image-preview`,filename:e,mime:c(i.resolvedPath)},image:{url:i.resolvedPath,filename:e,mimeType:c(i.resolvedPath)}});return}let u=le(r.effectiveDirectory,i.resolvedPath),f=l(i.resolvedPath);if(r.preferRuntimeEditor&&r.editor&&!f){r.editor.openFile(i.resolvedPath,Number.isFinite(i.line??NaN)?Math.max(1,Math.trunc(i.line)):void 0,Number.isFinite(i.column??NaN)?Math.max(1,Math.trunc(i.column)):void 0);return}d(i.resolvedPath,r.effectiveDirectory)||await m(i.resolvedPath,r.effectiveDirectory);let p=e.getState();if(f){p.openContextFile(u,i.resolvedPath,{viewerMode:`preview`});return}if(Number.isFinite(i.line??NaN)){p.openContextFileAtLine(u,i.resolvedPath,Math.max(1,Math.trunc(i.line)),Number.isFinite(i.column??NaN)?Math.max(1,Math.trunc(i.column)):1);return}p.openContextFile(u,i.resolvedPath)},de=async(e,t)=>{await ue(e.getAttribute(`data-openchamber-file-ref`)||Q(e),e.getAttribute(`data-openchamber-file-binary`)===`true`,t)};export{de as a,ce as c,k as d,re as f,T as h,$ as i,D as l,ne as m,Q as n,ae as o,F as p,Y as r,se as s,R as t,O as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{nt as e,rt as t}from"./vendor-base-ui-CnHfUmDN.js";import{n}from"./vendor-react-DLPElpoQ.js";import{t as r}from"./utils-B0mQXN9L.js";import{i}from"./markdownHeightCache-Bj707yG-.js";t();var a=n(),o=e();function s(e){let t=(0,a.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let s;t[3]===n?s=t[4]:(s=r(`bg-accent animate-pulse rounded-xl`,n),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==s?(c=(0,o.jsx)(`div`,{"data-slot":`skeleton`,className:s,...i}),t[5]=i,t[6]=s,t[7]=c):c=t[7],c}var c=5,l=88,u=[`w-full`,`w-[92%]`,`w-[84%]`,`w-[96%]`],d=/^\s*\|.*\|\s*$/,f=/^[\s|:-]+$/,p=e=>e.split(`
|
|
2
|
-
`).map(e=>d.test(e)?f.test(e)?``:`x`:e).join(`
|
|
3
|
-
`),m=e=>{let t=e.trim();if(!t)return 1;let n=t.split(/\n+/).length,r=Math.ceil(t.length/l);return Math.min(c,Math.max(1,n,r))},h=e=>{let t=(0,a.c)(6),{animated:n,content:i,reservedHeight:c}=e,l=n===void 0||n,d;if(t[0]!==l||t[1]!==i||t[2]!==c){let e=p(i),n=m(e),a;t[4]===i?a=t[5]:(a=i.trim(),t[4]=i,t[5]=a);let f=a.length>0;d=(0,o.jsxs)(o.Fragment,{children:[typeof c==`number`&&Number.isFinite(c)&&c>0?(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`block`,"data-markdown-size-spacer":`measured`,style:{height:`${c}px`}}):(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`invisible block whitespace-pre-wrap`,"data-markdown-size-spacer":`true`,children:e||`\xA0`}),f&&(0,o.jsx)(`div`,{"aria-hidden":`true`,className:r(`pointer-events-none absolute inset-0 flex w-full flex-col gap-2 overflow-hidden py-1`,l&&`motion-safe:animate-pulse`),"data-markdown-placeholder":`skeleton`,children:Array.from({length:n},(e,t)=>(0,o.jsx)(s,{className:r(`h-3.5 animate-none`,t===n-1?`w-[68%]`:u[t%u.length])},t))})]}),t[0]=l,t[1]=i,t[2]=c,t[3]=d}else d=t[3];return d},g=`/assets/markdown-shiki.worker-woF2hOAN.js`,_=class{#e;#t;#n=new Map;constructor(e){this.#e=new i({maxEntries:e.maxEntries,maxBytes:e.maxBytes}),this.#t=e.weigh}get size(){return this.#e.size}get inFlightSize(){return this.#n.size}peek(e){return this.#e.get(e)}run(e,t,n){let r=this.#e.get(e);if(r!==void 0)return Promise.resolve(r);if(n?.aborted)return Promise.resolve(null);let i=this.#n.get(e)??this.#r(e,t);return i.waiters+=1,this.#i(e,i,n)}clear(){this.#e.clear()}#r(e,t){let n=new AbortController,r={controller:n,waiters:0,promise:Promise.resolve(null)},i=t=>(this.#n.get(e)===r&&this.#n.delete(e),t!==null&&this.#e.set(e,t,this.#t(t)+e.length*2),t);return r.promise=t(n.signal).then(i,()=>i(null)),this.#n.set(e,r),r}#i(e,t,n){return new Promise(r=>{let i=!1,a=e=>{i||(i=!0,n?.removeEventListener(`abort`,o),r(e))},o=()=>{i||(--t.waiters,t.waiters<=0&&this.#n.get(e)===t&&(this.#n.delete(e),t.controller.abort()),a(null))};n?.addEventListener(`abort`,o,{once:!0}),t.promise.then(a,()=>a(null))})}},v=`\0`,y=(e,t)=>`${e}${v}${t}`,b=(e,t,n)=>`${e}${v}${t}${v}${n}`,x=e=>e.length*2,S=e=>{let t=e.length*8;for(let n of e)t+=n.length*2;return t},C=e=>{let t=e.length*8;for(let n of e){t+=n.length*32;for(let e of n)t+=e[1].length*2}return t},w,T=0,E=new Map,D=new Set,O=(e,t)=>{let n=E.get(e);n&&(E.delete(e),n.signal&&n.onAbort&&n.signal.removeEventListener(`abort`,n.onAbort),n.resolve(t))},k=()=>{for(let e of Array.from(E.keys()))O(e,null);D.clear(),w?.terminate(),w=void 0},A=()=>{if(w)return w;if(!(typeof window>`u`||typeof Worker>`u`)){try{w=new Worker(g,{type:`module`})}catch(e){console.error(`Failed to create Shiki worker:`,e);return}return w.onmessage=e=>{O(e.data.id,e.data)},w.onerror=k,w.onmessageerror=k,w.postMessage({type:`init`}),w}},j=(e,t)=>{if(t?.signal?.aborted)return Promise.resolve(null);let n=A();if(!n)return Promise.resolve(null);let r=++T,i=t?.priority??`visible`;return new Promise(a=>{let o=t?.signal,s=()=>{if(E.has(r)){O(r,null);try{n.postMessage({type:`cancel`,id:r})}catch{}}};if(E.set(r,{resolve:a,signal:o,onAbort:s}),o?.addEventListener(`abort`,s,{once:!0}),o?.aborted){s();return}try{n.postMessage(e(r,i))}catch{O(r,null)}})},M=new _({maxEntries:192,maxBytes:12582912,weigh:x}),N=new _({maxEntries:96,maxBytes:8388608,weigh:S}),P=new _({maxEntries:96,maxBytes:8388608,weigh:C}),F=(e,t,n)=>M.run(y(t,e),async r=>{let i=await j((n,r)=>({type:`highlight`,id:n,code:e,lang:t,priority:r}),{...n,signal:r});return i?.type===`highlight`?i.html:null},n?.signal),I=(e,t,n)=>N.run(y(t,e),async r=>{let i=await j((n,r)=>({type:`highlightLines`,id:n,code:e,lang:t,priority:r}),{...n,signal:r});return i?.type===`highlightLines`?i.lines:null},n?.signal),L=new _({maxEntries:64,maxBytes:8388608,weigh:e=>e.reduce((e,t)=>e+(t.id.length+t.html.length)*2,0)}),R=(e,t,n,r)=>`${+!!t}:${+!!n}:${r}:${e}`,z=e=>{let t=e.blocks&&e.blocks.length>0?e.blocks.map(e=>`${e.mode}:${+!!e.highlight}:${e.src}`).join(`\0`):e.text??``;return L.run(R(t,e.streaming,e.highlight!==!1,e.highlightLineLimit),async t=>{let n=await j((t,n)=>({type:`parse`,id:t,streaming:e.streaming,highlight:e.highlight!==!1,highlightLineLimit:e.highlightLineLimit,priority:n,...e.blocks&&e.blocks.length>0?{blocks:e.blocks}:{text:e.text??``}}),{...e,signal:t});return n?.type===`parse`?n.blocks:null},e.signal)},B=(e,t,n,r,i)=>P.run(b(n,t,e),async a=>{let o=!D.has(n),s=await j((i,a)=>({type:`highlightTokens`,id:i,code:e,lang:t,themeName:n,priority:a,...o?{theme:r}:{}}),{...i,signal:a});return s?.type===`highlightTokens`?(D.add(n),s.lines):null},i?.signal);export{h as a,z as i,I as n,s as o,B as r,F as t};
|