import{U as rt,c as B,x as M,y as V,aX as Et,O as ut,o as F,b as be,g,h as D,aq as Ee,B as u,t as Ye,v as Ne,F as Nt,q as G,a2 as Qe,a3 as Ze,n as oe,N as $t,R as Tt,bG as zt,bJ as Dt,aY as ye}from"./index-b7f60880.js";import{J as st,n as ct,D as $e,U as Ht,o as Lt,q as et,F as jt,f as tt,O as Yt,Y as nt,b as qt}from"./MessageList-9d9a3799.js";import{e as ae}from"./safeRaf-623176f7.js";import"./toast-9a90685d.js";var Vt=Object.defineProperty,Wt=Object.defineProperties,It=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,lt=(h,m,b)=>m in h?Vt(h,m,{enumerable:!0,configurable:!0,writable:!0,value:b}):h[m]=b,Te=(h,m)=>{for(var b in m||(m={}))Rt.call(m,b)&&lt(h,b,m[b]);if(ot)for(var b of ot(m))Ut.call(m,b)&&lt(h,b,m[b]);return h},it=(h,m)=>Wt(h,It(m)),Y=(h,m,b)=>new Promise((l,W)=>{var N=d=>{try{p(b.next(d))}catch(X){W(X)}},k=d=>{try{p(b.throw(d))}catch(X){W(X)}},p=d=>d.done?l(d.value):Promise.resolve(d.value).then(N,k);p((b=b.apply(h,m)).next())});const Xt={class:"markstream-vue"},Jt={class:"html-preview-frame__header"},At={class:"html-preview-frame__title"},Gt={class:"html-preview-frame__label"},Kt=["srcdoc"],Qt=st(rt({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(h){const m=h,{t:b}=ct(),l=B(()=>{const N=m.code||"",k=N.trim().toLowerCase();return k.startsWith("<!doctype")||k.startsWith("<html")||k.startsWith("<body")?N:`<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      html, body {
        margin: 0;
        padding: 0;
        height: 100%;
        background-color: ${m.isDark?"#020617":"#ffffff"};
        color: ${m.isDark?"#e5e7eb":"#020617"};
      }
      body {
        font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;
      }
    </style>
  </head>
  <body>
    ${N}
  </body>
</html>`});function W(N){var k;N.key!=="Escape"&&N.key!=="Esc"||(k=m.onClose)==null||k.call(m)}return $t(()=>{typeof window<"u"&&window.addEventListener("keydown",W)}),ut(()=>{typeof window<"u"&&window.removeEventListener("keydown",W)}),(N,k)=>(F(),be(zt,{to:"body"},[u("div",Xt,[u("div",{class:oe(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":m.isDark}]),onClick:k[2]||(k[2]=p=>{var d;return(d=m.onClose)==null?void 0:d.call(m)})},[u("div",{class:oe(["html-preview-frame",{"html-preview-frame--dark":m.isDark}]),onClick:k[1]||(k[1]=Tt(()=>{},["stop"]))},[u("div",Jt,[u("div",At,[k[3]||(k[3]=u("span",{class:"html-preview-frame__dot"},null,-1)),u("span",Gt,Ye(m.title||g(b)("common.preview")||"Preview"),1)]),u("button",{type:"button",class:oe(["html-preview-frame__close",{"html-preview-frame__close--dark":m.isDark}]),onClick:k[0]||(k[0]=p=>{var d;return(d=m.onClose)==null?void 0:d.call(m)})}," × ",2)]),u("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:l.value},null,8,Kt)],2)],2)])]))}}),[["__scopeId","data-v-296dd89d"]]);let te=null,ze=null,re=null,ne=null,De=null,He=null;const Le=new WeakMap;let Zt=0;const en={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, var(--markstream-code-fallback-fg))","background-color":"var(--vscode-editor-background, var(--markstream-code-fallback-bg))"}},tn={class:"flex items-center gap-x-2 flex-1 overflow-hidden"},nn=["innerHTML"],on={class:"text-sm font-medium font-mono truncate"},ln={class:"flex items-center gap-x-2"},an=["aria-pressed"],rn=["disabled"],un=["disabled"],sn=["disabled"],cn=["aria-label"],dn={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"},vn={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"},mn=["aria-pressed"],pn={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"},hn={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"},fn=["aria-label"],wn={class:"code-editor-layer"},gn={class:"code-loading-placeholder"},yn={class:"sr-only","aria-live":"polite",role:"status"},at="__markstreamMonacoPassiveTouch__",je=st(rt({__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(h,{emit:m}){var b;const l=h,W=m;typeof window<"u"&&function(){var t;try{const e=window;if(e[at])return;const n=(t=window.Element)==null?void 0:t.prototype,o=n==null?void 0:n.addEventListener;if(!n||!o)return;n.addEventListener=function(i,a,c){return i==="touchstart"&&function(r,y){if(!r)return!1;const s=r;return!(typeof s.closest!="function"||!s.closest(".monaco-editor, .monaco-diff-editor")||y&&typeof y=="object"&&"passive"in y)}(this,c)?o.call(this,i,a,function(r){return r==null?{passive:!0}:typeof r=="boolean"?{capture:r,passive:!0}:typeof r=="object"?"passive"in r?r:it(Te({},r),{passive:!0}):{passive:!0}}(c)):o.call(this,i,a,c)},e[at]=!0}catch{}}();const N=Dt(),k=B(()=>{const t=N==null?void 0:N.vnode.props;return!(!t||!t.onPreviewCode&&!t.onPreviewCode)}),{t:p}=ct(),d=M(null),X=M(null),K=M(!1),H=M($e(l.node.language)),le=B(()=>Ht(H.value)),S=M(!1),O=M(!1),ue=M(!1),Q=M(!1),se=M(!1),J=M(null);let ke=0;const dt=Lt(),ie=M(null),I=M(typeof window>"u");typeof window<"u"&&V(()=>X.value,t=>{var e;if((e=ie.value)==null||e.destroy(),ie.value=null,!t)return void(I.value=!1);const n=dt(t,{rootMargin:"400px"});ie.value=n,I.value=n.isVisible.value,n.whenVisible.then(()=>{I.value=!0})},{immediate:!0}),Et(()=>{var t;(t=ie.value)==null||t.destroy(),ie.value=null});let L=null,ce=null,xe=()=>{},Me=()=>{},de=()=>null,j=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),z=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Ce=()=>{},ve=()=>{},Z=null,qe=()=>{var t;return String((t=l.node.language)!=null?t:"plaintext")},Be=()=>Y(null,null,function*(){});const P=B(()=>l.node.diff),Ve=B(()=>P.value?"diff":"single"),vt=M(Ve.value),me=M(!1),mt=B(()=>{var t;const e=(t=l.monacoOptions)==null?void 0:t.wordWrap;return e==null||String(e)!=="off"}),We=B(()=>typeof window<"u"&&!me.value&&!Q.value),pe=M(!1);typeof window<"u"&&Y(null,null,function*(){try{const t=yield Yt();if(!t)return void(me.value=!0);const e=t.useMonaco,n=t.detectLanguage;if(typeof n=="function"&&(qe=n),typeof e=="function"){const o=Ae();if(o&&l.themes&&Array.isArray(l.themes)&&!l.themes.includes(o))throw new Error("Preferred theme not in provided themes array");const i=e(it(Te({wordWrap:"on",wrappingIndent:"same",themes:l.themes,theme:o},l.monacoOptions||{}),{onThemeChange(){Fe()}}));L=i.createEditor||L,ce=i.createDiffEditor||ce,xe=i.updateCode||xe,Me=i.updateDiff||Me,de=i.getEditor||de,j=i.getEditorView||j,z=i.getDiffEditorView||z,Ce=i.cleanupEditor||Ce,ve=i.safeClean||i.cleanupEditor||ve,Be=i.setTheme||Be,se.value=!0,d.value&&(yield fe(d.value))}}catch{me.value=!0}});const $=M(typeof((b=l.monacoOptions)==null?void 0:b.fontSize)=="number"?l.monacoOptions.fontSize:Number.NaN),f=M($.value),pt=B(()=>{const t=$.value,e=f.value;return typeof t=="number"&&Number.isFinite(t)&&t>0&&typeof e=="number"&&Number.isFinite(e)&&e>0}),Ie=B(()=>{var t;const e=(t=l.monacoOptions)==null?void 0:t.fontSize;if(typeof e=="number"&&Number.isFinite(e)&&e>0)return e;const n=f.value;return typeof n=="number"&&Number.isFinite(n)&&n>0?n:12}),ht=B(()=>{var t;const e=(t=l.monacoOptions)==null?void 0:t.lineHeight;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:Math.round(1.5*Ie.value)}),ft=B(()=>{var t;const e=(t=l.monacoOptions)==null?void 0:t.tabSize;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:4}),wt=B(()=>{var t;const e=(t=l.monacoOptions)==null?void 0:t.fontFamily;return Te({fontSize:`${Ie.value}px`,lineHeight:`${ht.value}px`,tabSize:ft.value},typeof e=="string"&&e.trim()?{"--markstream-code-font-family":e.trim()}:{})});function Re(){var t,e,n,o,i;try{const a=P.value?(n=(e=(t=z())==null?void 0:t.getModifiedEditor)==null?void 0:e.call(t))!=null?n:z():j(),c=de(),r=(o=c==null?void 0:c.EditorOption)==null?void 0:o.fontInfo;if(a&&r!=null){const y=(i=a.getOption)==null?void 0:i.call(a,r),s=y==null?void 0:y.fontSize;if(typeof s=="number"&&Number.isFinite(s)&&s>0)return s}}catch{}try{const a=d.value;if(a){const c=a.querySelector(".view-lines .view-line");if(c)try{if(typeof window<"u"&&typeof window.getComputedStyle=="function"){const r=window.getComputedStyle(c).fontSize,y=r&&r.match(/^(\d+(?:\.\d+)?)/);if(y)return Number.parseFloat(y[1])}}catch{}}}catch{}return null}function Se(t){var e,n;try{const a=de(),c=(e=a==null?void 0:a.EditorOption)==null?void 0:e.lineHeight;if(c!=null){const r=(n=t==null?void 0:t.getOption)==null?void 0:n.call(t,c);if(typeof r=="number"&&r>0)return r}}catch{}const o=function(){try{const a=d.value;if(!a)return null;const c=a.querySelector(".view-lines .view-line");if(c){const r=Math.ceil(c.getBoundingClientRect().height);if(r>0)return r}}catch{}return null}();if(o&&o>0)return o;const i=Number.isFinite(f.value)&&f.value>0?f.value:12;return Math.max(12,Math.round(1.35*i))}function Oe(){var t;if(Number.isFinite(f.value)&&f.value>0&&Number.isFinite($.value))return f.value;const e=Re();return typeof((t=l.monacoOptions)==null?void 0:t.fontSize)=="number"?($.value=l.monacoOptions.fontSize,f.value=l.monacoOptions.fontSize,f.value):e&&e>0?($.value=e,f.value=e,e):($.value=12,f.value=12,12)}function Ue(){var t,e,n,o,i,a,c,r,y,s,v,q,R,x;try{const w=P.value?z():j();if(!w)return null;if(P.value&&(w!=null&&w.getOriginalEditor)&&(w!=null&&w.getModifiedEditor)){const C=(t=w.getOriginalEditor)==null?void 0:t.call(w),E=(e=w.getModifiedEditor)==null?void 0:e.call(w);(n=C==null?void 0:C.layout)==null||n.call(C),(o=E==null?void 0:E.layout)==null||o.call(E);const ge=((i=C==null?void 0:C.getContentHeight)==null?void 0:i.call(C))||0,Ge=((a=E==null?void 0:E.getContentHeight)==null?void 0:a.call(E))||0,Ke=Math.max(ge,Ge);if(Ke>0)return Math.ceil(Ke+1);const Ot=((y=(r=(c=C==null?void 0:C.getModel)==null?void 0:c.call(C))==null?void 0:r.getLineCount)==null?void 0:y.call(r))||1,Ft=((q=(v=(s=E==null?void 0:E.getModel)==null?void 0:s.call(E))==null?void 0:v.getLineCount)==null?void 0:q.call(v))||1,_t=Math.max(Ot,Ft),Pt=Math.max(Se(C),Se(E));return Math.ceil(_t*(Pt+1.5)+0+1)}if(w!=null&&w.getContentHeight){(R=w==null?void 0:w.layout)==null||R.call(w);const C=w.getContentHeight();if(C>0)return Math.ceil(C+1)}const U=(x=w==null?void 0:w.getModel)==null?void 0:x.call(w);let we=1;U&&typeof U.getLineCount=="function"&&(we=U.getLineCount());const Pe=Se(w);return Math.ceil(we*(Pe+1.5)+0+1)}catch{return null}}function Fe(){var t,e,n,o,i,a,c,r;const y=d.value,s=X.value;if(!y||!s)return;const v=y.querySelector(".monaco-editor")||y,q=v.querySelector(".monaco-editor-background")||v,R=v.querySelector(".view-lines")||v;let x=null,w=null,U=null;try{typeof window<"u"&&typeof window.getComputedStyle=="function"&&(x=window.getComputedStyle(v),w=q===v?x:window.getComputedStyle(q),U=R===v?x:window.getComputedStyle(R))}catch{x=null,w=null,U=null}const we=String((t=x==null?void 0:x.getPropertyValue("--vscode-editor-foreground"))!=null?t:"").trim(),Pe=String((e=x==null?void 0:x.getPropertyValue("--vscode-editor-background"))!=null?e:"").trim(),C=String((o=(n=x==null?void 0:x.getPropertyValue("--vscode-editor-selectionBackground"))!=null?n:x==null?void 0:x.getPropertyValue("--vscode-editor-hoverHighlightBackground"))!=null?o:"").trim(),E=we||String((a=(i=U==null?void 0:U.color)!=null?i:x==null?void 0:x.color)!=null?a:"").trim(),ge=Pe||String((r=(c=w==null?void 0:w.backgroundColor)!=null?c:x==null?void 0:x.backgroundColor)!=null?r:"").trim();E&&s.style.setProperty("--vscode-editor-foreground",E),ge&&s.style.setProperty("--vscode-editor-background",ge),C&&s.style.setProperty("--vscode-editor-selectionBackground",C)}function A(){try{const t=d.value;if(!t)return;const e=t.getBoundingClientRect(),n=window.scrollY+e.top,o=Ue();if(o!=null&&o>0){const i=e.height;t.style.height=`${Math.ceil(o)}px`,t.style.maxHeight="none";const a=Math.ceil(o)-i;a!==0&&n<window.scrollY&&window.scrollBy(0,a)}}catch{}}function ee(){var t;try{const e=d.value;if(!e)return;const n=e.getBoundingClientRect(),o=window.scrollY+n.top,i=n.height,a=function(){var s,v;const q=(v=(s=l.monacoOptions)==null?void 0:s.MAX_HEIGHT)!=null?v:500;if(typeof q=="number")return q;const R=String(q).match(/^(\d+(?:\.\d+)?)/);return R?Number.parseFloat(R[1]):500}();if(ke>0&&(ke--,J.value!=null)){const s=Math.min(J.value,a);e.style.height=`${Math.ceil(s)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const v=Math.ceil(s)-i;return void(v!==0&&o<window.scrollY&&window.scrollBy(0,v))}const c=Ue();if(c!=null&&c>0){const s=Math.min(c,a);e.style.height=`${Math.ceil(s)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const v=Math.ceil(s)-i;return void(v!==0&&o<window.scrollY&&window.scrollBy(0,v))}if(J.value!=null){const s=Math.min(J.value,a);e.style.height=`${Math.ceil(s)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const v=Math.ceil(s)-i;return void(v!==0&&o<window.scrollY&&window.scrollBy(0,v))}const r=Math.ceil(((t=e.getBoundingClientRect)==null?void 0:t.call(e).height)||0);if(r>0){const s=Math.min(r,a);e.style.height=`${Math.ceil(s)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const v=Math.ceil(s)-i;return void(v!==0&&o<window.scrollY&&window.scrollBy(0,v))}const y=Number.parseFloat(e.style.height);if(!Number.isNaN(y)&&y>0){const s=Math.ceil(Math.min(y,a));e.style.height=`${s}px`;const v=s-i;v!==0&&o<window.scrollY&&window.scrollBy(0,v)}else{const s=Math.ceil(a);e.style.height=`${s}px`;const v=s-i;v!==0&&o<window.scrollY&&window.scrollBy(0,v)}e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto"}catch{}}const _e=B(()=>l.isShowPreview&&(H.value==="html"||H.value==="svg"));V(()=>l.node.language,t=>{H.value=$e(t)}),V(()=>l.node.code,t=>Y(null,null,function*(){var e,n;if(l.stream!==!1){if(H.value||(H.value=$e(qe(t))),L&&!ue.value&&d.value)try{yield fe(d.value)}catch{}P.value?Me(String((e=l.node.originalCode)!=null?e:""),String((n=l.node.updatedCode)!=null?n:""),le.value):xe(t,le.value),S.value&&ae(()=>A())}}));const gt=B(()=>{const t=H.value;return t?et[t]||t.charAt(0).toUpperCase()+t.slice(1):et[""]}),yt=B(()=>jt(H.value||"")),bt=B(()=>{const t={},e=i=>{if(i!=null)return typeof i=="number"?`${i}px`:String(i)},n=e(l.minWidth),o=e(l.maxWidth);return n&&(t.minWidth=n),o&&(t.maxWidth=o),t});function kt(){return Y(this,null,function*(){try{typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(l.node.code)),K.value=!0,W("copy",l.node.code),setTimeout(()=>{K.value=!1},1e3)}catch(t){console.error("复制失败:",t)}})}function Xe(t){return!t||t.disabled}function T(t,e,n="top"){if(Xe(t.currentTarget))return;const o=t,i=(o==null?void 0:o.clientX)!=null&&(o==null?void 0:o.clientY)!=null?{x:o.clientX,y:o.clientY}:void 0;nt(t.currentTarget,e,n,!1,i,l.isDark)}function _(){qt()}function Je(t){if(Xe(t.currentTarget))return;const e=K.value?p("common.copied")||"Copied":p("common.copy")||"Copy",n=t,o=(n==null?void 0:n.clientX)!=null&&(n==null?void 0:n.clientY)!=null?{x:n.clientX,y:n.clientY}:void 0;nt(t.currentTarget,e,"top",!1,o,l.isDark)}function xt(){S.value=!S.value;const t=P.value?z():j(),e=d.value;t&&e&&(S.value?(he(!0),e.style.maxHeight="none",e.style.overflow="visible",A()):(he(!1),e.style.overflow="auto",ee()))}function Mt(){var t,e,n;if(O.value=!O.value,O.value){if(d.value){const o=Math.ceil(((e=(t=d.value).getBoundingClientRect)==null?void 0:e.call(t).height)||0);o>0&&(J.value=o)}he(!1)}else{S.value&&he(!0),d.value&&J.value!=null&&(d.value.style.height=`${J.value}px`);const o=P.value?z():j();try{(n=o==null?void 0:o.layout)==null||n.call(o)}catch{}ke=2,ae(()=>{S.value?A():ee()})}}function Ct(){if(!_e.value)return;const t=H.value;if(k.value){const e=t==="html"?"text/html":"image/svg+xml",n=t==="html"?p("artifacts.htmlPreviewTitle")||"HTML Preview":p("artifacts.svgPreviewTitle")||"SVG Preview";return void W("previewCode",{node:l.node,artifactType:e,artifactTitle:n,id:`temp-${t}-${Date.now()}`})}t==="html"&&(pe.value=!pe.value)}function he(t){var e,n;try{if(P.value){const o=z();(e=o==null?void 0:o.updateOptions)==null||e.call(o,{automaticLayout:t})}else{const o=j();(n=o==null?void 0:o.updateOptions)==null||n.call(o,{automaticLayout:t})}}catch{}}function fe(t){return L?Z||(ue.value=!0,Z=Y(null,null,function*(){yield function(n){return Y(this,null,function*(){var o,i,a;if(!L)return;P.value?(ve(),ce?yield ce(n,String((o=l.node.originalCode)!=null?o:""),String((i=l.node.updatedCode)!=null?i:""),le.value):yield L(n,l.node.code,le.value)):yield L(n,l.node.code,le.value);const c=P.value?z():j();if(typeof((a=l.monacoOptions)==null?void 0:a.fontSize)=="number")c==null||c.updateOptions({fontSize:l.monacoOptions.fontSize,automaticLayout:!1}),$.value=l.monacoOptions.fontSize,f.value=l.monacoOptions.fontSize;else{const r=Re();r&&r>0?($.value=r,f.value=r):($.value=12,f.value=12)}S.value||O.value||ee(),l.loading===!1&&(yield ye(),ae(()=>{S.value&&!O.value?A():O.value||ee()})),yield ye(),Q.value=!0,Fe()})}(t)}).finally(()=>{Z=null}),Z):null}V(()=>f.value,(t,e)=>{const n=P.value?z():j();n&&typeof t=="number"&&Number.isFinite(t)&&t>0&&(n.updateOptions({fontSize:t}),S.value&&!O.value&&A())},{flush:"post",immediate:!1});const Bt=V(()=>[d.value,P.value,l.stream,l.loading,se.value,I.value],t=>Y(null,[t],function*([e,n,o,i,a,c]){if(!e||!L||!c||o===!1&&i!==!1)return;const r=fe(e);if(r){try{yield r}catch{Q.value=!1}Bt()}}));function Ae(){return l.isDark?l.darkTheme:l.lightTheme}V(Ve,(t,e)=>Y(null,null,function*(){if(t!==e&&(vt.value=t,L&&d.value&&ue.value&&(l.stream!==!1||l.loading===!1)&&I.value))try{Q.value=!1,ue.value=!1,Z=null,ve(),yield ye(),yield fe(d.value)}catch{Q.value=!1}})),V(()=>[l.isDark,l.darkTheme,l.lightTheme,se.value],()=>{se.value&&function(){const t=Ae();t&&function(e,n){const o=function(i){if(i==null)return null;if(typeof i=="string")return i;if(typeof i=="object"&&i&&"name"in i)return String(i.name);if(typeof i=="object"){const a=Le.get(i);if(a)return a;try{const r=JSON.stringify(i);if(r)return Le.set(i,r),r}catch{}const c="__theme_"+ ++Zt;return Le.set(i,c),c}return String(i)}(n);return o?(He=e,te||De!==o?te?(ne===o||ze===o||(re=n,ne=o),te):(re=n,ne=o,te=Y(null,null,function*(){for(;ne&&re!=null;){const i=re,a=ne;if(re=null,ne=null,De!==a)try{ze=a,yield(He??e)(i),De=a}catch{}}}).finally(()=>{te=null,ze=null}),te):Promise.resolve()):Promise.resolve()}(Be,t).then(()=>{Q.value&&ae(()=>Fe())})}()}),V(()=>[l.monacoOptions,I.value],()=>{var t,e;if(!L||!I.value)return;const n=P.value?z():j(),o=typeof((t=l.monacoOptions)==null?void 0:t.fontSize)=="number"?l.monacoOptions.fontSize:Number.isFinite(f.value)?f.value:void 0;typeof o=="number"&&Number.isFinite(o)&&o>0&&((e=n==null?void 0:n.updateOptions)==null||e.call(n,{fontSize:o})),S.value&&!O.value?A():O.value||ee()},{deep:!0});const St=V(()=>[l.loading,I.value],t=>Y(null,[t],function*([e,n]){n&&(e||(yield ye(),ae(()=>{O.value||(S.value?A():ee()),St()})))}),{immediate:!0,flush:"post"});return ut(()=>{Ce()}),(t,e)=>me.value?(F(),be(g(tt),{key:0,node:h.node,loading:l.loading},null,8,["node","loading"])):(F(),D("div",{key:1,ref_key:"container",ref:X,style:Ne(bt.value),class:oe(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[l.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":l.loading,"is-dark":l.isDark}]])},[l.showHeader?(F(),D("div",en,[Ee(t.$slots,"header-left",{},()=>[u("div",tn,[u("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:yt.value},null,8,nn),u("span",on,Ye(gt.value),1)])],!0),Ee(t.$slots,"header-right",{},()=>[u("div",ln,[u("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":O.value,onClick:Mt,onMouseenter:e[0]||(e[0]=n=>T(n,O.value?g(p)("common.expand")||"Expand":g(p)("common.collapse")||"Collapse")),onFocus:e[1]||(e[1]=n=>T(n,O.value?g(p)("common.expand")||"Expand":g(p)("common.collapse")||"Collapse")),onMouseleave:_,onBlur:_},[(F(),D("svg",{style:Ne({rotate:O.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"},[...e[17]||(e[17]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,an),l.showFontSizeButtons&&l.enableFontSizeControl?(F(),D(Nt,{key:0},[u("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(f.value)&&f.value<=10,onClick:e[2]||(e[2]=n=>function(){const o=Oe(),i=Math.max(10,o-1);f.value=i}()),onMouseenter:e[3]||(e[3]=n=>T(n,g(p)("common.decrease")||"Decrease")),onFocus:e[4]||(e[4]=n=>T(n,g(p)("common.decrease")||"Decrease")),onMouseleave:_,onBlur:_},[...e[18]||(e[18]=[u("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"},[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,rn),u("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!pt.value||f.value===$.value,onClick:e[5]||(e[5]=n=>(Oe(),void(Number.isFinite($.value)&&(f.value=$.value)))),onMouseenter:e[6]||(e[6]=n=>T(n,g(p)("common.reset")||"Reset")),onFocus:e[7]||(e[7]=n=>T(n,g(p)("common.reset")||"Reset")),onMouseleave:_,onBlur:_},[...e[19]||(e[19]=[u("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"},[u("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[u("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),u("path",{d:"M3 3v5h5"})])],-1)])],40,un),u("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(f.value)&&f.value>=36,onClick:e[8]||(e[8]=n=>function(){const o=Oe(),i=Math.min(36,o+1);f.value=i}()),onMouseenter:e[9]||(e[9]=n=>T(n,g(p)("common.increase")||"Increase")),onFocus:e[10]||(e[10]=n=>T(n,g(p)("common.increase")||"Increase")),onMouseleave:_,onBlur:_},[...e[20]||(e[20]=[u("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"},[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,sn)],64)):G("",!0),l.showCopyButton?(F(),D("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":K.value?g(p)("common.copied")||"Copied":g(p)("common.copy")||"Copy",onClick:kt,onMouseenter:e[11]||(e[11]=n=>Je(n)),onFocus:e[12]||(e[12]=n=>Je(n)),onMouseleave:_,onBlur:_},[K.value?(F(),D("svg",vn,[...e[22]||(e[22]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(F(),D("svg",dn,[...e[21]||(e[21]=[u("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[u("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),u("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,cn)):G("",!0),l.showExpandButton?(F(),D("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":S.value,onClick:xt,onMouseenter:e[13]||(e[13]=n=>T(n,S.value?g(p)("common.collapse")||"Collapse":g(p)("common.expand")||"Expand")),onFocus:e[14]||(e[14]=n=>T(n,S.value?g(p)("common.collapse")||"Collapse":g(p)("common.expand")||"Expand")),onMouseleave:_,onBlur:_},[S.value?(F(),D("svg",pn,[...e[23]||(e[23]=[u("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)])])):(F(),D("svg",hn,[...e[24]||(e[24]=[u("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,mn)):G("",!0),_e.value&&l.showPreviewButton?(F(),D("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":g(p)("common.preview")||"Preview",onClick:Ct,onMouseenter:e[15]||(e[15]=n=>T(n,g(p)("common.preview")||"Preview")),onFocus:e[16]||(e[16]=n=>T(n,g(p)("common.preview")||"Preview")),onMouseleave:_,onBlur:_},[...e[25]||(e[25]=[u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[u("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[u("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"}),u("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,fn)):G("",!0)])],!0)])):G("",!0),Qe(u("div",wn,[u("div",{ref_key:"codeEditor",ref:d,class:oe(["code-editor-container",[h.stream?"":"code-height-placeholder",{"is-hidden":We.value}]])},null,2),We.value?(F(),be(g(tt),{key:0,class:oe(["code-pre-fallback",{"is-wrap":mt.value}]),style:Ne(wt.value),node:h.node},null,8,["class","style","node"])):G("",!0)],512),[[Ze,!(O.value||!h.stream&&h.loading)]]),pe.value&&!k.value&&_e.value&&H.value==="html"?(F(),be(Qt,{key:1,code:h.node.code,"is-dark":l.isDark,"on-close":()=>pe.value=!1},null,8,["code","is-dark","on-close"])):G("",!0),Qe(u("div",gn,[Ee(t.$slots,"loading",{loading:h.loading,stream:h.stream},()=>[e[26]||(e[26]=u("div",{class:"loading-skeleton"},[u("div",{class:"skeleton-line"}),u("div",{class:"skeleton-line"}),u("div",{class:"skeleton-line short"})],-1))],!0)],512),[[Ze,!h.stream&&h.loading]]),u("span",yn,Ye(K.value?g(p)("common.copied")||"Copied":""),1)],6))}}),[["__scopeId","data-v-bf41db7f"]]);je.install=h=>{h.component(je.__name,je)};export{je as default};
