markstream-vue 0.0.7 → 0.0.8-beta.1
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 +4 -1
- package/README.zh-CN.md +4 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -0
- package/dist/index.tailwind.css +1 -1
- package/dist/index2.js +1 -1
- package/dist/index3.js +1 -1
- package/dist/index4.js +1 -1
- package/dist/index5.js +1 -1
- package/dist/index7.js +1 -1
- package/dist/languageIconExtended.js +1 -0
- package/dist/tailwind.ts +0 -0
- package/package.json +6 -3
- package/dist/index8.js +0 -1
package/dist/index4.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=Object.defineProperties,o=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,r=(e,t)=>{for(var o in t||(t={}))l.call(t,o)&&a(e,o,t[o]);if(n)for(var o of n(t))i.call(t,o)&&a(e,o,t[o]);return e},u=(e,n)=>t(e,o(n)),s=(e,t,o)=>new Promise((n,l)=>{var i=e=>{try{r(o.next(e))}catch(t){l(t)}},a=e=>{try{r(o.throw(e))}catch(t){l(t)}},r=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);r((o=o.apply(e,t)).next())});import{defineComponent as c,computed as d,onMounted as v,onUnmounted as m,createBlock as p,openBlock as h,Teleport as f,createElementVNode as w,normalizeClass as g,withModifiers as y,toDisplayString as b,unref as k,getCurrentInstance as x,ref as M,watch as C,onBeforeUnmount as B,nextTick as S,createElementBlock as O,normalizeStyle as _,createCommentVNode as F,withDirectives as P,renderSlot as E,Fragment as N,vShow as T}from"vue";import{u as z,_ as H,n as $,r as j,a as D,g as L,l as Y,b as W,c as V,s as q,h as I}from"./exports.js";import{s as R}from"./safeRaf.js";const X={class:"markstream-vue"},A={class:"html-preview-frame__header"},G={class:"html-preview-frame__title"},J={class:"html-preview-frame__label"},U=["srcdoc"],K=/* @__PURE__ */H(/* @__PURE__ */c({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(e){const t=e,{t:o}=z(),n=d(()=>{const e=t.code||"",o=e.trim().toLowerCase();return o.startsWith("<!doctype")||o.startsWith("<html")||o.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>`});function l(e){var o;"Escape"!==e.key&&"Esc"!==e.key||null==(o=t.onClose)||o.call(t)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",l)}),m(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",l)}),(e,l)=>(h(),p(f,{to:"body"},[w("div",X,[w("div",{class:g(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":t.isDark}]),onClick:l[2]||(l[2]=e=>{var o;return null==(o=t.onClose)?void 0:o.call(t)})},[w("div",{class:g(["html-preview-frame",{"html-preview-frame--dark":t.isDark}]),onClick:l[1]||(l[1]=y(()=>{},["stop"]))},[w("div",A,[w("div",G,[l[3]||(l[3]=w("span",{class:"html-preview-frame__dot"},null,-1)),w("span",J,b(t.title||k(o)("common.preview")||"Preview"),1)]),w("button",{type:"button",class:g(["html-preview-frame__close",{"html-preview-frame__close--dark":t.isDark}]),onClick:l[0]||(l[0]=e=>{var o;return null==(o=t.onClose)?void 0:o.call(t)})}," × ",2)]),w("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:n.value},null,8,U)],2)],2)])]))}}),[["__scopeId","data-v-296dd89d"]]);let Q=null,Z=null,ee=null,te=null,oe=null,ne=null;const le=/* @__PURE__ */new WeakMap;let ie=0;const ae={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))"}},re={class:"flex items-center gap-x-2 flex-1 overflow-hidden"},ue=["innerHTML"],se={class:"text-sm font-medium font-mono truncate"},ce={class:"flex items-center gap-x-2"},de=["aria-pressed"],ve=["disabled"],me=["disabled"],pe=["disabled"],he=["aria-label"],fe={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"},we={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"},ge=["aria-pressed"],ye={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"},be={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"},ke=["aria-label"],xe={class:"code-editor-layer"},Me={class:"code-loading-placeholder"},Ce={class:"sr-only","aria-live":"polite",role:"status"},Be="__markstreamMonacoPassiveTouch__",Se=/* @__PURE__ */H(/* @__PURE__ */c({__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:t}){var o;const n=e,l=t;"undefined"!=typeof window&&function(){var e;try{const t=window;if(t[Be])return;const o=null==(e=window.Element)?void 0:e.prototype,n=null==o?void 0:o.addEventListener;if(!o||!n)return;o.addEventListener=function(e,t,o){return"touchstart"===e&&function(e,t){if(!e)return!1;const o=e;return!("function"!=typeof o.closest||!o.closest(".monaco-editor, .monaco-diff-editor")||t&&"object"==typeof t&&"passive"in t)}(this,o)?n.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(r({},e),{passive:!0}):{passive:!0}}(o)):n.call(this,e,t,o)},t[Be]=!0}catch(t){}}();const i=x(),a=d(()=>{const e=null==i?void 0:i.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:c}=z(),v=M(null),f=M(null),y=M(!1),H=M($(n.node.language)),X=d(()=>j(H.value)),A=M(!1),G=M(!1),J=M(!1),U=M(!1),Se=M(!1),Oe=M(null);let _e=0;const Fe=D(),Pe=M(null),Ee=M("undefined"==typeof window);"undefined"!=typeof window&&C(()=>f.value,e=>{var t;if(null==(t=Pe.value)||t.destroy(),Pe.value=null,!e)return void(Ee.value=!1);const o=Fe(e,{rootMargin:"400px"});Pe.value=o,Ee.value=o.isVisible.value,o.whenVisible.then(()=>{Ee.value=!0})},{immediate:!0}),B(()=>{var e;null==(e=Pe.value)||e.destroy(),Pe.value=null});let Ne=null,Te=null,ze=()=>{},He=()=>{},$e=()=>null,je=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),De=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Le=()=>{},Ye=()=>{},We=null,Ve=()=>{var e;return String(null!=(e=n.node.language)?e:"plaintext")},qe=()=>s(null,null,function*(){});const Ie=d(()=>n.node.diff),Re=d(()=>Ie.value?"diff":"single"),Xe=M(Re.value),Ae=M(!1),Ge=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.wordWrap;return null==t||"off"!==String(t)}),Je=d(()=>"undefined"!=typeof window&&!Ae.value&&!U.value),Ue=M(!1);"undefined"!=typeof window&&s(null,null,function*(){try{const e=yield L();if(!e)return void(Ae.value=!0);const t=e.useMonaco,o=e.detectLanguage;if("function"==typeof o&&(Ve=o),"function"==typeof t){const e=St();if(e&&n.themes&&Array.isArray(n.themes)&&!n.themes.includes(e))throw new Error("Preferred theme not in provided themes array");const o=t(u(r({wordWrap:"on",wrappingIndent:"same",themes:n.themes,theme:e},n.monacoOptions||{}),{onThemeChange(){ut()}}));Ne=o.createEditor||Ne,Te=o.createDiffEditor||Te,ze=o.updateCode||ze,He=o.updateDiff||He,$e=o.getEditor||$e,je=o.getEditorView||je,De=o.getDiffEditorView||De,Le=o.cleanupEditor||Le,Ye=o.safeClean||o.cleanupEditor||Ye,qe=o.setTheme||qe,Se.value=!0,v.value&&(yield Ct(v.value))}}catch(e){Ae.value=!0}});const Ke=M("number"==typeof(null==(o=n.monacoOptions)?void 0:o.fontSize)?n.monacoOptions.fontSize:Number.NaN),Qe=M(Ke.value),Ze=d(()=>{const e=Ke.value,t=Qe.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof t&&Number.isFinite(t)&&t>0}),et=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const o=Qe.value;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:12}),tt=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.lineHeight;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:Math.round(1.5*et.value)}),ot=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.tabSize;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:4}),nt=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.fontFamily;return r({fontSize:`${et.value}px`,lineHeight:`${tt.value}px`,tabSize:ot.value},"string"==typeof t&&t.trim()?{"--markstream-code-font-family":t.trim()}:{})});function lt(){var e,t,o,n,l;try{const i=Ie.value?null!=(o=null==(t=null==(e=De())?void 0:e.getModifiedEditor)?void 0:t.call(e))?o:De():je(),a=$e(),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),t=null==e?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t}}catch(i){}try{const e=v.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,o=e&&e.match(/^(\d+(?:\.\d+)?)/);if(o)return Number.parseFloat(o[1])}}catch(i){}}}catch(i){}return null}function it(e){var t,o;try{const n=$e(),l=null==(t=null==n?void 0:n.EditorOption)?void 0:t.lineHeight;if(null!=l){const t=null==(o=null==e?void 0:e.getOption)?void 0:o.call(e,l);if("number"==typeof t&&t>0)return t}}catch(i){}const n=function(){try{const e=v.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(i){}return null}();if(n&&n>0)return n;const l=Number.isFinite(Qe.value)&&Qe.value>0?Qe.value:12;return Math.max(12,Math.round(1.35*l))}function at(){var e;if(Number.isFinite(Qe.value)&&Qe.value>0&&Number.isFinite(Ke.value))return Qe.value;const t=lt();return"number"==typeof(null==(e=n.monacoOptions)?void 0:e.fontSize)?(Ke.value=n.monacoOptions.fontSize,Qe.value=n.monacoOptions.fontSize,Qe.value):t&&t>0?(Ke.value=t,Qe.value=t,t):(Ke.value=12,Qe.value=12,12)}function rt(){var e,t,o,n,l,i,a,r,u,s,c,d,v,m;try{const p=Ie.value?De():je();if(!p)return null;if(Ie.value&&(null==p?void 0:p.getOriginalEditor)&&(null==p?void 0:p.getModifiedEditor)){const v=null==(e=p.getOriginalEditor)?void 0:e.call(p),m=null==(t=p.getModifiedEditor)?void 0:t.call(p);null==(o=null==v?void 0:v.layout)||o.call(v),null==(n=null==m?void 0:m.layout)||n.call(m);const h=(null==(l=null==v?void 0:v.getContentHeight)?void 0:l.call(v))||0,f=(null==(i=null==m?void 0:m.getContentHeight)?void 0:i.call(m))||0,w=Math.max(h,f);if(w>0)return Math.ceil(w+1);const g=(null==(u=null==(r=null==(a=null==v?void 0:v.getModel)?void 0:a.call(v))?void 0:r.getLineCount)?void 0:u.call(r))||1,y=(null==(d=null==(c=null==(s=null==m?void 0:m.getModel)?void 0:s.call(m))?void 0:c.getLineCount)?void 0:d.call(c))||1,b=Math.max(g,y),k=Math.max(it(v),it(m));return Math.ceil(b*(k+1.5)+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==(m=null==p?void 0:p.getModel)?void 0:m.call(p);let f=1;h&&"function"==typeof h.getLineCount&&(f=h.getLineCount());const w=it(p);return Math.ceil(f*(w+1.5)+0+1)}catch(p){return null}}function ut(){var e,t,o,n,l,i,a,r;const u=v.value,s=f.value;if(!u||!s)return;const c=u.querySelector(".monaco-editor")||u,d=c.querySelector(".monaco-editor-background")||c,m=c.querySelector(".view-lines")||c;let p=null,h=null,w=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(p=window.getComputedStyle(c),h=d===c?p:window.getComputedStyle(d),w=m===c?p:window.getComputedStyle(m))}catch(M){p=null,h=null,w=null}const g=String(null!=(e=null==p?void 0:p.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),y=String(null!=(t=null==p?void 0:p.getPropertyValue("--vscode-editor-background"))?t:"").trim(),b=String(null!=(n=null!=(o=null==p?void 0:p.getPropertyValue("--vscode-editor-selectionBackground"))?o:null==p?void 0:p.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?n:"").trim(),k=g||String(null!=(i=null!=(l=null==w?void 0:w.color)?l:null==p?void 0:p.color)?i:"").trim(),x=y||String(null!=(r=null!=(a=null==h?void 0:h.backgroundColor)?a:null==p?void 0:p.backgroundColor)?r:"").trim();k&&s.style.setProperty("--vscode-editor-foreground",k),x&&s.style.setProperty("--vscode-editor-background",x),b&&s.style.setProperty("--vscode-editor-selectionBackground",b)}function st(){try{const e=v.value;if(!e)return;const t=e.getBoundingClientRect(),o=window.scrollY+t.top,n=rt();if(null!=n&&n>0){const l=t.height;e.style.height=`${Math.ceil(n)}px`,e.style.maxHeight="none";const i=Math.ceil(n)-l;0!==i&&o<window.scrollY&&window.scrollBy(0,i)}}catch(e){}}function ct(){var e;try{const t=v.value;if(!t)return;const o=t.getBoundingClientRect(),l=window.scrollY+o.top,i=o.height,a=function(){var e,t;const o=null!=(t=null==(e=n.monacoOptions)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof o)return o;const l=String(o).match(/^(\d+(?:\.\d+)?)/);return l?Number.parseFloat(l[1]):500}();if(_e>0&&(_e--,null!=Oe.value)){const e=Math.min(Oe.value,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const r=rt();if(null!=r&&r>0){const e=Math.min(r,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}if(null!=Oe.value){const e=Math.min(Oe.value,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const u=Math.ceil((null==(e=t.getBoundingClientRect)?void 0:e.call(t).height)||0);if(u>0){const e=Math.min(u,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const s=Number.parseFloat(t.style.height);if(!Number.isNaN(s)&&s>0){const e=Math.ceil(Math.min(s,a));t.style.height=`${e}px`;const o=e-i;0!==o&&l<window.scrollY&&window.scrollBy(0,o)}else{const e=Math.ceil(a);t.style.height=`${e}px`;const o=e-i;0!==o&&l<window.scrollY&&window.scrollBy(0,o)}t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto"}catch(t){}}const dt=d(()=>n.isShowPreview&&("html"===H.value||"svg"===H.value));C(()=>n.node.language,e=>{H.value=$(e)}),C(()=>n.node.code,e=>s(null,null,function*(){var t,o;if(!1!==n.stream){if(H.value||(H.value=$(Ve(e))),Ne&&!J.value&&v.value)try{yield Ct(v.value)}catch(l){}Ie.value?He(String(null!=(t=n.node.originalCode)?t:""),String(null!=(o=n.node.updatedCode)?o:""),X.value):ze(e,X.value),A.value&&R(()=>st())}}));const vt=d(()=>{const e=H.value;return e?Y[e]||e.charAt(0).toUpperCase()+e.slice(1):Y[""]||"Plain Text"}),mt=d(()=>W(H.value||"")),pt=d(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=t(n.minWidth),l=t(n.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e});function ht(){return s(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(n.node.code)),y.value=!0,l("copy",n.node.code),setTimeout(()=>{y.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function ft(e){return!e||e.disabled}function wt(e,t,o="top"){if(ft(e.currentTarget))return;const l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;q(e.currentTarget,t,o,!1,i,n.isDark)}function gt(){I()}function yt(e){if(ft(e.currentTarget))return;const t=y.value?c("common.copied")||"Copied":c("common.copy")||"Copy",o=e,l=null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0;q(e.currentTarget,t,"top",!1,l,n.isDark)}function bt(){A.value=!A.value;const e=Ie.value?De():je(),t=v.value;e&&t&&(A.value?(Mt(!0),t.style.maxHeight="none",t.style.overflow="visible",st()):(Mt(!1),t.style.overflow="auto",ct()))}function kt(){var e,t,o;if(G.value=!G.value,G.value){if(v.value){const o=Math.ceil((null==(t=(e=v.value).getBoundingClientRect)?void 0:t.call(e).height)||0);o>0&&(Oe.value=o)}Mt(!1)}else{A.value&&Mt(!0),v.value&&null!=Oe.value&&(v.value.style.height=`${Oe.value}px`);const e=Ie.value?De():je();try{null==(o=null==e?void 0:e.layout)||o.call(e)}catch(n){}_e=2,R(()=>{A.value?st():ct()})}}function xt(){if(!dt.value)return;const e=H.value;if(a.value){const t="html"===e?"text/html":"image/svg+xml",o="html"===e?c("artifacts.htmlPreviewTitle")||"HTML Preview":c("artifacts.svgPreviewTitle")||"SVG Preview";return void l("previewCode",{node:n.node,artifactType:t,artifactTitle:o,id:`temp-${e}-${Date.now()}`})}"html"===e&&(Ue.value=!Ue.value)}function Mt(e){var t,o;try{if(Ie.value){const o=De();null==(t=null==o?void 0:o.updateOptions)||t.call(o,{automaticLayout:e})}else{const t=je();null==(o=null==t?void 0:t.updateOptions)||o.call(t,{automaticLayout:e})}}catch(n){}}function Ct(e){if(!Ne)return null;if(We)return We;J.value=!0;const t=s(null,null,function*(){yield function(e){return s(this,null,function*(){var t,o,l;if(!Ne)return;Ie.value?(Ye(),Te?yield Te(e,String(null!=(t=n.node.originalCode)?t:""),String(null!=(o=n.node.updatedCode)?o:""),X.value):yield Ne(e,n.node.code,X.value)):yield Ne(e,n.node.code,X.value);const i=Ie.value?De():je();if("number"==typeof(null==(l=n.monacoOptions)?void 0:l.fontSize))null==i||i.updateOptions({fontSize:n.monacoOptions.fontSize,automaticLayout:!1}),Ke.value=n.monacoOptions.fontSize,Qe.value=n.monacoOptions.fontSize;else{const e=lt();e&&e>0?(Ke.value=e,Qe.value=e):(Ke.value=12,Qe.value=12)}A.value||G.value||ct(),!1===n.loading&&(yield S(),R(()=>{A.value&&!G.value?st():G.value||ct()})),yield S(),U.value=!0,ut()})}(e)});return We=t.finally(()=>{We=null}),We}C(()=>Qe.value,(e,t)=>{const o=Ie.value?De():je();o&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(o.updateOptions({fontSize:e}),A.value&&!G.value&&st())},{flush:"post",immediate:!1});const Bt=C(()=>[v.value,Ie.value,n.stream,n.loading,Se.value,Ee.value],e=>s(null,[e],function*([e,t,o,n,l,i]){if(!e||!Ne)return;if(!i)return;if(!1===o&&!1!==n)return;const a=Ct(e);if(a){try{yield a}catch(r){U.value=!1}Bt()}}));function St(){return n.isDark?n.darkTheme:n.lightTheme}C(Re,(e,t)=>s(null,null,function*(){if(e!==t&&(Xe.value=e,Ne&&v.value&&J.value&&(!1!==n.stream||!1===n.loading)&&Ee.value))try{U.value=!1,J.value=!1,We=null,Ye(),yield S(),yield Ct(v.value)}catch(o){U.value=!1}})),C(()=>[n.isDark,n.darkTheme,n.lightTheme,Se.value],()=>{Se.value&&function(){const e=St();e&&function(e,t){const o=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const o=le.get(e);if(o)return o;try{const t=JSON.stringify(e);if(t)return le.set(e,t),t}catch(t){}const n="__theme_"+ ++ie;return le.set(e,n),n}return String(e)}(t);return o?(ne=e,Q||oe!==o?Q?(te===o||Z===o||(ee=t,te=o),Q):(ee=t,te=o,Q=s(null,null,function*(){for(;te&&null!=ee;){const o=ee,n=te;if(ee=null,te=null,oe!==n)try{Z=n,yield(null!=ne?ne:e)(o),oe=n}catch(t){}}}).finally(()=>{Q=null,Z=null}),Q):Promise.resolve()):Promise.resolve()}(qe,e).then(()=>{U.value&&R(()=>ut())})}()}),C(()=>[n.monacoOptions,Ee.value],()=>{var e,t;if(!Ne||!Ee.value)return;const o=Ie.value?De():je(),l="number"==typeof(null==(e=n.monacoOptions)?void 0:e.fontSize)?n.monacoOptions.fontSize:Number.isFinite(Qe.value)?Qe.value:void 0;"number"==typeof l&&Number.isFinite(l)&&l>0&&(null==(t=null==o?void 0:o.updateOptions)||t.call(o,{fontSize:l})),A.value&&!G.value?st():G.value||ct()},{deep:!0});const Ot=C(()=>[n.loading,Ee.value],e=>s(null,[e],function*([e,t]){t&&(e||(yield S(),R(()=>{G.value||(A.value?st():ct()),Ot()})))}),{immediate:!0,flush:"post"});return m(()=>{Le()}),(t,o)=>Ae.value?(h(),p(k(V),{key:0,node:e.node,loading:n.loading},null,8,["node","loading"])):(h(),O("div",{key:1,ref_key:"container",ref:f,style:_(pt.value),class:g(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[n.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":n.loading,"is-dark":n.isDark}]])},[n.showHeader?(h(),O("div",ae,[E(t.$slots,"header-left",{},()=>[w("div",re,[w("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:mt.value},null,8,ue),w("span",se,b(vt.value),1)])],!0),E(t.$slots,"header-right",{},()=>[w("div",ce,[w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":G.value,onClick:kt,onMouseenter:o[0]||(o[0]=e=>wt(e,G.value?k(c)("common.expand")||"Expand":k(c)("common.collapse")||"Collapse")),onFocus:o[1]||(o[1]=e=>wt(e,G.value?k(c)("common.expand")||"Expand":k(c)("common.collapse")||"Collapse")),onMouseleave:gt,onBlur:gt},[(h(),O("svg",{style:_({rotate:G.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"},[...o[17]||(o[17]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,de),n.showFontSizeButtons&&n.enableFontSizeControl?(h(),O(N,{key:0},[w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(Qe.value)&&Qe.value<=10,onClick:o[2]||(o[2]=e=>function(){const e=at(),t=Math.max(10,e-1);Qe.value=t}()),onMouseenter:o[3]||(o[3]=e=>wt(e,k(c)("common.decrease")||"Decrease")),onFocus:o[4]||(o[4]=e=>wt(e,k(c)("common.decrease")||"Decrease")),onMouseleave:gt,onBlur:gt},[...o[18]||(o[18]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,ve),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!Ze.value||Qe.value===Ke.value,onClick:o[5]||(o[5]=e=>(at(),void(Number.isFinite(Ke.value)&&(Qe.value=Ke.value)))),onMouseenter:o[6]||(o[6]=e=>wt(e,k(c)("common.reset")||"Reset")),onFocus:o[7]||(o[7]=e=>wt(e,k(c)("common.reset")||"Reset")),onMouseleave:gt,onBlur:gt},[...o[19]||(o[19]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),w("path",{d:"M3 3v5h5"})])],-1)])],40,me),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(Qe.value)&&Qe.value>=36,onClick:o[8]||(o[8]=e=>function(){const e=at(),t=Math.min(36,e+1);Qe.value=t}()),onMouseenter:o[9]||(o[9]=e=>wt(e,k(c)("common.increase")||"Increase")),onFocus:o[10]||(o[10]=e=>wt(e,k(c)("common.increase")||"Increase")),onMouseleave:gt,onBlur:gt},[...o[20]||(o[20]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,pe)],64)):F("",!0),n.showCopyButton?(h(),O("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":y.value?k(c)("common.copied")||"Copied":k(c)("common.copy")||"Copy",onClick:ht,onMouseenter:o[11]||(o[11]=e=>yt(e)),onFocus:o[12]||(o[12]=e=>yt(e)),onMouseleave:gt,onBlur:gt},[y.value?(h(),O("svg",we,[...o[22]||(o[22]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(h(),O("svg",fe,[...o[21]||(o[21]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("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,he)):F("",!0),n.showExpandButton?(h(),O("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":A.value,onClick:bt,onMouseenter:o[13]||(o[13]=e=>wt(e,A.value?k(c)("common.collapse")||"Collapse":k(c)("common.expand")||"Expand")),onFocus:o[14]||(o[14]=e=>wt(e,A.value?k(c)("common.collapse")||"Collapse":k(c)("common.expand")||"Expand")),onMouseleave:gt,onBlur:gt},[A.value?(h(),O("svg",ye,[...o[23]||(o[23]=[w("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)])])):(h(),O("svg",be,[...o[24]||(o[24]=[w("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,ge)):F("",!0),dt.value&&n.showPreviewButton?(h(),O("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":k(c)("common.preview")||"Preview",onClick:xt,onMouseenter:o[15]||(o[15]=e=>wt(e,k(c)("common.preview")||"Preview")),onFocus:o[16]||(o[16]=e=>wt(e,k(c)("common.preview")||"Preview")),onMouseleave:gt,onBlur:gt},[...o[25]||(o[25]=[w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[w("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[w("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"}),w("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,ke)):F("",!0)])],!0)])):F("",!0),P(w("div",xe,[w("div",{ref_key:"codeEditor",ref:v,class:g(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":Je.value}]])},null,2),Je.value?(h(),p(k(V),{key:0,class:g(["code-pre-fallback",{"is-wrap":Ge.value}]),style:_(nt.value),node:e.node},null,8,["class","style","node"])):F("",!0)],512),[[T,!(G.value||!e.stream&&e.loading)]]),Ue.value&&!a.value&&dt.value&&"html"===H.value?(h(),p(K,{key:1,code:e.node.code,"is-dark":n.isDark,"on-close":()=>Ue.value=!1},null,8,["code","is-dark","on-close"])):F("",!0),P(w("div",Me,[E(t.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[26]||(o[26]=w("div",{class:"loading-skeleton"},[w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line short"})],-1))],!0)],512),[[T,!e.stream&&e.loading]]),w("span",Ce,b(y.value?k(c)("common.copied")||"Copied":""),1)],6))}}),[["__scopeId","data-v-bf41db7f"]]);Se.install=e=>{e.component(Se.__name,Se)};export{Se as default};
|
|
1
|
+
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)=>{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},u=(e,n)=>o(e,t(n)),s=(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 c,computed as d,onMounted as v,onUnmounted as m,createBlock as p,openBlock as h,Teleport as f,createElementVNode as w,normalizeClass as g,withModifiers as y,toDisplayString as b,unref as k,getCurrentInstance as x,ref as M,watch as C,onBeforeUnmount as B,nextTick as S,createElementBlock as O,normalizeStyle as _,createCommentVNode as F,withDirectives as P,renderSlot as E,Fragment as N,vShow as T}from"vue";import{u as z,_ as H,n as $,r as j,a as D,g as L,l as Y,b as W,c as V,h as q,d as I,s as R}from"./exports.js";import{s as X}from"./safeRaf.js";const A={class:"markstream-vue"},G={class:"html-preview-frame__header"},J={class:"html-preview-frame__title"},U={class:"html-preview-frame__label"},K=["srcdoc"],Q=/* @__PURE__ */H(/* @__PURE__ */c({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(e){const o=e,{t}=z(),n=d(()=>{const e=o.code||"",t=e.trim().toLowerCase();return t.startsWith("<!doctype")||t.startsWith("<html")||t.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: ${o.isDark?"#020617":"#ffffff"};\n color: ${o.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>`});function l(e){var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=o.onClose)||t.call(o)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",l)}),m(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",l)}),(e,l)=>(h(),p(f,{to:"body"},[w("div",A,[w("div",{class:g(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":o.isDark}]),onClick:l[2]||(l[2]=e=>{var t;return null==(t=o.onClose)?void 0:t.call(o)})},[w("div",{class:g(["html-preview-frame",{"html-preview-frame--dark":o.isDark}]),onClick:l[1]||(l[1]=y(()=>{},["stop"]))},[w("div",G,[w("div",J,[l[3]||(l[3]=w("span",{class:"html-preview-frame__dot"},null,-1)),w("span",U,b(o.title||k(t)("common.preview")||"Preview"),1)]),w("button",{type:"button",class:g(["html-preview-frame__close",{"html-preview-frame__close--dark":o.isDark}]),onClick:l[0]||(l[0]=e=>{var t;return null==(t=o.onClose)?void 0:t.call(o)})}," × ",2)]),w("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:n.value},null,8,K)],2)],2)])]))}}),[["__scopeId","data-v-296dd89d"]]);let Z=null,ee=null,oe=null,te=null,ne=null,le=null;const ie=/* @__PURE__ */new WeakMap;let ae=0;const re={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))"}},ue={class:"flex items-center gap-x-2 flex-1 overflow-hidden"},se=["innerHTML"],ce={class:"text-sm font-medium font-mono truncate"},de={class:"flex items-center gap-x-2"},ve=["aria-pressed"],me=["disabled"],pe=["disabled"],he=["disabled"],fe=["aria-label"],we={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"},ge={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"},ye=["aria-pressed"],be={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"},ke={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"},xe=["aria-label"],Me={class:"code-editor-layer"},Ce={class:"code-loading-placeholder"},Be={class:"sr-only","aria-live":"polite",role:"status"},Se="__markstreamMonacoPassiveTouch__",Oe=/* @__PURE__ */H(/* @__PURE__ */c({__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},showTooltips:{type:Boolean},customId:{}},emits:["previewCode","copy"],setup(e,{emit:o}){var t;const n=e,l=o;"undefined"!=typeof window&&function(){var e;try{const o=window;if(o[Se])return;const t=null==(e=window.Element)?void 0:e.prototype,n=null==t?void 0:t.addEventListener;if(!t||!n)return;t.addEventListener=function(e,o,t){return"touchstart"===e&&function(e,o){if(!e)return!1;const t=e;return!("function"!=typeof t.closest||!t.closest(".monaco-editor, .monaco-diff-editor")||o&&"object"==typeof o&&"passive"in o)}(this,t)?n.call(this,e,o,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(r({},e),{passive:!0}):{passive:!0}}(t)):n.call(this,e,o,t)},o[Se]=!0}catch(o){}}();const i=x(),a=d(()=>{const e=null==i?void 0:i.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:c}=z(),v=M(null),f=M(null),y=M(!1),H=M($(n.node.language)),A=d(()=>j(H.value)),G=M(!1),J=M(!1),U=M(!1),K=M(!1),Oe=M(!1),_e=M(null);let Fe=0;const Pe=D(),Ee=M(null),Ne=M("undefined"==typeof window);"undefined"!=typeof window&&C(()=>f.value,e=>{var o;if(null==(o=Ee.value)||o.destroy(),Ee.value=null,!e)return void(Ne.value=!1);const t=Pe(e,{rootMargin:"400px"});Ee.value=t,Ne.value=t.isVisible.value,t.whenVisible.then(()=>{Ne.value=!0})},{immediate:!0}),B(()=>{var e;null==(e=Ee.value)||e.destroy(),Ee.value=null});let Te=null,ze=null,He=()=>{},$e=()=>{},je=()=>null,De=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Le=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Ye=()=>{},We=()=>{},Ve=null,qe=()=>{var e;return String(null!=(e=n.node.language)?e:"plaintext")},Ie=()=>s(null,null,function*(){});const Re=d(()=>n.node.diff),Xe=d(()=>Re.value?"diff":"single"),Ae=M(Xe.value),Ge=M(!1),Je=d(()=>{var e;const o=null==(e=n.monacoOptions)?void 0:e.wordWrap;return null==o||"off"!==String(o)}),Ue=d(()=>"undefined"!=typeof window&&!Ge.value&&!K.value),Ke=M(!1);"undefined"!=typeof window&&s(null,null,function*(){try{const e=yield L();if(!e)return void(Ge.value=!0);const o=e.useMonaco,t=e.detectLanguage;if("function"==typeof t&&(qe=t),"function"==typeof o){const e=Fo();if(e&&n.themes&&Array.isArray(n.themes)&&!n.themes.includes(e))throw new Error("Preferred theme not in provided themes array");const t=o(u(r({wordWrap:"on",wrappingIndent:"same",themes:n.themes,theme:e},n.monacoOptions||{}),{onThemeChange(){so()}}));Te=t.createEditor||Te,ze=t.createDiffEditor||ze,He=t.updateCode||He,$e=t.updateDiff||$e,je=t.getEditor||je,De=t.getEditorView||De,Le=t.getDiffEditorView||Le,Ye=t.cleanupEditor||Ye,We=t.safeClean||t.cleanupEditor||We,Ie=t.setTheme||Ie,Oe.value=!0,v.value&&(yield Oo(v.value))}}catch(e){Ge.value=!0}});const Qe=M("number"==typeof(null==(t=n.monacoOptions)?void 0:t.fontSize)?n.monacoOptions.fontSize:Number.NaN),Ze=M(Qe.value),eo=d(()=>{const e=Qe.value,o=Ze.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof o&&Number.isFinite(o)&&o>0}),oo=d(()=>{var e;const o=null==(e=n.monacoOptions)?void 0:e.fontSize;if("number"==typeof o&&Number.isFinite(o)&&o>0)return o;const t=Ze.value;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:12}),to=d(()=>{var e;const o=null==(e=n.monacoOptions)?void 0:e.lineHeight;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:Math.round(1.5*oo.value)}),no=d(()=>{var e;const o=null==(e=n.monacoOptions)?void 0:e.tabSize;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:4}),lo=d(()=>{var e;const o=null==(e=n.monacoOptions)?void 0:e.fontFamily;return r({fontSize:`${oo.value}px`,lineHeight:`${to.value}px`,tabSize:no.value},"string"==typeof o&&o.trim()?{"--markstream-code-font-family":o.trim()}:{})});function io(){var e,o,t,n,l;try{const i=Re.value?null!=(t=null==(o=null==(e=Le())?void 0:e.getModifiedEditor)?void 0:o.call(e))?t:Le():De(),a=je(),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=v.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 ao(e){var o,t;try{const n=je(),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=v.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 ro(){var e;if(Number.isFinite(Ze.value)&&Ze.value>0&&Number.isFinite(Qe.value))return Ze.value;const o=io();return"number"==typeof(null==(e=n.monacoOptions)?void 0:e.fontSize)?(Qe.value=n.monacoOptions.fontSize,Ze.value=n.monacoOptions.fontSize,Ze.value):o&&o>0?(Qe.value=o,Ze.value=o,o):(Qe.value=12,Ze.value=12,12)}function uo(){var e,o,t,n,l,i,a,r,u,s,c,d,v,m;try{const p=Re.value?Le():De();if(!p)return null;if(Re.value&&(null==p?void 0:p.getOriginalEditor)&&(null==p?void 0:p.getModifiedEditor)){const v=null==(e=p.getOriginalEditor)?void 0:e.call(p),m=null==(o=p.getModifiedEditor)?void 0:o.call(p);null==(t=null==v?void 0:v.layout)||t.call(v),null==(n=null==m?void 0:m.layout)||n.call(m);const h=(null==(l=null==v?void 0:v.getContentHeight)?void 0:l.call(v))||0,f=(null==(i=null==m?void 0:m.getContentHeight)?void 0:i.call(m))||0,w=Math.max(h,f);if(w>0)return Math.ceil(w+1);const g=(null==(u=null==(r=null==(a=null==v?void 0:v.getModel)?void 0:a.call(v))?void 0:r.getLineCount)?void 0:u.call(r))||1,y=(null==(d=null==(c=null==(s=null==m?void 0:m.getModel)?void 0:s.call(m))?void 0:c.getLineCount)?void 0:d.call(c))||1,b=Math.max(g,y),k=Math.max(ao(v),ao(m));return Math.ceil(b*(k+1.5)+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==(m=null==p?void 0:p.getModel)?void 0:m.call(p);let f=1;h&&"function"==typeof h.getLineCount&&(f=h.getLineCount());const w=ao(p);return Math.ceil(f*(w+1.5)+0+1)}catch(p){return null}}function so(){var e,o,t,n,l,i,a,r;const u=v.value,s=f.value;if(!u||!s)return;const c=u.querySelector(".monaco-editor")||u,d=c.querySelector(".monaco-editor-background")||c,m=c.querySelector(".view-lines")||c;let p=null,h=null,w=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(p=window.getComputedStyle(c),h=d===c?p:window.getComputedStyle(d),w=m===c?p:window.getComputedStyle(m))}catch(M){p=null,h=null,w=null}const g=String(null!=(e=null==p?void 0:p.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),y=String(null!=(o=null==p?void 0:p.getPropertyValue("--vscode-editor-background"))?o:"").trim(),b=String(null!=(n=null!=(t=null==p?void 0:p.getPropertyValue("--vscode-editor-selectionBackground"))?t:null==p?void 0:p.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?n:"").trim(),k=g||String(null!=(i=null!=(l=null==w?void 0:w.color)?l:null==p?void 0:p.color)?i:"").trim(),x=y||String(null!=(r=null!=(a=null==h?void 0:h.backgroundColor)?a:null==p?void 0:p.backgroundColor)?r:"").trim();k&&s.style.setProperty("--vscode-editor-foreground",k),x&&s.style.setProperty("--vscode-editor-background",x),b&&s.style.setProperty("--vscode-editor-selectionBackground",b)}function co(){try{const e=v.value;if(!e)return;const o=e.getBoundingClientRect(),t=window.scrollY+o.top,n=uo();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 vo(){var e;try{const o=v.value;if(!o)return;const t=o.getBoundingClientRect(),l=window.scrollY+t.top,i=t.height,a=function(){var e,o;const t=null!=(o=null==(e=n.monacoOptions)?void 0:e.MAX_HEIGHT)?o:500;if("number"==typeof t)return t;const l=String(t).match(/^(\d+(?:\.\d+)?)/);return l?Number.parseFloat(l[1]):500}();if(Fe>0&&(Fe--,null!=_e.value)){const e=Math.min(_e.value,a);o.style.height=`${Math.ceil(e)}px`,o.style.maxHeight=`${Math.ceil(a)}px`,o.style.overflow="auto";const t=Math.ceil(e)-i;return void(0!==t&&l<window.scrollY&&window.scrollBy(0,t))}const r=uo();if(null!=r&&r>0){const e=Math.min(r,a);o.style.height=`${Math.ceil(e)}px`,o.style.maxHeight=`${Math.ceil(a)}px`,o.style.overflow="auto";const t=Math.ceil(e)-i;return void(0!==t&&l<window.scrollY&&window.scrollBy(0,t))}if(null!=_e.value){const e=Math.min(_e.value,a);o.style.height=`${Math.ceil(e)}px`,o.style.maxHeight=`${Math.ceil(a)}px`,o.style.overflow="auto";const t=Math.ceil(e)-i;return void(0!==t&&l<window.scrollY&&window.scrollBy(0,t))}const u=Math.ceil((null==(e=o.getBoundingClientRect)?void 0:e.call(o).height)||0);if(u>0){const e=Math.min(u,a);o.style.height=`${Math.ceil(e)}px`,o.style.maxHeight=`${Math.ceil(a)}px`,o.style.overflow="auto";const t=Math.ceil(e)-i;return void(0!==t&&l<window.scrollY&&window.scrollBy(0,t))}const s=Number.parseFloat(o.style.height);if(!Number.isNaN(s)&&s>0){const e=Math.ceil(Math.min(s,a));o.style.height=`${e}px`;const t=e-i;0!==t&&l<window.scrollY&&window.scrollBy(0,t)}else{const e=Math.ceil(a);o.style.height=`${e}px`;const t=e-i;0!==t&&l<window.scrollY&&window.scrollBy(0,t)}o.style.maxHeight=`${Math.ceil(a)}px`,o.style.overflow="auto"}catch(o){}}const mo=d(()=>n.isShowPreview&&("html"===H.value||"svg"===H.value));C(()=>n.node.language,e=>{H.value=$(e)}),C(()=>n.node.code,e=>s(null,null,function*(){var o,t;if(!1!==n.stream){if(H.value||(H.value=$(qe(e))),Te&&!U.value&&v.value)try{yield Oo(v.value)}catch(l){}Re.value?$e(String(null!=(o=n.node.originalCode)?o:""),String(null!=(t=n.node.updatedCode)?t:""),A.value):He(e,A.value),G.value&&X(()=>co())}}));const po=d(()=>{const e=H.value;return e?Y[e]||e.charAt(0).toUpperCase()+e.slice(1):Y[""]||"Plain Text"}),ho=d(()=>(W.value,V(H.value||""))),fo=d(()=>{const e={},o=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=o(n.minWidth),l=o(n.maxWidth);return t&&(e.minWidth=t),l&&(e.maxWidth=l),e}),wo=d(()=>!1!==n.showTooltips);function go(){return s(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(n.node.code)),y.value=!0,l("copy",n.node.code),setTimeout(()=>{y.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function yo(e){const o=e.currentTarget||e.target;return!o||o.disabled?null:o}function bo(e,o,t="top"){if(!wo.value)return;const l=yo(e);if(!l)return;const i=e,a=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0;R(l,o,t,!1,a,n.isDark)}function ko(){wo.value&&q()}function xo(e){if(!wo.value)return;const o=yo(e);if(!o)return;const t=y.value?c("common.copied")||"Copied":c("common.copy")||"Copy",l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;R(o,t,"top",!1,i,n.isDark)}function Mo(){G.value=!G.value;const e=Re.value?Le():De(),o=v.value;e&&o&&(G.value?(So(!0),o.style.maxHeight="none",o.style.overflow="visible",co()):(So(!1),o.style.overflow="auto",vo()))}function Co(){var e,o,t;if(J.value=!J.value,J.value){if(v.value){const t=Math.ceil((null==(o=(e=v.value).getBoundingClientRect)?void 0:o.call(e).height)||0);t>0&&(_e.value=t)}So(!1)}else{G.value&&So(!0),v.value&&null!=_e.value&&(v.value.style.height=`${_e.value}px`);const e=Re.value?Le():De();try{null==(t=null==e?void 0:e.layout)||t.call(e)}catch(n){}Fe=2,X(()=>{G.value?co():vo()})}}function Bo(){if(!mo.value)return;const e=H.value;if(a.value){const o="html"===e?"text/html":"image/svg+xml",t="html"===e?c("artifacts.htmlPreviewTitle")||"HTML Preview":c("artifacts.svgPreviewTitle")||"SVG Preview";return void l("previewCode",{node:n.node,artifactType:o,artifactTitle:t,id:`temp-${e}-${Date.now()}`})}"html"===e&&(Ke.value=!Ke.value)}function So(e){var o,t;try{if(Re.value){const t=Le();null==(o=null==t?void 0:t.updateOptions)||o.call(t,{automaticLayout:e})}else{const o=De();null==(t=null==o?void 0:o.updateOptions)||t.call(o,{automaticLayout:e})}}catch(n){}}function Oo(e){if(!Te)return null;if(Ve)return Ve;U.value=!0;const o=s(null,null,function*(){yield function(e){return s(this,null,function*(){var o,t,l;if(!Te)return;Re.value?(We(),ze?yield ze(e,String(null!=(o=n.node.originalCode)?o:""),String(null!=(t=n.node.updatedCode)?t:""),A.value):yield Te(e,n.node.code,A.value)):yield Te(e,n.node.code,A.value);const i=Re.value?Le():De();if("number"==typeof(null==(l=n.monacoOptions)?void 0:l.fontSize))null==i||i.updateOptions({fontSize:n.monacoOptions.fontSize,automaticLayout:!1}),Qe.value=n.monacoOptions.fontSize,Ze.value=n.monacoOptions.fontSize;else{const e=io();e&&e>0?(Qe.value=e,Ze.value=e):(Qe.value=12,Ze.value=12)}G.value||J.value||vo(),!1===n.loading&&(yield S(),X(()=>{G.value&&!J.value?co():J.value||vo()})),yield S(),K.value=!0,so()})}(e)});return Ve=o.finally(()=>{Ve=null}),Ve}C(wo,e=>{e||q()}),C(()=>Ze.value,(e,o)=>{const t=Re.value?Le():De();t&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(t.updateOptions({fontSize:e}),G.value&&!J.value&&co())},{flush:"post",immediate:!1});const _o=C(()=>[v.value,Re.value,n.stream,n.loading,Oe.value,Ne.value],e=>s(null,[e],function*([e,o,t,n,l,i]){if(!e||!Te)return;if(!i)return;if(!1===t&&!1!==n)return;const a=Oo(e);if(a){try{yield a}catch(r){K.value=!1}_o()}}));function Fo(){return n.isDark?n.darkTheme:n.lightTheme}C(Xe,(e,o)=>s(null,null,function*(){if(e!==o&&(Ae.value=e,Te&&v.value&&U.value&&(!1!==n.stream||!1===n.loading)&&Ne.value))try{K.value=!1,U.value=!1,Ve=null,We(),yield S(),yield Oo(v.value)}catch(t){K.value=!1}})),C(()=>[n.isDark,n.darkTheme,n.lightTheme,Oe.value],()=>{Oe.value&&function(){const e=Fo();e&&function(e,o){const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=ie.get(e);if(t)return t;try{const o=JSON.stringify(e);if(o)return ie.set(e,o),o}catch(o){}const n="__theme_"+ ++ae;return ie.set(e,n),n}return String(e)}(o);return t?(le=e,Z||ne!==t?Z?(te===t||ee===t||(oe=o,te=t),Z):(oe=o,te=t,Z=s(null,null,function*(){for(;te&&null!=oe;){const t=oe,n=te;if(oe=null,te=null,ne!==n)try{ee=n,yield(null!=le?le:e)(t),ne=n}catch(o){}}}).finally(()=>{Z=null,ee=null}),Z):Promise.resolve()):Promise.resolve()}(Ie,e).then(()=>{K.value&&X(()=>so())})}()}),C(()=>[n.monacoOptions,Ne.value],()=>{var e,o;if(!Te||!Ne.value)return;const t=Re.value?Le():De(),l="number"==typeof(null==(e=n.monacoOptions)?void 0:e.fontSize)?n.monacoOptions.fontSize:Number.isFinite(Ze.value)?Ze.value:void 0;"number"==typeof l&&Number.isFinite(l)&&l>0&&(null==(o=null==t?void 0:t.updateOptions)||o.call(t,{fontSize:l})),G.value&&!J.value?co():J.value||vo()},{deep:!0});const Po=C(()=>[n.loading,Ne.value],e=>s(null,[e],function*([e,o]){o&&(e||(yield S(),X(()=>{J.value||(G.value?co():vo()),Po()})))}),{immediate:!0,flush:"post"});return m(()=>{Ye()}),(o,t)=>Ge.value?(h(),p(k(I),{key:0,node:e.node,loading:n.loading},null,8,["node","loading"])):(h(),O("div",{key:1,ref_key:"container",ref:f,style:_(fo.value),class:g(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[n.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":n.loading,"is-dark":n.isDark}]])},[n.showHeader?(h(),O("div",re,[E(o.$slots,"header-left",{},()=>[w("div",ue,[w("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:ho.value},null,8,se),w("span",ce,b(po.value),1)])],!0),E(o.$slots,"header-right",{},()=>[w("div",de,[w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":J.value,onClick:Co,onMouseenter:t[0]||(t[0]=e=>bo(e,J.value?k(c)("common.expand")||"Expand":k(c)("common.collapse")||"Collapse")),onFocus:t[1]||(t[1]=e=>bo(e,J.value?k(c)("common.expand")||"Expand":k(c)("common.collapse")||"Collapse")),onMouseleave:ko,onBlur:ko},[(h(),O("svg",{style:_({rotate:J.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]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ve),n.showFontSizeButtons&&n.enableFontSizeControl?(h(),O(N,{key:0},[w("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=ro(),o=Math.max(10,e-1);Ze.value=o}()),onMouseenter:t[3]||(t[3]=e=>bo(e,k(c)("common.decrease")||"Decrease")),onFocus:t[4]||(t[4]=e=>bo(e,k(c)("common.decrease")||"Decrease")),onMouseleave:ko,onBlur:ko},[...t[18]||(t[18]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,me),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!eo.value||Ze.value===Qe.value,onClick:t[5]||(t[5]=e=>(ro(),void(Number.isFinite(Qe.value)&&(Ze.value=Qe.value)))),onMouseenter:t[6]||(t[6]=e=>bo(e,k(c)("common.reset")||"Reset")),onFocus:t[7]||(t[7]=e=>bo(e,k(c)("common.reset")||"Reset")),onMouseleave:ko,onBlur:ko},[...t[19]||(t[19]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),w("path",{d:"M3 3v5h5"})])],-1)])],40,pe),w("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=ro(),o=Math.min(36,e+1);Ze.value=o}()),onMouseenter:t[9]||(t[9]=e=>bo(e,k(c)("common.increase")||"Increase")),onFocus:t[10]||(t[10]=e=>bo(e,k(c)("common.increase")||"Increase")),onMouseleave:ko,onBlur:ko},[...t[20]||(t[20]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,he)],64)):F("",!0),n.showCopyButton?(h(),O("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":y.value?k(c)("common.copied")||"Copied":k(c)("common.copy")||"Copy",onClick:go,onMouseenter:t[11]||(t[11]=e=>xo(e)),onFocus:t[12]||(t[12]=e=>xo(e)),onMouseleave:ko,onBlur:ko},[y.value?(h(),O("svg",ge,[...t[22]||(t[22]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(h(),O("svg",we,[...t[21]||(t[21]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("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,fe)):F("",!0),n.showExpandButton?(h(),O("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":G.value,onClick:Mo,onMouseenter:t[13]||(t[13]=e=>bo(e,G.value?k(c)("common.collapse")||"Collapse":k(c)("common.expand")||"Expand")),onFocus:t[14]||(t[14]=e=>bo(e,G.value?k(c)("common.collapse")||"Collapse":k(c)("common.expand")||"Expand")),onMouseleave:ko,onBlur:ko},[G.value?(h(),O("svg",be,[...t[23]||(t[23]=[w("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)])])):(h(),O("svg",ke,[...t[24]||(t[24]=[w("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,ye)):F("",!0),mo.value&&n.showPreviewButton?(h(),O("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":k(c)("common.preview")||"Preview",onClick:Bo,onMouseenter:t[15]||(t[15]=e=>bo(e,k(c)("common.preview")||"Preview")),onFocus:t[16]||(t[16]=e=>bo(e,k(c)("common.preview")||"Preview")),onMouseleave:ko,onBlur:ko},[...t[25]||(t[25]=[w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[w("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[w("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"}),w("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,xe)):F("",!0)])],!0)])):F("",!0),P(w("div",Me,[w("div",{ref_key:"codeEditor",ref:v,class:g(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":Ue.value}]])},null,2),Ue.value?(h(),p(k(I),{key:0,class:g(["code-pre-fallback",{"is-wrap":Je.value}]),style:_(lo.value),node:e.node},null,8,["class","style","node"])):F("",!0)],512),[[T,!(J.value||!e.stream&&e.loading)]]),Ke.value&&!a.value&&mo.value&&"html"===H.value?(h(),p(Q,{key:1,code:e.node.code,"is-dark":n.isDark,"on-close":()=>Ke.value=!1},null,8,["code","is-dark","on-close"])):F("",!0),P(w("div",Ce,[E(o.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[t[26]||(t[26]=w("div",{class:"loading-skeleton"},[w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line short"})],-1))],!0)],512),[[T,!e.stream&&e.loading]]),w("span",Be,b(y.value?k(c)("common.copied")||"Copied":""),1)],6))}}),[["__scopeId","data-v-39c34a1b"]]);Oe.install=e=>{e.component(Oe.__name,Oe)};export{Oe as default};
|
package/dist/index5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=Object.defineProperties,l=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,a=(t,l,n)=>l in t?e(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,i=(e,t)=>{for(var l in t||(t={}))o.call(t,l)&&a(e,l,t[l]);if(n)for(var l of n(t))r.call(t,l)&&a(e,l,t[l]);return e},u=(e,t,l)=>new Promise((n,o)=>{var r=e=>{try{i(l.next(e))}catch(t){o(t)}},a=e=>{try{i(l.throw(e))}catch(t){o(t)}},i=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);i((l=l.apply(e,t)).next())});import{defineComponent as s,ref as c,computed as v,watch as d,onBeforeUnmount as m,nextTick as h,onMounted as g,onUnmounted as f,createElementBlock as p,openBlock as w,normalizeClass as y,createCommentVNode as x,withDirectives as k,renderSlot as b,createElementVNode as M,unref as T,toDisplayString as C,normalizeStyle as D,createBlock as B,mergeProps as j,toHandlers as E,Teleport as S,createVNode as O,Transition as P,withCtx as L,withModifiers as $,vShow as z}from"vue";import{u as A,a as F,i as R,s as H,h as _,j as X,k as N,t as Y,_ as Z}from"./exports.js";import{s as I}from"./safeRaf.js";const q={key:0},V={key:1,class:"flex items-center gap-x-2 overflow-hidden"},U=["src"],W={key:2},G={class:"flex items-center gap-x-1"},K={class:"flex items-center gap-x-1"},J={key:4},Q={key:5,class:"flex items-center gap-x-1"},ee=["aria-pressed"],te={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"},le={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"},ne=["disabled"],oe=["disabled"],re={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},ae={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},ie={key:1,class:"relative"},ue={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},se={class:"flex items-center gap-2 backdrop-blur rounded-lg"},ce={class:"markstream-vue"},ve={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},de=/* @__PURE__ */Z(/* @__PURE__ */s({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!1}},emits:["copy","export","openModal","toggleMode"],setup(e,{emit:n}){var o,r;const a=e,s=n,Z={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},de=c(!1),me=v(()=>a.isStrict?"strict":"loose"),he=v(()=>({startOnLoad:!1,securityLevel:me.value,dompurifyConfig:"strict"===me.value?Z:void 0,flowchart:"strict"===me.value?{htmlLabels:!1}:void 0})),ge=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],fe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function pe(e){if(!e)return"";const t=e.trim();return fe.test(t)?t:""}function we(e){if(e)try{e.replaceChildren()}catch(t){e.innerHTML=""}}function ye(e,t){if(!e)return"";if("strict"===me.value)return function(e,t){if(!e)return"";try{e.replaceChildren()}catch(n){e.innerHTML=""}const l=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return null;if(!e)return null;const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),l=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!l||"svg"!==l.nodeName.toLowerCase())return null;const n=l;return function(e){const t=/* @__PURE__ */new Set(["script"]),l=[e,...Array.from(e.querySelectorAll("*"))];for(const n of l){if(t.has(n.tagName.toLowerCase())){n.remove();continue}const e=Array.from(n.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))n.removeAttribute(e);else{if("style"===e&&t.value){const l=t.value;if(ge.some(e=>e.test(l))){n.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const l=pe(t.value);if(!l){n.removeAttribute(e);continue}l!==t.value&&n.setAttribute(e,l)}}}}}(n),n}(t);return l?(e.appendChild(l),e.innerHTML):""}(e,t);try{e.replaceChildren()}catch(l){e.innerHTML=""}if(t)try{e.insertAdjacentHTML("afterbegin",t)}catch(l){e.innerHTML=t}return e.innerHTML}const{t:xe}=A();function ke(){return u(this,null,function*(){try{const e=yield R();return de.value=!!e,e}catch(e){throw de.value=!1,e}})}"undefined"!=typeof window&&u(null,null,function*(){var e;try{const t=yield ke();if(!t)return;null==(e=null==t?void 0:t.initialize)||e.call(t,i({},he.value))}catch(t){de.value=!1,console.warn("[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.",t)}});const be=c(!1),Me=c(!1),Te=c(),Ce=c(),De=c(),Be=c(null),je=F(),Ee=c(null),Se=c("undefined"==typeof window),Oe=c(),Pe=v(()=>a.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode")),Le=c(1),$e=c(0),ze=c(0),Ae=c(!1),Fe=c({x:0,y:0}),Re=c(!1),He=c(!1),_e=c(!1),Xe=c(null),Ne=c(0),Ye=c(!1);let Ze=null,Ie=null,qe=0;const Ve=null!=(o=globalThis.requestIdleCallback)?o:(e,t)=>setTimeout(()=>e({didTimeout:!0}),16),Ue=function(){let e=null;return(...t)=>{e&&clearTimeout(e),e=setTimeout(()=>(()=>{Ve(()=>{Ut()},{timeout:500})})(...t),300)}}();function We(){null!=Ie&&(globalThis.clearTimeout(Ie),Ie=null)}function Ge(e=600){if("undefined"==typeof globalThis)return;const t=Math.max(0,e);We(),Ie=globalThis.setTimeout(()=>{Ie=null,a.loading||_e.value||!Se.value?Ge(Math.min(1200,Math.max(300,1.2*t))):Ue()},t)}const Ke=c("360px");let Je=null;const Qe=c(!1),et=c(!1),tt=c({}),lt=c(null),nt=c(""),ot=c(0);let rt=null;const at=c(!1),it=c({zoom:1,translateX:0,translateY:0,containerHeight:"360px"}),ut=v(()=>a.enableWheelZoom?{wheel:Xt}:{}),st=v(()=>{var e,t,l,n;return{worker:null!=(e=a.workerTimeoutMs)?e:1400,parse:null!=(t=a.parseTimeoutMs)?t:1800,render:null!=(l=a.renderTimeoutMs)?l:2500,fullRender:null!=(n=a.fullRenderTimeoutMs)?n:4e3}}),ct=null!=(r=globalThis.cancelIdleCallback)?r:e=>clearTimeout(e);let vt=null,dt=null,mt=!1,ht=800,gt=null,ft=0,pt=!0,wt=0;function yt(e,t){const l=null==t?void 0:t.timeoutMs,n=null==t?void 0:t.signal;if(null==n?void 0:n.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));let o=null,r=!1,a=null;return new Promise((t,i)=>{const u=()=>{null!=o&&clearTimeout(o),a&&n&&n.removeEventListener("abort",a)};l&&l>0&&(o=globalThis.setTimeout(()=>{r||(r=!0,u(),i(new Error("Operation timed out")))},l)),n&&(a=()=>{r||(r=!0,u(),i(new DOMException("Aborted","AbortError")))},n.addEventListener("abort",a)),e().then(e=>{r||(r=!0,u(),t(e))}).catch(e=>{r||(r=!0,u(),i(e))})})}function xt(e){if("undefined"==typeof document)return;if(!Ce.value)return;const t=document.createElement("div");t.className="text-red-500 p-4",t.textContent="Failed to render diagram: ";const l=document.createElement("span");l.textContent=e instanceof Error?e.message:"Unknown error",t.appendChild(l),we(Ce.value),Ce.value.appendChild(t),Ke.value="360px",at.value=!0,Wt()}function kt(e){return!e||e.disabled}function bt(e,t,l="top"){if(kt(e.currentTarget))return;const n=e,o=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;H(e.currentTarget,t,l,!1,o,a.isDark)}function Mt(){_()}function Tt(e){if(kt(e.currentTarget))return;const t=be.value?xe("common.copied")||"Copied":xe("common.copy")||"Copy",l=e,n=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;H(e.currentTarget,t,"top",!1,n,a.isDark)}function Ct(e,t){const l=`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n`;return e.trimStart().startsWith("%%{")?e:l+e}function Dt(){return pt&&!Re.value&&!Qe.value&&!at.value}function Bt(e){const t=e.split(/\r?\n/);for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}function jt(e,t,l){return u(this,null,function*(){var n;try{return yield X(e,t,null!=(n=null==l?void 0:l.timeoutMs)?n:st.value.worker)}catch(o){return yield function(e,t,l){return u(this,null,function*(){var n,o;const r=yield ke();if(!r)return;const a=r,i=Ct(e,t);if("function"==typeof a.parse)return yield yt(()=>a.parse(i),{timeoutMs:null!=(n=null==l?void 0:l.timeoutMs)?n:st.value.parse,signal:null==l?void 0:l.signal}),!0;const u=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return yield yt(()=>r.render(u,i),{timeoutMs:null!=(o=null==l?void 0:l.timeoutMs)?o:st.value.render,signal:null==l?void 0:l.signal}),!0})}(e,t,l)}})}"undefined"!=typeof window&&d(()=>Te.value,e=>{var t;if(null==(t=Ee.value)||t.destroy(),Ee.value=null,!e)return void(Se.value=!1);const l=je(e,{rootMargin:"400px"});Ee.value=l,Se.value=l.isVisible.value,l.whenVisible.then(()=>{Se.value=!0})},{immediate:!0}),m(()=>{var e;null==(e=Ee.value)||e.destroy(),Ee.value=null});const Et=v(()=>Re.value||_e.value||Me.value);function St(e){if(!Te.value||!Ce.value)return;const t=Ce.value.querySelector("svg");if(!t)return;let l=0,n=0;const o=t.getAttribute("viewBox"),r=t.getAttribute("width"),a=t.getAttribute("height");if(o){const e=o.split(" ");4===e.length&&(l=Number.parseFloat(e[2]),n=Number.parseFloat(e[3]))}if(l&&n||r&&a&&(l=Number.parseFloat(r),n=Number.parseFloat(a)),Number.isNaN(l)||Number.isNaN(n)||l<=0||n<=0)try{const e=t.getBBox();e&&e.width>0&&e.height>0&&(l=e.width,n=e.height)}catch(i){return void console.error("Failed to get SVG BBox:",i)}if(l>0&&n>0){const t=n/l;let o=(null!=e?e:Te.value.clientWidth)*t;o>n&&(o=n),Ke.value=`${o}px`}}const Ot=c(!1),Pt=v(()=>({transform:`translate(${$e.value}px, ${ze.value}px) scale(${Le.value})`}));function Lt(e){"Escape"===e.key&&Ot.value&&$t()}function $t(){if(Ot.value=!1,De.value&&we(De.value),Be.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",Lt)}catch(e){}}function zt(){Le.value<3&&(Le.value+=.1)}function At(){Le.value>.5&&(Le.value-=.1)}function Ft(){Le.value=1,$e.value=0,ze.value=0}function Rt(e){Ae.value=!0,e instanceof MouseEvent?Fe.value={x:e.clientX-$e.value,y:e.clientY-ze.value}:Fe.value={x:e.touches[0].clientX-$e.value,y:e.touches[0].clientY-ze.value}}function Ht(e){if(!Ae.value)return;let t,l;e instanceof MouseEvent?(t=e.clientX,l=e.clientY):(t=e.touches[0].clientX,l=e.touches[0].clientY),$e.value=t-Fe.value.x,ze.value=l-Fe.value.y}function _t(){Ae.value=!1}function Xt(e){if(a.enableWheelZoom&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),!Te.value)return;const t=Te.value.getBoundingClientRect(),l=e.clientX-t.left,n=e.clientY-t.top,o=l-t.width/2,r=n-t.height/2,a=(o-$e.value)/Le.value,i=(r-ze.value)/Le.value,u=.01,s=-e.deltaY*u,c=Math.min(Math.max(Le.value+s,.5),3);c!==Le.value&&($e.value=o-a*c,ze.value=r-i*c,Le.value=c)}}function Nt(){return u(this,null,function*(){try{const e=Pe.value,t={payload:{type:"copy",text:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(s("copy",t),t.defaultPrevented)return;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),be.value=!0,setTimeout(()=>{be.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function Yt(){var e;const t=null==(e=Ce.value)?void 0:e.querySelector("svg");if(!t)return void console.error("SVG element not found");const l=(new XMLSerializer).serializeToString(t),n={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:t,svgString:l};s("export",n),n.defaultPrevented||function(e,t=null){u(this,null,function*(){try{const n=null!=t?t:(new XMLSerializer).serializeToString(e),o=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(o);if("undefined"!=typeof document){const e=document.createElement("a");e.href=r,e.download=`mermaid-diagram-${Date.now()}.svg`;try{document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch(l){}URL.revokeObjectURL(r)}}catch(n){console.error("Failed to export SVG:",n)}})}(t,l)}function Zt(){var e,t;const l=null!=(t=null==(e=Ce.value)?void 0:e.querySelector("svg"))?t:null,n=l?(new XMLSerializer).serializeToString(l):null,o={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:l,svgString:n};s("openModal",o),o.defaultPrevented||function(){if(Ot.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",Lt)}catch(e){}h(()=>{if(Te.value&&De.value){const e=Te.value.cloneNode(!0);e.classList.add("fullscreen");const t=e.querySelector("[data-mermaid-wrapper]");t&&(Be.value=t,t.style.transform=Pt.value.transform),we(De.value),De.value.appendChild(e)}})}()}function It(e){const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};s("toggleMode",e,t),t.defaultPrevented||qt(e)}function qt(e){return u(this,null,function*(){const t=Oe.value;if(!t)return He.value=!0,void(Re.value="source"===e);const l=t.getBoundingClientRect().height;t.style.height=`${l}px`,t.style.overflow="hidden",He.value=!0,Re.value="source"===e,yield h();const n=t.scrollHeight;t.style.transition="height 180ms ease",t.offsetHeight,t.style.height=`${n}px`;const o=()=>{t.style.transition="",t.style.height="",t.style.overflow="",t.removeEventListener("transitionend",r)};function r(){o()}t.addEventListener("transitionend",r),setTimeout(()=>o(),220)})}function Vt(){return u(this,null,function*(){return _e.value?Xe.value:Ce.value||(yield h(),Ce.value)?(_e.value=!0,Xe.value=u(null,null,function*(){var e,n,o;Ce.value&&(Ce.value.style.opacity="0");try{const r=yield ke();if(!r)return;const u=`mermaid-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;Qe.value||et.value||null==(e=r.initialize)||e.call(r,(n=i({},he.value),o={dompurifyConfig:i({},Z)},t(n,l(o))));const s=function(e,t=Pe.value){const l=t,n=`%%{init: {"theme": "${"dark"===e?"dark":"default"}"}}%%\n`;return l.trim().startsWith("%%{")?l:n+l}(a.isDark?"dark":"light"),c=yield yt(()=>r.render(u,s),{timeoutMs:st.value.fullRender}),v=null==c?void 0:c.svg;if(Ce.value){const e=ye(Ce.value,v);Qe.value||et.value||(St(),Qe.value=!0,it.value={zoom:Le.value,translateX:$e.value,translateY:ze.value,containerHeight:Ke.value});const t=a.isDark?"dark":"light";e&&(tt.value[t]=e),et.value&&(et.value=!1),at.value=!1,qe=0,We()}}catch(r){const e=function(e){const t="string"==typeof e?e:"string"==typeof(null==e?void 0:e.message)?e.message:"";return"string"==typeof t&&/timed out/i.test(t)}(r),t=qe+1;e&&t<=3?(qe=t,Ge(Math.min(1200,600*t))):(qe=0,We(),console.error("Failed to render mermaid diagram:",r),!1===a.loading&&xt(r))}finally{yield h(),Ce.value&&(Ce.value.style.opacity="1"),_e.value=!1,Xe.value=null}}),Xe.value):void console.warn("Mermaid container not ready")})}function Ut(){return u(this,null,function*(){var e,t;const l=Date.now(),n=++ot.value;rt&&rt.abort(),rt=new AbortController;const o=rt.signal,r=a.isDark?"dark":"light",i=Pe.value,s=i.replace(/\s+/g,"");if(!i.trim())return Ce.value&&we(Ce.value),lt.value=null,nt.value="",void(at.value=!1);if(s===nt.value)return;try{const c=yield function(e,t,l){return u(this,null,function*(){var n;try{if(yield jt(e,t,l))return{fullOk:!0,prefixOk:!1}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}let o=Bt(e);if(o&&o.trim()&&o!==e)try{try{const r=yield N(e,t,null!=(n=null==l?void 0:l.timeoutMs)?n:st.value.worker);r&&r.trim()&&(o=r)}catch(r){}if(yield jt(o,t,l))return{fullOk:!1,prefixOk:!0,prefix:o}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}return{fullOk:!1,prefixOk:!1}})}(i,r,{signal:o,timeoutMs:st.value.worker});if(c.fullOk)return yield Vt(),void(ot.value===n&&(lt.value=null!=(t=null==(e=Ce.value)?void 0:e.innerHTML)?t:null,nt.value=s,at.value=!1));const v=ft&&l<=ft;if(c.prefixOk&&c.prefix&&Dt()&&!v)return void(yield function(e){return u(this,null,function*(){if(Dt()&&(Ce.value||(yield h(),Ce.value))&&!_e.value){_e.value=!0;try{const t=yield ke();if(!t)return;const l=`mermaid-partial-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,n=a.isDark?"dark":"light",o=Bt(e),r=Ct(o&&o.trim()?o:e,n);Ce.value&&(Ce.value.style.opacity="0");const i=yield yt(()=>t.render(l,r),{timeoutMs:st.value.render}),u=null==i?void 0:i.svg;Ce.value&&u&&(ye(Ce.value,u),St())}catch(t){}finally{yield h(),Ce.value&&(Ce.value.style.opacity="1"),_e.value=!1}}})}(c.prefix))}catch(v){if("AbortError"===(null==v?void 0:v.name))return}if(ot.value!==n)return;if(at.value)return;const c=tt.value[r];c&&Ce.value&&ye(Ce.value,c)})}function Wt(){mt&&(mt=!1,ht=800,pt=!1,gt&&(gt.abort(),gt=null),vt&&(globalThis.clearTimeout(vt),vt=null),dt&&(ct(dt),dt=null),ft=Date.now())}function Gt(){if(Wt(),rt){try{rt.abort()}catch(e){}rt=null}if(gt){try{gt.abort()}catch(e){}gt=null}Y(),We(),qe=0}function Kt(e=800){mt&&(wt>=12?Wt():(vt&&globalThis.clearTimeout(vt),vt=globalThis.setTimeout(()=>{dt=Ve(()=>u(null,null,function*(){if(!mt)return;if(Re.value||Qe.value)return void Wt();const e=a.isDark?"dark":"light",t=Pe.value;if(!t.trim())return!1===a.loading?void Wt():void Kt(ht);if(wt++,wt>12)Wt();else{gt&>.abort(),gt=new AbortController;try{if((yield jt(t,e,{signal:gt.signal,timeoutMs:st.value.worker}))&&(yield Vt(),Qe.value))return void Wt()}catch(l){}ht=Math.min(Math.floor(1.5*ht),4e3),Kt(ht)}}),{timeout:500})},e)))}function Jt(){mt||Re.value||Qe.value||(mt=!0,ft=0,pt=!0,wt=0,Kt(500))}d(Pt,e=>{Ot.value&&Be.value&&(Be.value.style.transform=e.transform)},{immediate:!0}),d(()=>Pe.value,()=>{Qe.value=!1,tt.value={},Ue(),!Re.value&&de.value&&Jt(),function(){if(!Re.value)return;if(!de.value)return;const e=Pe.value.length;e!==Ne.value&&(Ye.value=!0,Ne.value=e,Ze&&clearTimeout(Ze),Ze=setTimeout(()=>{Ye.value&&Re.value&&Pe.value.trim()&&(Ye.value=!1,qt("preview"))},500))}()}),d(()=>a.isDark,()=>u(null,null,function*(){if(!Qe.value)return;if(at.value)return;const e=a.isDark?"dark":"light",t=tt.value[e];if(t)return void(Ce.value&&ye(Ce.value,t));const l={zoom:Le.value,translateX:$e.value,translateY:ze.value,containerHeight:Ke.value},n=1!==Le.value||0!==$e.value||0!==ze.value;et.value=!0,n&&(Le.value=1,$e.value=0,ze.value=0,yield h()),yield Vt(),n&&(yield h(),Le.value=l.zoom,$e.value=l.translateX,ze.value=l.translateY,Ke.value=l.containerHeight,it.value=l)})),d(()=>Re.value,e=>u(null,null,function*(){if(e)Wt(),Qe.value&&(it.value={zoom:Le.value,translateX:$e.value,translateY:ze.value,containerHeight:Ke.value});else{if(at.value)return;const e=a.isDark?"dark":"light";if(Qe.value&&tt.value[e])return yield h(),Ce.value&&ye(Ce.value,tt.value[e]),Le.value=it.value.zoom,$e.value=it.value.translateX,ze.value=it.value.translateY,void(Ke.value=it.value.containerHeight);if(yield h(),!de.value)return;yield Ut(),Jt()}})),d(()=>a.loading,(e,t)=>u(null,null,function*(){if(!0===t&&!1===e){const e=Pe.value.trim();if(!e)return Gt();const t=a.isDark?"dark":"light",n=e.replace(/\s+/g,"");if(Qe.value&&n===nt.value)return yield h(),Ce.value&&!Ce.value.querySelector("svg")&&tt.value[t]&&ye(Ce.value,tt.value[t]),void Gt();try{yield jt(e,t,{timeoutMs:st.value.worker}),yield Vt(),nt.value=n,at.value=!1,Gt()}catch(l){Gt(),xt(l)}}})),d(Te,e=>{Je&&Je.disconnect(),!e||Qe.value||et.value||(Je=new ResizeObserver(e=>{e&&e.length>0&&!Qe.value&&!et.value&&I(()=>{St(e[0].contentRect.width)})}),Je.observe(e))},{immediate:!0}),g(()=>u(null,null,function*(){yield h(),He.value||(Re.value=!de.value),Se.value&&(Ue(),Ne.value=Pe.value.length)})),d(()=>de.value,e=>{He.value||(Re.value=!e)}),d(()=>Se.value,e=>{e&&(Qe.value||(Ue(),Ne.value=Pe.value.length),a.loading||Qe.value||Ue())},{immediate:!1}),f(()=>{Ze&&clearTimeout(Ze),Je&&Je.disconnect(),rt&&(rt.abort(),rt=null),Y(),Wt(),We()}),d(()=>Me.value,e=>u(null,null,function*(){e?(Wt(),rt&&rt.abort()):Qe.value||(yield h(),Ue(),Re.value||Jt())}),{immediate:!1});const Qt=v(()=>a.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700");return(e,t)=>(w(),p("div",{class:y(["my-4 rounded-lg border overflow-hidden shadow-sm",[a.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":a.loading}]])},[a.showHeader?(w(),p("div",{key:0,class:y(["mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",a.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"])},[e.$slots["header-left"]?(w(),p("div",q,[b(e.$slots,"header-left",{},void 0,!0)])):(w(),p("div",V,[M("img",{src:T("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20width='16'%20height='16'%3e%3cpath%20fill='none'%20stroke='%23ca9ee6'%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M1.5%202.5c0%206%202.25%205.75%204%207%20.83.67%201.17%202%201%204h3c-.17-2%20.17-3.33%201-4%201.75-1.25%204-1%204-7C12%202.5%2010%203%208%207%206%203%204%202.5%201.5%202.5'%20/%3e%3c/svg%3e"),class:"w-4 h-4 my-0",alt:"Mermaid"},null,8,U),M("span",{class:y(["text-sm font-medium font-mono truncate",a.isDark?"text-gray-400":"text-gray-600"])},"Mermaid",2)])),e.$slots["header-center"]?(w(),p("div",W,[b(e.$slots,"header-center",{},void 0,!0)])):a.showModeToggle&&de.value?(w(),p("div",{key:3,class:y(["flex items-center gap-x-1 rounded-md p-0.5",a.isDark?"bg-gray-700":"bg-gray-100"])},[M("button",{class:y(["px-2.5 py-1 text-xs rounded transition-colors",[Re.value?a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"]]),onClick:t[0]||(t[0]=()=>It("preview")),onMouseenter:t[1]||(t[1]=e=>bt(e,T(xe)("common.preview")||"Preview")),onFocus:t[2]||(t[2]=e=>bt(e,T(xe)("common.preview")||"Preview")),onMouseleave:Mt,onBlur:Mt},[M("div",G,[t[21]||(t[21]=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:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),M("circle",{cx:"12",cy:"12",r:"3"})])],-1)),M("span",null,C(T(xe)("common.preview")||"Preview"),1)])],34),M("button",{class:y(["px-2.5 py-1 text-xs rounded transition-colors",[Re.value?a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"]]),onClick:t[3]||(t[3]=()=>It("source")),onMouseenter:t[4]||(t[4]=e=>bt(e,T(xe)("common.source")||"Source")),onFocus:t[5]||(t[5]=e=>bt(e,T(xe)("common.source")||"Source")),onMouseleave:Mt,onBlur:Mt},[M("div",K,[t[22]||(t[22]=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:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),M("span",null,C(T(xe)("common.source")||"Source"),1)])],34)],2)):x("",!0),e.$slots["header-right"]?(w(),p("div",J,[b(e.$slots,"header-right",{},void 0,!0)])):(w(),p("div",Q,[a.showCollapseButton?(w(),p("button",{key:0,class:y(Qt.value),"aria-pressed":Me.value,onClick:t[6]||(t[6]=e=>Me.value=!Me.value),onMouseenter:t[7]||(t[7]=e=>bt(e,Me.value?T(xe)("common.expand")||"Expand":T(xe)("common.collapse")||"Collapse")),onFocus:t[8]||(t[8]=e=>bt(e,Me.value?T(xe)("common.expand")||"Expand":T(xe)("common.collapse")||"Collapse")),onMouseleave:Mt,onBlur:Mt},[(w(),p("svg",{style:D({rotate:Me.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[23]||(t[23]=[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],42,ee)):x("",!0),a.showCopyButton?(w(),p("button",{key:1,class:y(Qt.value),onClick:Nt,onMouseenter:t[9]||(t[9]=e=>Tt(e)),onFocus:t[10]||(t[10]=e=>Tt(e)),onMouseleave:Mt,onBlur:Mt},[be.value?(w(),p("svg",le,[...t[25]||(t[25]=[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(w(),p("svg",te,[...t[24]||(t[24]=[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)])]))],34)):x("",!0),a.showExportButton&&de.value?(w(),p("button",{key:2,class:y(`${Qt.value} ${Et.value?"opacity-50 cursor-not-allowed":""}`),disabled:Et.value,onClick:Yt,onMouseenter:t[11]||(t[11]=e=>bt(e,T(xe)("common.export")||"Export")),onFocus:t[12]||(t[12]=e=>bt(e,T(xe)("common.export")||"Export")),onMouseleave:Mt,onBlur:Mt},[...t[26]||(t[26]=[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:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),M("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,ne)):x("",!0),a.showFullscreenButton&&de.value?(w(),p("button",{key:3,class:y(`${Qt.value} ${Et.value?"opacity-50 cursor-not-allowed":""}`),disabled:Et.value,onClick:Zt,onMouseenter:t[13]||(t[13]=e=>bt(e,Ot.value?T(xe)("common.minimize")||"Minimize":T(xe)("common.open")||"Open")),onFocus:t[14]||(t[14]=e=>bt(e,Ot.value?T(xe)("common.minimize")||"Minimize":T(xe)("common.open")||"Open")),onMouseleave:Mt,onBlur:Mt},[Ot.value?(w(),p("svg",ae,[...t[28]||(t[28]=[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)])])):(w(),p("svg",re,[...t[27]||(t[27]=[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)])]))],42,oe)):x("",!0)]))],2)):x("",!0),k(M("div",{ref_key:"modeContainerRef",ref:Oe},[Re.value?(w(),p("div",{key:0,class:y(["p-4",a.isDark?"bg-gray-900":"bg-gray-50"])},[M("pre",{class:y(["text-sm font-mono whitespace-pre-wrap",a.isDark?"text-gray-300":"text-gray-700"])},C(Pe.value),3)],2)):(w(),p("div",ie,[a.showZoomControls?(w(),p("div",ue,[M("div",se,[M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:zt,onMouseenter:t[15]||(t[15]=e=>bt(e,T(xe)("common.zoomIn")||"Zoom in")),onFocus:t[16]||(t[16]=e=>bt(e,T(xe)("common.zoomIn")||"Zoom in")),onMouseleave:Mt,onBlur:Mt},[...t[29]||(t[29]=[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("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],34),M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:At,onMouseenter:t[17]||(t[17]=e=>bt(e,T(xe)("common.zoomOut")||"Zoom out")),onFocus:t[18]||(t[18]=e=>bt(e,T(xe)("common.zoomOut")||"Zoom out")),onMouseleave:Mt,onBlur:Mt},[...t[30]||(t[30]=[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("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],34),M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Ft,onMouseenter:t[19]||(t[19]=e=>bt(e,T(xe)("common.resetZoom")||"Reset zoom")),onFocus:t[20]||(t[20]=e=>bt(e,T(xe)("common.resetZoom")||"Reset zoom")),onMouseleave:Mt,onBlur:Mt},C(Math.round(100*Le.value))+"% ",35)])])):x("",!0),M("div",j({ref_key:"mermaidContainer",ref:Te,class:["min-h-[360px] relative transition-all duration-100 overflow-hidden block",a.isDark?"bg-gray-900":"bg-gray-50"],style:{height:Ke.value}},E(ut.value,!0),{onMousedown:Rt,onMousemove:Ht,onMouseup:_t,onMouseleave:_t,onTouchstartPassive:Rt,onTouchmovePassive:Ht,onTouchendPassive:_t}),[M("div",{"data-mermaid-wrapper":"",class:y(["absolute inset-0 cursor-grab",{"cursor-grabbing":Ae.value}]),style:D(Pt.value)},[M("div",{ref_key:"mermaidContent",ref:Ce,class:"_mermaid w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],16),(w(),B(S,{to:"body"},[M("div",ce,[O(P,{name:"mermaid-dialog",appear:""},{default:L(()=>[Ot.value?(w(),p("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:$($t,["self"])},[M("div",{class:y(["dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",a.isDark?"bg-gray-900":"bg-white"])},[M("div",ve,[M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:zt},[...t[31]||(t[31]=[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("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],2),M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:At},[...t[32]||(t[32]=[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("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],2),M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Ft},C(Math.round(100*Le.value))+"% ",3),M("button",{class:y(["inline-flex items-center justify-center p-2 rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:$t},[...t[33]||(t[33]=[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:"M18 6L6 18M6 6l12 12"})],-1)])],2)]),M("div",j({ref_key:"modalContent",ref:De,class:"w-full h-full flex items-center justify-center p-4 overflow-hidden"},E(ut.value,!0),{onMousedown:Rt,onMousemove:Ht,onMouseup:_t,onMouseleave:_t,onTouchstartPassive:Rt,onTouchmovePassive:Ht,onTouchendPassive:_t}),null,16)],2)])):x("",!0)]),_:1})])]))]))],512),[[z,!Me.value]])],2))}}),[["__scopeId","data-v-2ff46cc8"]]);de.install=e=>{e.component(de.__name,de)};export{de as default};
|
|
1
|
+
var e=Object.defineProperty,t=Object.defineProperties,l=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,a=(t,l,n)=>l in t?e(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,i=(e,t)=>{for(var l in t||(t={}))o.call(t,l)&&a(e,l,t[l]);if(n)for(var l of n(t))r.call(t,l)&&a(e,l,t[l]);return e},u=(e,t,l)=>new Promise((n,o)=>{var r=e=>{try{i(l.next(e))}catch(t){o(t)}},a=e=>{try{i(l.throw(e))}catch(t){o(t)}},i=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);i((l=l.apply(e,t)).next())});import{defineComponent as s,ref as c,computed as v,watch as d,onBeforeUnmount as m,nextTick as h,onMounted as g,onUnmounted as f,createElementBlock as p,openBlock as w,normalizeClass as y,createCommentVNode as x,withDirectives as k,renderSlot as b,createElementVNode as M,unref as T,toDisplayString as C,normalizeStyle as D,createBlock as B,mergeProps as j,toHandlers as E,Teleport as S,createVNode as O,Transition as P,withCtx as L,withModifiers as $,vShow as z}from"vue";import{u as A,a as F,j as R,s as H,h as _,k as X,m as N,t as Y,_ as Z}from"./exports.js";import{s as I}from"./safeRaf.js";const q={key:0},V={key:1,class:"flex items-center gap-x-2 overflow-hidden"},U=["src"],W={key:2},G={class:"flex items-center gap-x-1"},K={class:"flex items-center gap-x-1"},J={key:4},Q={key:5,class:"flex items-center gap-x-1"},ee=["aria-pressed"],te={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"},le={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"},ne=["disabled"],oe=["disabled"],re={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},ae={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},ie={key:1,class:"relative"},ue={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},se={class:"flex items-center gap-2 backdrop-blur rounded-lg"},ce={class:"markstream-vue"},ve={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},de=/* @__PURE__ */Z(/* @__PURE__ */s({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!1}},emits:["copy","export","openModal","toggleMode"],setup(e,{emit:n}){var o,r;const a=e,s=n,Z={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},de=c(!1),me=v(()=>a.isStrict?"strict":"loose"),he=v(()=>({startOnLoad:!1,securityLevel:me.value,dompurifyConfig:"strict"===me.value?Z:void 0,flowchart:"strict"===me.value?{htmlLabels:!1}:void 0})),ge=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],fe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function pe(e){if(!e)return"";const t=e.trim();return fe.test(t)?t:""}function we(e){if(e)try{e.replaceChildren()}catch(t){e.innerHTML=""}}function ye(e,t){if(!e)return"";if("strict"===me.value)return function(e,t){if(!e)return"";try{e.replaceChildren()}catch(n){e.innerHTML=""}const l=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return null;if(!e)return null;const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),l=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!l||"svg"!==l.nodeName.toLowerCase())return null;const n=l;return function(e){const t=/* @__PURE__ */new Set(["script"]),l=[e,...Array.from(e.querySelectorAll("*"))];for(const n of l){if(t.has(n.tagName.toLowerCase())){n.remove();continue}const e=Array.from(n.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))n.removeAttribute(e);else{if("style"===e&&t.value){const l=t.value;if(ge.some(e=>e.test(l))){n.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const l=pe(t.value);if(!l){n.removeAttribute(e);continue}l!==t.value&&n.setAttribute(e,l)}}}}}(n),n}(t);return l?(e.appendChild(l),e.innerHTML):""}(e,t);try{e.replaceChildren()}catch(l){e.innerHTML=""}if(t)try{e.insertAdjacentHTML("afterbegin",t)}catch(l){e.innerHTML=t}return e.innerHTML}const{t:xe}=A();function ke(){return u(this,null,function*(){try{const e=yield R();return de.value=!!e,e}catch(e){throw de.value=!1,e}})}"undefined"!=typeof window&&u(null,null,function*(){var e;try{const t=yield ke();if(!t)return;null==(e=null==t?void 0:t.initialize)||e.call(t,i({},he.value))}catch(t){de.value=!1,console.warn("[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.",t)}});const be=c(!1),Me=c(!1),Te=c(),Ce=c(),De=c(),Be=c(null),je=F(),Ee=c(null),Se=c("undefined"==typeof window),Oe=c(),Pe=v(()=>a.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode")),Le=c(1),$e=c(0),ze=c(0),Ae=c(!1),Fe=c({x:0,y:0}),Re=c(!1),He=c(!1),_e=c(!1),Xe=c(null),Ne=c(0),Ye=c(!1);let Ze=null,Ie=null,qe=0;const Ve=null!=(o=globalThis.requestIdleCallback)?o:(e,t)=>setTimeout(()=>e({didTimeout:!0}),16),Ue=function(){let e=null;return(...t)=>{e&&clearTimeout(e),e=setTimeout(()=>(()=>{Ve(()=>{Ut()},{timeout:500})})(...t),300)}}();function We(){null!=Ie&&(globalThis.clearTimeout(Ie),Ie=null)}function Ge(e=600){if("undefined"==typeof globalThis)return;const t=Math.max(0,e);We(),Ie=globalThis.setTimeout(()=>{Ie=null,a.loading||_e.value||!Se.value?Ge(Math.min(1200,Math.max(300,1.2*t))):Ue()},t)}const Ke=c("360px");let Je=null;const Qe=c(!1),et=c(!1),tt=c({}),lt=c(null),nt=c(""),ot=c(0);let rt=null;const at=c(!1),it=c({zoom:1,translateX:0,translateY:0,containerHeight:"360px"}),ut=v(()=>a.enableWheelZoom?{wheel:Xt}:{}),st=v(()=>{var e,t,l,n;return{worker:null!=(e=a.workerTimeoutMs)?e:1400,parse:null!=(t=a.parseTimeoutMs)?t:1800,render:null!=(l=a.renderTimeoutMs)?l:2500,fullRender:null!=(n=a.fullRenderTimeoutMs)?n:4e3}}),ct=null!=(r=globalThis.cancelIdleCallback)?r:e=>clearTimeout(e);let vt=null,dt=null,mt=!1,ht=800,gt=null,ft=0,pt=!0,wt=0;function yt(e,t){const l=null==t?void 0:t.timeoutMs,n=null==t?void 0:t.signal;if(null==n?void 0:n.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));let o=null,r=!1,a=null;return new Promise((t,i)=>{const u=()=>{null!=o&&clearTimeout(o),a&&n&&n.removeEventListener("abort",a)};l&&l>0&&(o=globalThis.setTimeout(()=>{r||(r=!0,u(),i(new Error("Operation timed out")))},l)),n&&(a=()=>{r||(r=!0,u(),i(new DOMException("Aborted","AbortError")))},n.addEventListener("abort",a)),e().then(e=>{r||(r=!0,u(),t(e))}).catch(e=>{r||(r=!0,u(),i(e))})})}function xt(e){if("undefined"==typeof document)return;if(!Ce.value)return;const t=document.createElement("div");t.className="text-red-500 p-4",t.textContent="Failed to render diagram: ";const l=document.createElement("span");l.textContent=e instanceof Error?e.message:"Unknown error",t.appendChild(l),we(Ce.value),Ce.value.appendChild(t),Ke.value="360px",at.value=!0,Wt()}function kt(e){return!e||e.disabled}function bt(e,t,l="top"){if(kt(e.currentTarget))return;const n=e,o=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;H(e.currentTarget,t,l,!1,o,a.isDark)}function Mt(){_()}function Tt(e){if(kt(e.currentTarget))return;const t=be.value?xe("common.copied")||"Copied":xe("common.copy")||"Copy",l=e,n=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;H(e.currentTarget,t,"top",!1,n,a.isDark)}function Ct(e,t){const l=`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n`;return e.trimStart().startsWith("%%{")?e:l+e}function Dt(){return pt&&!Re.value&&!Qe.value&&!at.value}function Bt(e){const t=e.split(/\r?\n/);for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}function jt(e,t,l){return u(this,null,function*(){var n;try{return yield X(e,t,null!=(n=null==l?void 0:l.timeoutMs)?n:st.value.worker)}catch(o){return yield function(e,t,l){return u(this,null,function*(){var n,o;const r=yield ke();if(!r)return;const a=r,i=Ct(e,t);if("function"==typeof a.parse)return yield yt(()=>a.parse(i),{timeoutMs:null!=(n=null==l?void 0:l.timeoutMs)?n:st.value.parse,signal:null==l?void 0:l.signal}),!0;const u=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return yield yt(()=>r.render(u,i),{timeoutMs:null!=(o=null==l?void 0:l.timeoutMs)?o:st.value.render,signal:null==l?void 0:l.signal}),!0})}(e,t,l)}})}"undefined"!=typeof window&&d(()=>Te.value,e=>{var t;if(null==(t=Ee.value)||t.destroy(),Ee.value=null,!e)return void(Se.value=!1);const l=je(e,{rootMargin:"400px"});Ee.value=l,Se.value=l.isVisible.value,l.whenVisible.then(()=>{Se.value=!0})},{immediate:!0}),m(()=>{var e;null==(e=Ee.value)||e.destroy(),Ee.value=null});const Et=v(()=>Re.value||_e.value||Me.value);function St(e){if(!Te.value||!Ce.value)return;const t=Ce.value.querySelector("svg");if(!t)return;let l=0,n=0;const o=t.getAttribute("viewBox"),r=t.getAttribute("width"),a=t.getAttribute("height");if(o){const e=o.split(" ");4===e.length&&(l=Number.parseFloat(e[2]),n=Number.parseFloat(e[3]))}if(l&&n||r&&a&&(l=Number.parseFloat(r),n=Number.parseFloat(a)),Number.isNaN(l)||Number.isNaN(n)||l<=0||n<=0)try{const e=t.getBBox();e&&e.width>0&&e.height>0&&(l=e.width,n=e.height)}catch(i){return void console.error("Failed to get SVG BBox:",i)}if(l>0&&n>0){const t=n/l;let o=(null!=e?e:Te.value.clientWidth)*t;o>n&&(o=n),Ke.value=`${o}px`}}const Ot=c(!1),Pt=v(()=>({transform:`translate(${$e.value}px, ${ze.value}px) scale(${Le.value})`}));function Lt(e){"Escape"===e.key&&Ot.value&&$t()}function $t(){if(Ot.value=!1,De.value&&we(De.value),Be.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",Lt)}catch(e){}}function zt(){Le.value<3&&(Le.value+=.1)}function At(){Le.value>.5&&(Le.value-=.1)}function Ft(){Le.value=1,$e.value=0,ze.value=0}function Rt(e){Ae.value=!0,e instanceof MouseEvent?Fe.value={x:e.clientX-$e.value,y:e.clientY-ze.value}:Fe.value={x:e.touches[0].clientX-$e.value,y:e.touches[0].clientY-ze.value}}function Ht(e){if(!Ae.value)return;let t,l;e instanceof MouseEvent?(t=e.clientX,l=e.clientY):(t=e.touches[0].clientX,l=e.touches[0].clientY),$e.value=t-Fe.value.x,ze.value=l-Fe.value.y}function _t(){Ae.value=!1}function Xt(e){if(a.enableWheelZoom&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),!Te.value)return;const t=Te.value.getBoundingClientRect(),l=e.clientX-t.left,n=e.clientY-t.top,o=l-t.width/2,r=n-t.height/2,a=(o-$e.value)/Le.value,i=(r-ze.value)/Le.value,u=.01,s=-e.deltaY*u,c=Math.min(Math.max(Le.value+s,.5),3);c!==Le.value&&($e.value=o-a*c,ze.value=r-i*c,Le.value=c)}}function Nt(){return u(this,null,function*(){try{const e=Pe.value,t={payload:{type:"copy",text:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(s("copy",t),t.defaultPrevented)return;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),be.value=!0,setTimeout(()=>{be.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function Yt(){var e;const t=null==(e=Ce.value)?void 0:e.querySelector("svg");if(!t)return void console.error("SVG element not found");const l=(new XMLSerializer).serializeToString(t),n={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:t,svgString:l};s("export",n),n.defaultPrevented||function(e,t=null){u(this,null,function*(){try{const n=null!=t?t:(new XMLSerializer).serializeToString(e),o=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(o);if("undefined"!=typeof document){const e=document.createElement("a");e.href=r,e.download=`mermaid-diagram-${Date.now()}.svg`;try{document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch(l){}URL.revokeObjectURL(r)}}catch(n){console.error("Failed to export SVG:",n)}})}(t,l)}function Zt(){var e,t;const l=null!=(t=null==(e=Ce.value)?void 0:e.querySelector("svg"))?t:null,n=l?(new XMLSerializer).serializeToString(l):null,o={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:l,svgString:n};s("openModal",o),o.defaultPrevented||function(){if(Ot.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",Lt)}catch(e){}h(()=>{if(Te.value&&De.value){const e=Te.value.cloneNode(!0);e.classList.add("fullscreen");const t=e.querySelector("[data-mermaid-wrapper]");t&&(Be.value=t,t.style.transform=Pt.value.transform),we(De.value),De.value.appendChild(e)}})}()}function It(e){const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};s("toggleMode",e,t),t.defaultPrevented||qt(e)}function qt(e){return u(this,null,function*(){const t=Oe.value;if(!t)return He.value=!0,void(Re.value="source"===e);const l=t.getBoundingClientRect().height;t.style.height=`${l}px`,t.style.overflow="hidden",He.value=!0,Re.value="source"===e,yield h();const n=t.scrollHeight;t.style.transition="height 180ms ease",t.offsetHeight,t.style.height=`${n}px`;const o=()=>{t.style.transition="",t.style.height="",t.style.overflow="",t.removeEventListener("transitionend",r)};function r(){o()}t.addEventListener("transitionend",r),setTimeout(()=>o(),220)})}function Vt(){return u(this,null,function*(){return _e.value?Xe.value:Ce.value||(yield h(),Ce.value)?(_e.value=!0,Xe.value=u(null,null,function*(){var e,n,o;Ce.value&&(Ce.value.style.opacity="0");try{const r=yield ke();if(!r)return;const u=`mermaid-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;Qe.value||et.value||null==(e=r.initialize)||e.call(r,(n=i({},he.value),o={dompurifyConfig:i({},Z)},t(n,l(o))));const s=function(e,t=Pe.value){const l=t,n=`%%{init: {"theme": "${"dark"===e?"dark":"default"}"}}%%\n`;return l.trim().startsWith("%%{")?l:n+l}(a.isDark?"dark":"light"),c=yield yt(()=>r.render(u,s),{timeoutMs:st.value.fullRender}),v=null==c?void 0:c.svg;if(Ce.value){const e=ye(Ce.value,v);Qe.value||et.value||(St(),Qe.value=!0,it.value={zoom:Le.value,translateX:$e.value,translateY:ze.value,containerHeight:Ke.value});const t=a.isDark?"dark":"light";e&&(tt.value[t]=e),et.value&&(et.value=!1),at.value=!1,qe=0,We()}}catch(r){const e=function(e){const t="string"==typeof e?e:"string"==typeof(null==e?void 0:e.message)?e.message:"";return"string"==typeof t&&/timed out/i.test(t)}(r),t=qe+1;e&&t<=3?(qe=t,Ge(Math.min(1200,600*t))):(qe=0,We(),console.error("Failed to render mermaid diagram:",r),!1===a.loading&&xt(r))}finally{yield h(),Ce.value&&(Ce.value.style.opacity="1"),_e.value=!1,Xe.value=null}}),Xe.value):void console.warn("Mermaid container not ready")})}function Ut(){return u(this,null,function*(){var e,t;const l=Date.now(),n=++ot.value;rt&&rt.abort(),rt=new AbortController;const o=rt.signal,r=a.isDark?"dark":"light",i=Pe.value,s=i.replace(/\s+/g,"");if(!i.trim())return Ce.value&&we(Ce.value),lt.value=null,nt.value="",void(at.value=!1);if(s===nt.value)return;try{const c=yield function(e,t,l){return u(this,null,function*(){var n;try{if(yield jt(e,t,l))return{fullOk:!0,prefixOk:!1}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}let o=Bt(e);if(o&&o.trim()&&o!==e)try{try{const r=yield N(e,t,null!=(n=null==l?void 0:l.timeoutMs)?n:st.value.worker);r&&r.trim()&&(o=r)}catch(r){}if(yield jt(o,t,l))return{fullOk:!1,prefixOk:!0,prefix:o}}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r}return{fullOk:!1,prefixOk:!1}})}(i,r,{signal:o,timeoutMs:st.value.worker});if(c.fullOk)return yield Vt(),void(ot.value===n&&(lt.value=null!=(t=null==(e=Ce.value)?void 0:e.innerHTML)?t:null,nt.value=s,at.value=!1));const v=ft&&l<=ft;if(c.prefixOk&&c.prefix&&Dt()&&!v)return void(yield function(e){return u(this,null,function*(){if(Dt()&&(Ce.value||(yield h(),Ce.value))&&!_e.value){_e.value=!0;try{const t=yield ke();if(!t)return;const l=`mermaid-partial-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,n=a.isDark?"dark":"light",o=Bt(e),r=Ct(o&&o.trim()?o:e,n);Ce.value&&(Ce.value.style.opacity="0");const i=yield yt(()=>t.render(l,r),{timeoutMs:st.value.render}),u=null==i?void 0:i.svg;Ce.value&&u&&(ye(Ce.value,u),St())}catch(t){}finally{yield h(),Ce.value&&(Ce.value.style.opacity="1"),_e.value=!1}}})}(c.prefix))}catch(v){if("AbortError"===(null==v?void 0:v.name))return}if(ot.value!==n)return;if(at.value)return;const c=tt.value[r];c&&Ce.value&&ye(Ce.value,c)})}function Wt(){mt&&(mt=!1,ht=800,pt=!1,gt&&(gt.abort(),gt=null),vt&&(globalThis.clearTimeout(vt),vt=null),dt&&(ct(dt),dt=null),ft=Date.now())}function Gt(){if(Wt(),rt){try{rt.abort()}catch(e){}rt=null}if(gt){try{gt.abort()}catch(e){}gt=null}Y(),We(),qe=0}function Kt(e=800){mt&&(wt>=12?Wt():(vt&&globalThis.clearTimeout(vt),vt=globalThis.setTimeout(()=>{dt=Ve(()=>u(null,null,function*(){if(!mt)return;if(Re.value||Qe.value)return void Wt();const e=a.isDark?"dark":"light",t=Pe.value;if(!t.trim())return!1===a.loading?void Wt():void Kt(ht);if(wt++,wt>12)Wt();else{gt&>.abort(),gt=new AbortController;try{if((yield jt(t,e,{signal:gt.signal,timeoutMs:st.value.worker}))&&(yield Vt(),Qe.value))return void Wt()}catch(l){}ht=Math.min(Math.floor(1.5*ht),4e3),Kt(ht)}}),{timeout:500})},e)))}function Jt(){mt||Re.value||Qe.value||(mt=!0,ft=0,pt=!0,wt=0,Kt(500))}d(Pt,e=>{Ot.value&&Be.value&&(Be.value.style.transform=e.transform)},{immediate:!0}),d(()=>Pe.value,()=>{Qe.value=!1,tt.value={},Ue(),!Re.value&&de.value&&Jt(),function(){if(!Re.value)return;if(!de.value)return;const e=Pe.value.length;e!==Ne.value&&(Ye.value=!0,Ne.value=e,Ze&&clearTimeout(Ze),Ze=setTimeout(()=>{Ye.value&&Re.value&&Pe.value.trim()&&(Ye.value=!1,qt("preview"))},500))}()}),d(()=>a.isDark,()=>u(null,null,function*(){if(!Qe.value)return;if(at.value)return;const e=a.isDark?"dark":"light",t=tt.value[e];if(t)return void(Ce.value&&ye(Ce.value,t));const l={zoom:Le.value,translateX:$e.value,translateY:ze.value,containerHeight:Ke.value},n=1!==Le.value||0!==$e.value||0!==ze.value;et.value=!0,n&&(Le.value=1,$e.value=0,ze.value=0,yield h()),yield Vt(),n&&(yield h(),Le.value=l.zoom,$e.value=l.translateX,ze.value=l.translateY,Ke.value=l.containerHeight,it.value=l)})),d(()=>Re.value,e=>u(null,null,function*(){if(e)Wt(),Qe.value&&(it.value={zoom:Le.value,translateX:$e.value,translateY:ze.value,containerHeight:Ke.value});else{if(at.value)return;const e=a.isDark?"dark":"light";if(Qe.value&&tt.value[e])return yield h(),Ce.value&&ye(Ce.value,tt.value[e]),Le.value=it.value.zoom,$e.value=it.value.translateX,ze.value=it.value.translateY,void(Ke.value=it.value.containerHeight);if(yield h(),!de.value)return;yield Ut(),Jt()}})),d(()=>a.loading,(e,t)=>u(null,null,function*(){if(!0===t&&!1===e){const e=Pe.value.trim();if(!e)return Gt();const t=a.isDark?"dark":"light",n=e.replace(/\s+/g,"");if(Qe.value&&n===nt.value)return yield h(),Ce.value&&!Ce.value.querySelector("svg")&&tt.value[t]&&ye(Ce.value,tt.value[t]),void Gt();try{yield jt(e,t,{timeoutMs:st.value.worker}),yield Vt(),nt.value=n,at.value=!1,Gt()}catch(l){Gt(),xt(l)}}})),d(Te,e=>{Je&&Je.disconnect(),!e||Qe.value||et.value||(Je=new ResizeObserver(e=>{e&&e.length>0&&!Qe.value&&!et.value&&I(()=>{St(e[0].contentRect.width)})}),Je.observe(e))},{immediate:!0}),g(()=>u(null,null,function*(){yield h(),He.value||(Re.value=!de.value),Se.value&&(Ue(),Ne.value=Pe.value.length)})),d(()=>de.value,e=>{He.value||(Re.value=!e)}),d(()=>Se.value,e=>{e&&(Qe.value||(Ue(),Ne.value=Pe.value.length),a.loading||Qe.value||Ue())},{immediate:!1}),f(()=>{Ze&&clearTimeout(Ze),Je&&Je.disconnect(),rt&&(rt.abort(),rt=null),Y(),Wt(),We()}),d(()=>Me.value,e=>u(null,null,function*(){e?(Wt(),rt&&rt.abort()):Qe.value||(yield h(),Ue(),Re.value||Jt())}),{immediate:!1});const Qt=v(()=>a.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700");return(e,t)=>(w(),p("div",{class:y(["my-4 rounded-lg border overflow-hidden shadow-sm",[a.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":a.loading}]])},[a.showHeader?(w(),p("div",{key:0,class:y(["mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",a.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"])},[e.$slots["header-left"]?(w(),p("div",q,[b(e.$slots,"header-left",{},void 0,!0)])):(w(),p("div",V,[M("img",{src:T("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20width='16'%20height='16'%3e%3cpath%20fill='none'%20stroke='%23ca9ee6'%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M1.5%202.5c0%206%202.25%205.75%204%207%20.83.67%201.17%202%201%204h3c-.17-2%20.17-3.33%201-4%201.75-1.25%204-1%204-7C12%202.5%2010%203%208%207%206%203%204%202.5%201.5%202.5'%20/%3e%3c/svg%3e"),class:"w-4 h-4 my-0",alt:"Mermaid"},null,8,U),M("span",{class:y(["text-sm font-medium font-mono truncate",a.isDark?"text-gray-400":"text-gray-600"])},"Mermaid",2)])),e.$slots["header-center"]?(w(),p("div",W,[b(e.$slots,"header-center",{},void 0,!0)])):a.showModeToggle&&de.value?(w(),p("div",{key:3,class:y(["flex items-center gap-x-1 rounded-md p-0.5",a.isDark?"bg-gray-700":"bg-gray-100"])},[M("button",{class:y(["px-2.5 py-1 text-xs rounded transition-colors",[Re.value?a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"]]),onClick:t[0]||(t[0]=()=>It("preview")),onMouseenter:t[1]||(t[1]=e=>bt(e,T(xe)("common.preview")||"Preview")),onFocus:t[2]||(t[2]=e=>bt(e,T(xe)("common.preview")||"Preview")),onMouseleave:Mt,onBlur:Mt},[M("div",G,[t[21]||(t[21]=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:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),M("circle",{cx:"12",cy:"12",r:"3"})])],-1)),M("span",null,C(T(xe)("common.preview")||"Preview"),1)])],34),M("button",{class:y(["px-2.5 py-1 text-xs rounded transition-colors",[Re.value?a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"]]),onClick:t[3]||(t[3]=()=>It("source")),onMouseenter:t[4]||(t[4]=e=>bt(e,T(xe)("common.source")||"Source")),onFocus:t[5]||(t[5]=e=>bt(e,T(xe)("common.source")||"Source")),onMouseleave:Mt,onBlur:Mt},[M("div",K,[t[22]||(t[22]=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:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),M("span",null,C(T(xe)("common.source")||"Source"),1)])],34)],2)):x("",!0),e.$slots["header-right"]?(w(),p("div",J,[b(e.$slots,"header-right",{},void 0,!0)])):(w(),p("div",Q,[a.showCollapseButton?(w(),p("button",{key:0,class:y(Qt.value),"aria-pressed":Me.value,onClick:t[6]||(t[6]=e=>Me.value=!Me.value),onMouseenter:t[7]||(t[7]=e=>bt(e,Me.value?T(xe)("common.expand")||"Expand":T(xe)("common.collapse")||"Collapse")),onFocus:t[8]||(t[8]=e=>bt(e,Me.value?T(xe)("common.expand")||"Expand":T(xe)("common.collapse")||"Collapse")),onMouseleave:Mt,onBlur:Mt},[(w(),p("svg",{style:D({rotate:Me.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[23]||(t[23]=[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],42,ee)):x("",!0),a.showCopyButton?(w(),p("button",{key:1,class:y(Qt.value),onClick:Nt,onMouseenter:t[9]||(t[9]=e=>Tt(e)),onFocus:t[10]||(t[10]=e=>Tt(e)),onMouseleave:Mt,onBlur:Mt},[be.value?(w(),p("svg",le,[...t[25]||(t[25]=[M("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(w(),p("svg",te,[...t[24]||(t[24]=[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)])]))],34)):x("",!0),a.showExportButton&&de.value?(w(),p("button",{key:2,class:y(`${Qt.value} ${Et.value?"opacity-50 cursor-not-allowed":""}`),disabled:Et.value,onClick:Yt,onMouseenter:t[11]||(t[11]=e=>bt(e,T(xe)("common.export")||"Export")),onFocus:t[12]||(t[12]=e=>bt(e,T(xe)("common.export")||"Export")),onMouseleave:Mt,onBlur:Mt},[...t[26]||(t[26]=[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:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),M("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,ne)):x("",!0),a.showFullscreenButton&&de.value?(w(),p("button",{key:3,class:y(`${Qt.value} ${Et.value?"opacity-50 cursor-not-allowed":""}`),disabled:Et.value,onClick:Zt,onMouseenter:t[13]||(t[13]=e=>bt(e,Ot.value?T(xe)("common.minimize")||"Minimize":T(xe)("common.open")||"Open")),onFocus:t[14]||(t[14]=e=>bt(e,Ot.value?T(xe)("common.minimize")||"Minimize":T(xe)("common.open")||"Open")),onMouseleave:Mt,onBlur:Mt},[Ot.value?(w(),p("svg",ae,[...t[28]||(t[28]=[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)])])):(w(),p("svg",re,[...t[27]||(t[27]=[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)])]))],42,oe)):x("",!0)]))],2)):x("",!0),k(M("div",{ref_key:"modeContainerRef",ref:Oe},[Re.value?(w(),p("div",{key:0,class:y(["p-4",a.isDark?"bg-gray-900":"bg-gray-50"])},[M("pre",{class:y(["text-sm font-mono whitespace-pre-wrap",a.isDark?"text-gray-300":"text-gray-700"])},C(Pe.value),3)],2)):(w(),p("div",ie,[a.showZoomControls?(w(),p("div",ue,[M("div",se,[M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:zt,onMouseenter:t[15]||(t[15]=e=>bt(e,T(xe)("common.zoomIn")||"Zoom in")),onFocus:t[16]||(t[16]=e=>bt(e,T(xe)("common.zoomIn")||"Zoom in")),onMouseleave:Mt,onBlur:Mt},[...t[29]||(t[29]=[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("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],34),M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:At,onMouseenter:t[17]||(t[17]=e=>bt(e,T(xe)("common.zoomOut")||"Zoom out")),onFocus:t[18]||(t[18]=e=>bt(e,T(xe)("common.zoomOut")||"Zoom out")),onMouseleave:Mt,onBlur:Mt},[...t[30]||(t[30]=[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("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],34),M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Ft,onMouseenter:t[19]||(t[19]=e=>bt(e,T(xe)("common.resetZoom")||"Reset zoom")),onFocus:t[20]||(t[20]=e=>bt(e,T(xe)("common.resetZoom")||"Reset zoom")),onMouseleave:Mt,onBlur:Mt},C(Math.round(100*Le.value))+"% ",35)])])):x("",!0),M("div",j({ref_key:"mermaidContainer",ref:Te,class:["min-h-[360px] relative transition-all duration-100 overflow-hidden block",a.isDark?"bg-gray-900":"bg-gray-50"],style:{height:Ke.value}},E(ut.value,!0),{onMousedown:Rt,onMousemove:Ht,onMouseup:_t,onMouseleave:_t,onTouchstartPassive:Rt,onTouchmovePassive:Ht,onTouchendPassive:_t}),[M("div",{"data-mermaid-wrapper":"",class:y(["absolute inset-0 cursor-grab",{"cursor-grabbing":Ae.value}]),style:D(Pt.value)},[M("div",{ref_key:"mermaidContent",ref:Ce,class:"_mermaid w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],16),(w(),B(S,{to:"body"},[M("div",ce,[O(P,{name:"mermaid-dialog",appear:""},{default:L(()=>[Ot.value?(w(),p("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:$($t,["self"])},[M("div",{class:y(["dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",a.isDark?"bg-gray-900":"bg-white"])},[M("div",ve,[M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:zt},[...t[31]||(t[31]=[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("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],2),M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:At},[...t[32]||(t[32]=[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("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],2),M("button",{class:y(["p-2 text-xs rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Ft},C(Math.round(100*Le.value))+"% ",3),M("button",{class:y(["inline-flex items-center justify-center p-2 rounded transition-colors",[a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:$t},[...t[33]||(t[33]=[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:"M18 6L6 18M6 6l12 12"})],-1)])],2)]),M("div",j({ref_key:"modalContent",ref:De,class:"w-full h-full flex items-center justify-center p-4 overflow-hidden"},E(ut.value,!0),{onMousedown:Rt,onMousemove:Ht,onMouseup:_t,onMouseleave:_t,onTouchstartPassive:Rt,onTouchmovePassive:Ht,onTouchendPassive:_t}),null,16)],2)])):x("",!0)]),_:1})])]))]))],512),[[z,!Me.value]])],2))}}),[["__scopeId","data-v-2ff46cc8"]]);de.install=e=>{e.component(de.__name,de)};export{de as default};
|
package/dist/index7.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,o=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,r=(o,t,n)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,l=(e,l)=>{for(var i in l||(l={}))t.call(l,i)&&r(e,i,l[i]);if(o)for(var i of o(l))n.call(l,i)&&r(e,i,l[i]);return e},i=(e,o,t)=>new Promise((n,r)=>{var l=e=>{try{a(t.next(e))}catch(o){r(o)}},i=e=>{try{a(t.throw(e))}catch(o){r(o)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(l,i);a((t=t.apply(e,o)).next())});import{defineComponent as a,ref as u,computed as s,watch as c,nextTick as d,onMounted as v,onBeforeUnmount as p,createElementBlock as m,openBlock as f,normalizeClass as g,createCommentVNode as y,withDirectives as h,createElementVNode as w,unref as x,toDisplayString as b,normalizeStyle as k,vShow as B}from"vue";import{u as D,s as C,h as M,m as E,_ as A}from"./exports.js";const T={key:0,class:"d2-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)"}},j={class:"flex items-center gap-x-2"},O=["aria-label"],F={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},H={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},I=["aria-label"],N=["aria-pressed"],L={key:0,class:"d2-source px-4 py-4"},P={class:"d2-code"},R={key:0,class:"d2-error mt-2 text-xs"},S={key:1},_={key:0,class:"d2-source px-4 py-4"},U={class:"d2-code"},X={key:0,class:"d2-error mt-2 text-xs"},Y=["innerHTML"],q={key:0,class:"d2-error px-4 pb-3 text-xs"},$=/* @__PURE__ */A(/* @__PURE__ */a({__name:"D2BlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(e){const o=e,{t}=D(),n=u(!1),r=u(!1),a=u(!1),A=u(!1),$=u(null),z=u(!1),V=u(""),G=u(0),J=u(null),K=u(null),Q=s(()=>{var e;return null!=(e=o.node.code)?e:""}),W=s(()=>a.value||!A.value||!V.value),Z=s(()=>!!V.value),ee=s(()=>{if(K.value)return{minHeight:`${K.value}px`}}),oe=s(()=>{if(o.maxHeight)return{maxHeight:"number"==typeof o.maxHeight?`${o.maxHeight}px`:String(o.maxHeight)}}),te="undefined"!=typeof window;let ne=null,re=!1,le=!1,ie=0,ae=null,ue=!1,se=null;const ce={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function de(e){return!e||e.disabled}function ve(e,t,n="top"){if(de(e.currentTarget))return;const r=e,l=null!=(null==r?void 0:r.clientX)&&null!=(null==r?void 0:r.clientY)?{x:r.clientX,y:r.clientY}:void 0;C(e.currentTarget,t,n,!1,l,o.isDark)}function pe(){M()}function me(e){if(de(e.currentTarget))return;const r=n.value?t("common.copied")||"Copied":t("common.copy")||"Copy",l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;C(e.currentTarget,r,"top",!1,i,o.isDark)}function fe(){return i(this,null,function*(){try{const e=Q.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),n.value=!0,setTimeout(()=>{n.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ge(){r.value=!r.value}function ye(e){a.value="source"===e}const he=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],we=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function xe(e){if(!e)return"";const o=e.trim();return we.test(o)?o:""}function be(){V.value=""}function ke(){return i(this,null,function*(){var e,t,n,r,u;if(!te||le)return;if(o.loading&&!o.progressiveRender)return;const s=Q.value;if(!s)return be(),void($.value=null);const c=++G.value;z.value=!0,$.value=null;try{const d=yield function(){return i(this,null,function*(){if(ne)return ne;const e=yield E();if(!e)return null;if("function"==typeof e){const o=new e;return o&&"function"==typeof o.compile?ne=o:"function"==typeof e.compile&&(ne=e),ne}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(ne=new e.D2,ne):("function"==typeof e.compile&&(ne=e),ne)})}();if(!d)return A.value=!1,a.value=!0,be(),void($.value="D2 is not available.");if("function"!=typeof d.compile||"function"!=typeof d.render)throw new TypeError("D2 instance is missing compile/render methods.");A.value=!0;const v=yield d.compile(s);if(c!==G.value)return;const p=null!=(e=null==v?void 0:v.diagram)?e:v,m=null!=(n=null!=(t=null==v?void 0:v.renderOptions)?t:null==v?void 0:v.options)?n:{},f=null!=(r=o.themeId)?r:m.themeID,g=null!=(u=o.darkThemeId)?u:m.darkThemeID,y=l({},m);if(y.themeID=o.isDark&&null!=g?g:f,y.darkThemeID=null,y.darkThemeOverrides=null,o.isDark){const e=m.themeOverrides&&"object"==typeof m.themeOverrides?m.themeOverrides:null;y.themeOverrides=l(l({},ce),e||{})}const h=yield d.render(p,y);if(c!==G.value)return;const w=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(h);if(!w)throw new Error("D2 render returned empty output.");!function(e){const o=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const o=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),t=(new DOMParser).parseFromString(o,"image/svg+xml").documentElement;if(!t||"svg"!==t.nodeName.toLowerCase())return"";const n=t;return function(e){const o=/* @__PURE__ */new Set(["script"]),t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){if(o.has(n.tagName.toLowerCase())){n.remove();continue}const e=Array.from(n.attributes);for(const o of e){const e=o.name;if(/^on/i.test(e))n.removeAttribute(e);else{if("style"===e&&o.value){const t=o.value;if(he.some(e=>e.test(t))){n.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&o.value){const t=xe(o.value);if(!t){n.removeAttribute(e);continue}t!==o.value&&n.setAttribute(e,t)}}}}}(n),n.outerHTML}(e);V.value=o||""}(w),o.loading&&(a.value=!1),$.value=null}catch(d){if(c!==G.value)return;const e=(null==d?void 0:d.message)?String(d.message):"D2 render failed.";o.loading||($.value=e),e.includes("@terrastruct/d2")&&(A.value=!1,a.value=!0)}finally{c===G.value&&(z.value=!1,ue&&(ue=!1,Be()))}})}function Be(e=!1){if(re)return;if(!te)return;if(le)return;if(z.value)return void(ue=!0);const t=Math.max(120,Number(o.progressiveIntervalMs)||0),n=Date.now()-ie;if(!e&&n<t)return ue=!0,void(null==ae&&(ae=window.setTimeout(()=>{ae=null,ue&&(ue=!1,Be(!0))},Math.max(0,t-n))));re=!0;const r=()=>{re=!1,ie=Date.now(),ke()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)}function De(){if(V.value)try{const e=new Blob([V.value],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(e);if("undefined"!=typeof document){const e=document.createElement("a");e.href=o,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(o)}catch(e){console.error("Failed to export SVG:",e)}}function Ce(){const e=J.value;if(!e)return;const o=e.getBoundingClientRect().height;o>0&&(K.value=o)}return c(()=>[o.node.code,o.loading,o.isDark],()=>{Be()},{immediate:!0}),c(()=>o.loading,(e,o)=>{o&&!e&&Be(!0)}),c(()=>[W.value,V.value,Q.value],()=>{d(()=>{Ce()})}),v(()=>{Be(),d(()=>{Ce()}),"undefined"!=typeof ResizeObserver&&(se=new ResizeObserver(()=>{Ce()}),J.value&&se.observe(J.value))}),p(()=>{le=!0,null!=ae&&(clearTimeout(ae),ae=null),null==se||se.disconnect(),se=null}),(e,l)=>(f(),m("div",{class:g(["d2-block-container my-4 rounded-lg border overflow-hidden shadow-sm",o.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"])},[o.showHeader?(f(),m("div",T,[l[16]||(l[16]=w("div",{class:"flex items-center gap-x-2"},[w("span",{class:"text-sm font-medium font-mono"},"D2")],-1)),w("div",j,[o.showModeToggle?(f(),m("div",{key:0,class:g(["flex items-center gap-x-1 rounded-md p-0.5",o.isDark?"bg-gray-700":"bg-gray-100"])},[w("button",{type:"button",class:g(["mode-btn px-2 py-1 text-xs rounded",a.value?"":"is-active"]),onClick:l[0]||(l[0]=e=>ye("preview")),onMouseenter:l[1]||(l[1]=e=>ve(e,x(t)("common.preview")||"Preview")),onFocus:l[2]||(l[2]=e=>ve(e,x(t)("common.preview")||"Preview")),onMouseleave:pe,onBlur:pe},b(x(t)("common.preview")||"Preview"),35),w("button",{type:"button",class:g(["mode-btn px-2 py-1 text-xs rounded",a.value?"is-active":""]),onClick:l[3]||(l[3]=e=>ye("source")),onMouseenter:l[4]||(l[4]=e=>ve(e,x(t)("common.source")||"Source")),onFocus:l[5]||(l[5]=e=>ve(e,x(t)("common.source")||"Source")),onMouseleave:pe,onBlur:pe},b(x(t)("common.source")||"Source"),35)],2)):y("",!0),o.showCopyButton?(f(),m("button",{key:1,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":n.value?x(t)("common.copied")||"Copied":x(t)("common.copy")||"Copy",onClick:fe,onMouseenter:l[6]||(l[6]=e=>me(e)),onFocus:l[7]||(l[7]=e=>me(e)),onMouseleave:pe,onBlur:pe},[n.value?(f(),m("svg",H,[...l[13]||(l[13]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(f(),m("svg",F,[...l[12]||(l[12]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("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,O)):y("",!0),o.showExportButton&&V.value?(f(),m("button",{key:2,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":x(t)("common.export")||"Export",onClick:De,onMouseenter:l[8]||(l[8]=e=>ve(e,x(t)("common.export")||"Export")),onFocus:l[9]||(l[9]=e=>ve(e,x(t)("common.export")||"Export")),onMouseleave:pe,onBlur:pe},[...l[14]||(l[14]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,I)):y("",!0),o.showCollapseButton?(f(),m("button",{key:3,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":r.value,onClick:ge,onMouseenter:l[10]||(l[10]=e=>ve(e,r.value?x(t)("common.expand")||"Expand":x(t)("common.collapse")||"Collapse")),onFocus:l[11]||(l[11]=e=>ve(e,r.value?x(t)("common.expand")||"Expand":x(t)("common.collapse")||"Collapse")),onMouseleave:pe,onBlur:pe},[(f(),m("svg",{style:k({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...l[15]||(l[15]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,N)):y("",!0)])])):y("",!0),h(w("div",{ref_key:"bodyRef",ref:J,class:"d2-block-body",style:k(ee.value)},[o.loading&&!Z.value?(f(),m("div",L,[w("pre",P,[w("code",null,b(Q.value),1)]),$.value?(f(),m("p",R,b($.value),1)):y("",!0)])):(f(),m("div",S,[W.value?(f(),m("div",_,[w("pre",U,[w("code",null,b(Q.value),1)]),$.value?(f(),m("p",X,b($.value),1)):y("",!0)])):(f(),m("div",{key:1,class:"d2-render",style:k(oe.value)},[w("div",{class:"d2-svg",innerHTML:V.value},null,8,Y),$.value?(f(),m("p",q,b($.value),1)):y("",!0)],4))]))],4),[[B,!r.value]])],2))}}),[["__scopeId","data-v-f9232822"]]);$.install=e=>{e.component($.__name,$)};export{$ as default};
|
|
1
|
+
var e=Object.defineProperty,o=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,r=(o,t,n)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,l=(e,l)=>{for(var i in l||(l={}))t.call(l,i)&&r(e,i,l[i]);if(o)for(var i of o(l))n.call(l,i)&&r(e,i,l[i]);return e},i=(e,o,t)=>new Promise((n,r)=>{var l=e=>{try{a(t.next(e))}catch(o){r(o)}},i=e=>{try{a(t.throw(e))}catch(o){r(o)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(l,i);a((t=t.apply(e,o)).next())});import{defineComponent as a,ref as u,computed as s,watch as c,nextTick as d,onMounted as v,onBeforeUnmount as p,createElementBlock as m,openBlock as f,normalizeClass as g,createCommentVNode as y,withDirectives as h,createElementVNode as w,unref as x,toDisplayString as b,normalizeStyle as k,vShow as B}from"vue";import{u as D,s as C,h as M,o as E,_ as A}from"./exports.js";const T={key:0,class:"d2-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)"}},j={class:"flex items-center gap-x-2"},O=["aria-label"],F={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},H={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},I=["aria-label"],N=["aria-pressed"],L={key:0,class:"d2-source px-4 py-4"},P={class:"d2-code"},R={key:0,class:"d2-error mt-2 text-xs"},S={key:1},_={key:0,class:"d2-source px-4 py-4"},U={class:"d2-code"},X={key:0,class:"d2-error mt-2 text-xs"},Y=["innerHTML"],q={key:0,class:"d2-error px-4 pb-3 text-xs"},$=/* @__PURE__ */A(/* @__PURE__ */a({__name:"D2BlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(e){const o=e,{t}=D(),n=u(!1),r=u(!1),a=u(!1),A=u(!1),$=u(null),z=u(!1),V=u(""),G=u(0),J=u(null),K=u(null),Q=s(()=>{var e;return null!=(e=o.node.code)?e:""}),W=s(()=>a.value||!A.value||!V.value),Z=s(()=>!!V.value),ee=s(()=>{if(K.value)return{minHeight:`${K.value}px`}}),oe=s(()=>{if(o.maxHeight)return{maxHeight:"number"==typeof o.maxHeight?`${o.maxHeight}px`:String(o.maxHeight)}}),te="undefined"!=typeof window;let ne=null,re=!1,le=!1,ie=0,ae=null,ue=!1,se=null;const ce={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function de(e){return!e||e.disabled}function ve(e,t,n="top"){if(de(e.currentTarget))return;const r=e,l=null!=(null==r?void 0:r.clientX)&&null!=(null==r?void 0:r.clientY)?{x:r.clientX,y:r.clientY}:void 0;C(e.currentTarget,t,n,!1,l,o.isDark)}function pe(){M()}function me(e){if(de(e.currentTarget))return;const r=n.value?t("common.copied")||"Copied":t("common.copy")||"Copy",l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;C(e.currentTarget,r,"top",!1,i,o.isDark)}function fe(){return i(this,null,function*(){try{const e=Q.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),n.value=!0,setTimeout(()=>{n.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ge(){r.value=!r.value}function ye(e){a.value="source"===e}const he=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],we=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function xe(e){if(!e)return"";const o=e.trim();return we.test(o)?o:""}function be(){V.value=""}function ke(){return i(this,null,function*(){var e,t,n,r,u;if(!te||le)return;if(o.loading&&!o.progressiveRender)return;const s=Q.value;if(!s)return be(),void($.value=null);const c=++G.value;z.value=!0,$.value=null;try{const d=yield function(){return i(this,null,function*(){if(ne)return ne;const e=yield E();if(!e)return null;if("function"==typeof e){const o=new e;return o&&"function"==typeof o.compile?ne=o:"function"==typeof e.compile&&(ne=e),ne}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(ne=new e.D2,ne):("function"==typeof e.compile&&(ne=e),ne)})}();if(!d)return A.value=!1,a.value=!0,be(),void($.value="D2 is not available.");if("function"!=typeof d.compile||"function"!=typeof d.render)throw new TypeError("D2 instance is missing compile/render methods.");A.value=!0;const v=yield d.compile(s);if(c!==G.value)return;const p=null!=(e=null==v?void 0:v.diagram)?e:v,m=null!=(n=null!=(t=null==v?void 0:v.renderOptions)?t:null==v?void 0:v.options)?n:{},f=null!=(r=o.themeId)?r:m.themeID,g=null!=(u=o.darkThemeId)?u:m.darkThemeID,y=l({},m);if(y.themeID=o.isDark&&null!=g?g:f,y.darkThemeID=null,y.darkThemeOverrides=null,o.isDark){const e=m.themeOverrides&&"object"==typeof m.themeOverrides?m.themeOverrides:null;y.themeOverrides=l(l({},ce),e||{})}const h=yield d.render(p,y);if(c!==G.value)return;const w=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(h);if(!w)throw new Error("D2 render returned empty output.");!function(e){const o=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const o=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),t=(new DOMParser).parseFromString(o,"image/svg+xml").documentElement;if(!t||"svg"!==t.nodeName.toLowerCase())return"";const n=t;return function(e){const o=/* @__PURE__ */new Set(["script"]),t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){if(o.has(n.tagName.toLowerCase())){n.remove();continue}const e=Array.from(n.attributes);for(const o of e){const e=o.name;if(/^on/i.test(e))n.removeAttribute(e);else{if("style"===e&&o.value){const t=o.value;if(he.some(e=>e.test(t))){n.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&o.value){const t=xe(o.value);if(!t){n.removeAttribute(e);continue}t!==o.value&&n.setAttribute(e,t)}}}}}(n),n.outerHTML}(e);V.value=o||""}(w),o.loading&&(a.value=!1),$.value=null}catch(d){if(c!==G.value)return;const e=(null==d?void 0:d.message)?String(d.message):"D2 render failed.";o.loading||($.value=e),e.includes("@terrastruct/d2")&&(A.value=!1,a.value=!0)}finally{c===G.value&&(z.value=!1,ue&&(ue=!1,Be()))}})}function Be(e=!1){if(re)return;if(!te)return;if(le)return;if(z.value)return void(ue=!0);const t=Math.max(120,Number(o.progressiveIntervalMs)||0),n=Date.now()-ie;if(!e&&n<t)return ue=!0,void(null==ae&&(ae=window.setTimeout(()=>{ae=null,ue&&(ue=!1,Be(!0))},Math.max(0,t-n))));re=!0;const r=()=>{re=!1,ie=Date.now(),ke()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)}function De(){if(V.value)try{const e=new Blob([V.value],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(e);if("undefined"!=typeof document){const e=document.createElement("a");e.href=o,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(o)}catch(e){console.error("Failed to export SVG:",e)}}function Ce(){const e=J.value;if(!e)return;const o=e.getBoundingClientRect().height;o>0&&(K.value=o)}return c(()=>[o.node.code,o.loading,o.isDark],()=>{Be()},{immediate:!0}),c(()=>o.loading,(e,o)=>{o&&!e&&Be(!0)}),c(()=>[W.value,V.value,Q.value],()=>{d(()=>{Ce()})}),v(()=>{Be(),d(()=>{Ce()}),"undefined"!=typeof ResizeObserver&&(se=new ResizeObserver(()=>{Ce()}),J.value&&se.observe(J.value))}),p(()=>{le=!0,null!=ae&&(clearTimeout(ae),ae=null),null==se||se.disconnect(),se=null}),(e,l)=>(f(),m("div",{class:g(["d2-block-container my-4 rounded-lg border overflow-hidden shadow-sm",o.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"])},[o.showHeader?(f(),m("div",T,[l[16]||(l[16]=w("div",{class:"flex items-center gap-x-2"},[w("span",{class:"text-sm font-medium font-mono"},"D2")],-1)),w("div",j,[o.showModeToggle?(f(),m("div",{key:0,class:g(["flex items-center gap-x-1 rounded-md p-0.5",o.isDark?"bg-gray-700":"bg-gray-100"])},[w("button",{type:"button",class:g(["mode-btn px-2 py-1 text-xs rounded",a.value?"":"is-active"]),onClick:l[0]||(l[0]=e=>ye("preview")),onMouseenter:l[1]||(l[1]=e=>ve(e,x(t)("common.preview")||"Preview")),onFocus:l[2]||(l[2]=e=>ve(e,x(t)("common.preview")||"Preview")),onMouseleave:pe,onBlur:pe},b(x(t)("common.preview")||"Preview"),35),w("button",{type:"button",class:g(["mode-btn px-2 py-1 text-xs rounded",a.value?"is-active":""]),onClick:l[3]||(l[3]=e=>ye("source")),onMouseenter:l[4]||(l[4]=e=>ve(e,x(t)("common.source")||"Source")),onFocus:l[5]||(l[5]=e=>ve(e,x(t)("common.source")||"Source")),onMouseleave:pe,onBlur:pe},b(x(t)("common.source")||"Source"),35)],2)):y("",!0),o.showCopyButton?(f(),m("button",{key:1,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":n.value?x(t)("common.copied")||"Copied":x(t)("common.copy")||"Copy",onClick:fe,onMouseenter:l[6]||(l[6]=e=>me(e)),onFocus:l[7]||(l[7]=e=>me(e)),onMouseleave:pe,onBlur:pe},[n.value?(f(),m("svg",H,[...l[13]||(l[13]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(f(),m("svg",F,[...l[12]||(l[12]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("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,O)):y("",!0),o.showExportButton&&V.value?(f(),m("button",{key:2,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":x(t)("common.export")||"Export",onClick:De,onMouseenter:l[8]||(l[8]=e=>ve(e,x(t)("common.export")||"Export")),onFocus:l[9]||(l[9]=e=>ve(e,x(t)("common.export")||"Export")),onMouseleave:pe,onBlur:pe},[...l[14]||(l[14]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,I)):y("",!0),o.showCollapseButton?(f(),m("button",{key:3,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":r.value,onClick:ge,onMouseenter:l[10]||(l[10]=e=>ve(e,r.value?x(t)("common.expand")||"Expand":x(t)("common.collapse")||"Collapse")),onFocus:l[11]||(l[11]=e=>ve(e,r.value?x(t)("common.expand")||"Expand":x(t)("common.collapse")||"Collapse")),onMouseleave:pe,onBlur:pe},[(f(),m("svg",{style:k({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...l[15]||(l[15]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,N)):y("",!0)])])):y("",!0),h(w("div",{ref_key:"bodyRef",ref:J,class:"d2-block-body",style:k(ee.value)},[o.loading&&!Z.value?(f(),m("div",L,[w("pre",P,[w("code",null,b(Q.value),1)]),$.value?(f(),m("p",R,b($.value),1)):y("",!0)])):(f(),m("div",S,[W.value?(f(),m("div",_,[w("pre",U,[w("code",null,b(Q.value),1)]),$.value?(f(),m("p",X,b($.value),1)):y("",!0)])):(f(),m("div",{key:1,class:"d2-render",style:k(oe.value)},[w("div",{class:"d2-svg",innerHTML:V.value},null,8,Y),$.value?(f(),m("p",q,b($.value),1)):y("",!0)],4))]))],4),[[B,!r.value]])],2))}}),[["__scopeId","data-v-f9232822"]]);$.install=e=>{e.component($.__name,$)};export{$ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16">\x3c!-- Icon from VSCode Icons by Roberto Huertas - https://github.com/vscode-icons/vscode-icons/blob/master/LICENSE --\x3e<defs><linearGradient id="SVGMV3iTbAN" x1="185.455" x2="181.955" y1="1601.641" y2="1630.224" gradientTransform="translate(-62.523 -666.646)scale(.427)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient><linearGradient id="SVGniw2Mvsa" x1="176.136" x2="172.636" y1="1600.5" y2="1629.083" href="#SVGMV3iTbAN"/></defs><path fill="#b03931" d="m3.978 15.462l-.009-6.953a.59.59 0 0 1 .531-.562h.076l6.074-.009a15.7 15.7 0 0 1 6.067.95a8.9 8.9 0 0 1 2.244 1.359a4.47 4.47 0 0 1 2.946-1.083a4.11 4.11 0 0 1 4.276 3.92A4.11 4.11 0 0 1 21.907 17c-.089 0-.177-.008-.265-.012a7 7 0 0 1-.232.953a85 85 0 0 1 8.59 2.6V2H2v13.4q.992.02 1.978.062m22.8-7.944a1.32 1.32 0 0 1 1.374 1.259a1.379 1.379 0 0 1-2.747 0a1.32 1.32 0 0 1 1.375-1.26Z"/><path fill="#b03931" d="M17.861 15.787a4.11 4.11 0 0 0-1.748-3.458a5.8 5.8 0 0 0-1.508-.822a7.4 7.4 0 0 0-1.629-.438a22 22 0 0 0-2.588-.1H7.769l.006 4.737a89 89 0 0 1 9.91 1.408a5 5 0 0 0 .176-1.327m3.132 3.192a7.9 7.9 0 0 1-2.128 2.582a9.7 9.7 0 0 1-3.256 1.71a11.6 11.6 0 0 1-1.971.472h-.015a32 32 0 0 1-3.326.111l-5.625.022a.616.616 0 0 1-.686-.681l-.01-7.734Q2.992 15.42 2 15.4V30h28v-9.456a85 85 0 0 0-8.59-2.6a7 7 0 0 1-.417 1.035"/><path fill="url(#SVGMV3iTbAN)" d="M20.993 18.979a7.9 7.9 0 0 1-2.128 2.582a9.7 9.7 0 0 1-3.256 1.71a11.6 11.6 0 0 1-1.971.472h-.015a32 32 0 0 1-3.326.111l-5.625.022a.616.616 0 0 1-.686-.681l-.01-7.734Q2.992 15.42 2 15.4V30h28v-9.456a85 85 0 0 0-8.59-2.6a7 7 0 0 1-.417 1.035" opacity=".3"/><path fill="#b03931" d="M10.477 20.835a16 16 0 0 0 2.877-.2a7.6 7.6 0 0 0 1.628-.5a5.6 5.6 0 0 0 1.187-.748a4.46 4.46 0 0 0 1.518-2.271a89 89 0 0 0-9.91-1.408l.006 5.133Z"/><path fill="url(#SVGniw2Mvsa)" d="M10.477 20.835a16 16 0 0 0 2.877-.2a7.6 7.6 0 0 0 1.628-.5a5.6 5.6 0 0 0 1.187-.748a4.46 4.46 0 0 0 1.518-2.271a89 89 0 0 0-9.91-1.408l.006 5.133Z" opacity=".3"/><path fill="#fff" d="M20.383 11.746a7 7 0 0 1 1.36 4.148a6.6 6.6 0 0 1-.1 1.1c.088 0 .176.012.265.012a4.11 4.11 0 0 0 4.276-3.92a4.11 4.11 0 0 0-4.276-3.92a4.47 4.47 0 0 0-2.946 1.083a8 8 0 0 1 1.421 1.497"/><ellipse cx="26.78" cy="8.777" fill="#fff" rx="1.374" ry="1.259"/><path fill="#fff" d="m4.673 23.877l5.625-.022a32 32 0 0 0 3.326-.111h.015a11.5 11.5 0 0 0 1.971-.472a9.7 9.7 0 0 0 3.256-1.71a7.9 7.9 0 0 0 2.128-2.582a7 7 0 0 0 .417-1.034a7 7 0 0 0 .332-2.051a7 7 0 0 0-1.36-4.148a8 8 0 0 0-1.421-1.5a8.9 8.9 0 0 0-2.244-1.359a15.7 15.7 0 0 0-6.067-.95l-6.074.009h-.076a.59.59 0 0 0-.532.562l.009 6.952l.01 7.734a.616.616 0 0 0 .685.682m3.1-12.908h2.619a22 22 0 0 1 2.588.1a7.4 7.4 0 0 1 1.629.438a5.8 5.8 0 0 1 1.508.822a4.12 4.12 0 0 1 1.748 3.458a5 5 0 0 1-.175 1.327a4.46 4.46 0 0 1-1.518 2.271a5.6 5.6 0 0 1-1.187.748a7.7 7.7 0 0 1-1.628.5a16 16 0 0 1-2.877.2H7.786L7.78 15.7Z"/></svg>',n={ada:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16">\x3c!-- Icon from VSCode Icons by Roberto Huertas - https://github.com/vscode-icons/vscode-icons/blob/master/LICENSE --\x3e<path fill="#0f23c3" d="M24.554 20.075c.209.27 1.356.961 1.37 1.246a7 7 0 0 0-1.4-.324a17 17 0 0 1-1.412-.48a9.2 9.2 0 0 1-2.375-1.3A3.15 3.15 0 0 1 19.3 16.75a1.72 1.72 0 0 1 1.767-1.822a3.6 3.6 0 0 1 1.593.321c.146.066 1.31.606 1.256.809a5.5 5.5 0 0 0-1.41-.112c-.649.244-.4.828-.168 1.311a8 8 0 0 0 1.078 1.554c.164.194.884 1.271 1.138 1.264"/><path fill="#1a1978" d="M24.141 16.276c.128-.59.819-1.384 1.344-.773a4.2 4.2 0 0 1 .578 1.918c.12.656.2 1.327.261 1.982c.038.379.34 1.794.123 2.075a23 23 0 0 1-2.922-2.838a3.76 3.76 0 0 1-.925-1.7c-.1-1.073.879-.73 1.541-.664"/><path fill="#0f23c3" d="M26.3 17.781c.141-.732-.406-2.592-1.067-2.949a.06.06 0 0 0 .044-.007c-.156-.444-1.359 1.116-1.228 1.174c-.316-.138.774-1.984.988-2.16c.7-.578 1.372-.086 1.845.543a6.04 6.04 0 0 1 .733 4.434a4.5 4.5 0 0 1-.421 1.312c-.1.22-.45 1.1-.682 1.174a14.8 14.8 0 0 0-.212-3.521"/><path fill="#d2d2d2" d="M3.687 8.4c.179-.188-.041-1.527.324-1.548c.262-.015.553 1.741.627 1.968a9.2 9.2 0 0 0 1.127 2.329a7.53 7.53 0 0 0 4.016 2.978a4.55 4.55 0 0 0 2.366.2c.931-.208 1.82-.577 2.757-.765c1.35-.27 3.342-.352 4.438.647c.7.641.376.76.043 1.421a2.44 2.44 0 0 0 .178 2.562c.235.342 1.033.827.675 1.094c-.567.424-1.277-.452-1.636-.776c-1.4-1.264-2.711-1.313-4.492-1.074a9 9 0 0 1-4.883-.708A9.47 9.47 0 0 1 3.687 8.4M19.941 30a3.6 3.6 0 0 1-2.325-.817c.469-.092 1.021.025 1.508-.044a9.7 9.7 0 0 0 1.754-.43a10.5 10.5 0 0 0 3.022-1.554a6.55 6.55 0 0 0 2.757-5.214c.149-.088.316 1.034.319 1.091a5.8 5.8 0 0 1-.19 1.727a6.9 6.9 0 0 1-1.423 2.774A7.3 7.3 0 0 1 19.941 30"/><path fill="#d2d2d2" d="M18.962 19.109a5.8 5.8 0 0 1-2.05.859a13.4 13.4 0 0 1-2.224.549a8.86 8.86 0 0 1-4.435-.51a9.94 9.94 0 0 1-3.849-2.4c-.352-.367-2.104-2.417-1.548-3.05c.248-.282.875.846 1 .992a5 5 0 0 0 1.357 1.11a10.9 10.9 0 0 0 4.035 1.456a6.7 6.7 0 0 0 2.34-.094a13 13 0 0 1 1.694-.485a4 4 0 0 1 2.113.457c.344.17 1.523.743 1.567 1.116m9.351-4.031a19.3 19.3 0 0 1-.453 3.774c-.176-.242.016-1.47 0-1.792a6 6 0 0 0-.384-2.087a4.9 4.9 0 0 0-1.376-1.661a15 15 0 0 1-1.27-1.536c-1.837-2.382-3.245-5.211-2.9-8.3c.034-.308.069-1.448.411-1.445c.152 0 .266 1.561.29 1.718a12.5 12.5 0 0 0 1.224 4.116c.67 1.222 1.947 2.023 2.825 3.1a6.58 6.58 0 0 1 1.633 4.113M15.7 26.935a10.85 10.85 0 0 0 6.436-.687a6.94 6.94 0 0 0 4.278-4.418c.319.2-.048 1.529-.128 1.781a5.7 5.7 0 0 1-1.01 1.813a8.9 8.9 0 0 1-3.257 2.514c-1.703.772-5.662 1.652-6.319-1.003"/><path fill="#d2d2d2" d="M19.151 19.376c.367 2.107-2.957 3.124-4.478 3.213c-1.859.11-4.929-.292-6.06-2.031c-.673-1.035.781-.09 1.188.058a8.7 8.7 0 0 0 3.06.5a11.6 11.6 0 0 0 3.305-.5a14 14 0 0 0 1.533-.576c.301-.132 1.124-.691 1.452-.664m4.991 4.084c.4-.945-1.883-1.578-2.445-1.858a4.9 4.9 0 0 1-1.315-.867c-.181-.181-.872-.92-.807-1.219a5 5 0 0 1 1.087-.175a6 6 0 0 1 .855.588a10 10 0 0 0 .964.5a16 16 0 0 0 2.119.771c.308.09 1.549.208 1.727.428c-.04.296-1.97 2.021-2.185 1.832"/><path fill="#d2d2d2" d="M26.1 22.172c.265.43-1.08 1.831-1.363 2.105a9.3 9.3 0 0 1-2.566 1.728a7.8 7.8 0 0 1-2.56.753c-.679.058-1.966-.124-2.141-.979a7 7 0 0 1 1.177-.086c.462-.059.921-.149 1.376-.246a13 13 0 0 0 2.184-.645a11.5 11.5 0 0 0 2.084-1.11a11 11 0 0 0 1.078-.822c.105-.089.617-.702.731-.698m-7.342-10.207c-.1-1.308 2.612-1.3 3.271-1.092a5.98 5.98 0 0 1 2.982 2.475c-1.082.8-2.449.094-3.3-.654a4.3 4.3 0 0 0-1.481-1.029c-.809-.265-.818.094-1.472.3"/><path fill="#d2d2d2" d="M25.783 13.341c-.444-.029-.316.071-.647-.212c-.358-.307-.614-.795-.945-1.141c-.534-.558-1.242-.895-1.723-1.485a7.27 7.27 0 0 1-1.624-4.848c.018-1.489.407.187.551.675a12.3 12.3 0 0 0 1.126 2.708a46 46 0 0 0 3.4 4.321c-.039.002-.097-.021-.138-.018m-5.715 1.415c.033-.625-.911-.792-1.211-1.42c-.164-.343-.211-.569.029-.7c.082-.045.383.012.5-.02c.271-.076.335-.273.581-.4a1.193 1.193 0 0 1 1.633 1.021a1.82 1.82 0 0 1-1.532 1.519"/><path fill="#d2d2d2" d="M20.5 14.745a1.93 1.93 0 0 0 1.323-1.7c.524.139.928.658 1.521.771a2.6 2.6 0 0 0 1.029-.017c.207-.045.54-.274.721-.259c-.033.163-.464.546-.565.717a4.2 4.2 0 0 0-.388.9c-.229.741-.061.739-.709.311a4.3 4.3 0 0 0-1.957-.72c-.266-.026-.881.019-.975-.003m-.595 5.989a2.01 2.01 0 0 1-1.4 1.712c-.205.091-2.018.733-2.032.348c-.007-.2 1.624-.954 1.809-1.11a3.4 3.4 0 0 0 .867-1.071c.055-.112.232-.925.271-.943c.224-.106.488.93.485 1.064m-8.532-8.202a10.6 10.6 0 0 1 3.71-.914a10.3 10.3 0 0 1 1.865.024c.366.039 1.469.054 1.74.343a.255.255 0 0 1-.273.173c-.037.077.251.371.3.425c-.034.034-1.445-.4-1.572-.424a10.6 10.6 0 0 0-2.282-.134a16 16 0 0 0-1.841.194a6.2 6.2 0 0 1-1.647.313m11.139-1.801a1.89 1.89 0 0 1-1.517-.6c-.247-.349-.737-1.692-.385-2.021c.209-.2.384.662.484.846a11 11 0 0 0 1.418 1.775m5.276 8.469a19 19 0 0 1-.749 3.313c-.173-.077-.275-.778-.562-.95a4.1 4.1 0 0 0 .76-1.154c.152-.302.303-1.046.551-1.209m-7.807-7.357c-.132.268-.932 1.1-1.118.481c-.107-.356.876-.841 1.118-.481m-.747.45c.228.006.012-.248.012-.266c-.001-.043-.368.266-.012.266"/></svg>',applescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round" d="M14.4561802 11.3673353C13.0276218 14.1261537 11.8858593 15.5 10.8437759 15.5 10.3588459 15.5 9.88231005 15.3491298 9.41749082 15.0543006 8.74000639 14.6241577 7.8668418 14.6059458 7.17068967 15.0074382 6.60881451 15.3319356 6.07177167 15.5 5.56305868 15.5 4.02887542 15.5 1.5 10.9491129 1.5 8.45090396 1.5 5.78581061 2.95006811 3.551507 5.15647301 3.551507 6.19383481 3.551507 7.09007204 4.20001691 7.84308619 4.497206 8.16210316 4.62512517 8.52255587 4.61592787 8.83410596 4.47192 9.44477141 4.18872223 10.2497236 3.551507 11.2503615 3.551507 12.4715175 3.551507 13.5338865 4.33779342 14.4184071 5.47479877 14.5532906 5.64778615 14.5172013 5.89341518 14.3377895 6.02349446 13.3500923 6.736546 12.8746057 7.53893969 12.8746057 8.45090396 12.8746057 9.36404821 13.3502672 10.1652619 14.3377895 10.8793249 14.4946576 10.992887 14.5445377 11.1984946 14.4561802 11.3673353ZM8.5 3C8.5 3 8.3468635 1.3936039 10 1" />\n</svg>\n',assembly:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <rect width="8" height="13.001" x="4" y="1.499" fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round" rx="2.286" ry="2.286" />\n <path fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round" d="M 4,4.500025 H 1.5 M 4,7.9999993 H 1.5 M 4,11.499973 H 1.5 m 13,-6.999948 H 12 m 2.5,3.4999743 H 12 m 2.5,3.4999737 H 12" />\n</svg>\n',clojure:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#a6d189" d="M14.17 10.03A6.5 6.5 0 011.81 6.02" />\n <path stroke="#8caaee" d="M1.87 5.85A6.5 6.5 0 0114.22 9.9" />\n <path stroke="#a6d189" d="M6.36 4.9a3.5 3.5 0 103.41 6.12" />\n <path stroke="#8caaee" d="M9.77 11.02a3.5 3.5 0 00-3.03-6.29" />\n <path stroke="#c6d0f5" d="M8 7.5s-1.66 2.48-1.5 3.65" />\n <path stroke="#c6d0f5" d="M1.81 6.02C2.47 5 3.83 4.49 5 4.46c4.06 0 3 5.56 5.03 6.86 1.21.52 3.5-.21 4.15-1.32" />\n </g>\n</svg>\n',cobol:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M6.74 2.24c.32-1.32 2.2-1.32 2.52 0a1.3 1.3 0 001.93.8c1.15-.7 2.48.62 1.77 1.77a1.3 1.3 0 00.8 1.93c1.32.32 1.32 2.2 0 2.52a1.3 1.3 0 00-.8 1.93c.7 1.15-.62 2.48-1.77 1.77a1.3 1.3 0 00-1.93.8c-.32 1.32-2.2 1.32-2.52 0a1.3 1.3 0 00-1.93-.8c-1.15.7-2.48-.62-1.77-1.77a1.3 1.3 0 00-.8-1.93c-1.32-.32-1.32-2.2 0-2.52a1.3 1.3 0 00.8-1.93c-.7-1.15.62-2.48 1.77-1.77a1.3 1.3 0 001.93-.8M10 6.5a2.5 2.5 0 100 3" />\n</svg>\n',crystal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round" d="m 15.4712,10.050637 -5.433601,5.433968 c -0.015,0.01505 -0.04554,0.01505 -0.09055,0.01505 L 2.536327,13.517264 c -0.015,0 -0.04501,-0.01505 -0.06055,-0.06072 L 0.50026325,6.0396501 a 0.21432208,0.21495127 0 0 1 0.015,-0.090817 L 5.9483283,0.5154023 c 0.015,-0.0150465 0.04501,-0.0150465 0.09055,-0.0150465 l 7.4101857,1.997972 c 0.015,0 0.04501,0.015046 0.06055,0.060724 l 1.977121,7.4158186 c 0.03001,0.03063 0.01608,0.060724 -0.01554,0.07577 M 8.2121063,4.1480782 0.93801425,6.1154197 q -0.0225,0 0,0.04514 L 6.2655263,11.50371 c 0.015,0.01505 0.015,0 0.04501,0 l 1.962119,-7.2803988 c -0.03054,-0.075233 -0.06055,-0.075233 -0.06055,-0.075233" />\n</svg>\n',d:a,dart:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round">\n <path d="M7 14.5h4.5v-3h3V7L9.17 1.64c-.28-.29-.8-.47-1.17-.29L3.5 3.5 1.35 8c-.18.37 0 .88.3 1.17z" />\n <path d="M3.5 11V3.5H11m-7.5 0 8 8" />\n </g>\n</svg>\n',dlang:a,dockerfile:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M.5 8.5H11l.75-.5a5.35 5.35 0 010-3.5c1 .6 1 1.88 1.74 2 .77-.09 1.23.01 2 .52 0 0-.97 1.77-2.5 1.98-1.93 3.65-4.5 5.5-6.98 5.5C0 14.5.5 8.5.5 8.5m1 0v-2m0 0h8m-6 2v-4m0 0h4m-2-2h2m-2 6v-6m2 6v-6m2 6v-2" />\n</svg>\n',elixir:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M8.03 14.5C5 14.5 3.5 12.49 3.5 10.01c0-2.82 2.25-7.02 4.62-8.48a.24.24 0 01.24 0c.08.04.12.12.11.2-.13 1.25.22 2.5.98 3.54.3.43.63.8 1.02 1.27.54.66.94 1.03 1.52 2.08l.01.02c.33.56.5 1.2.5 1.84 0 2.03-1.69 4.02-4.47 4.02" />\n</svg>\n',erlang:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round">\n <path d="M6.5 5.5c0-1.25 1-2 2-2s2 .75 2 2z" />\n <path d="M13.5 13c.47-.57 1.12-1.24 1.5-2l-2.25-1.25c-.74 1.36-1.76 2.75-3.25 2.75-2.1 0-3-2.3-3-5h8c.05-1.61-.31-3.45-1-4.5M3 13c-1.08-1.3-1.5-3-1.5-5S2.1 4.24 3 3" />\n </g>\n</svg>\n',fortran:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M7.5 14.5v-1l-1-1v-3h2l1 2h1v-6h-1l-1 2h-2v-4h5l1 3h1v-5h-11v1l1 1v9l-1 1.25v.75z" />\n</svg>\n',groovy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round">\n <path d="M11.68 5.38c.4.19.54.68 1.53 3.25 1 2.57-.92 4.07-.92 4.07s-6.73 2.47-6.73 1.63c-.18-.92-1.92-2.08-1.92-2.08s-.52-.63.06-.75c5.89-1.27 6.96-.61 7.3-2" />\n <path d="M7.38 10.63C2.62 10.88 2.48 8.08 2.5 8 3.6 4.6 9.24.91 10.8 1.58 14.07 3.04 9.2 8.96 7 8.5c-4.02-.83 1.5-4 1.5-4" />\n </g>\n</svg>\n',haskell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M12.5 4.5h3m-1.5 3h1.5m-10 6 2.5-5-2.5-5H8l5.6 10h-2.53l-1.52-2.92L8 13.5zm-5 0 2.5-5-2.5-5H3l2.5 5-2.5 5z" />\n</svg>\n',julia:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#a6d189" d="M10.5 5a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0" />\n <path stroke="#e78284" d="M6.5 11a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0" />\n <path stroke="#ca9ee6" d="M14.5 11a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0" />\n </g>\n</svg>\n',lisp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round">\n <path d="M.5 5.06v6.07C.5 12.41.82 13 2.27 13h5.6c1.04 0 1.63-.51 1.63-1.62 0-.85-.2-1.88-1.5-1.88h-.36C6.4 9.5 6 8.77 6 7.75 6 6.81 6.8 6 7.49 6h2.68" />\n <path d="M3.5 10.5V4.99C3.5 3.89 3.62 3 5 3h9c.97 0 1.5.99 1.5 1.63.12 1.55-.98 1.62-2.1 2.16-.58.26-1.4.52-1.4.98V11" />\n </g>\n</svg>\n',lua:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#c6d0f5" d="M10.5 7A1.5 1.5 0 019 8.5 1.5 1.5 0 017.5 7 1.5 1.5 0 019 5.5 1.5 1.5 0 0110.5 7" />\n <path stroke="#8caaee" d="M7 2.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13m7-2a1.5 1.5 0 100 3 1.5 1.5 0 000-3" />\n </g>\n</svg>\n',matlab:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#85c1dc" d="M4 11 .5 8.5 5 7q.78-1.77 1.89-1.89c.74-.07 1.94-1.28 3.61-3.61M5 7l1.5 1.5" />\n <path stroke="#ef9f76" d="m15.5 12.5-5-11C8.5 6.83 6.33 10 4 11c1.67-.33 2.67.83 3 3.5 3.5-1.5 3.5-3.5 5-4s1.5 1.5 3.5 2" />\n </g>\n</svg>\n',nim:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M1 7 .5 4.5l1.01.67c.28-.27.47-.48 1.18-.85l.56-1.82L4.5 3.84c.77-.18 1.53-.36 2.4-.33L8 1.5l1.1 2.01c.87-.03 1.63.15 2.4.33l1.25-1.34.56 1.82c.7.37.9.58 1.18.85l1.01-.67L15 7m-1.5 1C13 6.5 11 5.5 8 5.5S3 6.5 2.5 8m11.5.75L13.5 8l-1 1.5-1.5.5-3-1.5L5 10l-1.5-.5-1-1.5-.5.75L1 7l1.25 3.75C3 12.75 6 13.5 8 13.5s5-.75 5.75-2.75L15 7z" />\n</svg>\n',objectivec:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16">\x3c!-- Icon from VSCode Icons by Roberto Huertas - https://github.com/vscode-icons/vscode-icons/blob/master/LICENSE --\x3e<path fill="#c2c2c2" d="M11.29 15.976a8.9 8.9 0 0 0 1.039 4.557a4.82 4.82 0 0 0 5.579 2.13a3.79 3.79 0 0 0 2.734-3.181c.095-.535.1-.54.1-.54c1.537.222 4.014.582 5.55.8l-.1.389A9.96 9.96 0 0 1 23.8 24.9a8.35 8.35 0 0 1-4.747 2.378a12.93 12.93 0 0 1-7.322-.725a8.98 8.98 0 0 1-5.106-5.524A14.35 14.35 0 0 1 6.642 10.9a9.32 9.32 0 0 1 7.929-6.24a11.8 11.8 0 0 1 5.9.491a8.47 8.47 0 0 1 5.456 6.1c.083.311.1.369.1.369c-1.709.311-3.821.705-5.518 1.075c-.323-1.695-1.122-3.029-2.831-3.445a4.656 4.656 0 0 0-5.853 3.158a9 9 0 0 0-.341 1.273a11 11 0 0 0-.194 2.295"/><path fill="#c2c2c2" d="M2.033 30V2h5.934v2.227H4.723v23.546h3.244V30zm27.934-.001h-5.934v-2.228h3.244V4.226h-3.244V1.999h5.934z"/></svg>',objectivecpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16">\x3c!-- Icon from VSCode Icons by Roberto Huertas - https://github.com/vscode-icons/vscode-icons/blob/master/LICENSE --\x3e<path fill="#c2c2c2" d="M19.5 24.833a11.24 11.24 0 0 1-5.13 1.009a8.37 8.37 0 0 1-6.492-2.576A9.75 9.75 0 0 1 5.512 16.4a10.4 10.4 0 0 1 2.659-7.406a9.02 9.02 0 0 1 6.9-2.841a12.2 12.2 0 0 1 4.43.7v4.129a7.5 7.5 0 0 0-4.108-1.142a5.28 5.28 0 0 0-4.075 1.685A6.48 6.48 0 0 0 9.766 16.1a6.37 6.37 0 0 0 1.464 4.4a5.02 5.02 0 0 0 3.941 1.639a8.03 8.03 0 0 0 4.329-1.223Z"/><path fill="#c2c2c2" d="M16.572 15.081V13.24h1.841v1.841h1.84v1.84h-1.84v1.841h-1.841v-1.841h-1.839V15.08zm6.44 0V13.24h1.841v1.841h1.84v1.84h-1.84v1.841h-1.841v-1.841h-1.839V15.08zM2.035 30V2.001h5.933v2.227H4.725v23.545h3.243V30z"/><path fill="#c2c2c2" d="M29.965 29.999h-5.933v-2.228h3.243V4.227h-3.243V2h5.933z"/></svg>',ocaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1.5 8V3c0-.83.67-1.5 1.5-1.5h10c.83 0 1.5.67 1.5 1.5v10c0 .83-.67 1.5-1.5 1.5H9" />\n <path d="m1.5 8 1.14-2.3q.09-.21.36-.24a.8.8 0 01.44.13c.18.12.23.53.28.64.06.1.64 1.23.85 1.23.2 0 .71-1.47.71-1.47s.37-.49.72-.49.55.32.67.49c.12.16.24 1.76.46 2.01s1.32.87 1.67.73c.34-.13.53-.4.63-.73.1-.34-.14-.75 0-1a1.1 1.1 0 011.02-.55c.56.03 2.05.56 2.05 1.05q0 .75-1.5.75c-.48 1.33.28 2.22-3 2.25l1 4" />\n <path d="m4.5 14.5 1.5-4 1 4zm-2 0 1.5-4-1.5-.5-1 1.54V14l1 .49Z" />\n </g>\n</svg>\n',perl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M12.5 14.5v-3.34c-1-.66-1-1.35-1-2.66m-3 1 .02 2.53.98 2.47m-4-5v5m9 0V9.23s.17-1.73-1-1.73c0-1.5-.5-6-2.5-6S8.75 4.25 8.75 4.25A3.67 3.67 0 006.5 7.12v-3.5c0-.63-.85-1.32-1.5-1.32-.92 0-1.33.59-1.5 1.2H2.25c-.42.11-.75.59-.75 1 0 .5.28 1 .75 1h1.22l.02 3c.01.75.51 1 1.51 1h4.5" />\n</svg>\n',prolog:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="M4.5 13.5c-.33.33-.5.67-.5 1s.17.67.5 1c.17-.67.5-1 1-1s.83.33 1 1c.33-.33.5-.83.5-1.5h2c0 .67.17 1.17.5 1.5.17-.67.5-1 1-1s.83.33 1 1c.33-.33.5-.67.5-1s-.17-.67-.5-1l1-1 1.25 1.25c0-2.75 1-2.75 1-5.75a7.1 7.1 0 00-2-5.25A3.64 3.64 0 0113 .5c-1.17 0-2 .42-2.5 1.25A3.08 3.08 0 008 .5c-1 0-1.83.42-2.5 1.25C5 .92 4.17.5 3 .5c.5.83.58 1.58.25 2.25a7.1 7.1 0 00-2 5.25c0 3 1 3 1 5.75L3.5 12.5zm6-5a2 2 0 100-4 2 2 0 000 4m-5 0a2 2 0 100-4 2 2 0 000 4M7 8l1 2.5L9 8m1.5-1.5" />\n</svg>\n',r:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#838ba7" d="M13.5 9.5c.63-.7 1-1.54 1-2.43 0-2.52-2.91-4.57-6.5-4.57S1.5 4.55 1.5 7.07c0 1.9 1.65 3.53 4 4.22" />\n <path stroke="#8caaee" d="M10.5 9.5c.4 0 .86.34 1 .7l1 3.3m-5 0v-8h3.05c.95 0 1.95 1 1.95 2s-1 2-1.95 2H7.5Z" />\n </g>\n</svg>\n',scala:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="m2.5 2.48 11-.98v3.04l-11 1zm0 5 11-.98v3.04l-11 1zm0 5 11-.98v3.04l-11 1z" />\n</svg>\n',solidity:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="m3 11.5 2.5 4 2.5-4 2.5 4 2.5-4-2.5-4-2.5 4m2.5 4h-5m7.5-4H3m10-7-2.5-4-2.5 4-2.5-4-2.5 4 2.5 4 2.5-4M5.5.5h5M3 4.5h10" />\n</svg>\n',svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="m4.54 10 6.92-4m-6.92 4a1.5 1.5 0 10-2.6 1.5 1.5 1.5 0 002.6-1.5M8 4v8m0-8a1.5 1.5 0 100-3 1.5 1.5 0 000 3M4.54 6l6.92 4M4.54 6a1.5 1.5 0 10-2.6-1.5A1.5 1.5 0 004.54 6M8 12a1.5 1.5 0 100 3 1.5 1.5 0 000-3m3.46-2a1.5 1.5 0 102.6 1.5 1.5 1.5 0 00-2.6-1.5m0-4a1.5 1.5 0 102.6-1.5 1.5 1.5 0 00-2.6 1.5" />\n</svg>\n',swift:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="M14.34 10.2c.34-1.08 1.1-5.07-4.45-8.62a.48.48 0 00-.6.07.44.44 0 00-.02.6c.03.02 2.07 2.5 1.34 5.34-1.26-.86-6.24-4.81-6.24-4.81L7.25 7.5 1.9 4.05S5.68 8.7 8 10.45c-1.12.4-3.56.82-6.78-1.18a.48.48 0 00-.58.06.44.44 0 00-.08.56c.11.18 2.7 4.36 8.14 4.36 1.5 0 2.37-.42 3.08-.77.43-.2.77-.37 1.14-.37.93 0 1.54.92 1.54.93.1.14.27.22.44.21a.46.46 0 00.4-.28c.67-1.55-.49-3.2-.96-3.78h0Z" />\n</svg>\n',terraform:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="m1.5 6 8 4.25 4-2.25m-12-2V1.5l8 4.25 4-2.25V8m-4-2.25v8.75M5.53 3.82 5.5 12.5l4 2" />\n</svg>\n',"vb.net":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16">\x3c!-- Icon from VSCode Icons by Roberto Huertas - https://github.com/vscode-icons/vscode-icons/blob/master/LICENSE --\x3e<path fill="#00519a" d="M6.67 7.836L9 18.915l2.336-11.079H16l-4.664 16.328H6.672L2 7.836Zm11.661 0h7.6a4.08 4.08 0 0 1 2.9 1.749a3.8 3.8 0 0 1 .571 2.04a4 4 0 0 1-.571 2.034a4.1 4.1 0 0 1-2.341 1.763a4.1 4.1 0 0 1 2.929 1.756a3.8 3.8 0 0 1 .58 2.1a4.66 4.66 0 0 1-.579 2.546a5.05 5.05 0 0 1-3.5 2.338h-7.589ZM23 14.252h1.166a1.754 1.754 0 0 0 0-3.5H23Zm0 7h1.39a2.047 2.047 0 0 0 0-4.089H23Z"/></svg>'};export{n as EXTENDED_LANGUAGE_ICON_MAP};
|
package/dist/tailwind.ts
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markstream-vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8-beta.1",
|
|
5
5
|
"description": "Vue 3 Markdown renderer optimized for large docs: progressive Mermaid, streaming diff code blocks, and fast real-time preview.",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"require": "./dist/index.js"
|
|
54
54
|
},
|
|
55
55
|
"./index.css": "./dist/index.css",
|
|
56
|
+
"./index.px.css": "./dist/index.px.css",
|
|
56
57
|
"./index.tailwind.css": "./dist/index.tailwind.css",
|
|
57
58
|
"./tailwind": "./dist/tailwind.ts",
|
|
58
59
|
"./workers/katexRenderer.worker": "./dist/workers/katexRenderer.worker.js",
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
},
|
|
105
106
|
"dependencies": {
|
|
106
107
|
"@floating-ui/dom": "^1.7.5",
|
|
107
|
-
"stream-markdown-parser": "0.0.
|
|
108
|
+
"stream-markdown-parser": "0.0.64"
|
|
108
109
|
},
|
|
109
110
|
"devDependencies": {
|
|
110
111
|
"@antfu/eslint-config": "^5.4.1",
|
|
@@ -166,7 +167,9 @@
|
|
|
166
167
|
"play:react:preview": "pnpm run -C playground-react preview",
|
|
167
168
|
"preview": "pnpm run -C playground preview",
|
|
168
169
|
"build:parser": "pnpm run -C packages/markdown-parser build",
|
|
169
|
-
"build": "vite build --mode npm && vite build --config vite.config.tailwind.ts --mode npm && node scripts/copy-tailwind-css.mjs && pnpm run build:dts",
|
|
170
|
+
"build": "vite build --mode npm && vite build --config vite.config.tailwind.ts --mode npm && node scripts/copy-tailwind-css.mjs && node scripts/generate-px-css.mjs && pnpm run build:dts",
|
|
171
|
+
"build:analyze": "ANALYZE=true pnpm build",
|
|
172
|
+
"size:check": "node scripts/check-package-size.mjs",
|
|
170
173
|
"docs:dev": "vitepress dev docs",
|
|
171
174
|
"docs:sync-zh": "node scripts/sync-zh-docs.mjs",
|
|
172
175
|
"docs:check-zh": "node scripts/check-zh-parity.mjs",
|