livebook/static/assets/stateDiagram-133e3642-Y5QZMNOM.js

2 lines
10 KiB
JavaScript
Raw Normal View History

2023-07-20 03:58:40 +08:00
import{a as C,g as N,h as v}from"./chunk-DXW4N2CS.js";import{a as T,b as W}from"./chunk-QFWTWYMO.js";import"./chunk-2MTWH372.js";import{Ka as F,b as $,c as I,da as B,h as H,ha as z,na as t,oa as U,w as P,y as R,z as _}from"./chunk-KU2GO2AH.js";import{h as L}from"./chunk-2YVZDWG7.js";var wt=L($(),1),mt=L(I(),1),bt=L(_(),1);var A={},q=(e,a)=>{A[e]=a},Z=e=>A[e],J=()=>Object.keys(A),j=()=>J().length,D={get:Z,set:q,keys:J,size:j},K=e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),Q=e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),V=(e,a)=>{let o=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(a.id),d=o.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",d.width+2*t().state.padding).attr("height",d.height+2*t().state.padding).attr("rx",t().state.radius),o},tt=(e,a)=>{let o=function(c,m,f){let S=c.append("tspan").attr("x",2*t().state.padding).text(m);f||S.attr("dy",t().state.textHeight)},s=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(a.descriptions[0]).node().getBBox(),l=s.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description"),i=!0,r=!0;a.descriptions.forEach(function(c){i||(o(p,c,r),r=!1),i=!1});let w=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,s.width);return w.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},et=(e,a,o)=>{let d=t().state.padding,s=2*t().state.padding,l=e.node().getBBox(),p=l.width,i=l.x,r=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(a.id),x=r.node().getBBox().width+s,g=Math.max(x,p);g===p&&(g=g+s);let c,m=e.node().getBBox();a.doc,c=i-d,x>p&&(c=(p-g)/2+d),Math.abs(i-m.x)<d&&x>p&&(c=i-(x-p)/2);let f=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",c).attr("y",f).attr("class",o?"alt-composit":"composit").attr("width",g).attr("height",m.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),r.attr("x",c+d),x<=p&&r.attr("x",i+(g-s)/2-x/2+d),e.insert("rect",":first-child").attr("x",c).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",c).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",m.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},it=e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),at=(e,a)=>{let o=t().state.forkWidth,d=t().state.forkHeight;if(a.parentId){let s=o;o=d,d=s}return e.append("rect").style("stroke","black").style("fill","black").attr("width",o).attr("height",d).attr("x",t().state.padding).attr("y",t().state.padding)},nt=(e,a,o,d)=>{let s=0,l=d.append("text");l.s