markstream-vue
Version:
Vue 3 Markdown renderer optimized for large docs: progressive Mermaid, streaming diff code blocks, and fast real-time preview.
2 lines (1 loc) • 24.4 kB
JavaScript
var e=Object.defineProperty,o=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(o,t,n)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,r=(e,o,t)=>new Promise((n,l)=>{var i=e=>{try{r(t.next(e))}catch(o){l(o)}},a=e=>{try{r(t.throw(e))}catch(o){l(o)}},r=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);r((t=t.apply(e,o)).next())});import{defineComponent as u,ref as s,watch as c,onBeforeUnmount as d,computed as v,nextTick as h,onUnmounted as m,createBlock as p,createElementBlock as g,openBlock as w,unref as f,normalizeClass as y,normalizeStyle as x,createCommentVNode as b,withDirectives as k,createElementVNode as M,renderSlot as C,toDisplayString as B,Fragment as S,vShow as O}from"vue";import{u as F,a as P,g as E,s as T,l as N,b as H,_ as z,c as L,h as $,d as j}from"./exports.js";const D={key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},Y={class:"flex items-center space-x-2 flex-1 overflow-hidden"},V=["innerHTML"],_={class:"text-sm font-medium font-mono truncate"},I={class:"flex items-center space-x-2"},q=["aria-pressed"],R=["disabled"],W=["disabled"],X=["disabled"],A=["aria-label"],G={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},U={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},J=["aria-pressed"],K={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Q={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Z=["aria-label"],ee={class:"code-loading-placeholder"},oe={class:"sr-only","aria-live":"polite",role:"status"},te=/* @__PURE__ */j(/* @__PURE__ */u({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:void 0},lightTheme:{default:void 0},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},showFontSizeButtons:{type:Boolean,default:!0},customId:{}},emits:["previewCode","copy"],setup(e,{emit:u}){var j,te;const ne=e,le=u,{t:ie}=F(),ae=s(null),re=s(null),ue=s(!1),se=s(String(null!=(j=ne.node.language)?j:"")),ce=s(!1),de=s(!1),ve=s(!1),he=s(!1),me=s(null);let pe=0;const ge=P(),we=s(null),fe=s("undefined"==typeof window);"undefined"!=typeof window&&c(()=>re.value,e=>{var o;if(null==(o=we.value)||o.destroy(),we.value=null,!e)return void(fe.value=!1);const t=ge(e,{rootMargin:"400px"});we.value=t,fe.value=t.isVisible.value,t.whenVisible.then(()=>{fe.value=!0})},{immediate:!0}),d(()=>{var e;null==(e=we.value)||e.destroy(),we.value=null});let ye=null,xe=null,be=()=>{},ke=()=>{},Me=()=>null,Ce=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Be=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Se=()=>{},Oe=()=>{},Fe=null,Pe=()=>{var e;return String(null!=(e=ne.node.language)?e:"plaintext")},Ee=()=>r(null,null,function*(){});const Te=v(()=>ne.node.diff),Ne=s(!1);"undefined"!=typeof window&&r(null,null,function*(){try{const r=yield E();if(!r)return void(Ne.value=!0);const u=r.useMonaco,s=r.detectLanguage;if("function"==typeof s&&(Pe=s),"function"==typeof u){const r=io();if(r&&ne.themes&&Array.isArray(ne.themes)&&!ne.themes.includes(r))throw new Error("Preferred theme not in provided themes array");const s=u((e=((e,o)=>{for(var t in o||(o={}))l.call(o,t)&&a(e,t,o[t]);if(n)for(var t of n(o))i.call(o,t)&&a(e,t,o[t]);return e})({wordWrap:"on",wrappingIndent:"same",themes:ne.themes,theme:r},ne.monacoOptions||{}),o(e,t({onThemeChange(){!function(){var e,o,t;const n=ae.value,l=re.value;if(!n||!l)return;const i=n.querySelector(".monaco-editor")||n;let a=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(a=window.getComputedStyle(i))}catch(c){a=null}const r=String(null!=(e=null==a?void 0:a.getPropertyValue("--vscode-editor-foreground"))?e:""),u=String(null!=(o=null==a?void 0:a.getPropertyValue("--vscode-editor-background"))?o:""),s=String(null!=(t=null==a?void 0:a.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?t:"");r&&u&&(l.style.setProperty("--vscode-editor-foreground",r.trim()),l.style.setProperty("--vscode-editor-background",u.trim()),l.style.setProperty("--vscode-editor-selectionBackground",s.trim()))}()}}))));ye=s.createEditor||ye,xe=s.createDiffEditor||xe,be=s.updateCode||be,ke=s.updateDiff||ke,Me=s.getEditor||Me,Ce=s.getEditorView||Ce,Be=s.getDiffEditorView||Be,Se=s.cleanupEditor||Se,Oe=s.safeClean||s.cleanupEditor||Oe,Ee=s.setTheme||Ee,he.value=!0,ae.value&&(yield to(ae.value))}}catch(r){Ne.value=!0}var e});const He=s("number"==typeof(null==(te=ne.monacoOptions)?void 0:te.fontSize)?ne.monacoOptions.fontSize:Number.NaN),ze=s(He.value),Le=v(()=>{const e=He.value,o=ze.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof o&&Number.isFinite(o)&&o>0});function $e(){var e,o,t,n,l;try{const i=Te.value?null!=(t=null==(o=null==(e=Be())?void 0:e.getModifiedEditor)?void 0:o.call(e))?t:Be():Ce(),a=Me(),r=null==(n=null==a?void 0:a.EditorOption)?void 0:n.fontInfo;if(i&&null!=r){const e=null==(l=i.getOption)?void 0:l.call(i,r),o=null==e?void 0:e.fontSize;if("number"==typeof o&&Number.isFinite(o)&&o>0)return o}}catch(i){}try{const e=ae.value;if(e){const o=e.querySelector(".view-lines .view-line");if(o)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(o).fontSize,t=e&&e.match(/^(\d+(?:\.\d+)?)/);if(t)return Number.parseFloat(t[1])}}catch(i){}}}catch(i){}return null}function je(e){var o,t;try{const n=Me(),l=null==(o=null==n?void 0:n.EditorOption)?void 0:o.lineHeight;if(null!=l){const o=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,l);if("number"==typeof o&&o>0)return o}}catch(i){}const n=function(){try{const e=ae.value;if(!e)return null;const o=e.querySelector(".view-lines .view-line");if(o){const e=Math.ceil(o.getBoundingClientRect().height);if(e>0)return e}}catch(i){}return null}();if(n&&n>0)return n;const l=Number.isFinite(ze.value)&&ze.value>0?ze.value:12;return Math.max(12,Math.round(1.35*l))}function De(){var e;if(Number.isFinite(ze.value)&&ze.value>0&&Number.isFinite(He.value))return ze.value;const o=$e();return"number"==typeof(null==(e=ne.monacoOptions)?void 0:e.fontSize)?(He.value=ne.monacoOptions.fontSize,ze.value=ne.monacoOptions.fontSize,ze.value):o&&o>0?(He.value=o,ze.value=o,o):(He.value=12,ze.value=12,12)}function Ye(){var e,o,t,n,l,i,a,r,u,s,c;try{const d=Te.value?Be():Ce();if(!d)return null;if(Te.value&&(null==d?void 0:d.getOriginalEditor)&&(null==d?void 0:d.getModifiedEditor)){const c=null==(e=d.getOriginalEditor)?void 0:e.call(d),v=null==(o=d.getModifiedEditor)?void 0:o.call(d),h=(null==(t=null==c?void 0:c.getContentHeight)?void 0:t.call(c))||0,m=(null==(n=null==v?void 0:v.getContentHeight)?void 0:n.call(v))||0,p=Math.max(h,m);if(p>0)return Math.ceil(p+1);const g=(null==(a=null==(i=null==(l=null==c?void 0:c.getModel)?void 0:l.call(c))?void 0:i.getLineCount)?void 0:a.call(i))||1,w=(null==(s=null==(u=null==(r=null==v?void 0:v.getModel)?void 0:r.call(v))?void 0:u.getLineCount)?void 0:s.call(u))||1,f=Math.max(g,w),y=Math.max(je(c),je(v));return Math.ceil(f*(y+1.5)+0+1)}if(null==d?void 0:d.getContentHeight){const e=d.getContentHeight();if(e>0)return Math.ceil(e+1)}const v=null==(c=null==d?void 0:d.getModel)?void 0:c.call(d);let h=1;v&&"function"==typeof v.getLineCount&&(h=v.getLineCount());const m=je(d);return Math.ceil(h*(m+1.5)+0+1)}catch(d){return null}}function Ve(){try{const e=ae.value;if(!e)return;const o=e.getBoundingClientRect(),t=window.scrollY+o.top,n=Ye();if(null!=n&&n>0){const l=o.height;e.style.height=`${Math.ceil(n)}px`,e.style.maxHeight="none";const i=Math.ceil(n)-l;0!==i&&t<window.scrollY&&window.scrollBy(0,i)}}catch(e){}}function _e(){var e;try{const o=ae.value;if(!o)return;const t=o.getBoundingClientRect(),n=window.scrollY+t.top,l=t.height,i=function(){var e,o;const t=null!=(o=null==(e=ne.monacoOptions)?void 0:e.MAX_HEIGHT)?o:500;if("number"==typeof t)return t;const n=String(t).match(/^(\d+(?:\.\d+)?)/);return n?Number.parseFloat(n[1]):500}();if(pe>0&&(pe--,null!=me.value)){const e=Math.min(me.value,i);o.style.height=`${Math.ceil(e)}px`,o.style.maxHeight=`${Math.ceil(i)}px`,o.style.overflow="auto";const t=Math.ceil(e)-l;return void(0!==t&&n<window.scrollY&&window.scrollBy(0,t))}const a=Ye();if(null!=a&&a>0){const e=Math.min(a,i);o.style.height=`${Math.ceil(e)}px`,o.style.maxHeight=`${Math.ceil(i)}px`,o.style.overflow="auto";const t=Math.ceil(e)-l;return void(0!==t&&n<window.scrollY&&window.scrollBy(0,t))}if(null!=me.value){const e=Math.min(me.value,i);o.style.height=`${Math.ceil(e)}px`,o.style.maxHeight=`${Math.ceil(i)}px`,o.style.overflow="auto";const t=Math.ceil(e)-l;return void(0!==t&&n<window.scrollY&&window.scrollBy(0,t))}const r=Math.ceil((null==(e=o.getBoundingClientRect)?void 0:e.call(o).height)||0);if(r>0){const e=Math.min(r,i);o.style.height=`${Math.ceil(e)}px`,o.style.maxHeight=`${Math.ceil(i)}px`,o.style.overflow="auto";const t=Math.ceil(e)-l;return void(0!==t&&n<window.scrollY&&window.scrollBy(0,t))}const u=Number.parseFloat(o.style.height);if(!Number.isNaN(u)&&u>0){const e=Math.ceil(Math.min(u,i));o.style.height=`${e}px`;const t=e-l;0!==t&&n<window.scrollY&&window.scrollBy(0,t)}else{const e=Math.ceil(i);o.style.height=`${e}px`;const t=e-l;0!==t&&n<window.scrollY&&window.scrollBy(0,t)}o.style.maxHeight=`${Math.ceil(i)}px`,o.style.overflow="auto"}catch(o){}}const Ie=v(()=>{const e=se.value.trim().toLowerCase();return ne.isShowPreview&&("html"===e||"svg"===e)}),qe=v(()=>"mermaid"===se.value.trim().toLowerCase());c(()=>ne.node.language,e=>{se.value=e}),c(()=>ne.node.code,e=>r(null,null,function*(){var o,t;if(!1!==ne.stream){if(se.value||(se.value=Pe(e)),ye&&!ve.value&&ae.value)try{yield to(ae.value)}catch(n){}Te.value?ke(String(null!=(o=ne.node.originalCode)?o:""),String(null!=(t=ne.node.updatedCode)?t:""),se.value):be(e,se.value),ce.value&&T(()=>Ve())}}));const Re=v(()=>{const e=se.value.trim().toLowerCase();return N[e]||e.charAt(0).toUpperCase()+e.slice(1)}),We=v(()=>{const e=se.value.trim().toLowerCase();return H(e.split(":")[0])}),Xe=v(()=>{const e={},o=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=o(ne.minWidth),n=o(ne.maxWidth);return t&&(e.minWidth=t),n&&(e.maxWidth=n),e});function Ae(){return r(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(ne.node.code)),ue.value=!0,le("copy",ne.node.code),setTimeout(()=>{ue.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function Ge(e){return!e||e.disabled}function Ue(e,o,t="top"){if(Ge(e.currentTarget))return;const n=e,l=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;L(e.currentTarget,o,t,!1,l,ne.isDark)}function Je(){$()}function Ke(e){if(Ge(e.currentTarget))return;const o=ue.value?ie("common.copied")||"Copied":ie("common.copy")||"Copy",t=e,n=null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0;L(e.currentTarget,o,"top",!1,n,ne.isDark)}function Qe(){ce.value=!ce.value;const e=Te.value?Be():Ce(),o=ae.value;e&&o&&(ce.value?(oo(!0),o.style.maxHeight="none",o.style.overflow="visible",Ve()):(oo(!1),o.style.overflow="auto",_e()))}function Ze(){var e,o,t;if(de.value=!de.value,de.value){if(ae.value){const t=Math.ceil((null==(o=(e=ae.value).getBoundingClientRect)?void 0:o.call(e).height)||0);t>0&&(me.value=t)}oo(!1)}else{ce.value&&oo(!0),ae.value&&null!=me.value&&(ae.value.style.height=`${me.value}px`);const e=Te.value?Be():Ce();try{null==(t=null==e?void 0:e.layout)||t.call(e)}catch(n){}pe=2,T(()=>{ce.value?Ve():_e()})}}function eo(){if(!Ie.value)return;const e=(se.value||ne.node.language).toLowerCase(),o="html"===e?"text/html":"image/svg+xml",t="html"===e?ie("artifacts.htmlPreviewTitle")||"HTML Preview":ie("artifacts.svgPreviewTitle")||"SVG Preview";le("previewCode",{node:ne.node,artifactType:o,artifactTitle:t,id:`temp-${e}-${Date.now()}`})}function oo(e){var o,t;try{if(Te.value){const t=Be();null==(o=null==t?void 0:t.updateOptions)||o.call(t,{automaticLayout:e})}else{const o=Ce();null==(t=null==o?void 0:o.updateOptions)||t.call(o,{automaticLayout:e})}}catch(n){}}function to(e){if(!ye)return null;if(Fe)return Fe;ve.value=!0;const o=r(null,null,function*(){yield function(e){return r(this,null,function*(){var o,t,n;if(!ye)return;Te.value?(Oe(),xe?yield xe(e,String(null!=(o=ne.node.originalCode)?o:""),String(null!=(t=ne.node.updatedCode)?t:""),se.value):yield ye(e,ne.node.code,se.value)):yield ye(e,ne.node.code,se.value);const l=Te.value?Be():Ce();if("number"==typeof(null==(n=ne.monacoOptions)?void 0:n.fontSize))null==l||l.updateOptions({fontSize:ne.monacoOptions.fontSize,automaticLayout:!1}),He.value=ne.monacoOptions.fontSize,ze.value=ne.monacoOptions.fontSize;else{const e=$e();e&&e>0?(He.value=e,ze.value=e):(He.value=12,ze.value=12)}ce.value||de.value||_e(),!1===ne.loading&&(yield h(),T(()=>{ce.value&&!de.value?Ve():de.value||_e()}))})}(e)});return Fe=o.finally(()=>{Fe=null}),Fe}c(()=>ze.value,(e,o)=>{const t=Te.value?Be():Ce();t&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(t.updateOptions({fontSize:e}),ce.value&&!de.value&&Ve())},{flush:"post",immediate:!1});const no=c(()=>[ae.value,qe.value,Te.value,ne.stream,ne.loading,he.value,fe.value],e=>r(null,[e],function*([e,o,t,n,l,i,a]){if(!e||!ye)return;if(!a)return;if(!1===n&&!1!==l)return;if(qe.value)return Se(),void no();const r=to(e);r&&(yield r,no())})),lo=c(()=>[ne.darkTheme,ne.lightTheme,ve.value,fe.value],()=>{if(ve.value&&fe.value)return qe.value?lo():void function(){const e=io();e&&Ee(e)}()});function io(){return ne.isDark?ne.darkTheme:ne.lightTheme}const ao=c(()=>[ne.monacoOptions,fe.value],()=>{var e,o;if(!ye||!fe.value)return;if(qe.value)return ao();const t=Te.value?Be():Ce(),n="number"==typeof(null==(e=ne.monacoOptions)?void 0:e.fontSize)?ne.monacoOptions.fontSize:Number.isFinite(ze.value)?ze.value:void 0;"number"==typeof n&&Number.isFinite(n)&&n>0&&(null==(o=null==t?void 0:t.updateOptions)||o.call(t,{fontSize:n})),ce.value&&!de.value?Ve():de.value||_e()},{deep:!0}),ro=c(()=>[ne.loading,fe.value],e=>r(null,[e],function*([e,o]){o&&(qe.value?h(()=>{null==ro||ro()}):e||(yield h(),T(()=>{de.value||(ce.value?Ve():_e()),ro()})))}),{immediate:!0,flush:"post"});return m(()=>{Se()}),(o,t)=>Ne.value?(w(),p(f(z),{key:0,node:e.node,loading:ne.loading},null,8,["node","loading"])):(w(),g("div",{key:1,ref_key:"container",ref:re,style:x(Xe.value),class:y(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[ne.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":ne.loading,"is-dark":ne.isDark}]])},[ne.showHeader?(w(),g("div",D,[C(o.$slots,"header-left",{},()=>[M("div",Y,[M("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:We.value},null,8,V),M("span",_,B(Re.value),1)])],!0),C(o.$slots,"header-right",{},()=>[M("div",I,[M("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":de.value,onClick:Ze,onMouseenter:t[0]||(t[0]=e=>Ue(e,de.value?f(ie)("common.expand")||"Expand":f(ie)("common.collapse")||"Collapse")),onFocus:t[1]||(t[1]=e=>Ue(e,de.value?f(ie)("common.expand")||"Expand":f(ie)("common.collapse")||"Collapse")),onMouseleave:Je,onBlur:Je},[(w(),g("svg",{style:x({rotate:de.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...t[17]||(t[17]=[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,q),ne.showFontSizeButtons&&ne.enableFontSizeControl?(w(),g(S,{key:0},[M("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(ze.value)&&ze.value<=10,onClick:t[2]||(t[2]=e=>function(){const e=De(),o=Math.max(10,e-1);ze.value=o}()),onMouseenter:t[3]||(t[3]=e=>Ue(e,f(ie)("common.decrease")||"Decrease")),onFocus:t[4]||(t[4]=e=>Ue(e,f(ie)("common.decrease")||"Decrease")),onMouseleave:Je,onBlur:Je},[...t[18]||(t[18]=[M("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,R),M("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!Le.value||ze.value===He.value,onClick:t[5]||(t[5]=e=>(De(),void(Number.isFinite(He.value)&&(ze.value=He.value)))),onMouseenter:t[6]||(t[6]=e=>Ue(e,f(ie)("common.reset")||"Reset")),onFocus:t[7]||(t[7]=e=>Ue(e,f(ie)("common.reset")||"Reset")),onMouseleave:Je,onBlur:Je},[...t[19]||(t[19]=[M("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[M("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[M("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),M("path",{d:"M3 3v5h5"})])],-1)])],40,W),M("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(ze.value)&&ze.value>=36,onClick:t[8]||(t[8]=e=>function(){const e=De(),o=Math.min(36,e+1);ze.value=o}()),onMouseenter:t[9]||(t[9]=e=>Ue(e,f(ie)("common.increase")||"Increase")),onFocus:t[10]||(t[10]=e=>Ue(e,f(ie)("common.increase")||"Increase")),onMouseleave:Je,onBlur:Je},[...t[20]||(t[20]=[M("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,X)],64)):b("",!0),ne.showCopyButton?(w(),g("button",{key:1,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":ue.value?f(ie)("common.copied")||"Copied":f(ie)("common.copy")||"Copy",onClick:Ae,onMouseenter:t[11]||(t[11]=e=>Ke(e)),onFocus:t[12]||(t[12]=e=>Ke(e)),onMouseleave:Je,onBlur:Je},[ue.value?(w(),g("svg",U,[...t[22]||(t[22]=[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(w(),g("svg",G,[...t[21]||(t[21]=[M("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[M("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),M("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,A)):b("",!0),ne.showExpandButton?(w(),g("button",{key:2,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":ce.value,onClick:Qe,onMouseenter:t[13]||(t[13]=e=>Ue(e,ce.value?f(ie)("common.collapse")||"Collapse":f(ie)("common.expand")||"Expand")),onFocus:t[14]||(t[14]=e=>Ue(e,ce.value?f(ie)("common.collapse")||"Collapse":f(ie)("common.expand")||"Expand")),onMouseleave:Je,onBlur:Je},[ce.value?(w(),g("svg",K,[...t[23]||(t[23]=[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])):(w(),g("svg",Q,[...t[24]||(t[24]=[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])]))],40,J)):b("",!0),Ie.value&&ne.showPreviewButton?(w(),g("button",{key:3,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":f(ie)("common.preview")||"Preview",onClick:eo,onMouseenter:t[15]||(t[15]=e=>Ue(e,f(ie)("common.preview")||"Preview")),onFocus:t[16]||(t[16]=e=>Ue(e,f(ie)("common.preview")||"Preview")),onMouseleave:Je,onBlur:Je},[...t[25]||(t[25]=[M("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[M("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[M("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),M("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})])],-1)])],40,Z)):b("",!0)])],!0)])):b("",!0),k(M("div",{ref_key:"codeEditor",ref:ae,class:y(["code-editor-container",[e.stream?"":"code-height-placeholder"]])},null,2),[[O,!(de.value||!e.stream&&e.loading)]]),k(M("div",ee,[C(o.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[t[26]||(t[26]=M("div",{class:"loading-skeleton"},[M("div",{class:"skeleton-line"}),M("div",{class:"skeleton-line"}),M("div",{class:"skeleton-line short"})],-1))],!0)],512),[[O,!e.stream&&e.loading]]),M("span",oe,B(ue.value?f(ie)("common.copied")||"Copied":""),1)],6))}}),[["__scopeId","data-v-c3ca09d1"]]);te.install=e=>{e.component(te.__name,te)};export{te as default};