markstream-vue 1.0.1-beta.3 → 1.0.1-beta.5
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/README.md +25 -1
- package/README.zh-CN.md +25 -1
- package/dist/CodeBlockNode.js +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +46 -11
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/index9.js +1 -1
- package/dist/tailwind.js +0 -0
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -161,6 +161,30 @@ Import `markstream-vue/index.css` after your reset (e.g., use `@import 'markstre
|
|
|
161
161
|
For untrusted user-generated content, prefer `htmlPolicy="escape"` so raw HTML is rendered as text.
|
|
162
162
|
If your app intentionally scales root font size on mobile, use `markstream-vue/index.px.css` to avoid `rem`-based global scaling side effects.
|
|
163
163
|
|
|
164
|
+
Choose the renderer mode by surface:
|
|
165
|
+
|
|
166
|
+
```vue
|
|
167
|
+
<!-- AI chat / SSE output: steady pacing, no opacity animation flicker -->
|
|
168
|
+
<MarkdownRender
|
|
169
|
+
mode="chat"
|
|
170
|
+
:content="message"
|
|
171
|
+
:final="isDone"
|
|
172
|
+
smooth-streaming="auto"
|
|
173
|
+
:fade="false"
|
|
174
|
+
/>
|
|
175
|
+
|
|
176
|
+
<!-- Rich docs: larger render batches, tooltips, and fade are enabled by default -->
|
|
177
|
+
<MarkdownRender
|
|
178
|
+
mode="docs"
|
|
179
|
+
:content="doc"
|
|
180
|
+
:final="true"
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Use `mode="minimal"` when you want the same lightweight defaults as `chat`, but prefer a neutral mode name for non-chat surfaces. Avoid combining high-frequency `smooth-streaming` with `fade`; it can turn a steady stream into repeated opacity restarts.
|
|
185
|
+
For the same chat message, do not switch from `mode="chat"` to `mode="docs"` only because `final` changed. Keep the mode stable and switch pacing/animation props (`smooth-streaming`, `typewriter`, `fade`) instead; `docs` changes the default code renderer and layout strategy.
|
|
186
|
+
For docs pages that do not need Monaco-backed code blocks, set `:render-code-blocks-as-pre="true"`. If you want the rich Monaco-backed code-block UI, install `stream-monaco`; otherwise the renderer intentionally falls back to `<pre>` rendering.
|
|
187
|
+
|
|
164
188
|
Renderer CSS is scoped under an internal `.markstream-vue` container to minimize global style conflicts. If you render exported node components outside of `MarkdownRender`, wrap them in an element with class `markstream-vue`.
|
|
165
189
|
|
|
166
190
|
For dark theme variables, either add a `.dark` class on an ancestor, or pass `:is-dark="true"` to `MarkdownRender` to scope dark mode to the renderer.
|
|
@@ -175,7 +199,7 @@ Prefer the unified code-block `theme` prop for new integrations. When you render
|
|
|
175
199
|
/>
|
|
176
200
|
```
|
|
177
201
|
|
|
178
|
-
Language icons use the built-in `material` theme by default.
|
|
202
|
+
Language icons use the built-in `material` theme by default. For new integrations, inspect or switch icon themes with the exported helpers before `app.mount()`. The legacy `app.use(VueRendererMarkdown, { iconTheme })` option still works in 1.x, but prefer helpers because icon configuration is process-global state.
|
|
179
203
|
|
|
180
204
|
```ts
|
|
181
205
|
import { getRegisteredThemes, setIconTheme } from 'markstream-vue'
|
package/README.zh-CN.md
CHANGED
|
@@ -153,6 +153,30 @@ createApp({
|
|
|
153
153
|
确保在 CSS reset(如 `@tailwind base` 或 `@unocss/reset`)之后导入 `markstream-vue/index.css`,推荐使用 `@import 'markstream-vue/index.css' layer(components);` 以避免 Tailwind/UnoCSS 覆盖组件样式。根据需求再按需安装可选 peer 依赖:`stream-monaco`(Monaco 代码块)、`shiki` + `stream-markdown`(Shiki 高亮)、`mermaid`(Mermaid 图表)、`katex`(数学公式)。
|
|
154
154
|
如果你的移动端会主动调大根字号(`html`/`body`),建议改用 `markstream-vue/index.px.css`,避免 `rem` 跟随根字号导致整体放大。
|
|
155
155
|
|
|
156
|
+
按使用场景选择渲染模式:
|
|
157
|
+
|
|
158
|
+
```vue
|
|
159
|
+
<!-- AI 聊天 / SSE 输出:稳定节奏,不叠加透明度动画,避免闪烁 -->
|
|
160
|
+
<MarkdownRender
|
|
161
|
+
mode="chat"
|
|
162
|
+
:content="message"
|
|
163
|
+
:final="isDone"
|
|
164
|
+
smooth-streaming="auto"
|
|
165
|
+
:fade="false"
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
<!-- 富文档:默认启用更大的渲染批次、tooltip 和 fade -->
|
|
169
|
+
<MarkdownRender
|
|
170
|
+
mode="docs"
|
|
171
|
+
:content="doc"
|
|
172
|
+
:final="true"
|
|
173
|
+
/>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
当你想要和 `chat` 相同的轻量默认值,但当前页面不是聊天语义时,可以使用 `mode="minimal"`。避免把高频 `smooth-streaming` 和 `fade` 同时开启,否则稳定的流式输出可能变成反复重启的透明度动画。
|
|
177
|
+
同一条聊天消息不要仅因为 `final` 变为 `true` 就从 `mode="chat"` 切到 `mode="docs"`。保持 mode 稳定,只切换 `smooth-streaming`、`typewriter`、`fade` 等节奏/动画 props;`docs` 会改变默认代码块渲染器和布局策略。
|
|
178
|
+
如果文档页不需要 Monaco 代码块,建议设置 `:render-code-blocks-as-pre="true"`;如果需要富 Monaco 代码块 UI,请安装 `stream-monaco`,否则渲染器会按设计降级为 `<pre>` 渲染。
|
|
179
|
+
|
|
156
180
|
渲染器的 CSS 会作用于内部 `.markstream-vue` 容器下,以尽量降低对全局的影响;如果你脱离 `MarkdownRender` 单独使用导出的节点组件,请在外层包一层带 `markstream-vue` 类名的容器。
|
|
157
181
|
|
|
158
182
|
暗色变量可以通过给祖先节点加 `.dark`,或直接给 `MarkdownRender` 传入 `:is-dark="true"`(仅对渲染器生效)。
|
|
@@ -167,7 +191,7 @@ createApp({
|
|
|
167
191
|
/>
|
|
168
192
|
```
|
|
169
193
|
|
|
170
|
-
语言图标默认使用内置的 `material` theme
|
|
194
|
+
语言图标默认使用内置的 `material` theme。新接入建议在 `app.mount()` 之前通过导出的 helper 查看或切换 icon theme。旧的 `app.use(VueRendererMarkdown, { iconTheme })` 选项在 1.x 仍可用,但它会修改进程级全局状态,因此优先使用 helper。
|
|
171
195
|
|
|
172
196
|
```ts
|
|
173
197
|
import { getRegisteredThemes, setIconTheme } from 'markstream-vue'
|
package/dist/CodeBlockNode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,r=(t,n,l)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l,a=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&r(e,n,t[n]);if(l)for(var n of l(t))i.call(t,n)&&r(e,n,t[n]);return e},u=(e,l)=>t(e,n(l)),d=(e,t,n)=>new Promise((l,o)=>{var i=e=>{try{a(n.next(e))}catch(t){o(t)}},r=e=>{try{a(n.throw(e))}catch(t){o(t)}},a=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);a((n=n.apply(e,t)).next())});import{defineComponent as s,computed as c,onMounted as v,onUnmounted as f,openBlock as m,createBlock as p,Teleport as h,createElementVNode as y,normalizeClass as g,withModifiers as w,toDisplayString as b,unref as S,useAttrs as k,inject as x,getCurrentInstance as C,ref as M,watch as P,onBeforeUnmount as B,nextTick as E,createElementBlock as O,normalizeStyle as L,createVNode as F,createSlots as H,withCtx as N,withDirectives as z,createCommentVNode as $,vShow as R,renderSlot as _}from"vue";import{u as D,_ as T,r as A,b as W,h as j,z as I,s as q}from"./exports.js";import{M as U,n as V,e as G,c as J,l as X,g as Y,i as K}from"./index2.js";import{safeRaf as Q,safeCancelRaf as Z}from"./utils/safeRaf.js";import{_ as ee}from"./CodeBlockShell.vue_vue_type_style_index_0_lang.js";import{getUseMonaco as te}from"./monaco.js";const ne={class:"html-preview-frame__header"},le={class:"html-preview-frame__title"},oe={class:"html-preview-frame__label"},ie=["sandbox","srcdoc"],re=/* @__PURE__ */T(/* @__PURE__ */s({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){const t=e,n=void 0!==import.meta&&Boolean(!1);let l=null;const{t:o}=D(),i=c(()=>{const e=t.code||"",n=e.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?"#020617":"#ffffff"};\n color: ${t.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),r=c(()=>{return e=t.htmlPreviewSandbox,o=t.htmlPreviewAllowScripts,"string"==typeof e?(function(e){if(!n||"undefined"==typeof console||l===e)return;const t=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);t.has("allow-scripts")&&t.has("allow-same-origin")&&(l=e,console.warn("[markstream-vue] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(e),e):void 0!==e?"":!0===o?"allow-scripts":"";var e,o});function a(e){var n;"Escape"!==e.key&&"Esc"!==e.key||null==(n=t.onClose)||n.call(t)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",a)}),f(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",a)}),(e,n)=>(m(),p(h,{to:"body"},[y("div",{class:g(["markstream-vue",{dark:t.isDark}])},[y("div",{class:"html-preview-frame__backdrop",onClick:n[2]||(n[2]=e=>{var n;return null==(n=t.onClose)?void 0:n.call(t)})},[y("div",{class:"html-preview-frame",onClick:n[1]||(n[1]=w(()=>{},["stop"]))},[y("div",ne,[y("div",le,[n[3]||(n[3]=y("span",{class:"html-preview-frame__dot"},null,-1)),y("span",oe,b(t.title||S(o)("common.preview")||"Preview"),1)]),y("button",{type:"button",class:"html-preview-frame__close",onClick:n[0]||(n[0]=e=>{var n;return null==(n=t.onClose)?void 0:n.call(t)})}," × ")]),y("iframe",{class:"html-preview-frame__iframe",sandbox:r.value,referrerpolicy:"no-referrer",srcdoc:i.value},null,8,ie)])])],2)]))}}),[["__scopeId","data-v-24e66176"]]);let ae=null,ue=null,de=null,se=null,ce=null,ve=null;const fe=/* @__PURE__ */new WeakMap;let me=0;const pe=["data-markstream-enhanced"],he={class:"code-header-main"},ye=["innerHTML"],ge={class:"code-header-copy"},we={class:"code-header-title"},be={key:0,class:"code-header-caption"},Se={class:"code-editor-layer"},ke="__markstreamMonacoPassiveTouchState__",xe=1.5,Ce=/* @__PURE__ */T(/* @__PURE__ */s({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isShowPreview:{type:Boolean,default:!0},monacoOptions:{},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:t}){var n;const l=e,o=t,i=k(),r=x(U,null),s=x("markstreamHostScrollManaged",null),v=c(()=>A(l,i));const h=C(),w=c(()=>{const e=null==h?void 0:h.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:T}=D(),ne=M(null),le=M(null),oe=M(!1),ie=M(V(l.node.language)),Ce=c(()=>G(ie.value)),Me=c(()=>"plaintext"===Ce.value),Pe=M(!1),Be=M(!1),Ee=M(!1),Oe=M(!1),Le=M(!1);let Fe=!1,He=null,Ne="";const ze=M(null),$e=M(null);let Re=0,_e=0;const De=W(),Te=M(null),Ae=M("undefined"==typeof window);"undefined"!=typeof window&&P(()=>le.value,e=>{var t;if(null==(t=Te.value)||t.destroy(),Te.value=null,!e)return void(Ae.value=!1);const n=De(e,{rootMargin:"400px"});Te.value=n,Ae.value=n.isVisible.value,n.whenVisible.then(()=>{Ae.value=!0})},{immediate:!0}),B(()=>{var e;Fe=!0,function(){const e=Ne;r&&e&&(Ne="",r.markSettled(e))}(),null==(e=Te.value)||e.destroy(),Te.value=null});let We=null,je=null,Ie=()=>{},qe=()=>{},Ue=()=>null,Ve=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Ge=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Je=()=>{},Xe=()=>{},Ye=()=>{},Ke=null,Qe=()=>{var e;return String(null!=(e=l.node.language)?e:"plaintext")},Ze=()=>d(null,null,function*(){}),et=!1;const tt=[],nt=[];let lt=null;function ot(e){var t;return"diff"===(null!=(t=String(null!=e?e:"").trim().split(/\s+/,1)[0])?t:"")}const it=c(()=>{var e;return!0===l.node.diff||ot(l.node.language)||ot(Yn(String(null!=(e=l.node.raw)?e:"")))}),rt=M({removed:0,added:0}),at=c(()=>`-${rt.value.removed} +${rt.value.added}`),ut=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5}),dt=Object.freeze(u(a({},ut),{enabled:!1,revealLineCount:0}));function st(e){var t;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const n=e;return u(a(a({},ut),n),{enabled:null==(t=n.enabled)||t})}return a({},ut)}function ct(e,t){return{original:String(null!=e?e:""),updated:String(null!=t?t:"")}}function vt(e){var t;return String(null!=(t=null==e?void 0:e.message)?t:e).includes("no diff result available")}function ft(){try{const e=Ye();e&&"function"==typeof e.catch&&e.catch(e=>{vt(e)})}catch(e){vt(e)}}const mt=c(()=>{var e,t,n,o;const i=l.monacoOptions?a({},l.monacoOptions):{};if(!it.value)return i;const r=void 0===i.diffHideUnchangedRegions?a({},ut):st(i.diffHideUnchangedRegions),d=void 0===i.hideUnchangedRegions?void 0:st(i.hideUnchangedRegions),s=!1!==l.stream&&!1!==l.loading,c=s?a({},dt):r,v=s?a({},dt):d,f=a({},null!=(e=i.experimental)?e:{}),m=null!=(t=i.diffUnchangedRegionStyle)?t:"line-info",p={maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,renderSideBySide:null==(n=i.renderSideBySide)||n,diffHideUnchangedRegions:c,useInlineViewWhenSpaceIsLimited:null!=(o=i.useInlineViewWhenSpaceIsLimited)&&o,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:m,diffHunkActionsOnHover:!1,experimental:f};return u(a(u(a(a({},p),i),{experimental:f}),void 0===v?{}:{hideUnchangedRegions:v}),{diffHideUnchangedRegions:c})}),pt=c(()=>it.value?"diff":"single"),ht=M(pt.value),yt=M(!1),gt=M(!1),wt=M(!1),bt=M(!1),St=M(!1);let kt=null;const xt=c(()=>{var e;const t=null==(e=l.monacoOptions)?void 0:e.wordWrap;return null==t||"off"!==String(t)}),Ct=c(()=>{var e,t,n,l,o,i;if(!it.value)return!1;if(!1===(null==(e=mt.value)?void 0:e.renderSideBySide))return!0;if(!0!==(null==(t=mt.value)?void 0:t.useInlineViewWhenSpaceIsLimited))return!1;const r=null==(n=mt.value)?void 0:n.renderSideBySideInlineBreakpoint,a="number"==typeof r&&Number.isFinite(r)?r:900,u=(null==(o=null==(l=le.value)?void 0:l.getBoundingClientRect)?void 0:o.call(l).width)||(null==(i=le.value)?void 0:i.clientWidth)||("undefined"==typeof window?0:window.innerWidth);return u>0&&u<=a});function Mt(e){return!0===(null==s?void 0:s.value)||!!e&&(!!e.closest('[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline')||Boolean(e.closest(".vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]")))}const Pt=c(()=>Mt(le.value)),Bt=c(()=>!yt.value&&(!!wt.value||(it.value||Pt.value||!K())&&!gt.value)),Et=c(()=>Bt.value||bt.value),Ot=c(()=>Bt.value&&!bt.value),Lt=M(!1),Ft=c(()=>it.value&&!0!==l.node.diff?u(a({},l.node),{diff:!0}):l.node);"undefined"!=typeof window&&d(null,null,function*(){try{const e=yield te();if(Fe)return;if(!e)return void(yt.value=!0);const t=e.useMonaco,n=e.detectLanguage;if("function"==typeof n&&(Qe=n),"function"==typeof t){const e=fl();if(e&&l.themes&&Array.isArray(l.themes)&&!l.themes.includes(e))throw new Error("Preferred theme not in provided themes array");lt=yl();const n=t(lt);We=n.createEditor||We,je=n.createDiffEditor||je,Ie=n.updateCode||Ie,qe=n.updateDiff||qe,Ue=n.getEditor||Ue,Ve=n.getEditorView||Ve,Ge=n.getDiffEditorView||Ge,Je=n.cleanupEditor||Je,Xe=n.safeClean||n.cleanupEditor||Xe,Ye=n.refreshDiffPresentation||Ye,Ze=n.setTheme||Ze,Le.value=!0,!Fe&&ne.value&&(yield ul(ne.value))}}catch(e){if(Fe)return;yt.value=!0}});const Ht=M("number"==typeof(null==(n=l.monacoOptions)?void 0:n.fontSize)?l.monacoOptions.fontSize:Number.NaN),Nt=M(Ht.value),zt=M(null),$t=M(null),Rt=c(()=>{const e=Ht.value,t=Nt.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof t&&Number.isFinite(t)&&t>0}),_t=c(()=>{var e;const t=zt.value;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const n=null==(e=l.monacoOptions)?void 0:e.fontSize;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n;const o=Nt.value;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:12}),Dt=c(()=>{var e;const t=$t.value;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const n=null==(e=l.monacoOptions)?void 0:e.lineHeight;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:12===_t.value?18:Math.max(12,Math.round(1.5*_t.value))}),Tt=c(()=>Dt.value);function At(e){const t=String(null!=e?e:"");return t?Math.max(1,t.split(/\r\n|\n|\r/).length):1}function Wt(e){return e.startsWith("-")&&!e.startsWith("---")}function jt(e){return e.startsWith("+")&&!e.startsWith("+++")}const It=c(()=>Ct.value?function(){var e,t,n;const o=String(null!=(e=l.node.code)?e:"").split(/\r\n|\n|\r/);if(o.some(e=>Wt(e)||jt(e)))return Math.max(1,o.length);const i=String(null!=(t=l.node.originalCode)?t:"").split(/\r\n|\n|\r/),r=String(null!=(n=l.node.updatedCode)?n:"").split(/\r\n|\n|\r/);let a=0,u=i.length-1,d=r.length-1;for(;a<=u&&a<=d&&i[a]===r[a];)a++;let s=0;for(;u>=a&&d>=a&&i[u]===r[d];)s++,u--,d--;const c=Math.max(0,u-a+1),v=Math.max(0,d-a+1);return Math.max(1,a+c+v+s)}():function(){var e;const t=String(null!=(e=l.node.code)?e:"").split(/\r\n|\n|\r/);if(!t.some(e=>Wt(e)||jt(e))&&(null!=l.node.originalCode||null!=l.node.updatedCode))return Math.max(At(l.node.originalCode),At(l.node.updatedCode));let n=0,o=0;for(const l of t)Wt(l)?n++:(jt(l)||n++,o++);return Math.max(1,n,o)}()),qt=c(()=>{var e;const t=null==(e=l.monacoOptions)?void 0:e.tabSize;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:4}),Ut=c(()=>{var e;const t=null==(e=l.monacoOptions)?void 0:e.padding;return{top:"number"==typeof(null==t?void 0:t.top)&&Number.isFinite(t.top)&&t.top>0?t.top:0,bottom:"number"==typeof(null==t?void 0:t.bottom)&&Number.isFinite(t.bottom)&&t.bottom>0?t.bottom:0}}),Vt=c(()=>{const e=l.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null});function Gt(e){if(null==e)return null;const t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(Gn()))}const Jt=c(()=>it.value?Math.ceil(It.value*Tt.value):null!=Vt.value?null:Math.ceil((e=>{const t=String(null!=e?e:"");return t?Math.max(1,t.split(/\r\n|\n|\r/).length):1})(l.node.code)*(Dt.value+xe)+1)),Xt=c(()=>{if(it.value){const e=Jt.value,t=tn();return Gt(null!=t&&null!=e?Math.max(e,t):null!=t?t:e)}const e=Vt.value;return Gt(null!=e?e:Jt.value)}),Yt=c(()=>{const e=l.estimatedHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null}),Kt=M(null),Qt=M(null);function Zt(){const e=Kt.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}function en(){return it.value&&!1!==l.stream&&(!1!==l.loading||Bt.value||bt.value||St.value)}function tn(){if(!en())return null;const e=Qt.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}function nn(e){if(!en()||null==e)return;const t=Math.min(Math.ceil(e),Math.ceil(Gn()));if(!Number.isFinite(t)||t<=0)return;const n=tn();Qt.value=null==n?t:Math.max(n,t)}const ln=c(()=>{const e=Zt();return null!=e?e:Bt.value||!gt.value?Xt.value:null}),on=c(()=>{var e;const t=null==(e=l.monacoOptions)?void 0:e.fontFamily,n=Gt(Vt.value),o=Gt(Jt.value),i=a(a({fontSize:`${_t.value}px`,lineHeight:`${Tt.value}px`,tabSize:qt.value,boxSizing:"border-box",maxHeight:`${Gn()}px`,overflow:"auto",paddingTop:`${Ut.value.top}px`,paddingBottom:`${Ut.value.bottom}px`},it.value?function(e){if(null==e)return{};const t=Math.ceil(e),n=Math.ceil(Gn()),l=Math.min(t,n);return t>=n?{height:`${l}px`,minHeight:`${l}px`}:{minHeight:`${t}px`}}(Xt.value):null!=n?{height:`${n}px`,minHeight:`${n}px`}:null!=o?{minHeight:`${o}px`}:{}),"string"==typeof t&&t.trim()?{"--markstream-code-font-family":t.trim()}:{});return i["--markstream-pre-line-number-top"]=`${Ut.value.top}px`,i["--markstream-code-padding-left"]="62px",i["--markstream-pre-line-number-width"]="36px",i["--markstream-pre-line-number-gap"]="0px",it.value&&(i["--markstream-pre-diff-line-height"]=`${Tt.value}px`),i}),rn=c(()=>null!=ln.value&&(!gt.value||null!=Zt())),an=c(()=>{const e=ln.value;if(null==e)return null;if(it.value)return Math.ceil(e);const t=Yt.value,n=Vt.value;if(null==t||null==n)return Math.ceil(e);const l=Math.max(0,Math.ceil(t)-Math.ceil(n));return Math.ceil(e+l)}),un=c(()=>{if(it.value&&Bt.value)return;const e=ln.value;return rn.value&&null!=e?{minHeight:`${e}px`}:void 0});function dn(){null!=kt&&"undefined"!=typeof window&&window.clearTimeout(kt),kt=null}function sn(){if(!it.value)return!1;if(!Oe.value||!gt.value)return!1;if(bt.value||St.value)return!1;const e=ne.value;return!!e&&Pn(e)}function cn(e,t=!1,n={}){const l=Math.ceil(e),o=Zt();if(null==o)return l;const i=!0===n.allowBelowEstimatedFloor||sn();return l>=o||i?((t||i)&&Oe.value&&(Kt.value=null),l):o}function vn(){return new Promise(e=>{Q(()=>e())})}function fn(){try{const e=ne.value;if(!e)return null;const t=e.querySelector(".view-lines .view-line");if(t){const e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch(e){}return null}function mn(){var e,t,n,l,o;try{const i=it.value?null!=(n=null==(t=null==(e=Ge())?void 0:e.getModifiedEditor)?void 0:t.call(e))?n:Ge():Ve(),r=Ue(),a=null==(l=null==r?void 0:r.EditorOption)?void 0:l.fontInfo;if(i&&null!=a){const e=null==(o=i.getOption)?void 0:o.call(i,a),t=null==e?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t}}catch(i){}try{const e=ne.value;if(e){const t=e.querySelector(".view-lines .view-line");if(t)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(t).fontSize,n=e&&e.match(/^(\d+(?:\.\d+)?)/);if(n)return Number.parseFloat(n[1])}}catch(i){}}}catch(i){}return null}function pn(e){var t,n;try{const l=Ue(),o=null==(t=null==l?void 0:l.EditorOption)?void 0:t.lineHeight;if(null!=o){const t=null==(n=null==e?void 0:e.getOption)?void 0:n.call(e,o);if("number"==typeof t&&t>0)return t}}catch(i){}const l=fn();if(l&&l>0)return l;const o=Number.isFinite(Nt.value)&&Nt.value>0?Nt.value:14;return Math.max(12,Math.round(1.35*o))}function hn(e){var t,n,l;try{const l=Ue(),o=null==(t=null==l?void 0:l.EditorOption)?void 0:t.padding;if(null!=o){const t=null==(n=null==e?void 0:e.getOption)?void 0:n.call(e,o),l="number"==typeof(null==t?void 0:t.top)?t.top:0,i="number"==typeof(null==t?void 0:t.bottom)?t.bottom:0;if(l>0||i>0)return l+i}}catch(a){}const o=null==(l=mt.value)?void 0:l.padding,i="number"==typeof(null==o?void 0:o.top)?o.top:0,r="number"==typeof(null==o?void 0:o.bottom)?o.bottom:0;return i>0||r>0?i+r:it.value?24:0}function yn(e,t){return"number"!=typeof e||"number"!=typeof t||e<1||t<e?0:t-e+1}function gn(e){if(!e)return[];const t=e.split(/\r?\n/);return 1===t.length&&""===t[0]?[]:t}function wn(){var e,t;it.value?rt.value=function(e,t){const n=gn(e),l=gn(t);let o=0,i=n.length-1,r=l.length-1;for(;o<=i&&o<=r&&n[o]===l[o];)o++;for(;i>=o&&r>=o&&n[i]===l[r];)i--,r--;return{removed:Math.max(0,i-o+1),added:Math.max(0,r-o+1)}}(String(null!=(e=l.node.originalCode)?e:""),String(null!=(t=l.node.updatedCode)?t:"")):rt.value={removed:0,added:0}}function bn(){var e;if(it.value)try{const t=Ge(),n=null==(e=null==t?void 0:t.getLineChanges)?void 0:e.call(t);if(!Array.isArray(n))return void wn();let l=0,o=0;for(const e of n)l+=yn(e.originalStartLineNumber,e.originalEndLineNumber),o+=yn(e.modifiedStartLineNumber,e.modifiedEndLineNumber);rt.value={removed:l,added:o}}catch(t){wn()}else rt.value={removed:0,added:0}}function Sn(){var e;if(Number.isFinite(Nt.value)&&Nt.value>0&&Number.isFinite(Ht.value))return Nt.value;const t=mn();return"number"==typeof(null==(e=l.monacoOptions)?void 0:e.fontSize)?(Ht.value=l.monacoOptions.fontSize,Nt.value=l.monacoOptions.fontSize,Nt.value):t&&t>0?(Ht.value=t,Nt.value=t,t):(Ht.value=12,Nt.value=12,12)}function kn(){const e=Sn(),t=Math.min(36,e+1);Nt.value=t}function xn(){const e=Sn(),t=Math.max(10,e-1);Nt.value=t}function Cn(){Sn(),Number.isFinite(Ht.value)&&(Nt.value=Ht.value)}function Mn(){var e,t,n,l,o,i,r,a,u,d,s,c,v,f;try{const m=it.value?Ge():null,p=it.value?m:Ve();if(!p)return null;if((null==m?void 0:m.getOriginalEditor)&&(null==m?void 0:m.getModifiedEditor)){const v=null==(e=m.getOriginalEditor)?void 0:e.call(m),f=null==(t=m.getModifiedEditor)?void 0:t.call(m);null==(n=null==v?void 0:v.layout)||n.call(v),null==(l=null==f?void 0:f.layout)||l.call(f);const p=(null==(o=null==v?void 0:v.getContentHeight)?void 0:o.call(v))||0,h=(null==(i=null==f?void 0:f.getContentHeight)?void 0:i.call(f))||0,y=Math.max(p,h);if(y>0)return Math.ceil(y+1);const g=(null==(u=null==(a=null==(r=null==v?void 0:v.getModel)?void 0:r.call(v))?void 0:a.getLineCount)?void 0:u.call(a))||1,w=(null==(c=null==(s=null==(d=null==f?void 0:f.getModel)?void 0:d.call(f))?void 0:s.getLineCount)?void 0:c.call(s))||1,b=Math.max(g,w),S=Math.max(pn(v),pn(f));return Math.ceil(b*(S+xe)+0+1)}if(null==p?void 0:p.getContentHeight){null==(v=null==p?void 0:p.layout)||v.call(p);const e=p.getContentHeight();if(e>0)return Math.ceil(e+1)}const h=null==(f=null==p?void 0:p.getModel)?void 0:f.call(p);let y=1;h&&"function"==typeof h.getLineCount&&(y=h.getLineCount());const g=pn(p);return Math.ceil(y*(g+xe)+0+1)}catch(m){return null}}function Pn(e){if("undefined"==typeof window)return!1;const t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return!1;const n=e.querySelectorAll(".editor.modified .diff-hidden-lines .center, .stream-monaco-diff-unchanged-bridge");for(const l of Array.from(n)){if(!(l instanceof HTMLElement))continue;const e=window.getComputedStyle(l);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const n=l.getBoundingClientRect();if(!(n.width<=0||n.height<=0||n.bottom<=t.top||n.top>=t.bottom))return!0}return!1}function Bn(e){var t;const n=String(null!=e?e:"").trim(),l=null==(t=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i))?void 0:t[1];if(l){const e=3===l.length?l.split("").map(e=>`${e}${e}`).join(""):l;return.2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}const o=n.match(/\d+(?:\.\d+)?/g);if(!o||o.length<3)return null;const[i,r,a]=o.slice(0,3).map(Number);return.2126*i+.7152*r+.0722*a}function En(){var e;const t=null==(e=ne.value)?void 0:e.parentElement;return t instanceof HTMLElement?t:null}function On(e,t){var n;null==t||!Number.isFinite(t)||t<=0||null==(n=En())||n.style.setProperty(e,`${t}px`)}function Ln(){var e,t,n;if(Fn())return;const l=mn();l&&l>0&&(zt.value=l,Nt.value=l,Ht.value=l);try{const l=pn(it.value?null!=(n=null==(t=null==(e=Ge())?void 0:e.getModifiedEditor)?void 0:t.call(e))?n:Ge():Ve());l&&l>0&&($t.value=l)}catch(o){}try{const e=fn();e&&e>0&&($t.value=e)}catch(o){}}function Fn(){return it.value&&Et.value}function Hn(){var e,t,n,l,o,i,r,a;const u=ne.value,d=le.value;if(!u||!d)return;const s=u,c=u.querySelector(".monaco-editor")||u,v=c.querySelector(".monaco-editor-background")||c,f=c.querySelector(".view-lines")||c;let m=null,p=null,h=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(m=window.getComputedStyle(c),p=v===c?m:window.getComputedStyle(v),h=f===c?m:window.getComputedStyle(f))}catch(k){m=null,p=null,h=null}const y=String(null!=(e=null==m?void 0:m.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),g=String(null!=(t=null==m?void 0:m.getPropertyValue("--vscode-editor-background"))?t:"").trim(),w=String(null!=(l=null!=(n=null==m?void 0:m.getPropertyValue("--vscode-editor-selectionBackground"))?n:null==m?void 0:m.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?l:"").trim(),b=y||String(null!=(i=null!=(o=null==h?void 0:h.color)?o:null==m?void 0:m.color)?i:"").trim(),S=g||String(null!=(a=null!=(r=null==p?void 0:p.backgroundColor)?r:null==m?void 0:m.backgroundColor)?a:"").trim();return it.value?(b?(d.style.setProperty("--markstream-diff-editor-fg",b),s.style.setProperty("--vscode-editor-foreground",b),s.style.setProperty("--stream-monaco-editor-fg",b)):(d.style.removeProperty("--markstream-diff-editor-fg"),s.style.removeProperty("--vscode-editor-foreground"),s.style.removeProperty("--stream-monaco-editor-fg")),S?(d.style.setProperty("--markstream-diff-editor-bg",S),d.style.setProperty("--markstream-diff-panel-bg",S),d.style.setProperty("--markstream-diff-panel-bg-soft",S),d.style.setProperty("--markstream-diff-panel-bg-strong",S),s.style.setProperty("--vscode-editor-background",S),s.style.setProperty("--stream-monaco-editor-bg",S),s.style.setProperty("--stream-monaco-fixed-editor-bg",S),s.style.setProperty("--stream-monaco-panel-bg",S),s.style.setProperty("--stream-monaco-panel-bg-soft",S),s.style.setProperty("--stream-monaco-panel-bg-strong",S),s.style.backgroundColor=S):(d.style.removeProperty("--markstream-diff-editor-bg"),d.style.removeProperty("--markstream-diff-panel-bg"),d.style.removeProperty("--markstream-diff-panel-bg-soft"),d.style.removeProperty("--markstream-diff-panel-bg-strong"),s.style.removeProperty("--vscode-editor-background"),s.style.removeProperty("--stream-monaco-editor-bg"),s.style.removeProperty("--stream-monaco-fixed-editor-bg"),s.style.removeProperty("--stream-monaco-panel-bg"),s.style.removeProperty("--stream-monaco-panel-bg-soft"),s.style.removeProperty("--stream-monaco-panel-bg-strong"),s.style.backgroundColor=""),void(w?s.style.setProperty("--vscode-editor-selectionBackground",w):s.style.removeProperty("--vscode-editor-selectionBackground"))):function(e,t,n){if(!Me.value)return!1;const l=Bn(e),o=Bn(t);return n?null!=l&&l>170||null!=o&&o<110:null!=l&&l<85||null!=o&&o>190}(S,b,d.classList.contains("is-dark"))?(s.style.removeProperty("--vscode-editor-foreground"),s.style.removeProperty("--vscode-editor-background"),void s.style.removeProperty("--vscode-editor-selectionBackground")):(b&&s.style.setProperty("--vscode-editor-foreground",b),S&&s.style.setProperty("--vscode-editor-background",S),void(w&&s.style.setProperty("--vscode-editor-selectionBackground",w)))}let Nn=0,zn=0;const $n=/auto|scroll|overlay/i;function Rn(e,t,n){var l;if("undefined"==typeof window)return;if(it.value)return;if(function(e){return Pt.value||Mt(e)}(e))return;const o=Math.ceil(t),i=Math.ceil(n)-o;if(Math.abs(i)<=1)return;const r=function(e){var t,n;if("undefined"==typeof window)return null;const l=null!=(t=null==e?void 0:e.ownerDocument)?t:document,o=l.scrollingElement||l.documentElement||l.body;let i=null!=(n=null==e?void 0:e.parentElement)?n:null;for(;i&&i!==l.body&&i!==o;){const e=window.getComputedStyle(i),t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();if($n.test(t)||$n.test(n))return i;i=i.parentElement}return o}(e);if(!r)return;const a=null!=(l=e.ownerDocument)?l:document,u=r===a.body||r===a.documentElement||r===a.scrollingElement,d=u?0:r.getBoundingClientRect().top;e.getBoundingClientRect().top-d>=0||(u&&"function"==typeof window.scrollBy?window.scrollBy(0,i):r.scrollTop+=i)}function _n(){try{const e=ne.value;if(!e)return;const t=e.getBoundingClientRect().height,n=Mn();if(null!=n&&n>0){const l=cn(n,!0),o=Zt();return e.style.minHeight=null!=o?`${o}px`:"0px",e.style.height=`${l}px`,e.style.maxHeight="none",e.style.overflow="visible",void Rn(e,t,l)}const l=Zt();null!=l&&(e.style.minHeight=`${l}px`,e.style.height=`${l}px`,e.style.maxHeight="none",e.style.overflow="visible",Rn(e,t,l))}catch(e){}}function Dn(){for(var e,t;tt.length>0;)try{null==(t=null==(e=tt.pop())?void 0:e.dispose)||t.call(e)}catch(n){}null!=He&&(Z(He),He=null)}function Tn(){for(var e;nt.length>0;)try{null==(e=nt.pop())||e()}catch(t){}}function An(e=!1){Be.value||(Pe.value?_n():function(){var e;try{const t=ne.value;if(!t)return;const n=t.getBoundingClientRect().height,l=Gn(),o=Math.ceil((null==(e=t.getBoundingClientRect)?void 0:e.call(t).height)||0),i=it.value?function(){var e,t,n,l,o,i,r,a;try{const u=Ge(),d=null==(e=null==u?void 0:u.getOriginalEditor)?void 0:e.call(u),s=null==(t=null==u?void 0:u.getModifiedEditor)?void 0:t.call(u);if(!d||!s)return null;const c=(null==(o=null==(l=null==(n=d.getModel)?void 0:n.call(d))?void 0:l.getLineCount)?void 0:o.call(l))||1,v=(null==(a=null==(r=null==(i=s.getModel)?void 0:i.call(s))?void 0:r.getLineCount)?void 0:a.call(r))||1,f=Math.max(c,v),m=Math.max(pn(d),pn(s)),p=Math.max(hn(d),hn(s));return Math.ceil(f*(m+xe)+p+0+1)}catch(u){return null}}():null,r=it.value&&Pn(t),a=r&&Oe.value&>.value&&!bt.value&&!St.value;if(r||($e.value=null),_e>0&&(_e--,null!=ze.value))return void Rn(t,n,Un(t,ze.value,l,{allowBelowEstimatedFloor:a}));const u=it.value?function(e){var t,n;if("undefined"==typeof window)return null;try{const l=e.getBoundingClientRect(),o=window.getComputedStyle(e);if("none"===o.display||"hidden"===o.visibility)return null;const i=[".editor.original .view-lines .view-line",".editor.modified .view-lines .view-line",".editor.original .view-zones > div",".editor.modified .view-zones > div",".editor.original .margin-view-zones > div",".editor.modified .margin-view-zones > div",".editor.original .diff-hidden-lines",".editor.modified .diff-hidden-lines",".stream-monaco-diff-unchanged-bridge"];let r=0;for(const t of Array.from(e.querySelectorAll(i.join(",")))){if(!(t instanceof HTMLElement))continue;const e=window.getComputedStyle(t);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const n=t.getBoundingClientRect();n.height<=0||n.bottom<=l.top||(r=Math.max(r,n.bottom-l.top))}if(r>0)return Math.ceil(r);const a=e.querySelector(".monaco-diff-editor"),u=null!=(n=null==(t=null==a?void 0:a.getBoundingClientRect)?void 0:t.call(a).height)?n:0;return u>0?Math.ceil(u+1):null}catch(l){return null}}(t):null,d=it.value?r?u:null!=i?Math.max(null!=u?u:0,i):u:Mn();if(null!=d&&d>0){const e=null!=$e.value&&Date.now()<Re&&d>=l-1,i=r&&o>0&&o<l-1&&d>=l-1,u=Un(t,e?$e.value:i?o:d,l,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:a});return r&&u<l-1&&($e.value=u,Re=Date.now()+160),void Rn(t,n,u)}if(null!=ze.value)return void Rn(t,n,Un(t,ze.value,l,{allowBelowEstimatedFloor:a}));const s=r?o:Math.max(o,null!=i&&i>0?i:0);if(s>0){const e=null!=$e.value&&Date.now()<Re&&s>=l-1,i=r&&o>0&&o<l-1&&s>=l-1,u=Un(t,e?$e.value:i?o:s,l,{allowBelowEstimatedFloor:a});return r&&u<l-1&&($e.value=u,Re=Date.now()+160),void Rn(t,n,u)}const c=Zt();if(null!=c)return void Rn(t,n,Un(t,c,l,{allowBelowEstimatedFloor:a}));const v=Number.parseFloat(t.style.height);!Number.isNaN(v)&&v>0?Rn(t,n,Un(t,v,l,{allowBelowEstimatedFloor:a})):it.value||Rn(t,n,Un(t,l,l))}catch(t){}}())}function Wn(){Nn=0,zn=0}function jn(e=!1){var t,n,l;const o=ne.value;if(!o)return;const i=it.value?Ge():Ve();if(i&&"function"==typeof i.layout)try{const r=null==(t=o.getBoundingClientRect)?void 0:t.call(o),a=Math.ceil((null!=(n=null==r?void 0:r.width)?n:0)||o.clientWidth||0),u=Math.ceil((null!=(l=null==r?void 0:r.height)?l:0)||o.clientHeight||Number.parseFloat(o.style.height||"")||0);if(a>0&&u>0){if(!e&&a===Nn&&u===zn)return;Nn=a,zn=u,i.layout({width:a,height:u})}else Wn(),i.layout()}catch(r){}}function In(){if(!it.value)return void Tn();const e=ne.value;if(!e)return void Tn();const t=e.querySelector(".monaco-diff-editor");if(!t||t.classList.contains("side-by-side"))return void Tn();const n=Array.from(t.querySelectorAll(".editor.original .diff-hidden-lines")),l=Array.from(t.querySelectorAll(".editor.modified .diff-hidden-lines")),o=Math.min(n.length,l.length);for(let i=0;i<o;i++){const e=l[i],t=e.querySelector("a"),n=e.querySelector(".center > div:first-child"),o=e.querySelector(".center");if(!t||!n||!o)continue;if(o.querySelector(".markstream-inline-fold-proxy"))continue;const r=document.createElement("button");r.type="button",r.className="markstream-inline-fold-proxy",r.dataset.markstreamInlineFoldProxy="true";const a=t.getAttribute("title")||"Show Unchanged Region";r.title=a,r.setAttribute("aria-label",a);const u=e=>{e.preventDefault(),e.stopPropagation()},d=e=>{e.preventDefault(),e.stopPropagation(),t.click(),Q(()=>qn())},s=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),t.click(),Q(()=>qn()))};r.addEventListener("mousedown",u),r.addEventListener("click",d),r.addEventListener("keydown",s),o.appendChild(r),nt.push(()=>{r.removeEventListener("mousedown",u),r.removeEventListener("click",d),r.removeEventListener("keydown",s),r.parentElement===o&&o.removeChild(r)})}}function qn(e=!1){null==He&&(He=Q(()=>{He=null,Q(()=>{In(),An(e),jn()})}))}function Un(e,t,n,l={}){nn(t);const o=tn(),i=null!=o?Math.max(t,o):t,r=Math.min(i,n),a=!0===l.allowBelowEstimatedFloor||sn(),u=cn(r,!0===l.clearEstimatedFloor,{allowBelowEstimatedFloor:a}),d=Zt();if(e.style.minHeight=null==d||a?"0px":`${Math.min(d,Math.ceil(n))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(n)}px`,it.value)e.style.overflow="hidden";else{const t=i>n+1;e.style.overflow=t?"auto":"hidden"}return u}function Vn(e,t,n){return d(this,null,function*(){try{return void(yield qe(e,t,n))}catch(l){if(!vt(l))throw l}if(yield E(),yield vn(),!Fe&&it.value)try{yield qe(e,t,n)}catch(l){if(!vt(l))throw l}})}function Gn(){var e,t;const n=null!=(t=null==(e=l.monacoOptions)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof n)return n;const o=String(n).match(/^(\d+(?:\.\d+)?)/);return o?Number.parseFloat(o[1]):500}const Jn=c(()=>l.isShowPreview&&("html"===ie.value||"svg"===ie.value));P(()=>l.node.language,e=>{ie.value=V(e)}),P(()=>[l.node.originalCode,l.node.updatedCode,it.value],()=>{wn(),Q(()=>bn())},{immediate:!0}),P(()=>[it.value,l.stream,l.loading,Bt.value,bt.value,St.value,Jt.value],()=>{en()?nn(Jt.value):Qt.value=null},{immediate:!0}),P(()=>[l.node.originalCode,l.node.updatedCode,Ce.value,it.value],e=>d(null,[e],function*([e,t,n,o]){if(!1===l.stream||!o)return;if(We&&!Ee.value&&ne.value)try{yield ul(ne.value)}catch(a){}const i=ct(String(null!=e?e:""),String(null!=t?t:"")),r=!1===l.loading;r&&gl();try{yield Vn(i.original,i.updated,Ce.value),jn(!0)}catch(u){return}if(r){if(Fe||!it.value)return;ft(),In(),bn(),qn()}Pe.value&&Q(()=>_n())})),P(()=>l.node.code,e=>d(null,null,function*(){if(!1!==l.stream&&(ie.value||(ie.value=V(Qe(e))),!it.value)){if(We&&!Ee.value&&ne.value)try{yield ul(ne.value)}catch(t){}Ie(e,Ce.value),Pe.value&&Q(()=>_n())}}));const Xn=c(()=>{const e=ie.value;return e?J[e]||e.charAt(0).toUpperCase()+e.slice(1):J[""]||"Plain Text"});function Yn(e){var t,n;const l=null!=(n=null==(t=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:t.trim())?n:"";if(l.length<3)return"";const o=l[0];if("`"!==o&&"~"!==o||l[1]!==o||l[2]!==o)return"";let i=3;for(;l[i]===o;)i+=1;return l.slice(i).trim()}const Kn=c(()=>{var e;return function(e){const t=Yn(e);if(!t)return"";const n=t.split(/\s+/).filter(Boolean);if(!n.length)return"";const l="diff"===n[0]?n.slice(1):n;for(const o of l){const e=o.includes(":")?o.slice(o.indexOf(":")+1):o;if(e&&/[./\\-]/.test(e))return e}return""}(String(null!=(e=l.node.raw)?e:""))}),Qn=c(()=>Kn.value||Xn.value),Zn=c(()=>Kn.value?it.value?`Diff / ${Xn.value}`:Xn.value:""),el=c(()=>(X.value,Y(ie.value||""))),tl=c(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n=t(l.minWidth),o=t(l.maxWidth);if(n&&(e.minWidth=n),o&&(e.maxWidth=o),rn.value&&!it.value){const t=an.value;null!=t&&(e.minHeight=`${t}px`)}return it.value||(e.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))",e.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg))",e.borderColor="var(--markstream-code-border-color)"),e}),nl=c(()=>!1!==l.showTooltips);function ll(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(l.node.code)),oe.value=!0,o("copy",l.node.code),setTimeout(()=>{oe.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function ol(e){if(Pe.value=!Pe.value,e&&nl.value){const t=function(e){const t=e.currentTarget||e.target;return!t||t.disabled?null:t}(e);if(t){const e=Pe.value?T("common.collapse")||"Collapse":T("common.expand")||"Expand";q(t,e,"top",!1,void 0,l.isDark)}}const t=it.value?Ge():Ve(),n=ne.value;t&&n&&(Pe.value?(al(!0),n.style.maxHeight="none",n.style.overflow="visible",An(!0)):(al(!1),n.style.overflow=it.value?"hidden":"auto",An(!0)))}function il(){var e,t,n;if(Be.value=!Be.value,Be.value){if(ne.value){const n=Math.ceil((null==(t=(e=ne.value).getBoundingClientRect)?void 0:t.call(e).height)||0);n>0&&(ze.value=n)}al(!1)}else{Pe.value&&al(!0),ne.value&&null!=ze.value&&(ne.value.style.height=`${ze.value}px`);const e=it.value?Ge():Ve();try{null==(n=null==e?void 0:e.layout)||n.call(e)}catch(l){}_e=2,Q(()=>{An(!0)})}}function rl(){if(!Jn.value)return;const e=ie.value;if(w.value){const t="html"===e?"text/html":"image/svg+xml",n="html"===e?T("artifacts.htmlPreviewTitle")||"HTML Preview":T("artifacts.svgPreviewTitle")||"SVG Preview";return void o("previewCode",{node:l.node,artifactType:t,artifactTitle:n,id:`temp-${e}-${Date.now()}`})}"html"===e&&(Lt.value=!Lt.value)}function al(e){var t,n;try{if(it.value){const n=Ge();null==(t=null==n?void 0:n.updateOptions)||t.call(n,{automaticLayout:e})}else{const t=Ve();null==(n=null==t?void 0:t.updateOptions)||n.call(t,{automaticLayout:e})}}catch(l){}}function ul(e){if(!We||Fe)return null;if(Ke)return Ke;if(Ee.value&&Oe.value)return Promise.resolve();Ee.value=!0,function(){const e=v.value;r&&e&&Ne!==e&&(Ne&&r.markSettled(Ne),Ne=e,r.markPending(e))}();const t=d(null,null,function*(){yield function(e){return d(this,null,function*(){var t;if("undefined"==typeof window)return yield e();try{const n=null==(t=window.Element)?void 0:t.prototype,l=null==n?void 0:n.addEventListener;if(!n||!l)return yield e();const o=function(){const e=window,t=e[ke];if(t)return t;const n={depth:0,original:null};return e[ke]=n,n}();0===o.depth&&(o.original=l,n.addEventListener=function(e,t,n){var i;const r=null!=(i=o.original)?i:l;return"touchstart"===e&&function(e,t){if(!e)return!1;const n=e;return!("function"!=typeof n.closest||!n.closest(".monaco-editor, .monaco-diff-editor")||t&&"object"==typeof t&&"passive"in t)}(this,n)?r.call(this,e,t,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(a({},e),{passive:!0}):{passive:!0}}(n)):r.call(this,e,t,n)}),o.depth++;try{return yield e()}finally{o.depth=Math.max(0,o.depth-1),0===o.depth&&o.original&&n.addEventListener!==o.original&&(n.addEventListener=o.original,o.original=null)}}catch(n){return yield e()}})}(()=>function(e){return d(this,null,function*(){var t,n,o;if(!We||Fe)return;if(wt.value=!1,gt.value=!1,bt.value=!1,St.value=!1,dn(),zt.value=null,$t.value=null,function(){const e=En();e&&(e.style.removeProperty("--stream-monaco-line-number-left"),e.style.removeProperty("--stream-monaco-line-number-width"),e.style.removeProperty("--stream-monaco-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-original-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-modified-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-original-scrollable-left"),e.style.removeProperty("--stream-monaco-modified-scrollable-left"))}(),Wn(),function(){const e=Xt.value;Kt.value=Oe.value||null==e?null:e}(),Dn(),Tn(),function(e){e.replaceChildren()}(e),Fe)return;if(it.value){!function(){if(et||"undefined"==typeof window)return;et=!0;const e=e=>{var t;vt("reason"in e?e.reason:null!=(t=e.error)?t:e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener("error",e,!0),window.addEventListener("unhandledrejection",e,!0)}(),Xe();const o=ct(String(null!=(t=l.node.originalCode)?t:""),String(null!=(n=l.node.updatedCode)?n:""));je?yield je(e,o.original,o.updated,Ce.value):yield We(e,l.node.code,Ce.value)}else yield We(e,l.node.code,Ce.value);if(Fe)return;const i=it.value?Ge():Ve();if("number"==typeof(null==(o=l.monacoOptions)?void 0:o.fontSize))null==i||i.updateOptions({fontSize:l.monacoOptions.fontSize,automaticLayout:!1}),Ht.value=l.monacoOptions.fontSize,Nt.value=l.monacoOptions.fontSize;else if(!Fn()){const e=mn();e&&e>0?(Ht.value=e,Nt.value=e):(Ht.value=12,Nt.value=12)}Ln(),Pe.value||Be.value||An(!1),yield function(){return d(this,null,function*(){null!=Zt()&&(In(),An(!1),yield E(),yield vn(),In(),An(!1),yield vn(),In(),An(!1))})}(),Fe||(Oe.value=!0,function(){var e,t,n,l,o;if(Dn(),it.value){const l=Ge(),o=null==(e=null==l?void 0:l.getOriginalEditor)?void 0:e.call(l),i=null==(t=null==l?void 0:l.getModifiedEditor)?void 0:t.call(l),a=(e,t)=>{try{const n=null==e?void 0:e[t];if("function"!=typeof n)return;const l=n.call(e,()=>qn());l&&tt.push(l)}catch(n){}};try{const e=null==(n=null==l?void 0:l.onDidUpdateDiff)?void 0:n.call(l,()=>{qn(),Q(()=>bn())});e&&tt.push(e)}catch(r){}return a(o,"onDidContentSizeChange"),a(i,"onDidContentSizeChange"),a(o,"onDidLayoutChange"),void a(i,"onDidLayoutChange")}const i=Ve();try{const e=null==(l=null==i?void 0:i.onDidContentSizeChange)?void 0:l.call(i,()=>qn());e&&tt.push(e)}catch(r){}try{const e=null==(o=null==i?void 0:i.onDidLayoutChange)?void 0:o.call(i,()=>qn());e&&tt.push(e)}catch(r){}}(),Hn(),Ln(),In(),bn(),qn(),yield function(){return d(this,null,function*(){In(),An(!1),yield E(),yield vn(),In(),An(!1),yield vn(),In(),An(!1)})}(),yield function(){return d(this,null,function*(){var e;if(it.value){for(let n=0;n<8;n++){if(Fe)return;const l=ne.value,o=Ge();let i=!1;try{const t=null==(e=null==o?void 0:o.getLineChanges)?void 0:e.call(o);i=Array.isArray(t)}catch(t){i=!1}const r=Boolean(null==l?void 0:l.querySelector(".monaco-diff-editor")),a=Boolean(null==l?void 0:l.querySelector(".monaco-diff-editor .view-lines .view-line"));if(r&&a&&i){if(yield E(),yield vn(),Fe)return;try{ft(),In(),bn(),qn()}catch(t){}return}if(n>=1&&!r)return;yield E(),yield vn()}if(!Fe)try{ft(),In(),bn(),qn()}catch(t){}}})}(),Fe||(Ln(),function(){if(!it.value)return;const e=ne.value;if(!e)return;const t=e.querySelector(".monaco-diff-editor");function n(e,t,n,l){const o=e.querySelector(t);if(!o)return;const i=o.getBoundingClientRect();if(i.width<=0)return;const r=o.querySelector(".line-numbers"),a=o.querySelector(".view-lines .view-line"),u=o.querySelector(".margin");let d=null;if(a?(d=a.getBoundingClientRect().left-i.left,On(n,d)):u&&(d=u.getBoundingClientRect().width,On(n,d)),r){const e=r.getBoundingClientRect();if(e.width>=20&&e.width<=64&&On("--stream-monaco-line-number-width",e.width),null!=d){const t=d-(e.right-i.left);Number.isFinite(t)&&t>=0&&t<=32&&(On(l,t),On("--stream-monaco-line-number-gap-to-code",t))}}}t&&(n(t,".editor.original","--stream-monaco-original-scrollable-left","--stream-monaco-original-line-number-gap-to-code"),n(t,".editor.modified","--stream-monaco-modified-scrollable-left","--stream-monaco-modified-line-number-gap-to-code"))}(),yield E(),function(){var e;if(!it.value||!Bt.value)return;const t=ne.value,n=null==(e=le.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!t||!n)return;const l=Math.ceil(n.getBoundingClientRect().height);!Number.isFinite(l)||l<=0||(t.style.height=`${l}px`,t.style.minHeight=`${l}px`)}(),yield vn(),yield function(){return d(this,null,function*(){if(it.value){if(bt.value=!0,St.value=!1,gt.value=!0,yield E(),yield vn(),!Fe){if(jn(!0),St.value=!0,dn(),"undefined"==typeof window)return bt.value=!1,void(St.value=!1);kt=window.setTimeout(()=>{kt=null,bt.value=!1,St.value=!1,Q(()=>{Ln(),In(),qn()})},120)}}else gt.value=!0})}()))})}(e))}).finally(()=>{Ke===t&&(Ke=null),function(){const e=Ne;r&&e&&(Ne="",E(()=>{var t,n;if(!Fe){const l=null!=(n=null==(t=le.value)?void 0:t.offsetHeight)?n:0;l>0&&r.reportHeight(e,l)}r.markSettled(e)}))}()});return Ke=t,t}P(nl,e=>{e||j()}),P(()=>Nt.value,(e,t)=>{const n=it.value?Ge():Ve();n&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(n.updateOptions({fontSize:e}),Be.value||An(!0))},{flush:"post",immediate:!1});const dl=P(()=>[ne.value,it.value,l.stream,l.loading,Le.value,Ae.value],e=>d(null,[e],function*([e,t,n,l,o,i]){if(!e||!We)return;if(!i)return;if(!1===n&&!1!==l)return;const r=ul(e);if(r){try{yield r}catch(a){Oe.value=!1,gt.value=!1,wt.value=!0}dl()}}));function sl(e){return!!e&&"object"==typeof e&&"light"in e&&"dark"in e}function cl(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function vl(e,t){if(e===t)return!0;const n=cl(e),l=cl(t);return!!n&&n===l}function fl(){var e;const t=function(){if(void 0!==l.theme){const e=l.theme;return sl(e)?l.isDark?e.dark:e.light:e}return l.isDark?l.darkTheme:l.lightTheme}(),n=null==(e=mt.value)?void 0:e.theme,o=null!=t?t:n;if(null!=o&&"object"==typeof o)return o;const i=Array.isArray(l.themes)?l.themes:[];if(!i.length||null==o)return o;const r=cl(o),a=i.map(e=>cl(e)).filter(e=>!!e);if(!r||a.includes(r))return o;const u=cl(n);return null!=n&&u&&a.includes(u)?n:i[0]}P(pt,(e,t)=>d(null,null,function*(){if(e===t)return;if(ht.value=e,!We||!ne.value)return;if(!Ee.value)return;if(!1===l.stream&&!1!==l.loading)return;if(!Ae.value)return;const n=Ke;if(n){try{yield n}catch(o){}if(Fe||!ne.value)return}try{Oe.value=!1,gt.value=!1,Ee.value=!1,Dn(),Tn(),Xe(),yield E(),yield ul(ne.value)}catch(i){Oe.value=!1,gt.value=!1,wt.value=!0}}));const ml=c(()=>(void 0!==l.theme?!sl(l.theme):vl(l.darkTheme,l.lightTheme))?function(e){var t,n;if(e&&"object"==typeof e&&(null==(t=e.colors)?void 0:t["editor.background"])){const t=Bn(e.colors["editor.background"]);if(null!=t)return t<128}const o=(null!=(n=cl(e))?n:"").toLowerCase();return o?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>o.includes(e))&&!["light","latte","dawn","lotus"].some(e=>o.includes(e)):!!l.isDark}(fl()):!!l.isDark),pl=c(()=>{var e;if(!it.value)return ml.value?"dark":"light";const t=null==(e=mt.value)?void 0:e.diffAppearance;return"light"===t||"dark"===t?t:ml.value?"dark":"light"}),hl=c(()=>it.value?"dark"===pl.value:ml.value);function yl(){return u(a(u(a({wordWrap:"on",wrappingIndent:"same",themes:l.themes},mt.value||{}),{theme:fl()}),it.value?{diffAppearance:pl.value}:{}),{onThemeChange(){Hn()}})}function gl(){const e=yl();if(!lt)return lt=e,lt;for(const t of Object.keys(lt))t in e||delete lt[t];return Object.assign(lt,e),lt}const wl=c(()=>{var e,t,n,o,i,r,u,d,s,c,v,f,m,p,h;return JSON.stringify({diffLineStyle:null!=(t=null==(e=mt.value)?void 0:e.diffLineStyle)?t:"background",diffUnchangedRegionStyle:null!=(o=null==(n=mt.value)?void 0:n.diffUnchangedRegionStyle)?o:"line-info",diffHideUnchangedRegions:void 0===(null==(i=l.monacoOptions)?void 0:i.diffHideUnchangedRegions)?a({},ut):st(l.monacoOptions.diffHideUnchangedRegions),renderSideBySide:null==(u=null==(r=mt.value)?void 0:r.renderSideBySide)||u,useInlineViewWhenSpaceIsLimited:null!=(s=null==(d=mt.value)?void 0:d.useInlineViewWhenSpaceIsLimited)&&s,enableSplitViewResizing:null==(v=null==(c=mt.value)?void 0:c.enableSplitViewResizing)||v,ignoreTrimWhitespace:null==(m=null==(f=mt.value)?void 0:f.ignoreTrimWhitespace)||m,originalEditable:null!=(h=null==(p=mt.value)?void 0:p.originalEditable)&&h})});return P(()=>[l.monacoOptions,Ae.value],()=>{var e,t;if(gl(),!We||!Ae.value)return;const n=it.value?Ge():Ve(),o="number"==typeof(null==(e=l.monacoOptions)?void 0:e.fontSize)?l.monacoOptions.fontSize:Number.isFinite(Nt.value)?Nt.value:void 0;"number"==typeof o&&Number.isFinite(o)&&o>0&&(null==(t=null==n?void 0:n.updateOptions)||t.call(n,{fontSize:o})),An(!1)},{deep:!0}),P(()=>[fl(),pl.value,Le.value,Ee.value,Ae.value],([e],t)=>{Le.value&&Ee.value&&Ae.value&&function(e={}){if(e.appearanceOnly)return;gl();const t=fl(),n=()=>{it.value&&ft(),Q(()=>{Hn(),qn()})};t?function(e,t){const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&"name"in e)return String(e.name);if("object"==typeof e){const n=fe.get(e);if(n)return n;try{const t=JSON.stringify(e);if(t)return fe.set(e,t),t}catch(t){}const l="__theme_"+ ++me;return fe.set(e,l),l}return String(e)}(t);return n?(ve=e,ae||ce!==n?ae?(se===n||ue===n||(de=t,se=n),ae):(de=t,se=n,ae=d(null,null,function*(){for(;se&&null!=de;){const n=de,l=se;if(de=null,se=null,ce!==l)try{ue=l,yield(null!=ve?ve:e)(n),ce=l}catch(t){}}}).finally(()=>{ae=null,ue=null}),ae):Promise.resolve()):Promise.resolve()}(Ze,t).then(n).catch(e=>{}):n()}({appearanceOnly:null!=t&&vl(e,t[0])})},{flush:"post"}),P(()=>[wl.value,Le.value,Ae.value],(e,t)=>d(null,[e,t],function*([e,t,n],[o]){if(gl(),!t||!n)return;if(!We||!ne.value)return;if(!Ee.value)return;if(e===o)return;if(!1===l.stream&&!1!==l.loading)return;const i=Ke;if(i){try{yield i}catch(r){}if(Fe||!ne.value)return}try{Oe.value=!1,gt.value=!1,Ee.value=!1,Dn(),Tn(),Xe(),yield E(),yield ul(ne.value)}catch(a){Oe.value=!1,gt.value=!1,wt.value=!0}}),{flush:"post"}),P(()=>[l.loading,Ae.value],(e,t)=>d(null,[e,t],function*([e,t],n){if(!t)return;const o=null==n?void 0:n[0];if(!1===o&&!1!==e&&it.value&&Ee.value&&(yield E(),Q(()=>{d(null,null,function*(){const e=Ke;if(e)try{yield e}catch(t){}!Fe&&it.value&&!1!==l.loading&&(gl(),ft(),qn())})})),e)return;const i=void 0!==o&&!1!==o;yield E(),Q(()=>{d(null,null,function*(){var e,t,n;try{if(i&&Ee.value)if(it.value&&ne.value){const n=Ke;if(n)try{yield n}catch(o){}gl();const i=ct(String(null!=(e=l.node.originalCode)?e:""),String(null!=(t=l.node.updatedCode)?t:""));if(yield Vn(i.original,i.updated,Ce.value),Fe||!it.value)return;ft(),jn(!0),In(),bn(),qn()}else Ie(String(null!=(n=l.node.code)?n:""),Ce.value);An(!1)}catch(r){}})})}),{immediate:!0,flush:"post"}),f(()=>{dn(),Dn(),Tn(),Je()}),(t,n)=>yt.value?(m(),p(S(I),{key:0,node:Ft.value,loading:l.loading},null,8,["node","loading"])):(m(),O("div",{key:1,ref_key:"container",ref:le,style:L(tl.value),class:g(["code-block-container rounded-lg border",[{dark:l.isDark,"is-rendering":l.loading,"is-dark":hl.value,"is-diff":it.value,"is-plain-text":Me.value}]]),"data-markstream-code-block":"1","data-markstream-enhanced":gt.value&&!yt.value?"true":"false"},[F(ee,{"show-header":l.showHeader,"show-collapse-button":l.showCollapseButton,"show-font-size-buttons":l.showFontSizeButtons,"enable-font-size-control":l.enableFontSizeControl,"show-copy-button":l.showCopyButton,"show-expand-button":l.showExpandButton,"show-preview-button":l.showPreviewButton,"show-tooltips":l.showTooltips,"is-dark":l.isDark,loading:l.loading,stream:e.stream,"is-collapsed":Be.value,"is-expanded":Pe.value,"copy-text":oe.value,"is-previewable":Jn.value,"code-font-size":Nt.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":Ht.value,"font-baseline-ready":Rt.value,"diff-stats":it.value?rt.value:null,"diff-stats-aria-label":at.value,onToggleCollapse:il,onDecreaseFont:xn,onResetFont:Cn,onIncreaseFont:kn,onCopy:ll,onToggleExpand:ol,onPreview:rl},H({"header-left":N(()=>[_(t.$slots,"header-left",{},()=>[y("div",he,[y("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:el.value},null,8,ye),y("div",ge,[y("div",we,b(Qn.value),1),Zn.value?(m(),O("div",be,b(Zn.value),1)):$("",!0)])])],!0)]),loading:N(()=>[_(t.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[n[0]||(n[0]=y("div",{class:"loading-skeleton"},[y("div",{class:"skeleton-line"}),y("div",{class:"skeleton-line"}),y("div",{class:"skeleton-line short"})],-1))],!0)]),default:N(()=>[z(y("div",Se,[y("div",{ref_key:"codeEditor",ref:ne,class:g(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":Ot.value}]]),style:L(un.value)},null,6),Et.value?(m(),p(S(I),{key:0,class:g(["code-pre-fallback",{"is-wrap":xt.value,"is-fading-out":St.value}]),style:L(on.value),node:Ft.value,"show-line-numbers":!0,"diff-inline":Ct.value},null,8,["class","style","node","diff-inline"])):$("",!0)],512),[[R,!(Be.value||!e.stream&&e.loading)]]),Lt.value&&!w.value&&Jn.value&&"html"===ie.value?(m(),p(re,{key:0,code:l.node.code,"html-preview-allow-scripts":l.htmlPreviewAllowScripts,"html-preview-sandbox":l.htmlPreviewSandbox,"is-dark":l.isDark,"on-close":()=>Lt.value=!1},null,8,["code","html-preview-allow-scripts","html-preview-sandbox","is-dark","on-close"])):$("",!0)]),_:2},[t.$slots["header-right"]?{name:"header-right",fn:N(()=>[_(t.$slots,"header-right",{},void 0,!0)]),key:"0"}:void 0]),1032,["show-header","show-collapse-button","show-font-size-buttons","enable-font-size-control","show-copy-button","show-expand-button","show-preview-button","show-tooltips","is-dark","loading","stream","is-collapsed","is-expanded","copy-text","is-previewable","code-font-size","default-code-font-size","font-baseline-ready","diff-stats","diff-stats-aria-label"])],14,pe))}}),[["__scopeId","data-v-ec2b9e40"]]);export{Ce as default};
|
|
1
|
+
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,r=(t,n,l)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l,a=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&r(e,n,t[n]);if(l)for(var n of l(t))i.call(t,n)&&r(e,n,t[n]);return e},u=(e,l)=>t(e,n(l)),d=(e,t,n)=>new Promise((l,o)=>{var i=e=>{try{a(n.next(e))}catch(t){o(t)}},r=e=>{try{a(n.throw(e))}catch(t){o(t)}},a=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);a((n=n.apply(e,t)).next())});import{defineComponent as s,computed as c,onMounted as v,onUnmounted as f,openBlock as m,createBlock as p,Teleport as h,createElementVNode as y,normalizeClass as g,withModifiers as w,toDisplayString as b,unref as S,useAttrs as k,inject as x,getCurrentInstance as C,ref as M,watch as P,onBeforeUnmount as B,nextTick as E,createElementBlock as O,normalizeStyle as L,createVNode as F,createSlots as H,withCtx as N,withDirectives as z,createCommentVNode as $,vShow as R,renderSlot as _}from"vue";import{u as D,_ as T,r as A,b as W,h as j,z as I,s as q}from"./exports.js";import{M as U,n as V,e as G,c as J,l as X,g as Y,i as K}from"./index2.js";import{safeRaf as Q,safeCancelRaf as Z}from"./utils/safeRaf.js";import{_ as ee}from"./CodeBlockShell.vue_vue_type_style_index_0_lang.js";import{getUseMonaco as te}from"./monaco.js";const ne={class:"html-preview-frame__header"},le={class:"html-preview-frame__title"},oe={class:"html-preview-frame__label"},ie=["sandbox","srcdoc"],re=/* @__PURE__ */T(/* @__PURE__ */s({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){const t=e,n=void 0!==import.meta&&Boolean(!1);let l=null;const{t:o}=D(),i=c(()=>{const e=t.code||"",n=e.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?"#020617":"#ffffff"};\n color: ${t.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),r=c(()=>{return e=t.htmlPreviewSandbox,o=t.htmlPreviewAllowScripts,"string"==typeof e?(function(e){if(!n||"undefined"==typeof console||l===e)return;const t=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);t.has("allow-scripts")&&t.has("allow-same-origin")&&(l=e,console.warn("[markstream-vue] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(e),e):void 0!==e?"":!0===o?"allow-scripts":"";var e,o});function a(e){var n;"Escape"!==e.key&&"Esc"!==e.key||null==(n=t.onClose)||n.call(t)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",a)}),f(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",a)}),(e,n)=>(m(),p(h,{to:"body"},[y("div",{class:g(["markstream-vue",{dark:t.isDark}])},[y("div",{class:"html-preview-frame__backdrop",onClick:n[2]||(n[2]=e=>{var n;return null==(n=t.onClose)?void 0:n.call(t)})},[y("div",{class:"html-preview-frame",onClick:n[1]||(n[1]=w(()=>{},["stop"]))},[y("div",ne,[y("div",le,[n[3]||(n[3]=y("span",{class:"html-preview-frame__dot"},null,-1)),y("span",oe,b(t.title||S(o)("common.preview")||"Preview"),1)]),y("button",{type:"button",class:"html-preview-frame__close",onClick:n[0]||(n[0]=e=>{var n;return null==(n=t.onClose)?void 0:n.call(t)})}," × ")]),y("iframe",{class:"html-preview-frame__iframe",sandbox:r.value,referrerpolicy:"no-referrer",srcdoc:i.value},null,8,ie)])])],2)]))}}),[["__scopeId","data-v-24e66176"]]);let ae=null,ue=null,de=null,se=null,ce=null,ve=null;const fe=/* @__PURE__ */new WeakMap;let me=0;const pe=["data-markstream-enhanced","data-markstream-pending"],he={class:"code-header-main"},ye=["innerHTML"],ge={class:"code-header-copy"},we={class:"code-header-title"},be={key:0,class:"code-header-caption"},Se={class:"code-editor-layer"},ke="__markstreamMonacoPassiveTouchState__",xe=1.5,Ce=/* @__PURE__ */T(/* @__PURE__ */s({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isShowPreview:{type:Boolean,default:!0},monacoOptions:{},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:t}){var n;const l=e,o=t,i=k(),r=x(U,null),s=x("markstreamHostScrollManaged",null),v=c(()=>A(l,i));const h=C(),w=c(()=>{const e=null==h?void 0:h.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:T}=D(),ne=M(null),le=M(null),oe=M(!1),ie=M(V(l.node.language)),Ce=c(()=>G(ie.value)),Me=c(()=>"plaintext"===Ce.value),Pe=M(!1),Be=M(!1),Ee=M(!1),Oe=M(!1),Le=M(!1);let Fe=!1,He=null,Ne="";const ze=M(null),$e=M(null);let Re=0,_e=0;const De=W(),Te=M(null),Ae=M("undefined"==typeof window);"undefined"!=typeof window&&P(()=>le.value,e=>{var t;if(null==(t=Te.value)||t.destroy(),Te.value=null,!e)return void(Ae.value=!1);const n=De(e,{rootMargin:"400px"});Te.value=n,Ae.value=n.isVisible.value,n.whenVisible.then(()=>{Ae.value=!0})},{immediate:!0}),B(()=>{var e;Fe=!0,function(){const e=Ne;r&&e&&(Ne="",r.markSettled(e))}(),null==(e=Te.value)||e.destroy(),Te.value=null});let We=null,je=null,Ie=()=>{},qe=()=>{},Ue=()=>null,Ve=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Ge=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Je=()=>{},Xe=()=>{},Ye=()=>{},Ke=null,Qe=()=>{var e;return String(null!=(e=l.node.language)?e:"plaintext")},Ze=()=>d(null,null,function*(){}),et=!1;const tt=[],nt=[];let lt=null;function ot(e){var t;return"diff"===(null!=(t=String(null!=e?e:"").trim().split(/\s+/,1)[0])?t:"")}const it=c(()=>{var e;return!0===l.node.diff||ot(l.node.language)||ot(Kn(String(null!=(e=l.node.raw)?e:"")))}),rt=M({removed:0,added:0}),at=c(()=>`-${rt.value.removed} +${rt.value.added}`),ut=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5}),dt=Object.freeze(u(a({},ut),{enabled:!1,revealLineCount:0}));function st(e){var t;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const n=e;return u(a(a({},ut),n),{enabled:null==(t=n.enabled)||t})}return a({},ut)}function ct(e,t){return{original:String(null!=e?e:""),updated:String(null!=t?t:"")}}function vt(e){var t;return String(null!=(t=null==e?void 0:e.message)?t:e).includes("no diff result available")}function ft(){try{const e=Ye();e&&"function"==typeof e.catch&&e.catch(e=>{vt(e)})}catch(e){vt(e)}}const mt=c(()=>{var e,t,n,o;const i=l.monacoOptions?a({},l.monacoOptions):{};if(!it.value)return i;const r=void 0===i.diffHideUnchangedRegions?a({},ut):st(i.diffHideUnchangedRegions),d=void 0===i.hideUnchangedRegions?void 0:st(i.hideUnchangedRegions),s=!1!==l.stream&&!1!==l.loading,c=s?a({},dt):r,v=s?a({},dt):d,f=a({},null!=(e=i.experimental)?e:{}),m=null!=(t=i.diffUnchangedRegionStyle)?t:"line-info",p={maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,renderSideBySide:null==(n=i.renderSideBySide)||n,diffHideUnchangedRegions:c,useInlineViewWhenSpaceIsLimited:null!=(o=i.useInlineViewWhenSpaceIsLimited)&&o,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:m,diffHunkActionsOnHover:!1,experimental:f};return u(a(u(a(a({},p),i),{experimental:f}),void 0===v?{}:{hideUnchangedRegions:v}),{diffHideUnchangedRegions:c})}),pt=c(()=>it.value?"diff":"single"),ht=M(pt.value),yt=M(!1),gt=M(!1),wt=M(!1),bt=M(!1),St=M(!1);let kt=null;const xt=c(()=>{var e;const t=null==(e=l.monacoOptions)?void 0:e.wordWrap;return null==t||"off"!==String(t)}),Ct=c(()=>{var e,t,n,l,o,i;if(!it.value)return!1;if(!1===(null==(e=mt.value)?void 0:e.renderSideBySide))return!0;if(!0!==(null==(t=mt.value)?void 0:t.useInlineViewWhenSpaceIsLimited))return!1;const r=null==(n=mt.value)?void 0:n.renderSideBySideInlineBreakpoint,a="number"==typeof r&&Number.isFinite(r)?r:900,u=(null==(o=null==(l=le.value)?void 0:l.getBoundingClientRect)?void 0:o.call(l).width)||(null==(i=le.value)?void 0:i.clientWidth)||("undefined"==typeof window?0:window.innerWidth);return u>0&&u<=a});function Mt(e){return!0===(null==s?void 0:s.value)||!!e&&(!!e.closest('[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline')||Boolean(e.closest(".vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]")))}const Pt=c(()=>Mt(le.value)),Bt=c(()=>!yt.value&&(!!wt.value||(it.value||Pt.value||!K())&&!gt.value)),Et=c(()=>Bt.value||bt.value),Ot=c(()=>Bt.value&&!bt.value),Lt=c(()=>!yt.value&&!wt.value&&(Bt.value||bt.value||St.value)),Ft=M(!1),Ht=c(()=>it.value&&!0!==l.node.diff?u(a({},l.node),{diff:!0}):l.node);"undefined"!=typeof window&&d(null,null,function*(){try{const e=yield te();if(Fe)return;if(!e)return void(yt.value=!0);const t=e.useMonaco,n=e.detectLanguage;if("function"==typeof n&&(Qe=n),"function"==typeof t){const e=ml();if(e&&l.themes&&Array.isArray(l.themes)&&!l.themes.includes(e))throw new Error("Preferred theme not in provided themes array");lt=gl();const n=t(lt);We=n.createEditor||We,je=n.createDiffEditor||je,Ie=n.updateCode||Ie,qe=n.updateDiff||qe,Ue=n.getEditor||Ue,Ve=n.getEditorView||Ve,Ge=n.getDiffEditorView||Ge,Je=n.cleanupEditor||Je,Xe=n.safeClean||n.cleanupEditor||Xe,Ye=n.refreshDiffPresentation||Ye,Ze=n.setTheme||Ze,Le.value=!0,!Fe&&ne.value&&(yield dl(ne.value))}}catch(e){if(Fe)return;yt.value=!0}});const Nt=M("number"==typeof(null==(n=l.monacoOptions)?void 0:n.fontSize)?l.monacoOptions.fontSize:Number.NaN),zt=M(Nt.value),$t=M(null),Rt=M(null),_t=c(()=>{const e=Nt.value,t=zt.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof t&&Number.isFinite(t)&&t>0}),Dt=c(()=>{var e;const t=$t.value;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const n=null==(e=l.monacoOptions)?void 0:e.fontSize;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n;const o=zt.value;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:12}),Tt=c(()=>{var e;const t=Rt.value;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const n=null==(e=l.monacoOptions)?void 0:e.lineHeight;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:12===Dt.value?18:Math.max(12,Math.round(1.5*Dt.value))}),At=c(()=>Tt.value);function Wt(e){const t=String(null!=e?e:"");return t?Math.max(1,t.split(/\r\n|\n|\r/).length):1}function jt(e){return e.startsWith("-")&&!e.startsWith("---")}function It(e){return e.startsWith("+")&&!e.startsWith("+++")}const qt=c(()=>Ct.value?function(){var e,t,n;const o=String(null!=(e=l.node.code)?e:"").split(/\r\n|\n|\r/);if(o.some(e=>jt(e)||It(e)))return Math.max(1,o.length);const i=String(null!=(t=l.node.originalCode)?t:"").split(/\r\n|\n|\r/),r=String(null!=(n=l.node.updatedCode)?n:"").split(/\r\n|\n|\r/);let a=0,u=i.length-1,d=r.length-1;for(;a<=u&&a<=d&&i[a]===r[a];)a++;let s=0;for(;u>=a&&d>=a&&i[u]===r[d];)s++,u--,d--;const c=Math.max(0,u-a+1),v=Math.max(0,d-a+1);return Math.max(1,a+c+v+s)}():function(){var e;const t=String(null!=(e=l.node.code)?e:"").split(/\r\n|\n|\r/);if(!t.some(e=>jt(e)||It(e))&&(null!=l.node.originalCode||null!=l.node.updatedCode))return Math.max(Wt(l.node.originalCode),Wt(l.node.updatedCode));let n=0,o=0;for(const l of t)jt(l)?n++:(It(l)||n++,o++);return Math.max(1,n,o)}()),Ut=c(()=>{var e;const t=null==(e=l.monacoOptions)?void 0:e.tabSize;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:4}),Vt=c(()=>{var e;const t=null==(e=l.monacoOptions)?void 0:e.padding;return{top:"number"==typeof(null==t?void 0:t.top)&&Number.isFinite(t.top)&&t.top>0?t.top:0,bottom:"number"==typeof(null==t?void 0:t.bottom)&&Number.isFinite(t.bottom)&&t.bottom>0?t.bottom:0}}),Gt=c(()=>{const e=l.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null});function Jt(e){if(null==e)return null;const t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(Jn()))}const Xt=c(()=>it.value?Math.ceil(qt.value*At.value):null!=Gt.value?null:Math.ceil((e=>{const t=String(null!=e?e:"");return t?Math.max(1,t.split(/\r\n|\n|\r/).length):1})(l.node.code)*(Tt.value+xe)+1)),Yt=c(()=>{if(it.value){const e=Xt.value,t=nn();return Jt(null!=t&&null!=e?Math.max(e,t):null!=t?t:e)}const e=Gt.value;return Jt(null!=e?e:Xt.value)}),Kt=c(()=>{const e=l.estimatedHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null}),Qt=M(null),Zt=M(null);function en(){const e=Qt.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}function tn(){return it.value&&!1!==l.stream&&(!1!==l.loading||Bt.value||bt.value||St.value)}function nn(){if(!tn())return null;const e=Zt.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}function ln(e){if(!tn()||null==e)return;const t=Math.min(Math.ceil(e),Math.ceil(Jn()));if(!Number.isFinite(t)||t<=0)return;const n=nn();Zt.value=null==n?t:Math.max(n,t)}const on=c(()=>{const e=en();return null!=e?e:Bt.value||!gt.value?Yt.value:null}),rn=c(()=>{var e;const t=null==(e=l.monacoOptions)?void 0:e.fontFamily,n=Jt(Gt.value),o=Jt(Xt.value),i=a(a({fontSize:`${Dt.value}px`,lineHeight:`${At.value}px`,tabSize:Ut.value,boxSizing:"border-box",maxHeight:`${Jn()}px`,overflow:"auto",paddingTop:`${Vt.value.top}px`,paddingBottom:`${Vt.value.bottom}px`},it.value?function(e){if(null==e)return{};const t=Math.ceil(e),n=Math.ceil(Jn()),l=Math.min(t,n);return t>=n?{height:`${l}px`,minHeight:`${l}px`}:{minHeight:`${t}px`}}(Yt.value):null!=n?{height:`${n}px`,minHeight:`${n}px`}:null!=o?{minHeight:`${o}px`}:{}),"string"==typeof t&&t.trim()?{"--markstream-code-font-family":t.trim()}:{});return i["--markstream-pre-line-number-top"]=`${Vt.value.top}px`,i["--markstream-code-padding-left"]="62px",i["--markstream-pre-line-number-width"]="36px",i["--markstream-pre-line-number-gap"]="0px",it.value&&(i["--markstream-pre-diff-line-height"]=`${At.value}px`),i}),an=c(()=>null!=on.value&&(!gt.value||null!=en())),un=c(()=>{const e=on.value;if(null==e)return null;if(it.value)return Math.ceil(e);const t=Kt.value,n=Gt.value;if(null==t||null==n)return Math.ceil(e);const l=Math.max(0,Math.ceil(t)-Math.ceil(n));return Math.ceil(e+l)}),dn=c(()=>{if(it.value&&Bt.value)return;const e=on.value;return an.value&&null!=e?{minHeight:`${e}px`}:void 0});function sn(){null!=kt&&"undefined"!=typeof window&&window.clearTimeout(kt),kt=null}function cn(){if(!it.value)return!1;if(!Oe.value||!gt.value)return!1;if(bt.value||St.value)return!1;const e=ne.value;return!!e&&Bn(e)}function vn(e,t=!1,n={}){const l=Math.ceil(e),o=en();if(null==o)return l;const i=!0===n.allowBelowEstimatedFloor||cn();return l>=o||i?((t||i)&&Oe.value&&(Qt.value=null),l):o}function fn(){return new Promise(e=>{Q(()=>e())})}function mn(){try{const e=ne.value;if(!e)return null;const t=e.querySelector(".view-lines .view-line");if(t){const e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch(e){}return null}function pn(){var e,t,n,l,o;try{const i=it.value?null!=(n=null==(t=null==(e=Ge())?void 0:e.getModifiedEditor)?void 0:t.call(e))?n:Ge():Ve(),r=Ue(),a=null==(l=null==r?void 0:r.EditorOption)?void 0:l.fontInfo;if(i&&null!=a){const e=null==(o=i.getOption)?void 0:o.call(i,a),t=null==e?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t}}catch(i){}try{const e=ne.value;if(e){const t=e.querySelector(".view-lines .view-line");if(t)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(t).fontSize,n=e&&e.match(/^(\d+(?:\.\d+)?)/);if(n)return Number.parseFloat(n[1])}}catch(i){}}}catch(i){}return null}function hn(e){var t,n;try{const l=Ue(),o=null==(t=null==l?void 0:l.EditorOption)?void 0:t.lineHeight;if(null!=o){const t=null==(n=null==e?void 0:e.getOption)?void 0:n.call(e,o);if("number"==typeof t&&t>0)return t}}catch(i){}const l=mn();if(l&&l>0)return l;const o=Number.isFinite(zt.value)&&zt.value>0?zt.value:14;return Math.max(12,Math.round(1.35*o))}function yn(e){var t,n,l;try{const l=Ue(),o=null==(t=null==l?void 0:l.EditorOption)?void 0:t.padding;if(null!=o){const t=null==(n=null==e?void 0:e.getOption)?void 0:n.call(e,o),l="number"==typeof(null==t?void 0:t.top)?t.top:0,i="number"==typeof(null==t?void 0:t.bottom)?t.bottom:0;if(l>0||i>0)return l+i}}catch(a){}const o=null==(l=mt.value)?void 0:l.padding,i="number"==typeof(null==o?void 0:o.top)?o.top:0,r="number"==typeof(null==o?void 0:o.bottom)?o.bottom:0;return i>0||r>0?i+r:it.value?24:0}function gn(e,t){return"number"!=typeof e||"number"!=typeof t||e<1||t<e?0:t-e+1}function wn(e){if(!e)return[];const t=e.split(/\r?\n/);return 1===t.length&&""===t[0]?[]:t}function bn(){var e,t;it.value?rt.value=function(e,t){const n=wn(e),l=wn(t);let o=0,i=n.length-1,r=l.length-1;for(;o<=i&&o<=r&&n[o]===l[o];)o++;for(;i>=o&&r>=o&&n[i]===l[r];)i--,r--;return{removed:Math.max(0,i-o+1),added:Math.max(0,r-o+1)}}(String(null!=(e=l.node.originalCode)?e:""),String(null!=(t=l.node.updatedCode)?t:"")):rt.value={removed:0,added:0}}function Sn(){var e;if(it.value)try{const t=Ge(),n=null==(e=null==t?void 0:t.getLineChanges)?void 0:e.call(t);if(!Array.isArray(n))return void bn();let l=0,o=0;for(const e of n)l+=gn(e.originalStartLineNumber,e.originalEndLineNumber),o+=gn(e.modifiedStartLineNumber,e.modifiedEndLineNumber);rt.value={removed:l,added:o}}catch(t){bn()}else rt.value={removed:0,added:0}}function kn(){var e;if(Number.isFinite(zt.value)&&zt.value>0&&Number.isFinite(Nt.value))return zt.value;const t=pn();return"number"==typeof(null==(e=l.monacoOptions)?void 0:e.fontSize)?(Nt.value=l.monacoOptions.fontSize,zt.value=l.monacoOptions.fontSize,zt.value):t&&t>0?(Nt.value=t,zt.value=t,t):(Nt.value=12,zt.value=12,12)}function xn(){const e=kn(),t=Math.min(36,e+1);zt.value=t}function Cn(){const e=kn(),t=Math.max(10,e-1);zt.value=t}function Mn(){kn(),Number.isFinite(Nt.value)&&(zt.value=Nt.value)}function Pn(){var e,t,n,l,o,i,r,a,u,d,s,c,v,f;try{const m=it.value?Ge():null,p=it.value?m:Ve();if(!p)return null;if((null==m?void 0:m.getOriginalEditor)&&(null==m?void 0:m.getModifiedEditor)){const v=null==(e=m.getOriginalEditor)?void 0:e.call(m),f=null==(t=m.getModifiedEditor)?void 0:t.call(m);null==(n=null==v?void 0:v.layout)||n.call(v),null==(l=null==f?void 0:f.layout)||l.call(f);const p=(null==(o=null==v?void 0:v.getContentHeight)?void 0:o.call(v))||0,h=(null==(i=null==f?void 0:f.getContentHeight)?void 0:i.call(f))||0,y=Math.max(p,h);if(y>0)return Math.ceil(y+1);const g=(null==(u=null==(a=null==(r=null==v?void 0:v.getModel)?void 0:r.call(v))?void 0:a.getLineCount)?void 0:u.call(a))||1,w=(null==(c=null==(s=null==(d=null==f?void 0:f.getModel)?void 0:d.call(f))?void 0:s.getLineCount)?void 0:c.call(s))||1,b=Math.max(g,w),S=Math.max(hn(v),hn(f));return Math.ceil(b*(S+xe)+0+1)}if(null==p?void 0:p.getContentHeight){null==(v=null==p?void 0:p.layout)||v.call(p);const e=p.getContentHeight();if(e>0)return Math.ceil(e+1)}const h=null==(f=null==p?void 0:p.getModel)?void 0:f.call(p);let y=1;h&&"function"==typeof h.getLineCount&&(y=h.getLineCount());const g=hn(p);return Math.ceil(y*(g+xe)+0+1)}catch(m){return null}}function Bn(e){if("undefined"==typeof window)return!1;const t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return!1;const n=e.querySelectorAll(".editor.modified .diff-hidden-lines .center, .stream-monaco-diff-unchanged-bridge");for(const l of Array.from(n)){if(!(l instanceof HTMLElement))continue;const e=window.getComputedStyle(l);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const n=l.getBoundingClientRect();if(!(n.width<=0||n.height<=0||n.bottom<=t.top||n.top>=t.bottom))return!0}return!1}function En(e){var t;const n=String(null!=e?e:"").trim(),l=null==(t=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i))?void 0:t[1];if(l){const e=3===l.length?l.split("").map(e=>`${e}${e}`).join(""):l;return.2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}const o=n.match(/\d+(?:\.\d+)?/g);if(!o||o.length<3)return null;const[i,r,a]=o.slice(0,3).map(Number);return.2126*i+.7152*r+.0722*a}function On(){var e;const t=null==(e=ne.value)?void 0:e.parentElement;return t instanceof HTMLElement?t:null}function Ln(e,t){var n;null==t||!Number.isFinite(t)||t<=0||null==(n=On())||n.style.setProperty(e,`${t}px`)}function Fn(){var e,t,n;if(Hn())return;const l=pn();l&&l>0&&($t.value=l,zt.value=l,Nt.value=l);try{const l=hn(it.value?null!=(n=null==(t=null==(e=Ge())?void 0:e.getModifiedEditor)?void 0:t.call(e))?n:Ge():Ve());l&&l>0&&(Rt.value=l)}catch(o){}try{const e=mn();e&&e>0&&(Rt.value=e)}catch(o){}}function Hn(){return it.value&&Et.value}function Nn(){var e,t,n,l,o,i,r,a;const u=ne.value,d=le.value;if(!u||!d)return;const s=u,c=u.querySelector(".monaco-editor")||u,v=c.querySelector(".monaco-editor-background")||c,f=c.querySelector(".view-lines")||c;let m=null,p=null,h=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(m=window.getComputedStyle(c),p=v===c?m:window.getComputedStyle(v),h=f===c?m:window.getComputedStyle(f))}catch(k){m=null,p=null,h=null}const y=String(null!=(e=null==m?void 0:m.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),g=String(null!=(t=null==m?void 0:m.getPropertyValue("--vscode-editor-background"))?t:"").trim(),w=String(null!=(l=null!=(n=null==m?void 0:m.getPropertyValue("--vscode-editor-selectionBackground"))?n:null==m?void 0:m.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?l:"").trim(),b=y||String(null!=(i=null!=(o=null==h?void 0:h.color)?o:null==m?void 0:m.color)?i:"").trim(),S=g||String(null!=(a=null!=(r=null==p?void 0:p.backgroundColor)?r:null==m?void 0:m.backgroundColor)?a:"").trim();return it.value?(b?(d.style.setProperty("--markstream-diff-editor-fg",b),s.style.setProperty("--vscode-editor-foreground",b),s.style.setProperty("--stream-monaco-editor-fg",b)):(d.style.removeProperty("--markstream-diff-editor-fg"),s.style.removeProperty("--vscode-editor-foreground"),s.style.removeProperty("--stream-monaco-editor-fg")),S?(d.style.setProperty("--markstream-diff-editor-bg",S),d.style.setProperty("--markstream-diff-panel-bg",S),d.style.setProperty("--markstream-diff-panel-bg-soft",S),d.style.setProperty("--markstream-diff-panel-bg-strong",S),s.style.setProperty("--vscode-editor-background",S),s.style.setProperty("--stream-monaco-editor-bg",S),s.style.setProperty("--stream-monaco-fixed-editor-bg",S),s.style.setProperty("--stream-monaco-panel-bg",S),s.style.setProperty("--stream-monaco-panel-bg-soft",S),s.style.setProperty("--stream-monaco-panel-bg-strong",S),s.style.backgroundColor=S):(d.style.removeProperty("--markstream-diff-editor-bg"),d.style.removeProperty("--markstream-diff-panel-bg"),d.style.removeProperty("--markstream-diff-panel-bg-soft"),d.style.removeProperty("--markstream-diff-panel-bg-strong"),s.style.removeProperty("--vscode-editor-background"),s.style.removeProperty("--stream-monaco-editor-bg"),s.style.removeProperty("--stream-monaco-fixed-editor-bg"),s.style.removeProperty("--stream-monaco-panel-bg"),s.style.removeProperty("--stream-monaco-panel-bg-soft"),s.style.removeProperty("--stream-monaco-panel-bg-strong"),s.style.backgroundColor=""),void(w?s.style.setProperty("--vscode-editor-selectionBackground",w):s.style.removeProperty("--vscode-editor-selectionBackground"))):function(e,t,n){if(!Me.value)return!1;const l=En(e),o=En(t);return n?null!=l&&l>170||null!=o&&o<110:null!=l&&l<85||null!=o&&o>190}(S,b,d.classList.contains("is-dark"))?(s.style.removeProperty("--vscode-editor-foreground"),s.style.removeProperty("--vscode-editor-background"),void s.style.removeProperty("--vscode-editor-selectionBackground")):(b&&s.style.setProperty("--vscode-editor-foreground",b),S&&s.style.setProperty("--vscode-editor-background",S),void(w&&s.style.setProperty("--vscode-editor-selectionBackground",w)))}let zn=0,$n=0;const Rn=/auto|scroll|overlay/i;function _n(e,t,n){var l;if("undefined"==typeof window)return;if(it.value)return;if(function(e){return Pt.value||Mt(e)}(e))return;const o=Math.ceil(t),i=Math.ceil(n)-o;if(Math.abs(i)<=1)return;const r=function(e){var t,n;if("undefined"==typeof window)return null;const l=null!=(t=null==e?void 0:e.ownerDocument)?t:document,o=l.scrollingElement||l.documentElement||l.body;let i=null!=(n=null==e?void 0:e.parentElement)?n:null;for(;i&&i!==l.body&&i!==o;){const e=window.getComputedStyle(i),t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();if(Rn.test(t)||Rn.test(n))return i;i=i.parentElement}return o}(e);if(!r)return;const a=null!=(l=e.ownerDocument)?l:document,u=r===a.body||r===a.documentElement||r===a.scrollingElement,d=u?0:r.getBoundingClientRect().top;e.getBoundingClientRect().top-d>=0||(u&&"function"==typeof window.scrollBy?window.scrollBy(0,i):r.scrollTop+=i)}function Dn(){try{const e=ne.value;if(!e)return;const t=e.getBoundingClientRect().height,n=Pn();if(null!=n&&n>0){const l=vn(n,!0),o=en();return e.style.minHeight=null!=o?`${o}px`:"0px",e.style.height=`${l}px`,e.style.maxHeight="none",e.style.overflow="visible",void _n(e,t,l)}const l=en();null!=l&&(e.style.minHeight=`${l}px`,e.style.height=`${l}px`,e.style.maxHeight="none",e.style.overflow="visible",_n(e,t,l))}catch(e){}}function Tn(){for(var e,t;tt.length>0;)try{null==(t=null==(e=tt.pop())?void 0:e.dispose)||t.call(e)}catch(n){}null!=He&&(Z(He),He=null)}function An(){for(var e;nt.length>0;)try{null==(e=nt.pop())||e()}catch(t){}}function Wn(e=!1){Be.value||(Pe.value?Dn():function(){var e;try{const t=ne.value;if(!t)return;const n=t.getBoundingClientRect().height,l=Jn(),o=Math.ceil((null==(e=t.getBoundingClientRect)?void 0:e.call(t).height)||0),i=it.value?function(){var e,t,n,l,o,i,r,a;try{const u=Ge(),d=null==(e=null==u?void 0:u.getOriginalEditor)?void 0:e.call(u),s=null==(t=null==u?void 0:u.getModifiedEditor)?void 0:t.call(u);if(!d||!s)return null;const c=(null==(o=null==(l=null==(n=d.getModel)?void 0:n.call(d))?void 0:l.getLineCount)?void 0:o.call(l))||1,v=(null==(a=null==(r=null==(i=s.getModel)?void 0:i.call(s))?void 0:r.getLineCount)?void 0:a.call(r))||1,f=Math.max(c,v),m=Math.max(hn(d),hn(s)),p=Math.max(yn(d),yn(s));return Math.ceil(f*(m+xe)+p+0+1)}catch(u){return null}}():null,r=it.value&&Bn(t),a=r&&Oe.value&>.value&&!bt.value&&!St.value;if(r||($e.value=null),_e>0&&(_e--,null!=ze.value))return void _n(t,n,Vn(t,ze.value,l,{allowBelowEstimatedFloor:a}));const u=it.value?function(e){var t,n;if("undefined"==typeof window)return null;try{const l=e.getBoundingClientRect(),o=window.getComputedStyle(e);if("none"===o.display||"hidden"===o.visibility)return null;const i=[".editor.original .view-lines .view-line",".editor.modified .view-lines .view-line",".editor.original .view-zones > div",".editor.modified .view-zones > div",".editor.original .margin-view-zones > div",".editor.modified .margin-view-zones > div",".editor.original .diff-hidden-lines",".editor.modified .diff-hidden-lines",".stream-monaco-diff-unchanged-bridge"];let r=0;for(const t of Array.from(e.querySelectorAll(i.join(",")))){if(!(t instanceof HTMLElement))continue;const e=window.getComputedStyle(t);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const n=t.getBoundingClientRect();n.height<=0||n.bottom<=l.top||(r=Math.max(r,n.bottom-l.top))}if(r>0)return Math.ceil(r);const a=e.querySelector(".monaco-diff-editor"),u=null!=(n=null==(t=null==a?void 0:a.getBoundingClientRect)?void 0:t.call(a).height)?n:0;return u>0?Math.ceil(u+1):null}catch(l){return null}}(t):null,d=it.value?r?u:null!=i?Math.max(null!=u?u:0,i):u:Pn();if(null!=d&&d>0){const e=null!=$e.value&&Date.now()<Re&&d>=l-1,i=r&&o>0&&o<l-1&&d>=l-1,u=Vn(t,e?$e.value:i?o:d,l,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:a});return r&&u<l-1&&($e.value=u,Re=Date.now()+160),void _n(t,n,u)}if(null!=ze.value)return void _n(t,n,Vn(t,ze.value,l,{allowBelowEstimatedFloor:a}));const s=r?o:Math.max(o,null!=i&&i>0?i:0);if(s>0){const e=null!=$e.value&&Date.now()<Re&&s>=l-1,i=r&&o>0&&o<l-1&&s>=l-1,u=Vn(t,e?$e.value:i?o:s,l,{allowBelowEstimatedFloor:a});return r&&u<l-1&&($e.value=u,Re=Date.now()+160),void _n(t,n,u)}const c=en();if(null!=c)return void _n(t,n,Vn(t,c,l,{allowBelowEstimatedFloor:a}));const v=Number.parseFloat(t.style.height);!Number.isNaN(v)&&v>0?_n(t,n,Vn(t,v,l,{allowBelowEstimatedFloor:a})):it.value||_n(t,n,Vn(t,l,l))}catch(t){}}())}function jn(){zn=0,$n=0}function In(e=!1){var t,n,l;const o=ne.value;if(!o)return;const i=it.value?Ge():Ve();if(i&&"function"==typeof i.layout)try{const r=null==(t=o.getBoundingClientRect)?void 0:t.call(o),a=Math.ceil((null!=(n=null==r?void 0:r.width)?n:0)||o.clientWidth||0),u=Math.ceil((null!=(l=null==r?void 0:r.height)?l:0)||o.clientHeight||Number.parseFloat(o.style.height||"")||0);if(a>0&&u>0){if(!e&&a===zn&&u===$n)return;zn=a,$n=u,i.layout({width:a,height:u})}else jn(),i.layout()}catch(r){}}function qn(){if(!it.value)return void An();const e=ne.value;if(!e)return void An();const t=e.querySelector(".monaco-diff-editor");if(!t||t.classList.contains("side-by-side"))return void An();const n=Array.from(t.querySelectorAll(".editor.original .diff-hidden-lines")),l=Array.from(t.querySelectorAll(".editor.modified .diff-hidden-lines")),o=Math.min(n.length,l.length);for(let i=0;i<o;i++){const e=l[i],t=e.querySelector("a"),n=e.querySelector(".center > div:first-child"),o=e.querySelector(".center");if(!t||!n||!o)continue;if(o.querySelector(".markstream-inline-fold-proxy"))continue;const r=document.createElement("button");r.type="button",r.className="markstream-inline-fold-proxy",r.dataset.markstreamInlineFoldProxy="true";const a=t.getAttribute("title")||"Show Unchanged Region";r.title=a,r.setAttribute("aria-label",a);const u=e=>{e.preventDefault(),e.stopPropagation()},d=e=>{e.preventDefault(),e.stopPropagation(),t.click(),Q(()=>Un())},s=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),t.click(),Q(()=>Un()))};r.addEventListener("mousedown",u),r.addEventListener("click",d),r.addEventListener("keydown",s),o.appendChild(r),nt.push(()=>{r.removeEventListener("mousedown",u),r.removeEventListener("click",d),r.removeEventListener("keydown",s),r.parentElement===o&&o.removeChild(r)})}}function Un(e=!1){null==He&&(He=Q(()=>{He=null,Q(()=>{qn(),Wn(e),In()})}))}function Vn(e,t,n,l={}){ln(t);const o=nn(),i=null!=o?Math.max(t,o):t,r=Math.min(i,n),a=!0===l.allowBelowEstimatedFloor||cn(),u=vn(r,!0===l.clearEstimatedFloor,{allowBelowEstimatedFloor:a}),d=en();if(e.style.minHeight=null==d||a?"0px":`${Math.min(d,Math.ceil(n))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(n)}px`,it.value)e.style.overflow="hidden";else{const t=i>n+1;e.style.overflow=t?"auto":"hidden"}return u}function Gn(e,t,n){return d(this,null,function*(){try{return void(yield qe(e,t,n))}catch(l){if(!vt(l))throw l}if(yield E(),yield fn(),!Fe&&it.value)try{yield qe(e,t,n)}catch(l){if(!vt(l))throw l}})}function Jn(){var e,t;const n=null!=(t=null==(e=l.monacoOptions)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof n)return n;const o=String(n).match(/^(\d+(?:\.\d+)?)/);return o?Number.parseFloat(o[1]):500}const Xn=c(()=>l.isShowPreview&&("html"===ie.value||"svg"===ie.value));P(()=>l.node.language,e=>{ie.value=V(e)}),P(()=>[l.node.originalCode,l.node.updatedCode,it.value],()=>{bn(),Q(()=>Sn())},{immediate:!0}),P(()=>[it.value,l.stream,l.loading,Bt.value,bt.value,St.value,Xt.value],()=>{tn()?ln(Xt.value):Zt.value=null},{immediate:!0}),P(()=>[l.node.originalCode,l.node.updatedCode,Ce.value,it.value],e=>d(null,[e],function*([e,t,n,o]){if(!1===l.stream||!o)return;if(We&&!Ee.value&&ne.value)try{yield dl(ne.value)}catch(a){}const i=ct(String(null!=e?e:""),String(null!=t?t:"")),r=!1===l.loading;r&&wl();try{yield Gn(i.original,i.updated,Ce.value),In(!0)}catch(u){return}if(r){if(Fe||!it.value)return;ft(),qn(),Sn(),Un()}Pe.value&&Q(()=>Dn())})),P(()=>l.node.code,e=>d(null,null,function*(){if(!1!==l.stream&&(ie.value||(ie.value=V(Qe(e))),!it.value)){if(We&&!Ee.value&&ne.value)try{yield dl(ne.value)}catch(t){}Ie(e,Ce.value),Pe.value&&Q(()=>Dn())}}));const Yn=c(()=>{const e=ie.value;return e?J[e]||e.charAt(0).toUpperCase()+e.slice(1):J[""]||"Plain Text"});function Kn(e){var t,n;const l=null!=(n=null==(t=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:t.trim())?n:"";if(l.length<3)return"";const o=l[0];if("`"!==o&&"~"!==o||l[1]!==o||l[2]!==o)return"";let i=3;for(;l[i]===o;)i+=1;return l.slice(i).trim()}const Qn=c(()=>{var e;return function(e){const t=Kn(e);if(!t)return"";const n=t.split(/\s+/).filter(Boolean);if(!n.length)return"";const l="diff"===n[0]?n.slice(1):n;for(const o of l){const e=o.includes(":")?o.slice(o.indexOf(":")+1):o;if(e&&/[./\\-]/.test(e))return e}return""}(String(null!=(e=l.node.raw)?e:""))}),Zn=c(()=>Qn.value||Yn.value),el=c(()=>Qn.value?it.value?`Diff / ${Yn.value}`:Yn.value:""),tl=c(()=>(X.value,Y(ie.value||""))),nl=c(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n=t(l.minWidth),o=t(l.maxWidth);if(n&&(e.minWidth=n),o&&(e.maxWidth=o),an.value&&!it.value){const t=un.value;null!=t&&(e.minHeight=`${t}px`)}return it.value||(e.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))",e.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg))",e.borderColor="var(--markstream-code-border-color)"),e}),ll=c(()=>!1!==l.showTooltips);function ol(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(l.node.code)),oe.value=!0,o("copy",l.node.code),setTimeout(()=>{oe.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function il(e){if(Pe.value=!Pe.value,e&&ll.value){const t=function(e){const t=e.currentTarget||e.target;return!t||t.disabled?null:t}(e);if(t){const e=Pe.value?T("common.collapse")||"Collapse":T("common.expand")||"Expand";q(t,e,"top",!1,void 0,l.isDark)}}const t=it.value?Ge():Ve(),n=ne.value;t&&n&&(Pe.value?(ul(!0),n.style.maxHeight="none",n.style.overflow="visible",Wn(!0)):(ul(!1),n.style.overflow=it.value?"hidden":"auto",Wn(!0)))}function rl(){var e,t,n;if(Be.value=!Be.value,Be.value){if(ne.value){const n=Math.ceil((null==(t=(e=ne.value).getBoundingClientRect)?void 0:t.call(e).height)||0);n>0&&(ze.value=n)}ul(!1)}else{Pe.value&&ul(!0),ne.value&&null!=ze.value&&(ne.value.style.height=`${ze.value}px`);const e=it.value?Ge():Ve();try{null==(n=null==e?void 0:e.layout)||n.call(e)}catch(l){}_e=2,Q(()=>{Wn(!0)})}}function al(){if(!Xn.value)return;const e=ie.value;if(w.value){const t="html"===e?"text/html":"image/svg+xml",n="html"===e?T("artifacts.htmlPreviewTitle")||"HTML Preview":T("artifacts.svgPreviewTitle")||"SVG Preview";return void o("previewCode",{node:l.node,artifactType:t,artifactTitle:n,id:`temp-${e}-${Date.now()}`})}"html"===e&&(Ft.value=!Ft.value)}function ul(e){var t,n;try{if(it.value){const n=Ge();null==(t=null==n?void 0:n.updateOptions)||t.call(n,{automaticLayout:e})}else{const t=Ve();null==(n=null==t?void 0:t.updateOptions)||n.call(t,{automaticLayout:e})}}catch(l){}}function dl(e){if(!We||Fe)return null;if(Ke)return Ke;if(Ee.value&&Oe.value)return Promise.resolve();Ee.value=!0,function(){const e=v.value;r&&e&&Ne!==e&&(Ne&&r.markSettled(Ne),Ne=e,r.markPending(e))}();const t=d(null,null,function*(){yield function(e){return d(this,null,function*(){var t;if("undefined"==typeof window)return yield e();try{const n=null==(t=window.Element)?void 0:t.prototype,l=null==n?void 0:n.addEventListener;if(!n||!l)return yield e();const o=function(){const e=window,t=e[ke];if(t)return t;const n={depth:0,original:null};return e[ke]=n,n}();0===o.depth&&(o.original=l,n.addEventListener=function(e,t,n){var i;const r=null!=(i=o.original)?i:l;return"touchstart"===e&&function(e,t){if(!e)return!1;const n=e;return!("function"!=typeof n.closest||!n.closest(".monaco-editor, .monaco-diff-editor")||t&&"object"==typeof t&&"passive"in t)}(this,n)?r.call(this,e,t,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(a({},e),{passive:!0}):{passive:!0}}(n)):r.call(this,e,t,n)}),o.depth++;try{return yield e()}finally{o.depth=Math.max(0,o.depth-1),0===o.depth&&o.original&&n.addEventListener!==o.original&&(n.addEventListener=o.original,o.original=null)}}catch(n){return yield e()}})}(()=>function(e){return d(this,null,function*(){var t,n,o;if(!We||Fe)return;if(wt.value=!1,gt.value=!1,bt.value=!1,St.value=!1,sn(),$t.value=null,Rt.value=null,function(){const e=On();e&&(e.style.removeProperty("--stream-monaco-line-number-left"),e.style.removeProperty("--stream-monaco-line-number-width"),e.style.removeProperty("--stream-monaco-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-original-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-modified-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-original-scrollable-left"),e.style.removeProperty("--stream-monaco-modified-scrollable-left"))}(),jn(),function(){const e=Yt.value;Qt.value=Oe.value||null==e?null:e}(),Tn(),An(),function(e){e.replaceChildren()}(e),Fe)return;if(it.value){!function(){if(et||"undefined"==typeof window)return;et=!0;const e=e=>{var t;vt("reason"in e?e.reason:null!=(t=e.error)?t:e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener("error",e,!0),window.addEventListener("unhandledrejection",e,!0)}(),Xe();const o=ct(String(null!=(t=l.node.originalCode)?t:""),String(null!=(n=l.node.updatedCode)?n:""));je?yield je(e,o.original,o.updated,Ce.value):yield We(e,l.node.code,Ce.value)}else yield We(e,l.node.code,Ce.value);if(Fe)return;const i=it.value?Ge():Ve();if("number"==typeof(null==(o=l.monacoOptions)?void 0:o.fontSize))null==i||i.updateOptions({fontSize:l.monacoOptions.fontSize,automaticLayout:!1}),Nt.value=l.monacoOptions.fontSize,zt.value=l.monacoOptions.fontSize;else if(!Hn()){const e=pn();e&&e>0?(Nt.value=e,zt.value=e):(Nt.value=12,zt.value=12)}Fn(),Pe.value||Be.value||Wn(!1),yield function(){return d(this,null,function*(){null!=en()&&(qn(),Wn(!1),yield E(),yield fn(),qn(),Wn(!1),yield fn(),qn(),Wn(!1))})}(),Fe||(Oe.value=!0,function(){var e,t,n,l,o;if(Tn(),it.value){const l=Ge(),o=null==(e=null==l?void 0:l.getOriginalEditor)?void 0:e.call(l),i=null==(t=null==l?void 0:l.getModifiedEditor)?void 0:t.call(l),a=(e,t)=>{try{const n=null==e?void 0:e[t];if("function"!=typeof n)return;const l=n.call(e,()=>Un());l&&tt.push(l)}catch(n){}};try{const e=null==(n=null==l?void 0:l.onDidUpdateDiff)?void 0:n.call(l,()=>{Un(),Q(()=>Sn())});e&&tt.push(e)}catch(r){}return a(o,"onDidContentSizeChange"),a(i,"onDidContentSizeChange"),a(o,"onDidLayoutChange"),void a(i,"onDidLayoutChange")}const i=Ve();try{const e=null==(l=null==i?void 0:i.onDidContentSizeChange)?void 0:l.call(i,()=>Un());e&&tt.push(e)}catch(r){}try{const e=null==(o=null==i?void 0:i.onDidLayoutChange)?void 0:o.call(i,()=>Un());e&&tt.push(e)}catch(r){}}(),Nn(),Fn(),qn(),Sn(),Un(),yield function(){return d(this,null,function*(){qn(),Wn(!1),yield E(),yield fn(),qn(),Wn(!1),yield fn(),qn(),Wn(!1)})}(),yield function(){return d(this,null,function*(){var e;if(it.value){for(let n=0;n<8;n++){if(Fe)return;const l=ne.value,o=Ge();let i=!1;try{const t=null==(e=null==o?void 0:o.getLineChanges)?void 0:e.call(o);i=Array.isArray(t)}catch(t){i=!1}const r=Boolean(null==l?void 0:l.querySelector(".monaco-diff-editor")),a=Boolean(null==l?void 0:l.querySelector(".monaco-diff-editor .view-lines .view-line"));if(r&&a&&i){if(yield E(),yield fn(),Fe)return;try{ft(),qn(),Sn(),Un()}catch(t){}return}if(n>=1&&!r)return;yield E(),yield fn()}if(!Fe)try{ft(),qn(),Sn(),Un()}catch(t){}}})}(),Fe||(Fn(),function(){if(!it.value)return;const e=ne.value;if(!e)return;const t=e.querySelector(".monaco-diff-editor");function n(e,t,n,l){const o=e.querySelector(t);if(!o)return;const i=o.getBoundingClientRect();if(i.width<=0)return;const r=o.querySelector(".line-numbers"),a=o.querySelector(".view-lines .view-line"),u=o.querySelector(".margin");let d=null;if(a?(d=a.getBoundingClientRect().left-i.left,Ln(n,d)):u&&(d=u.getBoundingClientRect().width,Ln(n,d)),r){const e=r.getBoundingClientRect();if(e.width>=20&&e.width<=64&&Ln("--stream-monaco-line-number-width",e.width),null!=d){const t=d-(e.right-i.left);Number.isFinite(t)&&t>=0&&t<=32&&(Ln(l,t),Ln("--stream-monaco-line-number-gap-to-code",t))}}}t&&(n(t,".editor.original","--stream-monaco-original-scrollable-left","--stream-monaco-original-line-number-gap-to-code"),n(t,".editor.modified","--stream-monaco-modified-scrollable-left","--stream-monaco-modified-line-number-gap-to-code"))}(),yield E(),function(){var e;if(!it.value||!Bt.value)return;const t=ne.value,n=null==(e=le.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!t||!n)return;const l=Math.ceil(n.getBoundingClientRect().height);!Number.isFinite(l)||l<=0||(t.style.height=`${l}px`,t.style.minHeight=`${l}px`)}(),yield fn(),yield function(){return d(this,null,function*(){if(it.value){if(bt.value=!0,St.value=!1,gt.value=!0,yield E(),yield fn(),!Fe){if(In(!0),St.value=!0,sn(),"undefined"==typeof window)return bt.value=!1,void(St.value=!1);kt=window.setTimeout(()=>{kt=null,bt.value=!1,St.value=!1,Q(()=>{Fn(),qn(),Un()})},120)}}else gt.value=!0})}()))})}(e))}).finally(()=>{Ke===t&&(Ke=null),function(){const e=Ne;r&&e&&(Ne="",E(()=>{var t,n;if(!Fe){const l=null!=(n=null==(t=le.value)?void 0:t.offsetHeight)?n:0;l>0&&r.reportHeight(e,l)}r.markSettled(e)}))}()});return Ke=t,t}P(ll,e=>{e||j()}),P(()=>zt.value,(e,t)=>{const n=it.value?Ge():Ve();n&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(n.updateOptions({fontSize:e}),Be.value||Wn(!0))},{flush:"post",immediate:!1});const sl=P(()=>[ne.value,it.value,l.stream,l.loading,Le.value,Ae.value],e=>d(null,[e],function*([e,t,n,l,o,i]){if(!e||!We)return;if(!i)return;if(!1===n&&!1!==l)return;const r=dl(e);if(r){try{yield r}catch(a){Oe.value=!1,gt.value=!1,wt.value=!0}sl()}}));function cl(e){return!!e&&"object"==typeof e&&"light"in e&&"dark"in e}function vl(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function fl(e,t){if(e===t)return!0;const n=vl(e),l=vl(t);return!!n&&n===l}function ml(){var e;const t=function(){if(void 0!==l.theme){const e=l.theme;return cl(e)?l.isDark?e.dark:e.light:e}return l.isDark?l.darkTheme:l.lightTheme}(),n=null==(e=mt.value)?void 0:e.theme,o=null!=t?t:n;if(null!=o&&"object"==typeof o)return o;const i=Array.isArray(l.themes)?l.themes:[];if(!i.length||null==o)return o;const r=vl(o),a=i.map(e=>vl(e)).filter(e=>!!e);if(!r||a.includes(r))return o;const u=vl(n);return null!=n&&u&&a.includes(u)?n:i[0]}P(pt,(e,t)=>d(null,null,function*(){if(e===t)return;if(ht.value=e,!We||!ne.value)return;if(!Ee.value)return;if(!1===l.stream&&!1!==l.loading)return;if(!Ae.value)return;const n=Ke;if(n){try{yield n}catch(o){}if(Fe||!ne.value)return}try{Oe.value=!1,gt.value=!1,Ee.value=!1,Tn(),An(),Xe(),yield E(),yield dl(ne.value)}catch(i){Oe.value=!1,gt.value=!1,wt.value=!0}}));const pl=c(()=>(void 0!==l.theme?!cl(l.theme):fl(l.darkTheme,l.lightTheme))?function(e){var t,n;if(e&&"object"==typeof e&&(null==(t=e.colors)?void 0:t["editor.background"])){const t=En(e.colors["editor.background"]);if(null!=t)return t<128}const o=(null!=(n=vl(e))?n:"").toLowerCase();return o?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>o.includes(e))&&!["light","latte","dawn","lotus"].some(e=>o.includes(e)):!!l.isDark}(ml()):!!l.isDark),hl=c(()=>{var e;if(!it.value)return pl.value?"dark":"light";const t=null==(e=mt.value)?void 0:e.diffAppearance;return"light"===t||"dark"===t?t:pl.value?"dark":"light"}),yl=c(()=>it.value?"dark"===hl.value:pl.value);function gl(){return u(a(u(a({wordWrap:"on",wrappingIndent:"same",themes:l.themes},mt.value||{}),{theme:ml()}),it.value?{diffAppearance:hl.value}:{}),{onThemeChange(){Nn()}})}function wl(){const e=gl();if(!lt)return lt=e,lt;for(const t of Object.keys(lt))t in e||delete lt[t];return Object.assign(lt,e),lt}const bl=c(()=>{var e,t,n,o,i,r,u,d,s,c,v,f,m,p,h;return JSON.stringify({diffLineStyle:null!=(t=null==(e=mt.value)?void 0:e.diffLineStyle)?t:"background",diffUnchangedRegionStyle:null!=(o=null==(n=mt.value)?void 0:n.diffUnchangedRegionStyle)?o:"line-info",diffHideUnchangedRegions:void 0===(null==(i=l.monacoOptions)?void 0:i.diffHideUnchangedRegions)?a({},ut):st(l.monacoOptions.diffHideUnchangedRegions),renderSideBySide:null==(u=null==(r=mt.value)?void 0:r.renderSideBySide)||u,useInlineViewWhenSpaceIsLimited:null!=(s=null==(d=mt.value)?void 0:d.useInlineViewWhenSpaceIsLimited)&&s,enableSplitViewResizing:null==(v=null==(c=mt.value)?void 0:c.enableSplitViewResizing)||v,ignoreTrimWhitespace:null==(m=null==(f=mt.value)?void 0:f.ignoreTrimWhitespace)||m,originalEditable:null!=(h=null==(p=mt.value)?void 0:p.originalEditable)&&h})});return P(()=>[l.monacoOptions,Ae.value],()=>{var e,t;if(wl(),!We||!Ae.value)return;const n=it.value?Ge():Ve(),o="number"==typeof(null==(e=l.monacoOptions)?void 0:e.fontSize)?l.monacoOptions.fontSize:Number.isFinite(zt.value)?zt.value:void 0;"number"==typeof o&&Number.isFinite(o)&&o>0&&(null==(t=null==n?void 0:n.updateOptions)||t.call(n,{fontSize:o})),Wn(!1)},{deep:!0}),P(()=>[ml(),hl.value,Le.value,Ee.value,Ae.value],([e],t)=>{Le.value&&Ee.value&&Ae.value&&function(e={}){if(e.appearanceOnly)return;wl();const t=ml(),n=()=>{it.value&&ft(),Q(()=>{Nn(),Un()})};t?function(e,t){const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&"name"in e)return String(e.name);if("object"==typeof e){const n=fe.get(e);if(n)return n;try{const t=JSON.stringify(e);if(t)return fe.set(e,t),t}catch(t){}const l="__theme_"+ ++me;return fe.set(e,l),l}return String(e)}(t);return n?(ve=e,ae||ce!==n?ae?(se===n||ue===n||(de=t,se=n),ae):(de=t,se=n,ae=d(null,null,function*(){for(;se&&null!=de;){const n=de,l=se;if(de=null,se=null,ce!==l)try{ue=l,yield(null!=ve?ve:e)(n),ce=l}catch(t){}}}).finally(()=>{ae=null,ue=null}),ae):Promise.resolve()):Promise.resolve()}(Ze,t).then(n).catch(e=>{}):n()}({appearanceOnly:null!=t&&fl(e,t[0])})},{flush:"post"}),P(()=>[bl.value,Le.value,Ae.value],(e,t)=>d(null,[e,t],function*([e,t,n],[o]){if(wl(),!t||!n)return;if(!We||!ne.value)return;if(!Ee.value)return;if(e===o)return;if(!1===l.stream&&!1!==l.loading)return;const i=Ke;if(i){try{yield i}catch(r){}if(Fe||!ne.value)return}try{Oe.value=!1,gt.value=!1,Ee.value=!1,Tn(),An(),Xe(),yield E(),yield dl(ne.value)}catch(a){Oe.value=!1,gt.value=!1,wt.value=!0}}),{flush:"post"}),P(()=>[l.loading,Ae.value],(e,t)=>d(null,[e,t],function*([e,t],n){if(!t)return;const o=null==n?void 0:n[0];if(!1===o&&!1!==e&&it.value&&Ee.value&&(yield E(),Q(()=>{d(null,null,function*(){const e=Ke;if(e)try{yield e}catch(t){}!Fe&&it.value&&!1!==l.loading&&(wl(),ft(),Un())})})),e)return;const i=void 0!==o&&!1!==o;yield E(),Q(()=>{d(null,null,function*(){var e,t,n;try{if(i&&Ee.value)if(it.value&&ne.value){const n=Ke;if(n)try{yield n}catch(o){}wl();const i=ct(String(null!=(e=l.node.originalCode)?e:""),String(null!=(t=l.node.updatedCode)?t:""));if(yield Gn(i.original,i.updated,Ce.value),Fe||!it.value)return;ft(),In(!0),qn(),Sn(),Un()}else Ie(String(null!=(n=l.node.code)?n:""),Ce.value);Wn(!1)}catch(r){}})})}),{immediate:!0,flush:"post"}),f(()=>{sn(),Tn(),An(),Je()}),(t,n)=>yt.value?(m(),p(S(I),{key:0,node:Ht.value,loading:l.loading},null,8,["node","loading"])):(m(),O("div",{key:1,ref_key:"container",ref:le,style:L(nl.value),class:g(["code-block-container rounded-lg border",[{dark:l.isDark,"is-rendering":l.loading,"is-dark":yl.value,"is-diff":it.value,"is-plain-text":Me.value}]]),"data-markstream-code-block":"1","data-markstream-enhanced":gt.value&&!yt.value?"true":"false","data-markstream-pending":Lt.value?"true":void 0},[F(ee,{"show-header":l.showHeader,"show-collapse-button":l.showCollapseButton,"show-font-size-buttons":l.showFontSizeButtons,"enable-font-size-control":l.enableFontSizeControl,"show-copy-button":l.showCopyButton,"show-expand-button":l.showExpandButton,"show-preview-button":l.showPreviewButton,"show-tooltips":l.showTooltips,"is-dark":l.isDark,loading:l.loading,stream:e.stream,"is-collapsed":Be.value,"is-expanded":Pe.value,"copy-text":oe.value,"is-previewable":Xn.value,"code-font-size":zt.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":Nt.value,"font-baseline-ready":_t.value,"diff-stats":it.value?rt.value:null,"diff-stats-aria-label":at.value,onToggleCollapse:rl,onDecreaseFont:Cn,onResetFont:Mn,onIncreaseFont:xn,onCopy:ol,onToggleExpand:il,onPreview:al},H({"header-left":N(()=>[_(t.$slots,"header-left",{},()=>[y("div",he,[y("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:tl.value},null,8,ye),y("div",ge,[y("div",we,b(Zn.value),1),el.value?(m(),O("div",be,b(el.value),1)):$("",!0)])])],!0)]),loading:N(()=>[_(t.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[n[0]||(n[0]=y("div",{class:"loading-skeleton"},[y("div",{class:"skeleton-line"}),y("div",{class:"skeleton-line"}),y("div",{class:"skeleton-line short"})],-1))],!0)]),default:N(()=>[z(y("div",Se,[y("div",{ref_key:"codeEditor",ref:ne,class:g(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":Ot.value}]]),style:L(dn.value)},null,6),Et.value?(m(),p(S(I),{key:0,class:g(["code-pre-fallback",{"is-wrap":xt.value,"is-fading-out":St.value}]),style:L(rn.value),node:Ht.value,"show-line-numbers":!0,"diff-inline":Ct.value},null,8,["class","style","node","diff-inline"])):$("",!0)],512),[[R,!(Be.value||!e.stream&&e.loading)]]),Ft.value&&!w.value&&Xn.value&&"html"===ie.value?(m(),p(re,{key:0,code:l.node.code,"html-preview-allow-scripts":l.htmlPreviewAllowScripts,"html-preview-sandbox":l.htmlPreviewSandbox,"is-dark":l.isDark,"on-close":()=>Ft.value=!1},null,8,["code","html-preview-allow-scripts","html-preview-sandbox","is-dark","on-close"])):$("",!0)]),_:2},[t.$slots["header-right"]?{name:"header-right",fn:N(()=>[_(t.$slots,"header-right",{},void 0,!0)]),key:"0"}:void 0]),1032,["show-header","show-collapse-button","show-font-size-buttons","enable-font-size-control","show-copy-button","show-expand-button","show-preview-button","show-tooltips","is-dark","loading","stream","is-collapsed","is-expanded","copy-text","is-previewable","code-font-size","default-code-font-size","font-baseline-ready","diff-stats","diff-stats-aria-label"])],14,pe))}}),[["__scopeId","data-v-8c3c403e"]]);export{Ce as default};
|