@mermaid-js/mermaid-zenuml
Version:
MermaidJS plugin for ZenUML integration
5 lines (4 loc) • 31.5 kB
JavaScript
import{A as B,B as Z,C as Xt,D as Yt,E as Gt,F as Jt,G as Kt,H as Qt,I as Zt,J as te,K as ee,a as kt,b as Dt,c as $t,d as jt,e as G,f as F,g as yt,h as H,i as wt,j as Nt,k as zt,l as Ht,m as Wt,n as j,o as Mt,p as xt,q as It,r as Vt,s as bt,t as Et,u as Ut,v as _t,w as at,x as qt,y as Ct,z as st}from"./chunk-W66TVRIS.mjs";import{a}from"./chunk-Z2ZEWN65.mjs";var de=["top","right","bottom","left"],ne=["start","end"],oe=de.reduce((t,e)=>t.concat(e,e+"-"+ne[0],e+"-"+ne[1]),[]),et=Math.min,J=Math.max,ut=Math.round,ct=Math.floor,q=a(t=>({x:t,y:t}),"X"),Oe={left:"right",right:"left",bottom:"top",top:"bottom"},Ae={start:"end",end:"start"};function Tt(t,e,n){return J(t,et(e,n))}a(Tt,"ye");function Q(t,e){return typeof t=="function"?t(e):t}a(Q,"K");function V(t){return t.split("-")[0]}a(V,"V");function W(t){return t.split("-")[1]}a(W,"M");function pe(t){return t==="x"?"y":"x"}a(pe,"He");function At(t){return t==="y"?"height":"width"}a(At,"xe");function mt(t){return["top","bottom"].includes(V(t))?"y":"x"}a(mt,"fe");function Ft(t){return pe(mt(t))}a(Ft,"be");function me(t,e,n){n===void 0&&(n=!1);let r=W(t),o=Ft(t),i=At(o),l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(l=dt(l)),[l,dt(l)]}a(me,"Ve");function Fe(t){let e=dt(t);return[ft(t),e,ft(e)]}a(Fe,"Tt");function ft(t){return t.replace(/start|end/g,e=>Ae[e])}a(ft,"ae");function Le(t,e,n){let r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(t){case"top":case"bottom":return n?e?o:r:e?r:o;case"left":case"right":return e?i:l;default:return[]}}a(Le,"Rt");function Pe(t,e,n,r){let o=W(t),i=Le(V(t),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),e&&(i=i.concat(i.map(ft)))),i}a(Pe,"Pt");function dt(t){return t.replace(/left|right|bottom|top/g,e=>Oe[e])}a(dt,"ce");function Be(t){return{top:0,right:0,bottom:0,left:0,...t}}a(Be,"Ft");function ve(t){return typeof t!="number"?Be(t):{top:t,right:t,bottom:t,left:t}}a(ve,"We");function pt(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}a(pt,"ue");function re(t,e,n){let{reference:r,floating:o}=t,i=mt(e),l=Ft(e),s=At(l),u=V(e),f=i==="y",p=r.x+r.width/2-o.width/2,m=r.y+r.height/2-o.height/2,v=r[s]/2-o[s]/2,d;switch(u){case"top":d={x:p,y:r.y-o.height};break;case"bottom":d={x:p,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:m};break;case"left":d={x:r.x-o.width,y:m};break;default:d={x:r.x,y:r.y}}switch(W(e)){case"start":d[l]-=v*(n&&f?-1:1);break;case"end":d[l]+=v*(n&&f?-1:1);break}return d}a(re,"Fe");var ke=a(async(t,e,n)=>{let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,s=i.filter(Boolean),u=await(l.isRTL==null?void 0:l.isRTL(e)),f=await l.getElementRects({reference:t,floating:e,strategy:o}),{x:p,y:m}=re(f,r,u),v=r,d={},c=0;for(let h=0;h<s.length;h++){let{name:y,fn:g}=s[h],{x,y:E,data:C,reset:b}=await g({x:p,y:m,initialPlacement:r,placement:v,strategy:o,middlewareData:d,rects:f,platform:l,elements:{reference:t,floating:e}});if(p=x??p,m=E??m,d={...d,[y]:{...d[y],...C}},b&&c<=50){c++,typeof b=="object"&&(b.placement&&(v=b.placement),b.rects&&(f=b.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:o}):b.rects),{x:p,y:m}=re(f,v,u)),h=-1;continue}}return{x:p,y:m,placement:v,strategy:o,middlewareData:d}},"Lt");async function ot(t,e){var n;e===void 0&&(e={});let{x:r,y:o,platform:i,rects:l,elements:s,strategy:u}=t,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:v=!1,padding:d=0}=Q(e,t),c=ve(d),h=s[v?m==="floating"?"reference":"floating":m],y=pt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:f,rootBoundary:p,strategy:u})),g=m==="floating"?{...l.floating,x:r,y:o}:l.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),E=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=pt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:g,offsetParent:x,strategy:u}):g);return{top:(y.top-C.top+c.top)/E.y,bottom:(C.bottom-y.bottom+c.bottom)/E.y,left:(y.left-C.left+c.left)/E.x,right:(C.right-y.right+c.right)/E.x}}a(ot,"ne");var De=a(t=>({name:"arrow",options:t,async fn(e){let{x:n,y:r,placement:o,rects:i,platform:l,elements:s,middlewareData:u}=e,{element:f,padding:p=0}=Q(t,e)||{};if(f==null)return{};let m=ve(p),v={x:n,y:r},d=Ft(o),c=At(d),h=await l.getDimensions(f),y=d==="y",g=y?"top":"left",x=y?"bottom":"right",E=y?"clientHeight":"clientWidth",C=i.reference[c]+i.reference[d]-v[d]-i.floating[c],b=v[d]-i.reference[d],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f)),S=T?T[E]:0;(!S||!await(l.isElement==null?void 0:l.isElement(T)))&&(S=s.floating[E]||i.floating[c]);let R=C/2-b/2,O=S/2-h[c]/2-1,L=et(m[g],O),A=et(m[x],O),P=L,Y=S-h[c]-A,k=S/2-h[c]/2+R,N=Tt(P,k,Y),z=!u.arrow&&W(o)!=null&&k!=N&&i.reference[c]/2-(k<P?L:A)-h[c]/2<0,I=z?k<P?k-P:k-Y:0;return{[d]:v[d]+I,data:{[d]:N,centerOffset:k-N-I,...z&&{alignmentOffset:I}},reset:z}}}),"Bt");function $e(t,e,n){return(t?[...n.filter(r=>W(r)===t),...n.filter(r=>W(r)!==t)]:n.filter(r=>V(r)===r)).filter(r=>t?W(r)===t||(e?ft(r)!==r:!1):!0)}a($e,"kt");var je=a(function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,r,o;let{rects:i,middlewareData:l,placement:s,platform:u,elements:f}=e,{crossAxis:p=!1,alignment:m,allowedPlacements:v=oe,autoAlignment:d=!0,...c}=Q(t,e),h=m!==void 0||v===oe?$e(m||null,d,v):v,y=await ot(e,c),g=((n=l.autoPlacement)==null?void 0:n.index)||0,x=h[g];if(x==null)return{};let E=me(x,i,await(u.isRTL==null?void 0:u.isRTL(f.floating)));if(s!==x)return{reset:{placement:h[0]}};let C=[y[V(x)],y[E[0]],y[E[1]]],b=[...((r=l.autoPlacement)==null?void 0:r.overflows)||[],{placement:x,overflows:C}],T=h[g+1];if(T)return{data:{index:g+1,overflows:b},reset:{placement:T}};let S=b.map(O=>{let L=W(O.placement);return[O.placement,L&&p?O.overflows.slice(0,2).reduce((A,P)=>A+P,0):O.overflows[0],O.overflows]}).sort((O,L)=>O[1]-L[1]),R=((o=S.filter(O=>O[2].slice(0,W(O[0])?2:3).every(L=>L<=0))[0])==null?void 0:o[0])||S[0][0];return R!==s?{data:{index:g+1,overflows:b},reset:{placement:R}}:{}}}},"Dt"),Ne=a(function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;let{placement:o,middlewareData:i,rects:l,initialPlacement:s,platform:u,elements:f}=e,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:v,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:c="none",flipAlignment:h=!0,...y}=Q(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=V(o),x=V(s)===s,E=await(u.isRTL==null?void 0:u.isRTL(f.floating)),C=v||(x||!h?[dt(s)]:Fe(s));!v&&c!=="none"&&C.push(...Pe(s,h,c,E));let b=[s,...C],T=await ot(e,y),S=[],R=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&S.push(T[g]),m){let P=me(o,l,E);S.push(T[P[0]],T[P[1]])}if(R=[...R,{placement:o,overflows:S}],!S.every(P=>P<=0)){var O,L;let P=(((O=i.flip)==null?void 0:O.index)||0)+1,Y=b[P];if(Y)return{data:{index:P,overflows:R},reset:{placement:Y}};let k=(L=R.filter(N=>N.overflows[0]<=0).sort((N,z)=>N.overflows[1]-z.overflows[1])[0])==null?void 0:L.placement;if(!k)switch(d){case"bestFit":{var A;let N=(A=R.map(z=>[z.placement,z.overflows.filter(I=>I>0).reduce((I,Se)=>I+Se,0)]).sort((z,I)=>z[1]-I[1])[0])==null?void 0:A[0];N&&(k=N);break}case"initialPlacement":k=s;break}if(o!==k)return{reset:{placement:k}}}return{}}}},"Nt");function ie(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}a(ie,"Le");function le(t){return de.some(e=>t[e]>=0)}a(le,"Be");var ze=a(function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n}=e,{strategy:r="referenceHidden",...o}=Q(t,e);switch(r){case"referenceHidden":{let i=await ot(e,{...o,elementContext:"reference"}),l=ie(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:le(l)}}}case"escaped":{let i=await ot(e,{...o,altBoundary:!0}),l=ie(i,n.floating);return{data:{escapedOffsets:l,escaped:le(l)}}}default:return{}}}}},"$t");async function He(t,e){let{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=V(n),s=W(n),u=mt(n)==="y",f=["left","top"].includes(l)?-1:1,p=i&&u?-1:1,m=Q(e,t),{mainAxis:v,crossAxis:d,alignmentAxis:c}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return s&&typeof c=="number"&&(d=s==="end"?c*-1:c),u?{x:d*p,y:v*f}:{x:v*f,y:d*p}}a(He,"jt");var We=a(function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){let{x:n,y:r}=e,o=await He(e,t);return{x:n+o.x,y:r+o.y,data:o}}}},"Mt"),Me=a(function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:l=!1,limiter:s={fn:y=>{let{x:g,y:x}=y;return{x:g,y:x}}},...u}=Q(t,e),f={x:n,y:r},p=await ot(e,u),m=mt(V(o)),v=pe(m),d=f[v],c=f[m];if(i){let y=v==="y"?"top":"left",g=v==="y"?"bottom":"right",x=d+p[y],E=d-p[g];d=Tt(x,d,E)}if(l){let y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",x=c+p[y],E=c-p[g];c=Tt(x,c,E)}let h=s.fn({...e,[v]:d,[m]:c});return{...h,data:{x:h.x-n,y:h.y-r}}}}},"It");function X(t){return he(t)?(t.nodeName||"").toLowerCase():"#document"}a(X,"q");function D(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}a(D,"k");function _(t){var e;return(e=(he(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}a(_,"U");function he(t){return t instanceof Node||t instanceof D(t).Node}a(he,"Ue");function U(t){return t instanceof Element||t instanceof D(t).Element}a(U,"W");function M(t){return t instanceof HTMLElement||t instanceof D(t).HTMLElement}a(M,"I");function ae(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof D(t).ShadowRoot}a(ae,"ke");function lt(t){let{overflow:e,overflowX:n,overflowY:r,display:o}=$(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(o)}a(lt,"re");function Ie(t){return["table","td","th"].includes(X(t))}a(Ie,"_t");function Lt(t){let e=Pt(),n=$(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}a(Lt,"Ce");function Ve(t){let e=nt(t);for(;M(e)&&!vt(e);){if(Lt(e))return e;e=nt(e)}return null}a(Ve,"zt");function Pt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}a(Pt,"Oe");function vt(t){return["html","body","#document"].includes(X(t))}a(vt,"de");function $(t){return D(t).getComputedStyle(t)}a($,"D");function ht(t){return U(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}a(ht,"me");function nt(t){if(X(t)==="html")return t;let e=t.assignedSlot||t.parentNode||ae(t)&&t.host||_(t);return ae(e)?e.host:e}a(nt,"ee");function ge(t){let e=nt(t);return vt(e)?t.ownerDocument?t.ownerDocument.body:t.body:M(e)&<(e)?e:ge(e)}a(ge,"Xe");function rt(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let o=ge(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),l=D(o);return i?e.concat(l,l.visualViewport||[],lt(o)?o:[],l.frameElement&&n?rt(l.frameElement):[]):e.concat(o,rt(o,[],n))}a(rt,"oe");function ye(t){let e=$(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,o=M(t),i=o?t.offsetWidth:n,l=o?t.offsetHeight:r,s=ut(n)!==i||ut(r)!==l;return s&&(n=i,r=l),{width:n,height:r,$:s}}a(ye,"qe");function Bt(t){return U(t)?t:t.contextElement}a(Bt,"Ee");function tt(t){let e=Bt(t);if(!M(e))return q(1);let n=e.getBoundingClientRect(),{width:r,height:o,$:i}=ye(e),l=(i?ut(n.width):n.width)/r,s=(i?ut(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}a(tt,"Z");var Ue=q(0);function we(t){let e=D(t);return!Pt()||!e.visualViewport?Ue:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}a(we,"Ye");function _e(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==D(t)?!1:e}a(_e,"Vt");function K(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let o=t.getBoundingClientRect(),i=Bt(t),l=q(1);e&&(r?U(r)&&(l=tt(r)):l=tt(t));let s=_e(i,n,r)?we(i):q(0),u=(o.left+s.x)/l.x,f=(o.top+s.y)/l.y,p=o.width/l.x,m=o.height/l.y;if(i){let v=D(i),d=r&&U(r)?D(r):r,c=v.frameElement;for(;c&&r&&d!==v;){let h=tt(c),y=c.getBoundingClientRect(),g=$(c),x=y.left+(c.clientLeft+parseFloat(g.paddingLeft))*h.x,E=y.top+(c.clientTop+parseFloat(g.paddingTop))*h.y;u*=h.x,f*=h.y,p*=h.x,m*=h.y,u+=x,f+=E,c=D(c).frameElement}}return pt({width:p,height:m,x:u,y:f})}a(K,"G");function qe(t){let{rect:e,offsetParent:n,strategy:r}=t,o=M(n),i=_(n);if(n===i)return e;let l={scrollLeft:0,scrollTop:0},s=q(1),u=q(0);if((o||!o&&r!=="fixed")&&((X(n)!=="body"||lt(i))&&(l=ht(n)),M(n))){let f=K(n);s=tt(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}return{width:e.width*s.x,height:e.height*s.y,x:e.x*s.x-l.scrollLeft*s.x+u.x,y:e.y*s.y-l.scrollTop*s.y+u.y}}a(qe,"Wt");function Xe(t){return Array.from(t.getClientRects())}a(Xe,"Ut");function xe(t){return K(_(t)).left+ht(t).scrollLeft}a(xe,"Ge");function Ye(t){let e=_(t),n=ht(t),r=t.ownerDocument.body,o=J(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=J(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),l=-n.scrollLeft+xe(t),s=-n.scrollTop;return $(r).direction==="rtl"&&(l+=J(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:s}}a(Ye,"Xt");function Ge(t,e){let n=D(t),r=_(t),o=n.visualViewport,i=r.clientWidth,l=r.clientHeight,s=0,u=0;if(o){i=o.width,l=o.height;let f=Pt();(!f||f&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:l,x:s,y:u}}a(Ge,"qt");function Je(t,e){let n=K(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=M(t)?tt(t):q(1),l=t.clientWidth*i.x,s=t.clientHeight*i.y,u=o*i.x,f=r*i.y;return{width:l,height:s,x:u,y:f}}a(Je,"Yt");function se(t,e,n){let r;if(e==="viewport")r=Ge(t,n);else if(e==="document")r=Ye(_(t));else if(U(e))r=Je(e,n);else{let o=we(t);r={...e,x:e.x-o.x,y:e.y-o.y}}return pt(r)}a(se,"De");function be(t,e){let n=nt(t);return n===e||!U(n)||vt(n)?!1:$(n).position==="fixed"||be(n,e)}a(be,"Ke");function Ke(t,e){let n=e.get(t);if(n)return n;let r=rt(t,[],!1).filter(s=>U(s)&&X(s)!=="body"),o=null,i=$(t).position==="fixed",l=i?nt(t):t;for(;U(l)&&!vt(l);){let s=$(l),u=Lt(l);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&o&&["absolute","fixed"].includes(o.position)||lt(l)&&!u&&be(t,l))?r=r.filter(f=>f!==l):o=s,l=nt(l)}return e.set(t,r),r}a(Ke,"Gt");function Qe(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t,i=[...n==="clippingAncestors"?Ke(e,this._c):[].concat(n),r],l=i[0],s=i.reduce((u,f)=>{let p=se(e,f,o);return u.top=J(p.top,u.top),u.right=et(p.right,u.right),u.bottom=et(p.bottom,u.bottom),u.left=J(p.left,u.left),u},se(e,l,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}a(Qe,"Kt");function Ze(t){return ye(t)}a(Ze,"Qt");function tn(t,e,n){let r=M(e),o=_(e),i=n==="fixed",l=K(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=q(0);if(r||!r&&!i)if((X(e)!=="body"||lt(o))&&(s=ht(e)),r){let f=K(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=xe(o));return{x:l.left+s.scrollLeft-u.x,y:l.top+s.scrollTop-u.y,width:l.width,height:l.height}}a(tn,"Zt");function ce(t,e){return!M(t)||$(t).position==="fixed"?null:e?e(t):t.offsetParent}a(ce,"Ne");function Ee(t,e){let n=D(t);if(!M(t))return n;let r=ce(t,e);for(;r&&Ie(r)&&$(r).position==="static";)r=ce(r,e);return r&&(X(r)==="html"||X(r)==="body"&&$(r).position==="static"&&!Lt(r))?n:r||Ve(t)||n}a(Ee,"Qe");var en=a(async function(t){let{reference:e,floating:n,strategy:r}=t,o=this.getOffsetParent||Ee,i=this.getDimensions;return{reference:tn(e,await o(n),r),floating:{x:0,y:0,...await i(n)}}},"Jt");function nn(t){return $(t).direction==="rtl"}a(nn,"en");var on={convertOffsetParentRelativeRectToViewportRelativeRect:qe,getDocumentElement:_,getClippingRect:Qe,getOffsetParent:Ee,getElementRects:en,getClientRects:Xe,getDimensions:Ze,getScale:tt,isElement:U,isRTL:nn};function rn(t,e){let n=null,r,o=_(t);function i(){clearTimeout(r),n&&n.disconnect(),n=null}a(i,"r");function l(s,u){s===void 0&&(s=!1),u===void 0&&(u=1),i();let{left:f,top:p,width:m,height:v}=t.getBoundingClientRect();if(s||e(),!m||!v)return;let d=ct(p),c=ct(o.clientWidth-(f+m)),h=ct(o.clientHeight-(p+v)),y=ct(f),g={rootMargin:-d+"px "+-c+"px "+-h+"px "+-y+"px",threshold:J(0,et(1,u))||1},x=!0;function E(C){let b=C[0].intersectionRatio;if(b!==u){if(!x)return l();b?l(!1,b):r=setTimeout(()=>{l(!1,1e-7)},100)}x=!1}a(E,"C");try{n=new IntersectionObserver(E,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,g)}n.observe(t)}return a(l,"s"),l(!0),i}a(rn,"nn");function ln(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Bt(t),p=o||i?[...f?rt(f):[],...rt(e)]:[];p.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});let m=f&&s?rn(f,n):null,v=-1,d=null;l&&(d=new ResizeObserver(g=>{let[x]=g;x&&x.target===f&&d&&(d.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{d&&d.observe(e)})),n()}),f&&!u&&d.observe(f),d.observe(e));let c,h=u?K(t):null;u&&y();function y(){let g=K(t);h&&(g.x!==h.x||g.y!==h.y||g.width!==h.width||g.height!==h.height)&&n(),h=g,c=requestAnimationFrame(y)}return a(y,"v"),n(),()=>{p.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),m&&m(),d&&d.disconnect(),d=null,u&&cancelAnimationFrame(c)}}a(ln,"on");var an=a((t,e,n)=>{let r=new Map,o={platform:on,...n},i={...o.platform,_c:r};return ke(t,e,{...o,platform:i})},"rn");function St(t){var e;return(e=t?.$el)!=null?e:t}a(St,"we");function sn(t){return{name:"arrow",options:t,fn(e){let n=St(H(t.element));return n==null?{}:De({element:n,padding:t.padding}).fn(e)}}}a(sn,"sn");function cn(t,e,n){n===void 0&&(n={});let r=n.whileElementsMounted,o=B(()=>{var b;return(b=H(n.open))!=null?b:!0}),i=B(()=>H(n.middleware)),l=B(()=>{var b;return(b=H(n.placement))!=null?b:"bottom"}),s=B(()=>{var b;return(b=H(n.strategy))!=null?b:"absolute"}),u=B(()=>St(t.value)),f=B(()=>St(e.value)),p=F(null),m=F(null),v=F(s.value),d=F(l.value),c=yt({}),h=F(!1),y;function g(){u.value==null||f.value==null||an(u.value,f.value,{middleware:i.value,placement:l.value,strategy:s.value}).then(b=>{p.value=b.x,m.value=b.y,v.value=b.strategy,d.value=b.placement,c.value=b.middlewareData,h.value=!0})}a(g,"g");function x(){typeof y=="function"&&(y(),y=void 0)}a(x,"x");function E(){if(x(),r===void 0){g();return}if(u.value!=null&&f.value!=null){y=r(u.value,f.value,g);return}}a(E,"b");function C(){o.value||(h.value=!1)}return a(C,"C"),j([i,l,s],g,{flush:"sync"}),j([u,f],E,{flush:"sync"}),j(o,C,{flush:"sync"}),$t()&&jt(x),{x:G(p),y:G(m),strategy:G(v),placement:G(d),middlewareData:G(c),isPositioned:G(h),update:g}}a(cn,"ln");var un=Object.defineProperty,fn=a((t,e,n)=>e in t?un(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,"cn"),dn=a((t,e,n)=>(fn(t,typeof e!="symbol"?e+"":e,n),n),"un");function it(t){var e;if(t==null||t.value==null)return null;let n=(e=t.value.$el)!=null?e:t.value;return n.$el?it(F(n)):n}a(it,"ie");var Ot=class{static{a(this,"fn")}constructor(){dn(this,"current",this.detect())}set(e){this.current!==e&&(this.current=e)}reset(){this.set(this.detect())}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}},gt=new Ot;function Ce(t){return t.reduce((e,n)=>n.type===bt?e.concat(Ce(n.children)):e.concat(n),[])}a(Ce,"Ze");function pn(t){return t==null?!1:typeof t.type=="string"||typeof t.type=="object"||typeof t.type=="function"}a(pn,"dn");function ue(t){return t=H(t),t&&t?.nodeType!==Node.COMMENT_NODE}a(ue,"$e");function mn(t){if(gt.isServer)return null;if(t instanceof Node)return t.ownerDocument;if(Object.prototype.hasOwnProperty.call(t,"value")){let e=it(t);if(e)return e.ownerDocument}return document}a(mn,"mn");function vn(t,e,n,r,o){j([()=>o.offset,()=>o.flip,()=>o.shift,()=>o.autoPlacement,()=>o.arrow,()=>o.hide,()=>o.middleware],()=>{let i=[];(typeof o.offset=="number"||typeof o.offset=="object"||typeof o.offset=="function")&&i.push(We(o.offset)),(o.flip===!0||typeof o.flip=="number"||typeof o.flip=="object")&&i.push(Ne({padding:typeof o.flip=="number"?o.flip:void 0,...typeof o.flip=="object"?o.flip:{}})),(o.shift===!0||typeof o.shift=="number"||typeof o.shift=="object")&&i.push(Me({padding:typeof o.shift=="number"?o.shift:void 0,...typeof o.shift=="object"?o.shift:{}})),(o.autoPlacement===!0||typeof o.autoPlacement=="object")&&i.push(je(typeof o.autoPlacement=="object"?o.autoPlacement:void 0)),(o.arrow===!0||typeof o.arrow=="number")&&i.push(sn({element:r,padding:o.arrow===!0?0:o.arrow})),i.push(...typeof o.middleware=="function"?o.middleware({referenceEl:e,floatingEl:n}):o.middleware||[]),(o.hide===!0||typeof o.hide=="object")&&i.push(ze(typeof o.hide=="object"?o.hide:void 0)),t.value=i},{immediate:!0})}a(vn,"pn");function hn(t,e,n){let r=a(()=>{},"i");xt(()=>{if(t&>.isClient&&typeof ResizeObserver<"u"&&e.value&&e.value instanceof Element){let o=new ResizeObserver(([i])=>{n.value=i.borderBoxSize.reduce((l,{inlineSize:s})=>l+s,0)});o.observe(e.value),r=a(()=>{o.disconnect(),n.value=null},"i")}}),It(()=>{r()})}a(hn,"gn");var gn=a(t=>{switch(t){case"top":return"origin-bottom";case"bottom":return"origin-top";case"left":return"origin-right";case"right":return"origin-left";case"top-start":case"right-end":return"origin-bottom-left";case"top-end":case"left-end":return"origin-bottom-right";case"right-start":case"bottom-start":return"origin-top-left";case"left-start":case"bottom-end":return"origin-top-right";default:return""}},"hn");function yn(t,e){let n=B(()=>{if(typeof t.originClass=="function")return t.originClass(e.value);if(typeof t.originClass=="string")return t.originClass;if(t.tailwindcssOriginClass)return gn(e.value)}),r=B(()=>t.enter||n.value?`${t.enter||""} ${n.value||""}`:void 0),o=B(()=>t.leave||n.value?`${t.leave||""} ${n.value||""}`:void 0);return{originClassRef:n,enterActiveClassRef:r,leaveActiveClassRef:o}}a(yn,"vn");function Re(t,e,...n){if(t in e){let o=e[t];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Re),r}a(Re,"Je");var fe=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(t=>`${t}:not([tabindex='-1'])`).join(","),Te=(t=>(t[t.Strict=0]="Strict",t[t.Loose=1]="Loose",t))(Te||{});function wn(t,e=0){var n;return t===((n=mn(t))==null?void 0:n.body)?!1:Re(e,{0(){return t.matches(fe)},1(){let r=t;for(;r!==null;){if(r.matches(fe))return!0;r=r.parentElement}return!1}})}a(wn,"yn");function Rt(t,e,n){gt.isServer||Wt(r=>{document.addEventListener(t,e,n),r(()=>document.removeEventListener(t,e,n))})}a(Rt,"ve");function xn(t,e,n=B(()=>!0)){function r(i,l){if(!n.value||i.defaultPrevented)return;let s=l(i);if(s===null||!s.getRootNode().contains(s))return;let u=a(function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]},"u")(t);for(let f of u){if(f===null)continue;let p=f instanceof HTMLElement?f:it(f);if(p!=null&&p.contains(s)||i.composed&&i.composedPath().includes(p))return}return!wn(s,Te.Loose)&&s.tabIndex!==-1&&i.preventDefault(),e(i,s)}a(r,"i");let o=F(null);Rt("mousedown",i=>{var l,s;n.value&&(o.value=((s=(l=i.composedPath)==null?void 0:l.call(i))==null?void 0:s[0])||i.target)},!0),Rt("click",i=>{o.value&&(r(i,()=>o.value),o.value=null)},!0),Rt("blur",i=>r(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}a(xn,"wn");var bn=Symbol("ArrowContext"),w={as:{type:[String,Function],default:"template"},floatingAs:{type:[String,Function],default:"div"},show:{type:Boolean,default:null},placement:{type:String,default:"bottom-start"},strategy:{type:String,default:"absolute"},offset:[Number,Function,Object],shift:{type:[Boolean,Number,Object],default:!1},flip:{type:[Boolean,Number,Object],default:!1},arrow:{type:[Boolean,Number],default:!1},autoPlacement:{type:[Boolean,Object],default:!1},hide:{type:[Boolean,Object],default:!1},autoUpdate:{type:[Boolean,Object],default:!0},zIndex:{type:[Number,String],default:9999},transitionName:String,transitionType:String,enter:String,enterFrom:String,enterTo:String,leave:String,leaveFrom:String,leaveTo:String,originClass:[String,Function],tailwindcssOriginClass:{type:Boolean,default:!1},portal:{type:Boolean,default:!1},transform:{type:Boolean,default:!0},adaptiveWidth:{type:Boolean,default:!1},composable:{type:Boolean,default:!1},dialog:{type:Boolean,default:!1},middleware:{type:[Array,Function],default:()=>[]}};function En(t,e,n,r){let{floatingRef:o,props:i,mounted:l,show:s,x:u,y:f,placement:p,strategy:m,referenceElWidth:v,updateFloating:d}=r,c=st({...i,as:i.floatingAs},e),{enterActiveClassRef:h,leaveActiveClassRef:y}=yn(c,p),g={enterActiveClass:h.value,enterFromClass:c.enterFrom,enterToClass:c.enterTo,leaveActiveClass:y.value,leaveFromClass:c.leaveFrom,leaveToClass:c.leaveTo},x={name:c.transitionName,type:c.transitionType,appear:!0,...c.transitionName?{}:g,onBeforeEnter(){s.value=!0},onAfterLeave(){s.value=!1}},E={enter:h.value,enterFrom:c.enterFrom,enterTo:c.enterTo,leave:y.value,leaveFrom:c.leaveFrom,leaveTo:c.leaveTo,onBeforeEnter:x.onBeforeEnter,onAfterLeave:x.onAfterLeave},C={style:{...!c.dialog&&c.transform?{position:m.value,zIndex:c.zIndex,top:"0px",left:"0px",right:"auto",bottom:"auto",transform:`translate(${Math.round(u.value||0)}px,${Math.round(f.value||0)}px)`}:{position:m.value,zIndex:c.zIndex,top:`${f.value||0}px`,left:`${u.value||0}px`},width:c.adaptiveWidth&&typeof v.value=="number"?`${v.value}px`:void 0}};function b(R){return c.portal?Z(te,()=>R):R}a(b,"w");function T(R){let O=st(C,n,c.dialog?{}:{ref:o});return c.as==="template"?R:typeof c.as=="string"?Z(c.as,O,R):Z(c.as,O,()=>R)}a(T,"O");function S(){function R(){var O;let L=c.as==="template"?st(C,n,c.dialog?{}:{ref:o}):null,A=qt(t,L);return((O=A.props)==null?void 0:O.unmount)===!1?(d(),A):typeof c.show!="boolean"||c.show?A:Ct()}return a(R,"A"),gt.isServer?l.value&&c.show?R():Ct():c.transitionChild?Z(ee,{key:`placement-${p.value}`,...c.dialog?{ref:o}:{},as:"template",...E},R):Z(Xt,{...c.dialog?{ref:o}:{},...x},R)}return a(S,"E"),b(T(S()))}a(En,"bn");function Cn(t,e,n,r,o){let i=F(!1),l=wt(r,"placement"),s=wt(r,"strategy"),u=yt({}),f=F(null),p=F(void 0),m=F(void 0),v=B(()=>it(e)),d=B(()=>it(n)),c=B(()=>ue(v)&&ue(d)),{x:h,y,placement:g,strategy:x,middlewareData:E,update:C}=cn(v,d,{placement:l,strategy:s,middleware:u,whileElementsMounted:()=>{}}),b=F(null);xt(()=>{i.value=!0}),j(t,(A,P)=>{A&&!P?o("show"):!A&&P&&o("hide")},{immediate:!0});function T(){c.value&&(C(),o("update"))}a(T,"O"),j([l,s,u],T,{flush:"sync"}),vn(u,v,d,f,r),j(E,()=>{let A=E.value.arrow;p.value=A?.x,m.value=A?.y}),hn(r.adaptiveWidth,v,b),j(t,async(A,P,Y)=>{if(await Nt(),t.value&&c.value&&r.autoUpdate){let k=ln(v.value,d.value,T,typeof r.autoUpdate=="object"?r.autoUpdate:void 0);Y(k)}},{flush:"post",immediate:!0});let S=F(!0);j(v,()=>{!(v.value instanceof Element)&&c.value&&S.value&&(S.value=!1,window.requestAnimationFrame(()=>{S.value=!0,T()}))},{flush:"sync"});let R={referenceRef:e,placement:g},O={floatingRef:n,props:r,mounted:i,show:t,x:h,y,placement:g,strategy:x,referenceElWidth:b,updateFloating:T},L={ref:f,placement:g,x:p,y:m};return Ht(bn,L),{referenceApi:R,floatingApi:O,arrowApi:L,x:h,y,placement:g,strategy:x,referenceEl:v,floatingEl:d,middlewareData:E,update:T}}a(Cn,"Cn");({...w.as});var Rn={as:w.as,show:w.show,placement:w.placement,strategy:w.strategy,offset:w.offset,shift:w.shift,flip:w.flip,arrow:w.arrow,autoPlacement:w.autoPlacement,hide:w.hide,autoUpdate:w.autoUpdate,zIndex:w.zIndex,transitionName:w.transitionName,transitionType:w.transitionType,enter:w.enter,enterFrom:w.enterFrom,enterTo:w.enterTo,leave:w.leave,leaveFrom:w.leaveFrom,leaveTo:w.leaveTo,originClass:w.originClass,tailwindcssOriginClass:w.tailwindcssOriginClass,portal:w.portal,transform:w.transform,middleware:w.middleware},Tn={name:"FloatVirtual",inheritAttrs:!1,props:Rn,emits:["initial","show","hide","update"],setup(t,{emit:e,slots:n,attrs:r}){var o;let i=F((o=t.show)!=null?o:!1),l=F({getBoundingClientRect(){return{x:0,y:0,top:0,left:0,bottom:0,right:0,width:0,height:0}}}),s=F(null),{floatingApi:u,placement:f}=Cn(i,l,s,t,e);j(()=>t.show,()=>{var m;i.value=(m=t.show)!=null?m:!1});function p(){i.value=!1}return a(p,"u"),e("initial",{show:i,placement:f,reference:l,floating:s}),()=>{if(!n.default)return;let m={placement:f.value,close:p},[v]=Ce(n.default(m)).filter(pn);return En(v,{as:t.as,show:i.value},r,u)}}};w.as,w.placement,w.strategy,w.offset,w.shift,{...w.flip},w.arrow,w.autoPlacement,w.hide,w.autoUpdate,w.zIndex,w.transitionName,w.transitionType,w.enter,w.enterFrom,w.enterTo,w.leave,w.leaveFrom,w.leaveTo,w.originClass,w.tailwindcssOriginClass,w.transform,w.middleware;var Sn={class:"flex bg-white shadow-md z-10 rounded-md p-1"},On=["onClick"],Fn=Mt({__name:"StylePanel",setup(t){let e=F({value:null}),n=Yt(),r=B(()=>n.getters.onContentChange||(()=>{})),o=B(()=>Zt(n.getters.diagramElement)+Qt),i=B(()=>n.getters.code),l=a(m=>{n.dispatch("updateCode",{code:m}),r.value(m)},"s"),s=F([]),u,f=a(({show:m,reference:v,floating:d})=>{let c,h,y,g,x,E;n.commit("onMessageClick",(C,b)=>{var T;if(c=C.value.start.start,h=Gt(i.value,c),y=Kt(i.value,c),g=((T=i.value.slice(h).match(/^\s*/))==null?void 0:T[0])||"",x=y.trim().startsWith("//"),x){let S=y.trimStart().slice(2).trimStart(),R=S.indexOf("["),O=S.indexOf("]");E=!!(R===0&&O),E?s.value=S.slice(R+1,O).split(",").map(L=>L.trim()):s.value=[]}v.value={getBoundingClientRect:()=>b.getBoundingClientRect()},e.value=C,m.value=!0}),xn(d,()=>{m.value=!1,s.value=[]},B(()=>m.value)),u=a(C=>{var b;if(m.value=!1,!!e.value.value)if(x){let T="";if(E){let S;s.value.includes(C)?S=s.value.filter(R=>R!==C):S=[...s.value,C],T=`${g}// [${S.filter(Boolean).join(", ")}] ${y.slice(y.indexOf("]")+1).trimStart()}`}else T=`${g}// [${C}] ${y.slice((((b=y.match(/\/\/*/))==null?void 0:b.index)||-2)+2).trimStart()}`;T.endsWith(`
`)||(T+=`
`),l(i.value.slice(0,Jt(i.value,c))+T+i.value.slice(h))}else l(i.value.slice(0,h)+`${g}// [${C}]
`+i.value.slice(h))},"c")},"u"),p=[{name:"bold",content:"B",class:"font-bold"},{name:"italic",content:"I",class:"italic"},{name:"underline",content:"U",class:"underline"},{name:"strikethrough",content:"S",class:"line-through"}];return(m,v)=>(Et(),_t(H(Tn),{key:"tool",onInitial:f,placement:"top",offset:5,flip:{padding:H(o)},shift:"",zIndex:"30"},{default:zt(()=>[at("div",Sn,[(Et(),Ut(bt,null,Vt(p,d=>at("div",{onClick:()=>H(u)(d.class),key:d.name},[at("div",{class:kt(["w-6 mx-1 py-1 rounded-md text-black text-center cursor-pointer hover:bg-gray-200",[d.class,{"bg-gray-100":s.value.includes(d.class)}]])},Dt(d.content),3)],8,On)),64))])],void 0,!0),_:1},8,["flip"]))}});export{Fn as default};