markstream-vue 2.0.8-beta.0 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index9.js CHANGED
@@ -1 +1 @@
1
- var e=(e,o,n)=>new Promise((t,l)=>{var i=e=>{try{a(n.next(e))}catch(o){l(o)}},r=e=>{try{a(n.throw(e))}catch(o){l(o)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,r);a((n=n.apply(e,o)).next())});import{defineComponent as o,ref as n,useAttrs as t,inject as l,computed as i,watch as r,nextTick as a,onMounted as s,onBeforeUnmount as u,openBlock as c,createElementBlock as d,normalizeClass as v,renderSlot as m,createElementVNode as h,unref as p,toDisplayString as w,createCommentVNode as g,normalizeStyle as f,withDirectives as C,vShow as x,createBlock as k,Teleport as y,createVNode as b,Transition as M,withCtx as B,withModifiers as F}from"vue";import{az as j,aB as H,aC as $,ay as T,ak as P,ac as E,at as z,a9 as L,a1 as S,G as Z}from"./exports.js";import{p as V,e as _,c as I}from"./diagramHeight.js";import{M as X}from"./index2.js";const N=["data-markstream-mode"],Y={key:0,class:"infographic-block-header flex justify-between items-center border-b"},O={key:0},D={key:1,class:"flex items-center gap-x-2 overflow-hidden"},R=["innerHTML"],A={key:2},U={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},G=["disabled"],q={class:"flex items-center gap-x-1"},W={class:"flex items-center gap-x-1"},J={key:4},K={key:5,class:"infographic-header-actions flex items-center"},Q=["aria-pressed"],ee={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:"action-icon"},oe={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:"action-icon"},ne=["disabled"],te=["disabled"],le={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:"action-icon"},ie={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:"action-icon"},re={key:0,class:"infographic-source"},ae={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},se={key:1,class:"relative"},ue={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},ce={class:"flex items-center gap-2 backdrop-blur rounded-lg"},de={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},ve={class:"dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},me={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},he="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",pe=/* @__PURE__ */Z(/* @__PURE__ */o({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(o,{emit:Z}){const pe=o,{t:we}=j(),ge=H(),fe=$(),Ce=T(),xe=n(!1),ke=n(!1),ye=n(),be=n(),Me=n(!0),Be=n(!1),Fe=n(!1),je=n(),He=n(null),$e=n(!1),Te=n(!1),Pe=n(null),Ee=n("undefined"==typeof window||!Ce.value),ze=t(),Le=l(X,null);let Se="";const Ze=i(()=>P(pe,ze));"undefined"!=typeof window&&r([()=>ye.value,Ce],([e,o])=>{var n,t,l;if(null==(n=Pe.value)||n.destroy(),Pe.value=null,!o||Ee.value)return void(Ee.value=!0);if(!e)return void(Ee.value=!1);const i=null!=(l=null!=(t=null==fe?void 0:fe.value.heavyBlockMargin)?t:null==fe?void 0:fe.value.rootMargin)?l:"160px",r=ge(e,{rootMargin:i,allowIdle:!1});Pe.value=r,Ee.value=r.isVisible.value,r.whenVisible.then(()=>{Ee.value=!0})},{immediate:!0});const Ve=i(()=>pe.node.code),_e=i(()=>{var e;return function(e){if("none"===pe.maxHeight)return I(e,void 0,null);const o=V(pe.maxHeight);return I(e,void 0,o)}(null!=(e=V(pe.estimatedPreviewHeightPx))?e:_(Ve.value))}),Ie=n(`${_e.value}px`),Xe=i(()=>null!=V(pe.estimatedPreviewHeightPx));function Ne(){var e;if(!be.value)return;if(Xe.value)return;const o=be.value.scrollHeight;if(o>0){const n=null!=(e=V(function(e){if("none"===pe.maxHeight)return`${e}px`;if(null!=pe.maxHeight){const o=Number.parseFloat(String(pe.maxHeight));if(Number.isFinite(o))return`${Math.min(e,o)}px`}const o=be.value;if(o){const n=getComputedStyle(o).getPropertyValue("--ms-size-code-max-height").trim(),t=Number.parseFloat(n);if(Number.isFinite(t))return`${Math.min(e,t)}px`}return`${Math.min(e,500)}px`}(o)))?e:o;Ie.value=`${Math.max(n,_e.value)}px`}}const Ye=n(1),Oe=n(0),De=n(0),Re=n(!1),Ae=n({x:0,y:0}),Ue=i(()=>Ve.value);function Ge(e){return!e||e.disabled}function qe(e,o,n="top"){if(Ge(e.currentTarget))return;const t=e,l=null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0;z(e.currentTarget,o,n,!1,l,pe.isDark)}function We(){L()}function Je(e){if(Ge(e.currentTarget))return;const o=xe.value?we("common.copied")||"Copied":we("common.copy")||"Copy",n=e,t=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;z(e.currentTarget,o,"top",!1,t,pe.isDark)}function Ke(){return e(this,null,function*(){try{const e=Ve.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),xe.value=!0,setTimeout(()=>{xe.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function Qe(e){("preview"!==e||E())&&(Be.value=!0,Me.value="source"===e)}function eo(){var o;const n=null==(o=be.value)?void 0:o.querySelector("svg");n?function(o){e(this,null,function*(){try{const n=(new XMLSerializer).serializeToString(o),t=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(t);if("undefined"!=typeof document){const o=document.createElement("a");o.href=l,o.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch(e){}URL.revokeObjectURL(l)}}catch(n){console.error("Failed to export SVG:",n)}})}(n):console.error("SVG element not found")}function oo(e){"Escape"===e.key&&Fe.value&&no()}function no(){if(Fe.value=!1,je.value&&(je.value.innerHTML=""),He.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",oo)}catch(e){}}function to(){!function(){if(Fe.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",oo)}catch(e){}a(()=>{if(be.value&&je.value){je.value.innerHTML="";const e=document.createElement("div");e.style.transition="transform 0.1s ease",e.style.transformOrigin="center center",e.style.width="100%",e.style.height="100%",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center";const o=be.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),je.value.appendChild(e),He.value=e,e.style.transform=`translate(${Oe.value}px, ${De.value}px) scale(${Ye.value})`}})}()}function lo(){Ye.value<3&&(Ye.value+=.1)}function io(){Ye.value>.5&&(Ye.value-=.1)}function ro(){Ye.value=1,Oe.value=0,De.value=0}function ao(e){Re.value=!0,e instanceof MouseEvent?Ae.value={x:e.clientX-Oe.value,y:e.clientY-De.value}:Ae.value={x:e.touches[0].clientX-Oe.value,y:e.touches[0].clientY-De.value}}function so(e){if(!Re.value)return;let o,n;e instanceof MouseEvent?(o=e.clientX,n=e.clientY):(o=e.touches[0].clientX,n=e.touches[0].clientY),Oe.value=o-Ae.value.x,De.value=n-Ae.value.y}function uo(){Re.value=!1}let co=null,vo=!1,mo=!1,ho=!1,po=!1,wo=!1,go="",fo=!1,Co=0;function xo(e){return!fo&&e===Co}function ko(o=!1){return e(this,null,function*(){var n,t,l,i,r,s;if(fo||!Ee.value)return;if(!be.value)return;if(vo)return mo=!0,void(ho=ho||o);const u=Ue.value;if(!o&&u===go&&$e.value)return;const c=Ve.value,d=!1===pe.loading,v=++Co;vo=!0,function(){const e=Ze.value;e&&Se!==e&&(Se&&(null==Le||Le.markSettled(Se)),Se=e,null==Le||Le.markPending(e))}();let m=null,h=null;try{const e=yield S();if(!xo(v))return;if(!e)throw new Error("Infographic library failed to load.");const o=be.value;if(!o)return;const i=!0===pe.loading;if(!(u===Ue.value||!d&&i&&Ve.value.startsWith(c)))return;h=Array.from(o.childNodes),m=new e({container:o,width:"100%",height:"100%"});let r="",s=!1;if(null==(n=m.on)||n.call(m,"error",e=>{const o=Array.isArray(e)?e:[e];r=o.map(e=>{var o;return e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?null!=(o=e.message)?o:"":null!=e?e:"")}).filter(Boolean).join("; ")}),null==(t=m.on)||t.call(m,"rendered",()=>{s=!0}),m.render(c),r)throw new Error(r);const p=Array.from(o.childNodes),w=p.length>0&&(p.length!==h.length||p.some((e,o)=>e!==(null==h?void 0:h[o])));if(!s&&!w)throw new Error("Infographic render returned empty output.");null==(l=null==co?void 0:co.destroy)||l.call(co),co=m,m=null,$e.value=!0,Te.value=!1,go=u,a(()=>{xo(v)&&Ne()})}catch(p){if(!xo(v))return;null==(i=null==m?void 0:m.destroy)||i.call(m),m=null,d&&!1===pe.loading&&u===Ue.value?(console.error("Failed to render infographic:",p),null==(r=null==co?void 0:co.destroy)||r.call(co),co=null,$e.value=!1,Te.value=!0,go="",be.value&&(be.value.innerHTML=`<div style="padding: var(--ms-inset-panel-body); color: hsl(var(--ms-destructive))">Failed to render infographic: ${p instanceof Error?p.message:"Unknown error"}</div>`)):h&&be.value&&be.value.replaceChildren(...h)}finally{if(null==(s=null==m?void 0:m.destroy)||s.call(m),vo=!1,xo(v))if(mo){const e=ho;mo=!1,ho=!1,a(()=>{ko(e)})}else!function(){e(this,null,function*(){const e=Se;e&&(Se="",yield a(),function(e=Ze.value){e&&ye.value&&(null==Le||Le.reportHeight(e,ye.value.offsetHeight))}(e),null==Le||Le.markSettled(e))})}()}})}function yo(e=!1){fo||!Ee.value||Me.value||ke.value||(wo=wo||e,po||(po=!0,a(()=>{po=!1;const e=wo;wo=!1,fo||ko(e)})))}r(()=>Ve.value,()=>{yo(!0)}),r(()=>pe.loading,(e,o)=>{o&&!e&&yo(!0)}),r(()=>Me.value,e=>{e||yo(!0)}),r(()=>ke.value,e=>{e||yo()}),r(()=>pe.maxHeight,()=>{a(()=>{Ne()})}),r([()=>pe.estimatedPreviewHeightPx,()=>Ve.value],()=>{$e.value||Me.value||(Ie.value=`${_e.value}px`)}),r(()=>Ee.value,e=>{!e||Me.value||ke.value||yo()}),s(()=>{!Be.value&&E()&&(Me.value=!1),yo()}),u(()=>{var e,o;if(fo=!0,Co+=1,mo=!1,ho=!1,po=!1,wo=!1,null==(e=Pe.value)||e.destroy(),Pe.value=null,function(){const e=Se;e&&(Se="",null==Le||Le.markSettled(e))}(),co&&(null==(o=co.destroy)||o.call(co),co=null),go="","undefined"!=typeof window)try{window.removeEventListener("keydown",oo)}catch(n){}});const bo=i(()=>!E()),Mo=i(()=>Me.value||ke.value),Bo=i(()=>Me.value?"fallback":Te.value?"error":$e.value?"preview":"pending"),Fo=i(()=>({transform:`translate(${Oe.value}px, ${De.value}px) scale(${Ye.value})`}));return r(Fo,e=>{Fe.value&&He.value&&(He.value.style.transform=e.transform)}),(e,o)=>(c(),d("div",{ref_key:"viewportTarget",ref:ye,class:v(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":pe.loading,dark:pe.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":Bo.value},[pe.showHeader?(c(),d("div",Y,[e.$slots["header-left"]?(c(),d("div",O,[m(e.$slots,"header-left",{},void 0,!0)])):(c(),d("div",D,[h("span",{class:"icon-slot action-icon shrink-0",innerHTML:p('<svg width="15.52" height="16" viewBox="0 0 291 300" fill="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.59C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z" fill="#FF6376"></path><path d="M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z" fill="#FFCCCC"></path><path d="M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z" fill="#FF939F"></path><path d="M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z" fill="#FF356A"></path><path d="M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z" fill="#FF6376"></path></g></svg>\n')},null,8,R),o[21]||(o[21]=h("span",{class:"infographic-label font-medium font-mono truncate"},"Infographic",-1))])),e.$slots["header-center"]?(c(),d("div",A,[m(e.$slots,"header-center",{},void 0,!0)])):pe.showModeToggle?(c(),d("div",U,[h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Me.value?"":"is-active",bo.value?"opacity-50 cursor-not-allowed":""]]),disabled:bo.value,onClick:o[0]||(o[0]=()=>Qe("preview")),onMouseenter:o[1]||(o[1]=e=>qe(e,p(we)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>qe(e,p(we)("common.preview")||"Preview")),onMouseleave:We,onBlur:We},[h("div",q,[o[22]||(o[22]=h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("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"}),h("circle",{cx:"12",cy:"12",r:"3"})])],-1)),h("span",null,w(p(we)("common.preview")||"Preview"),1)])],42,G),h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Me.value?"is-active":""]]),onClick:o[3]||(o[3]=()=>Qe("source")),onMouseenter:o[4]||(o[4]=e=>qe(e,p(we)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>qe(e,p(we)("common.source")||"Source")),onMouseleave:We,onBlur:We},[h("div",W,[o[23]||(o[23]=h("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:"action-icon"},[h("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)),h("span",null,w(p(we)("common.source")||"Source"),1)])],34)])):g("",!0),e.$slots["header-right"]?(c(),d("div",J,[m(e.$slots,"header-right",{},void 0,!0)])):(c(),d("div",K,[pe.showCollapseButton?(c(),d("button",{key:0,class:v(he),"aria-pressed":ke.value,onClick:o[6]||(o[6]=e=>ke.value=!ke.value),onMouseenter:o[7]||(o[7]=e=>qe(e,ke.value?p(we)("common.expand")||"Expand":p(we)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>qe(e,ke.value?p(we)("common.expand")||"Expand":p(we)("common.collapse")||"Collapse")),onMouseleave:We,onBlur:We},[(c(),d("svg",{style:f({rotate:ke.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:"action-icon"},[...o[24]||(o[24]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,Q)):g("",!0),pe.showCopyButton?(c(),d("button",{key:1,class:v(he),onClick:Ke,onMouseenter:o[9]||(o[9]=e=>Je(e)),onFocus:o[10]||(o[10]=e=>Je(e)),onMouseleave:We,onBlur:We},[xe.value?(c(),d("svg",oe,[...o[26]||(o[26]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(c(),d("svg",ee,[...o[25]||(o[25]=[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),h("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],32)):g("",!0),pe.showExportButton?(c(),d("button",{key:2,class:v(`${he} ${Mo.value?"opacity-50 cursor-not-allowed":""}`),disabled:Mo.value,onClick:eo,onMouseenter:o[11]||(o[11]=e=>qe(e,p(we)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>qe(e,p(we)("common.export")||"Export")),onMouseleave:We,onBlur:We},[...o[27]||(o[27]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),h("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,ne)):g("",!0),pe.showFullscreenButton?(c(),d("button",{key:3,class:v(`${he} ${Mo.value?"opacity-50 cursor-not-allowed":""}`),disabled:Mo.value,onClick:to,onMouseenter:o[13]||(o[13]=e=>qe(e,Fe.value?p(we)("common.minimize")||"Minimize":p(we)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>qe(e,Fe.value?p(we)("common.minimize")||"Minimize":p(we)("common.open")||"Open")),onMouseleave:We,onBlur:We},[Fe.value?(c(),d("svg",ie,[...o[29]||(o[29]=[h("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)])])):(c(),d("svg",le,[...o[28]||(o[28]=[h("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,te)):g("",!0)]))])):g("",!0),C(h("div",null,[Me.value?(c(),d("div",re,[h("pre",ae,w(Ve.value),1)])):(c(),d("div",se,[pe.showZoomControls?(c(),d("div",ue,[h("div",ce,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:lo,onMouseenter:o[15]||(o[15]=e=>qe(e,p(we)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>qe(e,p(we)("common.zoomIn")||"Zoom in")),onMouseleave:We,onBlur:We},[...o[30]||(o[30]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io,onMouseenter:o[17]||(o[17]=e=>qe(e,p(we)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>qe(e,p(we)("common.zoomOut")||"Zoom out")),onMouseleave:We,onBlur:We},[...o[31]||(o[31]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro,onMouseenter:o[19]||(o[19]=e=>qe(e,p(we)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>qe(e,p(we)("common.resetZoom")||"Reset zoom")),onMouseleave:We,onBlur:We},w(Math.round(100*Ye.value))+"% ",33)])])):g("",!0),h("div",{class:"infographic-preview relative transition-all overflow-hidden block",style:f({height:Ie.value}),onMousedown:ao,onMousemove:so,onMouseup:uo,onMouseleave:uo,onTouchstartPassive:ao,onTouchmovePassive:so,onTouchendPassive:uo},[$e.value||Te.value?g("",!0):(c(),d("pre",de,w(Ve.value),1)),h("div",{class:v(["absolute inset-0 cursor-grab",{"cursor-grabbing":Re.value}]),style:f(Fo.value)},[h("div",{ref_key:"infographicContainer",ref:be,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],36)]))],512),[[x,!ke.value]]),(c(),k(y,{to:"body"},[h("div",{class:v(["markstream-vue",{dark:pe.isDark}])},[b(M,{name:"infographic-dialog",appear:""},{default:B(()=>[Fe.value?(c(),d("div",{key:0,class:"infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:F(no,["self"])},[h("div",ve,[h("div",me,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:lo},[...o[32]||(o[32]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])]),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io},[...o[33]||(o[33]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])]),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro},w(Math.round(100*Ye.value))+"% ",1),h("button",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",onClick:no},[...o[34]||(o[34]=[h("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:"action-icon"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])])]),h("div",{ref_key:"modalContent",ref:je,class:v(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!Re.value,"cursor-grabbing":Re.value}]),onMousedown:ao,onMousemove:so,onMouseup:uo,onMouseleave:uo,onTouchstartPassive:ao,onTouchmovePassive:so,onTouchendPassive:uo},null,34)])])):g("",!0)]),_:1})],2)]))],10,N))}}),[["__scopeId","data-v-d5718026"]]);pe.install=e=>{e.component(pe.__name,pe)};export{pe as default};
1
+ var e=(e,o,n)=>new Promise((t,l)=>{var i=e=>{try{a(n.next(e))}catch(o){l(o)}},r=e=>{try{a(n.throw(e))}catch(o){l(o)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,r);a((n=n.apply(e,o)).next())});import{defineComponent as o,ref as n,useAttrs as t,inject as l,computed as i,watch as r,nextTick as a,onMounted as s,onBeforeUnmount as u,openBlock as c,createElementBlock as d,normalizeClass as v,renderSlot as m,createElementVNode as h,unref as p,toDisplayString as w,createCommentVNode as g,normalizeStyle as f,withDirectives as C,vShow as x,createBlock as k,Teleport as y,createVNode as b,Transition as M,withCtx as B,withModifiers as F}from"vue";import{az as j,aB as H,aC as $,ay as P,ak as T,ac as E,at as z,a9 as L,a1 as S,G as Z}from"./exports.js";import{p as V,e as I,c as _,I as X}from"./diagramHeight.js";import{M as N}from"./index2.js";const Y=["data-markstream-mode"],O={key:0,class:"infographic-block-header flex justify-between items-center border-b"},D={key:0},R={key:1,class:"flex items-center gap-x-2 overflow-hidden"},A=["innerHTML"],U={key:2},G={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},q=["disabled"],W={class:"flex items-center gap-x-1"},J={class:"flex items-center gap-x-1"},K={key:4},Q={key:5,class:"infographic-header-actions flex items-center"},ee=["aria-pressed"],oe={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:"action-icon"},ne={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:"action-icon"},te=["disabled"],le=["disabled"],ie={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:"action-icon"},re={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:"action-icon"},ae={key:0,class:"infographic-source"},se={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},ue={key:1,class:"relative"},ce={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},de={class:"flex items-center gap-2 backdrop-blur rounded-lg"},ve={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},me={class:"dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},he={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},pe="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",we=/* @__PURE__ */Z(/* @__PURE__ */o({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(o,{emit:Z}){const we=o,{t:ge}=j(),fe=H(),Ce=$(),xe=P(),ke=n(!1),ye=n(!1),be=n(),Me=n(),Be=n(!0),Fe=n(!1),je=n(!1),He=n(),$e=n(null),Pe=n(!1),Te=n(!1),Ee=n(null),ze=n("undefined"==typeof window||!xe.value),Le=t(),Se=l(N,null);let Ze="";const Ve=i(()=>T(we,Le));"undefined"!=typeof window&&r([()=>be.value,xe],([e,o])=>{var n,t,l;if(null==(n=Ee.value)||n.destroy(),Ee.value=null,!o||ze.value)return void(ze.value=!0);if(!e)return void(ze.value=!1);const i=null!=(l=null!=(t=null==Ce?void 0:Ce.value.heavyBlockMargin)?t:null==Ce?void 0:Ce.value.rootMargin)?l:"160px",r=fe(e,{rootMargin:i,allowIdle:!1});Ee.value=r,ze.value=r.isVisible.value,r.whenVisible.then(()=>{ze.value=!0})},{immediate:!0});const Ie=i(()=>we.node.code),_e=i(()=>{var e;return function(e){const o=function(){var e;const o=Me.value?getComputedStyle(Me.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=V(o))?e:X}();if("none"===we.maxHeight)return _(e,o,null);const n=V(we.maxHeight);return _(e,o,n)}(null!=(e=V(we.estimatedPreviewHeightPx))?e:I(Ie.value))}),Xe=n(`${_e.value}px`),Ne=i(()=>null!=V(we.estimatedPreviewHeightPx));function Ye(){var e;if(!Me.value)return;if(Ne.value)return;const o=Me.value.scrollHeight;if(o>0){const n=null!=(e=V(function(e){if("none"===we.maxHeight)return`${e}px`;if(null!=we.maxHeight){const o=Number.parseFloat(String(we.maxHeight));if(Number.isFinite(o))return`${Math.min(e,o)}px`}const o=Me.value;if(o){const n=getComputedStyle(o).getPropertyValue("--ms-size-code-max-height").trim(),t=Number.parseFloat(n);if(Number.isFinite(t))return`${Math.min(e,t)}px`}return`${Math.min(e,500)}px`}(o)))?e:o;Xe.value=`${Math.max(n,_e.value)}px`}}const Oe=n(1),De=n(0),Re=n(0),Ae=n(!1),Ue=n({x:0,y:0}),Ge=i(()=>Ie.value);function qe(e){return!e||e.disabled}function We(e,o,n="top"){if(qe(e.currentTarget))return;const t=e,l=null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0;z(e.currentTarget,o,n,!1,l,we.isDark)}function Je(){L()}function Ke(e){if(qe(e.currentTarget))return;const o=ke.value?ge("common.copied")||"Copied":ge("common.copy")||"Copy",n=e,t=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;z(e.currentTarget,o,"top",!1,t,we.isDark)}function Qe(){return e(this,null,function*(){try{const e=Ie.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),ke.value=!0,setTimeout(()=>{ke.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function eo(e){("preview"!==e||E())&&(Fe.value=!0,Be.value="source"===e)}function oo(){var o;const n=null==(o=Me.value)?void 0:o.querySelector("svg");n?function(o){e(this,null,function*(){try{const n=(new XMLSerializer).serializeToString(o),t=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(t);if("undefined"!=typeof document){const o=document.createElement("a");o.href=l,o.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch(e){}URL.revokeObjectURL(l)}}catch(n){console.error("Failed to export SVG:",n)}})}(n):console.error("SVG element not found")}function no(e){"Escape"===e.key&&je.value&&to()}function to(){if(je.value=!1,He.value&&(He.value.innerHTML=""),$e.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",no)}catch(e){}}function lo(){!function(){if(je.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",no)}catch(e){}a(()=>{if(Me.value&&He.value){He.value.innerHTML="";const e=document.createElement("div");e.style.transition="transform 0.1s ease",e.style.transformOrigin="center center",e.style.width="100%",e.style.height="100%",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center";const o=Me.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),He.value.appendChild(e),$e.value=e,e.style.transform=`translate(${De.value}px, ${Re.value}px) scale(${Oe.value})`}})}()}function io(){Oe.value<3&&(Oe.value+=.1)}function ro(){Oe.value>.5&&(Oe.value-=.1)}function ao(){Oe.value=1,De.value=0,Re.value=0}function so(e){Ae.value=!0,e instanceof MouseEvent?Ue.value={x:e.clientX-De.value,y:e.clientY-Re.value}:Ue.value={x:e.touches[0].clientX-De.value,y:e.touches[0].clientY-Re.value}}function uo(e){if(!Ae.value)return;let o,n;e instanceof MouseEvent?(o=e.clientX,n=e.clientY):(o=e.touches[0].clientX,n=e.touches[0].clientY),De.value=o-Ue.value.x,Re.value=n-Ue.value.y}function co(){Ae.value=!1}let vo=null,mo=!1,ho=!1,po=!1,wo=!1,go=!1,fo="",Co=!1,xo=0;function ko(e){return!Co&&e===xo}function yo(o=!1){return e(this,null,function*(){var n,t,l,i,r,s;if(Co||!ze.value)return;if(!Me.value)return;if(mo)return ho=!0,void(po=po||o);const u=Ge.value;if(!o&&u===fo&&Pe.value)return;const c=Ie.value,d=!1===we.loading,v=++xo;mo=!0,function(){const e=Ve.value;e&&Ze!==e&&(Ze&&(null==Se||Se.markSettled(Ze)),Ze=e,null==Se||Se.markPending(e))}();let m=null,h=null;try{const e=yield S();if(!ko(v))return;if(!e)throw new Error("Infographic library failed to load.");const o=Me.value;if(!o)return;const i=!0===we.loading;if(!(u===Ge.value||!d&&i&&Ie.value.startsWith(c)))return;h=Array.from(o.childNodes),m=new e({container:o,width:"100%",height:"100%"});let r="",s=!1;if(null==(n=m.on)||n.call(m,"error",e=>{const o=Array.isArray(e)?e:[e];r=o.map(e=>{var o;return e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?null!=(o=e.message)?o:"":null!=e?e:"")}).filter(Boolean).join("; ")}),null==(t=m.on)||t.call(m,"rendered",()=>{s=!0}),m.render(c),r)throw new Error(r);const p=Array.from(o.childNodes),w=p.length>0&&(p.length!==h.length||p.some((e,o)=>e!==(null==h?void 0:h[o])));if(!s&&!w)throw new Error("Infographic render returned empty output.");null==(l=null==vo?void 0:vo.destroy)||l.call(vo),vo=m,m=null,Pe.value=!0,Te.value=!1,fo=u,a(()=>{ko(v)&&Ye()})}catch(p){if(!ko(v))return;null==(i=null==m?void 0:m.destroy)||i.call(m),m=null,d&&!1===we.loading&&u===Ge.value?(console.error("Failed to render infographic:",p),null==(r=null==vo?void 0:vo.destroy)||r.call(vo),vo=null,Pe.value=!1,Te.value=!0,fo="",Me.value&&(Me.value.innerHTML=`<div style="padding: var(--ms-inset-panel-body); color: hsl(var(--ms-destructive))">Failed to render infographic: ${p instanceof Error?p.message:"Unknown error"}</div>`)):h&&Me.value&&Me.value.replaceChildren(...h)}finally{if(null==(s=null==m?void 0:m.destroy)||s.call(m),mo=!1,ko(v))if(ho){const e=po;ho=!1,po=!1,a(()=>{yo(e)})}else!function(){e(this,null,function*(){const e=Ze;e&&(Ze="",yield a(),function(e=Ve.value){e&&be.value&&(null==Se||Se.reportHeight(e,be.value.offsetHeight))}(e),null==Se||Se.markSettled(e))})}()}})}function bo(e=!1){Co||!ze.value||Be.value||ye.value||(go=go||e,wo||(wo=!0,a(()=>{wo=!1;const e=go;go=!1,Co||yo(e)})))}r(()=>Ie.value,()=>{bo(!0)}),r(()=>we.loading,(e,o)=>{o&&!e&&bo(!0)}),r(()=>Be.value,e=>{e||bo(!0)}),r(()=>ye.value,e=>{e||bo()}),r(()=>we.maxHeight,()=>{a(()=>{Ye()})}),r([()=>we.estimatedPreviewHeightPx,()=>Ie.value],()=>{Pe.value||Be.value||(Xe.value=`${_e.value}px`)}),r(()=>ze.value,e=>{!e||Be.value||ye.value||bo()}),s(()=>{!Fe.value&&E()&&(Be.value=!1),bo()}),u(()=>{var e,o;if(Co=!0,xo+=1,ho=!1,po=!1,wo=!1,go=!1,null==(e=Ee.value)||e.destroy(),Ee.value=null,function(){const e=Ze;e&&(Ze="",null==Se||Se.markSettled(e))}(),vo&&(null==(o=vo.destroy)||o.call(vo),vo=null),fo="","undefined"!=typeof window)try{window.removeEventListener("keydown",no)}catch(n){}});const Mo=i(()=>!E()),Bo=i(()=>Be.value||ye.value),Fo=i(()=>Be.value?"fallback":Te.value?"error":Pe.value?"preview":"pending"),jo=i(()=>({transform:`translate(${De.value}px, ${Re.value}px) scale(${Oe.value})`}));return r(jo,e=>{je.value&&$e.value&&($e.value.style.transform=e.transform)}),(e,o)=>(c(),d("div",{ref_key:"viewportTarget",ref:be,class:v(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":we.loading,dark:we.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":Fo.value},[we.showHeader?(c(),d("div",O,[e.$slots["header-left"]?(c(),d("div",D,[m(e.$slots,"header-left",{},void 0,!0)])):(c(),d("div",R,[h("span",{class:"icon-slot action-icon shrink-0",innerHTML:p('<svg width="15.52" height="16" viewBox="0 0 291 300" fill="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.59C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z" fill="#FF6376"></path><path d="M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z" fill="#FFCCCC"></path><path d="M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z" fill="#FF939F"></path><path d="M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z" fill="#FF356A"></path><path d="M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z" fill="#FF6376"></path></g></svg>\n')},null,8,A),o[21]||(o[21]=h("span",{class:"infographic-label font-medium font-mono truncate"},"Infographic",-1))])),e.$slots["header-center"]?(c(),d("div",U,[m(e.$slots,"header-center",{},void 0,!0)])):we.showModeToggle?(c(),d("div",G,[h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Be.value?"":"is-active",Mo.value?"opacity-50 cursor-not-allowed":""]]),disabled:Mo.value,onClick:o[0]||(o[0]=()=>eo("preview")),onMouseenter:o[1]||(o[1]=e=>We(e,p(ge)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>We(e,p(ge)("common.preview")||"Preview")),onMouseleave:Je,onBlur:Je},[h("div",W,[o[22]||(o[22]=h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("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"}),h("circle",{cx:"12",cy:"12",r:"3"})])],-1)),h("span",null,w(p(ge)("common.preview")||"Preview"),1)])],42,q),h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Be.value?"is-active":""]]),onClick:o[3]||(o[3]=()=>eo("source")),onMouseenter:o[4]||(o[4]=e=>We(e,p(ge)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>We(e,p(ge)("common.source")||"Source")),onMouseleave:Je,onBlur:Je},[h("div",J,[o[23]||(o[23]=h("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:"action-icon"},[h("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)),h("span",null,w(p(ge)("common.source")||"Source"),1)])],34)])):g("",!0),e.$slots["header-right"]?(c(),d("div",K,[m(e.$slots,"header-right",{},void 0,!0)])):(c(),d("div",Q,[we.showCollapseButton?(c(),d("button",{key:0,class:v(pe),"aria-pressed":ye.value,onClick:o[6]||(o[6]=e=>ye.value=!ye.value),onMouseenter:o[7]||(o[7]=e=>We(e,ye.value?p(ge)("common.expand")||"Expand":p(ge)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>We(e,ye.value?p(ge)("common.expand")||"Expand":p(ge)("common.collapse")||"Collapse")),onMouseleave:Je,onBlur:Je},[(c(),d("svg",{style:f({rotate:ye.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:"action-icon"},[...o[24]||(o[24]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ee)):g("",!0),we.showCopyButton?(c(),d("button",{key:1,class:v(pe),onClick:Qe,onMouseenter:o[9]||(o[9]=e=>Ke(e)),onFocus:o[10]||(o[10]=e=>Ke(e)),onMouseleave:Je,onBlur:Je},[ke.value?(c(),d("svg",ne,[...o[26]||(o[26]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(c(),d("svg",oe,[...o[25]||(o[25]=[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),h("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],32)):g("",!0),we.showExportButton?(c(),d("button",{key:2,class:v(`${pe} ${Bo.value?"opacity-50 cursor-not-allowed":""}`),disabled:Bo.value,onClick:oo,onMouseenter:o[11]||(o[11]=e=>We(e,p(ge)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>We(e,p(ge)("common.export")||"Export")),onMouseleave:Je,onBlur:Je},[...o[27]||(o[27]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),h("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,te)):g("",!0),we.showFullscreenButton?(c(),d("button",{key:3,class:v(`${pe} ${Bo.value?"opacity-50 cursor-not-allowed":""}`),disabled:Bo.value,onClick:lo,onMouseenter:o[13]||(o[13]=e=>We(e,je.value?p(ge)("common.minimize")||"Minimize":p(ge)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>We(e,je.value?p(ge)("common.minimize")||"Minimize":p(ge)("common.open")||"Open")),onMouseleave:Je,onBlur:Je},[je.value?(c(),d("svg",re,[...o[29]||(o[29]=[h("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)])])):(c(),d("svg",ie,[...o[28]||(o[28]=[h("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,le)):g("",!0)]))])):g("",!0),C(h("div",null,[Be.value?(c(),d("div",ae,[h("pre",se,w(Ie.value),1)])):(c(),d("div",ue,[we.showZoomControls?(c(),d("div",ce,[h("div",de,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io,onMouseenter:o[15]||(o[15]=e=>We(e,p(ge)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>We(e,p(ge)("common.zoomIn")||"Zoom in")),onMouseleave:Je,onBlur:Je},[...o[30]||(o[30]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro,onMouseenter:o[17]||(o[17]=e=>We(e,p(ge)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>We(e,p(ge)("common.zoomOut")||"Zoom out")),onMouseleave:Je,onBlur:Je},[...o[31]||(o[31]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ao,onMouseenter:o[19]||(o[19]=e=>We(e,p(ge)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>We(e,p(ge)("common.resetZoom")||"Reset zoom")),onMouseleave:Je,onBlur:Je},w(Math.round(100*Oe.value))+"% ",33)])])):g("",!0),h("div",{class:"infographic-preview relative transition-all overflow-hidden block",style:f({height:Xe.value}),onMousedown:so,onMousemove:uo,onMouseup:co,onMouseleave:co,onTouchstartPassive:so,onTouchmovePassive:uo,onTouchendPassive:co},[Pe.value||Te.value?g("",!0):(c(),d("pre",ve,w(Ie.value),1)),h("div",{class:v(["absolute inset-0 cursor-grab",{"cursor-grabbing":Ae.value}]),style:f(jo.value)},[h("div",{ref_key:"infographicContainer",ref:Me,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],36)]))],512),[[x,!ye.value]]),(c(),k(y,{to:"body"},[h("div",{class:v(["markstream-vue",{dark:we.isDark}])},[b(M,{name:"infographic-dialog",appear:""},{default:B(()=>[je.value?(c(),d("div",{key:0,class:"infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:F(to,["self"])},[h("div",me,[h("div",he,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io},[...o[32]||(o[32]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])]),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro},[...o[33]||(o[33]=[h("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:"action-icon"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])]),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ao},w(Math.round(100*Oe.value))+"% ",1),h("button",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",onClick:to},[...o[34]||(o[34]=[h("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:"action-icon"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])])]),h("div",{ref_key:"modalContent",ref:He,class:v(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!Ae.value,"cursor-grabbing":Ae.value}]),onMousedown:so,onMousemove:uo,onMouseup:co,onMouseleave:co,onTouchstartPassive:so,onTouchmovePassive:uo,onTouchendPassive:co},null,34)])])):g("",!0)]),_:1})],2)]))],10,Y))}}),[["__scopeId","data-v-7fa98755"]]);we.install=e=>{e.component(we.__name,we)};export{we as default};
package/dist/tailwind.js CHANGED
Binary file
@@ -1 +1 @@
1
- var n=Object.defineProperty,e=Object.defineProperties,t=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l=(n,e)=>{for(var t in e||(e={}))o.call(e,t)&&s(n,t,e[t]);if(r)for(var t of r(e))a.call(e,t)&&s(n,t,e[t]);return n};function d(n){return JSON.stringify(n)}function i(n){var e;const t=null!=(e=n.mode)?e:"classic",r=n.katexUrl,o=n.mhchemUrl,a=d(l({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},n.renderOptions||{})),s=d(r),i=o?d(o):'""';return"module"===t?`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\nlet loadPromise = null\n\nfunction normalizeKaTeX(mod) {\n const resolved = (mod && mod.default) ? mod.default : mod\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nasync function loadKaTeX() {\n if (katex || katexLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${s})\n katex = normalizeKaTeX(mod) || null\n const mhchemUrl = ${i}\n if (mhchemUrl) {\n try {\n await import(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n }\n catch (e) {\n katexLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n await loadKaTeX()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${a}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart():`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\n\nfunction normalizeKaTeX(val) {\n const resolved = (val && val.default) ? val.default : val\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nfunction loadKaTeXClassic() {\n if (katex || katexLoadError)\n return\n try {\n importScripts(${s})\n const mhchemUrl = ${i}\n if (mhchemUrl) {\n try {\n importScripts(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n katex = normalizeKaTeX(globalThis.katex)\n }\n catch (e) {\n katexLoadError = e\n }\n}\n\nloadKaTeXClassic()\n\nglobalThis.addEventListener('message', (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n if (!katex && !katexLoadError)\n loadKaTeXClassic()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${a}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart()}function c(n){var r,o;const a=i(n);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:a};const s=new Blob([a],{type:"text/javascript"}),d=URL.createObjectURL(s);let c=!1;const m="module"===(null!=(r=n.mode)?r:"classic")?(u=l({},null!=(o=n.workerOptions)?o:{}),e(u,t({type:"module"}))):n.workerOptions;var u;const p=new Worker(d,m);if(n.debug)try{p.postMessage({type:"init",debug:!0})}catch(f){}return{worker:p,dispose:()=>{if(!c){c=!0;try{URL.revokeObjectURL(d)}catch(f){}}},source:a}}export{i as buildKaTeXCDNWorkerSource,c as createKaTeXWorkerFromCDN};
1
+ var n=Object.defineProperty,e=Object.defineProperties,t=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,l=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,s=(n,e)=>{for(var t in e||(e={}))o.call(e,t)&&l(n,t,e[t]);if(r)for(var t of r(e))a.call(e,t)&&l(n,t,e[t]);return n};function i(n){return JSON.stringify(n)}function d(n){var e;const t=null!=(e=n.mode)?e:"classic",r=n.katexUrl,o=n.mhchemUrl,a=i(s({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},n.renderOptions||{})),l=i(r),d=o?i(o):'""';return"module"===t?`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\nlet loadPromise = null\n\nfunction normalizeKaTeX(mod) {\n const resolved = (mod && mod.default) ? mod.default : mod\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nasync function loadKaTeX() {\n if (katex || katexLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${l})\n katex = normalizeKaTeX(mod) || null\n const mhchemUrl = ${d}\n if (mhchemUrl) {\n try {\n await import(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n }\n catch (e) {\n katexLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n await loadKaTeX()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${a}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart():`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\n\nfunction normalizeKaTeX(val) {\n const resolved = (val && val.default) ? val.default : val\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nfunction loadKaTeXClassic() {\n if (katex || katexLoadError)\n return\n try {\n importScripts(${l})\n const mhchemUrl = ${d}\n if (mhchemUrl) {\n try {\n importScripts(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n katex = normalizeKaTeX(globalThis.katex)\n }\n catch (e) {\n katexLoadError = e\n }\n}\n\nloadKaTeXClassic()\n\nglobalThis.addEventListener('message', (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n if (!katex && !katexLoadError)\n loadKaTeXClassic()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${a}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart()}function c(n){var r,o;const a=d(n);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:a};const l=new Blob([a],{type:"text/javascript"}),i=URL.createObjectURL(l);let c=!1;const u=()=>{if(!c){c=!0;try{URL.revokeObjectURL(i)}catch(n){}}},m="module"===(null!=(r=n.mode)?r:"classic")?(p=s({},null!=(o=n.workerOptions)?o:{}),e(p,t({type:"module"}))):n.workerOptions;var p;let f=null;try{f=new Worker(i,m)}finally{u()}if(n.debug)try{f.postMessage({type:"init",debug:!0})}catch(g){}return{worker:f,dispose:u,source:a}}export{d as buildKaTeXCDNWorkerSource,c as createKaTeXWorkerFromCDN};
@@ -1 +1 @@
1
- var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,o=(n,t,i)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i,d=(e,n)=>{for(var t in n||(n={}))r.call(n,t)&&o(e,t,n[t]);if(i)for(var t of i(n))a.call(n,t)&&o(e,t,n[t]);return e};function c(e){return JSON.stringify(e)}function s(e){var n;const t=null!=(n=e.mode)?n:"module",i=c(e.mermaidUrl),r=`\nlet DEBUG = false\nlet mermaid = null\nlet mermaidLoadError = null\n\nfunction normalizeMermaidModule(mod) {\n if (!mod)\n return mod\n const candidate = (mod && mod.default) ? mod.default : mod\n if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))\n return candidate\n if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {\n const api = candidate.mermaidAPI\n return {\n ...candidate,\n render: api.render ? api.render.bind(api) : undefined,\n parse: api.parse ? api.parse.bind(api) : undefined,\n initialize: (opts) => {\n if (typeof candidate.initialize === 'function')\n return candidate.initialize(opts)\n return api.initialize ? api.initialize(opts) : undefined\n },\n }\n }\n if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')\n return mod.mermaid\n return candidate\n}\n\nfunction applyThemeTo(code, theme) {\n const themeValue = theme === 'dark' ? 'dark' : 'default'\n const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`\n const trimmed = (code || '').trimStart()\n if (trimmed.startsWith('%%{'))\n return code\n return themeConfig + code\n}\n\nfunction getMermaidDiagramKind(code) {\n const lines = String(code || '').split(/\\r?\\n/)\n for (const rawLine of lines) {\n const line = rawLine.trim()\n if (!line || line.startsWith('%%'))\n continue\n const match = line.match(/^([A-Z][\\w-]*)\\b/i)\n return (match && match[1] ? match[1].toLowerCase() : '')\n }\n return ''\n}\n\nfunction isEscapedEntityBefore(text, index) {\n return /(?:&#\\d+|#\\d+|&[a-z]+)$/i.test(text.slice(Math.max(0, index - 12), index))\n}\n\nfunction hasSequenceArrow(text) {\n return text.includes('->')\n || text.includes('--\x3e')\n || text.includes('->>')\n || text.includes('--\x3e>')\n || text.includes('-x')\n || text.includes('--x')\n || text.includes('-)')\n || text.includes('--)')\n || text.includes('-+')\n || text.includes('--+')\n}\n\nfunction startsSequenceMessage(text) {\n const segment = text.split(';', 1)[0]\n const colonIndex = segment.indexOf(':')\n return colonIndex > 0 && hasSequenceArrow(segment.slice(0, colonIndex))\n}\n\nfunction startsSequenceStatement(text) {\n const source = text.trimStart()\n return /^(?:accDescr|accTitle|activate|actor|and|alt|autonumber|box|break|critical|create\\s+(?:actor|participant)|deactivate|destroy|else|end|link|links|loop|Note|opt|option|par|participant|properties|rect)\\b/i.test(source)\n || startsSequenceMessage(source)\n}\n\nfunction isSequenceTextLine(line, colonIndex) {\n const prefix = line.slice(0, colonIndex)\n return /^\\s*Note\\b/i.test(prefix) || hasSequenceArrow(prefix)\n}\n\nfunction escapeTextSemicolons(text) {\n let escaped = ''\n let changed = false\n for (let index = 0; index < text.length; index++) {\n const char = text[index]\n if (char !== ';' || isEscapedEntityBefore(text, index)) {\n escaped += char\n continue\n }\n if (startsSequenceStatement(text.slice(index + 1))) {\n escaped += char\n continue\n }\n escaped += '#59;'\n changed = true\n }\n return changed ? escaped : text\n}\n\nfunction escapeSequenceTextSemicolons(code) {\n if (getMermaidDiagramKind(code) !== 'sequencediagram')\n return code\n const parts = String(code || '').split(/(\\r\\n|\\n|\\r)/)\n let changed = false\n for (let index = 0; index < parts.length; index += 2) {\n const line = parts[index]\n if (!line.includes(';'))\n continue\n const colonIndex = line.indexOf(':')\n if (colonIndex === -1 || !isSequenceTextLine(line, colonIndex))\n continue\n const escapedText = escapeTextSemicolons(line.slice(colonIndex + 1))\n if (escapedText !== line.slice(colonIndex + 1)) {\n parts[index] = line.slice(0, colonIndex + 1) + escapedText\n changed = true\n }\n }\n return changed ? parts.join('') : code\n}\n\nfunction findHeaderIndex(lines) {\n const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/\n for (let i = 0; i < lines.length; i++) {\n const l = (lines[i] || '').trim()\n if (!l)\n continue\n if (l.startsWith('%%'))\n continue\n if (headerRe.test(l))\n return i\n }\n return -1\n}\n\nasync function canParse(code, theme) {\n const themed = applyThemeTo(code, theme)\n const anyMermaid = mermaid\n if (anyMermaid && typeof anyMermaid.parse === 'function') {\n try {\n await anyMermaid.parse(themed)\n }\n catch (error) {\n const retryCode = escapeSequenceTextSemicolons(themed)\n if (retryCode === themed)\n throw error\n await anyMermaid.parse(retryCode)\n }\n return true\n }\n throw new Error('mermaid.parse not available in worker')\n}\n\nasync function findLastRenderablePrefix(baseCode, theme) {\n const lines = String(baseCode || '').split('\\n')\n const headerIdx = findHeaderIndex(lines)\n if (headerIdx === -1)\n return null\n const head = lines.slice(0, headerIdx + 1)\n await canParse(head.join('\\n'), theme)\n\n let low = headerIdx + 1\n let high = lines.length\n let lastGood = headerIdx + 1\n let tries = 0\n const MAX_TRIES = 12\n\n while (low <= high && tries < MAX_TRIES) {\n const mid = Math.floor((low + high) / 2)\n const candidate = [...head, ...lines.slice(headerIdx + 1, mid)].join('\\n')\n tries++\n try {\n await canParse(candidate, theme)\n lastGood = mid\n low = mid + 1\n }\n catch {\n high = mid - 1\n }\n }\n\n return [...head, ...lines.slice(headerIdx + 1, lastGood)].join('\\n')\n}\n\nfunction initMermaidOnce() {\n if (!mermaid)\n return\n try {\n if (typeof mermaid.initialize === 'function')\n mermaid.initialize(${c(d({startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}},e.initializeOptions||{}))})\n }\n catch (e) {\n if (DEBUG)\n console.warn('[mermaid-cdn-worker] initialize failed', e)\n }\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const msg = ev.data || {}\n if (msg.type === 'init') {\n DEBUG = !!msg.debug\n if (DEBUG)\n console.debug('[mermaid-cdn-worker] debug enabled')\n return\n }\n\n const id = msg.id\n const action = msg.action\n const payload = msg.payload || {}\n\n if (!mermaid) {\n const errMsg = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'\n globalThis.postMessage({ id, ok: false, error: errMsg })\n return\n }\n\n try {\n if (action === 'canParse') {\n const ok = await canParse(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: ok })\n return\n }\n if (action === 'findPrefix') {\n const res = await findLastRenderablePrefix(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: res })\n return\n }\n globalThis.postMessage({ id, ok: false, error: 'Unknown action' })\n }\n catch (e) {\n globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })\n }\n})\n`.trimStart();return"module"===t?`\n${r}\n\nlet loadPromise = null\nasync function loadMermaid() {\n if (mermaid || mermaidLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${i})\n mermaid = normalizeMermaidModule(mod) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\n// Load immediately; failures are reported per-request\nawait loadMermaid()\n`.trimStart():`\n${r}\n\nfunction loadMermaidClassic() {\n if (mermaid || mermaidLoadError)\n return\n try {\n importScripts(${i})\n mermaid = normalizeMermaidModule(globalThis.mermaid) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n}\n\nloadMermaidClassic()\n`.trimStart()}function l(e){var i,r;const a=s(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:a};const o=new Blob([a],{type:"text/javascript"}),c=URL.createObjectURL(o);let l=!1;const m="module"===(null!=(i=e.mode)?i:"module")?(u=d({},null!=(r=e.workerOptions)?r:{}),n(u,t({type:"module"}))):e.workerOptions;var u;const f=new Worker(c,m);if(e.debug)try{f.postMessage({type:"init",debug:!0})}catch(p){}return{worker:f,dispose:()=>{if(!l){l=!0;try{URL.revokeObjectURL(c)}catch(p){}}},source:a}}export{s as buildMermaidCDNWorkerSource,l as createMermaidWorkerFromCDN};
1
+ var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,o=(n,t,i)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i,d=(e,n)=>{for(var t in n||(n={}))r.call(n,t)&&o(e,t,n[t]);if(i)for(var t of i(n))a.call(n,t)&&o(e,t,n[t]);return e};function c(e){return JSON.stringify(e)}function s(e){var n;const t=null!=(n=e.mode)?n:"module",i=c(e.mermaidUrl),r=`\nlet DEBUG = false\nlet mermaid = null\nlet mermaidLoadError = null\n\nfunction normalizeMermaidModule(mod) {\n if (!mod)\n return mod\n const candidate = (mod && mod.default) ? mod.default : mod\n if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))\n return candidate\n if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {\n const api = candidate.mermaidAPI\n return {\n ...candidate,\n render: api.render ? api.render.bind(api) : undefined,\n parse: api.parse ? api.parse.bind(api) : undefined,\n initialize: (opts) => {\n if (typeof candidate.initialize === 'function')\n return candidate.initialize(opts)\n return api.initialize ? api.initialize(opts) : undefined\n },\n }\n }\n if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')\n return mod.mermaid\n return candidate\n}\n\nfunction applyThemeTo(code, theme) {\n const themeValue = theme === 'dark' ? 'dark' : 'default'\n const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`\n const trimmed = (code || '').trimStart()\n if (trimmed.startsWith('%%{'))\n return code\n return themeConfig + code\n}\n\nfunction getMermaidDiagramKind(code) {\n const lines = String(code || '').split(/\\r?\\n/)\n for (const rawLine of lines) {\n const line = rawLine.trim()\n if (!line || line.startsWith('%%'))\n continue\n const match = line.match(/^([A-Z][\\w-]*)\\b/i)\n return (match && match[1] ? match[1].toLowerCase() : '')\n }\n return ''\n}\n\nfunction isEscapedEntityBefore(text, index) {\n return /(?:&#\\d+|#\\d+|&[a-z]+)$/i.test(text.slice(Math.max(0, index - 12), index))\n}\n\nfunction hasSequenceArrow(text) {\n return text.includes('->')\n || text.includes('--\x3e')\n || text.includes('->>')\n || text.includes('--\x3e>')\n || text.includes('-x')\n || text.includes('--x')\n || text.includes('-)')\n || text.includes('--)')\n || text.includes('-+')\n || text.includes('--+')\n}\n\nfunction startsSequenceMessage(text) {\n const segment = text.split(';', 1)[0]\n const colonIndex = segment.indexOf(':')\n return colonIndex > 0 && hasSequenceArrow(segment.slice(0, colonIndex))\n}\n\nfunction startsSequenceStatement(text) {\n const source = text.trimStart()\n return /^(?:accDescr|accTitle|activate|actor|and|alt|autonumber|box|break|critical|create\\s+(?:actor|participant)|deactivate|destroy|else|end|link|links|loop|Note|opt|option|par|participant|properties|rect)\\b/i.test(source)\n || startsSequenceMessage(source)\n}\n\nfunction isSequenceTextLine(line, colonIndex) {\n const prefix = line.slice(0, colonIndex)\n return /^\\s*Note\\b/i.test(prefix) || hasSequenceArrow(prefix)\n}\n\nfunction escapeTextSemicolons(text) {\n let escaped = ''\n let changed = false\n for (let index = 0; index < text.length; index++) {\n const char = text[index]\n if (char !== ';' || isEscapedEntityBefore(text, index)) {\n escaped += char\n continue\n }\n if (startsSequenceStatement(text.slice(index + 1))) {\n escaped += char\n continue\n }\n escaped += '#59;'\n changed = true\n }\n return changed ? escaped : text\n}\n\nfunction escapeSequenceTextSemicolons(code) {\n if (getMermaidDiagramKind(code) !== 'sequencediagram')\n return code\n const parts = String(code || '').split(/(\\r\\n|\\n|\\r)/)\n let changed = false\n for (let index = 0; index < parts.length; index += 2) {\n const line = parts[index]\n if (!line.includes(';'))\n continue\n const colonIndex = line.indexOf(':')\n if (colonIndex === -1 || !isSequenceTextLine(line, colonIndex))\n continue\n const escapedText = escapeTextSemicolons(line.slice(colonIndex + 1))\n if (escapedText !== line.slice(colonIndex + 1)) {\n parts[index] = line.slice(0, colonIndex + 1) + escapedText\n changed = true\n }\n }\n return changed ? parts.join('') : code\n}\n\nfunction findHeaderIndex(lines) {\n const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/\n for (let i = 0; i < lines.length; i++) {\n const l = (lines[i] || '').trim()\n if (!l)\n continue\n if (l.startsWith('%%'))\n continue\n if (headerRe.test(l))\n return i\n }\n return -1\n}\n\nasync function canParse(code, theme) {\n const themed = applyThemeTo(code, theme)\n const anyMermaid = mermaid\n if (anyMermaid && typeof anyMermaid.parse === 'function') {\n try {\n await anyMermaid.parse(themed)\n }\n catch (error) {\n const retryCode = escapeSequenceTextSemicolons(themed)\n if (retryCode === themed)\n throw error\n await anyMermaid.parse(retryCode)\n }\n return true\n }\n throw new Error('mermaid.parse not available in worker')\n}\n\nasync function findLastRenderablePrefix(baseCode, theme) {\n const lines = String(baseCode || '').split('\\n')\n const headerIdx = findHeaderIndex(lines)\n if (headerIdx === -1)\n return null\n const head = lines.slice(0, headerIdx + 1)\n await canParse(head.join('\\n'), theme)\n\n let low = headerIdx + 1\n let high = lines.length\n let lastGood = headerIdx + 1\n let tries = 0\n const MAX_TRIES = 12\n\n while (low <= high && tries < MAX_TRIES) {\n const mid = Math.floor((low + high) / 2)\n const candidate = [...head, ...lines.slice(headerIdx + 1, mid)].join('\\n')\n tries++\n try {\n await canParse(candidate, theme)\n lastGood = mid\n low = mid + 1\n }\n catch {\n high = mid - 1\n }\n }\n\n return [...head, ...lines.slice(headerIdx + 1, lastGood)].join('\\n')\n}\n\nfunction initMermaidOnce() {\n if (!mermaid)\n return\n try {\n if (typeof mermaid.initialize === 'function')\n mermaid.initialize(${c(d({startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}},e.initializeOptions||{}))})\n }\n catch (e) {\n if (DEBUG)\n console.warn('[mermaid-cdn-worker] initialize failed', e)\n }\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const msg = ev.data || {}\n if (msg.type === 'init') {\n DEBUG = !!msg.debug\n if (DEBUG)\n console.debug('[mermaid-cdn-worker] debug enabled')\n return\n }\n\n const id = msg.id\n const action = msg.action\n const payload = msg.payload || {}\n\n if (!mermaid) {\n const errMsg = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'\n globalThis.postMessage({ id, ok: false, error: errMsg })\n return\n }\n\n try {\n if (action === 'canParse') {\n const ok = await canParse(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: ok })\n return\n }\n if (action === 'findPrefix') {\n const res = await findLastRenderablePrefix(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: res })\n return\n }\n globalThis.postMessage({ id, ok: false, error: 'Unknown action' })\n }\n catch (e) {\n globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })\n }\n})\n`.trimStart();return"module"===t?`\n${r}\n\nlet loadPromise = null\nasync function loadMermaid() {\n if (mermaid || mermaidLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${i})\n mermaid = normalizeMermaidModule(mod) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\n// Load immediately; failures are reported per-request\nawait loadMermaid()\n`.trimStart():`\n${r}\n\nfunction loadMermaidClassic() {\n if (mermaid || mermaidLoadError)\n return\n try {\n importScripts(${i})\n mermaid = normalizeMermaidModule(globalThis.mermaid) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n}\n\nloadMermaidClassic()\n`.trimStart()}function l(e){var i,r;const a=s(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:a};const o=new Blob([a],{type:"text/javascript"}),c=URL.createObjectURL(o);let l=!1;const m=()=>{if(!l){l=!0;try{URL.revokeObjectURL(c)}catch(e){}}},u="module"===(null!=(i=e.mode)?i:"module")?(f=d({},null!=(r=e.workerOptions)?r:{}),n(f,t({type:"module"}))):e.workerOptions;var f;let p=null;try{p=new Worker(c,u)}finally{m()}if(e.debug)try{p.postMessage({type:"init",debug:!0})}catch(h){}return{worker:p,dispose:m,source:a}}export{s as buildMermaidCDNWorkerSource,l as createMermaidWorkerFromCDN};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "markstream-vue",
3
3
  "type": "module",
4
- "version": "2.0.8-beta.0",
4
+ "version": "2.0.8",
5
5
  "description": "Vue/Nuxt streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, long documents, Mermaid, KaTeX, and stream-diffs powered code blocks.",
6
6
  "author": "Simon He",
7
7
  "license": "MIT",
@@ -137,8 +137,8 @@
137
137
  "dependencies": {
138
138
  "@chenglou/pretext": "^0.0.8",
139
139
  "@floating-ui/dom": "^1.8.0",
140
- "stream-markdown-parser": "1.2.13",
141
- "markstream-core": "2.0.7"
140
+ "markstream-core": "2.0.8",
141
+ "stream-markdown-parser": "1.2.14"
142
142
  },
143
143
  "devDependencies": {
144
144
  "@antfu/eslint-config": "^5.4.1",
@@ -283,7 +283,8 @@
283
283
  "build:pack": "pnpm run build:core && vite build --mode npm && node scripts/cleanup-style-entry.mjs && node scripts/write-tailwind-types.mjs && 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:pack",
284
284
  "build:analyze": "ANALYZE=true pnpm build",
285
285
  "size:check": "MAX_DIST_BYTES=1003520 MAX_JS_CHUNK_BYTES=290816 MAX_PACK_TGZ_BYTES=286720 MAX_PACK_UNPACKED_BYTES=1105920 node scripts/check-package-size.mjs",
286
- "docs:dev": "vitepress dev docs",
286
+ "docs:dev": "pnpm run docs:gen-components && vitepress dev docs",
287
+ "docs:gen-components": "tsx scripts/generate-component-pages.mjs",
287
288
  "docs:sync-zh": "node scripts/sync-zh-docs.mjs",
288
289
  "docs:check-zh": "node scripts/check-zh-parity.mjs",
289
290
  "docs:seo:source": "node scripts/check-docs-frontmatter.mjs",
@@ -292,7 +293,7 @@
292
293
  "docs:llms:check": "pnpm run docs:llms:generate && git diff --exit-code -- docs/public/llms.txt docs/public/llms.zh-CN.txt docs/public/llms-full.txt docs/public/llms-full.zh-CN.txt docs/public/llms-routing.txt",
293
294
  "docs:generate-llms": "pnpm run docs:llms:generate",
294
295
  "docs:check-llms": "pnpm run docs:llms:check",
295
- "docs:build": "vitepress build docs",
296
+ "docs:build": "pnpm run docs:gen-components && vitepress build docs",
296
297
  "docs:seo:check": "pnpm docs:seo:source && pnpm docs:check-zh && pnpm docs:build && node scripts/check-docs-seo-output.mjs",
297
298
  "docs:smoke:production": "node scripts/smoke-docs-production.mjs",
298
299
  "docs:build:ci": "pnpm run build:parser && pnpm run build && pnpm docs:seo:check",