markstream-vue 2.0.0 → 2.0.1-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/dist/index5.js CHANGED
@@ -1 +1 @@
1
- var e=(e,n,l)=>new Promise((t,a)=>{var o=e=>{try{i(l.next(e))}catch(n){a(n)}},r=e=>{try{i(l.throw(e))}catch(n){a(n)}},i=e=>e.done?t(e.value):Promise.resolve(e.value).then(o,r);i((l=l.apply(e,n)).next())});import{defineComponent as n,ref as l,inject as t,computed as a,getCurrentInstance as o,watch as r,onMounted as i,onBeforeUnmount as u,openBlock as s,createElementBlock as d,normalizeStyle as c,createVNode as v,Transition as f,withCtx as m,createElementVNode as h,createCommentVNode as g,normalizeClass as p,toDisplayString as y,nextTick as k}from"vue";import{ah as x,aq as $,G as b}from"./exports.js";import{M as _}from"./index2.js";import{n as w,f as S,k as T,j as R,b as E,W}from"./workers-katexWorkerClient.js";const M=["data-markstream-mode","data-markstream-pending"],O={key:0,class:"math-loading-overlay"},H=["innerHTML"],K={key:1,class:"math-block__fallback text-left"},I=/* @__PURE__ */b(/* @__PURE__ */n({__name:"MathBlockNode",props:{node:{},indexKey:{},cacheScope:{}},setup(n){var b,I;const j=n,A=l(null),L=t(_,null),N=a(()=>w(j.node.content)),P=1===(null==(I=null==(b=o())?void 0:b.vnode.el)?void 0:I.nodeType),z=a(()=>x(j,{})),B=function(){if(!j.node.content)return{html:"",text:j.node.raw,loading:!1};if(j.node.loading)return{html:"",text:"",loading:!0};const e=S();if(!e){const e="undefined"==typeof window||P;return{html:"",text:e?j.node.raw:"",loading:!e}}try{const n=e.renderToString(N.value,{throwOnError:!1,displayMode:!0});return T(N.value,!0,n),{html:n,text:"",loading:!1}}catch(n){return{html:"",text:j.node.loading?"":j.node.raw,loading:j.node.loading}}}(),C=l(B.html),D=l(B.text);let q=!1,F=0,G=!1,U=null;const X=$();let J=null,Q="";const V=l(B.loading),Y=l(!1),Z=l(le());function ee(e){null!=e&&e!==F||(Y.value=!1)}function ne(){var e;if(null==j.indexKey)return"";const n=null!=(e=j.cacheScope)?e:null==X?void 0:X.scope;return`${null!=n&&String(n).length>0?`${String(n)}:`:""}math-block:${String(j.indexKey)}`}function le(){var e;const n=ne();return n&&null!=(e=null==X?void 0:X.cache.get(n))?e:0}function te(){if(0===Z.value)return;Z.value=0;const e=ne();e&&(null==X||X.cache.set(e,0))}function ae(e){if(C.value)return void te();if(!Number.isFinite(e)||e<=0)return;const n=Math.max(Z.value,e);if(n===Z.value)return;Z.value=n;const l=ne();l&&(null==X||X.cache.set(l,n))}function oe(){k(()=>{var e,n;ae(null!=(n=null==(e=A.value)?void 0:e.offsetHeight)?n:0)})}function re(){const e=Q;L&&e&&(Q="",L.markSettled(e))}function ie(){return e(this,null,function*(){if(G)return re(),void ee();U&&(U.abort(),U=null);const n=++F;if(!j.node.content)return re(),ee(),V.value=!1,C.value="",D.value=j.node.raw,q=!1,void oe();const l=new AbortController;U=l,Y.value=!0,G||n!==F||l.signal.aborted?G||ee(n):(function(){const e=z.value;L&&e&&Q!==e&&(Q&&L.markSettled(Q),Q=e,L.markPending(e))}(),R(N.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:l.signal}).then(e=>{G||n!==F||(C.value=e,D.value="",q=!0,V.value=!1,te(),oe())}).catch(l=>e(null,null,function*(){if(G||n!==F)return;const e=(null==l?void 0:l.code)||(null==l?void 0:l.name),t="KATEX_DISABLED"===e;if("WORKER_INIT_ERROR"===e||(null==l?void 0:l.fallbackToRenderer)||(e===W||"WORKER_TIMEOUT"===e)&&!j.node.loading){const e=yield E();if(G||n!==F)return;if(e){try{const n=e.renderToString(N.value,{throwOnError:j.node.loading,displayMode:!0});C.value=n,D.value="",q=!0,V.value=!1,te(),oe(),T(N.value,!0,n)}catch(a){}return}}if(t||!j.node.loading)return V.value=!1,C.value="",D.value=j.node.raw,void oe();q||(V.value=!0)})).finally(()=>{G||n!==F||(ee(n),function(){const e=Q;L&&e&&(Q="",k(()=>{var n,l;if(!G){const t=null!=(l=null==(n=A.value)?void 0:n.offsetHeight)?l:0;t>0&&L.reportHeight(e,t)}L.markSettled(e)}))}())}))})}B.html&&(q=!0),B.html&&te();const ue=[{family:"$$",open:"$$",close:"$$"},{family:"\\[]",open:"\\[",close:"\\]"},{family:"\\[]",open:"\\[",close:"]"},{family:"[]",open:"[",close:"\\]"},{family:"[]",open:"[",close:"]"},{family:"\\()",open:"\\(",close:"\\)"},{family:"$",open:"$",close:"$"}];function se(e,n){const l=function(e){const n=String(null!=e?e:"");for(const{family:l,open:t,close:a}of ue)if(("$"!==t||!n.startsWith("$$")&&!n.endsWith("$$"))&&n.length>=t.length+a.length&&n.startsWith(t)&&n.endsWith(a))return{family:l,inner:n.slice(t.length,n.length-a.length),trusted:!0};return null}(e);return l||{family:"content",inner:String(null!=n?n:""),trusted:!1}}let de=null,ce=`${N.value}\0${j.node.loading?"1":"0"}`;return r(()=>[j.node.content,j.node.loading,j.node.raw],([e,,n],[l,,t])=>{var a,o;(a=se(t,l),o=se(n,e),""===a.inner||a.family===o.family&&(a.trusted&&o.trusted?o.inner.startsWith(a.inner):o.inner===a.inner))||te(),function(){const e=N.value,n=!0===j.node.loading,l=`${e}\0${n?"1":"0"}`;if(l!==ce){if(ce=l,!n)return null!=de&&(clearTimeout(de),de=null),void ie();null==de&&(de=setTimeout(()=>{de=null,ie()},32))}}()},{flush:"post"}),r([()=>j.indexKey,()=>j.cacheScope],()=>{Z.value=le(),oe()}),i(()=>{"undefined"!=typeof ResizeObserver&&A.value&&(J=new ResizeObserver(()=>{var e,n;ae(null!=(n=null==(e=A.value)?void 0:e.offsetHeight)?n:0)}),J.observe(A.value)),oe(),C.value||ie()}),u(()=>{G=!0,null!=de&&(clearTimeout(de),de=null),re(),U&&(U.abort(),U=null),null==J||J.disconnect(),J=null}),(e,n)=>(s(),d("div",{ref_key:"containerEl",ref:A,class:"math-block text-center overflow-x-auto relative","data-markstream-math":"block","data-markstream-mode":C.value?"katex":D.value?"fallback":"loading","data-markstream-pending":Y.value?"true":void 0,style:c(Z.value?{minHeight:`${Z.value}px`}:void 0)},[v(f,{name:"math-fade"},{default:m(()=>[!V.value||C.value||D.value?g("",!0):(s(),d("div",O,[...n[0]||(n[0]=[h("div",{class:"math-loading-spinner"},null,-1)])]))]),_:1}),C.value?(s(),d("div",{key:0,class:p(["math-block__content",{"math-rendering":V.value}]),innerHTML:C.value},null,10,H)):D.value?(s(),d("pre",K,y(D.value),1)):(s(),d("div",{key:2,class:p(["math-block__content",{"math-rendering":V.value}])},null,2))],12,M))}}),[["__scopeId","data-v-af54c877"]]);I.install=e=>{e.component(I.__name,I)};export{I as default};
1
+ var e=(e,n,l)=>new Promise((t,a)=>{var o=e=>{try{i(l.next(e))}catch(n){a(n)}},r=e=>{try{i(l.throw(e))}catch(n){a(n)}},i=e=>e.done?t(e.value):Promise.resolve(e.value).then(o,r);i((l=l.apply(e,n)).next())});import{defineComponent as n,ref as l,inject as t,computed as a,getCurrentInstance as o,watch as r,onMounted as i,onBeforeUnmount as u,openBlock as s,createElementBlock as d,normalizeStyle as c,createVNode as v,Transition as f,withCtx as m,createElementVNode as h,createCommentVNode as g,normalizeClass as p,toDisplayString as y,nextTick as k}from"vue";import{aj as x,av as $,G as b}from"./exports.js";import{M as _}from"./index2.js";import{n as w,f as S,k as T,j as R,b as E,W}from"./workers-katexWorkerClient.js";const M=["data-markstream-mode","data-markstream-pending"],O={key:0,class:"math-loading-overlay"},H=["innerHTML"],K={key:1,class:"math-block__fallback text-left"},j=/* @__PURE__ */b(/* @__PURE__ */n({__name:"MathBlockNode",props:{node:{},indexKey:{},cacheScope:{}},setup(n){var b,j;const I=n,A=l(null),L=t(_,null),N=a(()=>w(I.node.content)),P=1===(null==(j=null==(b=o())?void 0:b.vnode.el)?void 0:j.nodeType),z=a(()=>x(I,{})),B=function(){if(!I.node.content)return{html:"",text:I.node.raw,loading:!1};if(I.node.loading)return{html:"",text:"",loading:!0};const e=S();if(!e){const e="undefined"==typeof window||P;return{html:"",text:e?I.node.raw:"",loading:!e}}try{const n=e.renderToString(N.value,{throwOnError:!1,displayMode:!0});return T(N.value,!0,n),{html:n,text:"",loading:!1}}catch(n){return{html:"",text:I.node.loading?"":I.node.raw,loading:I.node.loading}}}(),C=l(B.html),D=l(B.text);let F=!1,G=0,U=!1,X=null;const q=$();let J=null,Q="";const V=l(B.loading),Y=l(!1),Z=l(le());function ee(e){null!=e&&e!==G||(Y.value=!1)}function ne(){var e;if(null==I.indexKey)return"";const n=null!=(e=I.cacheScope)?e:null==q?void 0:q.scope;return`${null!=n&&String(n).length>0?`${String(n)}:`:""}math-block:${String(I.indexKey)}`}function le(){var e;const n=ne();return n&&null!=(e=null==q?void 0:q.cache.get(n))?e:0}function te(){if(0===Z.value)return;Z.value=0;const e=ne();e&&(null==q||q.cache.set(e,0))}function ae(e){if(C.value)return void te();if(!Number.isFinite(e)||e<=0)return;const n=Math.max(Z.value,e);if(n===Z.value)return;Z.value=n;const l=ne();l&&(null==q||q.cache.set(l,n))}function oe(){k(()=>{var e,n;ae(null!=(n=null==(e=A.value)?void 0:e.offsetHeight)?n:0)})}function re(){const e=Q;L&&e&&(Q="",L.markSettled(e))}function ie(){return e(this,null,function*(){if(U)return re(),void ee();X&&(X.abort(),X=null);const n=++G;if(!I.node.content)return re(),ee(),V.value=!1,C.value="",D.value=I.node.raw,F=!1,void oe();const l=new AbortController;X=l,Y.value=!0,U||n!==G||l.signal.aborted?U||ee(n):(function(){const e=z.value;L&&e&&Q!==e&&(Q&&L.markSettled(Q),Q=e,L.markPending(e))}(),R(N.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:l.signal}).then(e=>{U||n!==G||(C.value=e,D.value="",F=!0,V.value=!1,te(),oe())}).catch(l=>e(null,null,function*(){if(U||n!==G)return;const e=(null==l?void 0:l.code)||(null==l?void 0:l.name),t="KATEX_DISABLED"===e;if("WORKER_INIT_ERROR"===e||(null==l?void 0:l.fallbackToRenderer)||(e===W||"WORKER_TIMEOUT"===e)&&!I.node.loading){const e=yield E();if(U||n!==G)return;if(e){try{const n=e.renderToString(N.value,{throwOnError:I.node.loading,displayMode:!0});C.value=n,D.value="",F=!0,V.value=!1,te(),oe(),T(N.value,!0,n)}catch(a){}return}}if(t||!I.node.loading)return V.value=!1,C.value="",D.value=I.node.raw,void oe();F||(V.value=!0)})).finally(()=>{U||n!==G||(ee(n),function(){const e=Q;L&&e&&(Q="",k(()=>{var n,l;if(!U){const t=null!=(l=null==(n=A.value)?void 0:n.offsetHeight)?l:0;t>0&&L.reportHeight(e,t)}L.markSettled(e)}))}())}))})}B.html&&(F=!0),B.html&&te();const ue=[{family:"$$",open:"$$",close:"$$"},{family:"\\[]",open:"\\[",close:"\\]"},{family:"\\[]",open:"\\[",close:"]"},{family:"[]",open:"[",close:"\\]"},{family:"[]",open:"[",close:"]"},{family:"\\()",open:"\\(",close:"\\)"},{family:"$",open:"$",close:"$"}];function se(e,n){const l=function(e){const n=String(null!=e?e:"");for(const{family:l,open:t,close:a}of ue)if(("$"!==t||!n.startsWith("$$")&&!n.endsWith("$$"))&&n.length>=t.length+a.length&&n.startsWith(t)&&n.endsWith(a))return{family:l,inner:n.slice(t.length,n.length-a.length),trusted:!0};return null}(e);return l||{family:"content",inner:String(null!=n?n:""),trusted:!1}}let de=null,ce=`${N.value}\0${I.node.loading?"1":"0"}`;return r(()=>[I.node.content,I.node.loading,I.node.raw],([e,,n],[l,,t])=>{var a,o;(a=se(t,l),o=se(n,e),""===a.inner||a.family===o.family&&(a.trusted&&o.trusted?o.inner.startsWith(a.inner):o.inner===a.inner))||te(),function(){const e=N.value,n=!0===I.node.loading,l=`${e}\0${n?"1":"0"}`;if(l!==ce){if(ce=l,!n)return null!=de&&(clearTimeout(de),de=null),void ie();null==de&&(de=setTimeout(()=>{de=null,ie()},32))}}()},{flush:"post"}),r([()=>I.indexKey,()=>I.cacheScope],()=>{Z.value=le(),oe()}),i(()=>{"undefined"!=typeof ResizeObserver&&A.value&&(J=new ResizeObserver(()=>{var e,n;ae(null!=(n=null==(e=A.value)?void 0:e.offsetHeight)?n:0)}),J.observe(A.value)),oe(),C.value||ie()}),u(()=>{U=!0,null!=de&&(clearTimeout(de),de=null),re(),X&&(X.abort(),X=null),null==J||J.disconnect(),J=null}),(e,n)=>(s(),d("div",{ref_key:"containerEl",ref:A,class:"math-block text-center overflow-x-auto relative","data-markstream-math":"block","data-markstream-mode":C.value?"katex":D.value?"fallback":"loading","data-markstream-pending":Y.value?"true":void 0,style:c(Z.value?{minHeight:`${Z.value}px`}:void 0)},[v(f,{name:"math-fade"},{default:m(()=>[!V.value||C.value||D.value?g("",!0):(s(),d("div",O,[...n[0]||(n[0]=[h("div",{class:"math-loading-spinner"},null,-1)])]))]),_:1}),C.value?(s(),d("div",{key:0,class:p(["math-block__content",{"math-rendering":V.value}]),innerHTML:C.value},null,10,H)):D.value?(s(),d("pre",K,y(D.value),1)):(s(),d("div",{key:2,class:p(["math-block__content",{"math-rendering":V.value}])},null,2))],12,M))}}),[["__scopeId","data-v-af54c877"]]);j.install=e=>{e.component(j.__name,j)};export{j as default};
package/dist/index7.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,l=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,r=(e,r)=>{for(var a in r||(r={}))o.call(r,a)&&l(e,a,r[a]);if(t)for(var a of t(r))n.call(r,a)&&l(e,a,r[a]);return e},a=(e,t,o)=>new Promise((n,l)=>{var r=e=>{try{i(o.next(e))}catch(t){l(t)}},a=e=>{try{i(o.throw(e))}catch(t){l(t)}},i=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);i((o=o.apply(e,t)).next())});import{defineComponent as i,useAttrs as u,inject as s,ref as d,computed as c,watch as v,nextTick as m,onMounted as p,onBeforeUnmount as f,openBlock as g,createElementBlock as h,normalizeClass as y,createElementVNode as w,unref as b,toDisplayString as k,createCommentVNode as x,normalizeStyle as B,withDirectives as D,vShow as M}from"vue";import{as as C,au as E,av as T,ar as A,ah as j,ao as O,a6 as I,Z as H,G as F}from"./exports.js";import{M as S}from"./index2.js";const L=["data-markstream-mode","data-markstream-pending"],N={key:0,class:"d2-block-header flex justify-between items-center border-b"},P={class:"d2-header-actions flex items-center"},R={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},_=["aria-label"],U={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},V={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},X=["aria-label"],Y=["aria-pressed"],q={key:0,class:"d2-source"},$={class:"d2-code"},z={key:0,class:"d2-error mt-2 text-xs"},G={key:1},Z={key:0,class:"d2-source"},J={class:"d2-code"},K={key:0,class:"d2-error mt-2 text-xs"},Q=["innerHTML"],W={key:0,class:"d2-error px-4 pb-3 text-xs"},ee=/* @__PURE__ */F(/* @__PURE__ */i({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},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 t=e,o=u(),n=s(S,null),{t:l}=C(),i=d(!1),F=d(!1),ee=d(!1),te=d(!1),oe=d(null),ne=d(!1),le=d(""),re=d(""),ae=d(0),ie=d(""),ue=d(""),se=d(null),de=d(null),ce=d(null),ve=E(),me=T(),pe=A(),fe=d(null),ge="undefined"!=typeof window,he=d(!1),ye=d("undefined"==typeof window||!pe.value),we=c(()=>{var e;return null!=(e=t.node.code)?e:""}),be=c(()=>j(t,o)),ke=c(()=>{var e,o;return[t.isDark?"dark":"light",null!=(e=t.themeId)?e:"auto",null!=(o=t.darkThemeId)?o:"auto",we.value].join(":")}),xe=c(()=>!!le.value&&re.value===ke.value),Be=c(()=>{if(!he.value||!we.value||ee.value)return!1;const e=ke.value;return!!ne.value||ie.value!==e&&(!oe.value||ue.value!==e)}),De=c(()=>xe.value||!!le.value&&Be.value),Me=c(()=>ee.value||!te.value||!De.value),Ce=c(()=>{if(Me.value&&de.value)return{minHeight:`${de.value}px`}}),Ee=c(()=>"none"===t.maxHeight?{maxHeight:"none"}:null!=t.maxHeight?{maxHeight:"number"==typeof t.maxHeight?`${t.maxHeight}px`:String(t.maxHeight)}:void 0);let Te=null,Ae=!1,je=!1,Oe=0,Ie=null,He=!1,Fe=null,Se="";"undefined"!=typeof window&&v([()=>ce.value,pe],([e,t])=>{var o,n,l;if(null==(o=fe.value)||o.destroy(),fe.value=null,!t||ye.value)return void(ye.value=!0);if(!e)return void(ye.value=!1);const r=null!=(l=null!=(n=null==me?void 0:me.value.heavyBlockMargin)?n:null==me?void 0:me.value.rootMargin)?l:"160px",a=ve(e,{rootMargin:r,allowIdle:!1});fe.value=a,ye.value=a.isVisible.value,a.whenVisible.then(()=>{ye.value=!0})},{immediate:!0});const Le={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 Ne(e){return!e||e.disabled}function Pe(e,o,n="top"){if(Ne(e.currentTarget))return;const l=e,r=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;O(e.currentTarget,o,n,!1,r,t.isDark)}function Re(){I()}function _e(e){if(Ne(e.currentTarget))return;const o=i.value?l("common.copied")||"Copied":l("common.copy")||"Copy",n=e,r=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;O(e.currentTarget,o,"top",!1,r,t.isDark)}function Ue(){return a(this,null,function*(){try{const e=we.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),i.value=!0,setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function Ve(){F.value=!F.value}function Xe(e){ee.value="source"===e}const Ye=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function $e(e){if(!e)return"";const t=e.trim();return qe.test(t)?t:""}function ze(){le.value="",re.value=""}function Ge(e){return je||e!==ae.value}function Ze(){return a(this,null,function*(){var e,o,l,i,u;if(!ge||je)return;if(!ye.value)return;if(t.loading&&!t.progressiveRender)return;const s=ke.value;if(s===ie.value&&!oe.value&&xe.value)return te.value=!0,void(t.loading&&(ee.value=!1));const d=we.value;if(!d)return ze(),oe.value=null,ie.value="",void(ue.value="");const c=++ae.value;ne.value=!0,oe.value=null,ue.value="",function(){const e=be.value;n&&e&&Se!==e&&(Se&&n.markSettled(Se),Se=e,n.markPending(e))}();try{const n=yield function(){return a(this,null,function*(){if(Te)return Te;const e=yield H();if(je||!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?Te=t:"function"==typeof e.compile&&(Te=e),Te}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(Te=new e.D2,Te):("function"==typeof e.compile&&(Te=e),Te)})}();if(Ge(c))return;if(!n)return te.value=!1,ee.value=!0,ze(),oe.value="D2 is not available.",void(ue.value=s);if("function"!=typeof n.compile||"function"!=typeof n.render)throw new TypeError("D2 instance is missing compile/render methods.");te.value=!0;const v=yield n.compile(d);if(Ge(c))return;const m=null!=(e=null==v?void 0:v.diagram)?e:v,p=null!=(l=null!=(o=null==v?void 0:v.renderOptions)?o:null==v?void 0:v.options)?l:{},f=null!=(i=t.themeId)?i:p.themeID,g=null!=(u=t.darkThemeId)?u:p.darkThemeID,h=r({},p);if(h.themeID=t.isDark&&null!=g?g:f,h.darkThemeID=null,h.darkThemeOverrides=null,t.isDark){const e=p.themeOverrides&&"object"==typeof p.themeOverrides?p.themeOverrides:null;h.themeOverrides=r(r({},Le),e||{})}const y=yield n.render(m,h);if(Ge(c))return;const w=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(y);if(!w)throw new Error("D2 render returned empty output.");!function(e,t){const o=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),o=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!o||"svg"!==o.nodeName.toLowerCase())return"";const n=o;return function(e){const t=/* @__PURE__ */new Set(["script"]),o=[e,...Array.from(e.querySelectorAll("*"))];for(const n of o){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 o=t.value;if(Ye.some(e=>e.test(o))){n.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const o=$e(t.value);if(!o){n.removeAttribute(e);continue}o!==t.value&&n.setAttribute(e,o)}}}}}(n),n.classList.add("markstream-d2-root-svg"),n.outerHTML}(e);le.value=o||"",re.value=o?t:""}(w,s),ie.value=s,ue.value="",t.loading&&(ee.value=!1),oe.value=null}catch(v){if(Ge(c))return;const e=(null==v?void 0:v.message)?String(v.message):"D2 render failed.";t.loading||(oe.value=e,ue.value=s),ie.value="",e.includes("@terrastruct/d2")&&(te.value=!1,ee.value=!0)}finally{Ge(c)||(ne.value=!1,He?(He=!1,Je()):function(){const e=Se;n&&e&&(Se="",m(()=>{var t,o;if(!je){const l=null!=(o=null==(t=ce.value)?void 0:t.offsetHeight)?o:0;l>0&&n.reportHeight(e,l)}n.markSettled(e)}))}())}})}function Je(e=!1){if(Ae)return;if(!ge)return;if(je)return;if(ne.value)return void(He=!0);const o=Math.max(120,Number(t.progressiveIntervalMs)||0),n=Date.now()-Oe;if(!e&&n<o)return He=!0,void(null==Ie&&(Ie=window.setTimeout(()=>{Ie=null,He&&(He=!1,Je(!0))},Math.max(0,o-n))));Ae=!0;const l=()=>{Ae=!1,Oe=Date.now(),Ze()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(l):setTimeout(l,0)}function Ke(){if(xe.value)try{const e=new Blob([le.value],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e);if("undefined"!=typeof document){const e=document.createElement("a");e.href=t,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}}function Qe(){const e=se.value;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&(de.value=t)}return v(()=>[t.node.code,t.loading,t.isDark,t.themeId,t.darkThemeId],()=>{Je()},{immediate:!0}),v(()=>t.loading,(e,t)=>{t&&!e&&Je(!0)}),v(()=>ye.value,e=>{e&&Je(!0)}),v(()=>[Me.value,le.value,we.value],()=>{m(()=>{Qe()})}),p(()=>{he.value=!0,m(()=>{Qe()}),"undefined"!=typeof ResizeObserver&&(Fe=new ResizeObserver(()=>{Qe()}),se.value&&Fe.observe(se.value))}),f(()=>{var e;je=!0,ae.value+=1,He=!1,function(){const e=Se;n&&e&&(Se="",n.markSettled(e))}(),ie.value="",null==(e=fe.value)||e.destroy(),fe.value=null,null!=Ie&&(clearTimeout(Ie),Ie=null),null==Fe||Fe.disconnect(),Fe=null}),(e,o)=>(g(),h("div",{ref_key:"viewportTarget",ref:ce,class:y(["d2-block-container rounded-lg border overflow-hidden",{dark:t.isDark}]),"data-markstream-d2":"1","data-markstream-mode":Me.value?"fallback":"preview","data-markstream-pending":Be.value?"true":void 0},[t.showHeader?(g(),h("div",N,[o[16]||(o[16]=w("div",{class:"flex items-center gap-x-2"},[w("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),w("div",P,[t.showModeToggle?(g(),h("div",R,[w("button",{type:"button",class:y(["mode-btn px-2 py-0.5 rounded",ee.value?"":"is-active"]),onClick:o[0]||(o[0]=e=>Xe("preview")),onMouseenter:o[1]||(o[1]=e=>Pe(e,b(l)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>Pe(e,b(l)("common.preview")||"Preview")),onMouseleave:Re,onBlur:Re},k(b(l)("common.preview")||"Preview"),35),w("button",{type:"button",class:y(["mode-btn px-2 py-0.5 rounded",ee.value?"is-active":""]),onClick:o[3]||(o[3]=e=>Xe("source")),onMouseenter:o[4]||(o[4]=e=>Pe(e,b(l)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>Pe(e,b(l)("common.source")||"Source")),onMouseleave:Re,onBlur:Re},k(b(l)("common.source")||"Source"),35)])):x("",!0),t.showCopyButton?(g(),h("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":i.value?b(l)("common.copied")||"Copied":b(l)("common.copy")||"Copy",onClick:Ue,onMouseenter:o[6]||(o[6]=e=>_e(e)),onFocus:o[7]||(o[7]=e=>_e(e)),onMouseleave:Re,onBlur:Re},[i.value?(g(),h("svg",V,[...o[13]||(o[13]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(g(),h("svg",U,[...o[12]||(o[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,_)):x("",!0),t.showExportButton&&xe.value?(g(),h("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":b(l)("common.export")||"Export",onClick:Ke,onMouseenter:o[8]||(o[8]=e=>Pe(e,b(l)("common.export")||"Export")),onFocus:o[9]||(o[9]=e=>Pe(e,b(l)("common.export")||"Export")),onMouseleave:Re,onBlur:Re},[...o[14]||(o[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:"action-icon"},[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,X)):x("",!0),t.showCollapseButton?(g(),h("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":F.value,onClick:Ve,onMouseenter:o[10]||(o[10]=e=>Pe(e,F.value?b(l)("common.expand")||"Expand":b(l)("common.collapse")||"Collapse")),onFocus:o[11]||(o[11]=e=>Pe(e,F.value?b(l)("common.expand")||"Expand":b(l)("common.collapse")||"Collapse")),onMouseleave:Re,onBlur:Re},[(g(),h("svg",{style:B({rotate:F.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:"action-icon"},[...o[15]||(o[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,Y)):x("",!0)])])):x("",!0),D(w("div",{ref_key:"bodyRef",ref:se,class:"d2-block-body",style:B(Ce.value)},[t.loading&&!De.value?(g(),h("div",q,[w("pre",$,[w("code",null,k(we.value),1)]),oe.value?(g(),h("p",z,k(oe.value),1)):x("",!0)])):(g(),h("div",G,[Me.value?(g(),h("div",Z,[w("pre",J,[w("code",null,k(we.value),1)]),oe.value?(g(),h("p",K,k(oe.value),1)):x("",!0)])):(g(),h("div",{key:1,class:"d2-render",style:B(Ee.value)},[w("div",{class:"d2-svg",innerHTML:le.value},null,8,Q),oe.value?(g(),h("p",W,k(oe.value),1)):x("",!0)],4))]))],4),[[M,!F.value]])],10,L))}}),[["__scopeId","data-v-3b434cf5"]]);ee.install=e=>{e.component(ee.__name,ee)};export{ee as default};
1
+ var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,r=(e,r)=>{for(var a in r||(r={}))n.call(r,a)&&l(e,a,r[a]);if(t)for(var a of t(r))o.call(r,a)&&l(e,a,r[a]);return e},a=(e,t,n)=>new Promise((o,l)=>{var r=e=>{try{i(n.next(e))}catch(t){l(t)}},a=e=>{try{i(n.throw(e))}catch(t){l(t)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,a);i((n=n.apply(e,t)).next())});import{defineComponent as i,useAttrs as u,inject as s,ref as d,computed as c,watch as v,nextTick as m,onMounted as p,onBeforeUnmount as f,openBlock as g,createElementBlock as h,normalizeClass as y,createElementVNode as w,unref as b,toDisplayString as k,createCommentVNode as x,normalizeStyle as B,withDirectives as D,vShow as M}from"vue";import{ax as C,az as E,aA as T,aw as A,aj as j,ar as O,a8 as I,$ as H,G as F}from"./exports.js";import{M as S}from"./index2.js";const L=["data-markstream-mode","data-markstream-pending"],N={key:0,class:"d2-block-header flex justify-between items-center border-b"},P={class:"d2-header-actions flex items-center"},R={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},_=["aria-label"],U={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},V={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},X=["aria-label"],Y=["aria-pressed"],$={key:0,class:"d2-source"},q={class:"d2-code"},z={key:0,class:"d2-error mt-2 text-xs"},G={key:1},J={key:0,class:"d2-source"},K={class:"d2-code"},Q={key:0,class:"d2-error mt-2 text-xs"},W=["innerHTML"],Z={key:0,class:"d2-error px-4 pb-3 text-xs"},ee=/* @__PURE__ */F(/* @__PURE__ */i({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},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 t=e,n=u(),o=s(S,null),{t:l}=C(),i=d(!1),F=d(!1),ee=d(!1),te=d(!1),ne=d(null),oe=d(!1),le=d(""),re=d(""),ae=d(0),ie=d(""),ue=d(""),se=d(null),de=d(null),ce=d(null),ve=E(),me=T(),pe=A(),fe=d(null),ge="undefined"!=typeof window,he=d(!1),ye=d("undefined"==typeof window||!pe.value),we=c(()=>{var e;return null!=(e=t.node.code)?e:""}),be=c(()=>j(t,n)),ke=c(()=>{var e,n;return[t.isDark?"dark":"light",null!=(e=t.themeId)?e:"auto",null!=(n=t.darkThemeId)?n:"auto",we.value].join(":")}),xe=c(()=>!!le.value&&re.value===ke.value),Be=c(()=>{if(!he.value||!we.value||ee.value)return!1;const e=ke.value;return!!oe.value||ie.value!==e&&(!ne.value||ue.value!==e)}),De=c(()=>xe.value||!!le.value&&Be.value),Me=c(()=>ee.value||!te.value||!De.value),Ce=c(()=>{if(Me.value&&de.value)return{minHeight:`${de.value}px`}}),Ee=c(()=>"none"===t.maxHeight?{maxHeight:"none"}:null!=t.maxHeight?{maxHeight:"number"==typeof t.maxHeight?`${t.maxHeight}px`:String(t.maxHeight)}:void 0);let Te=null,Ae=!1,je=!1,Oe=0,Ie=null,He=!1,Fe=null,Se="";"undefined"!=typeof window&&v([()=>ce.value,pe],([e,t])=>{var n,o,l;if(null==(n=fe.value)||n.destroy(),fe.value=null,!t||ye.value)return void(ye.value=!0);if(!e)return void(ye.value=!1);const r=null!=(l=null!=(o=null==me?void 0:me.value.heavyBlockMargin)?o:null==me?void 0:me.value.rootMargin)?l:"160px",a=ve(e,{rootMargin:r,allowIdle:!1});fe.value=a,ye.value=a.isVisible.value,a.whenVisible.then(()=>{ye.value=!0})},{immediate:!0});const Le={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 Ne(e){return!e||e.disabled}function Pe(e,n,o="top"){if(Ne(e.currentTarget))return;const l=e,r=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;O(e.currentTarget,n,o,!1,r,t.isDark)}function Re(){I()}function _e(e){if(Ne(e.currentTarget))return;const n=i.value?l("common.copied")||"Copied":l("common.copy")||"Copy",o=e,r=null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0;O(e.currentTarget,n,"top",!1,r,t.isDark)}function Ue(){return a(this,null,function*(){try{const e=we.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),i.value=!0,setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function Ve(){F.value=!F.value}function Xe(e){ee.value="source"===e}const Ye=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],$e=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function qe(e){if(!e)return"";const t=e.trim();return $e.test(t)?t:""}function ze(){le.value="",re.value=""}function Ge(e){return je||e!==ae.value}function Je(){return a(this,null,function*(){var e,n,l,i,u;if(!ge||je)return;if(!ye.value)return;if(t.loading&&!t.progressiveRender)return;const s=ke.value;if(s===ie.value&&!ne.value&&xe.value)return te.value=!0,void(t.loading&&(ee.value=!1));const d=we.value;if(!d)return ze(),ne.value=null,ie.value="",void(ue.value="");const c=++ae.value;oe.value=!0,ne.value=null,ue.value="",function(){const e=be.value;o&&e&&Se!==e&&(Se&&o.markSettled(Se),Se=e,o.markPending(e))}();try{const o=yield function(){return a(this,null,function*(){if(Te)return Te;const e=yield H();if(je||!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?Te=t:"function"==typeof e.compile&&(Te=e),Te}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(Te=new e.D2,Te):("function"==typeof e.compile&&(Te=e),Te)})}();if(Ge(c))return;if(!o)return te.value=!1,ee.value=!0,ze(),ne.value="D2 is not available.",void(ue.value=s);if("function"!=typeof o.compile||"function"!=typeof o.render)throw new TypeError("D2 instance is missing compile/render methods.");te.value=!0;const v=yield o.compile(d);if(Ge(c))return;const m=null!=(e=null==v?void 0:v.diagram)?e:v,p=null!=(l=null!=(n=null==v?void 0:v.renderOptions)?n:null==v?void 0:v.options)?l:{},f=null!=(i=t.themeId)?i:p.themeID,g=null!=(u=t.darkThemeId)?u:p.darkThemeID,h=r({},p);if(h.themeID=t.isDark&&null!=g?g:f,h.darkThemeID=null,h.darkThemeOverrides=null,t.isDark){const e=p.themeOverrides&&"object"==typeof p.themeOverrides?p.themeOverrides:null;h.themeOverrides=r(r({},Le),e||{})}const y=yield o.render(m,h);if(Ge(c))return;const w=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(y);if(!w)throw new Error("D2 render returned empty output.");!function(e,t){const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const o=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const o of n){if(t.has(o.tagName.toLowerCase())){o.remove();continue}const e=Array.from(o.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))o.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Ye.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=qe(t.value);if(!n){o.removeAttribute(e);continue}n!==t.value&&o.setAttribute(e,n)}}}}}(o),o.classList.add("markstream-d2-root-svg"),o.outerHTML}(e);le.value=n||"",re.value=n?t:""}(w,s),ie.value=s,ue.value="",t.loading&&(ee.value=!1),ne.value=null}catch(v){if(Ge(c))return;const e=(null==v?void 0:v.message)?String(v.message):"D2 render failed.";t.loading||(ne.value=e,ue.value=s),ie.value="",e.includes("@terrastruct/d2")&&(te.value=!1,ee.value=!0)}finally{Ge(c)||(oe.value=!1,He?(He=!1,Ke()):function(){const e=Se;o&&e&&(Se="",m(()=>{var t,n;if(!je){const l=null!=(n=null==(t=ce.value)?void 0:t.offsetHeight)?n:0;l>0&&o.reportHeight(e,l)}o.markSettled(e)}))}())}})}function Ke(e=!1){if(Ae)return;if(!ge)return;if(je)return;if(oe.value)return void(He=!0);const n=Math.max(120,Number(t.progressiveIntervalMs)||0),o=Date.now()-Oe;if(!e&&o<n)return He=!0,void(null==Ie&&(Ie=window.setTimeout(()=>{Ie=null,He&&(He=!1,Ke(!0))},Math.max(0,n-o))));Ae=!0;const l=()=>{Ae=!1,Oe=Date.now(),Je()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(l):setTimeout(l,0)}function Qe(){if(xe.value)try{const e=new Blob([le.value],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e);if("undefined"!=typeof document){const e=document.createElement("a");e.href=t,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}}function We(){const e=se.value;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&(de.value=t)}return v(()=>[t.node.code,t.loading,t.isDark,t.themeId,t.darkThemeId],()=>{Ke()},{immediate:!0}),v(()=>t.loading,(e,t)=>{t&&!e&&Ke(!0)}),v(()=>ye.value,e=>{e&&Ke(!0)}),v(()=>[Me.value,le.value,we.value],()=>{m(()=>{We()})}),p(()=>{he.value=!0,m(()=>{We()}),"undefined"!=typeof ResizeObserver&&(Fe=new ResizeObserver(()=>{We()}),se.value&&Fe.observe(se.value))}),f(()=>{var e;je=!0,ae.value+=1,He=!1,function(){const e=Se;o&&e&&(Se="",o.markSettled(e))}(),ie.value="",null==(e=fe.value)||e.destroy(),fe.value=null,null!=Ie&&(clearTimeout(Ie),Ie=null),null==Fe||Fe.disconnect(),Fe=null}),(e,n)=>(g(),h("div",{ref_key:"viewportTarget",ref:ce,class:y(["d2-block-container rounded-lg border overflow-hidden",{dark:t.isDark}]),"data-markstream-d2":"1","data-markstream-mode":Me.value?"fallback":"preview","data-markstream-pending":Be.value?"true":void 0},[t.showHeader?(g(),h("div",N,[n[16]||(n[16]=w("div",{class:"flex items-center gap-x-2"},[w("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),w("div",P,[t.showModeToggle?(g(),h("div",R,[w("button",{type:"button",class:y(["mode-btn px-2 py-0.5 rounded",ee.value?"":"is-active"]),onClick:n[0]||(n[0]=e=>Xe("preview")),onMouseenter:n[1]||(n[1]=e=>Pe(e,b(l)("common.preview")||"Preview")),onFocus:n[2]||(n[2]=e=>Pe(e,b(l)("common.preview")||"Preview")),onMouseleave:Re,onBlur:Re},k(b(l)("common.preview")||"Preview"),35),w("button",{type:"button",class:y(["mode-btn px-2 py-0.5 rounded",ee.value?"is-active":""]),onClick:n[3]||(n[3]=e=>Xe("source")),onMouseenter:n[4]||(n[4]=e=>Pe(e,b(l)("common.source")||"Source")),onFocus:n[5]||(n[5]=e=>Pe(e,b(l)("common.source")||"Source")),onMouseleave:Re,onBlur:Re},k(b(l)("common.source")||"Source"),35)])):x("",!0),t.showCopyButton?(g(),h("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":i.value?b(l)("common.copied")||"Copied":b(l)("common.copy")||"Copy",onClick:Ue,onMouseenter:n[6]||(n[6]=e=>_e(e)),onFocus:n[7]||(n[7]=e=>_e(e)),onMouseleave:Re,onBlur:Re},[i.value?(g(),h("svg",V,[...n[13]||(n[13]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(g(),h("svg",U,[...n[12]||(n[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,_)):x("",!0),t.showExportButton&&xe.value?(g(),h("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":b(l)("common.export")||"Export",onClick:Qe,onMouseenter:n[8]||(n[8]=e=>Pe(e,b(l)("common.export")||"Export")),onFocus:n[9]||(n[9]=e=>Pe(e,b(l)("common.export")||"Export")),onMouseleave:Re,onBlur:Re},[...n[14]||(n[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:"action-icon"},[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,X)):x("",!0),t.showCollapseButton?(g(),h("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":F.value,onClick:Ve,onMouseenter:n[10]||(n[10]=e=>Pe(e,F.value?b(l)("common.expand")||"Expand":b(l)("common.collapse")||"Collapse")),onFocus:n[11]||(n[11]=e=>Pe(e,F.value?b(l)("common.expand")||"Expand":b(l)("common.collapse")||"Collapse")),onMouseleave:Re,onBlur:Re},[(g(),h("svg",{style:B({rotate:F.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:"action-icon"},[...n[15]||(n[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,Y)):x("",!0)])])):x("",!0),D(w("div",{ref_key:"bodyRef",ref:se,class:"d2-block-body",style:B(Ce.value)},[t.loading&&!De.value?(g(),h("div",$,[w("pre",q,[w("code",null,k(we.value),1)]),ne.value?(g(),h("p",z,k(ne.value),1)):x("",!0)])):(g(),h("div",G,[Me.value?(g(),h("div",J,[w("pre",K,[w("code",null,k(we.value),1)]),ne.value?(g(),h("p",Q,k(ne.value),1)):x("",!0)])):(g(),h("div",{key:1,class:"d2-render",style:B(Ee.value)},[w("div",{class:"d2-svg",innerHTML:le.value},null,8,W),ne.value?(g(),h("p",Z,k(ne.value),1)):x("",!0)],4))]))],4),[[M,!F.value]])],10,L))}}),[["__scopeId","data-v-3b434cf5"]]);ee.install=e=>{e.component(ee.__name,ee)};export{ee as default};
package/dist/index8.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,l=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,i=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&l(e,n,t[n]);if(r)for(var n of r(t))a.call(t,n)&&l(e,n,t[n]);return e},u=(e,r)=>t(e,n(r)),s=(e,t,n)=>l(e,"symbol"!=typeof t?t+"":t,n);import{defineComponent as c,ref as d,reactive as m,provide as f,computed as v,shallowRef as h,watch as g,nextTick as y,onMounted as k,onUpdated as p,onBeforeUnmount as b,openBlock as w,createElementBlock as S,normalizeClass as M,createElementVNode as x,normalizeStyle as B,Fragment as K,renderList as T,renderSlot as F,mergeProps as H,createBlock as q,unref as R,resolveDynamicComponent as A,toDisplayString as N,createCommentVNode as C,createTextVNode as P}from"vue";import{z as _,aa as j,a4 as I,X as z,a3 as O,a2 as $,a1 as L,a5 as E,ac as D,a0 as V,G as W}from"./exports.js";const Y=["data-markstream-item-key","data-markstream-item-kind"],G={key:0,class:"markstream-virtual-timeline__status"},X=.5,J=/* @__PURE__ */W(/* @__PURE__ */c(u(i({},{name:"MarkstreamVirtualTimeline"}),{__name:"MarkstreamVirtualTimeline",props:{items:{},threadKey:{},layoutRevision:{},getKey:{},getKind:{},getContent:{},getFinal:{},getRevision:{},estimateItemHeight:{},overscan:{default:4},overscanPx:{default:1200},stickToBottom:{type:[Boolean,String],default:"auto"},measurementKey:{},markdownMode:{default:"docs"},renderCodeBlocksAsPre:{type:Boolean},initialThreadState:{},markdownFade:{type:Boolean,default:!1},restoreMaxLoadingMs:{type:[Number,Boolean],default:!1},debug:{type:Boolean}},emits:["height-change","virtual-state-change","range-change","thread-state-change"],setup(e,{expose:t,emit:n}){const r=e,o=n;function a(e){o("thread-state-change",e)}function l(e){return"measured"===e||"final"===e}function c(e){return!0===(null==e?void 0:e.stable)&&function(e){var t,n,r,o;if(!e)return!1;const a=Number(e.nodeCount),l=Number(e.measuredCount),i=Math.max(0,Number(null!=(n=null==(t=e.liveRange)?void 0:t.start)?n:0)),u=Math.min(a,Math.max(i,Number(null!=(o=null==(r=e.liveRange)?void 0:r.end)?o:0))),s=Math.max(0,u-i);return!0===e.final&&"mixed"===e.confidence&&a>0&&l>0&&l<a&&(s<=0||l>=s)}(e)}const W=/* @__PURE__ */new Map;function J(e){var t;!0===r.debug&&W.set(e,(null!=(t=W.get(e))?t:0)+1)}const Q=d(null),U=d(0),Z=d(0),ee=d(0),te=d(!0),ne=d(!0),re=m(/* @__PURE__ */new Map),oe=/* @__PURE__ */new Map,ae=/* @__PURE__ */new Map,le=/* @__PURE__ */new Map,ie=/* @__PURE__ */new Map,ue=/* @__PURE__ */new Set,se=m(/* @__PURE__ */new Map),ce=m(/* @__PURE__ */new Map),de=/* @__PURE__ */new Map,me=/* @__PURE__ */new Map,fe=/* @__PURE__ */new Map,ve=/* @__PURE__ */new Map,he=d(!1),ge=d(!0),ye=d(!0);f("markstreamHostScrollManaged",ye);const ke=[0,80,180,360,640];let pe,be,we=null,Se=null,Me=0,xe=null,Be=[],Ke=null,Te=null,Fe=-1,He=0,qe=null,Re=!1,Ae=!1,Ne=null,Ce=0,Pe=0,_e={top:0,bottom:0},je=!1;const Ie=v(()=>null==r.threadKey?void 0:String(r.threadKey));let ze=Ie.value;const Oe=v(()=>{return"chat"===(e=r.markdownMode)||"minimal"===e||"docs"===e?e:"docs";var e}),$e=v(()=>!0===r.renderCodeBlocksAsPre),Le=v(()=>[null==r.measurementKey?"":String(r.measurementKey),ee.value].join(":")),Ee=v(()=>{const e=$e.value?"pre":"rich";return`${Le.value}${Oe.value}${e}`});class De{constructor(e){s(this,"tree"),s(this,"total"),this.tree=Array.from({length:e.length+1},()=>0),this.total=0,e.forEach((e,t)=>this.add(t,e))}add(e,t){if(Number.isFinite(t)&&0!==t){this.total+=t;for(let n=e+1;n<this.tree.length;n+=n&-n)this.tree[n]+=t}}prefixSum(e){let t=Math.max(0,Math.min(e,this.tree.length-1)),n=0;for(;t>0;)n+=this.tree[t],t-=t&-t;return n}lowerBound(e,t="gte"){const n=this.tree.length-1;if(n<=0)return 0;if(e<=0)return 0;if(e>=this.total)return n-1;let r=0,o=1;for(;o<<1<this.tree.length;)o<<=1;let a=0;for(;o>0;o>>=1){const n=r+o;if(n<this.tree.length){const o=a+this.tree[n];("gt"===t?o<=e:o<e)&&(r=n,a=o)}}return Math.min(r,n-1)}}const Ve=h([]),We=/* @__PURE__ */new Map,Ye=h(new De([])),Ge=d(0);let Xe=[];const Je=v(()=>(Ge.value,{records:Ve.value,totalHeight:Ye.value.total}));function Qe(){var e;const t=[],n=[],o=function(){var e;return null!=(e=Ie.value)?e:"timeline"}();We.clear();for(let a=0;a<r.items.length;a++){const l=r.items[a],s=at(l,a),c={item:l,index:a,key:s,kind:I(l,a,r),markdown:j(l,a,r)};let d=pt(c);null==d&&(d=null!=(e=Xe[a])?e:z(l,a,r));const m=u(i({},c),{renderKey:`${o}:${s}`,offset:0,size:d,component:null==l?void 0:l.component});t.push(m),n.push(d),We.has(s)||We.set(s,m)}Ve.value=t,Ye.value=new De(n),Xe=[],Ge.value+=1}function Ue(e){return Ge.value,Ye.value.prefixSum(e.index)}function Ze(e){return u(i({},e),{offset:Ue(e)})}function et(e,t){const n=We.get(e);if(!n)return;const r=Math.ceil(t),o=r-n.size;0!==o&&(n.size=r,Ye.value.add(n.index,o),Ge.value+=1)}function tt(e,t="gte"){return Ge.value,Ye.value.lowerBound(e,t)}const nt=v(()=>{var e;return Math.max(0,null!=(e=r.overscan)?e:4)}),rt=v(()=>{var e;const t=Math.max(0,null!=(e=r.overscanPx)?e:1200);return ge.value?t:Math.min(t,160)}),ot=v(()=>{var e,t,n;const r=Je.value.records;if(0===r.length)return{start:0,end:0,records:[],topSpacerHeight:0,bottomSpacerHeight:0};const o=nt.value,a=rt.value,l=Nt(),i=l+Math.max(1,Z.value);let u=tt(Math.max(0,l-a),"gt"),s=tt(Math.min(Je.value.totalHeight,i+a))+1;u=Math.max(0,u-o),s=Math.min(r.length,Math.max(s+o,u+1));const c=r.slice(u,s).map(Ze),d=c[0],m=c[c.length-1],f=null!=(e=null==d?void 0:d.offset)?e:0,v=null!=(t=null==m?void 0:m.offset)?t:0;return{start:u,end:s,records:c,topSpacerHeight:f,bottomSpacerHeight:Math.max(0,Je.value.totalHeight-(v+(null!=(n=null==m?void 0:m.size)?n:0)))}});function at(e,t){return O(e,t,r)}const lt=/* @__PURE__ */new WeakMap;let it=1;function ut(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return String(null!=e?e:"");const t=e;let n=lt.get(t);return n||(n=it++,lt.set(t,n)),String(n)}function st(e,t,n){var o;if(n)return"";const a="string"==typeof(null==e?void 0:e.text)?e.text:"string"==typeof(null==e?void 0:e.message)?e.message:"string"==typeof(null==e?void 0:e.label)?e.label:String(null!=(o=L(e,t,r))?o:"");return a?`${a.length}:${function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}(a)}`:""}function ct(e,t){if("function"!=typeof r.estimateItemHeight)return"";const n=r.estimateItemHeight(e,t);if(!Number.isFinite(n)||n<=0)return"";const o=Math.ceil(n);return Xe[t]=o,String(o)}function dt(e){var t;return null!=(t=r.items[e.index])?t:e.item}function mt(e){return e.item}function ft(e){var t;const n=dt(e);return null!=(t=null==n?void 0:n.component)?t:e.component}function vt(e,t=Ie.value){const n=mt(e),o=E(n,e.index,r);return[null!=t?t:"timeline",e.key,null==o?"":String(o)].join(":")}function ht(e,t=Ie.value){if(e.markdown)return vt(e,t);const n=mt(e),o=E(n,e.index,r);return[null!=t?t:"timeline",e.key,null==o?"":String(o)].join(":")}function gt(e){return{sourceKey:ht(e),measurementKey:e.markdown?Ee.value:Le.value,widthBucket:ee.value}}function yt(e,t){var n,r,o,a,l,i;return(null!=(n=null==e?void 0:e.sourceKey)?n:"")===(null!=(r=null==t?void 0:t.sourceKey)?r:"")&&(null!=(o=null==e?void 0:e.measurementKey)?o:"")===(null!=(a=null==t?void 0:t.measurementKey)?a:"")&&(null!=(l=null==e?void 0:e.widthBucket)?l:0)===(null!=(i=null==t?void 0:t.widthBucket)?i:0)}function kt(e,t,n=Ie.value){var r;return!(!e||!t)&&t.sourceKey===ht(e,n)&&t.measurementKey===(e.markdown?Ee.value:Le.value)&&(null!=(r=t.widthBucket)?r:0)===ee.value}function pt(e,t=Ie.value){const n=re.get(e.key);return kt(e,oe.get(e.key),t)&&Number.isFinite(n)&&n>0?n:null}function bt(e){return Je.value,We.get(e)}function wt(e,t){var n,r;return!!(e&&e.markdown&&t)&&t.sessionKey===vt(e)&&(null!=(n=t.threadKey)?n:"")===(null!=(r=Ie.value)?r:"")&&!!function(e){const t=Ee.value,n=null!=e?e:"";return n===t||n.startsWith(`${t}\0`)}(t.measurementKey)}function St(e,t){return wt(e,t)}function Mt(e,t,n){!Number.isFinite(t)||t<=0||(ce.set(e,Math.ceil(t)),de.set(e,n))}function xt(e,t=se.get(e)){const n=function(e,t=se.get(e)){var n;if(!St(bt(e),t))return 0;const r=Number(null==(n=null==t?void 0:t.metrics)?void 0:n.totalHeight);return Number.isFinite(r)&&r>0?Math.ceil(r):0}(e,t);return n>0&&Mt(e,n,t),n}function Bt(e){var t;return wt(bt(e),de.get(e))?null!=(t=ce.get(e))?t:0:xt(e)}function Kt(e){return e===Me&&He===e&&!ge.value}function Tt(){if(null!=xe&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(xe),xe=null,null!=Ke&&"undefined"!=typeof window&&window.clearTimeout(Ke),Ke=null,"undefined"!=typeof window)for(const e of Be)window.clearTimeout(e);Be=[]}function Ft(){var e;return Math.max(0,Z.value||(null==(e=Q.value)?void 0:e.clientHeight)||0)}function Ht(){const e=Q.value;if(!e||"function"!=typeof getComputedStyle)return void(_e={top:0,bottom:0});const t=getComputedStyle(e),n=Number.parseFloat(t.paddingTop)||0,r=Number.parseFloat(t.paddingBottom)||0;_e={top:n,bottom:r}}function qt(){return _e.top}function Rt(){const e=_e;return Math.max(0,Je.value.totalHeight+e.top+e.bottom)}function At(){var e,t;return Math.max(Rt(),null!=(t=null==(e=Q.value)?void 0:e.scrollHeight)?t:0)}function Nt(){return Math.max(0,U.value-qt())}function Ct(){return Math.max(0,At()-Ft())}function Pt(e){const t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(t,Ct())):0}function _t(){return Math.max(0,Ct()-U.value)}function jt(){const e=_t();ne.value=e<=2,!0!==r.stickToBottom?!1!==r.stickToBottom?te.value=e<=48:te.value=!1:te.value=!0}function It(){var e,t;const n=null!=(t=null==(e=Q.value)?void 0:e.clientWidth)?t:0;ee.value=Number.isFinite(n)&&n>0?32*Math.round(n/32):0}function zt(e={}){const t=Q.value;t&&(U.value=Math.max(0,t.scrollTop||0),Z.value=t.clientHeight||0),It(),jt(),(!0===e.remember||!1!==e.remember&&!he.value)&&hn()}function Ot(e,t={}){const n=Pt(e),o=Q.value;if(U.value=n,o&&(Z.value=o.clientHeight||Z.value||0,!1!==t.writeDom&&Math.abs((o.scrollTop||0)-n)>X)){const e={target:n,preserveBottomPin:!1!==r.stickToBottom&&Math.abs(Ct()-n)<=2};Se=ge.value?e:null,o.scrollTop=n,e.target=Math.max(0,o.scrollTop||0)}It(),!1!==t.updatePinned&&jt(),(!0===t.remember||!1!==t.remember&&!he.value)&&fn()}function $t(){if(!ge.value){Se=null;const e=Q.value,t=qe;return e&&null!=t&&Math.abs((e.scrollTop||0)-t)>X&&(e.scrollTop=t),void kn(He,be)}const e=Q.value,t=Se,n=Math.max(0,(null==e?void 0:e.scrollTop)||0);return e&&t&&Math.abs(n-t.target)<=X&&t.preserveBottomPin&&!1!==r.stickToBottom||e&&ne.value&&"auto"===r.stickToBottom&&(Math.abs(Ct()-n)<=2||n>=U.value-X)||!0===r.stickToBottom?(te.value=!0,ne.value=!0,void Ot(Ct(),{writeDom:!0,remember:!1})):(Se=null,void zt())}function Lt(e){Ot(e,{writeDom:!0,remember:!0})}function Et(){Lt(Ct())}function Dt(e,t){const n=ae.get(e);if(!Number.isFinite(n)||null==n||n<=0)return 0;const r=le.get(e);return t&&r&&!Vt(r,t)?0:Math.ceil(n)}function Vt(e,t){var n,r,o,a;return e.sourceKey===t.sourceKey&&(0===(null!=(n=t.widthBucket)?n:0)||0===(null!=(r=e.widthBucket)?r:0)||(null!=(o=t.widthBucket)?o:0)===(null!=(a=e.widthBucket)?a:0))&&(Wt(t.measurementKey)||Wt(e.measurementKey)||t.measurementKey===e.measurementKey)}function Wt(e){return":0"===e||!0===(null==e?void 0:e.startsWith(":0"))}function Yt(e){ae.delete(e),le.delete(e),ie.delete(e),ue.delete(e)}function Gt(e,t,n,o={}){if(!Number.isFinite(t)||t<=0)return;const a=re.get(e),l=n&&!yt(oe.get(e),n),i=!0===o.releaseRestoredFloor;!function(e,t){if(!t)return;const n=le.get(e);n&&!Vt(n,t)&&(ae.delete(e),le.delete(e),ie.delete(e),ue.delete(e))}(e,n),i&&Yt(e);const u=Dt(e,n),s=u>0?u:Math.ceil(t);if(null!=a&&Math.abs(a-s)<=1&&!l)return void(i&&(Ge.value+=1));if(!1===o.updateLayout)return n&&oe.set(e,n),re.set(e,s),void hn(o.rememberThreadKey);if(he.value)return n&&oe.set(e,n),re.set(e,s),et(e,s),void function(e=He,t=be){t&&y(()=>{kn(e,t),null==xe&&"function"==typeof requestAnimationFrame&&(xe=requestAnimationFrame(()=>{xe=null,kn(e,t)}))})}();const c=(d=dn(),m=_t(),!0===r.stickToBottom?{type:"bottom",distanceFromBottomPx:0}:"auto"===r.stickToBottom&&te.value?{type:"bottom",distanceFromBottomPx:ne.value?0:Math.max(0,m)}:d);var d,m;n&&oe.set(e,n),re.set(e,s),et(e,s),hn(o.rememberThreadKey),function(e){if(!Xt.scheduled)return Xt.anchor=e,Xt.scheduled=!0,void(Xt.raf=Zt(tn));!Xt.anchor&&e&&(Xt.anchor=e)}(c)}g([()=>function(){const e=r.layoutRevision;return null!=e?["explicit",String(e),r.items.length].join(""):r.items.map((e,t)=>{var n;const o=at(e,t),a=j(e,t,r);return[o,I(e,t,r),a?1:0,null!=(n=E(e,t,r))?n:"",ct(e,t),st(e,t,a),(l=null==e?void 0:e.component,l?"string"==typeof l?`s:${l}`:`o:${ut(l)}`:"")].join("");var l}).join("\0")}(),Le,Ee,Ie,()=>ut(r.estimateItemHeight),()=>ut(r.getKey),()=>ut(r.getKind),()=>ut(r.getContent),()=>ut(r.getFinal),()=>ut(r.getRevision)],()=>Qe(),{immediate:!0,flush:"sync"});const Xt={scheduled:!1,raf:null,anchor:void 0},Jt=/* @__PURE__ */new Map;let Qt=!1,Ut=null;function Zt(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):(y(e),null)}function en(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function tn(){if(!Xt.scheduled)return;Xt.scheduled=!1,Xt.raf=null;const e=Xt.anchor;Xt.anchor=void 0;const t="bottom"===(null==e?void 0:e.type)&&e.distanceFromBottomPx<=2&&ne.value;e&&yn(e);const n=Q.value,r=!n||Math.abs((n.scrollTop||0)-U.value)<=X;t&&!r||zt({remember:!1})}function nn(){var e,t;if(!Qt)return;Qt=!1,Ut=null;const n=Array.from(Jt.entries());Jt.clear();for(const[r,o]of n){if(ce.get(r)!==o.logicalHeight)continue;const n=We.get(r);if(!n)continue;const a=(null!=(e=o.threadKey)?e:"")===(null!=(t=Ie.value)?t:"");an(n,{allowMarkdownShrink:o.allowMarkdownShrink,allowRestoredFloorShrink:o.allowRestoredFloorShrink,markdownLogicalHeight:o.logicalHeight,rememberThreadKey:o.threadKey,source:o.itemSizeSource,updateLayout:a})}tn()}function rn(){nn(),tn()}function on(e){var t;null==(t=fe.get(e))||t.disconnect(),fe.delete(e),me.delete(e)}function an(e,t={}){var n,o,a;const l=(s=e.key,D(me.get(s),J));var s;const c=null!=(n=t.source)?n:gt(e);let d=!1;const m=()=>{d||(d=!0,function(e,t){const n=function(){if(!0!==r.debug||0===W.size)return null;let e=0;for(const n of W.values())e+=n;const t={total:e,byLabel:Object.fromEntries(Array.from(W.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])))};return W.clear(),t}();n&&console.info("[markstream-vue][timeline][perf] layout-reads",{label:e,itemKey:t,layoutReads:n})}("reconcileRecordSize",e.key))};if(!e.markdown)return l>0&&Gt(e.key,l,c,t),void m();const f=yt(oe.get(e.key),c)&&null!=(o=re.get(e.key))?o:0,v=null!=(a=t.markdownLogicalHeight)?a:Bt(e.key),h=function(e,t){return V(me.get(e),J,t)}(e.key,l);if(v>0){let n=Math.max(l,v+h);(!t.allowMarkdownShrink||he.value)&&f>0&&(n=Math.max(n,f));const o=Dt(e.key,c),a=o>0&&n>o+1&&(!$(dt(e),e.index,r)||!0===t.allowRestoredFloorShrink);return e.markdown&&o>0&&(!0===t.allowRestoredFloorShrink||a)?he.value?ue.add(e.key):t=u(i({},t),{releaseRestoredFloor:!0}):t.allowMarkdownShrink&&!he.value&&(o<=0||t.allowRestoredFloorShrink&&function(e,t,n){const r=ie.get(e);return!Number.isFinite(r)||null==r||r<=0||t+Math.max(0,n-r)<n-1}(e.key,v,o))&&Yt(e.key),n>0&&Gt(e.key,n,c,t),void m()}return String(L(dt(e),e.index,r)).trim()?f>0?(l>f+1&&Gt(e.key,l,c,t),void m()):(l>0&&Gt(e.key,l,c,t),void m()):(l>0&&(Yt(e.key),Gt(e.key,l,c,t)),void m())}function ln(e){return t=>{!function(e,t){const n=function(e){const t=e&&"$el"in e?e.$el:e;return t instanceof HTMLElement?t:null}(t),r=me.get(e.key);if(!n)return void on(e.key);if(r===n)return void an(e);if(on(e.key),me.set(e.key,n),an(e),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(()=>{an(e)});o.observe(n),fe.set(e.key,o)}(e,t)}}function un(e){const t=dt(e),n=$(t,e.index,r),a=se.get(e.key),s=Oe.value,d={enabled:!0,sessionKey:vt(e),threadKey:Ie.value,scrollRoot:()=>Q.value,restoreState:St(e,a)?a:null,restoreAnchor:!1,measurementKey:Ee.value,settleMode:"manual",settledToken:n,emitIntervalMs:96,heightDiffThresholdPx:4};return u(i({content:L(t,e.index,r),final:n,mode:s,renderCodeBlocksAsPre:$e.value},n?{nodeVirtual:"auto",maxLiveNodes:50,liveNodeBuffer:16}:{}),{fade:!0===r.markdownFade,indexKey:vt(e),virtualScroll:d,onHeightChange(t){if(t.sessionKey!==vt(e))return;Mt(e.key,t.totalHeight,{sessionKey:t.sessionKey,threadKey:Ie.value,measurementKey:Ee.value});const n=function(e){return"final"===e.phase||!(!0!==e.final||!l(e.confidence))||!!e.stable&&(l(e.confidence)||c(e))}(t),r=function(e){return"final"===e.phase||!!e.stable&&(l(e.confidence)||c(e))}(t),a=Math.ceil(t.totalHeight);var i;!function(e,t){Jt.set(e.key,t),Qt||(Qt=!0,Ut=Zt(nn))}(e,{allowMarkdownShrink:n,allowRestoredFloorShrink:r,itemSizeSource:gt(e),logicalHeight:a,threadKey:Ie.value}),i={itemKey:e.key,metrics:t},o("height-change",i)},onVirtualStateChange(t){var n;t.sessionKey===vt(e)&&(se.set(e.key,t),xt(e.key,t),hn(),n={itemKey:e.key,state:t},o("virtual-state-change",n))}})}function sn(e){return{item:dt(e),index:e.index,itemKey:e.key,kind:e.kind,measureRef:ln(e),markdownProps:un(e)}}function cn(e){var t;const n=null!=(t=dt(e))?t:{};return"string"==typeof n.text?n.text:"string"==typeof n.message?n.message:"string"==typeof n.label?n.label:L(n,e.index,r)}function dn(){const e=_t();if(e<=2)return{type:"bottom",distanceFromBottomPx:Math.max(0,e)};const t=Nt(),n=tt(t,"gt"),r=Je.value.records[n];if(r){const e=Ue(r);if(t>=e&&t<e+r.size)return{type:"item",itemKey:r.key,offsetWithinItemPx:t-e}}const o=ot.value.records[0];return o?{type:"item",itemKey:o.key,offsetWithinItemPx:0}:void 0}function mn(e=Ie.value){rn();const t={},n={};for(const r of Je.value.records){const o=pt(r,e),a=oe.get(r.key);null!=o&&kt(r,a,e)&&(t[r.key]=o,n[r.key]=a)}return{threadKey:e,measurementKey:Le.value,widthBucket:ee.value,outerAnchor:dn(),itemHeights:t,itemSizeSources:n,markdownStates:Object.fromEntries(se.entries())}}function fn(e=Ie.value){if(!e)return;const t=mn(e);return ve.set(e,t),e===Ie.value&&(Ne=t),a(t),t}function vn(){const e=pe;return null!=Te&&"undefined"!=typeof window&&window.clearTimeout(Te),Te=null,pe=void 0,e?fn(e):void 0}function hn(e=Ie.value){e&&(pe=e,null==Te&&("undefined"!=typeof window?Te=window.setTimeout(()=>{Te=null,vn()},80):vn()))}function gn(e){if(!e)return null;if("bottom"===e.type)return(ge.value?At():Rt())-Ft()-Math.max(0,e.distanceFromBottomPx);const t=bt(e.itemKey);return t?qt()+Ue(t)+Math.max(0,e.offsetWithinItemPx):null}function yn(e,t={}){const n=gn(e);return null!=n&&(Ot(n,{writeDom:!0,remember:!0===t.remember}),!0)}function kn(e,t){if(e===Me){if(t){const e=yn(t,{remember:!1});qe=e?U.value:null}zt({remember:!1})}}function pn(e,t){const n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>t.top&&n.top<t.bottom}function bn(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.bottom>r.top&&n.top<r.bottom}function wn(e){if(e.closest(".code-editor-container.is-hidden"))return!1;let t=e;for(;t;){const e=window.getComputedStyle(t);if("none"===e.display||"hidden"===e.visibility||Number.parseFloat(e.opacity||"1")<=.01)return!1;t=t.parentElement}const n=e.getBoundingClientRect();return n.width>0&&n.height>0}function Sn(e){if(!e)return!1;if(e.classList.contains("is-fading-out"))return!1;const t=window.getComputedStyle(e);if("none"===t.display||Number.parseFloat(t.opacity||"1")<=.01)return!1;const n=e.getBoundingClientRect();return n.width>0&&n.height>0}function Mn(e){return Array.from(e.querySelectorAll(['[data-markstream-pending="true"]','[data-markstream-mermaid][data-markstream-mode="pending"]','.mermaid-block-container[data-markstream-mode="pending"]','[data-markstream-code-loading="1"]'].join(","))).some(e=>!e.matches('[data-markstream-code-block="1"]')||!Sn(e.querySelector("pre.code-pre-fallback")))}function xn(e){var t;if(e.querySelector(":scope > .node-placeholder"))return!1;const n=e.querySelector(":scope > .node-content");return!!n&&(!Mn(n)&&(!!function(e){const t=Array.from(e.querySelectorAll("[data-markstream-math]"));return!t.length||t.every(e=>{const t=e.dataset.markstreamMode;return!("true"===e.dataset.markstreamPending||"loading"===t||"katex"!==t&&"fallback"!==t)})}(n)&&("code_block"===(null!=(t=e.dataset.nodeType)?t:"")?function(e){if(e.querySelector('[data-markstream-code-loading="1"]'))return!1;const t=e.querySelector('[data-markstream-code-block="1"]');if(t){const e="true"===t.dataset.markstreamEnhanced,r=Sn(t.querySelector("pre.code-pre-fallback"));return e||r||(n=t,Array.from(n.querySelectorAll("diffs-container, .stream-diffs-shell, .stream-diffs-surface")).some(wn))}var n;return function(e){var t,n;const r=e.querySelector("[data-markstream-mermaid], .mermaid-block-container");if(r){if("true"===r.dataset.markstreamPending)return!1;const e=r.dataset.markstreamMode;return"preview"===e?Boolean(r.querySelector("svg")||r.querySelector('[data-mermaid-svg-layer="1"] svg')):"fallback"===e&&Boolean(null==(n=null==(t=r.querySelector(".mermaid-source-code"))?void 0:t.textContent)?void 0:n.trim())}const o=e.querySelector("[data-markstream-infographic], .infographic-block-container");if(o)return"true"!==o.dataset.markstreamPending;const a=e.querySelector("[data-markstream-d2], .d2-block-container");return a?"true"!==a.dataset.markstreamPending:Boolean(e.querySelector('pre[data-markstream-pre="1"]'))}(e)}(n):function(e){var t;return(null!=(t=e.textContent)?t:"").trim().length>0||Boolean(e.querySelector(["hr","br","table","blockquote","img","svg","canvas","input","button","select","textarea","[role]","[aria-label]","[data-markstream-math]","[data-markstream-mermaid]","[data-markstream-infographic]","[data-markstream-d2]",'[data-markstream-pre="1"]'].join(",")))}(n))))}function Bn(e,t){var n;if(!e.markdown)return!0;const o=L(dt(e),e.index,r);if(!String(null!=o?o:"").trim())return!0;if(t.querySelector("[data-node-index]"))return!0;const a=t.querySelector(".markdown-renderer"),l=null!=a?a:t;return!Mn(l)&&(!!(null!=(n=l.textContent)?n:"").trim()||Boolean(l.querySelector(["hr","br","table","blockquote","img","svg","canvas","input","button","[role]","[aria-label]","[data-markstream-math]","[data-markstream-mermaid]","[data-markstream-infographic]","[data-markstream-d2]",'[data-markstream-pre="1"]','[data-markstream-code-block="1"]'].join(","))))}function Kn(e,t,n){if(!e.markdown)return!0;const o=L(dt(e),e.index,r);if(!String(null!=o?o:"").trim())return!0;const a=n.getBoundingClientRect(),l=Array.from(t.querySelectorAll("[data-node-index]")).filter(e=>pn(e,a));if(l.length>0)return l.every(e=>xn(e));const i=t.querySelector(".markdown-renderer"),u=null!=i?i:t;return u.querySelector("[data-node-index], .node-placeholder")?!!function(e,t,n,r){if(!Tn(e))return!1;const o=n.getBoundingClientRect(),a=t.getBoundingClientRect();return o.width>0&&o.height>0&&o.bottom<=r.top+1&&a.bottom>r.top}(e,t,u,a)&&Bn(e,t):Bn(e,t)}function Tn(e){const t=oe.get(e.key);return Dt(e.key,t)>0}function Fn(e,t){var n,o,a,i;if(!e.markdown)return!0;if(!Re&&!Ae)return!0;if(Tn(e))return!0;const u=L(dt(e),e.index,r);if(!String(null!=u?u:"").trim())return!0;if(!t.querySelector(".markdown-renderer"))return!1;const s=se.get(e.key);if(!St(e,s))return!1;const d=null==s?void 0:s.metrics,m=Number(null!=(n=null==d?void 0:d.totalHeight)?n:0);if(!Number.isFinite(m)||m<=0)return!1;const f=Number(null!=(o=null==d?void 0:d.measuredCount)?o:0),v=Number(null!=(a=null==d?void 0:d.estimatedCount)?a:0),h=Number(null!=(i=null==d?void 0:d.nodeCount)?i:0),g=h<=0||f>=h&&v<=0,y=l(null==d?void 0:d.confidence),k=c(d),p=!0===(null==d?void 0:d.stable)||y||k;return Ae?!0===(null==d?void 0:d.final)&&(g&&y||k):p||!0===(null==d?void 0:d.final)}function Hn(){const e=Q.value;if(!e)return!1;const t=gn(be);if(null!=t&&Math.abs((e.scrollTop||0)-Pt(t))>X)return!1;const n=ot.value.records;if(!n.length)return 0===Je.value.records.length;const r=new Map(Array.from(e.querySelectorAll("[data-markstream-item-key]")).map(e=>{var t;return[null!=(t=e.dataset.markstreamItemKey)?t:"",e]})),o=[];for(const i of n){const t=r.get(i.key);t&&bn(t,e)&&o.push({record:i,el:t})}if(!o.length)return!1;for(const{record:i,el:u}of o){if(u.offsetHeight+1<i.size)return!1;if(!Kn(i,u,e))return!1;if(!Fn(i,u))return!1}const a=e.getBoundingClientRect();if(Array.from(e.querySelectorAll(['[data-markstream-pending="true"]','[data-markstream-mermaid][data-markstream-mode="pending"]','.mermaid-block-container[data-markstream-mode="pending"]','[data-markstream-code-loading="1"]'].join(","))).some(e=>!(!pn(e,a)||e.matches('[data-markstream-code-block="1"]')&&Sn(e.querySelector("pre.code-pre-fallback")))))return!1;const l=Array.from(e.querySelectorAll("[data-node-index]")).filter(e=>pn(e,a));for(const i of l)if(!xn(i))return!1;return!0}function qn(){const e=Q.value;if(!e)return"";const t=e.getBoundingClientRect(),n=new Map(Array.from(e.querySelectorAll("[data-markstream-item-key]")).map(e=>{var t;return[null!=(t=e.dataset.markstreamItemKey)?t:"",e]})),r=ot.value.records.map(e=>{var t,r,o,a,l,i,u,s,c;const d=n.get(e.key),m=null==d?void 0:d.querySelector(".markdown-renderer"),f=null==(t=se.get(e.key))?void 0:t.metrics;return[e.key,e.size,null!=(r=null==d?void 0:d.offsetHeight)?r:0,null!=(o=null==d?void 0:d.scrollHeight)?o:0,null!=(a=null==m?void 0:m.offsetHeight)?a:0,null!=(l=null==m?void 0:m.scrollHeight)?l:0,f?Math.round(Number(f.totalHeight||0)):"",null!=(i=null==f?void 0:f.measuredCount)?i:"",null!=(u=null==f?void 0:f.estimatedCount)?u:"",null!=(s=null==f?void 0:f.nodeCount)?s:"",!0===(null==f?void 0:f.final)?1:0,!0===(null==f?void 0:f.stable)?1:0,null!=(c=null==f?void 0:f.confidence)?c:""].join(":")}).join("|"),o=Array.from(e.querySelectorAll("[data-node-index]")).filter(e=>pn(e,t)).map(e=>{var t,n,r,o,a;const l=e.getBoundingClientRect(),i=e.querySelector(":scope > .node-content"),u=null==i?void 0:i.querySelector('[data-markstream-code-block="1"]'),s=null==i?void 0:i.querySelector("pre.code-pre-fallback"),c=null==i?void 0:i.querySelector("diffs-container, .stream-diffs-shell");return[null!=(t=e.dataset.nodeIndex)?t:"",null!=(n=e.dataset.nodeType)?n:"",Math.round(l.height),null!=(r=null==i?void 0:i.offsetHeight)?r:0,null!=(o=null==i?void 0:i.scrollHeight)?o:0,null!=(a=null==u?void 0:u.dataset.markstreamEnhanced)?a:"",u?Math.round(u.getBoundingClientRect().height):0,s?Math.round(s.getBoundingClientRect().height):0,c?Math.round(c.getBoundingClientRect().height):0].join(":")}).join("|");return[Math.round(e.scrollTop||0),Math.round(e.scrollHeight||0),Math.round(Je.value.totalHeight||0),r,o].join("\n")}function Rn(){return"undefined"!=typeof performance?performance.now():Date.now()}function An(){return Ae?24:2}function Nn(e){Kt(e)&&Ce!==e&&(Ce=e,function(e){return t=this,n=function*(){const t=Rn();let n=0,r="";for(let o=0;o<40;o++){if(yield y(),yield new Promise(e=>{"function"!=typeof requestAnimationFrame?e():requestAnimationFrame(()=>e())}),!Kt(e))return!1;kn(e,be);const o=Rn(),a=Hn(),l=a?qn():"";if(a&&l===r&&l){if(n+=1,n>=An()&&o-t>=96)return!0}else n=0,r=l}return!1},new Promise((e,r)=>{var o=e=>{try{l(n.next(e))}catch(t){r(t)}},a=e=>{try{l(n.throw(e))}catch(t){r(t)}},l=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,a);l((n=n.apply(t,null)).next())});var t,n}(e).then(t=>{if(Ce===e&&(Ce=0),Kt(e))return t?void In(e):function(){if(Fe<0)return!1;const e=function(){if(!1===r.restoreMaxLoadingMs)return Number.POSITIVE_INFINITY;const e=Number(r.restoreMaxLoadingMs);return Number.isFinite(e)&&e>0?e:Number.POSITIVE_INFINITY}();return Number.isFinite(e)&&Rn()-Fe>=e}()?(!0===r.debug&&import.meta,void In(e)):(function(e){Pe!==e&&(Pe=e,!0===r.debug&&import.meta)}(e),void function(e){Kt(e)&&"undefined"!=typeof window&&(null!=Ke&&window.clearTimeout(Ke),Ke=window.setTimeout(()=>{Ke=null,Kt(e)&&Nn(e)},120))}(e))}))}function Cn(){ge.value=!0,Fe=-1,Ce=0,Pe=0,Re=!1,Ae=!1,null!=Ke&&"undefined"!=typeof window&&window.clearTimeout(Ke),Ke=null}function Pn(){je=!0}function _n(e){var t,n;const r=[];if(!function(e){var t,n;return!!e&&(null!=(t=e.measurementKey)?t:"")===Le.value&&(null!=(n=e.widthBucket)?n:0)===ee.value}(e))return r;for(const[o,a]of Object.entries(null!=(t=null==e?void 0:e.itemHeights)?t:{})){if(!Number.isFinite(a)||a<=0)continue;const t=bt(o),l=null==(n=null==e?void 0:e.itemSizeSources)?void 0:n[o];kt(t,l)&&r.push([o,Math.ceil(a),l])}return r}function jn(e){var t;for(const[n,r]of Object.entries(null!=(t=null==e?void 0:e.markdownStates)?t:{}))if(St(bt(n),r))return!0;return!1}function In(e){if(e!==Me)return;nn();const t=new Set(ue);Tt(),kn(e,be),he.value=!1,Fe=-1,be=void 0,qe=null,He=0;for(const n of Je.value.records)n.markdown&&!t.has(n.key)||Yt(n.key);for(const n of t){const e=We.get(n);e?an(e,{allowMarkdownShrink:!0,allowRestoredFloorShrink:!0,markdownLogicalHeight:Bt(e.key),source:gt(e),updateLayout:!0}):Yt(n)}ue.clear(),tn(),zt({remember:!1}),Cn(),Pn()}function zn(e,t={}){var n;const o=++Me;Se=null,(null==e?void 0:e.widthBucket)&&0===ee.value&&(ee.value=e.widthBucket);const a=null==e?void 0:e.outerAnchor,l=function(e){return Boolean((null==e?void 0:e.outerAnchor)||_n(e).length>0||jn(e))}(e),i=jn(e),u=!(!je&&!0!==t.threadSwitch||l),s=l||u,c=null!=a?a:s?function(){if(!1!==r.stickToBottom)return{type:"bottom",distanceFromBottomPx:0};const e=Je.value.records[0];return e?{type:"item",itemKey:e.key,offsetWithinItemPx:0}:void 0}():void 0;Tt(),Ce=0,Pe=0,ge.value=!s,he.value=s&&Boolean(c),He=o,be=c,Re=s&&i,Ae=s&&u,Fe=he.value?Rn():-1,On(),re.clear(),oe.clear(),ae.clear(),le.clear(),ie.clear(),ue.clear(),se.clear(),ce.clear(),de.clear();for(const[r,m,f]of _n(e)){const e=Math.ceil(m);oe.set(r,f),re.set(r,e),ae.set(r,e),le.set(r,f)}for(const[r,m]of Object.entries(null!=(n=null==e?void 0:e.markdownStates)?n:{})){se.set(r,m);const e=xt(r,m);e>0&&ie.set(r,e)}Qe(),!0===r.stickToBottom?(te.value=!0,ne.value=!0):!1===r.stickToBottom?(te.value=!1,ne.value=!1):(te.value="bottom"===(null==c?void 0:c.type),ne.value="bottom"===(null==c?void 0:c.type)&&c.distanceFromBottomPx<=2);const d=gn(c);return qe=null==d?null:Pt(d),null!=d&&Ot(d,{writeDom:!0,remember:!1,updatePinned:!1}),Ne=(null==e?void 0:e.threadKey)===Ie.value?e:null,s?c?void y(()=>{kn(o,c),"undefined"!=typeof window?(ke.forEach(e=>{const t=window.setTimeout(()=>{kn(o,c)},e);Be.push(t)}),Nn(o)):In(o)}):(he.value=!1,be=void 0,qe=null,He=0,zt({remember:!1}),Cn(),void Pn()):(he.value=!1,be=void 0,qe=null,He=0,zt({remember:!1}),Cn(),Pn(),void(!1!==r.stickToBottom&&(te.value=!0,ne.value=!0,y(()=>{he.value||Et()}))))}function On(){for(const e of fe.values())e.disconnect();fe.clear(),me.clear()}return g(Ie,(e,t)=>{const n=null!=ze?ze:t,o=Boolean(n&&n!==e);o&&function(e){var t;rn(),(null==(t=vn())?void 0:t.threadKey)!==e&&((null==Ne?void 0:Ne.threadKey)===e?(ve.set(e,Ne),a(Ne)):ve.has(e)||fn(e))}(n),ze=e,zn(function(e){return(e?ve.get(e):null)||function(e){var t;const n=r.initialThreadState;return n?(null!=(t=n.threadKey)?t:"")!==(null!=e?e:"")?null:n:null}(e)}(e),{threadSwitch:o})},{immediate:!0,flush:"sync"}),g(()=>ot.value.records.map(e=>e.key).join("\0"),()=>{var e;e={start:ot.value.start,end:ot.value.end},o("range-change",e)},{immediate:!0}),g(()=>[r.items.length,Je.value.totalHeight],()=>{he.value||!1!==r.stickToBottom&&("auto"!==r.stickToBottom||ne.value)&&y(()=>{he.value||!1!==r.stickToBottom&&("auto"!==r.stickToBottom||ne.value)&&Et()})},{flush:"post"}),k(()=>{Ht(),It(),be?(kn(He,be),zt({remember:!1}),fn()):!1===r.stickToBottom?(zt({remember:!1}),fn()):(te.value=!0,Ot(Ct(),{writeDom:!0,remember:!1,updatePinned:!1}),zt({remember:!1}),fn()),Q.value&&"undefined"!=typeof ResizeObserver&&(we=new ResizeObserver(()=>{Ht(),zt()}),we.observe(Q.value))}),p(()=>{ge.value||Nn(He)}),b(()=>{vn()||fn(),Tt(),Se=null,null!=Te&&"undefined"!=typeof window&&window.clearTimeout(Te),Te=null,pe=void 0,en(Xt.raf),Xt.scheduled=!1,Xt.raf=null,Xt.anchor=void 0,en(Ut),Qt=!1,Ut=null,Jt.clear(),On(),oe.clear(),ae.clear(),le.clear(),ie.clear(),ue.clear(),ce.clear(),de.clear(),null==we||we.disconnect(),we=null}),t({captureThreadState:function(){return mn(Ie.value)},restoreThreadState:zn,scrollToBottom:Et,scrollToIndex:function(e,t="start"){const n=Je.value.records[e];if(!n)return;let r=qt()+Ue(n);"center"===t?r-=(Z.value-n.size)/2:"end"===t&&(r-=Z.value-n.size),Lt(r)},scrollToOffset:Lt,getItemSize:e=>{var t;const n=bt(e);return n&&null!=(t=pt(n))?t:void 0},getTotalHeight:()=>Je.value.totalHeight,getVisibleRange:()=>({start:ot.value.start,end:ot.value.end})}),(e,t)=>(w(),S("div",{ref_key:"scrollRoot",ref:Q,class:M(["markstream-virtual-timeline",{"is-restoring-thread":!ge.value}]),"data-markstream-virtual-timeline":"1","data-testid":"markstream-virtual-timeline",onScroll:$t},[x("div",{class:"markstream-virtual-timeline__spacer",style:B({height:`${ot.value.topSpacerHeight}px`}),"aria-hidden":"true"},null,4),(w(!0),S(K,null,T(ot.value.records,t=>(w(),S("div",{key:t.renderKey,class:M(["markstream-virtual-timeline__item",{"is-restored-height-floor":Tn(t)}]),"data-markstream-item-key":t.key,"data-markstream-item-kind":t.kind,style:B({minHeight:`${t.size}px`,"--markstream-virtual-item-size":`${t.size}px`})},[F(e.$slots,"default",H({ref_for:!0},sn(t)),()=>{var e,n;return[t.markdown?(w(),q(R(_),H({key:0,ref_for:!0},un(t)),null,16)):ft(t)?(w(),q(A(ft(t)),{key:1,ref_for:!0,ref:ln(t),item:dt(t)},null,8,["item"])):(w(),S("div",{key:2,ref_for:!0,ref:ln(t),class:M(["markstream-virtual-timeline__default-item",`markstream-virtual-timeline__default-item--${t.kind||"item"}`])},["tool-call"===t.kind&&(null==(e=dt(t))?void 0:e.status)?(w(),S("span",G,N(null==(n=dt(t))?void 0:n.status),1)):C("",!0),P(" "+N(cn(t)),1)],2))]},!0)],14,Y))),128)),x("div",{class:"markstream-virtual-timeline__spacer",style:B({height:`${ot.value.bottomSpacerHeight}px`}),"aria-hidden":"true"},null,4),ge.value?C("",!0):(w(),S("div",{key:0,class:"markstream-virtual-timeline__restore-loading",style:B({height:`${Math.max(1,Ft())}px`,transform:`translateY(${U.value}px)`}),"aria-live":"polite","aria-busy":"true"},[F(e.$slots,"restore-loading",{threadKey:Ie.value,visibleRecords:ot.value.records},()=>[t[0]||(t[0]=x("div",{class:"markstream-virtual-timeline__restore-loading-card"},[x("span",{class:"markstream-virtual-timeline__restore-spinner","aria-hidden":"true"}),x("span",null,"Loading thread…")],-1))],!0)],4))],34))}})),[["__scopeId","data-v-adb4b0ba"]]),Q=J;Q.install=e=>{var t,n;const r=null!=(n=null!=(t=Q.__name)?t:Q.name)?n:"MarkstreamVirtualTimeline";e.component(r,J)};export{Q as default};
1
+ var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,l=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,i=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&l(e,n,t[n]);if(r)for(var n of r(t))a.call(t,n)&&l(e,n,t[n]);return e},u=(e,r)=>t(e,n(r)),s=(e,t,n)=>l(e,"symbol"!=typeof t?t+"":t,n);import{defineComponent as c,ref as d,reactive as m,provide as f,computed as v,shallowRef as h,watch as g,nextTick as y,onMounted as k,onUpdated as p,onBeforeUnmount as b,openBlock as w,createElementBlock as S,normalizeClass as M,createElementVNode as x,normalizeStyle as B,Fragment as K,renderList as T,renderSlot as F,mergeProps as H,createBlock as q,unref as R,resolveDynamicComponent as A,toDisplayString as N,createCommentVNode as C,createTextVNode as P}from"vue";import{z as _,ac as j,a5 as I,Y as z,a4 as O,a3 as $,a2 as L,a6 as E,ae as D,a1 as V,G as W}from"./exports.js";const Y=["data-markstream-item-key","data-markstream-item-kind"],G={key:0,class:"markstream-virtual-timeline__status"},J=.5,Q=/* @__PURE__ */W(/* @__PURE__ */c(u(i({},{name:"MarkstreamVirtualTimeline"}),{__name:"MarkstreamVirtualTimeline",props:{items:{},threadKey:{},layoutRevision:{},getKey:{},getKind:{},getContent:{},getFinal:{},getRevision:{},estimateItemHeight:{},overscan:{default:4},overscanPx:{default:1200},stickToBottom:{type:[Boolean,String],default:"auto"},measurementKey:{},markdownMode:{default:"docs"},renderCodeBlocksAsPre:{type:Boolean},initialThreadState:{},markdownFade:{type:Boolean,default:!1},restoreMaxLoadingMs:{type:[Number,Boolean],default:!1},debug:{type:Boolean}},emits:["height-change","virtual-state-change","range-change","thread-state-change"],setup(e,{expose:t,emit:n}){const r=e,o=n;function a(e){o("thread-state-change",e)}function l(e){return"measured"===e||"final"===e}function c(e){return!0===(null==e?void 0:e.stable)&&function(e){var t,n,r,o;if(!e)return!1;const a=Number(e.nodeCount),l=Number(e.measuredCount),i=Math.max(0,Number(null!=(n=null==(t=e.liveRange)?void 0:t.start)?n:0)),u=Math.min(a,Math.max(i,Number(null!=(o=null==(r=e.liveRange)?void 0:r.end)?o:0))),s=Math.max(0,u-i);return!0===e.final&&"mixed"===e.confidence&&a>0&&l>0&&l<a&&(s<=0||l>=s)}(e)}const W=/* @__PURE__ */new Map;function Q(e){var t;!0===r.debug&&W.set(e,(null!=(t=W.get(e))?t:0)+1)}const U=d(null),X=d(0),Z=d(0),ee=d(0),te=d(!0),ne=d(!0),re=m(/* @__PURE__ */new Map),oe=/* @__PURE__ */new Map,ae=/* @__PURE__ */new Map,le=/* @__PURE__ */new Map,ie=/* @__PURE__ */new Map,ue=/* @__PURE__ */new Set,se=m(/* @__PURE__ */new Map),ce=m(/* @__PURE__ */new Map),de=/* @__PURE__ */new Map,me=/* @__PURE__ */new Map,fe=/* @__PURE__ */new Map,ve=/* @__PURE__ */new Map,he=d(!1),ge=d(!0),ye=d(!0);f("markstreamHostScrollManaged",ye);const ke=[0,80,180,360,640];let pe,be,we=null,Se=null,Me=0,xe=null,Be=[],Ke=null,Te=null,Fe=-1,He=0,qe=null,Re=!1,Ae=!1,Ne=null,Ce=0,Pe=0,_e={top:0,bottom:0},je=!1;const Ie=v(()=>null==r.threadKey?void 0:String(r.threadKey));let ze=Ie.value;const Oe=v(()=>{return"chat"===(e=r.markdownMode)||"minimal"===e||"docs"===e?e:"docs";var e}),$e=v(()=>!0===r.renderCodeBlocksAsPre),Le=v(()=>[null==r.measurementKey?"":String(r.measurementKey),ee.value].join(":")),Ee=v(()=>{const e=$e.value?"pre":"rich";return`${Le.value}${Oe.value}${e}`});class De{constructor(e){s(this,"tree"),s(this,"total"),this.tree=Array.from({length:e.length+1},()=>0),this.total=0,e.forEach((e,t)=>this.add(t,e))}add(e,t){if(Number.isFinite(t)&&0!==t){this.total+=t;for(let n=e+1;n<this.tree.length;n+=n&-n)this.tree[n]+=t}}prefixSum(e){let t=Math.max(0,Math.min(e,this.tree.length-1)),n=0;for(;t>0;)n+=this.tree[t],t-=t&-t;return n}lowerBound(e,t="gte"){const n=this.tree.length-1;if(n<=0)return 0;if(e<=0)return 0;if(e>=this.total)return n-1;let r=0,o=1;for(;o<<1<this.tree.length;)o<<=1;let a=0;for(;o>0;o>>=1){const n=r+o;if(n<this.tree.length){const o=a+this.tree[n];("gt"===t?o<=e:o<e)&&(r=n,a=o)}}return Math.min(r,n-1)}}const Ve=h([]),We=/* @__PURE__ */new Map,Ye=h(new De([])),Ge=d(0);let Je=[];const Qe=v(()=>(Ge.value,{records:Ve.value,totalHeight:Ye.value.total}));function Ue(){var e;const t=[],n=[],o=function(){var e;return null!=(e=Ie.value)?e:"timeline"}();We.clear();for(let a=0;a<r.items.length;a++){const l=r.items[a],s=at(l,a),c={item:l,index:a,key:s,kind:I(l,a,r),markdown:j(l,a,r)};let d=pt(c);null==d&&(d=null!=(e=Je[a])?e:z(l,a,r));const m=u(i({},c),{renderKey:`${o}:${s}`,offset:0,size:d,component:null==l?void 0:l.component});t.push(m),n.push(d),We.has(s)||We.set(s,m)}Ve.value=t,Ye.value=new De(n),Je=[],Ge.value+=1}function Xe(e){return Ge.value,Ye.value.prefixSum(e.index)}function Ze(e){return u(i({},e),{offset:Xe(e)})}function et(e,t){const n=We.get(e);if(!n)return;const r=Math.ceil(t),o=r-n.size;0!==o&&(n.size=r,Ye.value.add(n.index,o),Ge.value+=1)}function tt(e,t="gte"){return Ge.value,Ye.value.lowerBound(e,t)}const nt=v(()=>{var e;return Math.max(0,null!=(e=r.overscan)?e:4)}),rt=v(()=>{var e;const t=Math.max(0,null!=(e=r.overscanPx)?e:1200);return ge.value?t:Math.min(t,160)}),ot=v(()=>{var e,t,n;const r=Qe.value.records;if(0===r.length)return{start:0,end:0,records:[],topSpacerHeight:0,bottomSpacerHeight:0};const o=nt.value,a=rt.value,l=Nt(),i=l+Math.max(1,Z.value);let u=tt(Math.max(0,l-a),"gt"),s=tt(Math.min(Qe.value.totalHeight,i+a))+1;u=Math.max(0,u-o),s=Math.min(r.length,Math.max(s+o,u+1));const c=r.slice(u,s).map(Ze),d=c[0],m=c[c.length-1],f=null!=(e=null==d?void 0:d.offset)?e:0,v=null!=(t=null==m?void 0:m.offset)?t:0;return{start:u,end:s,records:c,topSpacerHeight:f,bottomSpacerHeight:Math.max(0,Qe.value.totalHeight-(v+(null!=(n=null==m?void 0:m.size)?n:0)))}});function at(e,t){return O(e,t,r)}const lt=/* @__PURE__ */new WeakMap;let it=1;function ut(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return String(null!=e?e:"");const t=e;let n=lt.get(t);return n||(n=it++,lt.set(t,n)),String(n)}function st(e,t,n){var o;if(n)return"";const a="string"==typeof(null==e?void 0:e.text)?e.text:"string"==typeof(null==e?void 0:e.message)?e.message:"string"==typeof(null==e?void 0:e.label)?e.label:String(null!=(o=L(e,t,r))?o:"");return a?`${a.length}:${function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}(a)}`:""}function ct(e,t){if("function"!=typeof r.estimateItemHeight)return"";const n=r.estimateItemHeight(e,t);if(!Number.isFinite(n)||n<=0)return"";const o=Math.ceil(n);return Je[t]=o,String(o)}function dt(e){var t;return null!=(t=r.items[e.index])?t:e.item}function mt(e){return e.item}function ft(e){var t;const n=dt(e);return null!=(t=null==n?void 0:n.component)?t:e.component}function vt(e,t=Ie.value){const n=mt(e),o=E(n,e.index,r);return[null!=t?t:"timeline",e.key,null==o?"":String(o)].join(":")}function ht(e,t=Ie.value){if(e.markdown)return vt(e,t);const n=mt(e),o=E(n,e.index,r);return[null!=t?t:"timeline",e.key,null==o?"":String(o)].join(":")}function gt(e){return{sourceKey:ht(e),measurementKey:e.markdown?Ee.value:Le.value,widthBucket:ee.value}}function yt(e,t){var n,r,o,a,l,i;return(null!=(n=null==e?void 0:e.sourceKey)?n:"")===(null!=(r=null==t?void 0:t.sourceKey)?r:"")&&(null!=(o=null==e?void 0:e.measurementKey)?o:"")===(null!=(a=null==t?void 0:t.measurementKey)?a:"")&&(null!=(l=null==e?void 0:e.widthBucket)?l:0)===(null!=(i=null==t?void 0:t.widthBucket)?i:0)}function kt(e,t,n=Ie.value){var r;return!(!e||!t)&&t.sourceKey===ht(e,n)&&t.measurementKey===(e.markdown?Ee.value:Le.value)&&(null!=(r=t.widthBucket)?r:0)===ee.value}function pt(e,t=Ie.value){const n=re.get(e.key);return kt(e,oe.get(e.key),t)&&Number.isFinite(n)&&n>0?n:null}function bt(e){return Qe.value,We.get(e)}function wt(e,t){var n,r;return!!(e&&e.markdown&&t)&&t.sessionKey===vt(e)&&(null!=(n=t.threadKey)?n:"")===(null!=(r=Ie.value)?r:"")&&!!function(e){const t=Ee.value,n=null!=e?e:"";return n===t||n.startsWith(`${t}\0`)}(t.measurementKey)}function St(e,t){return wt(e,t)}function Mt(e,t,n){!Number.isFinite(t)||t<=0||(ce.set(e,Math.ceil(t)),de.set(e,n))}function xt(e,t=se.get(e)){const n=function(e,t=se.get(e)){var n;if(!St(bt(e),t))return 0;const r=Number(null==(n=null==t?void 0:t.metrics)?void 0:n.totalHeight);return Number.isFinite(r)&&r>0?Math.ceil(r):0}(e,t);return n>0&&Mt(e,n,t),n}function Bt(e){var t;return wt(bt(e),de.get(e))?null!=(t=ce.get(e))?t:0:xt(e)}function Kt(e){return e===Me&&He===e&&!ge.value}function Tt(){if(null!=xe&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(xe),xe=null,null!=Ke&&"undefined"!=typeof window&&window.clearTimeout(Ke),Ke=null,"undefined"!=typeof window)for(const e of Be)window.clearTimeout(e);Be=[]}function Ft(){var e;return Math.max(0,Z.value||(null==(e=U.value)?void 0:e.clientHeight)||0)}function Ht(){const e=U.value;if(!e||"function"!=typeof getComputedStyle)return void(_e={top:0,bottom:0});const t=getComputedStyle(e),n=Number.parseFloat(t.paddingTop)||0,r=Number.parseFloat(t.paddingBottom)||0;_e={top:n,bottom:r}}function qt(){return _e.top}function Rt(){const e=_e;return Math.max(0,Qe.value.totalHeight+e.top+e.bottom)}function At(){var e,t;return Math.max(Rt(),null!=(t=null==(e=U.value)?void 0:e.scrollHeight)?t:0)}function Nt(){return Math.max(0,X.value-qt())}function Ct(){return Math.max(0,At()-Ft())}function Pt(e){const t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(t,Ct())):0}function _t(){return Math.max(0,Ct()-X.value)}function jt(){const e=_t();ne.value=e<=2,!0!==r.stickToBottom?!1!==r.stickToBottom?te.value=e<=48:te.value=!1:te.value=!0}function It(){var e,t;const n=null!=(t=null==(e=U.value)?void 0:e.clientWidth)?t:0;ee.value=Number.isFinite(n)&&n>0?32*Math.round(n/32):0}function zt(e={}){const t=U.value;t&&(X.value=Math.max(0,t.scrollTop||0),Z.value=t.clientHeight||0),It(),jt(),(!0===e.remember||!1!==e.remember&&!he.value)&&hn()}function Ot(e,t={}){const n=Pt(e),o=U.value;if(X.value=n,o&&(Z.value=o.clientHeight||Z.value||0,!1!==t.writeDom&&Math.abs((o.scrollTop||0)-n)>J)){const e={target:n,preserveBottomPin:!1!==r.stickToBottom&&Math.abs(Ct()-n)<=2};Se=ge.value?e:null,o.scrollTop=n,e.target=Math.max(0,o.scrollTop||0)}It(),!1!==t.updatePinned&&jt(),(!0===t.remember||!1!==t.remember&&!he.value)&&fn()}function $t(){if(!ge.value){Se=null;const e=U.value,t=qe;return e&&null!=t&&Math.abs((e.scrollTop||0)-t)>J&&(e.scrollTop=t),void kn(He,be)}const e=U.value,t=Se,n=Math.max(0,(null==e?void 0:e.scrollTop)||0);return e&&t&&Math.abs(n-t.target)<=J&&t.preserveBottomPin&&!1!==r.stickToBottom||e&&ne.value&&"auto"===r.stickToBottom&&(Math.abs(Ct()-n)<=2||n>=X.value-J)||!0===r.stickToBottom?(te.value=!0,ne.value=!0,void Ot(Ct(),{writeDom:!0,remember:!1})):(Se=null,void zt())}function Lt(e){Ot(e,{writeDom:!0,remember:!0})}function Et(){Lt(Ct())}function Dt(e,t){const n=ae.get(e);if(!Number.isFinite(n)||null==n||n<=0)return 0;const r=le.get(e);return t&&r&&!Vt(r,t)?0:Math.ceil(n)}function Vt(e,t){var n,r,o,a;return e.sourceKey===t.sourceKey&&(0===(null!=(n=t.widthBucket)?n:0)||0===(null!=(r=e.widthBucket)?r:0)||(null!=(o=t.widthBucket)?o:0)===(null!=(a=e.widthBucket)?a:0))&&(Wt(t.measurementKey)||Wt(e.measurementKey)||t.measurementKey===e.measurementKey)}function Wt(e){return":0"===e||!0===(null==e?void 0:e.startsWith(":0"))}function Yt(e){ae.delete(e),le.delete(e),ie.delete(e),ue.delete(e)}function Gt(e,t,n,o={}){if(!Number.isFinite(t)||t<=0)return;const a=re.get(e),l=n&&!yt(oe.get(e),n),i=!0===o.releaseRestoredFloor;!function(e,t){if(!t)return;const n=le.get(e);n&&!Vt(n,t)&&(ae.delete(e),le.delete(e),ie.delete(e),ue.delete(e))}(e,n),i&&Yt(e);const u=Dt(e,n),s=u>0?u:Math.ceil(t);if(null!=a&&Math.abs(a-s)<=1&&!l)return void(i&&(Ge.value+=1));if(!1===o.updateLayout)return n&&oe.set(e,n),re.set(e,s),void hn(o.rememberThreadKey);if(he.value)return n&&oe.set(e,n),re.set(e,s),et(e,s),void function(e=He,t=be){t&&y(()=>{kn(e,t),null==xe&&"function"==typeof requestAnimationFrame&&(xe=requestAnimationFrame(()=>{xe=null,kn(e,t)}))})}();const c=(d=dn(),m=_t(),!0===r.stickToBottom?{type:"bottom",distanceFromBottomPx:0}:"auto"===r.stickToBottom&&te.value?{type:"bottom",distanceFromBottomPx:ne.value?0:Math.max(0,m)}:d);var d,m;n&&oe.set(e,n),re.set(e,s),et(e,s),hn(o.rememberThreadKey),function(e){if(!Jt.scheduled)return Jt.anchor=e,Jt.scheduled=!0,void(Jt.raf=Zt(tn));!Jt.anchor&&e&&(Jt.anchor=e)}(c)}g([()=>function(){const e=r.layoutRevision;return null!=e?["explicit",String(e),r.items.length].join(""):r.items.map((e,t)=>{var n;const o=at(e,t),a=j(e,t,r);return[o,I(e,t,r),a?1:0,null!=(n=E(e,t,r))?n:"",ct(e,t),st(e,t,a),(l=null==e?void 0:e.component,l?"string"==typeof l?`s:${l}`:`o:${ut(l)}`:"")].join("");var l}).join("\0")}(),Le,Ee,Ie,()=>ut(r.estimateItemHeight),()=>ut(r.getKey),()=>ut(r.getKind),()=>ut(r.getContent),()=>ut(r.getFinal),()=>ut(r.getRevision)],()=>Ue(),{immediate:!0,flush:"sync"});const Jt={scheduled:!1,raf:null,anchor:void 0},Qt=/* @__PURE__ */new Map;let Ut=!1,Xt=null;function Zt(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):(y(e),null)}function en(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function tn(){if(!Jt.scheduled)return;Jt.scheduled=!1,Jt.raf=null;const e=Jt.anchor;Jt.anchor=void 0;const t="bottom"===(null==e?void 0:e.type)&&e.distanceFromBottomPx<=2&&ne.value;e&&yn(e);const n=U.value,r=!n||Math.abs((n.scrollTop||0)-X.value)<=J;t&&!r||zt({remember:!1})}function nn(){var e,t;if(!Ut)return;Ut=!1,Xt=null;const n=Array.from(Qt.entries());Qt.clear();for(const[r,o]of n){if(ce.get(r)!==o.logicalHeight)continue;const n=We.get(r);if(!n)continue;const a=(null!=(e=o.threadKey)?e:"")===(null!=(t=Ie.value)?t:"");an(n,{allowMarkdownShrink:o.allowMarkdownShrink,allowRestoredFloorShrink:o.allowRestoredFloorShrink,markdownLogicalHeight:o.logicalHeight,rememberThreadKey:o.threadKey,source:o.itemSizeSource,updateLayout:a})}tn()}function rn(){nn(),tn()}function on(e){var t;null==(t=fe.get(e))||t.disconnect(),fe.delete(e),me.delete(e)}function an(e,t={}){var n,o,a;const l=(s=e.key,D(me.get(s),Q));var s;const c=null!=(n=t.source)?n:gt(e);let d=!1;const m=()=>{d||(d=!0,function(e,t){const n=function(){if(!0!==r.debug||0===W.size)return null;let e=0;for(const n of W.values())e+=n;const t={total:e,byLabel:Object.fromEntries(Array.from(W.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])))};return W.clear(),t}();n&&console.info("[markstream-vue][timeline][perf] layout-reads",{label:e,itemKey:t,layoutReads:n})}("reconcileRecordSize",e.key))};if(!e.markdown)return l>0&&Gt(e.key,l,c,t),void m();const f=yt(oe.get(e.key),c)&&null!=(o=re.get(e.key))?o:0,v=null!=(a=t.markdownLogicalHeight)?a:Bt(e.key),h=function(e,t){return V(me.get(e),Q,t)}(e.key,l);if(v>0){let n=Math.max(l,v+h);(!t.allowMarkdownShrink||he.value)&&f>0&&(n=Math.max(n,f));const o=Dt(e.key,c),a=o>0&&n>o+1&&(!$(dt(e),e.index,r)||!0===t.allowRestoredFloorShrink);return e.markdown&&o>0&&(!0===t.allowRestoredFloorShrink||a)?he.value?ue.add(e.key):t=u(i({},t),{releaseRestoredFloor:!0}):t.allowMarkdownShrink&&!he.value&&(o<=0||t.allowRestoredFloorShrink&&function(e,t,n){const r=ie.get(e);return!Number.isFinite(r)||null==r||r<=0||t+Math.max(0,n-r)<n-1}(e.key,v,o))&&Yt(e.key),n>0&&Gt(e.key,n,c,t),void m()}return String(L(dt(e),e.index,r)).trim()?f>0?(l>f+1&&Gt(e.key,l,c,t),void m()):(l>0&&Gt(e.key,l,c,t),void m()):(l>0&&(Yt(e.key),Gt(e.key,l,c,t)),void m())}function ln(e){return t=>{!function(e,t){const n=function(e){const t=e&&"$el"in e?e.$el:e;return t instanceof HTMLElement?t:null}(t),r=me.get(e.key);if(!n)return void on(e.key);if(r===n)return void an(e);if(on(e.key),me.set(e.key,n),an(e),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(()=>{an(e)});o.observe(n),fe.set(e.key,o)}(e,t)}}function un(e){const t=dt(e),n=$(t,e.index,r),a=se.get(e.key),s=Oe.value,d={enabled:!0,sessionKey:vt(e),threadKey:Ie.value,scrollRoot:()=>U.value,restoreState:St(e,a)?a:null,restoreAnchor:!1,measurementKey:Ee.value,settleMode:"manual",settledToken:n,emitIntervalMs:96,heightDiffThresholdPx:4};return u(i({content:L(t,e.index,r),final:n,mode:s,renderCodeBlocksAsPre:$e.value},n?{nodeVirtual:"auto",maxLiveNodes:50,liveNodeBuffer:16}:{}),{fade:!0===r.markdownFade,indexKey:vt(e),virtualScroll:d,onHeightChange(t){if(t.sessionKey!==vt(e))return;Mt(e.key,t.totalHeight,{sessionKey:t.sessionKey,threadKey:Ie.value,measurementKey:Ee.value});const n=function(e){return"final"===e.phase||!(!0!==e.final||!l(e.confidence))||!!e.stable&&(l(e.confidence)||c(e))}(t),r=function(e){return"final"===e.phase||!!e.stable&&(l(e.confidence)||c(e))}(t),a=Math.ceil(t.totalHeight);var i;!function(e,t){Qt.set(e.key,t),Ut||(Ut=!0,Xt=Zt(nn))}(e,{allowMarkdownShrink:n,allowRestoredFloorShrink:r,itemSizeSource:gt(e),logicalHeight:a,threadKey:Ie.value}),i={itemKey:e.key,metrics:t},o("height-change",i)},onVirtualStateChange(t){var n;t.sessionKey===vt(e)&&(se.set(e.key,t),xt(e.key,t),hn(),n={itemKey:e.key,state:t},o("virtual-state-change",n))}})}function sn(e){return{item:dt(e),index:e.index,itemKey:e.key,kind:e.kind,measureRef:ln(e),markdownProps:un(e)}}function cn(e){var t;const n=null!=(t=dt(e))?t:{};return"string"==typeof n.text?n.text:"string"==typeof n.message?n.message:"string"==typeof n.label?n.label:L(n,e.index,r)}function dn(){const e=_t();if(e<=2)return{type:"bottom",distanceFromBottomPx:Math.max(0,e)};const t=Nt(),n=tt(t,"gt"),r=Qe.value.records[n];if(r){const e=Xe(r);if(t>=e&&t<e+r.size)return{type:"item",itemKey:r.key,offsetWithinItemPx:t-e}}const o=ot.value.records[0];return o?{type:"item",itemKey:o.key,offsetWithinItemPx:0}:void 0}function mn(e=Ie.value){rn();const t={},n={};for(const r of Qe.value.records){const o=pt(r,e),a=oe.get(r.key);null!=o&&kt(r,a,e)&&(t[r.key]=o,n[r.key]=a)}return{threadKey:e,measurementKey:Le.value,widthBucket:ee.value,outerAnchor:dn(),itemHeights:t,itemSizeSources:n,markdownStates:Object.fromEntries(se.entries())}}function fn(e=Ie.value){if(!e)return;const t=mn(e);return ve.set(e,t),e===Ie.value&&(Ne=t),a(t),t}function vn(){const e=pe;return null!=Te&&"undefined"!=typeof window&&window.clearTimeout(Te),Te=null,pe=void 0,e?fn(e):void 0}function hn(e=Ie.value){e&&(pe=e,null==Te&&("undefined"!=typeof window?Te=window.setTimeout(()=>{Te=null,vn()},80):vn()))}function gn(e){if(!e)return null;if("bottom"===e.type)return(ge.value?At():Rt())-Ft()-Math.max(0,e.distanceFromBottomPx);const t=bt(e.itemKey);return t?qt()+Xe(t)+Math.max(0,e.offsetWithinItemPx):null}function yn(e,t={}){const n=gn(e);return null!=n&&(Ot(n,{writeDom:!0,remember:!0===t.remember}),!0)}function kn(e,t){if(e===Me){if(t){const e=yn(t,{remember:!1});qe=e?X.value:null}zt({remember:!1})}}function pn(e,t){const n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>t.top&&n.top<t.bottom}function bn(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.bottom>r.top&&n.top<r.bottom}function wn(e){if(e.closest(".code-editor-container.is-hidden"))return!1;let t=e;for(;t;){const e=window.getComputedStyle(t);if("none"===e.display||"hidden"===e.visibility||Number.parseFloat(e.opacity||"1")<=.01)return!1;t=t.parentElement}const n=e.getBoundingClientRect();return n.width>0&&n.height>0}function Sn(e){if(!e)return!1;if(e.classList.contains("is-fading-out"))return!1;const t=window.getComputedStyle(e);if("none"===t.display||Number.parseFloat(t.opacity||"1")<=.01)return!1;const n=e.getBoundingClientRect();return n.width>0&&n.height>0}function Mn(e){return Array.from(e.querySelectorAll(['[data-markstream-pending="true"]','[data-markstream-mermaid][data-markstream-mode="pending"]','.mermaid-block-container[data-markstream-mode="pending"]','[data-markstream-code-loading="1"]'].join(","))).some(e=>!e.matches('[data-markstream-code-block="1"]')||!Sn(e.querySelector("pre.code-pre-fallback")))}function xn(e){var t;if(e.querySelector(":scope > .node-placeholder"))return!1;const n=e.querySelector(":scope > .node-content");return!!n&&(!Mn(n)&&(!!function(e){const t=Array.from(e.querySelectorAll("[data-markstream-math]"));return!t.length||t.every(e=>{const t=e.dataset.markstreamMode;return!("true"===e.dataset.markstreamPending||"loading"===t||"katex"!==t&&"fallback"!==t)})}(n)&&("code_block"===(null!=(t=e.dataset.nodeType)?t:"")?function(e){if(e.querySelector('[data-markstream-code-loading="1"]'))return!1;const t=e.querySelector('[data-markstream-code-block="1"]');if(t){const e="true"===t.dataset.markstreamEnhanced,r=Sn(t.querySelector("pre.code-pre-fallback"));return e||r||(n=t,Array.from(n.querySelectorAll("diffs-container, .stream-diffs-shell, .stream-diffs-surface")).some(wn))}var n;return function(e){var t,n;const r=e.querySelector("[data-markstream-mermaid], .mermaid-block-container");if(r){if("true"===r.dataset.markstreamPending)return!1;const e=r.dataset.markstreamMode;return"preview"===e?Boolean(r.querySelector("svg")||r.querySelector('[data-mermaid-svg-layer="1"] svg')):"fallback"===e&&Boolean(null==(n=null==(t=r.querySelector(".mermaid-source-code"))?void 0:t.textContent)?void 0:n.trim())}const o=e.querySelector("[data-markstream-infographic], .infographic-block-container");if(o)return"true"!==o.dataset.markstreamPending;const a=e.querySelector("[data-markstream-d2], .d2-block-container");return a?"true"!==a.dataset.markstreamPending:Boolean(e.querySelector('pre[data-markstream-pre="1"]'))}(e)}(n):function(e){var t;return(null!=(t=e.textContent)?t:"").trim().length>0||Boolean(e.querySelector(["hr","br","table","blockquote","img","svg","canvas","input","button","select","textarea","[role]","[aria-label]","[data-markstream-math]","[data-markstream-mermaid]","[data-markstream-infographic]","[data-markstream-d2]",'[data-markstream-pre="1"]'].join(",")))}(n))))}function Bn(e,t){var n;if(!e.markdown)return!0;const o=L(dt(e),e.index,r);if(!String(null!=o?o:"").trim())return!0;if(t.querySelector("[data-node-index]"))return!0;const a=t.querySelector(".markdown-renderer"),l=null!=a?a:t;return!Mn(l)&&(!!(null!=(n=l.textContent)?n:"").trim()||Boolean(l.querySelector(["hr","br","table","blockquote","img","svg","canvas","input","button","[role]","[aria-label]","[data-markstream-math]","[data-markstream-mermaid]","[data-markstream-infographic]","[data-markstream-d2]",'[data-markstream-pre="1"]','[data-markstream-code-block="1"]'].join(","))))}function Kn(e,t,n){if(!e.markdown)return!0;const o=L(dt(e),e.index,r);if(!String(null!=o?o:"").trim())return!0;const a=n.getBoundingClientRect(),l=Array.from(t.querySelectorAll("[data-node-index]")).filter(e=>pn(e,a));if(l.length>0)return l.every(e=>xn(e));const i=t.querySelector(".markdown-renderer"),u=null!=i?i:t;return u.querySelector("[data-node-index], .node-placeholder")?!!function(e,t,n,r){if(!Tn(e))return!1;const o=n.getBoundingClientRect(),a=t.getBoundingClientRect();return o.width>0&&o.height>0&&o.bottom<=r.top+1&&a.bottom>r.top}(e,t,u,a)&&Bn(e,t):Bn(e,t)}function Tn(e){const t=oe.get(e.key);return Dt(e.key,t)>0}function Fn(e,t){var n,o,a,i;if(!e.markdown)return!0;if(!Re&&!Ae)return!0;if(Tn(e))return!0;const u=L(dt(e),e.index,r);if(!String(null!=u?u:"").trim())return!0;if(!t.querySelector(".markdown-renderer"))return!1;const s=se.get(e.key);if(!St(e,s))return!1;const d=null==s?void 0:s.metrics,m=Number(null!=(n=null==d?void 0:d.totalHeight)?n:0);if(!Number.isFinite(m)||m<=0)return!1;const f=Number(null!=(o=null==d?void 0:d.measuredCount)?o:0),v=Number(null!=(a=null==d?void 0:d.estimatedCount)?a:0),h=Number(null!=(i=null==d?void 0:d.nodeCount)?i:0),g=h<=0||f>=h&&v<=0,y=l(null==d?void 0:d.confidence),k=c(d),p=!0===(null==d?void 0:d.stable)||y||k;return Ae?!0===(null==d?void 0:d.final)&&(g&&y||k):p||!0===(null==d?void 0:d.final)}function Hn(){const e=U.value;if(!e)return!1;const t=gn(be);if(null!=t&&Math.abs((e.scrollTop||0)-Pt(t))>J)return!1;const n=ot.value.records;if(!n.length)return 0===Qe.value.records.length;const r=new Map(Array.from(e.querySelectorAll("[data-markstream-item-key]")).map(e=>{var t;return[null!=(t=e.dataset.markstreamItemKey)?t:"",e]})),o=[];for(const i of n){const t=r.get(i.key);t&&bn(t,e)&&o.push({record:i,el:t})}if(!o.length)return!1;for(const{record:i,el:u}of o){if(u.offsetHeight+1<i.size)return!1;if(!Kn(i,u,e))return!1;if(!Fn(i,u))return!1}const a=e.getBoundingClientRect();if(Array.from(e.querySelectorAll(['[data-markstream-pending="true"]','[data-markstream-mermaid][data-markstream-mode="pending"]','.mermaid-block-container[data-markstream-mode="pending"]','[data-markstream-code-loading="1"]'].join(","))).some(e=>!(!pn(e,a)||e.matches('[data-markstream-code-block="1"]')&&Sn(e.querySelector("pre.code-pre-fallback")))))return!1;const l=Array.from(e.querySelectorAll("[data-node-index]")).filter(e=>pn(e,a));for(const i of l)if(!xn(i))return!1;return!0}function qn(){const e=U.value;if(!e)return"";const t=e.getBoundingClientRect(),n=new Map(Array.from(e.querySelectorAll("[data-markstream-item-key]")).map(e=>{var t;return[null!=(t=e.dataset.markstreamItemKey)?t:"",e]})),r=ot.value.records.map(e=>{var t,r,o,a,l,i,u,s,c;const d=n.get(e.key),m=null==d?void 0:d.querySelector(".markdown-renderer"),f=null==(t=se.get(e.key))?void 0:t.metrics;return[e.key,e.size,null!=(r=null==d?void 0:d.offsetHeight)?r:0,null!=(o=null==d?void 0:d.scrollHeight)?o:0,null!=(a=null==m?void 0:m.offsetHeight)?a:0,null!=(l=null==m?void 0:m.scrollHeight)?l:0,f?Math.round(Number(f.totalHeight||0)):"",null!=(i=null==f?void 0:f.measuredCount)?i:"",null!=(u=null==f?void 0:f.estimatedCount)?u:"",null!=(s=null==f?void 0:f.nodeCount)?s:"",!0===(null==f?void 0:f.final)?1:0,!0===(null==f?void 0:f.stable)?1:0,null!=(c=null==f?void 0:f.confidence)?c:""].join(":")}).join("|"),o=Array.from(e.querySelectorAll("[data-node-index]")).filter(e=>pn(e,t)).map(e=>{var t,n,r,o,a;const l=e.getBoundingClientRect(),i=e.querySelector(":scope > .node-content"),u=null==i?void 0:i.querySelector('[data-markstream-code-block="1"]'),s=null==i?void 0:i.querySelector("pre.code-pre-fallback"),c=null==i?void 0:i.querySelector("diffs-container, .stream-diffs-shell");return[null!=(t=e.dataset.nodeIndex)?t:"",null!=(n=e.dataset.nodeType)?n:"",Math.round(l.height),null!=(r=null==i?void 0:i.offsetHeight)?r:0,null!=(o=null==i?void 0:i.scrollHeight)?o:0,null!=(a=null==u?void 0:u.dataset.markstreamEnhanced)?a:"",u?Math.round(u.getBoundingClientRect().height):0,s?Math.round(s.getBoundingClientRect().height):0,c?Math.round(c.getBoundingClientRect().height):0].join(":")}).join("|");return[Math.round(e.scrollTop||0),Math.round(e.scrollHeight||0),Math.round(Qe.value.totalHeight||0),r,o].join("\n")}function Rn(){return"undefined"!=typeof performance?performance.now():Date.now()}function An(){return Ae?24:2}function Nn(e){Kt(e)&&Ce!==e&&(Ce=e,function(e){return t=this,n=function*(){const t=Rn();let n=0,r="";for(let o=0;o<40;o++){if(yield y(),yield new Promise(e=>{"function"!=typeof requestAnimationFrame?e():requestAnimationFrame(()=>e())}),!Kt(e))return!1;kn(e,be);const o=Rn(),a=Hn(),l=a?qn():"";if(a&&l===r&&l){if(n+=1,n>=An()&&o-t>=96)return!0}else n=0,r=l}return!1},new Promise((e,r)=>{var o=e=>{try{l(n.next(e))}catch(t){r(t)}},a=e=>{try{l(n.throw(e))}catch(t){r(t)}},l=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,a);l((n=n.apply(t,null)).next())});var t,n}(e).then(t=>{if(Ce===e&&(Ce=0),Kt(e))return t?void In(e):function(){if(Fe<0)return!1;const e=function(){if(!1===r.restoreMaxLoadingMs)return Number.POSITIVE_INFINITY;const e=Number(r.restoreMaxLoadingMs);return Number.isFinite(e)&&e>0?e:Number.POSITIVE_INFINITY}();return Number.isFinite(e)&&Rn()-Fe>=e}()?(!0===r.debug&&import.meta,void In(e)):(function(e){Pe!==e&&(Pe=e,!0===r.debug&&import.meta)}(e),void function(e){Kt(e)&&"undefined"!=typeof window&&(null!=Ke&&window.clearTimeout(Ke),Ke=window.setTimeout(()=>{Ke=null,Kt(e)&&Nn(e)},120))}(e))}))}function Cn(){ge.value=!0,Fe=-1,Ce=0,Pe=0,Re=!1,Ae=!1,null!=Ke&&"undefined"!=typeof window&&window.clearTimeout(Ke),Ke=null}function Pn(){je=!0}function _n(e){var t,n;const r=[];if(!function(e){var t,n;return!!e&&(null!=(t=e.measurementKey)?t:"")===Le.value&&(null!=(n=e.widthBucket)?n:0)===ee.value}(e))return r;for(const[o,a]of Object.entries(null!=(t=null==e?void 0:e.itemHeights)?t:{})){if(!Number.isFinite(a)||a<=0)continue;const t=bt(o),l=null==(n=null==e?void 0:e.itemSizeSources)?void 0:n[o];kt(t,l)&&r.push([o,Math.ceil(a),l])}return r}function jn(e){var t;for(const[n,r]of Object.entries(null!=(t=null==e?void 0:e.markdownStates)?t:{}))if(St(bt(n),r))return!0;return!1}function In(e){if(e!==Me)return;nn();const t=new Set(ue);Tt(),kn(e,be),he.value=!1,Fe=-1,be=void 0,qe=null,He=0;for(const n of Qe.value.records)n.markdown&&!t.has(n.key)||Yt(n.key);for(const n of t){const e=We.get(n);e?an(e,{allowMarkdownShrink:!0,allowRestoredFloorShrink:!0,markdownLogicalHeight:Bt(e.key),source:gt(e),updateLayout:!0}):Yt(n)}ue.clear(),tn(),zt({remember:!1}),Cn(),Pn()}function zn(e,t={}){var n;const o=++Me;Se=null,(null==e?void 0:e.widthBucket)&&0===ee.value&&(ee.value=e.widthBucket);const a=null==e?void 0:e.outerAnchor,l=function(e){return Boolean((null==e?void 0:e.outerAnchor)||_n(e).length>0||jn(e))}(e),i=jn(e),u=!(!je&&!0!==t.threadSwitch||l),s=l||u,c=null!=a?a:s?function(){if(!1!==r.stickToBottom)return{type:"bottom",distanceFromBottomPx:0};const e=Qe.value.records[0];return e?{type:"item",itemKey:e.key,offsetWithinItemPx:0}:void 0}():void 0;Tt(),Ce=0,Pe=0,ge.value=!s,he.value=s&&Boolean(c),He=o,be=c,Re=s&&i,Ae=s&&u,Fe=he.value?Rn():-1,On(),re.clear(),oe.clear(),ae.clear(),le.clear(),ie.clear(),ue.clear(),se.clear(),ce.clear(),de.clear();for(const[r,m,f]of _n(e)){const e=Math.ceil(m);oe.set(r,f),re.set(r,e),ae.set(r,e),le.set(r,f)}for(const[r,m]of Object.entries(null!=(n=null==e?void 0:e.markdownStates)?n:{})){se.set(r,m);const e=xt(r,m);e>0&&ie.set(r,e)}Ue(),!0===r.stickToBottom?(te.value=!0,ne.value=!0):!1===r.stickToBottom?(te.value=!1,ne.value=!1):(te.value="bottom"===(null==c?void 0:c.type),ne.value="bottom"===(null==c?void 0:c.type)&&c.distanceFromBottomPx<=2);const d=gn(c);return qe=null==d?null:Pt(d),null!=d&&Ot(d,{writeDom:!0,remember:!1,updatePinned:!1}),Ne=(null==e?void 0:e.threadKey)===Ie.value?e:null,s?c?void y(()=>{kn(o,c),"undefined"!=typeof window?(ke.forEach(e=>{const t=window.setTimeout(()=>{kn(o,c)},e);Be.push(t)}),Nn(o)):In(o)}):(he.value=!1,be=void 0,qe=null,He=0,zt({remember:!1}),Cn(),void Pn()):(he.value=!1,be=void 0,qe=null,He=0,zt({remember:!1}),Cn(),Pn(),void(!1!==r.stickToBottom&&(te.value=!0,ne.value=!0,y(()=>{he.value||Et()}))))}function On(){for(const e of fe.values())e.disconnect();fe.clear(),me.clear()}return g(Ie,(e,t)=>{const n=null!=ze?ze:t,o=Boolean(n&&n!==e);o&&function(e){var t;rn(),(null==(t=vn())?void 0:t.threadKey)!==e&&((null==Ne?void 0:Ne.threadKey)===e?(ve.set(e,Ne),a(Ne)):ve.has(e)||fn(e))}(n),ze=e,zn(function(e){return(e?ve.get(e):null)||function(e){var t;const n=r.initialThreadState;return n?(null!=(t=n.threadKey)?t:"")!==(null!=e?e:"")?null:n:null}(e)}(e),{threadSwitch:o})},{immediate:!0,flush:"sync"}),g(()=>ot.value.records.map(e=>e.key).join("\0"),()=>{var e;e={start:ot.value.start,end:ot.value.end},o("range-change",e)},{immediate:!0}),g(()=>[r.items.length,Qe.value.totalHeight],()=>{he.value||!1!==r.stickToBottom&&("auto"!==r.stickToBottom||ne.value)&&y(()=>{he.value||!1!==r.stickToBottom&&("auto"!==r.stickToBottom||ne.value)&&Et()})},{flush:"post"}),k(()=>{Ht(),It(),be?(kn(He,be),zt({remember:!1}),fn()):!1===r.stickToBottom?(zt({remember:!1}),fn()):(te.value=!0,Ot(Ct(),{writeDom:!0,remember:!1,updatePinned:!1}),zt({remember:!1}),fn()),U.value&&"undefined"!=typeof ResizeObserver&&(we=new ResizeObserver(()=>{Ht(),zt()}),we.observe(U.value))}),p(()=>{ge.value||Nn(He)}),b(()=>{vn()||fn(),Tt(),Se=null,null!=Te&&"undefined"!=typeof window&&window.clearTimeout(Te),Te=null,pe=void 0,en(Jt.raf),Jt.scheduled=!1,Jt.raf=null,Jt.anchor=void 0,en(Xt),Ut=!1,Xt=null,Qt.clear(),On(),oe.clear(),ae.clear(),le.clear(),ie.clear(),ue.clear(),ce.clear(),de.clear(),null==we||we.disconnect(),we=null}),t({captureThreadState:function(){return mn(Ie.value)},restoreThreadState:zn,scrollToBottom:Et,scrollToIndex:function(e,t="start"){const n=Qe.value.records[e];if(!n)return;let r=qt()+Xe(n);"center"===t?r-=(Z.value-n.size)/2:"end"===t&&(r-=Z.value-n.size),Lt(r)},scrollToOffset:Lt,getItemSize:e=>{var t;const n=bt(e);return n&&null!=(t=pt(n))?t:void 0},getTotalHeight:()=>Qe.value.totalHeight,getVisibleRange:()=>({start:ot.value.start,end:ot.value.end})}),(e,t)=>(w(),S("div",{ref_key:"scrollRoot",ref:U,class:M(["markstream-virtual-timeline",{"is-restoring-thread":!ge.value}]),"data-markstream-virtual-timeline":"1","data-testid":"markstream-virtual-timeline",onScroll:$t},[x("div",{class:"markstream-virtual-timeline__spacer",style:B({height:`${ot.value.topSpacerHeight}px`}),"aria-hidden":"true"},null,4),(w(!0),S(K,null,T(ot.value.records,t=>(w(),S("div",{key:t.renderKey,class:M(["markstream-virtual-timeline__item",{"is-restored-height-floor":Tn(t)}]),"data-markstream-item-key":t.key,"data-markstream-item-kind":t.kind,style:B({minHeight:`${t.size}px`,"--markstream-virtual-item-size":`${t.size}px`})},[F(e.$slots,"default",H({ref_for:!0},sn(t)),()=>{var e,n;return[t.markdown?(w(),q(R(_),H({key:0,ref_for:!0},un(t)),null,16)):ft(t)?(w(),q(A(ft(t)),{key:1,ref_for:!0,ref:ln(t),item:dt(t)},null,8,["item"])):(w(),S("div",{key:2,ref_for:!0,ref:ln(t),class:M(["markstream-virtual-timeline__default-item",`markstream-virtual-timeline__default-item--${t.kind||"item"}`])},["tool-call"===t.kind&&(null==(e=dt(t))?void 0:e.status)?(w(),S("span",G,N(null==(n=dt(t))?void 0:n.status),1)):C("",!0),P(" "+N(cn(t)),1)],2))]},!0)],14,Y))),128)),x("div",{class:"markstream-virtual-timeline__spacer",style:B({height:`${ot.value.bottomSpacerHeight}px`}),"aria-hidden":"true"},null,4),ge.value?C("",!0):(w(),S("div",{key:0,class:"markstream-virtual-timeline__restore-loading",style:B({height:`${Math.max(1,Ft())}px`,transform:`translateY(${X.value}px)`}),"aria-live":"polite","aria-busy":"true"},[F(e.$slots,"restore-loading",{threadKey:Ie.value,visibleRecords:ot.value.records},()=>[t[0]||(t[0]=x("div",{class:"markstream-virtual-timeline__restore-loading-card"},[x("span",{class:"markstream-virtual-timeline__restore-spinner","aria-hidden":"true"}),x("span",null,"Loading thread…")],-1))],!0)],4))],34))}})),[["__scopeId","data-v-adb4b0ba"]]),U=Q;U.install=e=>{var t,n;const r=null!=(n=null!=(t=U.__name)?t:U.name)?n:"MarkstreamVirtualTimeline";e.component(r,Q)};export{U as default};
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{as as H,au as j,av as $,ar as T,ah as P,a9 as L,ao as E,a6 as z,$ 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 Y=["data-markstream-mode"],N={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"],U={key:2},A={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},G=["disabled"],q={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"},W=["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}=H(),ge=j(),fe=$(),Ce=T(),xe=n(!1),ke=n(!1),ye=n(),be=n(),Me=n(!0),Be=n(!1),Fe=n(!1),He=n(),je=n(null),$e=n(!1),Te=n(!1),Pe=n(null),Le=n("undefined"==typeof window||!Ce.value),Ee=t(),ze=l(X,null);let Se="";const Ze=i(()=>P(pe,Ee));"undefined"!=typeof window&&r([()=>ye.value,Ce],([e,o])=>{var n,t,l;if(null==(n=Pe.value)||n.destroy(),Pe.value=null,!o||Le.value)return void(Le.value=!0);if(!e)return void(Le.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,Le.value=r.isVisible.value,r.whenVisible.then(()=>{Le.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 Ye(){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 Ne=n(1),Oe=n(0),De=n(0),Re=n(!1),Ue=n({x:0,y:0}),Ae=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;E(e.currentTarget,o,n,!1,l,pe.isDark)}function Je(){z()}function Ke(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;E(e.currentTarget,o,"top",!1,t,pe.isDark)}function Qe(){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 We(e){("preview"!==e||L())&&(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,He.value&&(He.value.innerHTML=""),je.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&&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=be.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),He.value.appendChild(e),je.value=e,e.style.transform=`translate(${Oe.value}px, ${De.value}px) scale(${Ne.value})`}})}()}function lo(){Ne.value<3&&(Ne.value+=.1)}function io(){Ne.value>.5&&(Ne.value-=.1)}function ro(){Ne.value=1,Oe.value=0,De.value=0}function ao(e){Re.value=!0,e instanceof MouseEvent?Ue.value={x:e.clientX-Oe.value,y:e.clientY-De.value}:Ue.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-Ue.value.x,De.value=n-Ue.value.y}function uo(){Re.value=!1}let co=null,vo=!1,mo=!1,ho=!1,po="",wo=!1,go=0;function fo(e){return!wo&&e===go}function Co(o=!1){return e(this,null,function*(){var n,t;if(wo||!Le.value)return;if(!be.value)return;if(vo)return mo=!0,void(ho=ho||o);const l=Ae.value;if(!o&&l===po&&$e.value)return;const i=!1===pe.loading,r=++go;vo=!0,function(){const e=Ze.value;e&&Se!==e&&(Se&&(null==ze||ze.markSettled(Se)),Se=e,null==ze||ze.markPending(e))}();const s=be.value.innerHTML,u=$e.value,c=Te.value;Te.value=!1;try{const e=yield S();if(!fo(r))return;if(!e)return void console.warn("Infographic library failed to load.");const o=be.value;if(!o)return;co&&(null==(n=co.destroy)||n.call(co),co=null),o.innerHTML="",co=new e({container:o,width:"100%",height:"100%"});let i="";if(null==(t=co.on)||t.call(co,"error",e=>{const o=Array.isArray(e)?e:[e];i=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("; ")}),co.render(Ve.value),i)throw new Error(i);if(!o.childNodes.length)throw new Error("Infographic render returned empty output.");$e.value=!0,Te.value=!1,po=l,a(()=>{fo(r)&&Ye()})}catch(d){if(!fo(r))return;i&&!1===pe.loading&&l===Ae.value?(console.error("Failed to render infographic:",d),$e.value=!1,Te.value=!0,po="",be.value&&(be.value.innerHTML=`<div style="padding: var(--ms-inset-panel-body); color: hsl(var(--ms-destructive))">Failed to render infographic: ${d instanceof Error?d.message:"Unknown error"}</div>`)):($e.value=u,Te.value=c,u&&be.value&&(be.value.innerHTML=s))}finally{if(vo=!1,fo(r))if(mo){const e=ho;mo=!1,ho=!1,a(()=>{Co(e)})}else!function(){e(this,null,function*(){const e=Se;e&&(Se="",yield a(),function(e=Ze.value){e&&ye.value&&(null==ze||ze.reportHeight(e,ye.value.offsetHeight))}(e),null==ze||ze.markSettled(e))})}()}})}function xo(e=!1){wo||!Le.value||Me.value||ke.value||a(()=>{wo||Co(e)})}r(()=>Ve.value,()=>{xo(!0)}),r(()=>pe.loading,(e,o)=>{o&&!e&&xo(!0)}),r(()=>Me.value,e=>{e||xo(!0)}),r(()=>ke.value,e=>{e||xo()}),r(()=>pe.maxHeight,()=>{a(()=>{Ye()})}),r([()=>pe.estimatedPreviewHeightPx,()=>Ve.value],()=>{$e.value||Me.value||(Ie.value=`${_e.value}px`)}),r(()=>Le.value,e=>{!e||Me.value||ke.value||xo()}),s(()=>{!Be.value&&L()&&(Me.value=!1),xo()}),u(()=>{var e,o;if(wo=!0,go+=1,mo=!1,ho=!1,null==(e=Pe.value)||e.destroy(),Pe.value=null,function(){const e=Se;e&&(Se="",null==ze||ze.markSettled(e))}(),co&&(null==(o=co.destroy)||o.call(co),co=null),po="","undefined"!=typeof window)try{window.removeEventListener("keydown",oo)}catch(n){}});const ko=i(()=>!L()),yo=i(()=>Me.value||ke.value),bo=i(()=>Me.value?"fallback":Te.value?"error":$e.value?"preview":"pending"),Mo=i(()=>({transform:`translate(${Oe.value}px, ${De.value}px) scale(${Ne.value})`}));return r(Mo,e=>{Fe.value&&je.value&&(je.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",N,[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",U,[m(e.$slots,"header-center",{},void 0,!0)])):pe.showModeToggle?(c(),d("div",A,[h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Me.value?"":"is-active",ko.value?"opacity-50 cursor-not-allowed":""]]),disabled:ko.value,onClick:o[0]||(o[0]=()=>We("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:Je,onBlur:Je},[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]=()=>We("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: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(we)("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,[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:Je,onBlur:Je},[(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,W)):g("",!0),pe.showCopyButton?(c(),d("button",{key:1,class:v(he),onClick:Qe,onMouseenter:o[9]||(o[9]=e=>Ke(e)),onFocus:o[10]||(o[10]=e=>Ke(e)),onMouseleave:Je,onBlur:Je},[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} ${yo.value?"opacity-50 cursor-not-allowed":""}`),disabled:yo.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: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,ne)):g("",!0),pe.showFullscreenButton?(c(),d("button",{key:3,class:v(`${he} ${yo.value?"opacity-50 cursor-not-allowed":""}`),disabled:yo.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:Je,onBlur:Je},[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: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: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: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: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:Je,onBlur:Je},w(Math.round(100*Ne.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(Mo.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*Ne.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:He,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,Y))}}),[["__scopeId","data-v-de34ec4b"]]);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{ax as H,az as j,aA as T,aw as $,aj as P,ab as L,ar as E,a8 as z,a0 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 Y=["data-markstream-mode"],N={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"],U={key:2},A={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},G=["disabled"],q={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"},W=["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}=H(),ge=j(),fe=T(),Ce=$(),xe=n(!1),ke=n(!1),ye=n(),be=n(),Me=n(!0),Be=n(!1),Fe=n(!1),He=n(),je=n(null),Te=n(!1),$e=n(!1),Pe=n(null),Le=n("undefined"==typeof window||!Ce.value),Ee=t(),ze=l(X,null);let Se="";const Ze=i(()=>P(pe,Ee));"undefined"!=typeof window&&r([()=>ye.value,Ce],([e,o])=>{var n,t,l;if(null==(n=Pe.value)||n.destroy(),Pe.value=null,!o||Le.value)return void(Le.value=!0);if(!e)return void(Le.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,Le.value=r.isVisible.value,r.whenVisible.then(()=>{Le.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 Ye(){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 Ne=n(1),Oe=n(0),De=n(0),Re=n(!1),Ue=n({x:0,y:0}),Ae=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;E(e.currentTarget,o,n,!1,l,pe.isDark)}function Je(){z()}function Ke(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;E(e.currentTarget,o,"top",!1,t,pe.isDark)}function Qe(){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 We(e){("preview"!==e||L())&&(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,He.value&&(He.value.innerHTML=""),je.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&&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=be.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),He.value.appendChild(e),je.value=e,e.style.transform=`translate(${Oe.value}px, ${De.value}px) scale(${Ne.value})`}})}()}function lo(){Ne.value<3&&(Ne.value+=.1)}function io(){Ne.value>.5&&(Ne.value-=.1)}function ro(){Ne.value=1,Oe.value=0,De.value=0}function ao(e){Re.value=!0,e instanceof MouseEvent?Ue.value={x:e.clientX-Oe.value,y:e.clientY-De.value}:Ue.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-Ue.value.x,De.value=n-Ue.value.y}function uo(){Re.value=!1}let co=null,vo=!1,mo=!1,ho=!1,po="",wo=!1,go=0;function fo(e){return!wo&&e===go}function Co(o=!1){return e(this,null,function*(){var n,t;if(wo||!Le.value)return;if(!be.value)return;if(vo)return mo=!0,void(ho=ho||o);const l=Ae.value;if(!o&&l===po&&Te.value)return;const i=!1===pe.loading,r=++go;vo=!0,function(){const e=Ze.value;e&&Se!==e&&(Se&&(null==ze||ze.markSettled(Se)),Se=e,null==ze||ze.markPending(e))}();const s=be.value.innerHTML,u=Te.value,c=$e.value;$e.value=!1;try{const e=yield S();if(!fo(r))return;if(!e)return void console.warn("Infographic library failed to load.");const o=be.value;if(!o)return;co&&(null==(n=co.destroy)||n.call(co),co=null),o.innerHTML="",co=new e({container:o,width:"100%",height:"100%"});let i="";if(null==(t=co.on)||t.call(co,"error",e=>{const o=Array.isArray(e)?e:[e];i=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("; ")}),co.render(Ve.value),i)throw new Error(i);if(!o.childNodes.length)throw new Error("Infographic render returned empty output.");Te.value=!0,$e.value=!1,po=l,a(()=>{fo(r)&&Ye()})}catch(d){if(!fo(r))return;i&&!1===pe.loading&&l===Ae.value?(console.error("Failed to render infographic:",d),Te.value=!1,$e.value=!0,po="",be.value&&(be.value.innerHTML=`<div style="padding: var(--ms-inset-panel-body); color: hsl(var(--ms-destructive))">Failed to render infographic: ${d instanceof Error?d.message:"Unknown error"}</div>`)):(Te.value=u,$e.value=c,u&&be.value&&(be.value.innerHTML=s))}finally{if(vo=!1,fo(r))if(mo){const e=ho;mo=!1,ho=!1,a(()=>{Co(e)})}else!function(){e(this,null,function*(){const e=Se;e&&(Se="",yield a(),function(e=Ze.value){e&&ye.value&&(null==ze||ze.reportHeight(e,ye.value.offsetHeight))}(e),null==ze||ze.markSettled(e))})}()}})}function xo(e=!1){wo||!Le.value||Me.value||ke.value||a(()=>{wo||Co(e)})}r(()=>Ve.value,()=>{xo(!0)}),r(()=>pe.loading,(e,o)=>{o&&!e&&xo(!0)}),r(()=>Me.value,e=>{e||xo(!0)}),r(()=>ke.value,e=>{e||xo()}),r(()=>pe.maxHeight,()=>{a(()=>{Ye()})}),r([()=>pe.estimatedPreviewHeightPx,()=>Ve.value],()=>{Te.value||Me.value||(Ie.value=`${_e.value}px`)}),r(()=>Le.value,e=>{!e||Me.value||ke.value||xo()}),s(()=>{!Be.value&&L()&&(Me.value=!1),xo()}),u(()=>{var e,o;if(wo=!0,go+=1,mo=!1,ho=!1,null==(e=Pe.value)||e.destroy(),Pe.value=null,function(){const e=Se;e&&(Se="",null==ze||ze.markSettled(e))}(),co&&(null==(o=co.destroy)||o.call(co),co=null),po="","undefined"!=typeof window)try{window.removeEventListener("keydown",oo)}catch(n){}});const ko=i(()=>!L()),yo=i(()=>Me.value||ke.value),bo=i(()=>Me.value?"fallback":$e.value?"error":Te.value?"preview":"pending"),Mo=i(()=>({transform:`translate(${Oe.value}px, ${De.value}px) scale(${Ne.value})`}));return r(Mo,e=>{Fe.value&&je.value&&(je.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",N,[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",U,[m(e.$slots,"header-center",{},void 0,!0)])):pe.showModeToggle?(c(),d("div",A,[h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Me.value?"":"is-active",ko.value?"opacity-50 cursor-not-allowed":""]]),disabled:ko.value,onClick:o[0]||(o[0]=()=>We("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:Je,onBlur:Je},[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]=()=>We("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: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(we)("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,[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:Je,onBlur:Je},[(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,W)):g("",!0),pe.showCopyButton?(c(),d("button",{key:1,class:v(he),onClick:Qe,onMouseenter:o[9]||(o[9]=e=>Ke(e)),onFocus:o[10]||(o[10]=e=>Ke(e)),onMouseleave:Je,onBlur:Je},[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} ${yo.value?"opacity-50 cursor-not-allowed":""}`),disabled:yo.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: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,ne)):g("",!0),pe.showFullscreenButton?(c(),d("button",{key:3,class:v(`${he} ${yo.value?"opacity-50 cursor-not-allowed":""}`),disabled:yo.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:Je,onBlur:Je},[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: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: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: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: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:Je,onBlur:Je},w(Math.round(100*Ne.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},[Te.value||$e.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(Mo.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*Ne.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:He,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,Y))}}),[["__scopeId","data-v-de34ec4b"]]);pe.install=e=>{e.component(pe.__name,pe)};export{pe as default};
@@ -1 +1 @@
1
- import{ai as e,ab as f}from"./exports.js";function d(d){const r=e(d),i="vitesse-dark"===r||"vitesse-light"!==r&&f(r,!0===d.isDark);if("vitesse-dark"!==r&&"vitesse-light"!==r){const e=i?"var(--markstream-code-theme-bg, #121212)":"var(--markstream-code-theme-bg, #ffffff)";return{builtin:!1,dark:i,name:r,background:e,diffAddedLine:`color-mix(in lab, ${e} ${i?"80%":"88%"}, ${i?"#4d9375":"#1e754f"})`,diffAddedNumber:`color-mix(in lab, ${e} ${i?"85%":"91%"}, ${i?"#4d9375":"#1e754f"})`,diffRemovedLine:`color-mix(in lab, ${e} ${i?"80%":"88%"}, ${i?"#cb7676":"#ab5959"})`,diffRemovedNumber:`color-mix(in lab, ${e} ${i?"85%":"91%"}, ${i?"#cb7676":"#ab5959"})`,foreground:i?"var(--markstream-code-theme-fg, #dbd7caee)":"var(--markstream-code-theme-fg, #393a34)",lineNumber:i?"var(--markstream-code-theme-line-number, #dedcd550)":"var(--markstream-code-theme-line-number, #393a3450)"}}return i?{builtin:!0,dark:!0,name:r,background:"#121212",diffAddedLine:"color-mix(in lab, #121212 80%, #4d9375)",diffAddedNumber:"color-mix(in lab, #121212 85%, #4d9375)",diffRemovedLine:"color-mix(in lab, #121212 80%, #cb7676)",diffRemovedNumber:"color-mix(in lab, #121212 85%, #cb7676)",foreground:"#dbd7caee",lineNumber:"#dedcd550"}:{builtin:!0,dark:!1,name:r,background:"#ffffff",diffAddedLine:"color-mix(in lab, #ffffff 88%, #1e754f)",diffAddedNumber:"color-mix(in lab, #ffffff 91%, #1e754f)",diffRemovedLine:"color-mix(in lab, #ffffff 88%, #ab5959)",diffRemovedNumber:"color-mix(in lab, #ffffff 91%, #ab5959)",foreground:"#393a34",lineNumber:"#393a3450"}}export{d as r};
1
+ import{ak as e,ad as f}from"./exports.js";function d(d){const r=e(d),i="vitesse-dark"===r||"vitesse-light"!==r&&f(r,!0===d.isDark);if("vitesse-dark"!==r&&"vitesse-light"!==r){const e=i?"var(--markstream-code-theme-bg, #121212)":"var(--markstream-code-theme-bg, #ffffff)";return{builtin:!1,dark:i,name:r,background:e,diffAddedLine:`color-mix(in lab, ${e} ${i?"80%":"88%"}, ${i?"#4d9375":"#1e754f"})`,diffAddedNumber:`color-mix(in lab, ${e} ${i?"85%":"91%"}, ${i?"#4d9375":"#1e754f"})`,diffRemovedLine:`color-mix(in lab, ${e} ${i?"80%":"88%"}, ${i?"#cb7676":"#ab5959"})`,diffRemovedNumber:`color-mix(in lab, ${e} ${i?"85%":"91%"}, ${i?"#cb7676":"#ab5959"})`,foreground:i?"var(--markstream-code-theme-fg, #dbd7caee)":"var(--markstream-code-theme-fg, #393a34)",lineNumber:i?"var(--markstream-code-theme-line-number, #dedcd550)":"var(--markstream-code-theme-line-number, #393a3450)"}}return i?{builtin:!0,dark:!0,name:r,background:"#121212",diffAddedLine:"color-mix(in lab, #121212 80%, #4d9375)",diffAddedNumber:"color-mix(in lab, #121212 85%, #4d9375)",diffRemovedLine:"color-mix(in lab, #121212 80%, #cb7676)",diffRemovedNumber:"color-mix(in lab, #121212 85%, #cb7676)",foreground:"#dbd7caee",lineNumber:"#dedcd550"}:{builtin:!0,dark:!1,name:r,background:"#ffffff",diffAddedLine:"color-mix(in lab, #ffffff 88%, #1e754f)",diffAddedNumber:"color-mix(in lab, #ffffff 91%, #1e754f)",diffRemovedLine:"color-mix(in lab, #ffffff 88%, #ab5959)",diffRemovedNumber:"color-mix(in lab, #ffffff 91%, #ab5959)",foreground:"#393a34",lineNumber:"#393a3450"}}export{d as r};
package/dist/tailwind.js CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "markstream-vue",
3
3
  "type": "module",
4
- "version": "2.0.0",
4
+ "version": "2.0.1-beta.1",
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",
@@ -142,6 +142,7 @@
142
142
  },
143
143
  "devDependencies": {
144
144
  "@antfu/eslint-config": "^5.4.1",
145
+ "@pierre/diffs": "^1.2.12",
145
146
  "@shikijs/vitepress-twoslash": "^4.3.1",
146
147
  "@types/markdown-it-emoji": "^3.0.1",
147
148
  "@types/node": "^18.19.130",