Files
mermaid-live-editor/_app/immutable/chunks/StylePanel.809b7d51.CdSym_C1.js
T
2024-05-12 03:53:51 +00:00

5 lines
30 KiB
JavaScript

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