@a2simcode/ui 0.0.129 → 0.0.130

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.
@@ -13,4 +13,4 @@
13
13
  roundFun,
14
14
  sumFun,
15
15
  sumproductFun,
16
- getCompValue)=>{ return ${k} }`;let B;const _=hl(k);if(_.res)try{B=_.fn(a,l,r,i,s,c,d,u,p,f,h,g,m,y,v)}catch(V){console.log(V,"计算组件公式运行错误")}else return console.log(_.msg),"";return Number.isNaN(B)?"":(o.decimal!==void 0&&(B=B.toFixed(o.decimal)),B)}),R=(0,n.computed)(()=>{let b=C.value;return o.thousandSeparator&&(b=zr(b)),o.isChinese&&(b=Ir(b)),b});return(0,n.watch)(C,b=>{w("update:modelValue",b),w("change",{value:b,data:R.value})}),(b,k)=>{const B=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(B,{modelValue:R.value,"onUpdate:modelValue":k[0]||(k[0]=_=>R.value=_),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),vh=bh,Ji=se(vh),wh={class:"j-block j-input-count"},Ch={class:"j-input-count-top"},xh={class:"j-input-count-tool"},kh={style:{"font-weight":"600"}},Sh={class:"j-input-count-codebox"},Eh={key:0,class:"j-input-count-cursor"},Bh={key:0,class:"fun_color"},Rh={key:1,class:"comp_color"},_h={key:2,class:"num_color"},Th={key:3,class:"j-input-count-cursor"},Mh={class:"j-input-count-bottom"},Vh={class:"j-input-count-left"},Nh={class:"mb-8px fw-600"},Ah={class:"j-input-count-right"},Ph={class:"j-input-count-funs"},jh={style:{"font-weight":"600",padding:"8px"}},Oh={class:"j-input-count-funs-content"},Ih={class:"j-input-count-fundes"},zh={style:{"font-size":"14px","font-weight":"300"}},Lh=(0,n.defineComponent)({name:"JInputCount",__name:"input-count",props:{modelValue:String,list:{type:Array,default:()=>[]},type:{type:String,default:"primary"},size:{type:String},label:{type:String,default:"公式设置"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=Je(),a=e,l=t,r=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4},{label:5,value:5},{label:6,value:6},{label:7,value:7},{label:8,value:8},{label:9,value:9},{label:0,value:0},{label:"i",value:"i"},{label:"+",value:"+"},{label:"-",value:"-"},{label:"*",value:"*"},{label:"/",value:"/"},{label:">",value:">"},{label:"<",value:"<"},{label:"=",value:"="},{label:"(",value:"("},{label:")",value:")"},{label:"[",value:"["},{label:"]",value:"]"},{label:"'",value:"'"},{label:'"',value:'"'},{label:",",value:","},{label:".",value:"."}],i=[{label:"ABS",value:"abs",des:["ABS函数可以获取一个数的绝对值","用法:ABS(数字)","示例:ABS(-8)可以返回8,也就是-8的绝对值"]},{label:"AVERAGE",value:"average",des:["AVERAGE函数可以获取一组数值的算术平均值","用法:AVERAGE(数字1,数字2,...)","示例:AVERAGE({语文成绩},{数学成绩}, {英语成绩})返回三门课程的平均分"]},{label:"CEILING",value:"ceiling",des:["CEILING函数可以将数字增大到最接近原值的指定因数的倍数","用法:CEILING(数字,因数)","示例:CEILING(7,6)返回12,因为12比7大的同时,也是6的倍数中最接近7的数字"]},{label:"COUNT",value:"count",des:["COUNT函数可以获取参数的数量","用法:COUNT(值,值,...)","示例:COUNT(小明,小王,小张,小李)返回4,也就是人员的数量"]},{label:"COUNTIF",value:"countif",des:["COUNTIF函数可以获取数组中满足条件的参数个数","用法:COUNTIF(数组,'条件')","示例:COUNTIF(子表单.性别, '女'),可得到子表单中性别填的是'女'的数据条数;COUNTIF([1,2,3,4],'>2'),可得到1,2,3,4中大于2的数字数量,结果为2。"]},{label:"FIXED",value:"fixed",des:["FIXED函数可将数字舍入到指定的小数位数并输出为文本","用法:FIXED(数字,小数位数)","示例:FIXED(3.1415,2)返回'3.14'"]},{label:"FLOOR",value:"floor",des:["FLOOR函数可将数字减小到最接近原值的指定因数的倍数","用法:FLOOR(数字,因数)","示例:FLOOR(7,6)返回6,因为6比7小的同时,也是6的倍数中最接近7的数字"]},{label:"INT",value:"int",des:["INT函数可以获取一个数的整数部分","用法:INT(数字)","示例:INT(3.1415)返回3,也就是3.1415的整数部分"]},{label:"LARGE",value:"large",des:["LARGE函数可以获取数据集中第k个最大值","用法:LARGE(数组,k)","示例:LARGE({学生成绩.数学成绩},1)返回子表单'学生成绩'中排名第1的'数学成绩'"]},{label:"LOG",value:"log",des:["LOG函数可以根据指定底数返回数字的对数","用法:LOG(数字,底数)","示例:LOG(100,10)返回2,也就是以10为底数100的对数"]},{label:"MAX",value:"max",des:["MAX函数可以获取一组数值的最大值","用法:MAX(数字1,数字2,...)","示例:MAX({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最高分"]},{label:"MIN",value:"min",des:["MIN函数可以获取一组数值的最小值","用法:MIN(数字1,数字2,...)","示例:MIN({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最低分"]},{label:"MOD",value:"mod",des:["MOD函数可以获取两数相除的余数","用法:MOD(被除数,除数)","示例:MOD(4,3)返回1,也就是4/3的余数"]},{label:"POWER",value:"power",des:["POWER函数可以获取数字乘幂的结果","用法:POWER(数字,指数)","示例:POWER(3,2)返回9,也就是3的2次方"]},{label:"PRODUCT",value:"product",des:["PRODUCT函数可以获取一组数值的乘积","用法:PRODUCT(数字1,数字2,...)","示例:PRODUCT({单价}, {数量})获取总价,也就是单价和数量的乘积"]},{label:"RAND",value:"rand",des:["RAND函数可返回大于等于0且小于1的均匀分布随机实数","用法:RAND()","示例:RAND()返回0.424656"]},{label:"ROUND",value:"round",des:["ROUND函数可以将数字四舍五入到指定的位数","用法:ROUND(数字,数字位数)","示例:ROUND(3.1485,2)返回3.15"]},{label:"SMALL",value:"small",des:["SMALL函数可以返回数据集中第k个最小值","用法:SMALL(数组,k)","示例:SMALL({学生成绩.数学成绩}, 1)返回子表单'学生成绩'中排名倒数第一的'数学成绩'"]},{label:"SQRT",value:"sqrt",des:["SQRT函数可以获取一个数字的正平方根","用法:SQRT(数字)","示例:SQRT(9)返回3,也就是9的正平方根"]},{label:"SUM",value:"sum",des:["SUM函数可以获取一组数值的总和","用法:SUM(数字1,数字2,...)","示例:SUM({语文成绩},{数学成绩}, {英语成绩})返回三门课程的总分"]},{label:"SUMPRODUCT",value:"sumproduct",des:["SUMPRODUCT函数可以将数组间对应的元素相乘,并返回乘积之和,适用于加权求和","用法:SUMPRODUCT(数组,数组...)","示例:SUMPRODUCT([1,2,3],[0.1,0.2,0.3])返回1.4,也就是 1×0.1 + 2×0.2 + 3×0.3的值"]}],s=(0,n.ref)(!1),c=(0,n.ref)([]),d=(0,n.reactive)({cells:[],cursor:0}),u=(0,n.computed)({get(){return JSON.parse(a.modelValue||"[]")},set(b){l("update:modelValue",b.length>0?JSON.stringify(b):""),l("change",{value:b.length>0?JSON.stringify(b):"",data:b})}}),p=b=>{c.value=b},f=(b,k)=>{const B={value:b,type:k};if(d.cells.splice(d.cursor,0,B),d.cursor+=1,k==="fun"){const _={value:"(",type:k},V={value:")",type:k};d.cells.splice(d.cursor,0,_,V),d.cursor+=1}},h=()=>{d.cursor>0&&(d.cursor-=1)},g=()=>{d.cursor<d.cells.length&&(d.cursor+=1)},m=()=>{d.cursor>0&&(d.cells.splice(d.cursor-1,1),d.cursor-=1)},y=()=>{d.cells=[],d.cursor=0},w=()=>{d.cells=xt(u.value),d.cursor=d.cells.length,s.value=!0},x=()=>{u.value=d.cells,s.value=!1},v=()=>{d.cells=[],d.cursor=0,s.value=!1},C=(0,n.computed)(()=>{const b={};return a.list.forEach(k=>{k.children.forEach(B=>{b[B.value]=`${k.label}.${B.label}`})}),b}),R=b=>C.value[b]||b;return(b,k)=>{const B=(0,n.resolveComponent)("j-button"),_=(0,n.resolveComponent)("j-icon"),V=(0,n.resolveComponent)("el-space"),T=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(B,(0,n.mergeProps)(b.$attrs,{type:e.type,size:e.size,label:e.label,onClick:w}),null,16,["type","size","label"]),(0,n.createVNode)(T,{visible:s.value,title:(0,n.unref)(o)("公式设置"),height:800,width:1200,onOk:x,onClosed:v},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",wh,[(0,n.createElementVNode)("div",Ch,[(0,n.createElementVNode)("div",xh,[(0,n.createElementVNode)("span",kh,(0,n.toDisplayString)((0,n.unref)(o)("计算公式"))+"=",1),(0,n.createVNode)(V,null,{default:(0,n.withCtx)(()=>[(0,n.createVNode)(B,{type:"text",onClick:h},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowLeft"})]),_:1}),(0,n.createVNode)(B,{type:"text",onClick:g},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowRight"})]),_:1}),(0,n.createVNode)(B,{type:"link",label:"退格",onClick:m}),(0,n.createVNode)(B,{type:"link",danger:"",label:"清空",onClick:y})]),_:1})]),(0,n.createElementVNode)("div",Sh,[d.cells.length==0?((0,n.openBlock)(),(0,n.createElementBlock)("span",Eh)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.cells,(F,L)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:L},[F.type=="fun"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Bh,(0,n.toDisplayString)(F.value.toUpperCase()),1)):F.type=="comp"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Rh," #"+(0,n.toDisplayString)(R(F.value))+"# ",1)):F.type=="num"?((0,n.openBlock)(),(0,n.createElementBlock)("span",_h,(0,n.toDisplayString)(F.value),1)):(0,n.createCommentVNode)("",!0),L+1==d.cursor?((0,n.openBlock)(),(0,n.createElementBlock)("span",Th)):(0,n.createCommentVNode)("",!0)],64))),128))])]),(0,n.createVNode)(V,{class:"j-input-count-mid"},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r,(F,L)=>(0,n.createVNode)(B,{key:L,label:F.label+"",onClick:D=>f(F.value,"num")},null,8,["label","onClick"])),64))]),_:1}),(0,n.createElementVNode)("div",Mh,[(0,n.createElementVNode)("div",Vh,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.list,(F,L)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:L},[(0,n.createElementVNode)("div",Nh,(0,n.toDisplayString)((0,n.unref)(o)(F.label)),1),(0,n.createVNode)(V,{size:[8,8],wrap:"",style:{"margin-bottom":"16px"}},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(F.children,D=>((0,n.openBlock)(),(0,n.createBlock)(B,{key:D.value,onClick:M=>f(D.value,"comp"),label:(0,n.unref)(o)(D.label)},null,8,["onClick","label"]))),128))]),_:2},1024)],64))),128))]),(0,n.createElementVNode)("div",Ah,[(0,n.createElementVNode)("div",Ph,[(0,n.createElementVNode)("span",jh,(0,n.toDisplayString)((0,n.unref)(o)("函数列表")),1),(0,n.createElementVNode)("div",Oh,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,(F,L)=>(0,n.createVNode)(B,{type:"text",style:{"border-radius":"0","justify-content":"left"},key:L,onMouseover:D=>p(F.des),onClick:D=>f(F.value,"fun"),label:F.label},null,8,["onMouseover","onClick","label"])),64))])]),(0,n.createElementVNode)("div",Ih,[(0,n.createElementVNode)("div",null,[(0,n.createElementVNode)("ul",null,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.value,(F,L)=>((0,n.openBlock)(),(0,n.createElementBlock)("li",{key:L,style:{"margin-bottom":"8px"}},[(0,n.createElementVNode)("span",zh,(0,n.toDisplayString)((0,n.unref)(o)(F)),1)]))),128))])])])])])])]),_:1},8,["visible","title"])])}}}),Hh=Lh,Yi=se(Hh),Dh={key:0},Fh=(0,n.defineComponent)({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=(0,n.computed)(()=>({...o})),l=(0,n.ref)(),r=(0,n.ref)(null),i=(0,n.computed)(()=>o.options);(0,n.onMounted)(()=>{o.animation&&s()}),(0,n.watch)(()=>o.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=o.decimals,r.value.reset(),r.value.update(o.endValue))},{deep:!0}),(0,n.watch)(()=>o.endValue,f=>{r.value&&r.value.update&&r.value.update(f)});const s=()=>{r.value||(i.value.startVal=o.startValue,i.value.decimalPlaces=o.decimals,i.value.duration=o.duration,r.value=new Cu.CountUp(l.value,Number(o.endValue),i.value),r.value.start(()=>{o.callback?.(r.value)}))};return(0,n.onUnmounted)(()=>{r.value=null}),(0,n.onBeforeUnmount)(()=>{r.value=null}),t({myProps:a,el:l,init:s,start:f=>{r.value&&r.value.start&&r.value.start(()=>{f?.(r.value)})},pauseResume:()=>{r.value&&r.value.pauseResume&&r.value.pauseResume()},reset:()=>{r.value&&r.value.reset&&r.value.reset()},update:f=>{r.value&&r.value.update&&r.value.update(f)}}),(f,h)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{ref_key:"el",ref:l},[e.animation?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",Dh,(0,n.toDisplayString)(e.endValue),1))],512))}}),$h=Fh,Ki=se($h),Wh={class:"j-block j-data-panel"},Uh={key:0,class:"j-data-panel-header"},Jh={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},Yh={class:"j-data-panel-header-right"},Kh={class:"j-data-panel-body"},Gh=(0,n.defineComponent)({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Wh,[e.title?((0,n.openBlock)(),(0,n.createElementBlock)("div",Uh,[(0,n.createElementVNode)("div",Jh,(0,n.toDisplayString)(e.title),1),(0,n.createElementVNode)("div",Yh,[(0,n.renderSlot)(t.$slots,"titleRight")])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Kh,[(0,n.renderSlot)(t.$slots,"default")])]))}}),qh=Gh,Gi=se(qh),Xh={class:"j-divider-content"},Zh=(0,n.defineComponent)({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=(0,n.computed)(()=>{const l={color:t.color};return t.size&&Number(t.size)&&(l.fontSize=`${t.size}px`),l}),a=(0,n.computed)(()=>({borderTopStyle:t.borderStyle}));return(l,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(`j-divider-container j-divider-${e.contentPosition}`),style:(0,n.normalizeStyle)(o.value)},[(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-left",style:(0,n.normalizeStyle)(a.value)},null,4),(0,n.createElementVNode)("div",Xh,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e.content||""),1)]),(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-right",style:(0,n.normalizeStyle)(a.value)},null,4)],6))}}),Qh=Zh,qi=se(Qh),eg={class:"j-hpanel"},tg={class:"j-hpanel-main"},ng=(0,n.defineComponent)({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",eg,[(0,n.renderSlot)(t.$slots,"left"),(0,n.createElementVNode)("div",tg,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"right")]))}}),og=ng,Xi=se(og),ag=(0,n.defineComponent)({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},title:{},size:{default:"default"},width:{default:1e3},height:{default:600},destroyOnClose:{type:Boolean,default:!1},open:{},ok:{},beforeClose:{},closed:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.ref)(),r=(0,n.ref)(),i=async(u,p)=>{o.ok&&(u("保存数据中..."),r.value=await o.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),p(),l.value.close())},s=()=>o.beforeClose?o.beforeClose(r.value):!0,c=()=>{o.closed?.()},d=()=>{l.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(r.value)},200)};return(0,n.watch)(()=>o.modelValue,u=>{r.value=u},{immediate:!0}),(u,p)=>{const f=(0,n.resolveComponent)("j-button"),h=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(f,(0,n.mergeProps)({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),(0,n.createVNode)(h,{ref_key:"layerRef",ref:l,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:i,onClosed:c},{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}}),lg=ag,Zi=se(lg),rg=(0,n.defineComponent)({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},title:{},size:{},width:{default:1200},height:{default:600},example:{default:""},beforeClose:{},isHint:{type:Boolean,default:!1},handleHint:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.computed)({get:()=>o.modelValue,set:p=>{a("update:modelValue",p)}}),r=(0,n.ref)(""),i=p=>{r.value=p},s=()=>r.value,c=p=>o.beforeClose?o.beforeClose(p):!0,d=p=>{a("change",p)},u=(0,n.computed)(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(p,f)=>{const h=(0,n.resolveComponent)("j-code-mirror"),g=(0,n.resolveComponent)("j-layout"),m=(0,n.resolveComponent)("j-input-button");return(0,n.openBlock)(),(0,n.createBlock)(m,{modelValue:l.value,"onUpdate:modelValue":f[1]||(f[1]=y=>l.value=y),type:e.type,"btn-text":u.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":c,ok:s,open:i,onChange:d},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{"right-move":!1,right:560},(0,n.createSlots)({default:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{value:r.value,"onUpdate:value":f[0]||(f[0]=y=>r.value=y),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["value","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{value:e.example,mode:e.mode,"read-only":""},null,8,["value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","width","height"])}}}),ig=rg,Qi=se(ig),sg=(0,n.defineComponent)({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.computed)({get(){return a.modelValue===null||a.modelValue===void 0?i.value:a.modelValue},set(m){i.value=m,l("update:modelValue",m),l("input",m)}}),c=m=>{l("input",m)},d=m=>{l("focus",m)},u=m=>{l("blur",m)},p=()=>{l("clear"),l("update:modelValue","")},f=m=>{l("change",m)},h=m=>{l("color-change",m),l("change",m)},g=m=>{l("active-change",m)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(m,y)=>{const w=(0,n.resolveComponent)("el-color-picker"),x=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[(0,n.createVNode)(x,(0,n.mergeProps)({ref_key:"inputRef",ref:r,modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=v=>s.value=v),placeholder:e.placeholder,size:e.size,readonly:e.readonly||e.onlyButton,clearable:e.readonly||e.onlyButton?!1:e.clearable,disabled:e.disabled,name:e.name,autofocus:e.autofocus,tabindex:e.tabindex,"validate-event":e.validateEvent,"input-style":e.inputStyle},m.$attrs,{onInput:c,onFocus:d,onBlur:u,onClear:p,onChange:f}),{[e.inputType]:(0,n.withCtx)(()=>[(0,n.createVNode)(w,{modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=v=>s.value=v),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:h,onActiveChange:g},null,8,["modelValue","size","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["modelValue","placeholder","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}}),cg=sg,es=se(cg),dg=(0,n.defineComponent)({name:"JTitle",__name:"title",props:{title:{default:""},style:{default:void 0},class:{default:void 0},color:{default:void 0},size:{default:void 0},weight:{default:"normal"}},setup(e){const t=e,o=(0,n.computed)(()=>t.class||""),a=(0,n.computed)(()=>{const l={...t.style};return t.color&&(l.color=t.color),t.size&&(typeof t.size=="number"?l.fontSize=`${t.size}px`:l.fontSize=t.size),t.weight&&(l.fontWeight=t.weight),l});return(l,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-title",o.value]),style:(0,n.normalizeStyle)(a.value)},(0,n.toDisplayString)(e.title),7))}}),ug=dg,ts=se(ug),fg={class:"j-decorated-title-wrapper1"},pg={class:"j-decorated-title-wrapper1-line"},hg={key:3,class:"j-decorated-title-wrapper2"},gg={class:"wrapper2"},mg={class:"wrapper2-line"},yg={key:4,class:"j-decorated-title-wrapper3"},bg={class:"wrapper3"},vg={class:"wrapper3-line"},wg={key:5,class:"j-decorated-title-wrapper4"},Cg={class:"wrapper4"},xg={class:"wrapper4-center"},kg={key:6,class:"j-decorated-title-wrapper5"},Sg={class:"wrapper5"},Eg={class:"wrapper5-left"},Bg={class:"wrapper5-right"},Rg=(0,n.defineComponent)({name:"JDecoratedTitle",__name:"decorated-title",props:{title:{default:""},content:{},style:{default:void 0},class:{default:void 0},color:{default:void 0},contentColor:{},backgroundColor:{},size:{default:14},contentSize:{default:12},align:{default:void 0},weight:{default:"normal"},titleType:{default:"title1"}},setup(e){const{t}=Je(),o=e,a=(0,n.computed)(()=>o.class||""),l=(0,n.computed)(()=>({"font-size":o.size?`${["title5","title7","title8","title9"].includes(o.titleType)?14:o.size}px`:"","font-weight":o.weight,color:o.color})),r=(0,n.computed)(()=>({"font-size":o.contentSize?`${o.contentSize}px`:"",color:o.contentColor})),i=(0,n.computed)(()=>({"--el-border-style":o.titleType==="title3"?"solid":"dashed",borderColor:o.backgroundColor||"var(--j-color-primary)",margin:"0 !important"})),s=(0,n.computed)(()=>o.backgroundColor||"var(--j-color-primary-hover)"),c=(0,n.computed)(()=>({...o.style}));return(d,u)=>{const p=(0,n.resolveComponent)("el-divider");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-decorated-title",a.value]),style:(0,n.normalizeStyle)(c.value)},[e.titleType==="title2"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):["title3","title4"].includes(e.titleType||"")?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createVNode)(p,{class:"m-0",style:(0,n.normalizeStyle)(i.value)},null,8,["style"]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title5"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:2},[(0,n.createElementVNode)("div",fg,[(0,n.createElementVNode)("div",{class:"j-decorated-title-wrapper1-title",style:(0,n.normalizeStyle)([l.value,{backgroundColor:s.value}])},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",pg,[(0,n.createElementVNode)("div",{class:"wrapper-line",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram1",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram2",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram3",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)([r.value,{textAlign:"left"}])},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title6"?((0,n.openBlock)(),(0,n.createElementBlock)("div",hg,[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",gg,[(0,n.createElementVNode)("div",mg,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper2-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title7"?((0,n.openBlock)(),(0,n.createElementBlock)("div",yg,[(0,n.createElementVNode)("div",bg,[(0,n.createElementVNode)("div",vg,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper3-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title8"?((0,n.openBlock)(),(0,n.createElementBlock)("div",wg,[(0,n.createElementVNode)("div",Cg,[(0,n.createElementVNode)("div",{class:"wrapper4-bg",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",xg,[(0,n.createElementVNode)("div",{class:"wrapper4-center-label",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border left-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border right-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title9"?((0,n.openBlock)(),(0,n.createElementBlock)("div",kg,[(0,n.createElementVNode)("div",Sg,[(0,n.createElementVNode)("div",Eg,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-left-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),u[0]||(u[0]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-left-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-left-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-left-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper5-center",style:(0,n.normalizeStyle)([{backgroundColor:s.value}])},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",Bg,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-right-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),u[1]||(u[1]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-right-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-right-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-right-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:7,style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5))],6)}}}),_g=Rg,ns=se(_g),Tg={class:"j-block"},Mg={class:"j-input-decorated-title-wrapper mb-0px"},Vg=(0,n.defineComponent)({name:"JInputDecoratedTitle",__name:"input-decorated-title",props:{modelValue:{default:"title1"},backgroundColor:{default:void 0},color:{default:void 0},weight:{default:void 0},contentColor:{default:void 0},align:{default:void 0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=Je(),a=t,l=(0,n.ref)(),r=d=>{l.value?.hide(),a("update:modelValue",d),a("change",d)},i=(0,n.ref)("mdi:chevron-down"),s=()=>{i.value="mdi:chevron-up"},c=()=>{i.value="mdi:chevron-down"};return(d,u)=>{const p=(0,n.resolveComponent)("j-decorated-title"),f=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Tg,[(0,n.createVNode)(h,{width:270,placement:"top-start",trigger:"click","popper-class":"j-input-decorated-title-popover",ref_key:"popoverRef",ref:l,onShow:s,onHide:c},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Mg,[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:e.modelValue,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align"]),(0,n.createVNode)(f,{icon:i.value,size:20},null,8,["icon"])])]),default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(8,g=>(0,n.createElementVNode)("div",{class:"j-input-decorated-title-wrapper",key:g},[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:`title${g}`,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align,onClick:m=>r(`title${g}`)},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align","onClick"])])),64))]),_:1},512)])}}}),Ng=Vg,os=se(Ng),Ag=(0,n.defineComponent)({name:"JCodeMirror",__name:"code-mirror",props:{value:{default:""},mode:{default:"javascript"},readonly:{type:Boolean,default:!1},height:{default:void 0},isHint:{type:Boolean,default:!1},handleHint:{type:Function,default:void 0},isScrollToBottom:{type:Boolean,default:!1}},emits:["update:value","change"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(),i=(0,n.ref)("");let s=null;const c=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return(0,Ln.javascript)();case"css":case"text/css":return(0,Su.css)();case"html":case"text/html":return(0,Eu.html)();case"json":case"application/json":return(0,Bu.json)();case"sql":case"text/x-sql":return(0,Ru.sql)();case"xml":case"text/xml":return(0,_u.xml)();case"python":case"text/x-python":return(0,Tu.python)();case"markdown":case"text/markdown":return(0,Mu.markdown)();case"java":case"text/x-java":return(0,Vu.java)();case"vue":case"text/x-vue":return(0,Ln.javascript)({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return(0,Ln.javascript)({jsx:!1,typescript:!0});case"jsx":return(0,Ln.javascript)({jsx:!0,typescript:!1});case"tsx":return(0,Ln.javascript)({jsx:!0,typescript:!0});default:return(0,Ln.javascript)()}},d=()=>{const m=[ku.basicSetup,(0,Pt.lineNumbers)(),(0,Pt.highlightActiveLineGutter)(),(0,Pt.highlightSpecialChars)(),(0,cl.history)(),(0,Pt.drawSelection)(),(0,Pt.dropCursor)(),(0,Hn.indentOnInput)(),(0,Hn.bracketMatching)(),(0,sl.closeBrackets)(),(0,Pt.rectangularSelection)(),(0,Hn.foldGutter)(),Pt.keymap.of([...sl.closeBracketsKeymap,...cl.defaultKeymap,...cl.historyKeymap,...Hn.foldKeymap]),(0,Hn.syntaxHighlighting)(Hn.defaultHighlightStyle)];return m.push(c(a.mode)),a.readonly&&m.push(il.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push((0,sl.autocompletion)({override:[y=>{const w=y.matchBefore(/\w*/);if(!w||w.from===w.to)return null;const x=a.handleHint(w.text);return x.length===0?null:{from:w.from,options:x.map(v=>({label:typeof v=="string"?v:v.label||v.name||"",detail:typeof v=="string"?"":v.detail||"",type:typeof v=="string"?"variable":v.type||"variable",apply:typeof v=="string"?v:v.apply||v.name||v.label||""}))}}]})),m.push(Pt.EditorView.updateListener.of(y=>{if(y.docChanged){const w=y.state.doc.toString();i.value=w,l("update:value",w),l("change",{value:w})}})),m},u=async()=>{r.value&&(s=new Pt.EditorView({state:il.EditorState.create({doc:a.value,extensions:d()}),parent:r.value}),i.value=a.value)},p=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const y=il.EditorState.create({doc:m,extensions:d()});r.value&&(s=new Pt.EditorView({state:y,parent:r.value}));const w=s.state.doc.toString();w!==a.value&&s.dispatch({changes:{from:0,to:w.length,insert:a.value}})},f=()=>{if(!s)return;const m=s.state.doc.length;s.dispatch({selection:{anchor:m,head:m},scrollIntoView:!0}),setTimeout(()=>{if(s){const y=s.state.doc.length;s.dispatch({selection:{anchor:y,head:y},scrollIntoView:!0})}},100)},h=()=>{let m=(0,xu.format)(a.value);m=m.replace(/{ JCODE_SASSID }/g,"{JCODE_SASSID}").replace(/{ JCODE_SASSID_NOTT }/g,"{JCODE_SASSID_NOTT}").replace(/{ JCODE_SASSID_NOTA }/g,"{JCODE_SASSID_NOTA}").replace(/@ /g,"@"),l("update:value",m),l("change",{value:m})};let g=null;return(0,n.watch)(()=>a.value,m=>{m!==i.value&&(i.value=m,s&&p(),setTimeout(()=>{s&&a.isScrollToBottom&&f()}))}),(0,n.watch)(()=>a.mode,()=>{s&&p()}),(0,n.onMounted)(async()=>{await(0,n.nextTick)(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(g=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),g.observe(r.value))}),(0,n.onUnmounted)(()=>{g&&r.value&&(g.unobserve(r.value),g.disconnect(),g=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(m,y)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:(0,n.normalizeStyle)({height:e.height?`${e.height}px`:""})},null,4))}}),Pg=Ag,as=se(Pg),jg=(0,n.defineComponent)({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("actionRef"),l=(0,n.ref)("0"),r=(0,n.computed)(()=>{const{actionStyle:s,toLeft:c}=o;return{...s,left:c?"0":l.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:i.value?"6px":void 0,transition:c?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),i=(0,n.computed)(()=>Number.parseInt(l.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{l.value=s}}),(s,c)=>{const d=(0,n.resolveComponent)("j-icon");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"actionRef",ref:a,style:(0,n.normalizeStyle)(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):((0,n.openBlock)(),(0,n.createBlock)(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),Og=jg,Ig=(0,n.defineComponent)({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("barRef"),l=(0,n.ref)("0"),r=(0,n.computed)(()=>{const{barStyle:i,toLeft:s}=o;return{...i,width:s?"0":l.value,transition:s?"width 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0,backgroundColor:"var(--j-color-success)",position:"absolute",height:"100%"}});return t({getEl:()=>a.value,setWidth:i=>{l.value=i}}),(i,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"barRef",ref:a,style:(0,n.normalizeStyle)(r.value)},null,4))}}),zg=Ig,Lg=(0,n.defineComponent)({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("contentRef"),l=(0,n.computed)(()=>{const{contentStyle:i}=o;return{...i,fontSize:"12px"}});t({getEl:()=>a.value});const r=(0,n.computed)(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(i,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"contentRef",ref:a,class:(0,n.normalizeClass)([{success:e.isPassing},"j-slider-captcha-content"]),style:(0,n.normalizeStyle)(l.value)},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(r.value),class:"j-spine-text"},(0,n.toDisplayString)(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Hg=Lg,Dg=(0,n.defineComponent)({name:"JSliderCaptcha",__name:"slider-captcha",props:(0,n.mergeModels)({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:(0,n.mergeModels)(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,a=t,l=(0,n.useModel)(e,"modelValue"),r=(0,n.reactive)({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),i=(0,n.useTemplateRef)("wrapperRef"),s=(0,n.useTemplateRef)("barRef"),c=(0,n.useTemplateRef)("contentRef"),d=(0,n.useTemplateRef)("actionRef");(0,n.watch)(()=>r.isPassing,w=>{if(w){const{endTime:x,startTime:v}=r;a("success",{isPassing:w,time:((x-v)/1e3).toFixed(1)}),l.value=w}}),(0,n.watchEffect)(()=>{r.isPassing=!!l.value});function u(w){return"pageX"in w?w.pageX:"touches"in w&&w.touches[0]?w.touches[0].pageX:0}function p(w){r.isPassing||d.value&&(a("start",w),r.moveDistance=u(w)-Number.parseInt(d.value.getStyle().left.replace("px","")||"0",10),r.startTime=Date.now(),r.isMoving=!0)}function f(w){const x=i.value?.offsetWidth??220,v=w?.offsetWidth??40;return{actionWidth:v,offset:x-v-6,wrapperWidth:x}}function h(w){const{isMoving:x,moveDistance:v}=r;if(x){const C=(0,n.unref)(d),R=(0,n.unref)(s);if(!C||!R)return;const{actionWidth:b,offset:k,wrapperWidth:B}=f(C.getEl()),_=u(w)-v;a("move",{event:w,moveDistance:v,moveX:_}),_>0&&_<=k?(C.setLeft(`${_}px`),R.setWidth(`${_+b/2}px`)):_>k&&(C.setLeft(`${B-b}px`),R.setWidth(`${B-b/2}px`),m())}}function g(w){const{isMoving:x,isPassing:v,moveDistance:C}=r;if(x&&!v){a("end",w);const R=d.value,b=(0,n.unref)(s);if(!R||!b)return;const k=u(w)-C,{actionWidth:B,offset:_,wrapperWidth:V}=f(R.getEl());k<_?y():(R.setLeft(`${V-B}px`),b.setWidth(`${V-B/2}px`),m()),r.isMoving=!1}}function m(){r.endTime=Date.now(),r.isPassing=!0,r.isMoving=!1}function y(){r.isMoving=!1,r.isPassing=!1,r.moveDistance=0,r.toLeft=!1,r.startTime=0,r.endTime=0;const w=(0,n.unref)(d),x=(0,n.unref)(s),v=(0,n.unref)(c);!w||!x||!v||(v.getEl().style.width="100%",r.toLeft=!0,setTimeout(()=>{r.toLeft=!1,w.setLeft("0"),x.setWidth("0")},300))}return(w,x)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"wrapperRef",ref:i,class:(0,n.normalizeClass)(["j-slider-captcha slider-border",o.class]),style:(0,n.normalizeStyle)([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:g,onMousemove:h,onMouseup:g,onTouchend:g,onTouchmove:h},[(0,n.createVNode)(zg,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),(0,n.createVNode)(Hg,{ref_key:"contentRef",ref:c,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),(0,n.createVNode)(Og,{ref_key:"actionRef",ref:d,"action-style":e.actionStyle,"is-passing":r.isPassing,"to-left":r.toLeft,onMousedown:p,onTouchstart:p},null,8,["action-style","is-passing","to-left"])],38))}}),Fg=Dg,ls=se(Fg),$g=(0,n.defineComponent)({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:l,toArray:r,activeMenu:i,theme:s}=$n(),{getHMoreMenus:c}=li(),d=(0,n.ref)([]);o.pId==="moreId"?d.value=c.value:d.value=r(l()[o.pId||""]||[],[]);const u=g=>{const m=d.value.find(y=>y.active);m?.value!==g.value&&(m&&(m.active=!1),a("click",g))},{list:p,containerProps:f,wrapperProps:h}=(0,dl.useVirtualList)(d,{itemHeight:44});return(g,m)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-sub-menu-content",{"j-menu-dark":(0,n.unref)(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},(0,n.unref)(f)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(h))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(p),y=>((0,n.openBlock)(),(0,n.createBlock)(ia,{key:y.data.value,"parent-actives":(0,n.unref)(i)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),Wg=$g,Ug={class:"j-menu-item-label"},Jg={class:"j-menu-item-label"},Yg={key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow","sub"])},Kg={class:"j-menu-item-label"},Gg=(0,n.defineComponent)({name:"JMenuItem",__name:"index",props:{item:{type:Object,default:()=>({})},parentActives:{type:Array,default:()=>[]},collapsed:Boolean,isSub:Boolean,isHorizontal:Boolean,isVertical:Boolean},emits:["click"],setup(e,{emit:t}){const{t:o}=Je(),{activeMenuId:a}=$n(),l=t,r=i=>{l("click",i)};return(i,s)=>{const c=(0,n.resolveComponent)("j-icon"),d=(0,n.resolveComponent)("el-tooltip"),u=(0,n.resolveComponent)("el-popover");return e.collapsed&&!e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,placement:"right"},{content:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1)]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=(0,n.withModifiers)(p=>r(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Ug,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(u,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,icon:e.item.icon,style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),class:"j-menu-item-icon",size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Jg,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?((0,n.openBlock)(),(0,n.createElementBlock)("div",Yg)):(0,n.createCommentVNode)("",!0)],6)],2)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(Wg,{"p-id":e.item.value,onClick:r},null,8,["p-id"])]),_:1},8,["placement"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=(0,n.withModifiers)(p=>r(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Kg,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2))}}}),ia=Gg,qg=(0,n.defineComponent)({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:l,theme:r}=$n(),i=u=>{a("click",u)},{list:s,containerProps:c,wrapperProps:d}=(0,dl.useVirtualList)((0,n.computed)(()=>o.menuList),{itemHeight:44});return(u,p)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":(0,n.unref)(r)==="dark"}]},(0,n.unref)(c)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(d))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(s),f=>((0,n.openBlock)(),(0,n.createBlock)(ia,{key:f.data.value,"parent-actives":(0,n.unref)(l)?.pid?.split(".")||[],item:f.data,collapsed:e.collapsed,class:(0,n.normalizeClass)({"menu-item-entering":f.data.entering,"menu-item-leaving":f.data.leaving}),onClick:i},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),Xg=qg,Zg=(0,n.defineComponent)({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:l,theme:r}=$n(),i=(0,n.ref)(),s=(0,n.ref)(0);let c=null;(0,n.onMounted)(()=>{typeof window<"u"&&window.ResizeObserver&&i.value&&(c=new ResizeObserver(()=>{i.value&&(s.value=i.value.offsetWidth)}),c.observe(i.value))});const d=(0,n.computed)(()=>{const h=[];let g=0,m=0;const y=o.menuList.length;return o.menuList.forEach(w=>{m++;const x=(kt(w.label)||0)+32+16+4+8;g+=x,(m===y&&g<=s.value||m<y&&g+56<=s.value)&&h.push(w)}),h.length<o.menuList.length&&h.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),h}),u=(0,n.computed)(()=>{const h=[];let g=0;const m=d.value.length;return o.menuList.forEach(y=>{g++,g>=m&&h.push(y)}),h}),p=(0,n.computed)(()=>{const h=l.value?.pid?.split(".")||[];return(h.length>1&&u.value.findIndex(g=>g.value===h[1])>-1||u.value.findIndex(g=>g.value===l.value?.value)>-1)&&h.push("moreId"),h}),f=h=>{a("click",h)};return ri({getHMoreMenus:u}),(0,n.onUnmounted)(()=>{c&&i.value&&(c.unobserve(i.value),c.disconnect(),c=null)}),(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"menuRef",ref:i,class:(0,n.normalizeClass)(["j-menu-horizontal",{"j-menu-dark":(0,n.unref)(r)==="dark"}])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.value,m=>((0,n.openBlock)(),(0,n.createBlock)(ia,{key:m.value,"parent-actives":p.value,item:m,"is-horizontal":"",onClick:f},null,8,["parent-actives","item"]))),128))],2))}}),Qg=Zg,e0=(0,n.defineComponent)({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:l,theme:r}=$n(),i=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=(0,n.computed)(()=>(o.menuList.forEach((h,g)=>{h.color=i[g%i.length]}),o.menuList)),c=(0,n.computed)(()=>l.value?.pid?.split(".")||[]),d=h=>{a("click",h)},{list:u,containerProps:p,wrapperProps:f}=(0,dl.useVirtualList)(s,{itemHeight:96});return(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu-vertical",{"j-menu-dark":(0,n.unref)(r)==="dark"}]},(0,n.unref)(p)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(f))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(u),m=>((0,n.openBlock)(),(0,n.createBlock)(ia,{key:m.data.value,"parent-actives":c.value,item:m.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),t0=e0,n0=(0,n.defineComponent)({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let l={};const r=(0,n.ref)("");r.value=o.activeId||"";const i=(m,y,w,x,v)=>{w=w||[];for(let C=0,R=w.length;C<R;C++){const b=w[C],k={};k.pid=y,k.indent=x,r.value===b.value&&(k.active=!0),Object.keys(b).forEach(_=>{_!=="children"&&(k[_]=b[_])}),v&&v.includes(b.value)&&(k.open=!0),m.push(k);const B=b.children||[];B.length>0&&(k.hasChildren=!0,v||(l[k.value]=B),(!v||k.open&&!o.collapsed)&&i(m,`${y}.${k.value}`,B,x+1,v))}},s=(m,y)=>{const w=[];return i(w,"0",m,0,y),w},c=(0,n.ref)([]);let d=[];const u=()=>{l={},d=s(o.menus);const m=[];if(r.value&&o.mode==="inline"){const y=d.find(w=>w.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(o.menus,m)};(0,n.watch)(()=>o.menus,()=>{u()},{immediate:!0}),(0,n.watch)(()=>o.mode,()=>{u()});const p=()=>{if(c.value.find(m=>m.active)?.value!==r.value){const m=d.find(y=>y.value===r.value);if(m){const y=[];o.mode==="inline"&&y.push(...m.pid.split(".")),c.value=s(o.menus,y)}}},f=(0,n.computed)(()=>d.find(m=>m.value===r.value));(0,n.watch)(()=>o.activeId,()=>{r.value=o.activeId||"",p()}),(0,n.watch)(()=>o.collapsed,()=>{if(o.collapsed)c.value=s(o.menus,[]);else{const m=[];if(r.value){const y=d.find(w=>w.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(o.menus,m)}});const h=(0,n.computed)(()=>o.theme),g=m=>{if(console.log(m),m.hasChildren){if(o.collapsed)return;const y=[];y.push(...m.pid.split(".")),m.open||y.push(m.value);const w=s(o.menus,y),x=new Set(c.value.map(C=>C.value)),v=new Set(w.map(C=>C.value));w.forEach(C=>{x.has(C.value)||(C.entering=!0)}),c.value.forEach(C=>{v.has(C.value)||(C.leaving=!0)}),c.value=w,setTimeout(()=>{c.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{if(r.value===m.value)return;r.value=m.value,a("click",m)}};return ai({getMenuMap:()=>l,toArray:s,activeMenu:f,activeMenuId:r,theme:h}),(m,y)=>e.mode==="inline"?((0,n.openBlock)(),(0,n.createBlock)(Xg,{key:0,"menu-list":c.value,collapsed:e.collapsed,onClick:g},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?((0,n.openBlock)(),(0,n.createBlock)(Qg,{key:1,"menu-list":c.value,onClick:g},null,8,["menu-list"])):((0,n.openBlock)(),(0,n.createBlock)(t0,{key:2,"menu-list":c.value,onClick:g},null,8,["menu-list"]))}}),o0=n0,rs=se(o0),a0={class:"j-keyword-panel"},l0={key:0},r0={key:1,class:"columns-wrapper"},i0=(0,n.defineComponent)({name:"JKeywordPanel",__name:"keyword-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:o}=Je(),a=e,l=(0,n.useModel)(e,"checkAll"),r=(0,n.useModel)(e,"checkFields"),i=(0,n.ref)(!1),s=(0,n.ref)(""),c=(0,n.computed)(()=>a.columns.filter(f=>f.config?.filter?.isSearchKeyword?s.value?f.config?.label?.indexOf(s.value)!=-1:!0:!1).map(f=>({label:f.config?.label,value:f.id}))),d=()=>{l.value||(l.value=!0,i.value=!1,r.value=[])},u=f=>{f.length>0?l.value=!1:l.value=!0};return t({init:()=>{l.value?i.value=!1:i.value=!0}}),(f,h)=>{const g=(0,n.resolveComponent)("j-icon"),m=(0,n.resolveComponent)("el-input"),y=(0,n.resolveComponent)("j-checkbox");return(0,n.openBlock)(),(0,n.createElementBlock)("div",a0,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["range-item",{active:l.value}]),onClick:d},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索全部")),1),l.value?((0,n.openBlock)(),(0,n.createBlock)(g,{key:0,icon:"mdi:check"})):(0,n.createCommentVNode)("",!0)],2),(0,n.createElementVNode)("div",{class:"range-item",onClick:h[0]||(h[0]=w=>i.value=!i.value)},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索特定字段")),1),(0,n.createVNode)(g,{icon:i.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",l0,[(0,n.createVNode)(m,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=w=>s.value=w),modelModifiers:{trim:!0},class:"no-border background",placeholder:(0,n.unref)(o)("搜索"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",r0,[(0,n.createVNode)(y,{modelValue:r.value,"onUpdate:modelValue":h[2]||(h[2]=w=>r.value=w),options:c.value,style:{display:"flex","flex-direction":"column"},onChange:u},null,8,["modelValue","options"])])):(0,n.createCommentVNode)("",!0)])}}}),s0=i0,c0={key:0,class:"title"},d0={class:"content"},u0={class:"relation"},f0={style:{width:"72px"}},p0={class:"btn-wrapper"},h0={class:"field-wrapper"},g0={class:"buttons"},m0=(0,n.defineComponent)({name:"JFilterPanel",__name:"filter-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:(0,n.mergeModels)(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:a}=Je(),l=e,r=(0,n.useModel)(e,"relation"),i=(0,n.useModel)(e,"isPin"),s=(0,n.ref)([]),c=()=>{i.value=!i.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:p.value.join(","),options:u.value}),config:{style:{width:i.value?"132px":"160px"},appendTo:i.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,change:({value:x,row:v})=>{const C=l.columns.find(k=>k.id===x)?.config||{};let R="eq",b="text";["options"].includes(C.dataType||"")?R="in":["dateTime"].includes(C.type||"")?(R="range",b="dateTime"):["number"].includes(C.type||"")&&(b="number"),v.method=R,v.type=C.valueType||b,v.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:x})=>{const v=l.columns.find(C=>C.id===x.field)?.config||{};return["options","switch","dataItem","dataView"].includes(v.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(v.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"range",label:"选择范围"},{value:"formula",label:"动态筛选"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["number"].includes(v.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{style:{width:i.value?"134px":"130px"},appendTo:i.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:x})=>{x.value=void 0}}},{id:"value",type:"input",getCompType:({row:x})=>{const v=l.columns.find(C=>C.id===x.field)?.config||{};if(["options","dataItem","switch"].includes(v.dataType||"")){if(["in","nin"].includes(x.method)||["eq","ne"].includes(x.method))return"j-select"}else{if(["dateTime"].includes(v.type||""))return["formula"].includes(x.method)?"j-select":"j-date";if(["number"].includes(v.type||""))return"j-number"}return"j-input"},getCompConfig:({row:x})=>{if(["empty","not_empty"].includes(x.method||""))return{display:!1};const v=l.columns.find(R=>R.id===x.field)?.config||{},C={display:!0,placeholder:"",clearable:!0,filterable:!0};return["in","nin"].includes(x.method||"")&&(C.multiple=!0,C.collapseTags=!0,C.collapseTagsTooltip=!0),["options","dataItem"].includes(v.dataType||"")?(C.collapseTags=!0,C.collapseTagsTooltip=!0,C.dataType=v.dataType,C.dataCode=v.dataCode,C.options=v.options):["switch"].includes(v.dataType||"")?(C.options=[],C.dataType="options",v.activeValue==null?C.options.push({label:"是",value:"1"}):C.options.push({label:"是",value:v.activeValue}),v.inactiveValue==null?C.options.push({label:"否",value:"0"}):C.options.push({label:"否",value:v.inactiveValue})):["dateTime"].includes(v.type||"")&&(["formula"].includes(x.method)?(C.placeholder="",C.options=[{label:"今天",value:"today"},{label:"昨天",value:"yesterday"},{label:"明天",value:"tomorrow"},{label:"最近7天",value:"last7days"},{label:"最近30天",value:"last30days"},{label:"本周",value:"thisWeek"},{label:"上周",value:"lastWeek"},{label:"下周",value:"nextWeek"},{label:"本月",value:"thisMonth"},{label:"上月",value:"lastMonth"},{label:"下月",value:"nextMonth"},{label:"本季度",value:"thisQuarter"},{label:"上季度",value:"lastQuarter"},{label:"下季度",value:"nextQuarter"},{label:"今年",value:"thisYear"},{label:"去年",value:"lastYear"},{label:"明年",value:"nextYear"}],C.dataType="options"):(C.selectType="datetime",["range"].includes(x.method)?(C.selectType="datetimerange",C.startPlaceholder="开始时间",C.endPlaceholder="结束时间",C.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):C.placeholder="")),C},config:{style:{width:i.value?"246px":"296px",flex:i.value?"auto":"1"},appendTo:i.value?void 0:".j-filter-panel"}}];(0,n.onMounted)(()=>{s.value=l.searchFieldList});const u=(0,n.computed)(()=>l.columns.filter(x=>!x.children?.length).map(x=>({label:x.config?.label,value:x.id,dataType:x.config?.dataType,options:x.config?.options}))),p=(0,n.computed)(()=>s.value.map(x=>x.field)),f=({data:x})=>{if(p.value.includes(x.value))return;const v=l.columns.find(b=>b.id===x.value)?.config||{};let C="eq",R="text";["options","dataItem"].includes(v.dataType||"")?C="in":["dateTime"].includes(v.type||"")&&(C="range",R="dateTime"),s.value.push({field:x.value,method:C,type:v.valueType||R})},h=o,g=()=>{s.value.length=0},m=()=>{i.value?h("filter"):h("close",!0)},y=()=>{s.value.forEach(x=>{x.value=void 0}),h("filter")};return t({getSearchFields:()=>s.value}),(x,v)=>{const C=(0,n.resolveComponent)("j-icon"),R=(0,n.resolveComponent)("j-select"),b=(0,n.resolveComponent)("j-button-select"),k=(0,n.resolveComponent)("j-button"),B=(0,n.resolveComponent)("j-input-rows"),_=(0,n.resolveComponent)("el-tooltip");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-filter-panel",{"is-pin":i.value}])},[i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",c0,[(0,n.createVNode)(C,{icon:"mdi:filter-outline"}),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选")),1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",d0,[(0,n.createElementVNode)("div",u0,[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选出符合以下")),1),(0,n.createElementVNode)("div",f0,[(0,n.createVNode)(R,{modelValue:r.value,"onUpdate:modelValue":v[0]||(v[0]=V=>r.value=V),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("条件的数据")),1)]),(0,n.createElementVNode)("div",p0,[(0,n.createVNode)(b,{label:"添加过滤条件",options:u.value,"model-value":p.value.join(","),onChange:f},null,8,["options","model-value"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(k,{key:0,type:"text",danger:"",label:"删除全部",onClick:g})):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",h0,[(0,n.createVNode)(B,{modelValue:s.value,"onUpdate:modelValue":v[1]||(v[1]=V=>s.value=V),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":i.value},null,8,["modelValue","is-wrap"])]),(0,n.createVNode)(_,{placement:"bottom",content:i.value?(0,n.unref)(a)("取消固定"):(0,n.unref)(a)("固定显示")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"pin-btn",onClick:c},[(0,n.createVNode)(C,{rotate:45,icon:i.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),(0,n.createElementVNode)("div",g0,[(0,n.createVNode)(k,{label:(0,n.unref)(a)("筛选"),type:"primary",onClick:m},null,8,["label"]),(0,n.createVNode)(k,{label:(0,n.unref)(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),is=m0,y0={class:"j-order-panel"},b0={class:"content"},v0={class:"btn-wrapper"},w0={class:"field-wrapper"},C0={class:"buttons"},x0=(0,n.defineComponent)({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),l=e,r=o,i=(0,n.computed)(()=>l.columns.filter(g=>!g.children?.length&&g.config?.sorter?.isNot!==!0).map(g=>({label:g.config?.label,value:g.id}))),s=(0,n.ref)([]),c=(0,n.computed)(()=>s.value.map(g=>g.value)),d=[{id:"label",type:"j-title",getCompConfig:({row:g})=>({title:g.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],u=({data:g})=>{c.value.includes(g.value)||s.value.push({label:g.label,value:g.value,sord:"ASC"})},p=g=>{s.value=JSON.parse(JSON.stringify(g))},f=()=>{r("save",JSON.parse(JSON.stringify(s.value)))},h=()=>{s.value=[],r("clear")};return t({init:p}),(g,m)=>{const y=(0,n.resolveComponent)("j-button-select"),w=(0,n.resolveComponent)("j-input-rows"),x=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",y0,[(0,n.createElementVNode)("div",b0,[(0,n.createElementVNode)("div",v0,[(0,n.createVNode)(y,{label:"添加排序规则",options:i.value,"model-value":c.value.join(","),onChange:u},null,8,["options","model-value"])]),(0,n.createElementVNode)("div",w0,[(0,n.createVNode)(w,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=v=>s.value=v),columns:d,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),(0,n.createElementVNode)("div",C0,[(0,n.createVNode)(x,{label:(0,n.unref)(a)("排序"),type:"primary",onClick:f},null,8,["label"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(x,{key:0,label:(0,n.unref)(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):(0,n.createCommentVNode)("",!0)])])}}}),k0=x0,S0={class:"j-column-panel"},E0={class:"content"},B0={class:"search-wrapper"},R0={class:"tree-wrapper"},_0={class:"buttons"},T0=(0,n.defineComponent)({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),l=e,r=o,i=(0,n.ref)(),s=(0,n.ref)(""),c={},d=(0,n.ref)([]),u=(0,n.ref)([]),p=(b,k)=>{const B=[],_=new Map;b.forEach(T=>{_.set(T.id||"",T),c[T.id||""]=T});const V=new Set;return k&&k.length>0&&k.forEach(T=>{const F=_.get(T.id);if(F){V.add(F.id||"");const L={id:F.id||"",label:F.config?.label||F.id||"",type:F.type,display:F.config?.display!==!1};F.children&&F.children.length>0&&(L.children=p(F.children,T.children)),B.push(L)}}),b.forEach(T=>{if(!V.has(T.id||"")){const F={id:T.id||"",label:T.config?.label||T.id||"",type:T.type,display:T.config?.display!==!1};T.children&&T.children.length>0&&(F.children=p(T.children)),B.push(F)}}),B},f=(b,k)=>k.length===0?b:b.map(B=>{const _=k.some(T=>B.label.toLowerCase().includes(T.toLowerCase())),V=B.children?f(B.children,k):[];return _||V.length>0?{...B,children:V.length>0?V:B.children}:null}).filter(Boolean),h=(0,n.computed)(()=>{if(!s.value)return u.value;const b=s.value.split(/\s+/).filter(Boolean);return f(u.value,b)}),g=(0,n.ref)([]),m=(0,n.computed)(()=>{const b=new Map;if(l.columnConfig&&l.columnConfig.length>0){const k=B=>{B.forEach(_=>{b.set(_.id,_),_.children&&k(_.children)})};k(l.columnConfig)}return b}),y=()=>{const b=k=>{const B=[];return k.forEach(_=>{let V=!0;if(m.value.size>0){const T=m.value.get(_.id||"");T?V=T.display:V=_.config?.display!==!1}else V=_.config?.display!==!1;V&&(B.push(_.id||""),_.children&&B.push(...b(_.children)))}),B};g.value=b(l.columns)},w=(b,{node:k})=>{b.includes(k.id)?g.value.push(k.id):g.value=g.value.filter(B=>B!==k.id)},x=(b,k,B)=>B==="inner"?!1:b.parent===k.parent,v=()=>{const b=k=>k.map(B=>{const _={...B,display:g.value.includes(B.id)};return B.children&&(_.children=b(B.children)),_});r("save",b(u.value))},C=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),s.value="",i.value){const b=i.value;b.setCheck&&b.setCheck(g.value);const k=b.$refs?.treeRef||b;k?.setCheckedKeys&&k.setCheckedKeys(g.value)}r("save",void 0)};return t({init:()=>{y(),d.value=p(l.columns,l.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(b,k)=>{const B=(0,n.resolveComponent)("j-icon"),_=(0,n.resolveComponent)("el-input"),V=(0,n.resolveComponent)("j-tree"),T=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",S0,[(0,n.createElementVNode)("div",E0,[(0,n.createElementVNode)("div",B0,[(0,n.createVNode)(_,{modelValue:s.value,"onUpdate:modelValue":k[0]||(k[0]=F=>s.value=F),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(B,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",R0,[(0,n.createVNode)(V,{ref_key:"treeRef",ref:i,list:h.value,"is-tree-data":!0,"default-checked-keys":g.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":x,check:w},null,8,["list","default-checked-keys","draggable"])])]),(0,n.createElementVNode)("div",_0,[(0,n.createVNode)(T,{label:(0,n.unref)(a)("确定"),type:"primary",onClick:v},null,8,["label"]),(0,n.createVNode)(T,{label:(0,n.unref)(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),M0=T0,V0={class:"j-table-panel-left"},N0={class:"j-table-panel-top"},A0={class:"j-table-panel-top-right"},P0={key:0,style:{width:"200px"}},j0={class:"j-table-panel-main"},O0={class:"j-table-panel-loading"},I0={class:"j-table-panel-loading-content"},z0={class:"j-table-panel-loading-text"},L0={key:0,class:"j-table-panel-filter-panel"},H0=(0,n.defineComponent)({name:"JTablePanel",__name:"table-panel",props:{columns:{type:Array,required:!0,default:()=>[]},isTree:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},parentKey:{type:String,default:""},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},selectStateKey:{type:String,default:""},isPage:{type:Boolean,default:!1},pageSizes:Array,pageSize:{type:Number,default:100},subColumns:{type:Array,default:()=>[]},isSubShowNumber:{type:Boolean,default:!0},subActions:{type:Array,default:()=>[]},loadChildren:{type:Function,default:null},rowKey:{type:String,default:void 0},sort:String,buttons:{type:Array,default:()=>[]},batchButtons:{type:Array,default:()=>[]},actions:{type:Array,default:()=>[]},actionsMaxCount:{type:Number,default:3},actionsLabel:{type:String,default:"操作"},actionFilter:{type:Function,default:null},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean,highlightMode:{type:String,default:"row"},showFilterButton:{type:Boolean,default:!0},showOrderButton:{type:Boolean,default:!0},showColumnButton:{type:Boolean,default:!0},showRefreshButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0}},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),{openLayer:l}=Wn(),r=e,i=o;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=(0,n.ref)();let c=[];const d=(0,n.ref)(0),u=(0,n.ref)(1);let p=r.pageSize||100;const f=(0,n.ref)(0),h=(0,n.computed)(()=>f.value>0),g=(0,n.ref)([]),m=(0,n.ref)(!1),y=(0,n.computed)(()=>r.batchButtons&&r.batchButtons.length>0),w=(0,n.computed)(()=>g.value.length>0),x=(0,n.computed)(()=>y.value&&w.value&&r.isMultiple||m.value),v=(0,n.computed)(()=>r.isPage&&!x.value);y.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const C=pe=>r.rowKey?r.rowKey.split(",").map(be=>pe[be.trim()]).join("::"):"",R=(pe,be)=>{if(!be||be.length===0)return pe.filter(re=>re.config?.display!==!1).map(re=>re.children&&re.children.length>0?{...re,children:R(re.children)}:re);const Ze=new Map(pe.map(re=>[re.id,re])),ct=[];return be.forEach(re=>{const Ke=Ze.get(re.id);if(Ke){if(re.display){let Ct=Ke;Ke.children&&Ke.children.length>0&&(Ct={...Ke,children:R(Ke.children,re.children)}),ct.push(Ct)}Ze.delete(re.id)}}),pe.forEach(re=>{if(Ze.has(re.id)&&re.config?.display!==!1){let Ke=re;re.children&&re.children.length>0&&(Ke={...re,children:R(re.children)}),ct.push(Ke)}}),ct},b=(0,n.computed)(()=>R(r.columns,Te.value)),k=(0,n.computed)(()=>Jr(r.columns,pe=>pe.config.label)),B=(0,n.ref)(""),_=(0,n.computed)(()=>k.value.some(pe=>pe.config?.filter?.isSearchKeyword)),V=(0,n.ref)(),T=(0,n.ref)(!0),F=(0,n.ref)([]),L=(0,n.computed)(()=>T.value?"搜索全部":`搜索范围:${k.value.filter(pe=>F.value.includes(pe.id)).map(pe=>pe.config?.label).join("、")}`),D=()=>{V.value.init()},M=(0,n.ref)(),E=(0,n.ref)(!1),I=(0,n.ref)(!1),$=(0,n.ref)(!1),Q=(0,n.ref)([]),ue=(0,n.ref)("and"),xe=(0,n.ref)(),_e=(0,n.ref)(!1),Y=(0,n.ref)([]),z=()=>{xe.value.init(Y.value)},ie=pe=>{Y.value=pe,_e.value=!1,ke()},fe=()=>{Y.value=[],ke()},de=(0,n.ref)(),ve=(0,n.ref)(!1),Te=(0,n.ref)(),X=(0,n.computed)(()=>Te.value!=null),ye=()=>{de.value?.init()},Be=pe=>{Te.value=pe,ve.value=!1},Me=(0,n.ref)(!1),ft=()=>{Me.value=!Me.value},mt=()=>{g.value=[],s.value&&(s.value.setSelection?.([]),m.value&&(m.value=!1,s.value.setRecords(c)))},ze=()=>{m.value=!m.value,m.value?s.value?.setRecords(g.value):(console.log(c,"tableData"),s.value?.setRecords(c)),s.value?.setSelection?.(g.value)},jn=(0,n.computed)(()=>{if(g.value.length>0&&r.isMultiple){const pe=[{id:"selection_count",label:`已选${g.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:m.value?"全部":"仅选中",config:{type:"text"},click:ze},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:mt}],be=r.batchButtons.map(Ze=>({...Ze,click:()=>{Ze.click&&Ze.click({data:g.value,openLayer:l})}}));return[...pe,...be]}return r.buttons}),st=(0,n.computed)(()=>jn.value.filter(pe=>pe.config?.display!==!1)),Et=(0,n.ref)(null),U=(0,n.ref)(0),ae=()=>{U.value=Et.value?.clientWidth||0};let K;(0,n.onMounted)(()=>{(0,n.nextTick)(ae),K=new ResizeObserver(()=>{ae()}),Et.value&&K.observe(Et.value)}),(0,n.onBeforeUnmount)(()=>{K?.disconnect()}),(0,n.watch)(()=>st.value,()=>{(0,n.nextTick)(ae)},{deep:!0}),(0,n.watch)(Me,()=>{(0,n.nextTick)(ae)});const q=(0,n.computed)(()=>{const pe=st.value;if(pe.length===0)return[];const be=U.value;if(be<=0)return pe;const Ze=Math.max(0,be-4),ct=(yt,at)=>yt.groupId||`__auto_${at}`,re=yt=>{if(yt.config?.notLabel===!0||!yt.label)return 28;const at=24,Vt=kt(yt.label||"")||0,Bt=yt.config?.icon?18:0;return Math.ceil(Vt+at+Bt+2)};if((yt=>{let at=0,Vt=null;return yt.forEach((Bt,Do)=>{const Ga=ct(Bt,Do);Vt!==null&&(at+=Ga===Vt?-1:8),at+=re(Bt),Vt=Ga}),at})(pe)<=Ze)return pe;const Ct={id:"__table_panel_more__",label:"",config:{icon:"mdi:dots-horizontal",notLabel:!0},children:[]},pt=28,dt=[];let Fe=0,co=null;for(let yt=0;yt<pe.length;yt++){const at=pe[yt],Vt=ct(at,yt);let Bt=Fe;co!==null&&(Bt+=Vt===co?-1:8),Bt+=re(at);const Do=pe.length-(yt+1)>0?(Bt>0?8:0)+pt:0;if(Bt+Do<=Ze)dt.push(at),Fe=Bt,co=Vt;else break}const Ka=pe.slice(dt.length);if(Ka.length===0)return pe;const On={...Ct,children:Ka};return dt.length===0?[On]:[...dt,On]});let te;const Ce=async pe=>{f.value++;const be={};pe&&(te=pe),te&&(be.query=te);try{const Ze={};Ze.rel=ue.value,Ze.cond=(M.value?.getSearchFields?.()||Q.value).filter(re=>re.value!==void 0&&re.value!==null&&re.value!==""||["empty","not_empty"].includes(re.method)).map(re=>({field:re.field,method:re.method,value:re.value,type:re.type})),Ze.cond.length>0?$.value=!0:$.value=!1,be.filter=Ze;const ct=Y.value.map(re=>re.value+" "+re.sord).join(",");if(B.value&&(be.keyword={value:B.value,fields:T.value?k.value.filter(re=>re.config?.filter?.isSearchKeyword).map(re=>re.id):(0,n.unref)(F)}),r.loadData){if(r.isPage){be.pagination={rows:p,page:u.value,sort:ct||r.sort||r.rowKey};const re=await r.loadData(be)||{};c=re.rows||[],d.value=re.records||0}else be.sort=ct,c=await r.loadData(be)||[],d.value=c.length;s.value.setRecords(c),y.value?(g.value=[],m.value=!1):r.rowKey&&g.value.length>0&&s.value?.setSelection?.(g.value)}}finally{f.value=Math.max(0,f.value-1)}},ke=async()=>{u.value=1,await Ce()},Le=({rows:pe,page:be})=>{p=pe,u.value=be,Ce()},ot=async()=>{g.value=[],m.value=!1,u.value=1,te=void 0,await Ce()},We=async pe=>{g.value=[],m.value=!1,await Ce(pe)},vn=async()=>{await ot()},wn=pe=>{i("ready",pe)},Lo=({selections:pe,record:be,checked:Ze,isMultiple:ct})=>{let re=[];if(!r.isMultiple){g.value=pe,i("select",{selections:pe,record:be,checked:Ze,isMultiple:ct});return}if(y.value)re=pe;else if(!r.rowKey)re=pe;else{const Ke=new Map(pe.map(pt=>[C(pt),pt])),Ct=new Map(g.value.map(pt=>[C(pt),pt]));c.forEach(pt=>{const dt=C(pt);Ke.has(dt)?Ct.set(dt,Ke.get(dt)):Ct.delete(dt)}),re=Array.from(Ct.values())}g.value=re,i("select",{selections:re,record:be,checked:Ze,isMultiple:ct}),m.value&&re.length===0?(m.value=!1,s.value&&s.value.setRecords(c)):m.value&&re.length>0&&s.value&&(s.value.setRecords(re),s.value.setSelection?.(re))},Ho=pe=>{g.value=pe},Mr=()=>g.value||[],Ja=pe=>{g.value=pe,s.value?.setSelection?.(pe)},$t=()=>s.value;return(0,n.onMounted)(async()=>{r.immediate&&await We()}),t({refreshData:We,resetData:ot,getSelection:Mr,setSelection:Ja,clearSelection:()=>{mt()},getTableRef:$t}),(pe,be)=>{const Ze=(0,n.resolveComponent)("j-buttons"),ct=(0,n.resolveComponent)("j-icon"),re=(0,n.resolveComponent)("el-popover"),Ke=(0,n.resolveComponent)("el-tooltip"),Ct=(0,n.resolveComponent)("el-input"),pt=(0,n.resolveComponent)("j-button"),dt=(0,n.resolveComponent)("j-table");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-table-panel-wrapper",{fullscreen:Me.value,"no-padding":e.noPadding||Me.value}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-table-panel",{"j-table-panel-fullscreen":Me.value}])},[(0,n.createElementVNode)("div",V0,[(0,n.createElementVNode)("div",N0,[(0,n.createElementVNode)("div",{ref_key:"topLeftRef",ref:Et,class:"j-table-panel-top-left"},[(0,n.createVNode)(Ze,{list:q.value},null,8,["list"])],512),(0,n.createElementVNode)("div",A0,[_.value&&!x.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",P0,[(0,n.createVNode)(Ct,{modelValue:B.value,"onUpdate:modelValue":be[2]||(be[2]=Fe=>B.value=Fe),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:(0,n.withKeys)(ke,["enter"]),onClear:ke},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(ct,{icon:"mdi:search"})]),suffix:(0,n.withCtx)(()=>[(0,n.createVNode)(Ke,{placement:"bottom",content:L.value},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(re,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:D,onHide:ke},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(ct,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(s0,{ref_key:"keywordPanelRef",ref:V,"check-all":T.value,"onUpdate:checkAll":be[0]||(be[0]=Fe=>T.value=Fe),"check-fields":F.value,"onUpdate:checkFields":be[1]||(be[1]=Fe=>F.value=Fe),columns:k.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),e.showFilterButton&&!E.value&&!x.value?((0,n.openBlock)(),(0,n.createBlock)(re,{key:1,visible:I.value,"onUpdate:visible":be[6]||(be[6]=Fe=>I.value=Fe),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:ke},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:(0,n.normalizeClass)({active:$.value})},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(is,{ref_key:"filterPanelRef",ref:M,"is-pin":E.value,"onUpdate:isPin":be[3]||(be[3]=Fe=>E.value=Fe),relation:ue.value,"onUpdate:relation":be[4]||(be[4]=Fe=>ue.value=Fe),"search-field-list":Q.value,columns:k.value,onFilter:ke,onClose:be[5]||(be[5]=Fe=>I.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):(0,n.createCommentVNode)("",!0),e.showOrderButton&&!x.value?((0,n.openBlock)(),(0,n.createBlock)(Ke,{key:2,placement:"bottom",content:(0,n.unref)(a)("排序")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(re,{visible:_e.value,"onUpdate:visible":be[7]||(be[7]=Fe=>_e.value=Fe),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:z},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{class:(0,n.normalizeClass)({active:Y.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(k0,{ref_key:"orderPanelRef",ref:xe,columns:k.value,onSave:ie,onClear:fe},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showColumnButton&&!x.value?((0,n.openBlock)(),(0,n.createBlock)(Ke,{key:3,placement:"bottom",content:(0,n.unref)(a)("显示字段")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(re,{visible:ve.value,"onUpdate:visible":be[8]||(be[8]=Fe=>ve.value=Fe),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:ye},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{class:(0,n.normalizeClass)({active:X.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(M0,{ref_key:"columnPanelRef",ref:de,columns:e.columns,"column-config":Te.value,onSave:Be},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showRefreshButton&&!x.value?((0,n.openBlock)(),(0,n.createBlock)(Ke,{key:4,placement:"bottom",content:(0,n.unref)(a)("刷新")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{type:"text",icon:"mdi:refresh",onClick:vn})]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showFullscreenButton?((0,n.openBlock)(),(0,n.createBlock)(Ke,{key:5,placement:"bottom",content:Me.value?(0,n.unref)(a)("退出全屏"):(0,n.unref)(a)("全屏")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{type:"text",icon:Me.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:ft},null,8,["icon"])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0)])]),(0,n.createElementVNode)("div",j0,[(0,n.withDirectives)((0,n.createElementVNode)("div",O0,[(0,n.createElementVNode)("div",I0,[(0,n.createVNode)(ct,{icon:"mdi:loading",class:"loading-spin",size:24}),(0,n.createElementVNode)("div",z0,(0,n.toDisplayString)((0,n.unref)(a)("加载中")),1)])],512),[[n.vShow,h.value]]),(0,n.createVNode)(dt,{ref_key:"tableRef",ref:s,"table-page":u.value,"onUpdate:tablePage":be[9]||(be[9]=Fe=>u.value=Fe),columns:b.value,"sub-columns":e.subColumns,records:(0,n.unref)(c),"is-tree":e.isTree,"default-expand-all":e.defaultExpandAll,"parent-key":e.parentKey,"is-show-number":e.isShowNumber,"is-sub-show-number":e.isSubShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"select-state-key":e.selectStateKey,"is-page":v.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":d.value,"row-key":e.rowKey,actions:e.actions,"sub-actions":e.subActions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"action-filter":e.actionFilter,"highlight-mode":e.highlightMode,"load-children":e.loadChildren,onLoadPageData:Le,onReady:wn,onSelectionChanged:Lo,onSelectRecordsChanged:Ho},null,8,["table-page","columns","sub-columns","records","is-tree","default-expand-all","parent-key","is-show-number","is-sub-show-number","is-multiple","select-state-key","is-page","page-sizes","page-size","page-total","row-key","actions","sub-actions","actions-max-count","actions-label","action-filter","highlight-mode","load-children"])])]),e.showFilterButton&&E.value&&!x.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",L0,[(0,n.createVNode)(is,{ref_key:"filterPanelRef",ref:M,"is-pin":E.value,"onUpdate:isPin":be[10]||(be[10]=Fe=>E.value=Fe),relation:ue.value,"onUpdate:relation":be[11]||(be[11]=Fe=>ue.value=Fe),"search-field-list":Q.value,columns:k.value,onFilter:ke},null,8,["is-pin","relation","search-field-list","columns"])])):(0,n.createCommentVNode)("",!0)],2)],2)}}}),D0=H0,xl=se(D0),F0={class:"j-button-select"},$0={class:"search-wraper"},W0={class:"options-wraper"},U0=["onClick"],J0=(0,n.defineComponent)({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:l}=Je(),r=(0,n.ref)(""),i=(0,n.computed)(()=>r.value===""?o.options:o.options.filter(d=>(d.label||"").includes(r.value))),s=(0,n.computed)(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),c=d=>{if(d.disabled||s.value.includes(d.value))return;const u=[...s.value,d.value].join(",");a("update:modelValue",u),a("change",{value:u,data:d})};return(d,u)=>{const p=(0,n.resolveComponent)("j-button"),f=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-input"),g=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createBlock)(g,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(p,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",F0,[(0,n.createElementVNode)("div",$0,[(0,n.createVNode)(h,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=m=>r.value=m),modelModifiers:{trim:!0},placeholder:(0,n.unref)(l)("搜索"),class:"no-border",clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(f,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",W0,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i.value,m=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:m.value,class:(0,n.normalizeClass)(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:(0,n.withModifiers)(y=>c(m),["stop"])},[m.icon?((0,n.openBlock)(),(0,n.createBlock)(f,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(l)(m.label)),1)],10,U0))),128))])])]),_:1},8,["width"])}}}),Y0=J0,ss=se(Y0),K0={class:"j-tree-item-text"},G0={key:2,class:"j-tree-item-button-group"},q0={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},X0=(0,n.defineComponent)({name:"JTree",__name:"tree",props:{loadData:Function,afterLoadData:Function,click:Function,immediate:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},defaultCheckedKeys:{type:Array,default:()=>[]},defaultExpandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightCurrent:{type:Boolean,default:!0},filterNode:Function,renderAfterExpand:{type:Boolean,default:!0},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},pidKey:{type:String,default:"pid"},idKey:{type:String},iconKey:{type:String,default:"nodeIcon"},iconColorKey:{type:String,default:"nodeIconColor"},list:{type:Array},dataType:String,dataCode:String,checkable:Boolean,check:Function,emptyDes:{type:String,default:"暂无数据"},defaultIcon:{type:String,default:""},defaultIconColor:{type:String,default:""},treeButtons:{type:Array,default:()=>[]},filterButton:Function,buttonDefaultIcon:{type:String,default:""},buttonIconColor:{type:String,default:""},runFlow:{type:Function},nodeClickFlow:{type:String},isHeightAuto:{type:Boolean,default:!1},theme:{type:String,default:"default"},draggable:{type:Boolean,default:!1},expandOnClickNode:{type:Boolean,default:!1},allowDrop:Function},emits:["node-drop"],setup(e,{expose:t,emit:o}){const a=e,l=o,{useData:r,t:i}=Je(),{getTreeData:s,loadData:c}=r(),d=(0,n.ref)(),u=(0,n.ref)(!1),p=(0,n.ref)(""),f=(0,n.ref)([]),h={children:"children",label:"label",disabled:"disabled"},g=(0,n.computed)(()=>s?s({dataType:a.dataType,dataCode:a.dataCode,labelKey:a.labelKey,valueKey:a.valueKey,pidKey:a.pidKey,idKey:a.idKey,notLoad:!0})||[]:[]),m=(0,n.computed)(()=>a.dataCode||a.dataType?g.value:a.list?(0,n.unref)(a.list):f.value),y=async()=>{u.value=!0,a.loadData&&(f.value=await a.loadData()||[]),c&&await c(a.dataType,a.dataCode),u.value=!1,(0,n.nextTick)(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},w=(D,M=!0)=>{d.value?.setCurrentKey(D,M)},x=()=>d.value?.getCurrentKey(),v=(D,M=!1)=>{d.value?.setCheckedKeys(D,M)},C=(D=!1)=>d.value?.getCheckedKeys(D),R=async(D,M,E,I)=>{if(p.value=D.value,a.nodeClickFlow&&a.runFlow){const $=JSON.parse(a.nodeClickFlow);await a.runFlow($,{value:D.value})}a.click&&a.click(D.value,D,I)},b=(D,{checkedKeys:M,checkedNodes:E,halfCheckedKeys:I,halfCheckedNodes:$})=>{a.check&&a.check(M,{node:D,checkedNodes:E,halfCheckedKeys:I,halfCheckedNodes:$})},k=(D,M,E,I)=>{l("node-drop",D,M,E,I)},B=D=>{const M=xt(a.treeButtons);return D&&a.filterButton?a.filterButton({buttons:M,node:D}):M},{openLayer:_}=Wn(),V=(D,M)=>{D.config?.disabled||D.click&&D.click({data:M,openLayer:_})},T=(0,n.ref)(""),F=(D,M)=>{T.value=D?M.value:"",console.log(T.value,"row")},L=(D,M,E)=>a.allowDrop?a.allowDrop(D,M,E):!(E=="inner"&&!M.data.canInner);return(0,n.onMounted)(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),(0,n.watch)(()=>a.list,()=>{u.value=!0,(0,n.nextTick)(()=>{u.value=!1})}),(0,n.watch)(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:w,getValue:x,setCheck:v,getCheck:C}),(D,M)=>{const E=(0,n.resolveComponent)("j-icon"),I=(0,n.resolveComponent)("j-button"),$=(0,n.resolveComponent)("el-dropdown-item"),Q=(0,n.resolveComponent)("el-dropdown-menu"),ue=(0,n.resolveComponent)("el-dropdown"),xe=(0,n.resolveComponent)("el-tree"),_e=(0,n.resolveComponent)("el-empty"),Y=(0,n.resolveDirective)("loading");return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!u.value&&m.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(xe,{key:0,ref_key:"treeRef",ref:d,"node-key":e.idKey||e.valueKey,"default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":p.value,data:m.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:h,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":L,"expand-on-click-node":e.expandOnClickNode,onNodeClick:R,onCheck:b,onNodeDrop:k},{default:(0,n.withCtx)(({node:z})=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-tree-item-wraper",{"is-focus":T.value===z.data.value}])},[z.data.openIcon?((0,n.openBlock)(),(0,n.createBlock)(E,{key:0,class:"j-tree-item-open-icon",size:18,icon:z.data.openIcon,color:z.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),z.data[e.iconKey]||e.defaultIcon?((0,n.openBlock)(),(0,n.createBlock)(E,{key:1,class:"j-tree-item-default-icon",size:18,icon:z.data[e.iconKey]||e.defaultIcon||"",color:z.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",K0,(0,n.toDisplayString)(z.label),1),B(z.data).length?((0,n.openBlock)(),(0,n.createElementBlock)("div",G0,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(B(z.data),(ie,fe)=>((0,n.openBlock)(),(0,n.createBlock)(ue,{key:fe,trigger:"click",onVisibleChange:de=>F(de,z.data)},{dropdown:(0,n.withCtx)(()=>[(0,n.createVNode)(Q,null,{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(ie.children,(de,ve)=>((0,n.openBlock)(),(0,n.createBlock)($,{key:ve,disabled:de.disabled,divided:de.divided,onClick:(0,n.withModifiers)(Te=>V(de,z.data),["stop"])},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"j-flex-item",style:(0,n.normalizeStyle)({color:de.danger?"var(--j-color-danger)":de.color||e.buttonIconColor||"var(--j-color-text-2)"})},[de.icon||e.buttonDefaultIcon?((0,n.openBlock)(),(0,n.createBlock)(E,{key:0,icon:de.icon||e.buttonDefaultIcon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(i)(de.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(I,{icon:ie.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):(0,n.createCommentVNode)("",!0)],2)]),_:1},8,["node-key","default-checked-keys","default-expanded-keys","current-node-key","data","default-expand-all","show-checkbox","highlight-current","accordion","filter-node-method","render-after-expand","draggable","expand-on-click-node"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",q0,[(0,n.createVNode)(_e,{description:(0,n.unref)(i)(e.emptyDes)},null,8,["description"])]))],2)),[[Y,u.value]])}}}),Z0=X0,cs=se(Z0),Q0=(0,n.defineComponent)({name:"JTreeSelect",__name:"tree-select",props:{modelValue:{},options:{},checkStrictly:{type:Boolean,default:!0},renderAfterExpand:{type:Boolean,default:!0},props:{default:()=>({children:"children",label:"label",value:"value"})},size:{default:"default"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},placeholder:{default:"请选择"},dataType:{default:""},dataCode:{default:""},labelKey:{default:""},valueKey:{default:""},pidKey:{default:""},idKey:{default:""}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a={dataItem:{label:"j_ItemName",value:"j_ItemValue",idKey:"j_Id",pidKey:"j_ParentId"},dataClassify:{label:"j_ItemName",value:"j_ItemCode",idKey:"j_Id",pidKey:"j_ParentId"},dblink:{label:"j_Name",value:"j_Code"},area:{label:"j_AreaName",value:"j_AreaCode",idKey:"j_AreaId",pidKey:"j_ParentId"}},{useData:l}=Je(),{getTreeData:r}=l(),i=(0,n.computed)(()=>r?r({dataType:o.dataType,dataCode:o.dataCode,labelKey:o.labelKey||a[o.dataType]?.label||"label",valueKey:o.valueKey||a[o.dataType]?.value||"value",pidKey:o.pidKey||a[o.dataType]?.pidKey||"pid",idKey:o.idKey||a[o.dataType]?.idKey||"id",notLoad:!1})||[]:[]),s=(0,n.computed)(()=>o.dataCode||o.dataType?i.value:o.options||[]),c=t,d=(0,n.computed)({get(){return o.modelValue},set(p){c("update:modelValue",p)}}),u=p=>{c("change",p)};return(p,f)=>{const h=(0,n.resolveComponent)("el-tree-select");return(0,n.openBlock)(),(0,n.createBlock)(h,{modelValue:d.value,"onUpdate:modelValue":f[0]||(f[0]=g=>d.value=g),data:s.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:o,style:{width:"100%"},size:e.size,disabled:e.disabled||e.readonly,clearable:e.clearable,placeholder:e.placeholder,onChange:u},null,8,["modelValue","data","check-strictly","render-after-expand","size","disabled","clearable","placeholder"])}}}),em=Q0,ds=se(em),us=se(Vi),tm=ul.default;async function nm(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const l=new tm({[e]:[a]});let r=[];try{await l.validate({[e]:t})}catch(i){i.errors?r=i.errors.map(({message:s})=>s):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function om(e,t,o){const a=o.map((l,r)=>({...l,ruleIndex:r})).sort(({warningOnly:l,ruleIndex:r},{warningOnly:i,ruleIndex:s})=>!!l==!!i?r-s:l?1:-1);for(let l=0;l<a.length;l+=1){const r=a[l];"pattern"in r&&(t+="");const i=await nm(e,t,r);if(i!=="")return{name:e,errors:i}}}function am(e,t){const o=(r,i,s,c,d)=>{Object.keys(i).forEach(u=>{let p=u;s&&(p=`${s}.${u}`);const f=i[u],{rules:h,myGridtableId:g}=t(p,s?i:void 0,()=>c,d);if(h.length){const m=a(p,f,h);r.push(m)}g&&f.forEach(m=>{o(r,m,g,f,s?i:void 0)})})},a=(r,i,s)=>om(r,i,s);return{validateForm:async()=>{const r=(0,n.unref)(e),i=[];o(i,r,"");const s=await Promise.all(i),c={};return s.forEach(d=>{d&&(c[d.name]={msg:d.errors})}),c},validateField:a}}var lm=(0,n.defineComponent)({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["change"],setup(e,{expose:t,emit:o}){const a=e,l=o,{useData:r,existField:i,httpGet:s,httpPost:c,success:d,warning:u,error:p,info:f,t:h}=Je();let g;r&&(g=r());const m=U=>{p&&p(U)},y=(0,n.ref)(!1),w=(0,n.computed)(()=>a.config?.gutter||16),x=(0,n.computed)(()=>a.config?.span||24),v=(0,n.computed)(()=>a.config?.labelWidth),C=(0,n.computed)(()=>a.config?.labelPosition||"right"),R=(0,n.computed)(()=>B.length===1&&(B[0].type==="j-tabs"||B[0].type==="j-layout"||B[0].config?.isAutoWindow)),b=(0,n.reactive)({}),k=(0,n.ref)({}),B=[],_={},V=(0,n.ref)({});let T={},F={},L=[],D={};const M=U=>{y.value&&$&&(U.getTableData||gl($,U.id,U.formData[U.id])),l("change",U)},E=U=>ea(_[U]?.type||"")&&!_[U]?.config?.notInput||_[U]?.config?.isInput,I=U=>["j-table","j-input-rows","j-input-cards"].includes(_[U]?.type||"");let $;const Q=(U,ae)=>{Object.keys(U).forEach(K=>{const q=U[K];ae&&(K=ae+"."+K),q!=null&&typeof q=="object"&&!Xo(q)&&Q(q,K),b[K]=q})},ue=(U,ae)=>{let K=U.id;return K||(U.config?.table&&U.config?.field?K=`${U.config.table}.${U.config.field}`:U.config?.table?K=U.config?.table:U.config?.field&&(K=U.config?.field),ae&&I(ae)&&(K=`${ae}.${K}`)),K||Qo("j")},xe=(U,ae,K,q="")=>{U.forEach(te=>{te.id=ue(te,q);const Ce={id:te.id,slot:te.slot,type:te.type||"",getCompType:te.getCompType,getCompConfig:te.getCompConfig,config:{},children:[]};ae.push(Ce);const{children:ke}=te;fo(Ce,te,["children","config"]),fo(Ce.config,te.config||{},[]),_[te.id]&&console.warn("有重复的组件id:"+te.id),_[te.id]=Ce,a.readonly===!0&&(Ce.config.readonly=!0);let Le=!1,ot;q!==""&&I(q)&&(Le=!0,Ce.config=te.config||{},Ce.config.parentTableId=q,ot=_[q]?.config?.table);const We=Ce.config||{};if(E(te.id))!K&&Le===!1&&(We?.defaultValue===0?b[te.id]=We?.defaultValue:b[te.id]=We?.defaultValue||void 0),We.table&&We.field?T[`${We.table}_${We.field}`.toLowerCase()]=te.id:We.field&&(Le?T[`${ot}_${We.field}`.toLowerCase()]=te.id:T[`${We.field}`.toLowerCase()]=te.id);else if(Le&&We.field)T[`${ot}_${We.field}`.toLowerCase()]=te.id;else if(I(te.id))!K&&!We.isSubTable&&(b[te.id]=[]),We.table&&(T[We.table.toLowerCase()||""]=te.id),We.isSubTable||L.push(Ce);else if(We?.defaultValue)b[te.id]=We?.defaultValue;else if(te.type==="collapse"&&We?.isExpand){const vn=[];(We?.groups||[]).forEach(wn=>{vn.push(wn.i)}),b[te.id]=vn}ke&&ke.length>0&&xe(ke,Ce.children,K,Ce.id)})},_e=async(U,ae)=>{y.value=!1;const K=!!ae;B.splice(0,B.length),T={},F={},L=[],$=ae,Dn(b),Dn(_),V.value={},K&&Q(ae,""),xe(U,B,K),D=xt(b),await(0,n.nextTick)(),y.value=!0,await(0,n.nextTick)(),st(a.config?.codeInit,{})},Y=(U,ae,K)=>{const q=[];return ae.forEach(te=>{const Ce={};Object.keys(te).forEach(ke=>{if(!K||K(ke,te[ke],U)){const Le=Be(ke);if(Le?.type==="j-table")Ce[Le?.id||""]=Y(ke,te[ke],K);else{let ot=T[`${U}_${ke}`.toLowerCase()]||ke;ot=ot.indexOf(".")!==-1?ot.split(".")[1]:ot,Ce[ot]=te[ke]}}}),q.push(Ce)}),q},z=(U,ae)=>{Object.keys(U||{}).forEach(K=>{let q=U[K];const te=Be(K);if(te===void 0)q&&(Xo(q)&&(q=q[0]||{}),typeof q=="object"?Object.keys(q).forEach(Ce=>{if(!ae||ae(K,q[Ce],K)){let ke=Ce;K!=="main"&&(ke=`${K}_${Ce}`),F[ke]=K,b[T[ke.toLowerCase()]||Ce]=q[Ce]}}):b[K]=q);else if(I(te.id||"")){if(!Array.isArray(q)){console.warn("表格数据不是数组:"+K);return}q?.length>0?b[T[K.toLowerCase()]||K]=Y(K,q,ae):b[T[K.toLowerCase()]||K]=[]}else(!ae||ae(K,q,K))&&(b[T[K.toLowerCase()]||K]=q)}),$&&Object.keys(b).forEach(K=>{const q=Be(K);(q===void 0||!["j-tabs","j-collapse"].includes(q.type||""))&&gl($,K,b[K])})},ie=(U,ae=!1)=>{const K={};return Object.keys(U).forEach(q=>{if(q==="parentRow")return;const te=_[q];if(te){const Ce=te.config?.table,ke=te.config?.field;if(ae)ke?K[ke]=U[q]:K[q]=U[q];else if(I(q)){const Le=[];U[q].forEach(ot=>{Le.push(ie(ot,!0))}),K[Ce||q]=Le}else Ce&&ke?(K[Ce]=K[Ce]||{},K[Ce][ke]=U[q]):ke&&(K[ke]=U[q])}else ae?q!=="_X_ROW_KEY"&&q!=="_isHover"&&(K[q]=U[q]):F[q]?(K[F[q]]=K[F[q]]||{},K[F[q]][q.replace(`${F[q]}_`,"")]=U[q]):K[q]=U[q]}),K},fe=(U=!0)=>U?ie(b):b,de=(U,ae,K,q)=>{let te=_[U];if(te==null){const ke=U.split(".");te=_[ke[ke.length-1]]||{}}if(!te)return{};const Ce=_t({config:{...te.config||{},...V.value[te.id||""]||{}},getCompConfig:te.getCompConfig,formData:b,getTableData:K,row:ae,pRowData:q});return Ce._componentId=te?.id,Ce},ve=(U,ae,K,q)=>{const te=de(U,ae,K,q);if(te.isNotRule!==!0&&te.display!==!1){const Ce=te.rule||[],ke=Ce.find(Le=>Le.type==="only");return ke&&(ke.validator=async(Le,ot)=>{if(ot&&!await i({table:Le.table,key:Le.key,keyName:Le.keyName,field:Le.field,keyValue:Le.getKeyValue?Le.getKeyValue():"",value:ot,paramNames:Le.paramNames,getParams:Le.getParams,withProjectId:Le.withProjectId,getValue:Le.getValue,formData:b}))throw h(Le.message)||h("数据值重复")}),{rules:Ce,myGridtableId:I(te._componentId)?te._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:Te}=am(b,ve),X=async()=>{k.value={};const U=await Te();return Object.keys(U).length>0?(k.value=U,m(`${h(_[Object.keys(U)[0]]?.config?.label)}:${h(U[Object.keys(U)[0]].msg)}`),!1):!0},ye=()=>{k.value={},Dn(b),Object.keys(D||{}).forEach(U=>{b[U]=D[U]})},Be=U=>{let ae=_[U];return ae===void 0&&T[U.toLowerCase()]&&(ae=_[T[U.toLowerCase()]]),ae},Me=({id:U,i:ae,value:K,type:q})=>{if(q==="add")b[U].push(K);else if(q==="delete")b[U].splice(ae,1);else{const te=Be(U);te&&(te.config.parentTableId?b[te.config.parentTableId][ae][U]=K:b[U]=K)}},ft=({id:U,i:ae})=>{const K=Be(U);if(K){if(K.config.parentTableId){const q=b[K.config.parentTableId],te=K.id?K.id.replace(`${K.config.parentTableId}.`,""):"";if(ae!=null)return(q[ae]||{})[te||""];const Ce=[];return q&&q.forEach(ke=>{Ce.push(ke[te||""])}),Ce}if(I(K.id||"")){const q=[];return b[K.id||""].forEach(te=>{q.push(ie(te,!0))}),q}return b[K.id||""]}if(b[U])return b[U]},mt=async({id:U,i:ae})=>{const K=ft({id:U,i:ae}),q=Be(U);if(q&&g?.getLabel)if(ae!==void 0){const te=K[ae],Ce=b[q.config.parentTableId||""][ae],ke=_t({config:q.config,getCompConfig:q.getCompConfig,formData:b,tableData:b[q.config.parentTableId||""],row:Ce});return await g?.getLabel({value:te,config:ke,formData:b,tableData:b[q.config.parentTableId||""],row:Ce})}else{const te=_t({config:q.config,getCompConfig:q.getCompConfig,formData:b});return await g?.getLabel({value:K,config:te,formData:b})}return K},ze=async(U,ae)=>g?.loadViewDataList?await g?.loadViewDataList(U,ae,!1):[],jn=U=>(U.set=Me,U.get=ft,U.setFormData=z,U.getFormData=fe,U.getLabel=mt,U.getViewData=ze,U.getDateNow=ae=>na(new Date,ae||"YYYY-MM-DD HH:mm:ss"),U.httpGet=s||(()=>{console.log("当前状态不支持")}),U.httpPost=c||(()=>{console.log("当前状态不支持")}),U.loading=ae=>{Fn(ae)},U.showMsg=({text:ae,type:K})=>{switch(K){case"success":d&&d(ae);break;case"warning":u&&u(ae);break;case"error":p&&p(ae);break;case"info":f&&f(ae);break;default:f&&f(ae);break}console.log("showMsg",ae,K)},U),st=async(U,ae)=>{if(U&&U.trim()){U=`async (jcode) => {${U}}`;const{res:K,fn:q}=hl(U);K&&await q(jn(ae))}},Et=(U,ae)=>{V.value[U]={...V.value[U]||{},...ae}};return a.schema&&_e(a.schema),bl({formData:b,components:_,compsConfig:V,errorFields:k,isAutoWindow:R,gutter:w,span:x,labelWidth:v,labelPosition:C,getValue:ft,formChange:M}),vl({contextType:"form"}),t({init:_e,reset:ye,validate:X,setValue:Me,getValue:ft,getLabel:mt,setFormData:z,getFormData:fe,setCompConfig:Et}),(U,ae)=>{const K=(0,n.resolveComponent)("j-form-item"),q=(0,n.resolveComponent)("el-row"),te=(0,n.resolveComponent)("el-form");return y.value?((0,n.openBlock)(),(0,n.createBlock)(te,{key:0,class:(0,n.normalizeClass)(["j-form",e.isAutoSize&&"j-block",e.isAutoSize&&"j-form-auto"]),"label-position":C.value,"label-width":v.value,size:e.config?.size,onSubmit:ae[0]||(ae[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[R.value?((0,n.openBlock)(),(0,n.createBlock)(K,(0,n.mergeProps)({key:0},B[0],{"is-not-col":""}),null,16)):((0,n.openBlock)(),(0,n.createBlock)(q,{key:1,gutter:w.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(B,Ce=>(0,n.createVNode)(K,(0,n.mergeProps)({key:Ce.id},{ref_for:!0},Ce),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):(0,n.createCommentVNode)("",!0)}}}),rm=lm,fs=se(rm),ps=se(Mi),im={class:"j-page"},sm=(0,n.defineComponent)({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=(0,n.ref)(!1),l=(0,n.reactive)([]),r={},i=(0,n.reactive)({}),s=(g,m)=>{g.forEach(y=>{y.id=y.id||Qo("c");const w={id:y.id,slot:y.slot,type:y.type||"",getCompConfig:y.getCompConfig,getCompType:y.getCompType},{children:x}=y;r[y.id]=w,w.config=[],fo(w.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(i[y.id]=y.config.defaultValue),m.push(w),x&&x.length>0&&(w.children=[],s(x,w.children))})},c=g=>{a.value=!1,l.splice(0,l.length),Dn(r),Dn(i),s(g,l),(0,n.nextTick)(()=>{a.value=!0})};o.schema&&c(o.schema);const d=new yl,u=new Map,p=(g,m,y,...w)=>{if(y?.immediate){const x=u.get(g)||new Map;x.set(m,w),u.set(g,x)}return d.emit(g,m,...w)},f=(g,m)=>{d.on(g,m);const y=u.get(g);y&&(u.delete(g),y.forEach((w,x)=>{m(x,...w||[])}))},h=(g,m)=>{d.off(g,m)};return ui({registerMethod:(g,m)=>(f(g,m),()=>{h(g,m)})}),vl({contextType:"page"}),t({init:c,call:p,on:f,off:h}),(g,m)=>{const y=(0,n.resolveComponent)("j-comp");return(0,n.openBlock)(),(0,n.createElementBlock)("div",im,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l,w=>((0,n.openBlock)(),(0,n.createBlock)(y,{key:w.id,id:w.id,type:w.type,config:w.config,children:w.children},null,8,["id","type","config","children"]))),128))])}}}),cm=sm,hs=se(cm),dm=(0,n.defineComponent)({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.ref)("");return(0,n.watch)(()=>o.modelValue,r=>{r?l.value=r:(l.value=Kt(),a("update:modelValue",l.value))},{immediate:!0}),(r,i)=>{const s=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(s,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=c=>l.value=c),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),um=dm,gs=se(um),fm={key:0,class:"j-panel-top"},pm=["title"],hm={style:{margin:"0","font-size":"14px"}},gm={key:1},mm={key:1,class:"j-panel-bottom"},ym=(0,n.defineComponent)({name:"JPanel",__name:"panel",props:{title:{},toolBtns:{default:()=>[]},bootmBtns:{default:()=>[]},bootmRightBtns:{default:()=>[]},bodyStyle:{default:()=>({padding:"8px"})},noPadding:{type:Boolean,default:!1},notTitle:{type:Boolean,default:!1},flexWidth:{},height:{},unit:{default:"%"},notSetWidth:{type:Boolean,default:!1},size:{default:"default"}},setup(e){const{openLayer:t}=Wn(),o=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,l)=>{const r=(0,n.resolveComponent)("j-button"),i=(0,n.resolveComponent)("el-tooltip"),s=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-block",style:(0,n.normalizeStyle)({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[(0,n.createElementVNode)("div",{class:"j-panel",style:(0,n.normalizeStyle)({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",fm,[e.notTitle?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"j-panel-top-left",title:e.title||""},[(0,n.renderSlot)(a.$slots,"title",{},()=>[(0,n.createElementVNode)("span",hm,(0,n.toDisplayString)(e.title||""),1)])],8,pm)),e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("span",gm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.toolBtns,c=>((0,n.openBlock)(),(0,n.createBlock)(i,{key:c.id,placement:"top",content:c.label||""},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(r,(0,n.mergeProps)({ref_for:!0},c.config,{onClick:d=>o(c),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):(0,n.createCommentVNode)("",!0)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"j-panel-body",style:(0,n.normalizeStyle)(e.bodyStyle)},[(0,n.renderSlot)(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",mm,[(0,n.createVNode)(s,{list:e.bootmBtns},null,8,["list"]),(0,n.createVNode)(s,{list:e.bootmRightBtns},null,8,["list"])])):(0,n.createCommentVNode)("",!0)],4)],4)}}}),bm=ym,ms=se(bm),vm={class:"j-input-rows"},wm={key:0,class:"j-input-rows-num"},Cm={key:1,class:"j-input-rows-char"},xm=(0,n.defineComponent)({name:"JInputRows",__name:"input-rows",props:{modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},isCompact:{type:Boolean,default:!1},showNum:{type:Boolean,default:!1},showChar:{type:Boolean,default:!1},isWrap:{type:Boolean,default:!1},id:{type:String,default:""}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=C=>C==null,a=e,l=t,{formData:r}=Qt(),i=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),s=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),c=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),d=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),u=(0,n.computed)(()=>a.editConfig.readonly),p=(0,n.computed)(()=>a.editConfig.drag),f=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)(),g=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],m=(0,n.ref)([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(C=>{C._i||(C._i=Kt())})):(m.value=[],l("update:modelValue",m.value)),(0,n.watch)(()=>a.modelValue,C=>{m.value=a.modelValue||[],m.value=C||[],m.value.forEach(R=>{R._i||(R._i=Kt())})},{deep:!0});const w=()=>{const C={_i:Kt()};a.columns.forEach(R=>{const b=R.config?.valueRowKey||R.id||"";b&&(C[b]=xt(R.config?.defaultValue))}),m.value.push(C),l("change",{id:a.id,value:C,data:C,formData:r,tableData:m.value,type:"add"})},x=C=>{const R=m.value[C];m.value.splice(C,1),l("change",{id:a.id,value:R,data:R,formData:r,tableData:m.value,type:"delete"})},v=C=>{l("rowChange",C)};return(0,n.onMounted)(()=>{if(!p.value||!h.value)return;const C=h.value,{initSortable:R}=ei(C,{handle:".j-input-rows-drag",onEnd:b=>{const{oldIndex:k,newIndex:B}=b;if(o(k)||o(B)||k===B||k<0||B<0)return;const _=m.value.splice(k,1)[0];m.value.splice(B,0,_),l("change",{id:a.id,value:_,data:_,formData:r,tableData:m.value,type:"sort"})}});R()}),go({getTableData:()=>m.value,rowChange:v}),(C,R)=>{const b=(0,n.resolveComponent)("j-comp"),k=(0,n.resolveComponent)("j-icon"),B=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",vm,[(0,n.createElementVNode)("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(m.value,(_,V)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:_._i+V,class:(0,n.normalizeClass)([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?((0,n.openBlock)(),(0,n.createElementBlock)("div",wm,(0,n.toDisplayString)(V+1),1)):(0,n.createCommentVNode)("",!0),e.showChar?((0,n.openBlock)(),(0,n.createElementBlock)("div",Cm,(0,n.toDisplayString)(g[V%26]),1)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,T=>((0,n.openBlock)(),(0,n.createBlock)(b,(0,n.mergeProps)({key:T.id,ref_for:!0},T,{row:_}),null,16,["row"]))),128)),p.value?((0,n.openBlock)(),(0,n.createBlock)(k,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):(0,n.createCommentVNode)("",!0),d.value&&(f.value||m.value.length>1)&&!u.value?((0,n.openBlock)(),(0,n.createBlock)(k,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:T=>x(V)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)],2))),128))],512),!u.value&&i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":c.value}),class:"j-input-rows-actions"},[i.value?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:w},null,8,["label"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)])}}}),km=xm,ys=se(km),Sm={class:"j-input-layer"},Em=(0,n.defineComponent)({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchInputList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=g=>!!(g==null||typeof g=="string"&&g.trim()===""||Array.isArray(g)&&g.length===0),a=e,l=t,r=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.ref)(""),c=(0,n.computed)({get(){return a.modelValue},set(g){l("update:modelValue",g)}}),d=(0,n.computed)({get(){return o(c.value)?"":o(s.value)?a.getText?a.getText(c.value):c.value:s.value},set(g){g||p()}});(0,n.watch)(()=>a.modelValue,()=>{s.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},p=()=>{s.value="",c.value="",l("change",{value:"",data:void 0})},f=async()=>{if(!i.value)return;const g=i.value.getSelection();if(a.isMultiSelect){const m=[],y=[];g.forEach(w=>{const x=w[a.labelKey],v=w[a.valueKey];m.push(x!=null?String(x):""),v===0||v?y.push(String(v)):y.push("")}),s.value=m.join(","),c.value=y.join(","),l("change",{value:y.join(","),data:g})}else if(g.length>0){const m=g[0],y=m[a.labelKey],w=m[a.valueKey];s.value=y!=null?String(y):"";const x=w!=null?String(w):"";c.value=x,l("change",{value:x,data:m})}else s.value="",c.value="",l("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},h=()=>{i.value&&i.value.clearSelection&&i.value.clearSelection()};return(g,m)=>{const y=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Sm,[e.onlyButton?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(Zo),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):((0,n.openBlock)(),(0,n.createBlock)(y,{key:0,modelValue:d.value,"onUpdate:modelValue":m[0]||(m[0]=w=>d.value=w),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:p},(0,n.createSlots)({_:2},[e.readonly?void 0:{name:"append",fn:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(Zo),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),(0,n.createVNode)((0,n.unref)(Cl),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:f,onClosed:h},{default:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(xl),{ref_key:"tableRef",ref:i,columns:e.columns,"row-key":e.valueKey,"is-tree":e.isTree,"is-page":e.isPage,sort:e.sidx,"is-multiple":e.isMultiSelect,"load-data":e.loadLayerData,immediate:!0},null,8,["columns","row-key","is-tree","is-page","sort","is-multiple","load-data"])]),_:1},8,["title","width","height"])])}}}),Bm=Em,bs=se(Bm),Rm=(0,n.defineComponent)({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"default"},size:{type:String,default:"default"},layerLabel:{type:String,default:"设置"},layerHeight:{type:Number,default:400},layerWidth:{type:Number,default:600},formConfig:{type:Object,default:()=>({})},schema:{type:Array,default:()=>[]}},setup(e){const t=e,o=Qt(),{t:a}=Je(),l=(0,n.computed)(()=>t.formConfig?.gutter||16),r=(0,n.computed)(()=>t.formConfig?.span||24),i=(0,n.computed)(()=>t.formConfig?.labelWidth||o.labelWidth?.value),s=(0,n.computed)(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),c=(0,n.computed)(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=(0,n.ref)(!1),u=()=>{d.value=!0};return bl({...o,isAutoWindow:c,gutter:l,span:r,labelWidth:i}),(p,f)=>{const h=(0,n.resolveComponent)("j-button"),g=(0,n.resolveComponent)("j-form-item"),m=(0,n.resolveComponent)("el-row"),y=(0,n.resolveComponent)("el-form"),w=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(h,(0,n.mergeProps)(p.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),(0,n.createVNode)(w,{visible:d.value,"onUpdate:visible":f[1]||(f[1]=x=>d.value=x),title:(0,n.unref)(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(y,{class:(0,n.normalizeClass)(["j-block","j-layer-form"]),"label-position":s.value,"label-width":i.value,size:e.formConfig?.size,onSubmit:f[0]||(f[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[c.value?((0,n.openBlock)(),(0,n.createBlock)(g,(0,n.normalizeProps)((0,n.mergeProps)({key:0},e.schema[0])),null,16)):((0,n.openBlock)(),(0,n.createBlock)(m,{key:1,gutter:l.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.schema,x=>((0,n.openBlock)(),(0,n.createBlock)(g,(0,n.mergeProps)({key:x.id,ref_for:!0},x),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}}),_m=Rm,vs=se(_m),Tm=(0,n.defineComponent)({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.computed)({get(){return o.modelValue},set(i){a("update:modelValue",i)}}),r=i=>{a("change",i)};return(0,n.onMounted)(()=>{o.autoFocus&&!o.readonly&&setTimeout(()=>{const i=l.value===o.activeValue?o.inactiveValue:o.activeValue;l.value=i,r(i)},100)}),(i,s)=>{const c=(0,n.resolveComponent)("el-switch");return(0,n.openBlock)(),(0,n.createBlock)(c,(0,n.mergeProps)(i.$attrs,{id:e.id,modelValue:l.value,"onUpdate:modelValue":s[0]||(s[0]=d=>l.value=d),size:e.size,width:e.width,"inline-prompt":e.inlinePrompt,"active-icon":e.activeIcon,"inactive-icon":e.inactiveIcon,"active-action-icon":e.activeActionIcon,"inactive-action-icon":e.inactiveActionIcon,"active-text":e.activeText,"inactive-text":e.inactiveText,"active-value":e.activeValue,"inactive-value":e.inactiveValue,name:e.name,"validate-event":e.validateEvent,"before-change":e.beforeChange,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:r}),(0,n.createSlots)({_:2},[i.$slots["active-action"]?{name:"active-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"active-action")]),key:"0"}:void 0,i.$slots["inactive-action"]?{name:"inactive-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"inactive-action")]),key:"1"}:void 0,i.$slots.active?{name:"active",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"active")]),key:"2"}:void 0,i.$slots.inactive?{name:"inactive",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}}),Mm=Tm,ws=se(Mm),Vm=(0,n.defineComponent)({name:"JTabs",__name:"tabs",props:{modelValue:{},type:{default:""},closable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},tabPosition:{default:"top"},stretch:{type:Boolean,default:!1},beforeLeave:{},isFill:{type:Boolean}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,a=d=>{o("update:modelValue",d)},l=(d,u)=>{o("tab-click",d,u)},r=d=>{o("tab-change",d)},i=d=>{o("tab-remove",d)},s=()=>{o("tab-add")},c=(d,u)=>{o("edit",d,u)};return(d,u)=>{const p=(0,n.resolveComponent)("el-tabs");return(0,n.openBlock)(),(0,n.createBlock)(p,(0,n.mergeProps)(d.$attrs,{class:{isFill:e.isFill},"model-value":e.modelValue,type:e.type,closable:e.closable,addable:e.addable,editable:e.editable,"tab-position":e.tabPosition,stretch:e.stretch,"before-leave":e.beforeLeave,"onUpdate:modelValue":a,onTabClick:l,onTabChange:r,onTabRemove:i,onTabAdd:s,onEdit:c}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(d.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}}),Nm=Vm,Cs=se(Nm),Am=(0,n.defineComponent)({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=r=>{o("update:modelValue",r)},l=r=>{o("change",r)};return(r,i)=>{const s=(0,n.resolveComponent)("el-collapse");return(0,n.openBlock)(),(0,n.createBlock)(s,(0,n.mergeProps)(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:l,"onUpdate:modelValue":a}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}}),Pm=Am,xs=se(Pm),jm={class:"j-editor"},Om=(0,n.defineComponent)({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.ref)(),r=(0,n.ref)(),i=(0,n.shallowRef)(),s=(0,n.computed)(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let c=!1;const d=p=>{if(!p)return"";let f=p;return o.apiUrl&&o.token&&(f=f.replace(/{learun_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${o.token}`)),f},u=p=>{if(!p)return"";let f=p;if(o.apiUrl){const h=`${o.apiUrl}/system/annexesfile/`;f=f.split(h).join("{learun_img_api}"),o.token&&(f=f.split(`token=${o.token}`).join("{learun_img_token}"))}return f};return(0,n.onMounted)(()=>{const p={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};p.onChange=h=>{if(c)return;const g=u(h.getHtml());a("update:value",g),a("change",{value:g})};const f=(0,Nr.createEditor)({selector:l.value,html:d(o.value),config:p,mode:"default"});i.value=f,(0,Nr.createToolbar)({editor:f,selector:r.value,mode:"default"})}),(0,n.watch)(()=>o.value,p=>{const f=i.value;if(f){const h=f.getHtml(),g=d(p);u(h)!==p&&(c=!0,f.setHtml(g),c=!1)}}),(0,n.watch)(()=>o.readonly,p=>{const f=i.value;f&&(p?f.disable():f.enable())}),(0,n.onBeforeUnmount)(()=>{const p=i.value;p?.destroy()}),(p,f)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",jm,[(0,n.createElementVNode)("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),(0,n.createElementVNode)("div",{ref_key:"editorRef",ref:l,class:"j-editor-content",style:(0,n.normalizeStyle)(s.value)},null,4)]))}}),Im=$i(Om,[["__scopeId","data-v-60cd5d0b"]]),ks=se(Im),zm={key:0,class:"j-map-loading"},Lm=(0,n.defineComponent)({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(!0),i=(0,n.ref)();let s=null,c=null,d=null,u=null;const p=async()=>{r.value=!0;try{s=await ti(a.mapKey)}catch(w){console.error("Failed to load Baidu Map:",w),r.value=!1;return}if(c!=null){h(a.lng,a.lat),r.value=!1;return}if(!i.value)return;c=new s.Map(i.value,{enableMapClick:!1});const y=new s.Point(121.480248,31.236276);c.centerAndZoom(y,17),d=new s.Marker(y,{enableDragging:!0}),c.addOverlay(d),d.addEventListener("dragend",w=>{f(w.point)}),c.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),u=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),u.addEventListener("locationSuccess",w=>{f(w.point)}),u.addEventListener("locationError",w=>{alert(w.message)}),c.addControl(u),c.addEventListener("click",w=>{f(w.point)}),c.enableScrollWheelZoom(!0),h(a.lng,a.lat),r.value=!1},f=y=>{new s.Geocoder().getLocation(y,w=>{d.setPosition(y),c.panTo(y),l("update:address",w.address),l("update:lng",y.lng),l("update:lat",y.lat),l("change",{value:{address:w.address,lng:y.lng,lat:y.lat}})})},h=(y,w)=>{if(y&&w&&s){const x=new s.Point(y,w);d&&d.setPosition(x),c&&c.panTo(x)}};let g=null;return t({setPoint:h,querySearchAsync:(y,w)=>{!c||!s||(g||(g=new s.LocalSearch(c,{onSearchComplete:x=>{const v=[];if(x){const C=x.getCurrentNumPois();for(let R=0;R<C;R++)v.push(x.getPoi(R))}w(v)}})),g.search(y))}}),(0,n.onMounted)(()=>{p()}),(y,w)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-map",style:(0,n.normalizeStyle)({height:e.height})},[r.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",zm,[(0,n.createVNode)(Cn,{icon:"mdi:loading",class:"is-loading",size:30})])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref_key:"mapRef",ref:i,class:"j-map-container"},null,512)],4))}}),Hm=Lm,Dm=se(Hm);function Ss(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Jn(e){return e.originalEvent||e.srcEvent}function kl(e){Ss(e),Ss(Jn(e))}function Yn(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}var Es=1500;function Bs(e,t,o){var a=this,l=o.get("dragging",!1);function r(i){if(!i.hover){var s=i.originalEvent,c=a._findTargetGfx(s),d=c&&e.get(c);c&&d&&(i.stopPropagation(),l.hover({element:d,gfx:c}),l.move(s))}}l&&t.on("drag.start",function(i){t.once("drag.move",Es,function(s){r(s)})}),(function(){var i,s;t.on("element.hover",function(c){i=c.gfx,s=c.element}),t.on("element.hover",Es,function(c){s&&t.fire("element.out",{element:s,gfx:i})}),t.on("element.out",function(){i=null,s=null})})(),this._findTargetGfx=function(i){var s,c;if(i instanceof MouseEvent)return s=Yn(i),c=document.elementFromPoint(s.x,s.y),Fm(c)}}Bs.$inject=["elementRegistry","eventBus","injector"];function Fm(e){return(0,W.closest)(e,"svg, .djs-element",!0)}var $m={__init__:["hoverFix"],hoverFix:["type",Bs]};function Rs(){return/mac/i.test(navigator.platform)}function _s(e,t){return(Jn(e)||e).button===t}function en(e){return _s(e,0)}function Wm(e){return _s(e,1)}function Ts(e){var t=Jn(e)||e;return en(e)?Rs()?t.metaKey:t.ctrlKey:!1}function Sl(e){var t=Jn(e)||e;return en(e)&&t.shiftKey}function yo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Um(e){return["M",e.x,e.y]}function El(e){return["L",e.x,e.y]}function Jm(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function Ym(e,t){const o=e.length,a=[Um(e[0])];for(let l=1;l<o;l++){const r=e[l-1],i=e[l],s=e[l+1];if(!s||!t){a.push(El(i));continue}const c=Math.min(t,Bl(i.x-r.x,i.y-r.y),Bl(s.x-i.x,s.y-i.y));if(!c){a.push(El(i));continue}const d=sa(i,r,c),u=sa(i,r,c*.5),p=sa(i,s,c),f=sa(i,s,c*.5);a.push(El(d)),a.push(Jm(u,f,p))}return a}function sa(e,t,o){const a=t.x-e.x,l=t.y-e.y,r=o/Bl(a,l);return{x:e.x+a*r,y:e.y+l*r}}function Bl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Rl(e,t,o){(0,S.isNumber)(t)&&(o=t,t=null),t||(t={});const a=(0,N.create)("path",t);return(0,S.isNumber)(o)&&(a.dataset.cornerRadius=String(o)),Ms(a,e)}function Ms(e,t){return(0,N.attr)(e,{d:yo(Ym(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function Km(e){return!0}function ca(e){return en(e)||Wm(e)}var Vs=500;function Ns(e,t,o){var a=this;function l(B,_,V){if(!s(B,_)){var T,F,L;V?F=t.getGraphics(V):(T=_.delegateTarget||_.target,T&&(F=T,V=t.get(F))),!(!F||!V)&&(L=e.fire(B,{element:V,gfx:F,originalEvent:_}),L===!1&&(_.stopPropagation(),_.preventDefault()))}}var r={};function i(B){return r[B]}function s(B,_){return!(d[B]||en)(_)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},d={"element.contextmenu":Km,"element.mousedown":ca,"element.mouseup":ca,"element.click":ca,"element.dblclick":ca};function u(B,_,V){var T=c[B];if(!T)throw new Error("unmapped DOM event name <"+B+">");return l(T,_,V)}var p="svg, .djs-element";function f(B,_,V,T){var F=r[V]=function(L){l(V,L)};T&&(d[V]=T),F.$delegate=W.delegate.bind(B,p,_,F)}function h(B,_,V){var T=i(V);T&&W.delegate.unbind(B,_,T.$delegate)}function g(B){(0,S.forEach)(c,function(_,V){f(B,V,_)})}function m(B){(0,S.forEach)(c,function(_,V){h(B,V,_)})}e.on("canvas.destroy",function(B){m(B.svg)}),e.on("canvas.init",function(B){g(B.svg)}),e.on(["shape.added","connection.added"],function(B){var _=B.element,V=B.gfx;e.fire("interactionEvents.createHit",{element:_,gfx:V})}),e.on(["shape.changed","connection.changed"],Vs,function(B){var _=B.element,V=B.gfx;e.fire("interactionEvents.updateHit",{element:_,gfx:V})}),e.on("interactionEvents.createHit",Vs,function(B){var _=B.element,V=B.gfx;a.createDefaultHit(_,V)}),e.on("interactionEvents.updateHit",function(B){var _=B.element,V=B.gfx;a.updateDefaultHit(_,V)});var y=R("djs-hit djs-hit-stroke"),w=R("djs-hit djs-hit-click-stroke"),x=R("djs-hit djs-hit-all"),v=R("djs-hit djs-hit-no-move"),C={all:x,"click-stroke":w,stroke:y,"no-move":v};function R(B,_){return _=(0,S.assign)({stroke:"white",strokeWidth:15},_||{}),o.cls(B,["no-fill","no-border"],_)}function b(B,_){var V=C[_];if(!V)throw new Error("invalid hit type <"+_+">");return(0,N.attr)(B,V),B}function k(B,_){(0,N.append)(B,_)}this.removeHits=function(B){(0,S.forEach)((0,W.queryAll)(".djs-hit",B),N.remove)},this.createDefaultHit=function(B,_){var V=B.waypoints,T=B.isFrame,F;return V?this.createWaypointsHit(_,V):(F=T?"stroke":"all",this.createBoxHit(_,F,{width:B.width,height:B.height}))},this.createWaypointsHit=function(B,_){var V=Rl(_);return b(V,"stroke"),k(B,V),V},this.createBoxHit=function(B,_,V){V=(0,S.assign)({x:0,y:0},V);var T=(0,N.create)("rect");return b(T,_),(0,N.attr)(T,V),k(B,T),T},this.updateDefaultHit=function(B,_){var V=(0,W.query)(".djs-hit",_);if(V)return B.waypoints?Ms(V,B.waypoints):(0,N.attr)(V,{width:B.width,height:B.height}),V},this.fire=l,this.triggerMouseEvent=u,this.mouseHandler=i,this.registerEvent=f,this.unregisterEvent=h}Ns.$inject=["eventBus","elementRegistry","styles"];var _l={__init__:["interactionEvents"],interactionEvents:["type",Ns]};function Kn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var l=a.element;o.deselect(l)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}Kn.$inject=["eventBus","canvas"],Kn.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},Kn.prototype.get=function(){return this._selectedElements},Kn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},Kn.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();(0,S.isArray)(e)||(e=e?[e]:[]);var l=this._canvas,r=l.getRootElement();e=e.filter(function(i){return r===l.findRoot(i)}),t?(0,S.forEach)(e,function(i){o.indexOf(i)===-1&&o.push(i)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var As="hover",Ps="selected";function js(e,t){this._canvas=e;function o(l,r){e.addMarker(l,r)}function a(l,r){e.removeMarker(l,r)}t.on("element.hover",function(l){o(l.element,As)}),t.on("element.out",function(l){a(l.element,As)}),t.on("selection.changed",function(l){function r(d){a(d,Ps)}function i(d){o(d,Ps)}var s=l.oldSelection,c=l.newSelection;(0,S.forEach)(s,function(d){c.indexOf(d)===-1&&r(d)}),(0,S.forEach)(c,function(d){s.indexOf(d)===-1&&i(d)})})}js.$inject=["canvas","eventBus"];function Os(e,t,o,a){e.on("create.end",500,function(l){var r=l.context,i=r.canExecute,s=r.elements,c=(r.hints||{}).autoSelect;if(i){if(c===!1)return;(0,S.isArray)(c)?t.select(c):t.select(s.filter(Gm))}}),e.on("connect.end",500,function(l){var r=l.context.connection;r&&t.select(r)}),e.on("shape.move.end",500,function(l){var r=l.previousSelection||[],i=a.get(l.context.shape.id);(0,S.find)(r,function(s){return i.id===s.id})||t.select(i)}),e.on("element.click",function(l){if(en(l)){var r=l.element;r===o.getRootElement()&&(r=null);var i=t.isSelected(r),s=t.get().length>1,c=Sl(l);if(i&&s)return c?t.deselect(r):t.select(r);i?t.deselect(r):t.select(r,c)}})}Os.$inject=["eventBus","selection","canvas","elementRegistry"];function Gm(e){return!e.hidden}var Gn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[_l],selection:["type",Kn],selectionVisuals:["type",js],selectionBehavior:["type",Os]},qm=/^djs-cursor-.*$/;function Tl(e){var t=(0,W.classes)(document.body);t.removeMatching(qm),e&&t.add("djs-cursor-"+e)}function Is(){Tl(null)}var Xm=5e3;function zs(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Xm,o),function(){e.off(t,o)}}function Ls(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function qn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hs(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ds(e,t){return e=(0,S.isArray)(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var Xn=Math.round,Fs="djs-drag-active";function xn(e){e.preventDefault()}function Zm(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Qm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $s(e,t,o,a){var l={threshold:5,trapClick:!0},r;function i(v){var C=t.viewbox(),R=t._container.getBoundingClientRect();return{x:C.x+(v.x-R.left)/C.scale,y:C.y+(v.y-R.top)/C.scale}}function s(v,C){C=C||r;var R=e.createEvent((0,S.assign)({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+v,R)===!1?!1:e.fire(C.prefix+"."+v,R)}function c(v){var C=v.filter(function(R){return a.get(R.id)});C.length&&o.select(C)}function d(v,C){var R=r.payload,b=r.displacement,k=r.globalStart,B=Yn(v),_=qn(B,k),V=r.localStart,T=i(B),F=qn(T,V);if(!r.active&&(C||Qm(_)>r.threshold)){if((0,S.assign)(R,{x:Xn(V.x+b.x),y:Xn(V.y+b.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(R.previousSelection=o.get(),o.select(null)),r.cursor&&Tl(r.cursor),t.addMarker(t.getRootElement(),Fs)}kl(v),r.active&&((0,S.assign)(R,{x:Xn(T.x+b.x),y:Xn(T.y+b.y),dx:Xn(F.x),dy:Xn(F.y)},{originalEvent:v}),s("move"))}function u(v){var C,R=!0;r.active&&(v&&(r.payload.originalEvent=v,kl(v)),R=s("end")),R===!1&&s("rejected"),C=w(R!==!0),s("ended",C)}function p(v){Ds("Escape",v)&&(xn(v),y())}function f(v){var C;r.active&&(C=zs(e),setTimeout(C,400),xn(v)),u(v)}function h(v){d(v)}function g(v){var C=r.payload;C.hoverGfx=v.gfx,C.hover=v.element,s("hover")}function m(v){s("out");var C=r.payload;C.hoverGfx=null,C.hover=null}function y(v){var C;if(r){var R=r.active;R&&s("cancel"),C=w(v),R&&s("canceled",C)}}function w(v){var C,R;s("cleanup"),Is(),r.trapClick?R=f:R=u,W.event.unbind(document,"mousemove",d),W.event.unbind(document,"dragstart",xn),W.event.unbind(document,"selectstart",xn),W.event.unbind(document,"mousedown",R,!0),W.event.unbind(document,"mouseup",R,!0),W.event.unbind(document,"keyup",p),W.event.unbind(document,"touchstart",h,!0),W.event.unbind(document,"touchcancel",y,!0),W.event.unbind(document,"touchmove",d,!0),W.event.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",m),t.removeMarker(t.getRootElement(),Fs);var b=r.payload.previousSelection;return v!==!1&&b&&!o.get().length&&c(b),C=r,r=null,C}function x(v,C,R,b){r&&y(!1),typeof C=="string"&&(b=R,R=C,C=null),b=(0,S.assign)({},l,b||{});var k=b.data||{},B,_,V,T,F;b.trapClick?T=f:T=u,v?(B=Jn(v)||v,_=Yn(v),kl(v),B.type==="dragstart"&&xn(B)):(B=null,_={x:0,y:0}),V=i(_),C||(C=V),F=Zm(B),r=(0,S.assign)({prefix:R,data:k,payload:{},globalStart:_,displacement:qn(C,V),localStart:V,isTouch:F},b),b.manual||(F?(W.event.bind(document,"touchstart",h,!0),W.event.bind(document,"touchcancel",y,!0),W.event.bind(document,"touchmove",d,!0),W.event.bind(document,"touchend",u,!0)):(W.event.bind(document,"mousemove",d),W.event.bind(document,"dragstart",xn),W.event.bind(document,"selectstart",xn),W.event.bind(document,"mousedown",T,!0),W.event.bind(document,"mouseup",T,!0)),W.event.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",m)),s("init"),b.autoActivate&&d(v,!0)}e.on("diagram.destroy",y),this.init=x,this.move=d,this.hover=g,this.out=m,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){(0,S.assign)(l,v)}}$s.$inject=["eventBus","canvas","selection","elementRegistry"];var kn={__depends__:[$m,Gn],dragging:["type",$s]};function Ml(e){return e.childNodes[0]}function da(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}da.prototype.next=function(){return this._prefix+ ++this._counter};var ey=new da("ps"),ty=["marker-start","marker-mid","marker-end"],ny=["circle","ellipse","line","path","polygon","polyline","path","rect"];function tn(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}tn.$inject=["elementRegistry","eventBus","canvas","styles"],tn.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},tn.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},tn.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var l=(0,N.clone)(o),r=o.getBoundingClientRect();return this._cloneMarkers(Ml(l),a),(0,N.attr)(l,this._styles.cls(a,[],{x:r.top,y:r.left})),(0,N.append)(t,l),(0,N.attr)(l,"data-preview-support-element-id",e.id),l},tn.prototype.addFrame=function(e,t){var o=(0,N.create)("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return(0,N.append)(t,o),(0,N.attr)(o,"data-preview-support-element-id",e.id),o},tn.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(l=>{a._cloneMarkers(l,t,o)}),ry(e)&&ty.forEach(function(l){if((0,N.attr)(e,l)){var r=oy(e,l,a._canvas.getContainer());r&&a._cloneMarker(o,e,r,l,t)}})},tn.prototype._cloneMarker=function(e,t,o,a,l="djs-dragger"){var r=[o.id,l,ey.next()].join("-"),i=(0,W.query)("marker#"+o.id,e);e=e||this._canvas._svg;var s=i||(0,N.clone)(o);s.id=r,(0,N.classes)(s).add(l);var c=(0,W.query)(":scope > defs",e);c||(c=(0,N.create)("defs"),(0,N.append)(e,c)),(0,N.append)(c,s),(0,N.attr)(t,a,ly(s.id))};function oy(e,t,o){return(0,W.query)("marker#"+ay((0,N.attr)(e,t)),o||document)}function ay(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function ly(e){return"url(#"+e+")"}function ry(e){return ny.indexOf(e.nodeName)!==-1}var Vl={__init__:["previewSupport"],previewSupport:["type",tn]};function Nl(e){this._commandStack=e.get("commandStack",!1)}Nl.$inject=["injector"],Nl.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};var Zn={__init__:["rules"],rules:["type",Nl]};function iy(e){return(0,S.filter)(e,function(t){return!(0,S.find)(e,function(o){return o!==t&&Ws(t,o)})})}function Ws(e,t){if(t){if(e===t)return t;if(e.parent)return Ws(e.parent,t)}}function Us(e,t,o){var a=!o||e.indexOf(t)===-1;return a&&e.push(t),a}function Al(e,t,o){o=o||0,(0,S.isArray)(e)||(e=[e]),(0,S.forEach)(e,function(a,l){var r=t(a,l,o);(0,S.isArray)(r)&&r.length&&Al(r,t,o+1)})}function sy(e,t,o){var a=[],l=[];return Al(e,function(r,i,s){Us(a,r,t);var c=r.children;if((o===-1||s<o)&&c&&Us(l,c,t))return c}),a}function cy(e,t){return sy(e,!t,-1)}function dy(e,t,o){(0,S.isUndefined)(t)&&(t=!0),(0,S.isObject)(t)&&(o=t,t=!0),o=o||{};var a=bo(o.allShapes),l=bo(o.allConnections),r=bo(o.enclosedElements),i=bo(o.enclosedConnections),s=bo(o.topLevel,t&&(0,S.groupBy)(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),a[u.source.id]&&a[u.target.id]&&(i[u.id]=r[u.id]=u),l[u.id]=u}function d(u){if(r[u.id]=u,u.waypoints)i[u.id]=l[u.id]=u;else return a[u.id]=u,(0,S.forEach)(u.incoming,c),(0,S.forEach)(u.outgoing,c),u.children}return Al(e,d),{allShapes:a,allConnections:l,topLevel:s,enclosedConnections:i,enclosedElements:r}}function It(e,t){t=!!t,(0,S.isArray)(e)||(e=[e]);var o,a,l,r;return(0,S.forEach)(e,function(i){var s=i;i.waypoints&&!t&&(s=It(i.waypoints,!0));var c=s.x,d=s.y,u=s.height||0,p=s.width||0;(c<o||o===void 0)&&(o=c),(d<a||a===void 0)&&(a=d),(c+p>l||l===void 0)&&(l=c+p),(d+u>r||r===void 0)&&(r=d+u)}),{x:o,y:a,height:r-a,width:l-o}}function uy(e,t){var o={};return(0,S.forEach)(e,function(a){var l=a;l.waypoints&&(l=It(l)),!(0,S.isNumber)(t.y)&&l.x>t.x&&(o[a.id]=a),!(0,S.isNumber)(t.x)&&l.y>t.y&&(o[a.id]=a),l.x>t.x&&l.y>t.y&&((0,S.isNumber)(t.width)&&(0,S.isNumber)(t.height)&&l.width+l.x<t.width+t.x&&l.height+l.y<t.height+t.y||!(0,S.isNumber)(t.width)||!(0,S.isNumber)(t.height))&&(o[a.id]=a)}),o}function fy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function py(e){return!!(e&&e.isFrame)}function bo(e,t){return(0,S.assign)({},e||{},t||{})}function vt(e){return(0,S.isObject)(e)&&(0,S.has)(e,"waypoints")}function Qn(e){return(0,S.isObject)(e)&&(0,S.has)(e,"labelTarget")}var hy="drop-ok",Js="drop-not-ok",Ys="attach-ok",Ks="new-parent",Gs="create",gy=2e3;function qs(e,t,o,a,l){function r(c,d,u,p,f){if(!d)return!1;c=(0,S.filter)(c,function(x){var v=x.labelTarget;return!x.parent&&!(Qn(x)&&c.indexOf(v)!==-1)});var h=(0,S.find)(c,function(x){return!vt(x)}),g=!1,m=!1,y=!1;Zs(c)&&(g=l.allowed("shape.attach",{position:u,shape:h,target:d})),g||(Zs(c)?y=l.allowed("shape.create",{position:u,shape:h,source:p,target:d}):y=l.allowed("elements.create",{elements:c,position:u,target:d}));var w=f.connectionTarget;return y||g?(h&&p&&(m=l.allowed("connection.create",{source:w===p?h:p,target:w===p?p:h,hints:{targetParent:d,targetAttach:g}})),{attach:g,connect:m}):y===null||g===null?null:!1}function i(c,d){[Ys,hy,Js,Ks].forEach(function(u){u===d?e.addMarker(c,u):e.removeMarker(c,u)})}o.on(["create.move","create.hover"],function(c){var d=c.context,u=d.elements,p=c.hover,f=d.source,h=d.hints||{};if(!p){d.canExecute=!1,d.target=null;return}Xs(c);var g={x:c.x,y:c.y},m=d.canExecute=p&&r(u,p,g,f,h);p&&m!==null&&(d.target=p,m&&m.attach?i(p,Ys):i(p,m?Ks:Js))}),o.on(["create.end","create.out","create.cleanup"],function(c){var d=c.hover;d&&i(d,null)}),o.on("create.end",function(c){var d=c.context,u=d.source,p=d.shape,f=d.elements,h=d.target,g=d.canExecute,m=g&&g.attach,y=g&&g.connect,w=d.hints||{};if(g===!1||!h)return!1;Xs(c);var x={x:c.x,y:c.y};y?p=a.appendShape(u,p,x,h,{attach:m,connection:y===!0?{}:y,connectionTarget:w.connectionTarget}):(f=a.createElements(f,x,h,(0,S.assign)({},w,{attach:m})),p=(0,S.find)(f,function(v){return!vt(v)})),(0,S.assign)(d,{elements:f,shape:p}),(0,S.assign)(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Gs&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",s),o.once(["create.cancel","create.end"],gy,function(){o.off("elements.changed",s)})}),this.start=function(c,d,u){(0,S.isArray)(d)||(d=[d]);var p=(0,S.find)(d,function(h){return!vt(h)});if(p){u=(0,S.assign)({elements:d,hints:{},shape:p},u||{}),(0,S.forEach)(d,function(h){(0,S.isNumber)(h.x)||(h.x=0),(0,S.isNumber)(h.y)||(h.y=0)});var f=It((0,S.filter)(d,function(h){return!h.hidden}));(0,S.forEach)(d,function(h){vt(h)&&(h.waypoints=(0,S.map)(h.waypoints,function(g){return{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2}})),(0,S.assign)(h,{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2})}),t.init(c,Gs,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:d,context:u}})}}}qs.$inject=["canvas","dragging","eventBus","modeling","rules"];function Xs(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function Zs(e){return e&&e.length===1&&!vt(e[0])}function my(e,t,o,a,l){var r=(0,N.createTransform)();r.setTranslate(t,o);var i=(0,N.createTransform)();i.setRotate(a||0,0,0);var s=(0,N.createTransform)();s.setScale(l||1,l||1),(0,N.transform)(e,[r,i,s])}function zt(e,t,o){var a=(0,N.createTransform)();a.setTranslate(t,o),(0,N.transform)(e,a)}function yy(e,t){var o=(0,N.createTransform)();o.setRotate(t,0,0),(0,N.transform)(e,o)}var by=750;function Qs(e,t,o,a,l){function r(i){var s=(0,N.create)("g");(0,N.attr)(s,l.cls("djs-drag-group",["no-events"]));var c=(0,N.create)("g");return i.forEach(function(d){var u;d.hidden||(d.waypoints?(u=o._createContainer("connection",c),o.drawConnection(Ml(u),d)):(u=o._createContainer("shape",c),o.drawShape(Ml(u),d),zt(u,d.x,d.y)),a.addDragger(d,s,u))}),s}t.on("create.move",by,function(i){var s=i.hover,c=i.context,d=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(d));var p;s?(u.parentNode||(p=e.getActiveLayer(),(0,N.append)(p,u)),zt(u,i.x,i.y)):(0,N.remove)(u)}),t.on("create.cleanup",function(i){var s=i.context.dragGroup;s&&(0,N.remove)(s)})}Qs.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var ec={__depends__:[kn,Vl,Zn,Gn],__init__:["create","createPreview"],create:["type",qs],createPreview:["type",Qs]};function vo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pl(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var l=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),r=vo(e,t);return Math.abs(l/r)<=a}var vy=2;function nn(e,t){var o=Array.from(arguments).flat();for(const[a,l]of Object.entries({x:"v",y:"h"}))if(wy(a,o))return l;return!1}function wy(e,t){const o=t[0];return(0,S.every)(t,function(a){return Math.abs(o[e]-a[e])<=vy})}function tc(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function jl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Cy=/,?([a-z]),?/gi,nc=parseFloat,Qe=Math,on=Qe.PI,Lt=Qe.min,Ht=Qe.max,oc=Qe.pow,an=Qe.abs,xy=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,ky=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,ac=Array.isArray||function(e){return e instanceof Array};function Sy(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ey(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function By(e){function t(){var o=Array.prototype.slice.call(arguments,0).join("␀"),a=t.cache=t.cache||{},l=t.count=t.count||[];return Sy(a,o)?(Ey(l,o),a[o]):(l.length>=1e3&&delete a[l.shift()],l.push(o),a[o]=e(...arguments),a[o])}return t}function Ry(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(e).replace(xy,function(a,l,r){var i=[],s=l.toLowerCase();for(r.replace(ky,function(c,d){d&&i.push(+d)}),s=="m"&&i.length>2&&(o.push([l,...i.splice(0,2)]),s="l",l=l=="m"?"l":"L");i.length>=t[s]&&(o.push([l,...i.splice(0,t[s])]),!!t[s]););}),o.toString=Il,o}function _y(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function Ty(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Ol(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function Il(){return this.join(",").replace(Cy,"$1")}function My(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var l=e[o],r=t[o]=new Array(l.length),i=0,s=l.length;i<s;i++)r[i]=l[i];return t.toString=Il,t}function lc(e,t,o,a,l,r,i,s,c){var d=1-c,u=oc(d,3),p=oc(d,2),f=c*c*c,h=u*e+p*3*c*o+d*3*c*c*l+f*i,g=u*t+p*3*c*a+d*3*c*c*r+f*s;return{x:ua(h),y:ua(g)}}function rc(e){var t=Oy(...e);return Ol(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ln(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function Vy(e,t){return e=Ol(e),t=Ol(t),ln(t,e.x,e.y)||ln(t,e.x2,e.y)||ln(t,e.x,e.y2)||ln(t,e.x2,e.y2)||ln(e,t.x,t.y)||ln(e,t.x2,t.y)||ln(e,t.x,t.y2)||ln(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function ic(e,t,o,a,l){return e*(e*(-3*t+9*o-9*a+3*l)+6*t-12*o+6*a)-3*t+3*o}function sc(e,t,o,a,l,r,i,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var d=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,g=0;g<u;g++){var m=d*p[g]+d,y=ic(m,e,o,l,i),w=ic(m,t,a,r,s),x=y*y+w*w;h+=f[g]*Qe.sqrt(x)}return d*h}function Ny(e,t,o,a,l,r,i,s){if(!(Ht(e,o)<Lt(l,i)||Lt(e,o)>Ht(l,i)||Ht(t,a)<Lt(r,s)||Lt(t,a)>Ht(r,s))){var c=(e*a-t*o)*(l-i)-(e-o)*(l*s-r*i),d=(e*a-t*o)*(r-s)-(t-a)*(l*s-r*i),u=(e-o)*(r-s)-(t-a)*(l-i);if(u){var p=ua(c/u),f=ua(d/u),h=+p.toFixed(2),g=+f.toFixed(2);if(!(h<+Lt(e,o).toFixed(2)||h>+Ht(e,o).toFixed(2)||h<+Lt(l,i).toFixed(2)||h>+Ht(l,i).toFixed(2)||g<+Lt(t,a).toFixed(2)||g>+Ht(t,a).toFixed(2)||g<+Lt(r,s).toFixed(2)||g>+Ht(r,s).toFixed(2)))return{x:p,y:f}}}}function ua(e){return Math.round(e*1e11)/1e11}function Ay(e,t,o){if(!Vy(rc(e),rc(t)))return o?0:[];var a=sc(...e),l=sc(...t),r=dc(e)?1:~~(a/5)||1,i=dc(t)?1:~~(l/5)||1,s=new Array(r+1),c=new Array(i+1),d={},u=o?0:[],p,f;for(p=0;p<r+1;p++){var h=lc(...e,p/r);s[p]={x:h.x,y:h.y,t:p/r}}for(p=0;p<i+1;p++)h=lc(...t,p/i),c[p]={x:h.x,y:h.y,t:p/i};for(p=0;p<r;p++)for(f=0;f<i;f++){var g=s[p],m=s[p+1],y=c[f],w=c[f+1],x=an(m.x-g.x)<.01?"y":"x",v=an(w.x-y.x)<.01?"y":"x",C=Ny(g.x,g.y,m.x,m.y,y.x,y.y,w.x,w.y),R;if(C){if(R=C.x.toFixed(9)+"#"+C.y.toFixed(9),d[R])continue;d[R]=!0;var b=g.t+an((C[x]-g[x])/(m[x]-g[x]))*(m.t-g.t),k=y.t+an((C[v]-y[v])/(w[v]-y[v]))*(w.t-y.t);b>=0&&b<=1&&k>=0&&k<=1&&(o?u++:u.push({x:C.x,y:C.y,t1:b,t2:k}))}}return u}function cc(e,t,o){e=pc(e),t=pc(t);for(var a,l,r,i,s,c,d,u,p,f,h=o?0:[],g=0,m=e.length;g<m;g++){var y=e[g];if(y[0]=="M")a=s=y[1],l=c=y[2];else{y[0]=="C"?(p=[a,l,...y.slice(1)],a=p[6],l=p[7]):(p=[a,l,a,l,s,c,s,c],a=s,l=c);for(var w=0,x=t.length;w<x;w++){var v=t[w];if(v[0]=="M")r=d=v[1],i=u=v[2];else{v[0]=="C"?(f=[r,i,...v.slice(1)],r=f[6],i=f[7]):(f=[r,i,r,i,d,u,d,u],r=d,i=u);var C=Ay(p,f,o);if(o)h+=C;else{for(var R=0,b=C.length;R<b;R++)C[R].segment1=g,C[R].segment2=w,C[R].bez1=p,C[R].bez2=f;h=h.concat(C)}}}}}return h}function Py(e){return ac(e)&&ac(e[0])}function jy(e){if(_y(e))return e;var t=new Array(e.length),o=0,a=0,l=0,r=0,i=0,s;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],l=o,r=a,i++,t[0]=["M",o,a]);for(var c,d,u=i,p=e.length;u<p;u++){if(d=e[u],s=d[0],t[u]=c=new Array(d.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=+d[6]+o,c[7]=+d[7]+a;break;case"V":c[1]=+d[1]+a;break;case"H":c[1]=+d[1]+o;break;case"M":l=+d[1]+o,r=+d[2]+a;default:for(var f=1,h=d.length;f<h;f++)c[f]=+d[f]+(f%2?o:a)}else for(var g=0,m=d.length;g<m;g++)c[g]=d[g];switch(s=s.toUpperCase(),c[0]){case"Z":o=+l,a=+r;break;case"H":o=c[1];break;case"V":a=c[1];break;case"M":l=c[c.length-2],r=c[c.length-1];default:o=c[c.length-2],a=c[c.length-1]}}return t.toString=Il,t}function dc(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function fa(e,t,o,a){return[e,t,o,a,o,a]}function uc(e,t,o,a,l,r){var i=.3333333333333333,s=2/3;return[i*e+s*o,i*t+s*a,i*l+s*o,i*r+s*a,l,r]}function fc(e,t,o,a,l,r,i,s,c,d){var u=on*120/180,p=on/180*(+l||0),f=[],h,g=By(function(de,ve,Te){return{x:de*Qe.cos(Te)-ve*Qe.sin(Te),y:de*Qe.sin(Te)+ve*Qe.cos(Te)}});if(d)k=d[0],B=d[1],R=d[2],b=d[3];else{h=g(e,t,-p),e=h.x,t=h.y,h=g(s,c,-p),s=h.x,c=h.y;var m=(e-s)/2,y=(t-c)/2,w=m*m/(o*o)+y*y/(a*a);w>1&&(w=Qe.sqrt(w),o=w*o,a=w*a);var x=o*o,v=a*a,C=(r==i?-1:1)*Qe.sqrt(an((x*v-x*y*y-v*m*m)/(x*y*y+v*m*m))),R=C*o*y/a+(e+s)/2,b=C*-a*m/o+(t+c)/2,k=Qe.asin(((t-b)/a).toFixed(9)),B=Qe.asin(((c-b)/a).toFixed(9));k=e<R?on-k:k,B=s<R?on-B:B,k<0&&(k=on*2+k),B<0&&(B=on*2+B),i&&k>B&&(k=k-on*2),!i&&B>k&&(B=B-on*2)}var _=B-k;if(an(_)>u){var V=B,T=s,F=c;B=k+u*(i&&B>k?1:-1),s=R+o*Qe.cos(B),c=b+a*Qe.sin(B),f=fc(s,c,o,a,l,0,i,T,F,[B,V,R,b])}_=B-k;var L=Qe.cos(k),D=Qe.sin(k),M=Qe.cos(B),E=Qe.sin(B),I=Qe.tan(_/4),$=4/3*o*I,Q=4/3*a*I,ue=[e,t],xe=[e+$*D,t-Q*L],_e=[s+$*E,c-Q*M],Y=[s,c];if(xe[0]=2*ue[0]-xe[0],xe[1]=2*ue[1]-xe[1],d)return[xe,_e,Y].concat(f);f=[xe,_e,Y].concat(f).join().split(",");for(var z=[],ie=0,fe=f.length;ie<fe;ie++)z[ie]=ie%2?g(f[ie-1],f[ie],p).y:g(f[ie],f[ie+1],p).x;return z}function Oy(e,t,o,a,l,r,i,s){for(var c=[],d=[[],[]],u,p,f,h,g,m,y,w,x=0;x<2;++x){if(x==0?(p=6*e-12*o+6*l,u=-3*e+9*o-9*l+3*i,f=3*o-3*e):(p=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*s,f=3*a-3*t),an(u)<1e-12){if(an(p)<1e-12)continue;h=-f/p,0<h&&h<1&&c.push(h);continue}y=p*p-4*f*u,w=Qe.sqrt(y),!(y<0)&&(g=(-p+w)/(2*u),0<g&&g<1&&c.push(g),m=(-p-w)/(2*u),0<m&&m<1&&c.push(m))}for(var v=c.length,C=v,R;v--;)h=c[v],R=1-h,d[0][v]=R*R*R*e+3*R*R*h*o+3*R*h*h*l+h*h*h*i,d[1][v]=R*R*R*t+3*R*R*h*a+3*R*h*h*r+h*h*h*s;return d[0][C]=e,d[1][C]=t,d[0][C+1]=i,d[1][C+1]=s,d[0].length=d[1].length=C+2,{x0:Lt(...d[0]),y0:Lt(...d[1]),x1:Ht(...d[0]),y1:Ht(...d[1])}}function pc(e){if(Py(e)||(e=Ry(e)),Ty(e))return e;for(var t=My(jy(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(f,h,g){var m,y;if(!f)return["C",h.x,h.y,h.x,h.y,h.x,h.y];switch(!(f[0]in{T:1,Q:1})&&(h.qx=h.qy=null),f[0]){case"M":h.X=f[1],h.Y=f[2];break;case"A":f=["C",...fc(h.x,h.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(m=h.x*2-h.bx,y=h.y*2-h.by):(m=h.x,y=h.y),f=["C",m,y,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(h.qx=h.x*2-h.qx,h.qy=h.y*2-h.qy):(h.qx=h.x,h.qy=h.y),f=["C",...uc(h.x,h.y,h.qx,h.qy,f[1],f[2])];break;case"Q":h.qx=f[1],h.qy=f[2],f=["C",...uc(h.x,h.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...fa(h.x,h.y,f[1],f[2])];break;case"H":f=["C",...fa(h.x,h.y,f[1],h.y)];break;case"V":f=["C",...fa(h.x,h.y,h.x,f[1])];break;case"Z":f=["C",...fa(h.x,h.y,h.X,h.Y)];break}return f},l=function(f,h){if(f[h].length>7){f[h].shift();for(var g=f[h];g.length;)r[h]="A",f.splice(h++,0,["C",...g.splice(0,6)]);f.splice(h,1),d=t.length}},r=[],i="",s="",c=0,d=t.length;c<d;c++){t[c]&&(i=t[c][0]),i!="C"&&(r[c]=i,c&&(s=r[c-1])),t[c]=a(t[c],o,s),r[c]!="A"&&i=="C"&&(r[c]="C"),l(t,c);var u=t[c],p=u.length;o.x=u[p-2],o.y=u[p-1],o.bx=nc(u[p-4])||o.x,o.by=nc(u[p-3])||o.y}return t}function Iy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function wo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Oe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function hc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function zy(e){return wo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Ly(e){for(var t=e.waypoints,o=t.reduce(function(s,c,d){var u=t[d-1];if(u){var p=s[s.length-1],f=p&&p.endLength||0,h=Fy(u,c);s.push({start:u,end:c,startLength:f,endLength:f+h,length:h})}return s},[]),a=o.reduce(function(s,c){return s+c.length},0)/2,l=0,r=o[l];r.endLength<a;)r=o[++l];var i=(a-r.startLength)/r.length;return{x:r.start.x+(r.end.x-r.start.x)*i,y:r.start.y+(r.end.y-r.start.y)*i}}function qe(e){return vt(e)?Ly(e):zy(e)}function rn(e,t,o){o=o||0,(0,S.isObject)(o)||(o={x:o,y:o});var a=Oe(e),l=Oe(t),r=a.bottom+o.y<=l.top,i=a.left-o.x>=l.right,s=a.top-o.y>=l.bottom,c=a.right+o.x<=l.left,d=r?"top":s?"bottom":null,u=c?"left":i?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function zl(e,t,o){var a=Hy(e,t);return a.length===1||a.length===2&&vo(a[0],a[1])<1?wo(a[0]):a.length>1?(a=(0,S.sortBy)(a,function(l){var r=Math.floor(l.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,l.segment2+"#"+r}),wo(a[o?0:a.length-1])):null}function Hy(e,t){return cc(e,t)}function Dy(e){e=e.slice();for(var t=0,o,a,l;e[t];)o=e[t],a=e[t-1],l=e[t+1],vo(o,l)===0||Pl(a,l,o)?e.splice(t,1):t++;return e}function Fy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gc(e,t,o,a){function l(i,s){return a.allowed("connection.create",{source:i,target:s})}function r(i,s){return l(s,i)}e.on("connect.hover",function(i){var s=i.context,c=s.start,d=i.hover,u;if(s.hover=d,u=s.canExecute=l(c,d),!(0,S.isNil)(u)){if(u!==!1){s.source=c,s.target=d;return}u=s.canExecute=r(c,d),!(0,S.isNil)(u)&&u!==!1&&(s.source=d,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(i){var s=i.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(i){var s=i.context,c=s.canExecute,d=s.connectionStart,u={x:i.x,y:i.y},p=s.source,f=s.target;if(!c)return!1;var h=null,g={connectionStart:Ll(s)?u:d,connectionEnd:Ll(s)?d:u};(0,S.isObject)(c)&&(h=c),s.connection=o.connect(p,f,h,g)}),this.start=function(i,s,c,d){(0,S.isObject)(c)||(d=c,c=qe(s)),t.init(i,"connect",{autoActivate:d,data:{shape:s,context:{start:s,connectionStart:c}}})}}gc.$inject=["eventBus","dragging","modeling","rules"];function Ll(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var $y=1100,Wy=900,mc="connect-ok",yc="connect-not-ok";function bc(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(l){var r=l.context,i=r.canExecute,s=r.hover,c=r.source,d=r.start,u=r.startPosition,p=r.target,f=r.connectionStart||u,h=r.connectionEnd||{x:l.x,y:l.y},g=f,m=h;Ll(r)&&(g=h,m=f),a.drawPreview(r,i,{source:c||d,target:p||s,connectionStart:g,connectionEnd:m})}),t.on("connect.hover",Wy,function(l){var r=l.context,i=l.hover,s=r.canExecute;s!==null&&o.addMarker(i,s?mc:yc)}),t.on(["connect.out","connect.cleanup"],$y,function(l){var r=l.hover;r&&(o.removeMarker(r,mc),o.removeMarker(r,yc))}),a&&t.on("connect.cleanup",function(l){a.cleanUp(l.context)})}bc.$inject=["injector","eventBus","canvas"];var Hl={__depends__:[Gn,Zn,kn],__init__:["connectPreview"],connect:["type",gc],connectPreview:["type",bc]},Uy=15;function vc(e,t){var o;function a(s){return i(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function l(s){var c=o.start,d=o.button,u=Yn(s),p=qn(u,c);!o.dragging&&Jy(p)>Uy&&(o.dragging=!0,d===0&&zs(e),Tl("grab")),o.dragging&&(p=qn(u,o.last||o.start),t.scroll({dx:p.x,dy:p.y}),o.last=u),s.preventDefault()}function r(s){W.event.unbind(document,"mousemove",l),W.event.unbind(document,"mouseup",r),o=null,Is()}function i(s){if(!(0,W.closest)(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:c,start:Yn(s)},W.event.bind(document,"mousemove",l),W.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!o}}vc.$inject=["eventBus","canvas"];function Jy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var wc={__init__:["moveCanvas"],moveCanvas:["type",vc]};function Dl(e){return Math.log(e)/Math.log(10)}function Cc(e,t){var o=Dl(e.min),a=Dl(e.max);return(Math.abs(o)+Math.abs(a))/t}function Yy(e,t){return Math.max(e.min,Math.min(e.max,t))}var Ky=Math.sign||function(e){return e>=0?1:-1},Fl={min:.2,max:4},xc=10,Gy=.1,qy=.75;function Dt(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=(0,S.bind)(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||qy;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}Dt.$inject=["config.zoomScroll","eventBus","canvas"],Dt.prototype.scroll=function(t){this._canvas.scroll(t)},Dt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Dt.prototype.zoom=function(t,o){var a=Cc(Fl,xc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Gy&&(this._zoom(t,o,a),this._totalDelta=0)},Dt.prototype._handleWheel=function(t){if(this._enabled){var o=this._container;t.preventDefault();var a=t.ctrlKey||Rs()&&t.metaKey,l=t.shiftKey,r=-1*this._scale,i;if(a?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,a){var s=o.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};i=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Ky(t.deltaY)*r,this.zoom(i,c)}else l?i={dx:r*t.deltaY,dy:0}:i={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(i)}},Dt.prototype.stepZoom=function(t,o){var a=Cc(Fl,xc);this._zoom(t,o,a)},Dt.prototype._zoom=function(e,t,o){var a=this._canvas,l=e>0?1:-1,r=Dl(a.zoom()),i=Math.round(r/o)*o;i+=o*l;var s=Math.pow(10,i);a.zoom(Yy(Fl,s),t)},Dt.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,l=this._enabled;return typeof t>"u"&&(t=!l),l!==t&&W.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},Dt.prototype._init=function(e){this.toggle(e)};var kc={__init__:["zoomScroll"],zoomScroll:["type",Dt]};function Ye(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Ye.$inject=["eventBus","injector"],Ye.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const o={command:e,context:t};this._pushAction(o),this._internalExecute(o),this._popAction()},Ye.prototype.canExecute=function(e,t){const o={command:e,context:t},a=this._getHandler(e);let l=this._fire(e,"canExecute",o);if(l===void 0){if(!a)return!1;a.canExecute&&(l=a.canExecute(t))}return l},Ye.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Ye.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Ye.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Ye.prototype.register=function(e,t){this._setHandler(e,t)},Ye.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const o=this._injector.instantiate(t);this.register(e,o)},Ye.prototype.canUndo=function(){return!!this._getUndoAction()},Ye.prototype.canRedo=function(){return!!this._getRedoAction()},Ye.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Ye.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Ye.prototype._internalUndo=function(e){const t=e.command,o=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},Ye.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let l;o=this._eventBus.createEvent(o);for(const r of a)if(l=this._eventBus.fire("commandStack."+r,o),o.cancelBubble)break;return l},Ye.prototype._createId=function(){return this._uid++},Ye.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Ye.prototype._internalExecute=function(e,t){const o=e.command,a=e.context,l=this._getHandler(o);if(!l)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),l.preExecute&&l.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),l.execute&&this._markDirty(l.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),l.postExecute&&l.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},Ye.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},Ye.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:(0,S.uniqueBy)("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Ye.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=(0,S.isArray)(e)?e:[e],t.dirty=t.dirty.concat(e))},Ye.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},Ye.prototype._revertedAction=function(e){this._stackIdx--},Ye.prototype._getHandler=function(e){return this._handlerMap[e]},Ye.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var Xy={commandStack:["type",Ye]};function Sn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function pa(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function sn(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function $l(e,t){return!e||!t?-1:e.indexOf(t)}function eo(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var o;o=e[0];)t(o);return e}}var Zy=1e3;function ut(e){this._eventBus=e}ut.$inject=["eventBus"];function Qy(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}ut.prototype.on=function(e,t,o,a,l,r){if(((0,S.isFunction)(t)||(0,S.isNumber)(t))&&(r=l,l=a,a=o,o=t,t=null),(0,S.isFunction)(o)&&(r=l,l=a,a=o,o=Zy),(0,S.isObject)(l)&&(r=l,l=!1),!(0,S.isFunction)(a))throw new Error("handlerFn must be a function");(0,S.isArray)(e)||(e=[e]);var i=this._eventBus;(0,S.forEach)(e,function(s){var c=["commandStack",s,t].filter(function(d){return d}).join(".");i.on(c,o,l?Qy(a,r):a,r)})},ut.prototype.canExecute=Gt("canExecute"),ut.prototype.preExecute=Gt("preExecute"),ut.prototype.preExecuted=Gt("preExecuted"),ut.prototype.execute=Gt("execute"),ut.prototype.executed=Gt("executed"),ut.prototype.postExecute=Gt("postExecute"),ut.prototype.postExecuted=Gt("postExecuted"),ut.prototype.revert=Gt("revert"),ut.prototype.reverted=Gt("reverted");function Gt(e){return function(o,a,l,r,i){((0,S.isFunction)(o)||(0,S.isNumber)(o))&&(i=r,r=l,l=a,a=o,o=null),this.on(o,e,a,l,r,i)}}var eb=250,Sc=1400;function Wl(e,t,o){ut.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",Sc,function(l){var r=l.context,i=r.shapes,s=r.validatedShapes;r.shapes=Ec(i),r.validatedShapes=Ec(s)}),a&&t.on("shape.move.start",eb,function(l){var r=l.context,i=r.shapes,s=[];(0,S.forEach)(i,function(c){(0,S.forEach)(c.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&s.push(d),c.labelTarget&&s.push(c)})}),(0,S.forEach)(s,function(c){a.makeDraggable(r,c,!0)})}),this.preExecuted("elements.move",Sc,function(l){var r=l.context.closure,i=r.enclosedElements,s=[];(0,S.forEach)(i,function(c){(0,S.forEach)(c.labels,function(d){i[d.id]||s.push(d)})}),r.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(l){var r=l.context;eo((r.connection||r.shape).labels,function(i){o.removeShape(i,{nested:!0})})}),this.execute("shape.delete",function(l){var r=l.context,i=r.shape,s=i.labelTarget;s&&(r.labelTargetIndex=$l(s.labels,i),r.labelTarget=s,i.labelTarget=null)}),this.revert("shape.delete",function(l){var r=l.context,i=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(sn(s.labels,i,c),i.labelTarget=s)})}Sn(Wl,ut),Wl.$inject=["injector","eventBus","modeling"];function Ec(e){return(0,S.filter)(e,function(t){return e.indexOf(t.labelTarget)===-1})}var tb={__init__:["labelSupport"],labelSupport:["type",Wl]};function Bc(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Rc(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function nb(e,t,o,a){var l=o.inverse;return Object.defineProperty(e,"remove",{value:function(r){var i=this.indexOf(r);return i!==-1&&(this.splice(i,1),t.unset(r,l,a)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,i){var s=this.indexOf(r);if(typeof i>"u"){if(s!==-1)return;i=this.length}s!==-1&&this.splice(s,1),this.splice(i,0,r),s===-1&&t.set(r,l,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function ob(e){return e.__refs_collection===!0}function ab(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function _c(e,t,o){var a=nb(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(l){e.set(l,t.inverse,o)})}function lb(e,t,o){var a=t.inverse,l=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return l},set:function(r){if(r!==l){var i=l;l=null,i&&e.unset(i,a,o),l=r,e.set(l,a,o)}}})}function St(e,t){if(!(this instanceof St))return new St(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}St.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?_c(this,t,e):lb(this,t,e)},St.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return ob(o)||_c(this,t,e),o},St.prototype.ensureBound=function(e,t){ab(e,t)||this.bind(e,t)},St.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},St.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var Ul=new St({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Tc=new St({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Mc=new St({name:"attachers",collection:!0},{name:"host"}),Vc=new St({name:"outgoing",collection:!0},{name:"source"}),Nc=new St({name:"incoming",collection:!0},{name:"target"});function to(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,o=this.labels;!e&&t?o.remove(t):o.add(e,0)}}),Ul.bind(this,"parent"),Tc.bind(this,"labels"),Vc.bind(this,"outgoing"),Nc.bind(this,"incoming")}function Co(){to.call(this),Ul.bind(this,"children"),Mc.bind(this,"host"),Mc.bind(this,"attachers")}Sn(Co,to);function Ac(){to.call(this),Ul.bind(this,"children")}Sn(Ac,Co);function Pc(){Co.call(this),Tc.bind(this,"labelTarget")}Sn(Pc,Co);function jc(){to.call(this),Vc.bind(this,"source"),Nc.bind(this,"target")}Sn(jc,to);var rb={connection:jc,shape:Co,label:Pc,root:Ac};function ib(e,t){var o=rb[e];if(!o)throw new Error("unknown type: <"+e+">");return(0,S.assign)(new o,t)}function sb(e){return e instanceof to}function cn(){this._uid=12}cn.prototype.createRoot=function(e){return this.create("root",e)},cn.prototype.createLabel=function(e){return this.create("label",e)},cn.prototype.createShape=function(e){return this.create("shape",e)},cn.prototype.createConnection=function(e){return this.create("connection",e)},cn.prototype.create=function(e,t){return t=(0,S.assign)({},t||{}),t.id||(t.id=e+"_"+this._uid++),ib(e,t)};var cb={width:90,height:20};function En(){cn.call(this),this._translate=Rc}(0,Yt.default)(En,cn),En.$inject=[],En.prototype.baseCreate=cn.prototype.create,En.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Ue({type:"label"},cb,t)):this.createFlowElement(e,t)},En.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Bc()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=Ue({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},En.prototype._getDefaultSize=function(e){let t={width:100,height:80};switch(e){case"startEvent":case"endEvent":case"myEvent":t={width:36,height:36};break;case"gatewayAnd":case"gatewayXor":case"gatewayInclusive":t={width:50,height:50};break;case"subprocess":case"userTask":case"scriptTask":t={width:100,height:80};break}return t};function ha(e,t){this._modeling=e,this._canvas=t}ha.$inject=["modeling","canvas"],ha.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;(0,S.forEach)(o,function(l){var r={x:0,y:0};(0,S.isDefined)(a.left)?r.x=a.left-l.x:(0,S.isDefined)(a.right)?r.x=a.right-l.width-l.x:(0,S.isDefined)(a.center)?r.x=a.center-Math.round(l.width/2)-l.x:(0,S.isDefined)(a.top)?r.y=a.top-l.y:(0,S.isDefined)(a.bottom)?r.y=a.bottom-l.height-l.y:(0,S.isDefined)(a.middle)&&(r.y=a.middle-Math.round(l.height/2)-l.y),t.moveElements([l],r,l.parent)})},ha.prototype.postExecute=function(e){};function ga(e){this._modeling=e}ga.$inject=["modeling"],ga.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,l=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:l.attach}),e.shape=a},ga.prototype.postExecute=function(e){var t=e.hints||{};db(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function db(e,t){return(0,S.some)(e.outgoing,function(o){return o.target===t})}function ma(e,t){this._canvas=e,this._layouter=t}ma.$inject=["canvas","layouter"],ma.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,l=e.parent,r=e.parentIndex,i=e.hints;if(!o||!a)throw new Error("source and target required");if(!l)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,i)),this._canvas.addConnection(t,l,r),t},ma.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ya=Math.round;function Jl(e){this._modeling=e}Jl.$inject=["modeling"],Jl.prototype.preExecute=function(e){var t=e.elements,o=e.parent,a=e.parentIndex,l=e.position,r=e.hints,i=this._modeling;(0,S.forEach)(t,function(u){(0,S.isNumber)(u.x)||(u.x=0),(0,S.isNumber)(u.y)||(u.y=0)});var s=It((0,S.filter)(t,function(u){return!u.hidden}));(0,S.forEach)(t,function(u){vt(u)&&(u.waypoints=(0,S.map)(u.waypoints,function(p){return{x:ya(p.x-s.x-s.width/2+l.x),y:ya(p.y-s.y-s.height/2+l.y)}})),(0,S.assign)(u,{x:ya(u.x-s.x-s.width/2+l.x),y:ya(u.y-s.y-s.height/2+l.y)})});var c=iy(t),d={};(0,S.forEach)(t,function(u){if(vt(u)){d[u.id]=(0,S.isNumber)(a)?i.createConnection(d[u.source.id],d[u.target.id],a,u,u.parent||o,r):i.createConnection(d[u.source.id],d[u.target.id],u,u.parent||o,r);return}var p=(0,S.assign)({},r);c.indexOf(u)===-1&&(p.autoResize=!1),Qn(u)&&(p=(0,S.omit)(p,["attach"])),d[u.id]=(0,S.isNumber)(a)?i.createShape(u,(0,S.pick)(u,["x","y","width","height"]),u.parent||o,a,p):i.createShape(u,(0,S.pick)(u,["x","y","width","height"]),u.parent||o,p)}),e.elements=(0,S.values)(d)};var Oc=Math.round;function dn(e){this._canvas=e}dn.$inject=["canvas"],dn.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,l=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?(0,S.assign)(t,o):(0,S.assign)(t,{x:o.x-Oc(t.width/2),y:o.y-Oc(t.height/2)}),this._canvas.addShape(t,a,l),t},dn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function xo(e){dn.call(this,e)}Sn(xo,dn),xo.$inject=["canvas"];var ub=dn.prototype.execute;xo.prototype.execute=function(e){var t=e.shape;return pb(t),t.labelTarget=e.labelTarget,ub.call(this,e)};var fb=dn.prototype.revert;xo.prototype.revert=function(e){return e.shape.labelTarget=null,fb.call(this,e)};function pb(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ko(e,t){this._canvas=e,this._modeling=t}ko.$inject=["canvas","modeling"],ko.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;eo(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),eo(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},ko.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=$l(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ko.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,sn(o.children,t,a),this._canvas.addConnection(t,o),t};function Yl(e,t){this._modeling=e,this._elementRegistry=t}Yl.$inject=["modeling","elementRegistry"],Yl.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;(0,S.forEach)(a,function(l){o.get(l.id)&&(l.waypoints?t.removeConnection(l):t.removeShape(l))})};function So(e,t){this._canvas=e,this._modeling=t}So.$inject=["canvas","modeling"],So.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;eo(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),eo(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),eo(o.children,function(a){vt(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},So.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=$l(a.children,o),t.removeShape(o),o},So.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,l=e.oldParentIndex;return sn(a.children,o,l),t.addShape(o,a),o};function ba(e){this._modeling=e}ba.$inject=["modeling"];var Ic={x:"y",y:"x"};ba.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,l=e.dimension;function r(y,w){y.range.min=Math.min(w[a],y.range.min),y.range.max=Math.max(w[a]+w[l],y.range.max)}function i(y){return y[a]+y[l]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function d(y,w){var x={y:0};x[a]=y-i(w),x[a]&&(x[Ic[a]]=0,t.moveElements([w],x,w.parent))}var u=o[0],p=s(o),f=o[p],h,g,m=0;(0,S.forEach)(o,function(y,w){var x,v,C;if(y.elements.length<2){w&&w!==o.length-1&&(r(y,y.elements[0]),m+=c(y.range));return}x=(0,S.sortBy)(y.elements,a),v=x[0],w===p&&(v=x[s(x)]),C=i(v),y.range=null,(0,S.forEach)(x,function(R){if(d(C,R),y.range===null){y.range={min:R[a],max:R[a]+R[l]};return}r(y,R)}),w&&w!==o.length-1&&(m+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),h=Math.round((g-m)/(o.length-1)),!(h<o.length-1)&&(0,S.forEach)(o,function(y,w){var x={},v;y===u||y===f||(v=o[w-1],y.range.max=0,(0,S.forEach)(y.elements,function(C,R){x[Ic[a]]=0,x[a]=v.range.max-C[a]+h,y.range.min!==C[a]&&(x[a]+=C[a]-y.range.min),x[a]&&t.moveElements([C],x,C.parent),y.range.max=Math.max(C[a]+C[l],R?y.range.max:0)}))})},ba.prototype.postExecute=function(e){};function va(e,t){this._layouter=e,this._canvas=t}va.$inject=["layouter","canvas"],va.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return(0,S.assign)(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},va.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Kl(){}Kl.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,l=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=pa(r.children,t),sn(a.children,t,l),t.parent=a,(0,S.forEach)(t.waypoints,function(i){i.x+=o.x,i.y+=o.y,i.original&&(i.original.x+=o.x,i.original.y+=o.y)}),t},Kl.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,l=e.oldParentIndex,r=e.delta;return pa(o.children,t),sn(a.children,t,l),t.parent=a,(0,S.forEach)(t.waypoints,function(i){i.x-=r.x,i.y-=r.y,i.original&&(i.original.x-=r.x,i.original.y-=r.y)}),t};function wa(e,t,o){var a=Ls(t),l=Ls(o),r=qn(e,a),i={x:r.x*(o.width/t.width),y:r.y*(o.height/t.height)};return wo({x:l.x+i.x,y:l.y+i.y})}function Gl(e,t,o){var a=Ca(e),l=Lc(a,t),r=a[0];return l.length?l[l.length-1]:wa(r.original||r,o,t)}function ql(e,t,o){var a=Ca(e),l=Lc(a,t),r=a[a.length-1];return l.length?l[0]:wa(r.original||r,o,t)}function Xl(e,t,o){var a=Ca(e),l=zc(t,o),r=a[0];return wa(r.original||r,l,t)}function Zl(e,t,o){var a=Ca(e),l=zc(t,o),r=a[a.length-1];return wa(r.original||r,l,t)}function zc(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ca(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Lc(e,t){return(0,S.filter)((0,S.map)(e,gb),function(o){return hb(o,t)})}function hb(e,t){return rn(t,e,1)==="intersect"}function gb(e){return e.original||e}function Ql(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ql.prototype.add=function(e,t){return this.addAll([e],t)},Ql.prototype.addAll=function(e,t){var o=dy(e,!!t,this);return(0,S.assign)(this,o),this};function Eo(e){this._modeling=e}Eo.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},Eo.prototype.moveClosure=function(e,t,o,a,l){var r=this._modeling,i=e.allShapes,s=e.allConnections,c=e.enclosedConnections,d=e.topLevel,u=!1;l&&l.parent===o&&(u=!0),(0,S.forEach)(i,function(p){r.moveShape(p,t,d[p.id]&&!u&&o,{recurse:!1,layout:!1})}),(0,S.forEach)(s,function(p){var f=!!i[p.source.id],h=!!i[p.target.id];c[p.id]&&f&&h?r.moveConnection(p,t,d[p.id]&&!u&&o):r.layoutConnection(p,{connectionStart:f&&Xl(p,p.source,t),connectionEnd:h&&Zl(p,p.target,t)})})},Eo.prototype.getClosure=function(e){return new Ql().addAll(e,!0)};function xa(e){this._helper=new Eo(e)}xa.$inject=["modeling"],xa.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},xa.prototype.postExecute=function(e){var t=e.hints,o;t&&t.primaryShape&&(o=t.primaryShape,t.oldParent=o.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,o)};function Bn(e){this._modeling=e,this._helper=new Eo(e)}Bn.$inject=["modeling"],Bn.prototype.execute=function(e){var t=e.shape,o=e.delta,a=e.newParent||t.parent,l=e.newParentIndex,r=t.parent;return e.oldBounds=(0,S.pick)(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=pa(r.children,t),sn(a.children,t,l),(0,S.assign)(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},Bn.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,l=this._modeling;a.layout!==!1&&((0,S.forEach)(t.incoming,function(r){l.layoutConnection(r,{connectionEnd:Zl(r,t,o)})}),(0,S.forEach)(t.outgoing,function(r){l.layoutConnection(r,{connectionStart:Xl(r,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},Bn.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,l=e.delta;return sn(o.children,t,a),(0,S.assign)(t,{parent:o,x:t.x-l.x,y:t.y-l.y}),t},Bn.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Bn.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Bo(e){this._modeling=e}Bo.$inject=["modeling"],Bo.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,l=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return(0,S.isArray)(l)&&(e.oldWaypoints=a.waypoints,a.waypoints=l),t&&(e.oldSource=a.source,a.source=t),o&&(e.oldTarget=a.target,a.target=o),a},Bo.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,a=e.newTarget,l=e.dockingOrPoints,r=e.hints||{},i={};r.connectionStart&&(i.connectionStart=r.connectionStart),r.connectionEnd&&(i.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(o&&(!a||r.docking==="source")&&(i.connectionStart=i.connectionStart||Hc((0,S.isArray)(l)?l[0]:l)),a&&(!o||r.docking==="target")&&(i.connectionEnd=i.connectionEnd||Hc((0,S.isArray)(l)?l[l.length-1]:l)),r.newWaypoints&&(i.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,i))},Bo.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,l=e.connection;return t&&(l.source=t),o&&(l.target=o),a&&(l.waypoints=a),l};function Hc(e){return e.original||e}function qt(e,t){this._modeling=e,this._rules=t}qt.$inject=["modeling","rules"],qt.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,l=e.oldShape,r=e.newData,i=e.hints||{},s;function c(g,m,y){return a.allowed("connection.reconnect",{connection:y,source:g,target:m})}var d={x:r.x,y:r.y},u={x:l.x,y:l.y,width:l.width,height:l.height};s=e.newShape=e.newShape||t.createShape(r,d,l.parent,i),l.host&&o.updateAttachment(s,l.host);var p;i.moveChildren!==!1&&(p=l.children.slice(),o.moveElements(p,{x:0,y:0},s,i));var f=l.incoming.slice(),h=l.outgoing.slice();(0,S.forEach)(f,function(g){var m=g.source;c(m,s,g)&&t.reconnectEnd(g,s,ql(g,s,u),i)}),(0,S.forEach)(h,function(g){var m=g.target;c(s,m,g)&&t.reconnectStart(g,s,Gl(g,s,u),i)})},qt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},qt.prototype.execute=function(e){},qt.prototype.revert=function(e){},qt.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},qt.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},qt.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function Ro(e){this._modeling=e}Ro.$inject=["modeling"],Ro.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},(0,S.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Ro.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds;(e.hints||{}).layout!==!1&&((0,S.forEach)(o.incoming,function(l){t.layoutConnection(l,{connectionEnd:ql(l,o,a)})}),(0,S.forEach)(o.outgoing,function(l){t.layoutConnection(l,{connectionStart:Gl(l,o,a)})}))},Ro.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return(0,S.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function mb(e,t){var o=[];return(0,S.forEach)(e.concat(t),function(a){var l=a.incoming,r=a.outgoing;(0,S.forEach)(l.concat(r),function(i){var s=i.source,c=i.target;(_o(e,s)||_o(e,c)||_o(t,s)||_o(t,c))&&(_o(o,i)||o.push(i))})}),o}function _o(e,t){return e.indexOf(t)!==-1}function yb(e,t,o){var a=e.x,l=e.y,r=e.width,i=e.height,s=o.x,c=o.y;switch(t){case"n":return{x:a,y:l+c,width:r,height:i-c};case"s":return{x:a,y:l,width:r,height:i+c};case"w":return{x:a+s,y:l,width:r-s,height:i};case"e":return{x:a,y:l,width:r+s,height:i};default:throw new Error("unknown direction: "+t)}}function un(e){this._modeling=e}un.$inject=["modeling"],un.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,l=e.resizingShapes,r=e.start,i={};this.moveShapes(a,t),(0,S.forEach)(l,function(s){i[s.id]=vb(s)}),this.resizeShapes(l,t,o),this.updateConnectionWaypoints(mb(a,l),t,o,r,a,l,i)},un.prototype.execute=function(){},un.prototype.revert=function(){},un.prototype.moveShapes=function(e,t){var o=this;(0,S.forEach)(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},un.prototype.resizeShapes=function(e,t,o){var a=this;(0,S.forEach)(e,function(l){var r=yb(l,o,t);a._modeling.resizeShape(l,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},un.prototype.updateConnectionWaypoints=function(e,t,o,a,l,r,i){var s=this,c=l.concat(r);(0,S.forEach)(e,function(d){var u=d.source,p=d.target,f=bb(d),h=Fc(o),g={};fn(c,u)&&fn(c,p)?(f=(0,S.map)(f,function(m){return $c(m,a,o)&&(m[h]=m[h]+t[h]),m.original&&$c(m.original,a,o)&&(m.original[h]=m.original[h]+t[h]),m}),s._modeling.updateWaypoints(d,f,{labelBehavior:!1})):(fn(c,u)||fn(c,p))&&(fn(l,u)?g.connectionStart=Xl(d,u,t):fn(l,p)?g.connectionEnd=Zl(d,p,t):fn(r,u)?g.connectionStart=Gl(d,u,i[u.id]):fn(r,p)&&(g.connectionEnd=ql(d,p,i[p.id])),s._modeling.layoutConnection(d,g))})};function Dc(e){return(0,S.assign)({},e)}function bb(e){return(0,S.map)(e.waypoints,function(t){return t=Dc(t),t.original&&(t.original=Dc(t.original)),t})}function Fc(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function $c(e,t,o){var a=Fc(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function fn(e,t){return e.indexOf(t)!==-1}function vb(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function ka(e){this._modeling=e}ka.$inject=["modeling"],ka.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=Wc(o),t.collapsed=!t.collapsed;var a=Uc(o,t.collapsed);return[t].concat(a)},ka.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,l=Jc(a,o);return t.collapsed=!t.collapsed,[t].concat(l)};function Wc(e){var t={};return(0,S.forEach)(e,function(o){t[o.id]=o.hidden,o.children&&(t=(0,S.assign)({},t,Wc(o.children)))}),t}function Uc(e,t){var o=[];return(0,S.forEach)(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(Uc(a.children,a.collapsed||t)))}),o}function Jc(e,t){var o=[];return(0,S.forEach)(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(Jc(a.children,t)))}),o}function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Yc(a,t),Kc(o,t),t.host=o,t},Sa.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,l=e.attacherIdx;return t.host=a,Yc(o,t),Kc(a,t,l),t};function Yc(e,t){return pa(e&&e.attachers,t)}function Kc(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),sn(a,t,o)}}function er(){}er.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},er.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function je(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}je.$inject=["eventBus","elementFactory","commandStack"],je.prototype.getHandlers=function(){return{"shape.append":ga,"shape.create":dn,"shape.delete":So,"shape.move":Bn,"shape.resize":Ro,"shape.replace":qt,"shape.toggleCollapse":ka,spaceTool:un,"label.create":xo,"connection.create":ma,"connection.delete":ko,"connection.move":Kl,"connection.layout":va,"connection.updateWaypoints":er,"connection.reconnect":Bo,"elements.create":Jl,"elements.move":xa,"elements.delete":Yl,"elements.distribute":ba,"elements.align":ha,"element.updateAttachment":Sa}},je.prototype.registerHandlers=function(e){(0,S.forEach)(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},je.prototype.moveShape=function(e,t,o,a,l){typeof a=="object"&&(l=a,a=null);var r={shape:e,delta:t,newParent:o,newParentIndex:a,hints:l||{}};this._commandStack.execute("shape.move",r)},je.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},je.prototype.moveElements=function(e,t,o,a){a=a||{};var l=a.attach,r=o,i;l===!0?(i=o,r=o.parent):l===!1&&(i=null);var s={shapes:e,delta:t,newParent:r,newHost:i,hints:a};this._commandStack.execute("elements.move",s)},je.prototype.moveConnection=function(e,t,o,a,l){typeof a=="object"&&(l=a,a=void 0);var r={connection:e,delta:t,newParent:o,newParentIndex:a,hints:l||{}};this._commandStack.execute("connection.move",r)},je.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},je.prototype.createConnection=function(e,t,o,a,l,r){typeof o=="object"&&(r=l,l=a,a=o,o=void 0),a=this._create("connection",a);var i={source:e,target:t,parent:l,parentIndex:o,connection:a,hints:r};return this._commandStack.execute("connection.create",i),i.connection},je.prototype.createShape=function(e,t,o,a,l){typeof a!="number"&&(l=a,a=void 0),l=l||{};var r=l.attach,i,s;e=this._create("shape",e),r?(i=o.parent,s=o):i=o;var c={position:t,shape:e,parent:i,parentIndex:a,host:s,hints:l};return this._commandStack.execute("shape.create",c),c.shape},je.prototype.createElements=function(e,t,o,a,l){(0,S.isArray)(e)||(e=[e]),typeof a!="number"&&(l=a,a=void 0),l=l||{};var r={position:t,elements:e,parent:o,parentIndex:a,hints:l};return this._commandStack.execute("elements.create",r),r.elements},je.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var l={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",l),l.shape},je.prototype.appendShape=function(e,t,o,a,l){l=l||{},t=this._create("shape",t);var r={source:e,position:o,target:a,shape:t,connection:l.connection,connectionParent:l.connectionParent,hints:l};return this._commandStack.execute("shape.append",r),r.shape},je.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},je.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},je.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},je.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},je.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},je.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},je.prototype.resizeShape=function(e,t,o,a){var l={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",l)},je.prototype.createSpace=function(e,t,o,a,l){var r={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:l};this._commandStack.execute("spaceTool",r)},je.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},je.prototype.reconnect=function(e,t,o,a,l){var r={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:l||{}};this._commandStack.execute("connection.reconnect",r)},je.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,(0,S.assign)(a,{docking:"source"}))},je.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,(0,S.assign)(a,{docking:"target"}))},je.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},je.prototype._create=function(e,t){return sb(t)?t:this._elementFactory.create(e,t)},je.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function Gc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function tr(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function wb(e,t){Array.isArray(e)&&e.forEach(t)}function Ea(e){const t=e.businessObject;if(t)return t.name||""}function Cb(e,t){const o=e.businessObject;return o.name=t,e}var xb={width:90,height:20},zC=15;function nr(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function qc(e){return To(e.label)}function kb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],l=Sb(e),r=Math.atan((a.y-o.y)/(a.x-o.x));let{x:i,y:s}=l;return Math.abs(r)<Math.PI/2?s-=15:i+=15,{x:i,y:s}}function Sb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function Xc(e){return e.waypoints?kb(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+xb.height/2}}function To(e){return e&&!!e.labelTarget}var Eb={width:0,height:0};function Zc(e,t){function o(s,c){const d=s.label||s,u=s.labelTarget||s;return Cb(d,c,u!==d),[d,u]}function a(s){const{element:c,newLabel:d}=s,{businessObject:u}=c;if(!To(c)&&nr(c)&&!qc(c)&&!Qc(d)){let f=Xc(c);f={x:f.x,y:f.y+7},e.createLabel(c,f,{id:u.id+"_label",businessObject:u})}}function l(s){return s.oldLabel=Ea(s.element),o(s.element,s.newLabel)}function r(s){return o(s.element,s.oldLabel)}function i(s){const{element:c,newLabel:d}=s,u=c.label||c,p=s.hints||{};let{newBounds:f}=s;if(!To(u))return;if(To(u)&&Qc(d)){p.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const h=Ea(u);typeof f>"u"&&(f=t.getExternalLabelBounds(u,h)),f&&e.resizeShape(u,f,Eb)}this.preExecute=a,this.execute=l,this.revert=r,this.postExecute=i}Zc.$inject=["modeling","textRenderer"];function Qc(e){return!e||!e.trim()}function Mo(e,t,o){je.call(this,e,t,o)}(0,Yt.default)(Mo,je),Mo.$inject=["eventBus","elementFactory","commandStack"],Mo.prototype.getHandlers=function(){const e=je.prototype.getHandlers.call(this);return e["element.updateLabel"]=Zc,e},Mo.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function or(e,t){ut.call(this,e);function o(a){const{context:l}=a,r=l.hints||{};let i;!l.cropped&&r.createElementsBehavior!==!1&&(i=l.connection,i.waypoints=t.getCroppedWaypoints(i),l.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}(0,Yt.default)(or,ut),or.$inject=["eventBus","connectionDocking"];function ed(){}ed.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||qe(t.source||e.source),t.connectionEnd||qe(t.target||e.target)]};var Ba=20,Bb=5,Ra=Math.round,td=20,Rb={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function _b(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Tb(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function nd(e,t,o){var a=rn(t,e,Bb),l=o.split(":")[0],r=Ra((t.x-e.x)/2+e.x),i=Ra((t.y-e.y)/2+e.y),s,c,d=Tb(l,a),u=/h|r|l/.test(l),p=!1,f=!1;return d?(s=u?{x:r,y:e.y}:{x:e.x,y:i},c=u?"h:h":"v:v"):(p=_b(a,l),c=u?"h:v":"v:h",p?u?(f=i===e.y,s={x:e.x+Ba*(/l/.test(l)?-1:1),y:f?i+Ba:i}):(f=r===e.x,s={x:f?r+Ba:r,y:e.y+Ba*(/t/.test(l)?-1:1)}):s={x:r,y:i}),{waypoints:ar(e,s,c).concat(s),directions:c,turnNextDirections:f}}function Mb(e,t,o){return nd(e,t,o)}function Vb(e,t,o){var a=nd(t,e,od(o));return{waypoints:a.waypoints.slice().reverse(),directions:od(a.directions),turnNextDirections:a.turnNextDirections}}function Nb(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var l=o+":"+a;return{waypoints:ar(e.waypoints[e.waypoints.length-1],t.waypoints[0],l),directions:l}}function od(e){return e.split(":").reverse().join(":")}function Ab(e,t,o){var a=Ra((t.x-e.x)/2+e.x),l=Ra((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:l},{x:t.x,y:l}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function ar(e,t,o){if(o=o||"h:h",!Fb(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ld(o)){var a=Mb(e,t,o),l=Vb(e,t,o),r=Nb(a,l);return[].concat(a.waypoints,r.waypoints,l.waypoints)}return Ab(e,t,o)}function Pb(e,t,o){var a=ar(e,t,o);return a.unshift(e),a.push(t),id(a)}function jb(e,t,o,a,l){var r=(0,S.without)(l&&l.preferredLayouts||[],"straight")[0]||"h:h",i=rn(e,t,Rb[r]||0),s=Db(i,r);o=o||qe(e),a=a||qe(t);var c=s.split(":");return Pb(rd(o,e,c[0],$b(i)),rd(a,t,c[1],i),s)}function Ob(e,t,o,a,l,r){(0,S.isArray)(o)&&(l=o,r=a,o=qe(e),a=qe(t)),r=(0,S.assign)({preferredLayouts:[]},r),l=l||[];var i=r.preferredLayouts.indexOf("straight")!==-1&&zb(e,t,o,a,r);return i||(i=r.connectionEnd&&Hb(t,e,a,l),i)||(i=r.connectionStart&&Lb(e,t,o,l),i)?i:!r.connectionStart&&!r.connectionEnd&&l&&l.length?l:jb(e,t,o,a,r)}function Ib(e,t,o){return e>=t&&e<=o}function ad(e,t,o){return Ib(t[e],o[e],o[e]+o[{x:"width",y:"height"}[e]])}function zb(e,t,o,a,l){var r={},i,s=rn(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(i="x"),/left|right/.test(s)&&(i="y"),l.preserveDocking==="target"?ad(i,a,e)?(r[i]=a[i],[{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y,original:{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y}},{x:a.x,y:a.y}]):null:ad(i,o,t)?(r[i]=o[i],[{x:o.x,y:o.y},{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y,original:{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y}}]):null):null}function Lb(e,t,o,a){return lr(e,t,o,a)}function Hb(e,t,o,a){var l=a.slice().reverse();return l=lr(e,t,o,l),l?l.reverse():null}function lr(e,t,o,a){function l(u){return u.length<3?!0:u.length>4?!1:!!(0,S.find)(u,function(p,f){var h=u[f-1];return h&&vo(p,h)<3})}function r(u,p,f){switch(nn(p,u)){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function i(u,p,f){var h;for(h=u.length-2;h!==0;h--)if(tc(u[h],p,td)||tc(u[h],f,td))return u.slice(h);return u}if(l(a))return null;var s=a[0],c=a.slice(),d;return c[0]=o,c[1]=r(c[1],s,o),d=i(c,e,t),d!==c&&(c=lr(e,t,o,d)),c&&nn(c)?null:c}function Db(e,t){if(ld(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function Fb(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ld(e){return e&&/t|r|b|l/.test(e)}function $b(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function rd(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function id(e){return e.reduce(function(t,o,a){var l=t[t.length-1],r=e[a+1];return Pl(l,r,o,0)||t.push(o),t},[])}function rr(){}(0,Yt.default)(rr,ed);var Rn=(e,t)=>e.type===t;rr.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,l=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:i}=t,s,c;return i===void 0&&(r=_a(l&&l[0],o),i=_a(l&&l[l.length-1],a)),r||(r=_a(l&&l[0],o)),i||(i=_a(l&&l[l.length-1],a)),Rn(e,"myline")&&(o===a?s={preferredLayouts:Wb(o,e)}:Rn(o,"gatewayAnd")||Rn(o,"gatewayXor")||Rn(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:Rn(a,"gatewayAnd")||Rn(a,"gatewayXor")||Rn(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Ue(s,t),c=id(Ob(o,a,r,i,l,s))),c||[r,i]};function _a(e,t){return e?e.original||e:qe(t)}function Wb(e,t){const{waypoints:o}=t,a=o&&o.length&&rn(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function sd(e){return(0,S.assign)({original:e.point.original||e.point},e.actual)}function pn(e,t){this._elementRegistry=e,this._graphicsFactory=t}pn.$inject=["elementRegistry","graphicsFactory"],pn.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),l=this.getDockingPoint(e,o),r=e.waypoints.slice(a.idx+1,l.idx);return r.unshift(sd(a)),r.push(sd(l)),r},pn.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,l=o?0:a.length-1,r=a[l];return{point:r,actual:this._getIntersection(t,e,o)||r,idx:l}},pn.prototype._getIntersection=function(e,t,o){return zl(this._getShapePath(e),this._getConnectionPath(t),o)},pn.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},pn.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},pn.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var cd={__depends__:[Xy,tb,Gn],__init__:["modeling","elementUpdater"],modeling:["type",Mo],layouter:["type",rr],elementUpdater:["type",or],elementFactory:["type",En],connectionDocking:["type",pn]},Ub=1e3;function _n(e,t){var o=this;t=t||Ub,e.on(["render.shape","render.connection"],t,function(a,l){var r=a.type,i=l.element,s=l.gfx,c=l.attrs;if(o.canRender(i))return r==="render.shape"?o.drawShape(s,i,c):o.drawConnection(s,i,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,l){if(o.canRender(l))return a.type==="render.getShapePath"?o.getShapePath(l):o.getConnectionPath(l)})}_n.prototype.canRender=function(e){},_n.prototype.drawShape=function(e,t){},_n.prototype.drawConnection=function(e,t){},_n.prototype.getShapePath=function(e){},_n.prototype.getConnectionPath=function(e){};function Jb(e){return e.businessObject}function Ta(e,t){return e.businessObject.strokeWidth||t||1}function Mt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Xe(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function Yb(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2;return yo([["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]])}function Kb(e,t){const{x:o,y:a,width:l,height:r}=e;return yo([["M",o+t,a],["l",l-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-l,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]])}function Gb(e){const{x:t,y:o,width:a,height:l}=e,r=a/2,i=l/2;return yo([["M",t+r,o],["l",r,i],["l",-r,i],["l",-r,-i],["z"]])}function qb(e){const{x:t,y:o,width:a,height:l}=e;return yo([["M",t,o],["l",a,0],["l",0,l],["l",-a,0],["z"]])}var ir=10,sr=.95,hn=(e,t)=>e.type===t;function Tn(e,t,o,a,l,r,i){_n.call(this,e,i);const s="var(--j-color-bg-container)",c="var(--j-color-text)",d={};Object.keys(r.palette).forEach(M=>{const E=r.palette[M];d[E.type]=E.options});const{computeStyle:u}=t;function p(M){return D[M]}function f(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2})}function h(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2,fill:"white"})}function g(M,E,I,$){I=f(I);const Q=Rl(E,I,$);return(0,N.append)(M,Q),Q}function m(M,E,I){return g(M,E,I,5)}function y(M,E,I,$,Q){Gc($)&&(Q=$,$=0),$=$||0,Q=u(Q,{stroke:c,strokeWidth:2,fill:s}),Q.fill==="none"&&delete Q.fillOpacity;const ue=E/2,xe=I/2,_e=(0,N.create)("circle");return(0,N.attr)(_e,{cx:ue,cy:xe,r:Math.round((E+I)/4-$)}),(0,N.attr)(_e,Q),(0,N.append)(M,_e),_e}function w(M,E,I,$,Q,ue){Gc(Q)&&(ue=Q,Q=0),Q=Q||0,ue=u(ue,{stroke:c,strokeWidth:2,fill:s});const xe=(0,N.create)("rect");return(0,N.attr)(xe,{x:Q,y:Q,width:E-Q*2,height:I-Q*2,rx:$,ry:$}),(0,N.attr)(xe,ue),(0,N.append)(M,xe),xe}function x(M,E,I){I=u(I,["no-fill"],{strokeWidth:2,stroke:c});const $=(0,N.create)("path");return(0,N.attr)($,{d:E}),(0,N.attr)($,I),(0,N.append)(M,$),$}function v(M,E,I,$){const Q=E/2,ue=I/2,xe=[{x:Q,y:0},{x:E,y:ue},{x:Q,y:I},{x:0,y:ue}].map(Y=>Y.x+","+Y.y).join(" ");$=u($,{stroke:c,strokeWidth:2,fill:s});const _e=(0,N.create)("polygon");return(0,N.attr)(_e,{points:xe}),(0,N.attr)(_e,$),(0,N.append)(M,_e),_e}function C(M,E,I,$){return x(E,I,Ue({"data-marker":M},$))}function R(M,E,I){I=Ue({size:{width:100}},I);const $=l.createText(E||"",I);return(0,N.classes)($).add("djs-label"),(0,N.append)(M,$),$}function b(M,E,I){return R(M,Jb(E).name,{box:E,align:I,padding:5,style:{fill:Xe(E,c)}})}function k(M,E){const I={width:90,height:30,x:E.width/2+E.x,y:E.height/2+E.y};return R(M,Ea(E),{box:I,fitBox:!0,style:Ue({},l.getExternalStyle(),{fill:Xe(E,c)})})}function B(M,E,I){const $=I&&I.indexOf("SubProcessMarker")!==-1;let Q;$?Q={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:Q={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},wb(I,ue=>{p(ue)(M,E,Q)})}function _(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function V(M,E){const{ref:I={x:0,y:0},scale:$=1,element:Q,parentGfx:ue=a._svg}=E,xe=(0,N.create)("marker",{id:M,viewBox:"0 0 20 20",refX:I.x,refY:I.y,markerWidth:20*$,markerHeight:20*$,orient:"auto"});(0,N.append)(xe,Q);let _e=(0,W.query)(":scope > defs",ue);_e||(_e=(0,N.create)("defs"),(0,N.append)(ue,_e)),(0,N.append)(_e,xe)}function T(M,E,I,$){const Q=E+"-"+_(I)+"-"+_($)+"-"+Bc();return F(M,Q,E,I,$),"url(#"+Q+")"}function F(M,E,I,$,Q){I==="sequenceflow-end"&&V(E,{element:(0,N.create)("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:Q,stroke:Q,strokeWidth:1})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),I==="messageflow-start"&&V(E,{element:(0,N.create)("circle",{cx:6,cy:6,r:3.5,...h({fill:$,stroke:Q,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6},parentGfx:M}),I==="messageflow-end"&&V(E,{element:(0,N.create)("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:$,stroke:Q,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5},parentGfx:M}),I==="association-start"&&V(E,{element:(0,N.create)("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:Q,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5,parentGfx:M}),I==="association-end"&&V(E,{element:(0,N.create)("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:Q,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),I==="conditional-flow-marker"&&V(E,{element:(0,N.create)("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:$,stroke:Q})}),ref:{x:-1,y:10},scale:.5,parentGfx:M}),I==="conditional-default-flow-marker"&&V(E,{element:(0,N.create)("path",{d:"M 6 4 L 10 16",...h({stroke:Q,fill:"none"})}),ref:{x:0,y:10},scale:.5,parentGfx:M})}function L(M,E,I,$){const Q=d[E.type]?.icon||E.icon;Q&&x(M,o.getScaledPath(Q,{abspos:{x:I,y:$}}),{strokeWidth:0,fill:Xe(E,d[E.type]?.iconFill||E.iconFill)})}const D={event(M,E,I){return"fillOpacity"in I||(I.fillOpacity=sr),y(M,E.width,E.height,I)},startEvent(M,E){const I={fill:Mt(E,d.startEvent?.fill||E.fill),stroke:Xe(E,d.startEvent?.stroke||E.stroke),strokeWidth:Ta(E,d.startEvent?.strokeWidth||E.strokeWidth)},$=p("event")(M,E,I);return L(M,E,18,18),$},endEvent(M,E){const I=p("event")(M,E,{strokeWidth:Ta(E,d.endEvent?.strokeWidth||E.strokeWidth||4),fill:Mt(E,d.endEvent?.fill||E.fill),stroke:Xe(E,d.endEvent?.stroke||E.stroke)});return L(M,E,18,18),I},gateway(M,E){const I={fillOpacity:sr,strokeWidth:Ta(E,d[E.type]?.strokeWidth||E.strokeWidth||4),fill:Mt(E,d[E.type]?.fill||E.fill),stroke:Xe(E,d[E.type]?.stroke||E.stroke)};return v(M,E.width,E.height,I)},gatewayAnd(M,E){const I=p("gateway")(M,E);return x(M,o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:d[E.type]?.width||E.width,containerHeight:d[E.type]?.height||E.height,position:{mx:.47,my:.29}}),{strokeWidth:1,fill:Xe(E,d[E.type]?.iconFill||E.iconFill),stroke:Xe(E,d[E.type]?.iconFill||E.iconFill)}),I},gatewayXor(M,E){const I=p("gateway")(M,E);return x(M,o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),{strokeWidth:1,fill:Xe(E,d[E.type]?.iconFill||E.iconFill),stroke:Xe(E,d[E.type]?.iconFill||E.iconFill)}),I},gatewayInclusive(M,E){const I=p("gateway")(M,E);return y(M,E.width,E.height,E.height*.24,{strokeWidth:2.5,fill:Xe(E,s),stroke:Xe(E,d[E.type]?.iconFill||E.iconFill)}),I},activity(M,E,I){return I=I||{},"fillOpacity"in I||(I.fillOpacity=sr),w(M,E.width,E.height,ir,I)},task(M,E){const I={fill:Mt(E,s),stroke:Xe(E,c)},$=p("activity")(M,E,I);return b(M,E,"center-middle"),B(M,E),$},userTask(M,E){const I=p("task")(M,E),$=15,Q=12;return x(M,o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Mt(E,s),stroke:Xe(E,c)}),x(M,o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Mt(E,s),stroke:Xe(E,c)}),x(M,o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Xe(E,c),stroke:Xe(E,c)}),I},scriptTask(M,E){const I=p("task")(M,E);return x(M,o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Xe(E,c)}),I},SubProcessMarker(M,E){zt(w(M,14,14,0,{strokeWidth:1,fill:Mt(E,s),stroke:Xe(E,c)}),E.width/2-7.5,E.height-20),C("sub-process",M,o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}}),{fill:Mt(E,s),stroke:Xe(E,c)})},subprocess(M,E,I){I=Ue({fill:Mt(E,s),stroke:Xe(E,c)},I);const $=p("activity")(M,E,I);return b(M,E,"center-middle"),B(M,E,["SubProcessMarker"]),$},label(M,E){return k(M,E)},myline(M,E){const I=Mt(E,r.lineStroke||s),$=Xe(E,r.lineStroke||c);return m(M,E.waypoints,{markerEnd:T(M,"sequenceflow-end",I,$),stroke:$})},default(M,E){const I={strokeWidth:Ta(E,d[E.type]?.strokeWidth||E.strokeWidth||1),fill:Mt(E,d[E.type]?.fill||E.fill),stroke:Xe(E,d[E.type]?.stroke||E.stroke)},$=w(M,E.width,E.height,E.radius||ir,I);return b(M,E,"center-middle"),B(M,E),L(M,E,E.iconX,E.iconY),$}};this.handlers=D,this._drawPath=x}(0,Yt.default)(Tn,_n),Tn.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],Tn.prototype.canRender=function(){return!0},Tn.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},Tn.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},Tn.prototype.getShapePath=function(e){return hn(e,"startEvent")||hn(e,"endEvent")?Yb(e):hn(e,"userTask")||hn(e,"scriptTask")||hn(e,"subprocess")?Kb(e,ir):hn(e,"gatewayAnd")||hn(e,"gatewayXor")||hn(e,"gatewayInclusive")?Gb(e):qb(e)};var Xb=0,Zb={width:150,height:50};function Qb(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function ev(e){return(0,S.isObject)(e)?(0,S.assign)({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function tv(e,t){t.textContent=e;var o;try{var a,l=e==="";return t.textContent=l?"dummy":e,o=t.getBBox(),a={width:o.width+o.x*2,height:o.height},l&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function nv(e,t,o){for(var a=e.shift(),l=a,r;;){if(r=tv(l,o),r.width=l?r.width:0,l===" "||l===""||r.width<Math.round(t)||l.length<2)return ov(e,l,a,r);l=lv(l,r.width,t)}}function ov(e,t,o,a){if(t.length<o.length){var l=o.slice(t.length).trim();e.unshift(l)}return{width:a.width,height:a.height,text:t}}var dd="­";function av(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,l=[],r=0;if(o.length>1)for(;a=o.shift();)if(a.length+r<t)l.push(a),r+=a.length;else{(a==="-"||a===dd)&&l.pop();break}var i=l[l.length-1];return i&&i===dd&&(l[l.length-1]="-"),l.join("")}function lv(e,t,o){var a=Math.max(e.length*(o/t),1),l=av(e,a);return l||(l=e.slice(0,Math.max(Math.round(a-1),1))),l}function rv(){var e=document.getElementById("helper-svg");return e||(e=(0,N.create)("svg"),(0,N.attr)(e,{id:"helper-svg"}),(0,W.assignStyle)(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function Ma(e){this._config=(0,S.assign)({},{size:Zb,padding:Xb,style:{},align:"center-top"},e||{})}Ma.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ma.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ma.prototype.layoutText=function(e,t){var o=(0,S.assign)({},this._config.size,t.box),a=(0,S.assign)({},this._config.style,t.style),l=Qb(t.align||this._config.align),r=ev(t.padding!==void 0?t.padding:this._config.padding),i=t.fitBox||!1,s=iv(a),c=e.split(/\u00AD?\r?\n/),d=[],u=o.width-r.left-r.right,p=(0,N.create)("text");for((0,N.attr)(p,{x:0,y:0}),(0,N.attr)(p,a),(0,N.append)(rv(),p);c.length;)d.push(nv(c,u,p));l.vertical==="middle"&&(r.top=r.bottom=0);var f=(0,S.reduce)(d,function(y,w,x){return y+(s||w.height)},0)+r.top+r.bottom,h=(0,S.reduce)(d,function(y,w,x){return w.width>y?w.width:y},0),g=r.top;l.vertical==="middle"&&(g+=(o.height-f)/2),g-=(s||d[0].height)/4;var m=(0,N.create)("text");return(0,N.attr)(m,a),(0,S.forEach)(d,function(y){var w;switch(g+=s||y.height,l.horizontal){case"left":w=r.left;break;case"right":w=(i?h:u)-r.right-y.width;break;default:w=Math.max(((i?h:u)-y.width)/2+r.left,0)}var x=(0,N.create)("tspan");(0,N.attr)(x,{x:w,y:g}),x.textContent=y.text,(0,N.append)(m,x)}),(0,N.remove)(p),{dimensions:{width:h,height:f},element:m}};function iv(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var sv=12,cv=1.2,dv=30;function ud(e){const t=Ue({fontFamily:"Arial, sans-serif",fontSize:sv,fontWeight:"normal",lineHeight:cv},e&&e.defaultStyle||{}),o=Ue({},t,{fontSize:parseInt(t.fontSize,10)-1},e&&e.externalStyle||{}),a=new Ma({style:t});this.getExternalLabelBounds=function(l,r){const i=a.getDimensions(r,{box:{width:90,height:30,x:l.width/2+l.x,y:l.height/2+l.y},style:o});return{x:Math.round(l.x+l.width/2-i.width/2),y:Math.round(l.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}},this.getTextAnnotationBounds=function(l,r){const i=a.getDimensions(r,{box:l,style:t,align:"left-top",padding:5});return{x:l.x,y:l.y,width:l.width,height:Math.max(dv,Math.round(i.height))}},this.createText=function(l,r){return a.createText(l,r||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return o}}ud.$inject=["config.textRenderer"];function uv(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,l;o.abspos?(a=o.abspos.x,l=o.abspos.y):(a=o.containerWidth*o.position.mx,l=o.containerHeight*o.position.my);let r={};typeof t=="object"?(r=t,r.d.indexOf("{mx},{my}")===-1&&(r.d="m {mx},{my}"+r.d),r.width&&(a-=r.width/2),r.height&&(l-=r.height/2)):r=this.pathMap[t];const i={};if(o.position){const s=o.containerHeight/r.height*o.yScaleFactor,c=o.containerWidth/r.width*o.xScaleFactor;for(let d=0;d<r.heightElements.length;d++)i["y"+d]=r.heightElements[d]*s;for(let d=0;d<r.widthElements.length;d++)i["x"+d]=r.widthElements[d]*c}return gv(r.d,{mx:a,my:l,e:i})}}var fv=/\{([^}]+)\}/g,pv=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function hv(e,t,o){let a=o;return t.replace(pv,(l,r,i,s,c)=>{r=r||s,a&&(r in a&&(a=a[r]),typeof a=="function"&&c&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function gv(e,t){return String(e).replace(fv,(o,a)=>hv(o,a,t))}var fd={__init__:["myRenderer"],myRenderer:["type",Tn],textRenderer:["type",ud],pathMap:["type",uv]};function pd(e,t){return Ue({id:e.id,type:e.type,businessObject:e},t)}function mv(e,t,o){const a=e.waypoint;return!a||a.length<2?[qe(t),qe(o)]:a.map(l=>({x:l.x,y:l.y}))}function gn(e,t,o,a,l,r){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=l,this._translate=Rc,this._textRenderer=r,this._modeling=t}gn.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],gn.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),l=this._getTarget(e);t=this._elementFactory.createConnection(pd(e,{source:a,target:l,waypoints:mv(e,a,l)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(pd(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},gn.prototype.addLabel=function(e,t){const o=this._elementFactory.createLabel({id:e.id+"_label",labelTarget:t,type:"label",x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),businessObject:e});return this._canvas.addShape(o,t.parent)},gn.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=Ue(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name:l}=t;if(l&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const r={x:t.x+12,y:t.y+42,width:10,height:10,name:l,id:e},i=this._textRenderer.getExternalLabelBounds(r,t.name);this._modeling.resizeShape(r,i,{width:0,height:0}),o&&this.addLabel(r,o)}}},gn.prototype._getSource=function(e){return this._getElement(e.from)},gn.prototype._getTarget=function(e){return this._getElement(e.to)},gn.prototype._getElement=function(e){return this._elementRegistry.get(e)};var hd={myImporter:["type",gn]},gd=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(l=>({x:l.x,y:l.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const l=t.find(r=>r.id===a.id);l&&(l.name=a.name||"",l.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},md=(e,t)=>{const o=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),l=e.filter(r=>r.type==="myline");a.forEach(r=>{o.add(r)}),l.forEach(r=>{o.add(r)})},yv=(0,n.defineComponent)({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(),i={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const b=s.get("eventBus");b.on("element.dblclick",k=>{l("elementDblclick",k.element.businessObject)}),b.on("element.click",k=>{l("elementClick",k.element.businessObject)})},p=function(){return{palette:a.paletteOptions||i,lineStroke:a.lineStroke}},f=()=>{let b={__init__:["myOptions"],myOptions:["type",p]};s=new qo.default({canvas:{container:r.value},modules:[Hl,ec,cd,wc,kc,b,fd,hd]});const k=s.get("canvas"),B=s.get("elementFactory");d();const _=B.createRoot();k.setRootElement(_),u()};(0,n.onMounted)(()=>{f()});const h=b=>{const k=b==null?1:c+b;s.get("canvas").zoom(k),c=k},g=()=>(s.get("canvas").zoom(1),gd(s.get("elementRegistry").getAll())),m=b=>{s.clear(),d(),md(b,s)},y=b=>{s.get("myImporter").update(b.id,b)};return t({reset:()=>{d()},zoom:b=>{h(b)},getData:()=>g(),setData:b=>{m(b)},updateElemet:b=>{y(b)}}),(b,k)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),bv=yv;function cr(e){return e&&e[e.length-1]}function yd(e){return e.y}function bd(e){return e.x}var vv={left:bd,center:bd,right:function(e){return e.x+e.width},top:yd,middle:yd,bottom:function(e){return e.y+e.height}};function no(e,t){this._modeling=e,this._rules=t}no.$inject=["modeling","rules"],no.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},no.prototype._isType=function(e,t){return t.indexOf(e)!==-1},no.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,l=o.dimension,r={},i={},s=!1,c,d,u;function p(f,h){return Math.round((f[a]+h[a]+h[l])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=cr(t),r[e]=u[a]+u[l];else if(this._isType(e,["center","middle"])){if((0,S.forEach)(t,function(f){var h=f[a]+Math.round(f[l]/2);i[h]?i[h].elements.push(f):i[h]={elements:[f],center:h}}),c=(0,S.sortBy)(i,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=cr(c).center,r;d=t[0],t=(0,S.sortBy)(t,function(f){return f[a]+f[l]}),u=cr(t),r[e]=p(d,u)}return r},no.prototype.trigger=function(e,t){var o=this._modeling,a,l=(0,S.filter)(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:l}),(0,S.isArray)(a)&&(l=a),!(l.length<2||!a)){var r=vv[t],i=(0,S.sortBy)(l,r),s=this._alignmentPosition(t,i);o.alignElements(i,s)}};var wv={__init__:["alignElements"],alignElements:["type",no]},Va=Math.round,Cv=Math.max;function xv(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function kv(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var vd=10;function Sv(e,t){var o,a;for(o=0;a=e[o];o++)if(vo(a,t)<=vd)return{point:e[o],bendpoint:!0,index:o};return null}function Ev(e,t){var o=cc(xv(t,vd),kv(e)),a=o[0],l=o[o.length-1],r;return a?a!==l?a.segment2!==l.segment2?(r=Cv(a.segment2,l.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Va(a.x+l.x)/2,y:Va(a.y+l.y)/2},index:a.segment2}:{point:{x:Va(a.x),y:Va(a.y)},index:a.segment2}:null}function Bv(e,t){return Sv(e,t)||Ev(e,t)}function Rv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function _v(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[1],lambda:t[1]}],l=a[0].n*t[0]+a[1].n*t[1],r=a[0].lambda*t[0]+a[1].lambda*t[1];return-l/r}function wd(e,t){var o=t[0],a=t[1],l={x:a.x-o.x,y:a.y-o.y},r=_v([o.x,o.y],[l.x,l.y],[e.x,e.y]);return{x:o.x+r*l.x,y:o.y+r*l.y}}function Tv(e,t){var o=wd(e,t);return Rv({x:o.x-e.x,y:o.y-e.y})}var Cd="djs-bendpoint",xd="djs-segment-dragger";function Mv(e,t){var o=Yn(t),a=e._container.getBoundingClientRect(),l={x:a.left,y:a.top},r=e.viewbox();return{x:r.x+(o.x-l.x)/r.scale,y:r.y+(o.y-l.y)/r.scale}}function dr(e,t,o){return Bv(t,Mv(e,o))}function ur(e,t){var o=(0,N.create)("g");(0,N.classes)(o).add(Cd),(0,N.append)(e,o);var a=(0,N.create)("circle");(0,N.attr)(a,{cx:0,cy:0,r:4}),(0,N.classes)(a).add("djs-visual"),(0,N.append)(o,a);var l=(0,N.create)("circle");return(0,N.attr)(l,{cx:0,cy:0,r:10}),(0,N.classes)(l).add("djs-hit"),(0,N.append)(o,l),t&&(0,N.classes)(o).add(t),o}function Vv(e,t,o,a){var l=(0,N.create)("g");(0,N.append)(e,l);var r=18,i=6,s=11,c=Av(t,o,a),d=i+s,u=(0,N.create)("rect");(0,N.attr)(u,{x:-r/2,y:-i/2,width:r,height:i}),(0,N.classes)(u).add("djs-visual"),(0,N.append)(l,u);var p=(0,N.create)("rect");return(0,N.attr)(p,{x:-c/2,y:-d/2,width:c,height:d}),(0,N.classes)(p).add("djs-hit"),(0,N.append)(l,p),yy(l,a==="v"?90:0,0,0),l}function kd(e,t,o){var a=(0,N.create)("g"),l=jl(t,o),r=nn(t,o);return(0,N.append)(e,a),Vv(a,t,o,r),(0,N.classes)(a).add(xd),(0,N.classes)(a).add(r==="h"?"horizontal":"vertical"),zt(a,l.x,l.y),a}function fr(e){return Math.abs(Math.round(e*2/3))}function Nv(e,t){return wd(e,Pv(e,t))}function Av(e,t,o){var a=t.x-e.x,l=t.y-e.y;return fr(o==="h"?a:l)}function Pv(e,t){for(var o=t.waypoints,a=1/0,l,r=0;r<o.length-1;r++){var i=o[r],s=o[r+1],c=Tv(e,[i,s]);c<a&&(a=c,l=r)}return[o[l],o[l+1]]}function pr(e){return CSS.escape(e)}function Sd(e,t,o,a,l){function r(v,C,R){var b=v.index,k=v.point,B,_,V,T,F,L;return b<=0||v.bendpoint?!1:(B=C[b-1],_=C[b],V=jl(B,_),T=nn(B,_),F=Math.abs(k.x-V.x),L=Math.abs(k.y-V.y),T&&F<=R&&L<=R)}function i(v,C){var R=v.waypoints,b,k,B,_;return C.index<=0||C.bendpoint||(b={start:R[C.index-1],end:R[C.index]},k=nn(b.start,b.end),!k)?null:(k==="h"?B=b.end.x-b.start.x:B=b.end.y-b.start.y,_=fr(B)/2,_)}function s(v,C){var R=C.waypoints,b=dr(t,R,v),k;if(b)return k=i(C,b),r(b,R,k)?l.start(v,C,b.index):a.start(v,C,b.index,!b.bendpoint),!0}function c(v,C,R){W.event.bind(v,C,function(b){o.triggerMouseEvent(C,b,R),b.stopPropagation()})}function d(v,C){var R=t.getLayer("overlays"),b=(0,W.query)('.djs-bendpoints[data-element-id="'+pr(v.id)+'"]',R);return!b&&C&&(b=(0,N.create)("g"),(0,N.attr)(b,{"data-element-id":v.id}),(0,N.classes)(b).add("djs-bendpoints"),(0,N.append)(R,b),c(b,"mousedown",v),c(b,"click",v),c(b,"dblclick",v)),b}function u(v,C){return(0,W.query)('.djs-segment-dragger[data-segment-idx="'+v+'"]',C)}function p(v,C){C.waypoints.forEach(function(R,b){var k=ur(v);(0,N.append)(v,k),zt(k,R.x,R.y)}),ur(v,"floating")}function f(v,C){for(var R=C.waypoints,b,k,B,_=1;_<R.length;_++)b=R[_-1],k=R[_],nn(b,k)&&(B=kd(v,b,k),(0,N.attr)(B,{"data-segment-idx":_}),c(B,"mousemove",C))}function h(v){(0,S.forEach)((0,W.queryAll)("."+Cd,v),function(C){(0,N.remove)(C)})}function g(v){(0,S.forEach)((0,W.queryAll)("."+xd,v),function(C){(0,N.remove)(C)})}function m(v){var C=d(v);return C||(C=d(v,!0),p(C,v),f(C,v)),C}function y(v){var C=d(v);C&&(g(C),h(C),f(C,v),p(C,v))}function w(v,C){var R=(0,W.query)(".floating",v),b=C.point;R&&zt(R,b.x,b.y)}function x(v,C,R){var b=u(C.index,v),k=R[C.index-1],B=R[C.index],_=C.point,V=jl(k,B),T=nn(k,B),F,L;b&&(F=jv(b),L={x:_.x-V.x,y:_.y-V.y},T==="v"&&(L={x:L.y,y:L.x}),zt(F,L.x,L.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var C=d(v.element);C&&(0,N.remove)(C)}),e.on("element.marker.update",function(v){var C=v.element,R;C.waypoints&&(R=m(C),v.add?(0,N.classes)(R).add(v.marker):(0,N.classes)(R).remove(v.marker))}),e.on("element.mousemove",function(v){var C=v.element,R=C.waypoints,b,k;if(R){if(b=d(C,!0),k=dr(t,R,v.originalEvent),!k)return;w(b,k),k.bendpoint||x(b,k,R)}}),e.on("element.mousedown",function(v){if(en(v)){var C=v.originalEvent,R=v.element;if(R.waypoints)return s(C,R)}}),e.on("selection.changed",function(v){var C=v.newSelection[0];C&&C.waypoints&&m(C)}),e.on("element.hover",function(v){var C=v.element;C.waypoints&&(m(C),o.registerEvent(v.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(v){o.unregisterEvent(v.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(v){var C=v.element,R=v.newId;if(C.waypoints){var b=d(C);b&&(0,N.attr)(b,{"data-element-id":R})}}),this.addHandles=m,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}Sd.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function jv(e){return(0,W.query)(".djs-visual",e)}var Ed=Math.round,Mn="reconnectStart",Vn="reconnectEnd",Vo="updateWaypoints";function hr(e,t,o,a,l,r){this._injector=e,this.start=function(i,s,c,d){var u=o.getGraphics(s),p=s.source,f=s.target,h=s.waypoints,g;!d&&c===0?g=Mn:!d&&c===h.length-1?g=Vn:g=Vo;var m=g===Vo?"connection.updateWaypoints":"connection.reconnect",y=l.allowed(m,{connection:s,source:p,target:f});y===!1&&(y=l.allowed(m,{connection:s,source:f,target:p})),y!==!1&&a.init(i,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:d,type:g}}})},t.on("bendpoint.move.hover",function(i){var s=i.context,c=s.connection,d=c.source,u=c.target,p=i.hover,f=s.type;s.hover=p;var h;if(p){var g=f===Vo?"connection.updateWaypoints":"connection.reconnect";if(h=s.allowed=l.allowed(g,{connection:c,source:f===Mn?p:d,target:f===Vn?p:u}),h){s.source=f===Mn?p:d,s.target=f===Vn?p:u;return}h===!1&&(h=s.allowed=l.allowed(g,{connection:c,source:f===Vn?p:u,target:f===Mn?p:d})),h&&(s.source=f===Vn?p:u,s.target=f===Mn?p:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(i){var s=i.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Vo&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(i){var s=i.context,c=s.allowed,d=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),h=s.source,g=s.target,m=s.type,y=s.hints||{},w={x:Ed(i.x),y:Ed(i.y)};if(!c)return!1;m===Vo?(p?f.splice(d,0,w):f[d]=w,y.bendpointMove={insert:p,bendpointIndex:d},f=this.cropWaypoints(u,f),r.updateWaypoints(u,Dy(f),y)):(m===Mn?(y.docking="source",Na(s)&&(y.docking="target",y.newWaypoints=f.reverse())):m===Vn&&(y.docking="target",Na(s)&&(y.docking="source",y.newWaypoints=f.reverse())),r.reconnect(u,h,g,w,y))},this)}hr.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],hr.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Na(e){var t=e.hover,o=e.source,a=e.target,l=e.type;if(l===Mn)return t&&a&&t===a&&o!==a;if(l===Vn)return t&&o&&t===o&&o!==a}var Ov="reconnectStart",Iv="reconnectEnd",Bd="updateWaypoints",No="connect-ok",Aa="connect-not-ok",Rd="connect-hover",_d="djs-updating",Td="djs-dragging",Md=1100;function Vd(e,t,o,a){this._injector=t;var l=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(r){var i=r.context,s=i.bendpointIndex,c=i.connection,d=i.insert,u=c.waypoints,p=u.slice();i.waypoints=u,d&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p,(0,N.classes)(i.draggerGfx=ur(a.getLayer("overlays"))).add("djs-dragging"),a.addMarker(c,Td),a.addMarker(c,_d)}),o.on("bendpoint.move.hover",function(r){var i=r.context,s=i.allowed,c=i.hover,d=i.type;if(c){if(a.addMarker(c,Rd),d===Bd)return;s?(a.removeMarker(c,Aa),a.addMarker(c,No)):s===!1&&(a.removeMarker(c,No),a.addMarker(c,Aa))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],Md,function(r){var i=r.context,s=i.hover,c=i.target;s&&(a.removeMarker(s,Rd),a.removeMarker(s,c?No:Aa))}),o.on("bendpoint.move.move",function(r){var i=r.context,s=i.allowed,c=i.bendpointIndex,d=i.draggerGfx,u=i.hover,p=i.type,f=i.connection,h=f.source,g=f.target,m=f.waypoints.slice(),y={x:r.x,y:r.y},w=i.hints||{},x={};l&&(w.connectionStart&&(x.connectionStart=w.connectionStart),w.connectionEnd&&(x.connectionEnd=w.connectionEnd),p===Ov?Na(i)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||h,m=m.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||h,x.target=g):p===Iv?Na(i)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=h,m=m.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=h,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,m[c]=y),p===Bd&&(m=e.cropWaypoints(f,m)),x.waypoints=m,l.drawPreview(i,s,x)),zt(d,r.x,r.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],Md,function(r){var i=r.context,s=i.connection,c=i.draggerGfx,d=i.hover,u=i.target;s.waypoints=i.waypoints,(0,N.remove)(c),a.removeMarker(s,_d),a.removeMarker(s,Td),d&&(a.removeMarker(d,No),a.removeMarker(d,u?No:Aa)),l&&l.cleanUp(i)})}Vd.$inject=["bendpointMove","injector","eventBus","canvas"];var Nd="connect-hover",Ad="djs-updating";function Pd(e,t,o){return gr(e,t,e[t]+o)}function gr(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function zv(e,t,o,a){var l=Math.max(t[a],o[a]),r=Math.min(t[a],o[a]),i=20;return gr(t,a,Math.min(Math.max(r+i,e[a]),l-i))}function jd(e){return e==="x"?"y":"x"}function Od(e,t,o){var a,l;return e.original?e.original:(a=qe(t),l=jd(o),gr(e,l,a[l]))}function Id(e,t,o,a,l,r){var i=e.get("connectionDocking",!1);this.start=function(p,f,h){var g,m=o.getGraphics(f),y=h-1,w=h,x=f.waypoints,v=x[y],C=x[w],R=dr(o,x,p),b=nn(v,C),k,B;b&&(k=b==="v"?"x":"y",y===0&&(v=Od(v,f.source,k)),w===x.length-1&&(C=Od(C,f.target,k)),R?B=R.point:B={x:(v.x+C.x)/2,y:(v.y+C.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:w,segmentStart:v,segmentEnd:C,axis:k,dragPosition:B},a.init(p,B,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:g}}))};function s(p,f){if(!i)return f;var h=p.waypoints,g;return p.waypoints=f,g=i.getCroppedWaypoints(p),p.waypoints=h,g}function c(p){l.update("connection",p.connection,p.connectionGfx)}function d(p,f,h){var g=p.newWaypoints,m=g[p.segmentStartIndex+f],y=g[p.segmentEndIndex+f],w=zv(h,m,y,jd(p.axis));zt(p.draggerGfx,w.x,w.y)}function u(p,f){var h=0;return{waypoints:p.filter(function(g,m){return Pl(p[m-1],p[m+1],g)?(h=m<=f?h-1:h,!1):!0}),segmentOffset:h}}t.on("connectionSegment.move.start",function(p){var f=p.context,h=p.connection,g=o.getLayer("overlays");f.originalWaypoints=h.waypoints.slice(),f.draggerGfx=kd(g,f.segmentStart,f.segmentEnd),(0,N.classes)(f.draggerGfx).add("djs-dragging"),o.addMarker(h,Ad)}),t.on("connectionSegment.move.move",function(p){var f=p.context,h=f.connection,g=f.segmentStartIndex,m=f.segmentEndIndex,y=f.segmentStart,w=f.segmentEnd,x=f.axis,v=f.originalWaypoints.slice(),C=Pd(y,x,p["d"+x]),R=Pd(w,x,p["d"+x]),b=v.length,k=0;v[g]=C,v[m]=R;var B,_;g<2&&(B=rn(h.source,C),g===1?B==="intersect"&&(v.shift(),v[0]=C,k--):B!=="intersect"&&(v.unshift(y),k++)),m>b-3&&(_=rn(h.target,R),m===b-2?_==="intersect"&&(v.pop(),v[v.length-1]=R):_!=="intersect"&&v.push(w)),f.newWaypoints=h.waypoints=s(h,v),d(f,k,p),f.newSegmentStartIndex=g+k,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,o.addMarker(p.hover,Nd)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&o.removeMarker(f,Nd)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,h=f.connection;f.draggerGfx&&(0,N.remove)(f.draggerGfx),o.removeMarker(h,Ad)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,h=f.connection;h.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,h=f.connection,g=f.newWaypoints,m=f.newSegmentStartIndex;g=g.map(function(R){return{original:R.original,x:Math.round(R.x),y:Math.round(R.y)}});var y=u(g,m),w=y.waypoints,x=s(h,w),v=y.segmentOffset,C={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+v}};r.updateWaypoints(h,x,C)})}Id.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Lv=Math.abs,zd=Math.round;function Hv(e,t,o){o=o===void 0?10:o;var a,l;for(a=0;a<t.length;a++)if(l=t[a],Lv(l-e)<=o)return l}function Dv(e){return{x:e.x,y:e.y}}function Fv(e){return{x:e.x+e.width,y:e.y+e.height}}function oo(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:zd(e.x+e.width/2),y:zd(e.y+e.height/2)}}function Pa(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function Xt(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,l=e[t],r=e.snapped=e.snapped||{};return o===!1?r[t]=!1:(r[t]=!0,a=o-l,e[t]+=a,e["d"+t]+=a),l}function Ld(e){return e.children||[]}var $v=Math.abs,Hd=Math.round,mr=10;function Dd(e){function t(r,i){if((0,S.isArray)(r)){for(var s=r.length;s--;)if($v(r[s]-i)<=mr)return r[s]}else{r=+r;var c=i%r;if(c<mr)return i-c;if(c>r-mr)return i-c+r}return i}function o(r,i){if(r.waypoints)return Nv(i,r);if(r.width)return{x:Hd(r.width/2+r.x),y:Hd(r.height/2+r.y)}}function a(r){var i=r.context,s=i.snapPoints,c=i.connection,d=c.waypoints,u=i.segmentStart,p=i.segmentStartIndex,f=i.segmentEnd,h=i.segmentEndIndex,g=i.axis;if(s)return s;var m=[d[p-1],u,f,d[h+1]];return p<2&&m.unshift(o(c.source,r)),h>d.length-3&&m.unshift(o(c.target,r)),i.snapPoints=s={horizontal:[],vertical:[]},(0,S.forEach)(m,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var i=a(r),s=r.x,c=r.y,d,u;if(i){d=t(i.vertical,s),u=t(i.horizontal,c);var p=s-d,f=c-u;(0,S.assign)(r,{dx:r.dx-p,dy:r.dy-f,x:d,y:u}),(p||i.vertical.indexOf(s)!==-1)&&Xt(r,"x",d),(f||i.horizontal.indexOf(c)!==-1)&&Xt(r,"y",u)}});function l(r){var i=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(i)return i;var d=[s[c-1],s[c+1]];return r.snapPoints=i={horizontal:[],vertical:[]},(0,S.forEach)(d,function(u){u&&(u=u.original||u,i.horizontal.push(u.y),i.vertical.push(u.x))}),i}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var i=r.context.hover,s=i&&o(i,r);!vt(i)||!s||!s.x||!s.y||(Xt(r,"x",s.x),Xt(r,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var i=r.context,s=l(i),c=i.hover,d=c&&o(c,r),u=r.x,p=r.y,f,h;if(s){f=t(d?s.vertical.concat([d.x]):s.vertical,u),h=t(d?s.horizontal.concat([d.y]):s.horizontal,p);var g=u-f,m=p-h;(0,S.assign)(r,{dx:r.dx-g,dy:r.dy-m,x:r.x-g,y:r.y-m}),(g||s.vertical.indexOf(u)!==-1)&&Xt(r,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Xt(r,"y",h)}})}Dd.$inject=["eventBus"];var Wv={__depends__:[kn,Zn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Sd],bendpointMove:["type",hr],bendpointMovePreview:["type",Vd],connectionSegmentMove:["type",Id],bendpointSnapping:["type",Dd]},Uv="djs-dragger";function Zt(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Zt.$inject=["injector","canvas","graphicsFactory","elementFactory"],Zt.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,l=e.getConnection,r=o.source,i=o.target,s=o.waypoints,c=o.connectionStart,d=o.connectionEnd,u=o.noLayout,p=o.noCropping,f=o.noNoop,h,g=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),(0,N.clear)(a),l||(l=e.getConnection=Jv(function(m,y,w){return g.getConnection(m,y,w)})),t&&(h=l(t,r,i)),!h){!f&&this.drawNoopPreview(a,o);return}h.waypoints=s||[],this._layouter&&!u&&(h.waypoints=this._layouter.layoutConnection(h,{source:r,target:i,connectionStart:c,connectionEnd:d,waypoints:o.waypoints||h.waypoints})),(!h.waypoints||!h.waypoints.length)&&(h.waypoints=[r?qe(r):c,i?qe(i):d]),this._connectionDocking&&(r||i)&&!p&&(h.waypoints=this._connectionDocking.getCroppedWaypoints(h,r,i)),this._graphicsFactory.drawConnection(a,h,{stroke:"var(--element-dragger-color)"})},Zt.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,l=t.connectionStart||qe(o),r=t.connectionEnd||qe(a),i=this.cropWaypoints(l,r,o,a);(0,N.append)(e,this.createNoopConnection(i[0],i[1]))},Zt.prototype.cropWaypoints=function(e,t,o,a){var l=this._graphicsFactory,r=o&&l.getShapePath(o),i=a&&l.getShapePath(a),s=l.getConnectionPath({waypoints:[e,t]});return e=o&&zl(r,s,!0)||e,t=a&&zl(i,s,!1)||t,[e,t]},Zt.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&(0,N.remove)(e.connectionPreviewGfx)},Zt.prototype.getConnection=function(e){var t=Yv(e);return this._elementFactory.createConnection(t)},Zt.prototype.createConnectionPreviewGfx=function(){var e=(0,N.create)("g");return(0,N.attr)(e,{pointerEvents:"none"}),(0,N.classes)(e).add(Uv),(0,N.append)(this._canvas.getActiveLayer(),e),e},Zt.prototype.createNoopConnection=function(e,t){return Rl([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Jv(e){var t={};return function(o){var a=JSON.stringify(o),l=t[a];return l||(l=t[a]=e.apply(null,arguments)),l}}function Yv(e){return(0,S.isObject)(e)?e:{}}var Kv={__init__:["connectionPreview"],connectionPreview:["type",Zt]},Gv=new da("ov"),qv=500;function it(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=Gv,this._overlayDefaults=(0,S.assign)({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Xv(o.getContainer()),this._init()}it.$inject=["config.overlays","eventBus","canvas","elementRegistry"],it.prototype.get=function(e){if((0,S.isString)(e)&&(e={id:e}),(0,S.isString)(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?(0,S.filter)(t.overlays,(0,S.matchPattern)({type:e.type})):t.overlays.slice():[]}else return e.type?(0,S.filter)(this._overlays,(0,S.matchPattern)({type:e.type})):e.id?this._overlays[e.id]:null},it.prototype.add=function(e,t,o){if((0,S.isObject)(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=(0,S.assign)({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},it.prototype.remove=function(e){var t=this.get(e)||[];(0,S.isArray)(t)||(t=[t]);var o=this;(0,S.forEach)(t,function(a){var l=o._getOverlayContainer(a.element,!0);if(a&&((0,W.remove)(a.html),(0,W.remove)(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),l){var r=l.overlays.indexOf(a);r!==-1&&l.overlays.splice(r,1)}})},it.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},it.prototype.show=function(){ja(this._overlayRoot)},it.prototype.hide=function(){ja(this._overlayRoot,!1)},it.prototype.clear=function(){this._overlays={},this._overlayContainers=[],(0,W.clear)(this._overlayRoot)},it.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,l=t.y;if(t.waypoints){var r=It(t);a=r.x,l=r.y}Fd(o,a,l),(0,W.attr)(e.html,"data-container-id",t.id)},it.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,l=t.left,r=t.top;if(t.right!==void 0){var i;a.waypoints?i=It(a).width:i=a.width,l=t.right*-1+i}if(t.bottom!==void 0){var s;a.waypoints?s=It(a).height:s=a.height,r=t.bottom*-1+s}Fd(o,l||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},it.prototype._createOverlayContainer=function(e){var t=(0,W.domify)('<div class="djs-overlays" />');(0,W.assignStyle)(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},it.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";$d(this._overlayRoot,o)},it.prototype._getOverlayContainer=function(e,t){var o=(0,S.find)(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},it.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,l,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),(0,S.isString)(a)&&(a=(0,W.domify)(a)),r=this._getOverlayContainer(o),l=(0,W.domify)('<div class="djs-overlay" data-overlay-id="'+t+'">'),(0,W.assignStyle)(l,{position:"absolute"}),l.appendChild(a),e.type&&(0,W.classes)(l).add("djs-overlay-"+e.type);var i=this._canvas.findRoot(o),s=this._canvas.getRootElement();ja(l,i===s),e.htmlContainer=l,r.overlays.push(e),r.html.appendChild(l),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},it.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),l=o&&o.minZoom,r=o&&o.maxZoom,i=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(a!==s||o&&((0,S.isDefined)(l)&&l>t.scale||(0,S.isDefined)(r)&&r<t.scale))&&(c=!1),ja(i,c),this._updateOverlayScale(e,t)},it.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,l,r=e.htmlContainer,i,s="";o!==!0&&(o===!1?(a=1,l=1):(a=o.min,l=o.max),(0,S.isDefined)(a)&&t.scale<a&&(i=(1/t.scale||1)*a),(0,S.isDefined)(l)&&t.scale>l&&(i=(1/t.scale||1)*l)),(0,S.isDefined)(i)&&(s="scale("+i+","+i+")"),$d(r,s)},it.prototype._updateOverlaysVisibilty=function(e){var t=this;(0,S.forEach)(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},it.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var l=a.element;(0,S.forEach)(t.get({element:l}),function(s){t.remove(s.id)});var r=t._getOverlayContainer(l);if(r){(0,W.remove)(r.html);var i=t._overlayContainers.indexOf(r);i!==-1&&t._overlayContainers.splice(i,1)}}),e.on("element.changed",qv,function(a){var l=a.element,r=t._getOverlayContainer(l,!0);r&&((0,S.forEach)(r.overlays,function(i){t._updateOverlay(i)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(a){var l=t._getOverlayContainer(a.element,!0);l&&(0,W.classes)(l.html)[a.add?"add":"remove"](a.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function Xv(e){var t=(0,W.domify)('<div class="djs-overlay-container" />');return(0,W.assignStyle)(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Fd(e,t,o){(0,W.assignStyle)(e,{left:t+"px",top:o+"px"})}function ja(e,t){e.style.display=t===!1?"none":""}function $d(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}var Zv={__init__:["overlays"],overlays:["type",it]},Qv=new da;function ao(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ao.$inject=["eventBus"],ao.prototype.schedule=function(e,t=Qv.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},ao.prototype._schedule=function(e,t){const o=ew();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(a){o.reject(a)}}catch(a){console.error("Scheduler#_schedule execution failed",a)}}),promise:o.promise}},ao.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ao.prototype._cancel=function(e){clearTimeout(e.executionId)};function ew(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}var tw={scheduler:["type",ao]},nw="djs-element-hidden",Oa=".entry",ow=1e3,Wd=8,aw=300;function et(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}et.$inject=["canvas","elementRegistry","eventBus","scheduler"],et.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var l=a.target,r=(0,S.isArray)(l)?l:[l];if(r.filter(function(s){return o.includes(s)}).length){e.close();var i=r.filter(function(s){return e._elementRegistry.get(s.id)});i.length&&e._updateAndOpen(i.length>1?i:i[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current;((0,S.isArray)(a.target)?a.target:[a.target]).includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},et.prototype._createContainer=function(){var e=(0,W.domify)('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},et.prototype.registerProvider=function(e,t){t||(t=e,e=ow),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},et.prototype.getEntries=function(e){var t=this._getProviders(),o=(0,S.isArray)(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return(0,S.forEach)(t,function(l){if((0,S.isFunction)(l[o])){var r=l[o](e);(0,S.isFunction)(r)?a=r(a):(0,S.forEach)(r,function(i,s){a[s]=i})}}),a},et.prototype.trigger=function(e,t,o){var a=this,l,r,i=t.delegateTarget||t.target;if(!i)return t.preventDefault();if(l=(0,W.attr)(i,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(l,"hover",r,o)},aw);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(l,e,r,o)},et.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var l=this._current.target,r=this._current.entries[e];if(r){var i=r.action;if(this._eventBus.fire("contextPad.trigger",{entry:r,event:o})!==!1){if((0,S.isFunction)(i)){if(t==="click")return i(o,l,a)}else if(i[t])return i[t](o,l,a);o.preventDefault()}}}},et.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},et.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},et.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;(0,S.forEach)(t,function(l,r){var i=l.group||"default",s=(0,W.domify)(l.html||'<div class="entry" draggable="true"></div>'),c;(0,W.attr)(s,"data-action",r),c=(0,W.query)("[data-group="+pr(i)+"]",o),c||(c=(0,W.domify)('<div class="group"></div>'),(0,W.attr)(c,"data-group",i),o.appendChild(c)),c.appendChild(s),l.className&&lw(s,l.className),l.title&&(0,W.attr)(s,"title",l.title),l.imageUrl&&(a=(0,W.domify)("<img>"),(0,W.attr)(a,"src",l.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),(0,W.classes)(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},et.prototype._createHtml=function(e){var t=this,o=(0,W.domify)('<div class="djs-context-pad"></div>');return W.delegate.bind(o,Oa,"click",function(a){t.trigger("click",a)}),W.delegate.bind(o,Oa,"dragstart",function(a){t.trigger("dragstart",a)}),W.delegate.bind(o,Oa,"mouseover",function(a){t.trigger("mouseover",a)}),W.delegate.bind(o,Oa,"mouseout",function(a){t.trigger("mouseout",a)}),W.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},et.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&iw(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},et.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},et.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return(0,S.isArray)(e)!==(0,S.isArray)(o)?!1:(0,S.isArray)(e)?e.length===o.length&&(0,S.every)(e,function(a){return o.includes(a)}):o===e},et.prototype.isShown=function(){return this.isOpen()&&(0,W.classes)(this._current.html).has("open")},et.prototype.show=function(){this.isOpen()&&((0,W.classes)(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},et.prototype.hide=function(){this.isOpen()&&((0,W.classes)(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},et.prototype._getPosition=function(e){if(!(0,S.isArray)(e)&&vt(e)){var t=this._canvas.viewbox(),o=rw(e),a=o.x*t.scale-t.x*t.scale,l=o.y*t.scale-t.y*t.scale;return{left:a+Wd*this._canvas.zoom(),top:l}}var r=this._canvas.getContainer().getBoundingClientRect(),i=this._getTargetBounds(e);return{left:i.right-r.left+Wd*this._canvas.zoom(),top:i.top-r.top}},et.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},et.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target;((0,S.isArray)(o)?o:[o]).some(function(a){return t._canvas.hasMarker(a,nw)})?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},et.prototype._getTargetBounds=function(e){var t=this;return((0,S.isArray)(e)?e:[e]).map(function(o){return t._canvas.getGraphics(o)}).reduce(function(o,a){const l=a.getBoundingClientRect();return o.top=Math.min(o.top,l.top),o.right=Math.max(o.right,l.right),o.bottom=Math.max(o.bottom,l.bottom),o.left=Math.min(o.left,l.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function lw(e,t){var o=(0,W.classes)(e);t=(0,S.isArray)(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function rw(e){return e.waypoints[e.waypoints.length-1]}function iw(e,t){return e=(0,S.isArray)(e)?e:[e],t=(0,S.isArray)(t)?t:[t],e.length===t.length&&(0,S.every)(e,function(o){return t.includes(o)})}var sw={__depends__:[_l,tw,Zv],contextPad:["type",et]},cw=250;function Nn(e){this._eventBus=e,this._tools=[],this._active=null}Nn.$inject=["eventBus"],Nn.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},Nn.prototype.isActive=function(e){return e&&this._active===e},Nn.prototype.length=function(e){return this._tools.length},Nn.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Nn.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.on(t.tool+".init",function(l){if(!l.context.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),(0,S.forEach)(t,function(l){a.push(l+".ended"),a.push(l+".canceled")}),o.on(a,cw,function(l){this._active&&(dw(l)||this.setActive(null))},this)};function dw(e){var t=e.originalEvent&&e.originalEvent.target;return t&&(0,W.closest)(t,'.group[data-group="tools"]')}var yr={__depends__:[kn],__init__:["toolManager"],toolManager:["type",Nn]};function br(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){(t._svg=a.svg).addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}br.$inject=["eventBus"],br.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||uw(0,0)};function uw(e,t){var o=document.createEvent("MouseEvent"),a=e,l=t,r=e,i=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,l,r,i,!1,!1,!1,!1,0,null),o}var vr={__init__:["mouse"],mouse:["type",br]},wr=1500,Ud="grab";function lo(e,t,o,a,l,r){this._dragging=o,this._mouse=r;var i=this,s=a.get("keyboard",!1);l.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",wr,function(c){if(Ts(c))return i.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(wr,function(c){if(!(!Jd(c.keyEvent)||i.isActive())){var d=i._mouse.getLastMoveEvent();i.activateMove(d,!!d)}},"keyboard.keydown"),s&&s.addListener(wr,function(c){!Jd(c.keyEvent)||!i.isActive()||i.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var d=c.originalEvent.target;if(!c.hover&&!(d instanceof SVGElement))return!1;e.once("hand.ended",function(){i.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var d=t.viewbox().scale;t.scroll({dx:c.dx*d,dy:c.dy*d})}),e.on("hand.move.end",function(c){var d=c.context.reactivate;return!Ts(c)&&d&&e.once("hand.move.ended",function(u){i.activateHand(u.originalEvent,!0,!0)}),!1})}lo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],lo.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Ud,data:{context:o||{}}})},lo.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Ud,data:{context:{reactivate:o}}})},lo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},lo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Jd(e){return Ds("Space",e)}var fw={__depends__:[yr,vr],__init__:["handTool"],handTool:["type",lo]},Yd="crosshair";function An(e,t,o,a,l,r,i){this._selection=l,this._dragging=o,this._mouse=i;var s=this,c={create:function(d){var u=t.getActiveLayer(),p=d.frame=(0,N.create)("rect");(0,N.attr)(p,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),(0,N.append)(u,p)},update:function(d){var u=d.frame,p=d.bbox;(0,N.attr)(u,{x:p.x,y:p.y,width:p.width,height:p.height})},remove:function(d){d.frame&&(0,N.remove)(d.frame)}};r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(d){var u=d.originalEvent.target;!d.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(d.originalEvent,!0)})}),e.on("lasso.end",0,function(d){var u=d.context,p=Cr(d),f=a.filter(function(g){return g}),h=Sl(d);s.select(f,p,h?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=Cr(d),c.create(u),u.selection=l.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=Cr(d),c.update(u)}),e.on("lasso.cleanup",function(d){var u=d.context;c.remove(u)}),e.on("element.mousedown",1500,function(d){if(Sl(d))return s.activateLasso(d.originalEvent),!0})}An.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],An.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Yd,data:{context:{}}})},An.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Yd,data:{context:{}},keepSelection:!0})},An.prototype.select=function(e,t,o=[]){var a=uy(e,t);this._selection.select([...o,...(0,S.values)(a)])},An.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},An.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Cr(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}var pw={__depends__:[yr,vr],__init__:["lassoTool"],lassoTool:["type",An]},Kd="connect-ok",Gd="connect-not-ok";function ro(e,t,o,a,l,r,i){var s=this;this._dragging=t,this._rules=r,this._mouse=i,l.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var d=c.context,u=c.hover,p=d.canStartConnect=s.canStartConnect(u);p!==null&&(d.startTarget=u,a.addMarker(u,p?Kd:Gd))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var d=c.context.startTarget,u=c.context.canStartConnect;d&&a.removeMarker(d,u?Kd:Gd)}),e.on(["global-connect.ended"],function(c){var d=c.context.startTarget,u={x:c.x,y:c.y};if(s.canStartConnect(d))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,d,u)}),!1})}ro.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ro.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ro.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ro.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ro.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var hw={__depends__:[Hl,Zn,kn,yr,vr],globalConnect:["type",ro]},gw=500,mw=1e3;function Pn(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function l(r){var i=(0,N.create)("rect");return(0,N.attr)(i,(0,S.assign)({x:0,y:0,rx:4,width:100,height:100},o)),i}e.on(["shape.added","shape.changed"],gw,function(r){var i=r.element,s=r.gfx,c=(0,W.query)(".djs-outline",s);c||(c=a.getOutline(i)||l(s),(0,N.append)(s,c)),a.updateShapeOutline(c,i)}),e.on(["connection.added","connection.changed"],function(r){var i=r.element,s=r.gfx,c=(0,W.query)(".djs-outline",s);c||(c=l(s),(0,N.append)(s,c)),a.updateConnectionOutline(c,i)})}Pn.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&(0,S.forEach)(a,function(l){o=o||l.updateOutline(t,e)}),o||(0,N.attr)(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},Pn.prototype.updateConnectionOutline=function(e,t){var o=It(t);(0,N.attr)(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},Pn.prototype.registerProvider=function(e,t){t||(t=e,e=mw),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},Pn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Pn.prototype.getOutline=function(e){var t;return(0,S.forEach)(this._getProviders(),function(o){(0,S.isFunction)(o.getOutline)&&(t=t||o.getOutline(e))}),t},Pn.$inject=["eventBus","styles","elementRegistry"];var Ia=6;function xr(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(l){o.isSelected(l.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(l){var r=l.newSelection;a._updateMultiSelectionOutline(r)})}xr.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");(0,N.clear)(t);var o=e.length>1;if((0,N.classes)(this._canvas.getContainer())[o?"add":"remove"]("djs-multi-select"),!!o){var a=yw(It(e)),l=(0,N.create)("rect");(0,N.attr)(l,(0,S.assign)({rx:3},a)),(0,N.classes)(l).add("djs-selection-outline"),(0,N.append)(t,l)}},xr.$inject=["eventBus","canvas","selection"];function yw(e){return{x:e.x-Ia,y:e.y-Ia,width:e.width+Ia*2,height:e.height+Ia*2}}var qd={__depends__:[Gn],__init__:["outline","multiSelectionOutline"],outline:["type",Pn],multiSelectionOutline:["type",xr]},bw=500,vw=1250,ww=1500,za=Math.round;function Cw(e){return{x:e.x+za(e.width/2),y:e.y+za(e.height/2)}}function Xd(e,t,o,a,l){function r(s,c,d,u){return l.allowed("elements.move",{shapes:s,delta:c,position:d,target:u})}e.on("shape.move.start",ww,function(s){var c=s.context,d=s.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=xw(u),(0,S.assign)(c,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",vw,function(s){var c=s.context,d=c.validatedShapes;if(!(c.canExecute=r(d)))return!1}),e.on("shape.move.move",bw,function(s){var c=s.context,d=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f=r(d,p,{x:s.x,y:s.y},u);if(c.delta=p,c.canExecute=f,f===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,d=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;d.x=za(d.x),d.y=za(d.y),!(d.x===0&&d.y===0)&&o.moveElements(f,d,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(en(s)){var c=Jn(s);if(!c)throw new Error("must supply DOM mousedown event");return i(c,s.element)}});function i(s,c,d,u){if((0,S.isObject)(d)&&(u=d,d=!1),!(c.waypoints||!c.parent)&&!(0,N.classes)(s.target).has("djs-hit-no-move")){var p=Cw(c);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:c,context:u||{}}}),!0}}this.start=i}Xd.$inject=["eventBus","dragging","modeling","selection","rules"];function xw(e){var t=(0,S.groupBy)(e,"id");return(0,S.filter)(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var Zd=499,kr="djs-dragging",Qd="drop-ok",eu="drop-not-ok",tu="new-parent",nu="attach-ok";function ou(e,t,o,a){function l(c){return kw(r(c))}function r(c){var d=cy(c,!0),u=d.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=d.concat(u);return[...new Set(p)]}function i(c,d){[nu,Qd,eu,tu].forEach(function(u){u===d?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,d,u){a.addDragger(d,c.dragGroup),u&&t.addMarker(d,kr),c.allDraggedElements?c.allDraggedElements.push(d):c.allDraggedElements=[d]}e.on("shape.move.start",Zd,function(c){var d=c.context,u=d.shapes,p=d.allDraggedElements,f=l(u);if(!d.dragGroup){var h=(0,N.create)("g");(0,N.attr)(h,o.cls("djs-drag-group",["no-events"])),(0,N.append)(t.getActiveLayer(),h),d.dragGroup=h}f.forEach(function(g){a.addDragger(g,d.dragGroup)}),p?p=(0,S.flatten)([p,r(u)]):p=r(u),(0,S.forEach)(p,function(g){t.addMarker(g,kr)}),d.allDraggedElements=p,d.differentParents=Sw(u)}),e.on("shape.move.move",Zd,function(c){var d=c.context,u=d.dragGroup,p=d.target,f=d.shape.parent,h=d.canExecute;p&&(h==="attach"?i(p,nu):d.canExecute&&f&&p.id!==f.id?i(p,tu):i(p,d.canExecute?Qd:eu)),zt(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var d=c.context.target;d&&i(d,null)}),e.on("shape.move.cleanup",function(c){var d=c.context,u=d.allDraggedElements,p=d.dragGroup;(0,S.forEach)(u,function(f){t.removeMarker(f,kr)}),p&&(0,N.remove)(p)}),this.makeDraggable=s}ou.$inject=["eventBus","canvas","styles","previewSupport"];function kw(e){return(0,S.filter)(e,function(t){return vt(t)?(0,S.find)(e,(0,S.matchPattern)({id:t.source.id}))&&(0,S.find)(e,(0,S.matchPattern)({id:t.target.id})):!0})}function Sw(e){return(0,S.size)((0,S.groupBy)(e,function(t){return t.parent&&t.parent.id}))!==1}var Ew={__depends__:[_l,Gn,qd,Zn,kn,Vl],__init__:["move","movePreview"],move:["type",Xd],movePreview:["type",ou]},au=".djs-palette-toggle",lu=".entry",Bw=au+", "+lu,Sr="djs-palette-",Rw="shown",Er="open",ru="two-column",_w=1e3;function tt(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var l=a.tool;o.updateToolHighlight(l)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}tt.$inject=["eventBus","canvas"],tt.prototype.registerProvider=function(e,t){t||(t=e,e=_w),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},tt.prototype.getEntries=function(){return this._getProviders().reduce(Mw,{})},tt.prototype._rebuild=function(){this._diagramInitialized&&this._getProviders().length&&(this._container||this._init(),this._update())},tt.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=(0,W.domify)(tt.HTML_MARKUP);o.appendChild(a),(0,W.classes)(o).add(Sr+Rw),W.delegate.bind(a,Bw,"click",function(l){var r=l.delegateTarget;if((0,W.matches)(r,au))return e.toggle();e.trigger("click",l)}),W.event.bind(a,"mousedown",function(l){l.stopPropagation()}),W.delegate.bind(a,lu,"dragstart",function(l){e.trigger("dragstart",l)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},tt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},tt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,l,r=(0,W.classes)(o),i=(0,W.classes)(t);"twoColumn"in e?l=e.twoColumn:l=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(ru,l),i.toggle(Sr+ru,l),"open"in e&&(r.toggle(Er,e.open),i.toggle(Sr+Er,e.open)),a.fire("palette.changed",{twoColumn:l,open:this.isOpen()})},tt.prototype._update=function(){var e=(0,W.query)(".djs-palette-entries",this._container),t=this._entries=this.getEntries();(0,W.clear)(e),(0,S.forEach)(t,function(o,a){var l=o.group||"default",r=(0,W.query)("[data-group="+pr(l)+"]",e);r||(r=(0,W.domify)('<div class="group"></div>'),(0,W.attr)(r,"data-group",l),e.appendChild(r));var i=(0,W.domify)(o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'));if(r.appendChild(i),!o.separator&&((0,W.attr)(i,"data-action",a),o.title&&(0,W.attr)(i,"title",o.title),o.className&&Tw(i,o.className),o.imageUrl)){var s=(0,W.domify)("<img>");(0,W.attr)(s,"src",o.imageUrl),i.appendChild(s)}}),this.open()},tt.prototype.trigger=function(e,t,o){var a,l,r=t.delegateTarget||t.target;return r?(a=(0,W.attr)(r,"data-action"),l=t.originalEvent||t,this.triggerEntry(a,e,l,o)):t.preventDefault()},tt.prototype.triggerEntry=function(e,t,o,a){var l=this._entries[e],r;if(l&&(r=l.action,this._eventBus.fire("palette.trigger",{entry:l,event:o})!==!1)){if((0,S.isFunction)(r)){if(t==="click")return r(o,a)}else if(r[t])return r[t](o,a);o.preventDefault()}},tt.prototype._layoutChanged=function(){this._toggleState({})},tt.prototype._needsCollapse=function(e,t){return e<Object.keys(t).length*46+50},tt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},tt.prototype.open=function(){this._toggleState({open:!0})},tt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},tt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},tt.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=(0,W.query)(".djs-palette-entries",this._container),this._toolsContainer=(0,W.query)("[data-group=tools]",t)),o=this._toolsContainer,(0,S.forEach)(o.children,function(a){var l=a.getAttribute("data-action");if(l){var r=(0,W.classes)(a);l=l.replace("-tool",""),r.contains("entry")&&l===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},tt.prototype.isOpen=function(){return(0,W.classes)(this._container).has(Er)},tt.prototype._getParentContainer=function(){return this._canvas.getContainer()},tt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Tw(e,t){var o=(0,W.classes)(e);((0,S.isArray)(t)?t:t.split(/\s+/g)).forEach(function(a){o.add(a)})}function Mw(e,t){var o=t.getPaletteEntries();return(0,S.isFunction)(o)?o(e):((0,S.forEach)(o,function(a,l){e[l]=a}),e)}var Vw={__init__:["palette"],palette:["type",tt]};function iu(e,t,o,a){e.on("element.changed",function(l){var r=l.element;(r.parent||r===t.getRootElement())&&(l.gfx=o.getGraphics(r)),l.gfx&&e.fire(fy(r)+".changed",l)}),e.on("elements.changed",function(l){var r=l.elements;r.forEach(function(i){e.fire("element.changed",{element:i})}),a.updateContainments(r)}),e.on("shape.changed",function(l){a.update("shape",l.element,l.gfx)}),e.on("connection.changed",function(l){a.update("connection",l.element,l.gfx)})}iu.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Nw={__init__:["changeSupport"],changeSupport:["type",iu]},La=Math.max,Ha=Math.min,Aw=20;function Pw(e,t,o){var a=o.x,l=o.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+l,r.height=e.height-l):t.indexOf("s")!==-1&&(r.height=e.height+l),t.indexOf("e")!==-1?r.width=e.width+a:t.indexOf("w")!==-1&&(r.x=e.x+a,r.width=e.width-a),r}function Da(e,t,o){var a=t[e],l=o.min&&o.min[e],r=o.max&&o.max[e];return(0,S.isNumber)(l)&&(a=(/top|left/.test(e)?Ha:La)(a,l)),(0,S.isNumber)(r)&&(a=(/top|left/.test(e)?La:Ha)(a,r)),a}function jw(e,t){if(!t)return e;var o=Oe(e);return hc({top:Da("top",o,t),right:Da("right",o,t),bottom:Da("bottom",o,t),left:Da("left",o,t)})}function Ow(e,t,o,a){var l=Oe(t),r={top:/n/.test(e)?l.bottom-o.height:l.top,left:/w/.test(e)?l.right-o.width:l.left,bottom:/s/.test(e)?l.top+o.height:l.bottom,right:/e/.test(e)?l.left+o.width:l.right},i=a?Oe(a):r;return hc({top:Ha(r.top,i.top),left:Ha(r.left,i.left),bottom:La(r.bottom,i.bottom),right:La(r.right,i.right)})}function Ao(e,t){return typeof e<"u"?e:Aw}function Iw(e,t){var o,a,l,r;return typeof t=="object"?(o=Ao(t.left),a=Ao(t.right),l=Ao(t.top),r=Ao(t.bottom)):o=a=l=r=Ao(t),{x:e.x-o,y:e.y-l,width:e.width+o+a,height:e.height+l+r}}function zw(e){return!(e.waypoints||e.type==="label")}function Lw(e,t){var o;if(e.length===void 0?o=(0,S.filter)(e.children,zw):o=e,o.length)return Iw(It(o),t)}var su=10;function Po(e,t,o,a){this._dragging=a,this._rules=t;var l=this;function r(c,d){var u=c.shape,p=c.direction,f=c.resizeConstraints,h;c.delta=d,h=Pw(u,p,d),c.newBounds=jw(h,f),c.canExecute=l.canResize(c)}function i(c){var d=c.resizeConstraints,u=c.minBounds;d===void 0&&(u===void 0&&(u=l.computeMinResizeBox(c)),c.resizeConstraints={min:Oe(u)})}function s(c){var d=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Iy(p),!Hw(d,p))return;o.resizeShape(d,p)}}e.on("resize.start",function(c){i(c.context)}),e.on("resize.move",function(c){var d={x:c.dx,y:c.dy};r(c.context,d)}),e.on("resize.end",function(c){s(c.context)})}Po.prototype.canResize=function(e){var t=this._rules,o=(0,S.pick)(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},Po.prototype.activate=function(e,t,o){var a=this._dragging,l,r;if(typeof o=="string"&&(o={direction:o}),l=(0,S.assign)({shape:t},o),r=l.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,cu(t,r),"resize",{autoActivate:!0,cursor:Dw(r),data:{shape:t,context:l}})},Po.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction;return Ow(o,t,e.minDimensions||{width:su,height:su},Lw(t,e.childrenBoxPadding))},Po.$inject=["eventBus","rules","modeling","dragging"];function Hw(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function cu(e,t){var o=qe(e),a=Oe(e),l={x:o.x,y:o.y};return t.indexOf("n")!==-1?l.y=a.top:t.indexOf("s")!==-1&&(l.y=a.bottom),t.indexOf("e")!==-1?l.x=a.right:t.indexOf("w")!==-1&&(l.x=a.left),l}function Dw(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var du="djs-resizing",uu="resize-not-ok",Fw=500;function fu(e,t,o){function a(r){var i=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=o.addFrame(i,t.getActiveLayer()),t.addMarker(i,du)),s.width>5&&(0,N.attr)(c,{x:s.x,width:s.width}),s.height>5&&(0,N.attr)(c,{y:s.y,height:s.height}),r.canExecute?(0,N.classes)(c).remove(uu):(0,N.classes)(c).add(uu)}function l(r){var i=r.shape;r.frame&&(0,N.remove)(r.frame),t.removeMarker(i,du)}e.on("resize.move",Fw,function(r){a(r.context)}),e.on("resize.cleanup",function(r){l(r.context)})}fu.$inject=["eventBus","canvas","previewSupport"];var Fa=-6,$a=8,Wa=20,jo="djs-resizer",$w=["n","w","s","e","nw","ne","se","sw"];function mn(e,t,o,a){this._resize=a,this._canvas=t;var l=this;e.on("selection.changed",function(r){var i=r.newSelection;l.removeResizers(),i.length===1&&(0,S.forEach)(i,(0,S.bind)(l.addResizer,l))}),e.on("shape.changed",function(r){var i=r.element;o.isSelected(i)&&(l.removeResizers(),l.addResizer(i))})}mn.prototype.makeDraggable=function(e,t,o){var a=this._resize;function l(r){en(r)&&a.activate(r,e,o)}W.event.bind(t,"mousedown",l),W.event.bind(t,"touchstart",l)},mn.prototype._createResizer=function(e,t,o,a){var l=this._getResizersParent(),r=Ww(a),i=(0,N.create)("g");(0,N.classes)(i).add(jo),(0,N.classes)(i).add(jo+"-"+e.id),(0,N.classes)(i).add(jo+"-"+a),(0,N.append)(l,i);var s=(0,N.create)("rect");(0,N.attr)(s,{x:-$a/2+r.x,y:-$a/2+r.y,width:$a,height:$a}),(0,N.classes)(s).add(jo+"-visual"),(0,N.append)(i,s);var c=(0,N.create)("rect");return(0,N.attr)(c,{x:-Wa/2+r.x,y:-Wa/2+r.y,width:Wa,height:Wa}),(0,N.classes)(c).add(jo+"-hit"),(0,N.append)(i,c),my(i,t,o),i},mn.prototype.createResizer=function(e,t){var o=cu(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},mn.prototype.addResizer=function(e){var t=this;vt(e)||!this._resize.canResize({shape:e})||(0,S.forEach)($w,function(o){t.createResizer(e,o)})},mn.prototype.removeResizers=function(){(0,N.clear)(this._getResizersParent())},mn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},mn.$inject=["eventBus","canvas","selection","resize"];function Ww(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Fa:e.indexOf("w")!==-1&&(t.x=Fa),e.indexOf("s")!==-1?t.y=-Fa:e.indexOf("n")!==-1&&(t.y=Fa),t}var Uw={__depends__:[Zn,kn,Vl],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Po],resizePreview:["type",fu],resizeHandles:["type",mn]};function Oo(e,t,o,a,l,r){this._canvas=t,this._modeling=a,this._textRenderer=r,o.registerProvider(this),e.on("element.dblclick",s=>{i(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{l.removeResizers()}),e.on("create.end",500,s=>{const{context:c,isTouch:d}=s,u=c.shape,{canExecute:p}=s.context;d||p&&(c.hints&&c.hints.createElementsBehavior===!1||i(u))}),e.on("autoPlace.end",500,s=>{i(s.shape)});function i(s,c){(c||tr(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&o.activate(s)}}Oo.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],Oo.prototype.activate=function(e){const t=Ea(e);if(t===void 0)return;const o={text:t};Ue(o,this.getEditingBBox(e));const a={};return(tr(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Ue(a,{centerVertically:!0}),nr(e)&&Ue(a,{autoResize:!0}),Ue(o,{options:a}),o},Oo.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),l={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},i=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),d=c.fontSize*i,u=c.lineHeight,p=s.fontSize*i,f=s.lineHeight,h={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(tr(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Ue(r,{width:a.width,height:a.height}),Ue(h,{fontSize:p+"px",lineHeight:f,paddingTop:7*i+"px",paddingBottom:7*i+"px",paddingLeft:5*i+"px",paddingRight:5*i+"px"}));const g=90*i,m=7*i,y=4*i;if(o.labelTarget&&(Ue(r,{width:g,height:a.height+m+y,x:l.x-g/2,y:a.y-m}),Ue(h,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})),nr(o)&&!qc(o)&&!To(o)){const w=Xc(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),v=d+m+y;Ue(r,{width:g,height:v,x:x.x-g/2,y:x.y-v/2}),Ue(h,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})}return{bounds:r,style:h}},Oo.prototype.update=function(e,t){let o;Jw(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function Jw(e){return!e||!e.trim()}var Yw={__depends__:[Nw,Uw,fl.default],__init__:["labelEditingProvider"],labelEditingProvider:["type",Oo]};function yn(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}yn.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},yn.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},yn.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},yn.prototype.getSnapLocations=function(){return this._snapLocations},yn.prototype.setSnapLocations=function(e){this._snapLocations=e},yn.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new Ua,o.initDefaults(this._defaultSnaps)),o};function Ua(){this._snapValues={}}Ua.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},Ua.prototype.snap=function(e,t,o,a){var l=this._snapValues[t];return l&&Hv(e[o],l[o],a)},Ua.prototype.initDefaults=function(e){var t=this;(0,S.forEach)(e||{},function(o,a){(0,S.forEach)(o,function(l){t.add(a,l)})})};var Kw=1250;function Ft(e,t,o){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(l){a.initSnap(l)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],Kw,function(l){var r=l.context,i=r.shape,s=r.snapContext,c=r.target;if(!(l.originalEvent&&Hs(l.originalEvent))&&!(Pa(l)||!c)){var d=s.pointsForTarget(c);d.initialized||(d=a.addSnapTargetPoints(d,i,c),d.initialized=!0),o.snap(l,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}Ft.$inject=["elementRegistry","eventBus","snapping"],Ft.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,l=o.snapContext;l||(l=o.snapContext=new yn);var r;t.get(a.id)?r=oo(a,e):r={x:e.x+oo(a).x,y:e.y+oo(a).y};var i={x:r.x-a.width/2,y:r.y-a.height/2},s={x:r.x+a.width/2,y:r.y+a.height/2};return l.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),Qn(a)||(l.setSnapOrigin("top-left",{x:i.x-e.x,y:i.y-e.y}),l.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),l},Ft.prototype.addSnapTargetPoints=function(e,t,o){return(0,S.forEach)(this.getSnapTargets(t,o),function(a){if(Qn(a)){Qn(t)&&e.add("mid",oo(a));return}if(vt(a)){if(a.waypoints.length<3)return;(0,S.forEach)(a.waypoints.slice(1,-1),function(l){e.add("mid",l)});return}e.add("mid",oo(a))}),!(0,S.isNumber)(t.x)||!(0,S.isNumber)(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",oo(t)),e},Ft.prototype.getSnapTargets=function(e,t){return Ld(t).filter(function(o){return!Gw(o)})};function Gw(e){return!!e.hidden}function io(e){e.invoke(Ft,this)}(0,Yt.default)(io,Ft),io.$inject=["injector"],io.prototype.initSnap=function(e){return Ft.prototype.initSnap.call(this,e)},io.prototype.addSnapTargetPoints=function(e,t,o){return Ft.prototype.addSnapTargetPoints.call(this,e,t,o)},io.prototype.getSnapTargets=function(e,t){return Ft.prototype.getSnapTargets.call(this,e,t)};var qw=1250;function Io(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],qw,function(a){var l=a.context,r=l.shape,i=r.parent,s=l.direction,c=l.snapContext;if(!(a.originalEvent&&Hs(a.originalEvent))&&!Pa(a)){var d=c.pointsForTarget(i);d.initialized||(d=o.addSnapTargetPoints(d,r,i,s),d.initialized=!0),Qw(s)&&Xt(a,"x",a.x),eC(s)&&Xt(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}Io.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,l=t.snapContext;l||(l=t.snapContext=new yn);var r=pu(o,a);return l.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),l},Io.prototype.addSnapTargetPoints=function(e,t,o,a){return(0,S.forEach)(this.getSnapTargets(t,o),function(l){e.add("corner",Fv(l)),e.add("corner",Dv(l))}),e.add("corner",pu(t,a)),e},Io.$inject=["eventBus","snapping"],Io.prototype.getSnapTargets=function(e,t){return Ld(t).filter(function(o){return!Xw(o,e)&&!vt(o)&&!Zw(o)&&!Qn(o)})};function pu(e,t){var o=qe(e),a=Oe(e),l={x:o.x,y:o.y};return t.indexOf("n")!==-1?l.y=a.top:t.indexOf("s")!==-1&&(l.y=a.bottom),t.indexOf("e")!==-1?l.x=a.right:t.indexOf("w")!==-1&&(l.x=a.left),l}function Xw(e,t){return e.host===t}function Zw(e){return!!e.hidden}function Qw(e){return e==="n"||e==="s"}function eC(e){return e==="e"||e==="w"}var tC=7,nC=1e3;function bn(e){this._canvas=e,this._asyncHide=(0,S.debounce)((0,S.bind)(this.hide,this),nC)}bn.$inject=["canvas"],bn.prototype.snap=function(e,t){var o=e.context.snapContext,a=o.getSnapLocations(),l={x:Pa(e,"x"),y:Pa(e,"y")};(0,S.forEach)(a,function(r){var i=o.getSnapOrigin(r),s={x:e.x+i.x,y:e.y+i.y};if((0,S.forEach)(["x","y"],function(c){var d;l[c]||(d=t.snap(s,r,c,tC),d!==void 0&&(l[c]={value:d,originValue:d-i[c]}))}),l.x&&l.y)return!1}),this.showSnapLine("vertical",l.x&&l.x.value),this.showSnapLine("horizontal",l.y&&l.y.value),(0,S.forEach)(["x","y"],function(r){var i=l[r];(0,S.isObject)(i)&&Xt(e,r,i.originValue)})},bn.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=(0,N.create)("path");return(0,N.attr)(o,{d:"M0,0 L0,0"}),(0,N.classes)(o).add("djs-snap-line"),(0,N.append)(t,o),{update:function(a){(0,S.isNumber)(a)?e==="horizontal"?(0,N.attr)(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):(0,N.attr)(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):(0,N.attr)(o,{display:"none"})}}},bn.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},bn.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},bn.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},bn.prototype.hide=function(){(0,S.forEach)(this._snapLines,function(e){e.update()})};var oC={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ft],resizeSnapping:["type",Io],snapping:["type",bn]},aC={__depends__:[oC],__init__:["createMoveSnapping"],createMoveSnapping:["type",io]};function so(e){ut.call(this,e),this.init()}so.$inject=["eventBus"],Sn(so,ut),so.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(l){a.canExecute(l,t,function(r,i,s){return o(r)},!0)})},so.prototype.init=function(){};function zo(e){so.call(this,e)}zo.$inject=["eventBus"],(0,Yt.default)(zo,so),zo.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},l=a.targetParent;if(a.targetAttach)return!1;l&&(o.parent=l);try{return Br(t,o)}finally{l&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,o=e.source,a=e.target;return Br(o,a,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return py(t)})},zo.prototype.canConnect=Br;function Br(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}var lC={__init__:["myRuleProvider"],myRuleProvider:["type",zo]};function Rr(e,t,o,a,l,r,i){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=l,this._palette=r,this._myOptions=i,r.registerProvider(this)}Rr.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],Rr.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,l=this._globalConnect,r=this._myOptions;function i(c,d,u,p,f){function h(g){const m=t.createShape(Ue({type:c},f));e.start(g,m)}return{group:d,className:u,title:p,action:{dragstart:h,click:h}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(c){o.activateHand(c)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(c){a.activateSelection(c)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(c){l.toggle(c)}}},"tool-separator":{group:"tools",separator:!0}};for(const c in r.palette){const d=r.palette[c];s[c]=i(d.type,d.group,d.className,d.title,d.options)}return s};var rC={__init__:["paletteProvider"],paletteProvider:["type",Rr]},LC=50,iC=250;function sC(e,t){t||(t={});function o(f){return f.source===e?1:-1}var a=t.defaultDistance||50,l=t.direction||"e",r=t.filter,i=t.getWeight||o,s=t.maxDistance||iC,c=t.reference||"start";r||(r=cC);function d(f,h){return l==="n"?c==="start"?Oe(f).top-Oe(h).bottom:c==="center"?Oe(f).top-qe(h).y:Oe(f).top-Oe(h).top:l==="w"?c==="start"?Oe(f).left-Oe(h).right:c==="center"?Oe(f).left-qe(h).x:Oe(f).left-Oe(h).left:l==="s"?c==="start"?Oe(h).top-Oe(f).bottom:c==="center"?qe(h).y-Oe(f).bottom:Oe(h).bottom-Oe(f).bottom:c==="start"?Oe(h).left-Oe(f).right:c==="center"?qe(h).x-Oe(f).right:Oe(h).right-Oe(f).right}var u=e.incoming.filter(r).map(function(f){var h=i(f),g=h<0?d(f.source,e):d(e,f.source);return{id:f.source.id,distance:g,weight:h}}),p=e.outgoing.filter(r).map(function(f){var h=i(f),g=h>0?d(e,f.target):d(f.target,e);return{id:f.target.id,distance:g,weight:h}});return(0,S.reduce)(u.concat(p).reduce(function(f,h){return f[h.id+"__weight_"+h.weight]=h,f},{}),function(f,h){var g=h.distance,m=h.weight;return g<0||g>s||(f[String(g)]||(f[String(g)]=0),f[String(g)]+=1*m,(!f.distance||f[f.distance]<f[String(g)])&&(f.distance=g)),f},{}).distance||a}function cC(){return!0}var dC=100;function hu(e,t,o){e.on("autoPlace",dC,function(a){var l=a.shape,r=a.source;return uC(r,l)}),e.on("autoPlace.end",function(a){o.scrollToElement(a.shape)}),this.append=function(a,l,r){e.fire("autoPlace.start",{source:a,shape:l});var i=e.fire("autoPlace",{source:a,shape:l}),s=t.appendShape(a,l,i,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:s}),s}}hu.$inject=["eventBus","modeling","canvas"];function uC(e,t,o){o||(o={});var a=o.defaultDistance||50,l=qe(e);return{x:Oe(e).right+a+t.width/2,y:l.y}}function gu(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}gu.$inject=["eventBus","selection"];var fC={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",hu],autoPlaceSelectionBehavior:["type",gu]},pC=10,hC=(e,t)=>e.type===t;function gC(e){return e.incoming.map(t=>t.source)}function mC(e){return e.outgoing.map(t=>t.target)}function _r(e){return mC(e).concat(gC(e))}function yC(e){let t=_r(e);return e.host&&(t=t.concat(_r(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(_r(a)),[]))),t.filter(o=>o.type!=="myline")}function bC(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height};return(0,S.find)(yC(e),l=>l===o?!1:rn(l,a,pC)==="intersect")}function vC(e,t,o,a){let l;for(;l=bC(e,o,t);)o=a(t,o,l);return o}function wC(e){return function(t,o,a){const l={x:o.x,y:o.y};return["x","y"].forEach(r=>{const i=e[r];if(!i)return;const s=r==="x"?"width":"height",{margin:c,minDistance:d}=i;c<0?l[r]=Math.min(a[r]+c-t[s]/2,o[r]-d+c):l[r]=Math.max(a[r]+a[s]+c+t[s]/2,o[r]+d+c)}),l}}function CC(e,t){return xC(e,t)}function xC(e,t){const o=Oe(e),a=qe(e),l=sC(e,{filter:s=>hC(s,"myline")}),r=30,i=80;return vC(e,t,{x:o.right+l+t.width/2,y:a.y+kC("left",i)},wC({y:{margin:r,minDistance:i}}))}function kC(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function mu(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return CC(a,o)})}mu.$inject=["eventBus"];var SC={__depends__:[fC],__init__:["myAutoPlace"],myAutoPlace:["type",mu]};function Tr(e,t,o,a,l,r,i){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=l,this._create=r,this._myOptions=i,t.registerProvider(this)}Tr.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Tr.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,l=this._autoPlace,r=this._create,i=this._myOptions;function s(){o.removeElements([e])}function c(p,f,h){t.start(p,f,h)}function d(p,f,h,g){typeof h!="string"&&(g=h);function m(w,x){const v=a.createShape(Ue({type:p},g));r.start(w,v,{source:x})}function y(w,x){const v=a.createShape(Ue({type:p},g));l.append(x,v)}return{group:"model",className:f,title:h,action:{dragstart:m,click:y}}}if(e.type==="label")return!1;if(e.type==="myline"||e.type==="endEvent")return{delete:{group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}}};const u={};for(const p in i.palette)if(p!=="create.start-event"){const f=i.palette[p];u[p]=d(f.type,f.className,f.title,f.options)}return u.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:c,dragstart:c}},u.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},u};var EC={__init__:["ContextPadProvider"],ContextPadProvider:["type",Tr]},BC=(0,n.defineComponent)({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(),i={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const V=s.get("eventBus");V.on("element.dblclick",T=>{l("elementDblclick",T.element.businessObject)}),V.on("element.click",T=>{l("elementClick",T.element.businessObject)}),V.on("create.end",T=>{l("elementCreate",T.elements[0].businessObject)}),V.on("autoPlace.end",T=>{l("elementCreate",T.shape.businessObject)})},p=function(){return{palette:a.paletteOptions||i,lineStroke:a.lineStroke}},f=()=>{let V={__init__:["myOptions"],myOptions:["type",p]};s=new qo.default({canvas:{container:r.value},modules:[Wv,Hl,Kv,sw,ec,wv,fw,pw,hw,cd,wc,Ew,qd,Vw,kc,V,SC,fd,Yw,EC,rC,lC,aC,hd]});const T=s.get("canvas"),F=s.get("elementFactory");d();const L=F.createRoot();T.setRootElement(L),u()};(0,n.onMounted)(()=>{f()});const h=V=>{const T=V==null?1:c+V;s.get("canvas").zoom(T),c=T},g=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},y=()=>(s.get("canvas").zoom(1),gd(s.get("elementRegistry").getAll())),w=V=>{s.clear(),d(),md(V,s)},x=V=>{s.get("myImporter").update(V.id,V)};return t({reset:()=>{d()},zoom:V=>{h(V)},redo:()=>{g()},undo:()=>{m()},getData:()=>y(),setData:V=>{w(V)},updateElemet:V=>{x(V)}}),(V,T)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),RC=BC,yu=se(bv),bu=se(RC),_C=(0,n.defineComponent)({name:"JInputCards",__name:"input-cards",props:{id:{type:String,default:""},modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},gutter:{type:Number,default:16},span:Number,labelWidth:[String,Number],required:{type:Boolean,default:!1}},emits:["update:modelValue","change","rowChange"],setup(e,{expose:t,emit:o}){const a=e,l=o,{t:r}=Je(),{formData:i}=Qt(),s=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),c=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),d=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),u=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),p=(0,n.computed)(()=>a.editConfig.readonly),f=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)([]),g=b=>{l("rowChange",b)},m=()=>{const b={_i:Kt()};a.columns.forEach(k=>{const B=k.config?.valueRowKey||k.id||"";B&&(b[B]=xt(k.config?.defaultValue))}),h.value.push(b),l("change",{id:a.id,value:b,data:b,formData:i,tableData:h.value,type:"add"})},y=b=>{const k=h.value[b];h.value.splice(b,1),l("change",{id:a.id,value:k,data:k,formData:i,tableData:h.value,type:"delete"})},w=()=>{const b={isOk:!0,info:""};if(a.required&&h.value.length===0)return b.isOk=!1,b.info="请添加表格数据",b;const k=h.value.length,B=a.columns,_=B.length;for(let V=0;V<k;V++){const T=h.value[V];for(let F=0;F<_;F++){const L=B[F];if(v(L.config,V).display!==!1&&L.rule&&L.rule.length>0){const D=L.rule.length;for(let M=0;M<D;M++){const E=L.rule[M];if(E.pattern=E.pattern?E.pattern+"":"",E.pattern&&!bt(T[L.prop||""])&&!new RegExp(E.pattern.substring(1,E.pattern.length-1)).test(T[L.prop||""]))return b.info=`${r("第")}${V+1}${r("行")},${r("第")}${F+1}${r("列")},${r(L.label)}:${r(E.message)}`,b.isOk=!1,b;if(E.required&&bt(T[L.prop||""]))return b.isOk=!1,b.info=`${r("第")}${V+1}${r("行")},${r("第")}${F+1}${r("列")},${r(L.label)}:${r("不能为空")}`,b}}}}return b};a.modelValue&&a.modelValue.length>0?(h.value=a.modelValue||[],h.value.forEach(b=>{b._i||(b._i=Kt())})):(h.value=[],l("update:modelValue",h.value));const v=(b,k)=>{const B={...b};if(B.getUpConfig){const _=b.getUpConfig({formData:i,index:k,row:h.value[k],tableData:h.value,config:B});_&&Object.keys(_).forEach(V=>{B[V]=_[V]})}return B},C=b=>{const k=b||a.labelWidth;return typeof k=="string"?k:typeof k=="number"?k+"px":k};return t({validate:()=>w()}),go({getTableData:()=>h.value,rowChange:g}),(b,k)=>{const B=(0,n.resolveComponent)("j-comp"),_=(0,n.resolveComponent)("el-form-item"),V=(0,n.resolveComponent)("el-col"),T=(0,n.resolveComponent)("j-button"),F=(0,n.resolveComponent)("el-row");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createElementVNode)("div",(0,n.mergeProps)({class:"j-input-cards"},b.$attrs),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(h.value,(L,D)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-input-cards-item",key:L.i,style:{"margin-bottom":"8px"}},[(0,n.createVNode)(F,{gutter:e.gutter},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,M=>((0,n.openBlock)(),(0,n.createBlock)(V,{key:M.prop,span:M.config?.span||e.span||24,style:(0,n.normalizeStyle)({"margin-bottom":(M.getInputType?M.getInputType(L):M.inputType)=="j-input-rows"?"8px":void 0})},{default:(0,n.withCtx)(()=>[(0,n.withDirectives)((0,n.createVNode)(_,{"label-width":C(M.config?.labelWidth),label:(0,n.unref)(r)(M.config?.label||""),extra:M.config?.labelExtra,tooltip:M.config?.labelTooltip,required:M.config?.required},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(B,(0,n.mergeProps)({ref_for:!0},M,{row:L}),null,16,["row"])]),_:2},1032,["label-width","label","extra","tooltip","required"]),[[n.vShow,v(M.config,D).display!==!1]])]),_:2},1032,["span","style"]))),128)),u.value&&(f.value||h.value.length>1)&&!p.value?((0,n.openBlock)(),(0,n.createBlock)(T,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",danger:"",onClick:M=>y(D)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)]),_:2},1032,["gutter"])]))),128))],16),s.value&&!p.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":d.value})},[s.value?((0,n.openBlock)(),(0,n.createBlock)(T,{key:0,type:"link",style:{"margin-right":"8px"},label:c.value,icon:"mdi:add",onClick:m},null,8,["label"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)],64)}}}),TC=_C,vu=se(TC),MC=[Zo,hi,gi,mi,yi,bi,vi,wi,Ci,xi,ki,Si,Ei,Bi,Pi,ji,Oi,Ii,Cl,pi,zi,Li,Hi,Fi,Wi,Ui,as,Ji,Yi,Ki,Gi,qi,Xi,Zi,Qi,es,ts,ns,os,ss,cs,ds,us,fs,ps,hs,gs,ms,ls,rs,xl,ys,bs,vs,ws,Cs,xs,ks,Dm,yu,bu,vu],VC=e=>{MC.forEach(t=>{e.component(t.name,t)})},NC={install:VC};A.EncryptionFactory=Qr,A.EventBus=yl,A.HashingFactory=of,A.INJECT_KEYS=rt,A.JAutoComplete=Ei,A.JBarcode=Ui,A.JButton=Zo,A.JButtonSelect=ss,A.JButtons=hi,A.JCascaderSelect=xi,A.JCheckbox=ki,A.JCodeMirror=as,A.JCollapse=xs,A.JComp=us,A.JCount=Ji,A.JCountUp=Ki,A.JDataPanel=Gi,A.JDate=mi,A.JDecoratedTitle=ns,A.JDialog=ji,A.JDialogFull=Oi,A.JDivider=qi,A.JDrawer=Ii,A.JDynamicLayer=pi,A.JEcharts=Wi,A.JEditor=ks,A.JForm=fs,A.JFormItem=ps,A.JGuid=gs,A.JHpanel=Xi,A.JIcon=vi,A.JInput=gi,A.JInputButton=Zi,A.JInputCards=vu,A.JInputCode=Qi,A.JInputColor=es,A.JInputCount=Yi,A.JInputDecoratedTitle=os,A.JInputLayer=bs,A.JInputRows=ys,A.JInputTag=zi,A.JLayer=Cl,A.JLayerForm=vs,A.JLayout=Bi,A.JMenu=rs,A.JNowTime=bi,A.JNumber=Si,A.JPage=hs,A.JPanel=ms,A.JRadio=wi,A.JRate=Li,A.JSelect=Ci,A.JSlider=Hi,A.JSliderCaptcha=ls,A.JSwitch=ws,A.JTable=Pi,A.JTablePanel=xl,A.JTabs=Cs,A.JTime=yi,A.JTitle=ts,A.JTree=cs,A.JTreeSelect=ds,A.JUpload=Fi,A.JWorkflow=bu,A.JWorkflowViewer=yu,A.assign=Ue,A.buildShortUUID=Qo,A.buildUUID=Kt,A.clearJson=Dn,A.clone=fo,A.deepClone=xt,A.default=NC,A.eventBus=lf,A.formatToDate=ho,A.formatToDateTime=na,A.fullScreenLoading=Fn,A.getCompConfig=_t,A.getCompType=ta,A.getFunction=hl,A.getIsInputComp=ea,A.getIsTableInputComp=Yr,A.getLabel=Kr,A.getObjType=jr,A.getTextWidth=kt,A.is=Pr,A.isArray=Xo,A.isNullOrEmpty=bt,A.isObject=zu,A.loadBMap=ti,A.lowerFirst=Ju,A.myAesDecrypt=af,A.numberToChinese=Ir,A.numberToThousandSeparator=zr,A.pagination=Wu,A.paginationEx=Or,A.set=gl,A.setGroupMap=Hr,A.toArray=$r,A.toDecimal=po,A.toLeafArray=Jr,A.toSimpleTree=Yu,A.toTree=Dr,A.uniqueArray=Uu,A.upFirst=Lr,A.useAppInject=Je,A.useAppProvide=rf,A.useAuthPageInject=ii,A.useAuthPageProvide=si,A.useCompInject=oi,A.useCompProvide=vl,A.useFormInject=Qt,A.useFormProvide=bl,A.useHMenuInject=li,A.useHMenuProvide=ri,A.useInject=jt,A.useLayer=Wn,A.useLayerInject=sf,A.useLayerProvide=ci,A.useMenuInject=$n,A.useMenuProvide=ai,A.usePageInject=di,A.usePageProvide=ui,A.useProvide=Ot,A.useSortable=ei,A.useTableInject=ni,A.useTableProvide=go});
16
+ getCompValue)=>{ return ${k} }`;let B;const _=hl(k);if(_.res)try{B=_.fn(a,l,r,i,s,c,d,u,p,f,h,g,m,y,v)}catch(V){console.log(V,"计算组件公式运行错误")}else return console.log(_.msg),"";return Number.isNaN(B)?"":(o.decimal!==void 0&&(B=B.toFixed(o.decimal)),B)}),R=(0,n.computed)(()=>{let b=C.value;return o.thousandSeparator&&(b=zr(b)),o.isChinese&&(b=Ir(b)),b});return(0,n.watch)(C,b=>{w("update:modelValue",b),w("change",{value:b,data:R.value})}),(b,k)=>{const B=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(B,{modelValue:R.value,"onUpdate:modelValue":k[0]||(k[0]=_=>R.value=_),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),vh=bh,Ji=se(vh),wh={class:"j-block j-input-count"},Ch={class:"j-input-count-top"},xh={class:"j-input-count-tool"},kh={style:{"font-weight":"600"}},Sh={class:"j-input-count-codebox"},Eh={key:0,class:"j-input-count-cursor"},Bh={key:0,class:"fun_color"},Rh={key:1,class:"comp_color"},_h={key:2,class:"num_color"},Th={key:3,class:"j-input-count-cursor"},Mh={class:"j-input-count-bottom"},Vh={class:"j-input-count-left"},Nh={class:"mb-8px fw-600"},Ah={class:"j-input-count-right"},Ph={class:"j-input-count-funs"},jh={style:{"font-weight":"600",padding:"8px"}},Oh={class:"j-input-count-funs-content"},Ih={class:"j-input-count-fundes"},zh={style:{"font-size":"14px","font-weight":"300"}},Lh=(0,n.defineComponent)({name:"JInputCount",__name:"input-count",props:{modelValue:String,list:{type:Array,default:()=>[]},type:{type:String,default:"primary"},size:{type:String},label:{type:String,default:"公式设置"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=Je(),a=e,l=t,r=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4},{label:5,value:5},{label:6,value:6},{label:7,value:7},{label:8,value:8},{label:9,value:9},{label:0,value:0},{label:"i",value:"i"},{label:"+",value:"+"},{label:"-",value:"-"},{label:"*",value:"*"},{label:"/",value:"/"},{label:">",value:">"},{label:"<",value:"<"},{label:"=",value:"="},{label:"(",value:"("},{label:")",value:")"},{label:"[",value:"["},{label:"]",value:"]"},{label:"'",value:"'"},{label:'"',value:'"'},{label:",",value:","},{label:".",value:"."}],i=[{label:"ABS",value:"abs",des:["ABS函数可以获取一个数的绝对值","用法:ABS(数字)","示例:ABS(-8)可以返回8,也就是-8的绝对值"]},{label:"AVERAGE",value:"average",des:["AVERAGE函数可以获取一组数值的算术平均值","用法:AVERAGE(数字1,数字2,...)","示例:AVERAGE({语文成绩},{数学成绩}, {英语成绩})返回三门课程的平均分"]},{label:"CEILING",value:"ceiling",des:["CEILING函数可以将数字增大到最接近原值的指定因数的倍数","用法:CEILING(数字,因数)","示例:CEILING(7,6)返回12,因为12比7大的同时,也是6的倍数中最接近7的数字"]},{label:"COUNT",value:"count",des:["COUNT函数可以获取参数的数量","用法:COUNT(值,值,...)","示例:COUNT(小明,小王,小张,小李)返回4,也就是人员的数量"]},{label:"COUNTIF",value:"countif",des:["COUNTIF函数可以获取数组中满足条件的参数个数","用法:COUNTIF(数组,'条件')","示例:COUNTIF(子表单.性别, '女'),可得到子表单中性别填的是'女'的数据条数;COUNTIF([1,2,3,4],'>2'),可得到1,2,3,4中大于2的数字数量,结果为2。"]},{label:"FIXED",value:"fixed",des:["FIXED函数可将数字舍入到指定的小数位数并输出为文本","用法:FIXED(数字,小数位数)","示例:FIXED(3.1415,2)返回'3.14'"]},{label:"FLOOR",value:"floor",des:["FLOOR函数可将数字减小到最接近原值的指定因数的倍数","用法:FLOOR(数字,因数)","示例:FLOOR(7,6)返回6,因为6比7小的同时,也是6的倍数中最接近7的数字"]},{label:"INT",value:"int",des:["INT函数可以获取一个数的整数部分","用法:INT(数字)","示例:INT(3.1415)返回3,也就是3.1415的整数部分"]},{label:"LARGE",value:"large",des:["LARGE函数可以获取数据集中第k个最大值","用法:LARGE(数组,k)","示例:LARGE({学生成绩.数学成绩},1)返回子表单'学生成绩'中排名第1的'数学成绩'"]},{label:"LOG",value:"log",des:["LOG函数可以根据指定底数返回数字的对数","用法:LOG(数字,底数)","示例:LOG(100,10)返回2,也就是以10为底数100的对数"]},{label:"MAX",value:"max",des:["MAX函数可以获取一组数值的最大值","用法:MAX(数字1,数字2,...)","示例:MAX({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最高分"]},{label:"MIN",value:"min",des:["MIN函数可以获取一组数值的最小值","用法:MIN(数字1,数字2,...)","示例:MIN({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最低分"]},{label:"MOD",value:"mod",des:["MOD函数可以获取两数相除的余数","用法:MOD(被除数,除数)","示例:MOD(4,3)返回1,也就是4/3的余数"]},{label:"POWER",value:"power",des:["POWER函数可以获取数字乘幂的结果","用法:POWER(数字,指数)","示例:POWER(3,2)返回9,也就是3的2次方"]},{label:"PRODUCT",value:"product",des:["PRODUCT函数可以获取一组数值的乘积","用法:PRODUCT(数字1,数字2,...)","示例:PRODUCT({单价}, {数量})获取总价,也就是单价和数量的乘积"]},{label:"RAND",value:"rand",des:["RAND函数可返回大于等于0且小于1的均匀分布随机实数","用法:RAND()","示例:RAND()返回0.424656"]},{label:"ROUND",value:"round",des:["ROUND函数可以将数字四舍五入到指定的位数","用法:ROUND(数字,数字位数)","示例:ROUND(3.1485,2)返回3.15"]},{label:"SMALL",value:"small",des:["SMALL函数可以返回数据集中第k个最小值","用法:SMALL(数组,k)","示例:SMALL({学生成绩.数学成绩}, 1)返回子表单'学生成绩'中排名倒数第一的'数学成绩'"]},{label:"SQRT",value:"sqrt",des:["SQRT函数可以获取一个数字的正平方根","用法:SQRT(数字)","示例:SQRT(9)返回3,也就是9的正平方根"]},{label:"SUM",value:"sum",des:["SUM函数可以获取一组数值的总和","用法:SUM(数字1,数字2,...)","示例:SUM({语文成绩},{数学成绩}, {英语成绩})返回三门课程的总分"]},{label:"SUMPRODUCT",value:"sumproduct",des:["SUMPRODUCT函数可以将数组间对应的元素相乘,并返回乘积之和,适用于加权求和","用法:SUMPRODUCT(数组,数组...)","示例:SUMPRODUCT([1,2,3],[0.1,0.2,0.3])返回1.4,也就是 1×0.1 + 2×0.2 + 3×0.3的值"]}],s=(0,n.ref)(!1),c=(0,n.ref)([]),d=(0,n.reactive)({cells:[],cursor:0}),u=(0,n.computed)({get(){return JSON.parse(a.modelValue||"[]")},set(b){l("update:modelValue",b.length>0?JSON.stringify(b):""),l("change",{value:b.length>0?JSON.stringify(b):"",data:b})}}),p=b=>{c.value=b},f=(b,k)=>{const B={value:b,type:k};if(d.cells.splice(d.cursor,0,B),d.cursor+=1,k==="fun"){const _={value:"(",type:k},V={value:")",type:k};d.cells.splice(d.cursor,0,_,V),d.cursor+=1}},h=()=>{d.cursor>0&&(d.cursor-=1)},g=()=>{d.cursor<d.cells.length&&(d.cursor+=1)},m=()=>{d.cursor>0&&(d.cells.splice(d.cursor-1,1),d.cursor-=1)},y=()=>{d.cells=[],d.cursor=0},w=()=>{d.cells=xt(u.value),d.cursor=d.cells.length,s.value=!0},x=()=>{u.value=d.cells,s.value=!1},v=()=>{d.cells=[],d.cursor=0,s.value=!1},C=(0,n.computed)(()=>{const b={};return a.list.forEach(k=>{k.children.forEach(B=>{b[B.value]=`${k.label}.${B.label}`})}),b}),R=b=>C.value[b]||b;return(b,k)=>{const B=(0,n.resolveComponent)("j-button"),_=(0,n.resolveComponent)("j-icon"),V=(0,n.resolveComponent)("el-space"),T=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(B,(0,n.mergeProps)(b.$attrs,{type:e.type,size:e.size,label:e.label,onClick:w}),null,16,["type","size","label"]),(0,n.createVNode)(T,{visible:s.value,title:(0,n.unref)(o)("公式设置"),height:800,width:1200,onOk:x,onClosed:v},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",wh,[(0,n.createElementVNode)("div",Ch,[(0,n.createElementVNode)("div",xh,[(0,n.createElementVNode)("span",kh,(0,n.toDisplayString)((0,n.unref)(o)("计算公式"))+"=",1),(0,n.createVNode)(V,null,{default:(0,n.withCtx)(()=>[(0,n.createVNode)(B,{type:"text",onClick:h},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowLeft"})]),_:1}),(0,n.createVNode)(B,{type:"text",onClick:g},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowRight"})]),_:1}),(0,n.createVNode)(B,{type:"link",label:"退格",onClick:m}),(0,n.createVNode)(B,{type:"link",danger:"",label:"清空",onClick:y})]),_:1})]),(0,n.createElementVNode)("div",Sh,[d.cells.length==0?((0,n.openBlock)(),(0,n.createElementBlock)("span",Eh)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.cells,(F,L)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:L},[F.type=="fun"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Bh,(0,n.toDisplayString)(F.value.toUpperCase()),1)):F.type=="comp"?((0,n.openBlock)(),(0,n.createElementBlock)("span",Rh," #"+(0,n.toDisplayString)(R(F.value))+"# ",1)):F.type=="num"?((0,n.openBlock)(),(0,n.createElementBlock)("span",_h,(0,n.toDisplayString)(F.value),1)):(0,n.createCommentVNode)("",!0),L+1==d.cursor?((0,n.openBlock)(),(0,n.createElementBlock)("span",Th)):(0,n.createCommentVNode)("",!0)],64))),128))])]),(0,n.createVNode)(V,{class:"j-input-count-mid"},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r,(F,L)=>(0,n.createVNode)(B,{key:L,label:F.label+"",onClick:D=>f(F.value,"num")},null,8,["label","onClick"])),64))]),_:1}),(0,n.createElementVNode)("div",Mh,[(0,n.createElementVNode)("div",Vh,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.list,(F,L)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:L},[(0,n.createElementVNode)("div",Nh,(0,n.toDisplayString)((0,n.unref)(o)(F.label)),1),(0,n.createVNode)(V,{size:[8,8],wrap:"",style:{"margin-bottom":"16px"}},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(F.children,D=>((0,n.openBlock)(),(0,n.createBlock)(B,{key:D.value,onClick:M=>f(D.value,"comp"),label:(0,n.unref)(o)(D.label)},null,8,["onClick","label"]))),128))]),_:2},1024)],64))),128))]),(0,n.createElementVNode)("div",Ah,[(0,n.createElementVNode)("div",Ph,[(0,n.createElementVNode)("span",jh,(0,n.toDisplayString)((0,n.unref)(o)("函数列表")),1),(0,n.createElementVNode)("div",Oh,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,(F,L)=>(0,n.createVNode)(B,{type:"text",style:{"border-radius":"0","justify-content":"left"},key:L,onMouseover:D=>p(F.des),onClick:D=>f(F.value,"fun"),label:F.label},null,8,["onMouseover","onClick","label"])),64))])]),(0,n.createElementVNode)("div",Ih,[(0,n.createElementVNode)("div",null,[(0,n.createElementVNode)("ul",null,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.value,(F,L)=>((0,n.openBlock)(),(0,n.createElementBlock)("li",{key:L,style:{"margin-bottom":"8px"}},[(0,n.createElementVNode)("span",zh,(0,n.toDisplayString)((0,n.unref)(o)(F)),1)]))),128))])])])])])])]),_:1},8,["visible","title"])])}}}),Hh=Lh,Yi=se(Hh),Dh={key:0},Fh=(0,n.defineComponent)({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=(0,n.computed)(()=>({...o})),l=(0,n.ref)(),r=(0,n.ref)(null),i=(0,n.computed)(()=>o.options);(0,n.onMounted)(()=>{o.animation&&s()}),(0,n.watch)(()=>o.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=o.decimals,r.value.reset(),r.value.update(o.endValue))},{deep:!0}),(0,n.watch)(()=>o.endValue,f=>{r.value&&r.value.update&&r.value.update(f)});const s=()=>{r.value||(i.value.startVal=o.startValue,i.value.decimalPlaces=o.decimals,i.value.duration=o.duration,r.value=new Cu.CountUp(l.value,Number(o.endValue),i.value),r.value.start(()=>{o.callback?.(r.value)}))};return(0,n.onUnmounted)(()=>{r.value=null}),(0,n.onBeforeUnmount)(()=>{r.value=null}),t({myProps:a,el:l,init:s,start:f=>{r.value&&r.value.start&&r.value.start(()=>{f?.(r.value)})},pauseResume:()=>{r.value&&r.value.pauseResume&&r.value.pauseResume()},reset:()=>{r.value&&r.value.reset&&r.value.reset()},update:f=>{r.value&&r.value.update&&r.value.update(f)}}),(f,h)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{ref_key:"el",ref:l},[e.animation?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",Dh,(0,n.toDisplayString)(e.endValue),1))],512))}}),$h=Fh,Ki=se($h),Wh={class:"j-block j-data-panel"},Uh={key:0,class:"j-data-panel-header"},Jh={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},Yh={class:"j-data-panel-header-right"},Kh={class:"j-data-panel-body"},Gh=(0,n.defineComponent)({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Wh,[e.title?((0,n.openBlock)(),(0,n.createElementBlock)("div",Uh,[(0,n.createElementVNode)("div",Jh,(0,n.toDisplayString)(e.title),1),(0,n.createElementVNode)("div",Yh,[(0,n.renderSlot)(t.$slots,"titleRight")])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Kh,[(0,n.renderSlot)(t.$slots,"default")])]))}}),qh=Gh,Gi=se(qh),Xh={class:"j-divider-content"},Zh=(0,n.defineComponent)({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=(0,n.computed)(()=>{const l={color:t.color};return t.size&&Number(t.size)&&(l.fontSize=`${t.size}px`),l}),a=(0,n.computed)(()=>({borderTopStyle:t.borderStyle}));return(l,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(`j-divider-container j-divider-${e.contentPosition}`),style:(0,n.normalizeStyle)(o.value)},[(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-left",style:(0,n.normalizeStyle)(a.value)},null,4),(0,n.createElementVNode)("div",Xh,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e.content||""),1)]),(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-right",style:(0,n.normalizeStyle)(a.value)},null,4)],6))}}),Qh=Zh,qi=se(Qh),eg={class:"j-hpanel"},tg={class:"j-hpanel-main"},ng=(0,n.defineComponent)({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",eg,[(0,n.renderSlot)(t.$slots,"left"),(0,n.createElementVNode)("div",tg,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"right")]))}}),og=ng,Xi=se(og),ag=(0,n.defineComponent)({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},title:{},size:{default:"default"},width:{default:1e3},height:{default:600},destroyOnClose:{type:Boolean,default:!1},open:{},ok:{},beforeClose:{},closed:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.ref)(),r=(0,n.ref)(),i=async(u,p)=>{o.ok&&(u("保存数据中..."),r.value=await o.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),p(),l.value.close())},s=()=>o.beforeClose?o.beforeClose(r.value):!0,c=()=>{o.closed?.()},d=()=>{l.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(r.value)},200)};return(0,n.watch)(()=>o.modelValue,u=>{r.value=u},{immediate:!0}),(u,p)=>{const f=(0,n.resolveComponent)("j-button"),h=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(f,(0,n.mergeProps)({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),(0,n.createVNode)(h,{ref_key:"layerRef",ref:l,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:i,onClosed:c},{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}}),lg=ag,Zi=se(lg),rg=(0,n.defineComponent)({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},title:{},size:{},width:{default:1200},height:{default:600},example:{default:""},beforeClose:{},isHint:{type:Boolean,default:!1},handleHint:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.computed)({get:()=>o.modelValue,set:p=>{a("update:modelValue",p)}}),r=(0,n.ref)(""),i=p=>{r.value=p},s=()=>r.value,c=p=>o.beforeClose?o.beforeClose(p):!0,d=p=>{a("change",p)},u=(0,n.computed)(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(p,f)=>{const h=(0,n.resolveComponent)("j-code-mirror"),g=(0,n.resolveComponent)("j-layout"),m=(0,n.resolveComponent)("j-input-button");return(0,n.openBlock)(),(0,n.createBlock)(m,{modelValue:l.value,"onUpdate:modelValue":f[1]||(f[1]=y=>l.value=y),type:e.type,"btn-text":u.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":c,ok:s,open:i,onChange:d},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{"right-move":!1,right:560},(0,n.createSlots)({default:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{value:r.value,"onUpdate:value":f[0]||(f[0]=y=>r.value=y),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["value","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{value:e.example,mode:e.mode,"read-only":""},null,8,["value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","width","height"])}}}),ig=rg,Qi=se(ig),sg=(0,n.defineComponent)({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.computed)({get(){return a.modelValue===null||a.modelValue===void 0?i.value:a.modelValue},set(m){i.value=m,l("update:modelValue",m),l("input",m)}}),c=m=>{l("input",m)},d=m=>{l("focus",m)},u=m=>{l("blur",m)},p=()=>{l("clear"),l("update:modelValue","")},f=m=>{l("change",m)},h=m=>{l("color-change",m),l("change",m)},g=m=>{l("active-change",m)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(m,y)=>{const w=(0,n.resolveComponent)("el-color-picker"),x=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[(0,n.createVNode)(x,(0,n.mergeProps)({ref_key:"inputRef",ref:r,modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=v=>s.value=v),placeholder:e.placeholder,size:e.size,readonly:e.readonly||e.onlyButton,clearable:e.readonly||e.onlyButton?!1:e.clearable,disabled:e.disabled,name:e.name,autofocus:e.autofocus,tabindex:e.tabindex,"validate-event":e.validateEvent,"input-style":e.inputStyle},m.$attrs,{onInput:c,onFocus:d,onBlur:u,onClear:p,onChange:f}),{[e.inputType]:(0,n.withCtx)(()=>[(0,n.createVNode)(w,{modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=v=>s.value=v),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:h,onActiveChange:g},null,8,["modelValue","size","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["modelValue","placeholder","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}}),cg=sg,es=se(cg),dg=(0,n.defineComponent)({name:"JTitle",__name:"title",props:{title:{default:""},style:{default:void 0},class:{default:void 0},color:{default:void 0},size:{default:void 0},weight:{default:"normal"},align:{default:"left"}},setup(e){const t=e,o=(0,n.computed)(()=>t.class||""),a=(0,n.computed)(()=>{const l={...t.style};return t.color&&(l.color=t.color),t.size&&(typeof t.size=="number"?l.fontSize=`${t.size}px`:l.fontSize=t.size),t.weight&&(l.fontWeight=t.weight),t.align&&(l.textAlign=t.align),l});return(l,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-title",o.value]),style:(0,n.normalizeStyle)(a.value)},(0,n.toDisplayString)(e.title),7))}}),ug=dg,ts=se(ug),fg={class:"j-decorated-title-wrapper1"},pg={class:"j-decorated-title-wrapper1-line"},hg={key:3,class:"j-decorated-title-wrapper2"},gg={class:"wrapper2"},mg={class:"wrapper2-line"},yg={key:4,class:"j-decorated-title-wrapper3"},bg={class:"wrapper3"},vg={class:"wrapper3-line"},wg={key:5,class:"j-decorated-title-wrapper4"},Cg={class:"wrapper4"},xg={class:"wrapper4-center"},kg={key:6,class:"j-decorated-title-wrapper5"},Sg={class:"wrapper5"},Eg={class:"wrapper5-left"},Bg={class:"wrapper5-right"},Rg=(0,n.defineComponent)({name:"JDecoratedTitle",__name:"decorated-title",props:{title:{default:""},content:{},style:{default:void 0},class:{default:void 0},color:{default:void 0},contentColor:{},backgroundColor:{},size:{default:14},contentSize:{default:12},align:{default:void 0},weight:{default:"normal"},titleType:{default:"title1"}},setup(e){const{t}=Je(),o=e,a=(0,n.computed)(()=>o.class||""),l=(0,n.computed)(()=>({"font-size":o.size?`${["title5","title7","title8","title9"].includes(o.titleType)?14:o.size}px`:"","font-weight":o.weight,color:o.color})),r=(0,n.computed)(()=>({"font-size":o.contentSize?`${o.contentSize}px`:"",color:o.contentColor})),i=(0,n.computed)(()=>({"--el-border-style":o.titleType==="title3"?"solid":"dashed",borderColor:o.backgroundColor||"var(--j-color-primary)",margin:"0 !important"})),s=(0,n.computed)(()=>o.backgroundColor||"var(--j-color-primary-hover)"),c=(0,n.computed)(()=>({...o.style}));return(d,u)=>{const p=(0,n.resolveComponent)("el-divider");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-decorated-title",a.value]),style:(0,n.normalizeStyle)(c.value)},[e.titleType==="title2"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):["title3","title4"].includes(e.titleType||"")?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createVNode)(p,{class:"m-0",style:(0,n.normalizeStyle)(i.value)},null,8,["style"]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title5"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:2},[(0,n.createElementVNode)("div",fg,[(0,n.createElementVNode)("div",{class:"j-decorated-title-wrapper1-title",style:(0,n.normalizeStyle)([l.value,{backgroundColor:s.value}])},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",pg,[(0,n.createElementVNode)("div",{class:"wrapper-line",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram1",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram2",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram3",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)([r.value,{textAlign:"left"}])},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title6"?((0,n.openBlock)(),(0,n.createElementBlock)("div",hg,[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",gg,[(0,n.createElementVNode)("div",mg,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper2-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title7"?((0,n.openBlock)(),(0,n.createElementBlock)("div",yg,[(0,n.createElementVNode)("div",bg,[(0,n.createElementVNode)("div",vg,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper3-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title8"?((0,n.openBlock)(),(0,n.createElementBlock)("div",wg,[(0,n.createElementVNode)("div",Cg,[(0,n.createElementVNode)("div",{class:"wrapper4-bg",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",xg,[(0,n.createElementVNode)("div",{class:"wrapper4-center-label",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border left-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border right-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title9"?((0,n.openBlock)(),(0,n.createElementBlock)("div",kg,[(0,n.createElementVNode)("div",Sg,[(0,n.createElementVNode)("div",Eg,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-left-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),u[0]||(u[0]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-left-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-left-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-left-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper5-center",style:(0,n.normalizeStyle)([{backgroundColor:s.value}])},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",Bg,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-right-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),u[1]||(u[1]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-right-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-right-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-right-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:7,style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5))],6)}}}),_g=Rg,ns=se(_g),Tg={class:"j-block"},Mg={class:"j-input-decorated-title-wrapper mb-0px"},Vg=(0,n.defineComponent)({name:"JInputDecoratedTitle",__name:"input-decorated-title",props:{modelValue:{default:"title1"},backgroundColor:{default:void 0},color:{default:void 0},weight:{default:void 0},contentColor:{default:void 0},align:{default:void 0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=Je(),a=t,l=(0,n.ref)(),r=d=>{l.value?.hide(),a("update:modelValue",d),a("change",d)},i=(0,n.ref)("mdi:chevron-down"),s=()=>{i.value="mdi:chevron-up"},c=()=>{i.value="mdi:chevron-down"};return(d,u)=>{const p=(0,n.resolveComponent)("j-decorated-title"),f=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Tg,[(0,n.createVNode)(h,{width:270,placement:"top-start",trigger:"click","popper-class":"j-input-decorated-title-popover",ref_key:"popoverRef",ref:l,onShow:s,onHide:c},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Mg,[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:e.modelValue,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align"]),(0,n.createVNode)(f,{icon:i.value,size:20},null,8,["icon"])])]),default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(8,g=>(0,n.createElementVNode)("div",{class:"j-input-decorated-title-wrapper",key:g},[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:`title${g}`,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align,onClick:m=>r(`title${g}`)},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align","onClick"])])),64))]),_:1},512)])}}}),Ng=Vg,os=se(Ng),Ag=(0,n.defineComponent)({name:"JCodeMirror",__name:"code-mirror",props:{value:{default:""},mode:{default:"javascript"},readonly:{type:Boolean,default:!1},height:{default:void 0},isHint:{type:Boolean,default:!1},handleHint:{type:Function,default:void 0},isScrollToBottom:{type:Boolean,default:!1}},emits:["update:value","change"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(),i=(0,n.ref)("");let s=null;const c=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return(0,Ln.javascript)();case"css":case"text/css":return(0,Su.css)();case"html":case"text/html":return(0,Eu.html)();case"json":case"application/json":return(0,Bu.json)();case"sql":case"text/x-sql":return(0,Ru.sql)();case"xml":case"text/xml":return(0,_u.xml)();case"python":case"text/x-python":return(0,Tu.python)();case"markdown":case"text/markdown":return(0,Mu.markdown)();case"java":case"text/x-java":return(0,Vu.java)();case"vue":case"text/x-vue":return(0,Ln.javascript)({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return(0,Ln.javascript)({jsx:!1,typescript:!0});case"jsx":return(0,Ln.javascript)({jsx:!0,typescript:!1});case"tsx":return(0,Ln.javascript)({jsx:!0,typescript:!0});default:return(0,Ln.javascript)()}},d=()=>{const m=[ku.basicSetup,(0,Pt.lineNumbers)(),(0,Pt.highlightActiveLineGutter)(),(0,Pt.highlightSpecialChars)(),(0,cl.history)(),(0,Pt.drawSelection)(),(0,Pt.dropCursor)(),(0,Hn.indentOnInput)(),(0,Hn.bracketMatching)(),(0,sl.closeBrackets)(),(0,Pt.rectangularSelection)(),(0,Hn.foldGutter)(),Pt.keymap.of([...sl.closeBracketsKeymap,...cl.defaultKeymap,...cl.historyKeymap,...Hn.foldKeymap]),(0,Hn.syntaxHighlighting)(Hn.defaultHighlightStyle)];return m.push(c(a.mode)),a.readonly&&m.push(il.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push((0,sl.autocompletion)({override:[y=>{const w=y.matchBefore(/\w*/);if(!w||w.from===w.to)return null;const x=a.handleHint(w.text);return x.length===0?null:{from:w.from,options:x.map(v=>({label:typeof v=="string"?v:v.label||v.name||"",detail:typeof v=="string"?"":v.detail||"",type:typeof v=="string"?"variable":v.type||"variable",apply:typeof v=="string"?v:v.apply||v.name||v.label||""}))}}]})),m.push(Pt.EditorView.updateListener.of(y=>{if(y.docChanged){const w=y.state.doc.toString();i.value=w,l("update:value",w),l("change",{value:w})}})),m},u=async()=>{r.value&&(s=new Pt.EditorView({state:il.EditorState.create({doc:a.value,extensions:d()}),parent:r.value}),i.value=a.value)},p=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const y=il.EditorState.create({doc:m,extensions:d()});r.value&&(s=new Pt.EditorView({state:y,parent:r.value}));const w=s.state.doc.toString();w!==a.value&&s.dispatch({changes:{from:0,to:w.length,insert:a.value}})},f=()=>{if(!s)return;const m=s.state.doc.length;s.dispatch({selection:{anchor:m,head:m},scrollIntoView:!0}),setTimeout(()=>{if(s){const y=s.state.doc.length;s.dispatch({selection:{anchor:y,head:y},scrollIntoView:!0})}},100)},h=()=>{let m=(0,xu.format)(a.value);m=m.replace(/{ JCODE_SASSID }/g,"{JCODE_SASSID}").replace(/{ JCODE_SASSID_NOTT }/g,"{JCODE_SASSID_NOTT}").replace(/{ JCODE_SASSID_NOTA }/g,"{JCODE_SASSID_NOTA}").replace(/@ /g,"@"),l("update:value",m),l("change",{value:m})};let g=null;return(0,n.watch)(()=>a.value,m=>{m!==i.value&&(i.value=m,s&&p(),setTimeout(()=>{s&&a.isScrollToBottom&&f()}))}),(0,n.watch)(()=>a.mode,()=>{s&&p()}),(0,n.onMounted)(async()=>{await(0,n.nextTick)(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(g=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),g.observe(r.value))}),(0,n.onUnmounted)(()=>{g&&r.value&&(g.unobserve(r.value),g.disconnect(),g=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(m,y)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:(0,n.normalizeStyle)({height:e.height?`${e.height}px`:""})},null,4))}}),Pg=Ag,as=se(Pg),jg=(0,n.defineComponent)({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("actionRef"),l=(0,n.ref)("0"),r=(0,n.computed)(()=>{const{actionStyle:s,toLeft:c}=o;return{...s,left:c?"0":l.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:i.value?"6px":void 0,transition:c?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),i=(0,n.computed)(()=>Number.parseInt(l.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{l.value=s}}),(s,c)=>{const d=(0,n.resolveComponent)("j-icon");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"actionRef",ref:a,style:(0,n.normalizeStyle)(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):((0,n.openBlock)(),(0,n.createBlock)(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),Og=jg,Ig=(0,n.defineComponent)({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("barRef"),l=(0,n.ref)("0"),r=(0,n.computed)(()=>{const{barStyle:i,toLeft:s}=o;return{...i,width:s?"0":l.value,transition:s?"width 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0,backgroundColor:"var(--j-color-success)",position:"absolute",height:"100%"}});return t({getEl:()=>a.value,setWidth:i=>{l.value=i}}),(i,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"barRef",ref:a,style:(0,n.normalizeStyle)(r.value)},null,4))}}),zg=Ig,Lg=(0,n.defineComponent)({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("contentRef"),l=(0,n.computed)(()=>{const{contentStyle:i}=o;return{...i,fontSize:"12px"}});t({getEl:()=>a.value});const r=(0,n.computed)(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(i,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"contentRef",ref:a,class:(0,n.normalizeClass)([{success:e.isPassing},"j-slider-captcha-content"]),style:(0,n.normalizeStyle)(l.value)},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(r.value),class:"j-spine-text"},(0,n.toDisplayString)(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Hg=Lg,Dg=(0,n.defineComponent)({name:"JSliderCaptcha",__name:"slider-captcha",props:(0,n.mergeModels)({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:(0,n.mergeModels)(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,a=t,l=(0,n.useModel)(e,"modelValue"),r=(0,n.reactive)({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),i=(0,n.useTemplateRef)("wrapperRef"),s=(0,n.useTemplateRef)("barRef"),c=(0,n.useTemplateRef)("contentRef"),d=(0,n.useTemplateRef)("actionRef");(0,n.watch)(()=>r.isPassing,w=>{if(w){const{endTime:x,startTime:v}=r;a("success",{isPassing:w,time:((x-v)/1e3).toFixed(1)}),l.value=w}}),(0,n.watchEffect)(()=>{r.isPassing=!!l.value});function u(w){return"pageX"in w?w.pageX:"touches"in w&&w.touches[0]?w.touches[0].pageX:0}function p(w){r.isPassing||d.value&&(a("start",w),r.moveDistance=u(w)-Number.parseInt(d.value.getStyle().left.replace("px","")||"0",10),r.startTime=Date.now(),r.isMoving=!0)}function f(w){const x=i.value?.offsetWidth??220,v=w?.offsetWidth??40;return{actionWidth:v,offset:x-v-6,wrapperWidth:x}}function h(w){const{isMoving:x,moveDistance:v}=r;if(x){const C=(0,n.unref)(d),R=(0,n.unref)(s);if(!C||!R)return;const{actionWidth:b,offset:k,wrapperWidth:B}=f(C.getEl()),_=u(w)-v;a("move",{event:w,moveDistance:v,moveX:_}),_>0&&_<=k?(C.setLeft(`${_}px`),R.setWidth(`${_+b/2}px`)):_>k&&(C.setLeft(`${B-b}px`),R.setWidth(`${B-b/2}px`),m())}}function g(w){const{isMoving:x,isPassing:v,moveDistance:C}=r;if(x&&!v){a("end",w);const R=d.value,b=(0,n.unref)(s);if(!R||!b)return;const k=u(w)-C,{actionWidth:B,offset:_,wrapperWidth:V}=f(R.getEl());k<_?y():(R.setLeft(`${V-B}px`),b.setWidth(`${V-B/2}px`),m()),r.isMoving=!1}}function m(){r.endTime=Date.now(),r.isPassing=!0,r.isMoving=!1}function y(){r.isMoving=!1,r.isPassing=!1,r.moveDistance=0,r.toLeft=!1,r.startTime=0,r.endTime=0;const w=(0,n.unref)(d),x=(0,n.unref)(s),v=(0,n.unref)(c);!w||!x||!v||(v.getEl().style.width="100%",r.toLeft=!0,setTimeout(()=>{r.toLeft=!1,w.setLeft("0"),x.setWidth("0")},300))}return(w,x)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"wrapperRef",ref:i,class:(0,n.normalizeClass)(["j-slider-captcha slider-border",o.class]),style:(0,n.normalizeStyle)([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:g,onMousemove:h,onMouseup:g,onTouchend:g,onTouchmove:h},[(0,n.createVNode)(zg,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),(0,n.createVNode)(Hg,{ref_key:"contentRef",ref:c,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),(0,n.createVNode)(Og,{ref_key:"actionRef",ref:d,"action-style":e.actionStyle,"is-passing":r.isPassing,"to-left":r.toLeft,onMousedown:p,onTouchstart:p},null,8,["action-style","is-passing","to-left"])],38))}}),Fg=Dg,ls=se(Fg),$g=(0,n.defineComponent)({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:l,toArray:r,activeMenu:i,theme:s}=$n(),{getHMoreMenus:c}=li(),d=(0,n.ref)([]);o.pId==="moreId"?d.value=c.value:d.value=r(l()[o.pId||""]||[],[]);const u=g=>{const m=d.value.find(y=>y.active);m?.value!==g.value&&(m&&(m.active=!1),a("click",g))},{list:p,containerProps:f,wrapperProps:h}=(0,dl.useVirtualList)(d,{itemHeight:44});return(g,m)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-sub-menu-content",{"j-menu-dark":(0,n.unref)(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},(0,n.unref)(f)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(h))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(p),y=>((0,n.openBlock)(),(0,n.createBlock)(ia,{key:y.data.value,"parent-actives":(0,n.unref)(i)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),Wg=$g,Ug={class:"j-menu-item-label"},Jg={class:"j-menu-item-label"},Yg={key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow","sub"])},Kg={class:"j-menu-item-label"},Gg=(0,n.defineComponent)({name:"JMenuItem",__name:"index",props:{item:{type:Object,default:()=>({})},parentActives:{type:Array,default:()=>[]},collapsed:Boolean,isSub:Boolean,isHorizontal:Boolean,isVertical:Boolean},emits:["click"],setup(e,{emit:t}){const{t:o}=Je(),{activeMenuId:a}=$n(),l=t,r=i=>{l("click",i)};return(i,s)=>{const c=(0,n.resolveComponent)("j-icon"),d=(0,n.resolveComponent)("el-tooltip"),u=(0,n.resolveComponent)("el-popover");return e.collapsed&&!e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,placement:"right"},{content:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1)]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=(0,n.withModifiers)(p=>r(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Ug,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(u,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,icon:e.item.icon,style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),class:"j-menu-item-icon",size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Jg,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?((0,n.openBlock)(),(0,n.createElementBlock)("div",Yg)):(0,n.createCommentVNode)("",!0)],6)],2)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(Wg,{"p-id":e.item.value,onClick:r},null,8,["p-id"])]),_:1},8,["placement"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=(0,n.withModifiers)(p=>r(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Kg,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2))}}}),ia=Gg,qg=(0,n.defineComponent)({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:l,theme:r}=$n(),i=u=>{a("click",u)},{list:s,containerProps:c,wrapperProps:d}=(0,dl.useVirtualList)((0,n.computed)(()=>o.menuList),{itemHeight:44});return(u,p)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":(0,n.unref)(r)==="dark"}]},(0,n.unref)(c)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(d))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(s),f=>((0,n.openBlock)(),(0,n.createBlock)(ia,{key:f.data.value,"parent-actives":(0,n.unref)(l)?.pid?.split(".")||[],item:f.data,collapsed:e.collapsed,class:(0,n.normalizeClass)({"menu-item-entering":f.data.entering,"menu-item-leaving":f.data.leaving}),onClick:i},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),Xg=qg,Zg=(0,n.defineComponent)({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:l,theme:r}=$n(),i=(0,n.ref)(),s=(0,n.ref)(0);let c=null;(0,n.onMounted)(()=>{typeof window<"u"&&window.ResizeObserver&&i.value&&(c=new ResizeObserver(()=>{i.value&&(s.value=i.value.offsetWidth)}),c.observe(i.value))});const d=(0,n.computed)(()=>{const h=[];let g=0,m=0;const y=o.menuList.length;return o.menuList.forEach(w=>{m++;const x=(kt(w.label)||0)+32+16+4+8;g+=x,(m===y&&g<=s.value||m<y&&g+56<=s.value)&&h.push(w)}),h.length<o.menuList.length&&h.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),h}),u=(0,n.computed)(()=>{const h=[];let g=0;const m=d.value.length;return o.menuList.forEach(y=>{g++,g>=m&&h.push(y)}),h}),p=(0,n.computed)(()=>{const h=l.value?.pid?.split(".")||[];return(h.length>1&&u.value.findIndex(g=>g.value===h[1])>-1||u.value.findIndex(g=>g.value===l.value?.value)>-1)&&h.push("moreId"),h}),f=h=>{a("click",h)};return ri({getHMoreMenus:u}),(0,n.onUnmounted)(()=>{c&&i.value&&(c.unobserve(i.value),c.disconnect(),c=null)}),(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"menuRef",ref:i,class:(0,n.normalizeClass)(["j-menu-horizontal",{"j-menu-dark":(0,n.unref)(r)==="dark"}])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.value,m=>((0,n.openBlock)(),(0,n.createBlock)(ia,{key:m.value,"parent-actives":p.value,item:m,"is-horizontal":"",onClick:f},null,8,["parent-actives","item"]))),128))],2))}}),Qg=Zg,e0=(0,n.defineComponent)({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:l,theme:r}=$n(),i=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=(0,n.computed)(()=>(o.menuList.forEach((h,g)=>{h.color=i[g%i.length]}),o.menuList)),c=(0,n.computed)(()=>l.value?.pid?.split(".")||[]),d=h=>{a("click",h)},{list:u,containerProps:p,wrapperProps:f}=(0,dl.useVirtualList)(s,{itemHeight:96});return(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu-vertical",{"j-menu-dark":(0,n.unref)(r)==="dark"}]},(0,n.unref)(p)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(f))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(u),m=>((0,n.openBlock)(),(0,n.createBlock)(ia,{key:m.data.value,"parent-actives":c.value,item:m.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),t0=e0,n0=(0,n.defineComponent)({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let l={};const r=(0,n.ref)("");r.value=o.activeId||"";const i=(m,y,w,x,v)=>{w=w||[];for(let C=0,R=w.length;C<R;C++){const b=w[C],k={};k.pid=y,k.indent=x,r.value===b.value&&(k.active=!0),Object.keys(b).forEach(_=>{_!=="children"&&(k[_]=b[_])}),v&&v.includes(b.value)&&(k.open=!0),m.push(k);const B=b.children||[];B.length>0&&(k.hasChildren=!0,v||(l[k.value]=B),(!v||k.open&&!o.collapsed)&&i(m,`${y}.${k.value}`,B,x+1,v))}},s=(m,y)=>{const w=[];return i(w,"0",m,0,y),w},c=(0,n.ref)([]);let d=[];const u=()=>{l={},d=s(o.menus);const m=[];if(r.value&&o.mode==="inline"){const y=d.find(w=>w.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(o.menus,m)};(0,n.watch)(()=>o.menus,()=>{u()},{immediate:!0}),(0,n.watch)(()=>o.mode,()=>{u()});const p=()=>{if(c.value.find(m=>m.active)?.value!==r.value){const m=d.find(y=>y.value===r.value);if(m){const y=[];o.mode==="inline"&&y.push(...m.pid.split(".")),c.value=s(o.menus,y)}}},f=(0,n.computed)(()=>d.find(m=>m.value===r.value));(0,n.watch)(()=>o.activeId,()=>{r.value=o.activeId||"",p()}),(0,n.watch)(()=>o.collapsed,()=>{if(o.collapsed)c.value=s(o.menus,[]);else{const m=[];if(r.value){const y=d.find(w=>w.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(o.menus,m)}});const h=(0,n.computed)(()=>o.theme),g=m=>{if(console.log(m),m.hasChildren){if(o.collapsed)return;const y=[];y.push(...m.pid.split(".")),m.open||y.push(m.value);const w=s(o.menus,y),x=new Set(c.value.map(C=>C.value)),v=new Set(w.map(C=>C.value));w.forEach(C=>{x.has(C.value)||(C.entering=!0)}),c.value.forEach(C=>{v.has(C.value)||(C.leaving=!0)}),c.value=w,setTimeout(()=>{c.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{if(r.value===m.value)return;r.value=m.value,a("click",m)}};return ai({getMenuMap:()=>l,toArray:s,activeMenu:f,activeMenuId:r,theme:h}),(m,y)=>e.mode==="inline"?((0,n.openBlock)(),(0,n.createBlock)(Xg,{key:0,"menu-list":c.value,collapsed:e.collapsed,onClick:g},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?((0,n.openBlock)(),(0,n.createBlock)(Qg,{key:1,"menu-list":c.value,onClick:g},null,8,["menu-list"])):((0,n.openBlock)(),(0,n.createBlock)(t0,{key:2,"menu-list":c.value,onClick:g},null,8,["menu-list"]))}}),o0=n0,rs=se(o0),a0={class:"j-keyword-panel"},l0={key:0},r0={key:1,class:"columns-wrapper"},i0=(0,n.defineComponent)({name:"JKeywordPanel",__name:"keyword-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:o}=Je(),a=e,l=(0,n.useModel)(e,"checkAll"),r=(0,n.useModel)(e,"checkFields"),i=(0,n.ref)(!1),s=(0,n.ref)(""),c=(0,n.computed)(()=>a.columns.filter(f=>f.config?.filter?.isSearchKeyword?s.value?f.config?.label?.indexOf(s.value)!=-1:!0:!1).map(f=>({label:f.config?.label,value:f.id}))),d=()=>{l.value||(l.value=!0,i.value=!1,r.value=[])},u=f=>{f.length>0?l.value=!1:l.value=!0};return t({init:()=>{l.value?i.value=!1:i.value=!0}}),(f,h)=>{const g=(0,n.resolveComponent)("j-icon"),m=(0,n.resolveComponent)("el-input"),y=(0,n.resolveComponent)("j-checkbox");return(0,n.openBlock)(),(0,n.createElementBlock)("div",a0,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["range-item",{active:l.value}]),onClick:d},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索全部")),1),l.value?((0,n.openBlock)(),(0,n.createBlock)(g,{key:0,icon:"mdi:check"})):(0,n.createCommentVNode)("",!0)],2),(0,n.createElementVNode)("div",{class:"range-item",onClick:h[0]||(h[0]=w=>i.value=!i.value)},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索特定字段")),1),(0,n.createVNode)(g,{icon:i.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",l0,[(0,n.createVNode)(m,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=w=>s.value=w),modelModifiers:{trim:!0},class:"no-border background",placeholder:(0,n.unref)(o)("搜索"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",r0,[(0,n.createVNode)(y,{modelValue:r.value,"onUpdate:modelValue":h[2]||(h[2]=w=>r.value=w),options:c.value,style:{display:"flex","flex-direction":"column"},onChange:u},null,8,["modelValue","options"])])):(0,n.createCommentVNode)("",!0)])}}}),s0=i0,c0={key:0,class:"title"},d0={class:"content"},u0={class:"relation"},f0={style:{width:"72px"}},p0={class:"btn-wrapper"},h0={class:"field-wrapper"},g0={class:"buttons"},m0=(0,n.defineComponent)({name:"JFilterPanel",__name:"filter-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:(0,n.mergeModels)(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:a}=Je(),l=e,r=(0,n.useModel)(e,"relation"),i=(0,n.useModel)(e,"isPin"),s=(0,n.ref)([]),c=()=>{i.value=!i.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:p.value.join(","),options:u.value}),config:{style:{width:i.value?"132px":"160px"},appendTo:i.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,change:({value:x,row:v})=>{const C=l.columns.find(k=>k.id===x)?.config||{};let R="eq",b="text";["options"].includes(C.dataType||"")?R="in":["dateTime"].includes(C.type||"")?(R="range",b="dateTime"):["number"].includes(C.type||"")&&(b="number"),v.method=R,v.type=C.valueType||b,v.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:x})=>{const v=l.columns.find(C=>C.id===x.field)?.config||{};return["options","switch","dataItem","dataView"].includes(v.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(v.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"range",label:"选择范围"},{value:"formula",label:"动态筛选"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["number"].includes(v.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{style:{width:i.value?"134px":"130px"},appendTo:i.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:x})=>{x.value=void 0}}},{id:"value",type:"input",getCompType:({row:x})=>{const v=l.columns.find(C=>C.id===x.field)?.config||{};if(["options","dataItem","switch"].includes(v.dataType||"")){if(["in","nin"].includes(x.method)||["eq","ne"].includes(x.method))return"j-select"}else{if(["dateTime"].includes(v.type||""))return["formula"].includes(x.method)?"j-select":"j-date";if(["number"].includes(v.type||""))return"j-number"}return"j-input"},getCompConfig:({row:x})=>{if(["empty","not_empty"].includes(x.method||""))return{display:!1};const v=l.columns.find(R=>R.id===x.field)?.config||{},C={display:!0,placeholder:"",clearable:!0,filterable:!0};return["in","nin"].includes(x.method||"")&&(C.multiple=!0,C.collapseTags=!0,C.collapseTagsTooltip=!0),["options","dataItem"].includes(v.dataType||"")?(C.collapseTags=!0,C.collapseTagsTooltip=!0,C.dataType=v.dataType,C.dataCode=v.dataCode,C.options=v.options):["switch"].includes(v.dataType||"")?(C.options=[],C.dataType="options",v.activeValue==null?C.options.push({label:"是",value:"1"}):C.options.push({label:"是",value:v.activeValue}),v.inactiveValue==null?C.options.push({label:"否",value:"0"}):C.options.push({label:"否",value:v.inactiveValue})):["dateTime"].includes(v.type||"")&&(["formula"].includes(x.method)?(C.placeholder="",C.options=[{label:"今天",value:"today"},{label:"昨天",value:"yesterday"},{label:"明天",value:"tomorrow"},{label:"最近7天",value:"last7days"},{label:"最近30天",value:"last30days"},{label:"本周",value:"thisWeek"},{label:"上周",value:"lastWeek"},{label:"下周",value:"nextWeek"},{label:"本月",value:"thisMonth"},{label:"上月",value:"lastMonth"},{label:"下月",value:"nextMonth"},{label:"本季度",value:"thisQuarter"},{label:"上季度",value:"lastQuarter"},{label:"下季度",value:"nextQuarter"},{label:"今年",value:"thisYear"},{label:"去年",value:"lastYear"},{label:"明年",value:"nextYear"}],C.dataType="options"):(C.selectType="datetime",["range"].includes(x.method)?(C.selectType="datetimerange",C.startPlaceholder="开始时间",C.endPlaceholder="结束时间",C.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):C.placeholder="")),C},config:{style:{width:i.value?"246px":"296px",flex:i.value?"auto":"1"},appendTo:i.value?void 0:".j-filter-panel"}}];(0,n.onMounted)(()=>{s.value=l.searchFieldList});const u=(0,n.computed)(()=>l.columns.filter(x=>!x.children?.length).map(x=>({label:x.config?.label,value:x.id,dataType:x.config?.dataType,options:x.config?.options}))),p=(0,n.computed)(()=>s.value.map(x=>x.field)),f=({data:x})=>{if(p.value.includes(x.value))return;const v=l.columns.find(b=>b.id===x.value)?.config||{};let C="eq",R="text";["options","dataItem"].includes(v.dataType||"")?C="in":["dateTime"].includes(v.type||"")&&(C="range",R="dateTime"),s.value.push({field:x.value,method:C,type:v.valueType||R})},h=o,g=()=>{s.value.length=0},m=()=>{i.value?h("filter"):h("close",!0)},y=()=>{s.value.forEach(x=>{x.value=void 0}),h("filter")};return t({getSearchFields:()=>s.value}),(x,v)=>{const C=(0,n.resolveComponent)("j-icon"),R=(0,n.resolveComponent)("j-select"),b=(0,n.resolveComponent)("j-button-select"),k=(0,n.resolveComponent)("j-button"),B=(0,n.resolveComponent)("j-input-rows"),_=(0,n.resolveComponent)("el-tooltip");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-filter-panel",{"is-pin":i.value}])},[i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",c0,[(0,n.createVNode)(C,{icon:"mdi:filter-outline"}),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选")),1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",d0,[(0,n.createElementVNode)("div",u0,[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选出符合以下")),1),(0,n.createElementVNode)("div",f0,[(0,n.createVNode)(R,{modelValue:r.value,"onUpdate:modelValue":v[0]||(v[0]=V=>r.value=V),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("条件的数据")),1)]),(0,n.createElementVNode)("div",p0,[(0,n.createVNode)(b,{label:"添加过滤条件",options:u.value,"model-value":p.value.join(","),onChange:f},null,8,["options","model-value"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(k,{key:0,type:"text",danger:"",label:"删除全部",onClick:g})):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",h0,[(0,n.createVNode)(B,{modelValue:s.value,"onUpdate:modelValue":v[1]||(v[1]=V=>s.value=V),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":i.value},null,8,["modelValue","is-wrap"])]),(0,n.createVNode)(_,{placement:"bottom",content:i.value?(0,n.unref)(a)("取消固定"):(0,n.unref)(a)("固定显示")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"pin-btn",onClick:c},[(0,n.createVNode)(C,{rotate:45,icon:i.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),(0,n.createElementVNode)("div",g0,[(0,n.createVNode)(k,{label:(0,n.unref)(a)("筛选"),type:"primary",onClick:m},null,8,["label"]),(0,n.createVNode)(k,{label:(0,n.unref)(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),is=m0,y0={class:"j-order-panel"},b0={class:"content"},v0={class:"btn-wrapper"},w0={class:"field-wrapper"},C0={class:"buttons"},x0=(0,n.defineComponent)({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),l=e,r=o,i=(0,n.computed)(()=>l.columns.filter(g=>!g.children?.length&&g.config?.sorter?.isNot!==!0).map(g=>({label:g.config?.label,value:g.id}))),s=(0,n.ref)([]),c=(0,n.computed)(()=>s.value.map(g=>g.value)),d=[{id:"label",type:"j-title",getCompConfig:({row:g})=>({title:g.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],u=({data:g})=>{c.value.includes(g.value)||s.value.push({label:g.label,value:g.value,sord:"ASC"})},p=g=>{s.value=JSON.parse(JSON.stringify(g))},f=()=>{r("save",JSON.parse(JSON.stringify(s.value)))},h=()=>{s.value=[],r("clear")};return t({init:p}),(g,m)=>{const y=(0,n.resolveComponent)("j-button-select"),w=(0,n.resolveComponent)("j-input-rows"),x=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",y0,[(0,n.createElementVNode)("div",b0,[(0,n.createElementVNode)("div",v0,[(0,n.createVNode)(y,{label:"添加排序规则",options:i.value,"model-value":c.value.join(","),onChange:u},null,8,["options","model-value"])]),(0,n.createElementVNode)("div",w0,[(0,n.createVNode)(w,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=v=>s.value=v),columns:d,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),(0,n.createElementVNode)("div",C0,[(0,n.createVNode)(x,{label:(0,n.unref)(a)("排序"),type:"primary",onClick:f},null,8,["label"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(x,{key:0,label:(0,n.unref)(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):(0,n.createCommentVNode)("",!0)])])}}}),k0=x0,S0={class:"j-column-panel"},E0={class:"content"},B0={class:"search-wrapper"},R0={class:"tree-wrapper"},_0={class:"buttons"},T0=(0,n.defineComponent)({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),l=e,r=o,i=(0,n.ref)(),s=(0,n.ref)(""),c={},d=(0,n.ref)([]),u=(0,n.ref)([]),p=(b,k)=>{const B=[],_=new Map;b.forEach(T=>{_.set(T.id||"",T),c[T.id||""]=T});const V=new Set;return k&&k.length>0&&k.forEach(T=>{const F=_.get(T.id);if(F){V.add(F.id||"");const L={id:F.id||"",label:F.config?.label||F.id||"",type:F.type,display:F.config?.display!==!1};F.children&&F.children.length>0&&(L.children=p(F.children,T.children)),B.push(L)}}),b.forEach(T=>{if(!V.has(T.id||"")){const F={id:T.id||"",label:T.config?.label||T.id||"",type:T.type,display:T.config?.display!==!1};T.children&&T.children.length>0&&(F.children=p(T.children)),B.push(F)}}),B},f=(b,k)=>k.length===0?b:b.map(B=>{const _=k.some(T=>B.label.toLowerCase().includes(T.toLowerCase())),V=B.children?f(B.children,k):[];return _||V.length>0?{...B,children:V.length>0?V:B.children}:null}).filter(Boolean),h=(0,n.computed)(()=>{if(!s.value)return u.value;const b=s.value.split(/\s+/).filter(Boolean);return f(u.value,b)}),g=(0,n.ref)([]),m=(0,n.computed)(()=>{const b=new Map;if(l.columnConfig&&l.columnConfig.length>0){const k=B=>{B.forEach(_=>{b.set(_.id,_),_.children&&k(_.children)})};k(l.columnConfig)}return b}),y=()=>{const b=k=>{const B=[];return k.forEach(_=>{let V=!0;if(m.value.size>0){const T=m.value.get(_.id||"");T?V=T.display:V=_.config?.display!==!1}else V=_.config?.display!==!1;V&&(B.push(_.id||""),_.children&&B.push(...b(_.children)))}),B};g.value=b(l.columns)},w=(b,{node:k})=>{b.includes(k.id)?g.value.push(k.id):g.value=g.value.filter(B=>B!==k.id)},x=(b,k,B)=>B==="inner"?!1:b.parent===k.parent,v=()=>{const b=k=>k.map(B=>{const _={...B,display:g.value.includes(B.id)};return B.children&&(_.children=b(B.children)),_});r("save",b(u.value))},C=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),s.value="",i.value){const b=i.value;b.setCheck&&b.setCheck(g.value);const k=b.$refs?.treeRef||b;k?.setCheckedKeys&&k.setCheckedKeys(g.value)}r("save",void 0)};return t({init:()=>{y(),d.value=p(l.columns,l.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(b,k)=>{const B=(0,n.resolveComponent)("j-icon"),_=(0,n.resolveComponent)("el-input"),V=(0,n.resolveComponent)("j-tree"),T=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",S0,[(0,n.createElementVNode)("div",E0,[(0,n.createElementVNode)("div",B0,[(0,n.createVNode)(_,{modelValue:s.value,"onUpdate:modelValue":k[0]||(k[0]=F=>s.value=F),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(B,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",R0,[(0,n.createVNode)(V,{ref_key:"treeRef",ref:i,list:h.value,"is-tree-data":!0,"default-checked-keys":g.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":x,check:w},null,8,["list","default-checked-keys","draggable"])])]),(0,n.createElementVNode)("div",_0,[(0,n.createVNode)(T,{label:(0,n.unref)(a)("确定"),type:"primary",onClick:v},null,8,["label"]),(0,n.createVNode)(T,{label:(0,n.unref)(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),M0=T0,V0={class:"j-table-panel-left"},N0={class:"j-table-panel-top"},A0={class:"j-table-panel-top-right"},P0={key:0,style:{width:"200px"}},j0={class:"j-table-panel-main"},O0={class:"j-table-panel-loading"},I0={class:"j-table-panel-loading-content"},z0={class:"j-table-panel-loading-text"},L0={key:0,class:"j-table-panel-filter-panel"},H0=(0,n.defineComponent)({name:"JTablePanel",__name:"table-panel",props:{columns:{type:Array,required:!0,default:()=>[]},isTree:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},parentKey:{type:String,default:""},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},selectStateKey:{type:String,default:""},isPage:{type:Boolean,default:!1},pageSizes:Array,pageSize:{type:Number,default:100},subColumns:{type:Array,default:()=>[]},isSubShowNumber:{type:Boolean,default:!0},subActions:{type:Array,default:()=>[]},loadChildren:{type:Function,default:null},rowKey:{type:String,default:void 0},sort:String,buttons:{type:Array,default:()=>[]},batchButtons:{type:Array,default:()=>[]},actions:{type:Array,default:()=>[]},actionsMaxCount:{type:Number,default:3},actionsLabel:{type:String,default:"操作"},actionFilter:{type:Function,default:null},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean,highlightMode:{type:String,default:"row"},showFilterButton:{type:Boolean,default:!0},showOrderButton:{type:Boolean,default:!0},showColumnButton:{type:Boolean,default:!0},showRefreshButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0}},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),{openLayer:l}=Wn(),r=e,i=o;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=(0,n.ref)();let c=[];const d=(0,n.ref)(0),u=(0,n.ref)(1);let p=r.pageSize||100;const f=(0,n.ref)(0),h=(0,n.computed)(()=>f.value>0),g=(0,n.ref)([]),m=(0,n.ref)(!1),y=(0,n.computed)(()=>r.batchButtons&&r.batchButtons.length>0),w=(0,n.computed)(()=>g.value.length>0),x=(0,n.computed)(()=>y.value&&w.value&&r.isMultiple||m.value),v=(0,n.computed)(()=>r.isPage&&!x.value);y.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const C=pe=>r.rowKey?r.rowKey.split(",").map(be=>pe[be.trim()]).join("::"):"",R=(pe,be)=>{if(!be||be.length===0)return pe.filter(re=>re.config?.display!==!1).map(re=>re.children&&re.children.length>0?{...re,children:R(re.children)}:re);const Ze=new Map(pe.map(re=>[re.id,re])),ct=[];return be.forEach(re=>{const Ke=Ze.get(re.id);if(Ke){if(re.display){let Ct=Ke;Ke.children&&Ke.children.length>0&&(Ct={...Ke,children:R(Ke.children,re.children)}),ct.push(Ct)}Ze.delete(re.id)}}),pe.forEach(re=>{if(Ze.has(re.id)&&re.config?.display!==!1){let Ke=re;re.children&&re.children.length>0&&(Ke={...re,children:R(re.children)}),ct.push(Ke)}}),ct},b=(0,n.computed)(()=>R(r.columns,Te.value)),k=(0,n.computed)(()=>Jr(r.columns,pe=>pe.config.label)),B=(0,n.ref)(""),_=(0,n.computed)(()=>k.value.some(pe=>pe.config?.filter?.isSearchKeyword)),V=(0,n.ref)(),T=(0,n.ref)(!0),F=(0,n.ref)([]),L=(0,n.computed)(()=>T.value?"搜索全部":`搜索范围:${k.value.filter(pe=>F.value.includes(pe.id)).map(pe=>pe.config?.label).join("、")}`),D=()=>{V.value.init()},M=(0,n.ref)(),E=(0,n.ref)(!1),I=(0,n.ref)(!1),$=(0,n.ref)(!1),Q=(0,n.ref)([]),ue=(0,n.ref)("and"),xe=(0,n.ref)(),_e=(0,n.ref)(!1),Y=(0,n.ref)([]),z=()=>{xe.value.init(Y.value)},ie=pe=>{Y.value=pe,_e.value=!1,ke()},fe=()=>{Y.value=[],ke()},de=(0,n.ref)(),ve=(0,n.ref)(!1),Te=(0,n.ref)(),X=(0,n.computed)(()=>Te.value!=null),ye=()=>{de.value?.init()},Be=pe=>{Te.value=pe,ve.value=!1},Me=(0,n.ref)(!1),ft=()=>{Me.value=!Me.value},mt=()=>{g.value=[],s.value&&(s.value.setSelection?.([]),m.value&&(m.value=!1,s.value.setRecords(c)))},ze=()=>{m.value=!m.value,m.value?s.value?.setRecords(g.value):(console.log(c,"tableData"),s.value?.setRecords(c)),s.value?.setSelection?.(g.value)},jn=(0,n.computed)(()=>{if(g.value.length>0&&r.isMultiple){const pe=[{id:"selection_count",label:`已选${g.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:m.value?"全部":"仅选中",config:{type:"text"},click:ze},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:mt}],be=r.batchButtons.map(Ze=>({...Ze,click:()=>{Ze.click&&Ze.click({data:g.value,openLayer:l})}}));return[...pe,...be]}return r.buttons}),st=(0,n.computed)(()=>jn.value.filter(pe=>pe.config?.display!==!1)),Et=(0,n.ref)(null),U=(0,n.ref)(0),ae=()=>{U.value=Et.value?.clientWidth||0};let K;(0,n.onMounted)(()=>{(0,n.nextTick)(ae),K=new ResizeObserver(()=>{ae()}),Et.value&&K.observe(Et.value)}),(0,n.onBeforeUnmount)(()=>{K?.disconnect()}),(0,n.watch)(()=>st.value,()=>{(0,n.nextTick)(ae)},{deep:!0}),(0,n.watch)(Me,()=>{(0,n.nextTick)(ae)});const q=(0,n.computed)(()=>{const pe=st.value;if(pe.length===0)return[];const be=U.value;if(be<=0)return pe;const Ze=Math.max(0,be-4),ct=(yt,at)=>yt.groupId||`__auto_${at}`,re=yt=>{if(yt.config?.notLabel===!0||!yt.label)return 28;const at=24,Vt=kt(yt.label||"")||0,Bt=yt.config?.icon?18:0;return Math.ceil(Vt+at+Bt+2)};if((yt=>{let at=0,Vt=null;return yt.forEach((Bt,Do)=>{const Ga=ct(Bt,Do);Vt!==null&&(at+=Ga===Vt?-1:8),at+=re(Bt),Vt=Ga}),at})(pe)<=Ze)return pe;const Ct={id:"__table_panel_more__",label:"",config:{icon:"mdi:dots-horizontal",notLabel:!0},children:[]},pt=28,dt=[];let Fe=0,co=null;for(let yt=0;yt<pe.length;yt++){const at=pe[yt],Vt=ct(at,yt);let Bt=Fe;co!==null&&(Bt+=Vt===co?-1:8),Bt+=re(at);const Do=pe.length-(yt+1)>0?(Bt>0?8:0)+pt:0;if(Bt+Do<=Ze)dt.push(at),Fe=Bt,co=Vt;else break}const Ka=pe.slice(dt.length);if(Ka.length===0)return pe;const On={...Ct,children:Ka};return dt.length===0?[On]:[...dt,On]});let te;const Ce=async pe=>{f.value++;const be={};pe&&(te=pe),te&&(be.query=te);try{const Ze={};Ze.rel=ue.value,Ze.cond=(M.value?.getSearchFields?.()||Q.value).filter(re=>re.value!==void 0&&re.value!==null&&re.value!==""||["empty","not_empty"].includes(re.method)).map(re=>({field:re.field,method:re.method,value:re.value,type:re.type})),Ze.cond.length>0?$.value=!0:$.value=!1,be.filter=Ze;const ct=Y.value.map(re=>re.value+" "+re.sord).join(",");if(B.value&&(be.keyword={value:B.value,fields:T.value?k.value.filter(re=>re.config?.filter?.isSearchKeyword).map(re=>re.id):(0,n.unref)(F)}),r.loadData){if(r.isPage){be.pagination={rows:p,page:u.value,sort:ct||r.sort||r.rowKey};const re=await r.loadData(be)||{};c=re.rows||[],d.value=re.records||0}else be.sort=ct,c=await r.loadData(be)||[],d.value=c.length;s.value.setRecords(c),y.value?(g.value=[],m.value=!1):r.rowKey&&g.value.length>0&&s.value?.setSelection?.(g.value)}}finally{f.value=Math.max(0,f.value-1)}},ke=async()=>{u.value=1,await Ce()},Le=({rows:pe,page:be})=>{p=pe,u.value=be,Ce()},ot=async()=>{g.value=[],m.value=!1,u.value=1,te=void 0,await Ce()},We=async pe=>{g.value=[],m.value=!1,await Ce(pe)},vn=async()=>{await ot()},wn=pe=>{i("ready",pe)},Lo=({selections:pe,record:be,checked:Ze,isMultiple:ct})=>{let re=[];if(!r.isMultiple){g.value=pe,i("select",{selections:pe,record:be,checked:Ze,isMultiple:ct});return}if(y.value)re=pe;else if(!r.rowKey)re=pe;else{const Ke=new Map(pe.map(pt=>[C(pt),pt])),Ct=new Map(g.value.map(pt=>[C(pt),pt]));c.forEach(pt=>{const dt=C(pt);Ke.has(dt)?Ct.set(dt,Ke.get(dt)):Ct.delete(dt)}),re=Array.from(Ct.values())}g.value=re,i("select",{selections:re,record:be,checked:Ze,isMultiple:ct}),m.value&&re.length===0?(m.value=!1,s.value&&s.value.setRecords(c)):m.value&&re.length>0&&s.value&&(s.value.setRecords(re),s.value.setSelection?.(re))},Ho=pe=>{g.value=pe},Mr=()=>g.value||[],Ja=pe=>{g.value=pe,s.value?.setSelection?.(pe)},$t=()=>s.value;return(0,n.onMounted)(async()=>{r.immediate&&await We()}),t({refreshData:We,resetData:ot,getSelection:Mr,setSelection:Ja,clearSelection:()=>{mt()},getTableRef:$t}),(pe,be)=>{const Ze=(0,n.resolveComponent)("j-buttons"),ct=(0,n.resolveComponent)("j-icon"),re=(0,n.resolveComponent)("el-popover"),Ke=(0,n.resolveComponent)("el-tooltip"),Ct=(0,n.resolveComponent)("el-input"),pt=(0,n.resolveComponent)("j-button"),dt=(0,n.resolveComponent)("j-table");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-table-panel-wrapper",{fullscreen:Me.value,"no-padding":e.noPadding||Me.value}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-table-panel",{"j-table-panel-fullscreen":Me.value}])},[(0,n.createElementVNode)("div",V0,[(0,n.createElementVNode)("div",N0,[(0,n.createElementVNode)("div",{ref_key:"topLeftRef",ref:Et,class:"j-table-panel-top-left"},[(0,n.createVNode)(Ze,{list:q.value},null,8,["list"])],512),(0,n.createElementVNode)("div",A0,[_.value&&!x.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",P0,[(0,n.createVNode)(Ct,{modelValue:B.value,"onUpdate:modelValue":be[2]||(be[2]=Fe=>B.value=Fe),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:(0,n.withKeys)(ke,["enter"]),onClear:ke},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(ct,{icon:"mdi:search"})]),suffix:(0,n.withCtx)(()=>[(0,n.createVNode)(Ke,{placement:"bottom",content:L.value},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(re,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:D,onHide:ke},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(ct,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(s0,{ref_key:"keywordPanelRef",ref:V,"check-all":T.value,"onUpdate:checkAll":be[0]||(be[0]=Fe=>T.value=Fe),"check-fields":F.value,"onUpdate:checkFields":be[1]||(be[1]=Fe=>F.value=Fe),columns:k.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),e.showFilterButton&&!E.value&&!x.value?((0,n.openBlock)(),(0,n.createBlock)(re,{key:1,visible:I.value,"onUpdate:visible":be[6]||(be[6]=Fe=>I.value=Fe),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:ke},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:(0,n.normalizeClass)({active:$.value})},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(is,{ref_key:"filterPanelRef",ref:M,"is-pin":E.value,"onUpdate:isPin":be[3]||(be[3]=Fe=>E.value=Fe),relation:ue.value,"onUpdate:relation":be[4]||(be[4]=Fe=>ue.value=Fe),"search-field-list":Q.value,columns:k.value,onFilter:ke,onClose:be[5]||(be[5]=Fe=>I.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):(0,n.createCommentVNode)("",!0),e.showOrderButton&&!x.value?((0,n.openBlock)(),(0,n.createBlock)(Ke,{key:2,placement:"bottom",content:(0,n.unref)(a)("排序")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(re,{visible:_e.value,"onUpdate:visible":be[7]||(be[7]=Fe=>_e.value=Fe),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:z},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{class:(0,n.normalizeClass)({active:Y.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(k0,{ref_key:"orderPanelRef",ref:xe,columns:k.value,onSave:ie,onClear:fe},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showColumnButton&&!x.value?((0,n.openBlock)(),(0,n.createBlock)(Ke,{key:3,placement:"bottom",content:(0,n.unref)(a)("显示字段")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(re,{visible:ve.value,"onUpdate:visible":be[8]||(be[8]=Fe=>ve.value=Fe),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:ye},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{class:(0,n.normalizeClass)({active:X.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(M0,{ref_key:"columnPanelRef",ref:de,columns:e.columns,"column-config":Te.value,onSave:Be},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showRefreshButton&&!x.value?((0,n.openBlock)(),(0,n.createBlock)(Ke,{key:4,placement:"bottom",content:(0,n.unref)(a)("刷新")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{type:"text",icon:"mdi:refresh",onClick:vn})]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showFullscreenButton?((0,n.openBlock)(),(0,n.createBlock)(Ke,{key:5,placement:"bottom",content:Me.value?(0,n.unref)(a)("退出全屏"):(0,n.unref)(a)("全屏")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(pt,{type:"text",icon:Me.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:ft},null,8,["icon"])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0)])]),(0,n.createElementVNode)("div",j0,[(0,n.withDirectives)((0,n.createElementVNode)("div",O0,[(0,n.createElementVNode)("div",I0,[(0,n.createVNode)(ct,{icon:"mdi:loading",class:"loading-spin",size:24}),(0,n.createElementVNode)("div",z0,(0,n.toDisplayString)((0,n.unref)(a)("加载中")),1)])],512),[[n.vShow,h.value]]),(0,n.createVNode)(dt,{ref_key:"tableRef",ref:s,"table-page":u.value,"onUpdate:tablePage":be[9]||(be[9]=Fe=>u.value=Fe),columns:b.value,"sub-columns":e.subColumns,records:(0,n.unref)(c),"is-tree":e.isTree,"default-expand-all":e.defaultExpandAll,"parent-key":e.parentKey,"is-show-number":e.isShowNumber,"is-sub-show-number":e.isSubShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"select-state-key":e.selectStateKey,"is-page":v.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":d.value,"row-key":e.rowKey,actions:e.actions,"sub-actions":e.subActions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"action-filter":e.actionFilter,"highlight-mode":e.highlightMode,"load-children":e.loadChildren,onLoadPageData:Le,onReady:wn,onSelectionChanged:Lo,onSelectRecordsChanged:Ho},null,8,["table-page","columns","sub-columns","records","is-tree","default-expand-all","parent-key","is-show-number","is-sub-show-number","is-multiple","select-state-key","is-page","page-sizes","page-size","page-total","row-key","actions","sub-actions","actions-max-count","actions-label","action-filter","highlight-mode","load-children"])])]),e.showFilterButton&&E.value&&!x.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",L0,[(0,n.createVNode)(is,{ref_key:"filterPanelRef",ref:M,"is-pin":E.value,"onUpdate:isPin":be[10]||(be[10]=Fe=>E.value=Fe),relation:ue.value,"onUpdate:relation":be[11]||(be[11]=Fe=>ue.value=Fe),"search-field-list":Q.value,columns:k.value,onFilter:ke},null,8,["is-pin","relation","search-field-list","columns"])])):(0,n.createCommentVNode)("",!0)],2)],2)}}}),D0=H0,xl=se(D0),F0={class:"j-button-select"},$0={class:"search-wraper"},W0={class:"options-wraper"},U0=["onClick"],J0=(0,n.defineComponent)({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:l}=Je(),r=(0,n.ref)(""),i=(0,n.computed)(()=>r.value===""?o.options:o.options.filter(d=>(d.label||"").includes(r.value))),s=(0,n.computed)(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),c=d=>{if(d.disabled||s.value.includes(d.value))return;const u=[...s.value,d.value].join(",");a("update:modelValue",u),a("change",{value:u,data:d})};return(d,u)=>{const p=(0,n.resolveComponent)("j-button"),f=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-input"),g=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createBlock)(g,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(p,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",F0,[(0,n.createElementVNode)("div",$0,[(0,n.createVNode)(h,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=m=>r.value=m),modelModifiers:{trim:!0},placeholder:(0,n.unref)(l)("搜索"),class:"no-border",clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(f,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",W0,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i.value,m=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:m.value,class:(0,n.normalizeClass)(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:(0,n.withModifiers)(y=>c(m),["stop"])},[m.icon?((0,n.openBlock)(),(0,n.createBlock)(f,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(l)(m.label)),1)],10,U0))),128))])])]),_:1},8,["width"])}}}),Y0=J0,ss=se(Y0),K0={class:"j-tree-item-text"},G0={key:2,class:"j-tree-item-button-group"},q0={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},X0=(0,n.defineComponent)({name:"JTree",__name:"tree",props:{loadData:Function,afterLoadData:Function,click:Function,immediate:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},defaultCheckedKeys:{type:Array,default:()=>[]},defaultExpandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightCurrent:{type:Boolean,default:!0},filterNode:Function,renderAfterExpand:{type:Boolean,default:!0},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},pidKey:{type:String,default:"pid"},idKey:{type:String},iconKey:{type:String,default:"nodeIcon"},iconColorKey:{type:String,default:"nodeIconColor"},list:{type:Array},dataType:String,dataCode:String,checkable:Boolean,check:Function,emptyDes:{type:String,default:"暂无数据"},defaultIcon:{type:String,default:""},defaultIconColor:{type:String,default:""},treeButtons:{type:Array,default:()=>[]},filterButton:Function,buttonDefaultIcon:{type:String,default:""},buttonIconColor:{type:String,default:""},runFlow:{type:Function},nodeClickFlow:{type:String},isHeightAuto:{type:Boolean,default:!1},theme:{type:String,default:"default"},draggable:{type:Boolean,default:!1},expandOnClickNode:{type:Boolean,default:!1},allowDrop:Function},emits:["node-drop"],setup(e,{expose:t,emit:o}){const a=e,l=o,{useData:r,t:i}=Je(),{getTreeData:s,loadData:c}=r(),d=(0,n.ref)(),u=(0,n.ref)(!1),p=(0,n.ref)(""),f=(0,n.ref)([]),h={children:"children",label:"label",disabled:"disabled"},g=(0,n.computed)(()=>s?s({dataType:a.dataType,dataCode:a.dataCode,labelKey:a.labelKey,valueKey:a.valueKey,pidKey:a.pidKey,idKey:a.idKey,notLoad:!0})||[]:[]),m=(0,n.computed)(()=>a.dataCode||a.dataType?g.value:a.list?(0,n.unref)(a.list):f.value),y=async()=>{u.value=!0,a.loadData&&(f.value=await a.loadData()||[]),c&&await c(a.dataType,a.dataCode),u.value=!1,(0,n.nextTick)(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},w=(D,M=!0)=>{d.value?.setCurrentKey(D,M)},x=()=>d.value?.getCurrentKey(),v=(D,M=!1)=>{d.value?.setCheckedKeys(D,M)},C=(D=!1)=>d.value?.getCheckedKeys(D),R=async(D,M,E,I)=>{if(p.value=D.value,a.nodeClickFlow&&a.runFlow){const $=JSON.parse(a.nodeClickFlow);await a.runFlow($,{value:D.value})}a.click&&a.click(D.value,D,I)},b=(D,{checkedKeys:M,checkedNodes:E,halfCheckedKeys:I,halfCheckedNodes:$})=>{a.check&&a.check(M,{node:D,checkedNodes:E,halfCheckedKeys:I,halfCheckedNodes:$})},k=(D,M,E,I)=>{l("node-drop",D,M,E,I)},B=D=>{const M=xt(a.treeButtons);return D&&a.filterButton?a.filterButton({buttons:M,node:D}):M},{openLayer:_}=Wn(),V=(D,M)=>{D.config?.disabled||D.click&&D.click({data:M,openLayer:_})},T=(0,n.ref)(""),F=(D,M)=>{T.value=D?M.value:"",console.log(T.value,"row")},L=(D,M,E)=>a.allowDrop?a.allowDrop(D,M,E):!(E=="inner"&&!M.data.canInner);return(0,n.onMounted)(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),(0,n.watch)(()=>a.list,()=>{u.value=!0,(0,n.nextTick)(()=>{u.value=!1})}),(0,n.watch)(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:w,getValue:x,setCheck:v,getCheck:C}),(D,M)=>{const E=(0,n.resolveComponent)("j-icon"),I=(0,n.resolveComponent)("j-button"),$=(0,n.resolveComponent)("el-dropdown-item"),Q=(0,n.resolveComponent)("el-dropdown-menu"),ue=(0,n.resolveComponent)("el-dropdown"),xe=(0,n.resolveComponent)("el-tree"),_e=(0,n.resolveComponent)("el-empty"),Y=(0,n.resolveDirective)("loading");return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!u.value&&m.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(xe,{key:0,ref_key:"treeRef",ref:d,"node-key":e.idKey||e.valueKey,"default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":p.value,data:m.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:h,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":L,"expand-on-click-node":e.expandOnClickNode,onNodeClick:R,onCheck:b,onNodeDrop:k},{default:(0,n.withCtx)(({node:z})=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-tree-item-wraper",{"is-focus":T.value===z.data.value}])},[z.data.openIcon?((0,n.openBlock)(),(0,n.createBlock)(E,{key:0,class:"j-tree-item-open-icon",size:18,icon:z.data.openIcon,color:z.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),z.data[e.iconKey]||e.defaultIcon?((0,n.openBlock)(),(0,n.createBlock)(E,{key:1,class:"j-tree-item-default-icon",size:18,icon:z.data[e.iconKey]||e.defaultIcon||"",color:z.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",K0,(0,n.toDisplayString)(z.label),1),B(z.data).length?((0,n.openBlock)(),(0,n.createElementBlock)("div",G0,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(B(z.data),(ie,fe)=>((0,n.openBlock)(),(0,n.createBlock)(ue,{key:fe,trigger:"click",onVisibleChange:de=>F(de,z.data)},{dropdown:(0,n.withCtx)(()=>[(0,n.createVNode)(Q,null,{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(ie.children,(de,ve)=>((0,n.openBlock)(),(0,n.createBlock)($,{key:ve,disabled:de.disabled,divided:de.divided,onClick:(0,n.withModifiers)(Te=>V(de,z.data),["stop"])},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"j-flex-item",style:(0,n.normalizeStyle)({color:de.danger?"var(--j-color-danger)":de.color||e.buttonIconColor||"var(--j-color-text-2)"})},[de.icon||e.buttonDefaultIcon?((0,n.openBlock)(),(0,n.createBlock)(E,{key:0,icon:de.icon||e.buttonDefaultIcon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(i)(de.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(I,{icon:ie.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):(0,n.createCommentVNode)("",!0)],2)]),_:1},8,["node-key","default-checked-keys","default-expanded-keys","current-node-key","data","default-expand-all","show-checkbox","highlight-current","accordion","filter-node-method","render-after-expand","draggable","expand-on-click-node"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",q0,[(0,n.createVNode)(_e,{description:(0,n.unref)(i)(e.emptyDes)},null,8,["description"])]))],2)),[[Y,u.value]])}}}),Z0=X0,cs=se(Z0),Q0=(0,n.defineComponent)({name:"JTreeSelect",__name:"tree-select",props:{modelValue:{},options:{},checkStrictly:{type:Boolean,default:!0},renderAfterExpand:{type:Boolean,default:!0},props:{default:()=>({children:"children",label:"label",value:"value"})},size:{default:"default"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},placeholder:{default:"请选择"},dataType:{default:""},dataCode:{default:""},labelKey:{default:""},valueKey:{default:""},pidKey:{default:""},idKey:{default:""}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a={dataItem:{label:"j_ItemName",value:"j_ItemValue",idKey:"j_Id",pidKey:"j_ParentId"},dataClassify:{label:"j_ItemName",value:"j_ItemCode",idKey:"j_Id",pidKey:"j_ParentId"},dblink:{label:"j_Name",value:"j_Code"},area:{label:"j_AreaName",value:"j_AreaCode",idKey:"j_AreaId",pidKey:"j_ParentId"}},{useData:l}=Je(),{getTreeData:r}=l(),i=(0,n.computed)(()=>r?r({dataType:o.dataType,dataCode:o.dataCode,labelKey:o.labelKey||a[o.dataType]?.label||"label",valueKey:o.valueKey||a[o.dataType]?.value||"value",pidKey:o.pidKey||a[o.dataType]?.pidKey||"pid",idKey:o.idKey||a[o.dataType]?.idKey||"id",notLoad:!1})||[]:[]),s=(0,n.computed)(()=>o.dataCode||o.dataType?i.value:o.options||[]),c=t,d=(0,n.computed)({get(){return o.modelValue},set(p){c("update:modelValue",p)}}),u=p=>{c("change",p)};return(p,f)=>{const h=(0,n.resolveComponent)("el-tree-select");return(0,n.openBlock)(),(0,n.createBlock)(h,{modelValue:d.value,"onUpdate:modelValue":f[0]||(f[0]=g=>d.value=g),data:s.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:o,style:{width:"100%"},size:e.size,disabled:e.disabled||e.readonly,clearable:e.clearable,placeholder:e.placeholder,onChange:u},null,8,["modelValue","data","check-strictly","render-after-expand","size","disabled","clearable","placeholder"])}}}),em=Q0,ds=se(em),us=se(Vi),tm=ul.default;async function nm(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const l=new tm({[e]:[a]});let r=[];try{await l.validate({[e]:t})}catch(i){i.errors?r=i.errors.map(({message:s})=>s):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function om(e,t,o){const a=o.map((l,r)=>({...l,ruleIndex:r})).sort(({warningOnly:l,ruleIndex:r},{warningOnly:i,ruleIndex:s})=>!!l==!!i?r-s:l?1:-1);for(let l=0;l<a.length;l+=1){const r=a[l];"pattern"in r&&(t+="");const i=await nm(e,t,r);if(i!=="")return{name:e,errors:i}}}function am(e,t){const o=(r,i,s,c,d)=>{Object.keys(i).forEach(u=>{let p=u;s&&(p=`${s}.${u}`);const f=i[u],{rules:h,myGridtableId:g}=t(p,s?i:void 0,()=>c,d);if(h.length){const m=a(p,f,h);r.push(m)}g&&f.forEach(m=>{o(r,m,g,f,s?i:void 0)})})},a=(r,i,s)=>om(r,i,s);return{validateForm:async()=>{const r=(0,n.unref)(e),i=[];o(i,r,"");const s=await Promise.all(i),c={};return s.forEach(d=>{d&&(c[d.name]={msg:d.errors})}),c},validateField:a}}var lm=(0,n.defineComponent)({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["change"],setup(e,{expose:t,emit:o}){const a=e,l=o,{useData:r,existField:i,httpGet:s,httpPost:c,success:d,warning:u,error:p,info:f,t:h}=Je();let g;r&&(g=r());const m=U=>{p&&p(U)},y=(0,n.ref)(!1),w=(0,n.computed)(()=>a.config?.gutter||16),x=(0,n.computed)(()=>a.config?.span||24),v=(0,n.computed)(()=>a.config?.labelWidth),C=(0,n.computed)(()=>a.config?.labelPosition||"right"),R=(0,n.computed)(()=>B.length===1&&(B[0].type==="j-tabs"||B[0].type==="j-layout"||B[0].config?.isAutoWindow)),b=(0,n.reactive)({}),k=(0,n.ref)({}),B=[],_={},V=(0,n.ref)({});let T={},F={},L=[],D={};const M=U=>{y.value&&$&&(U.getTableData||gl($,U.id,U.formData[U.id])),l("change",U)},E=U=>ea(_[U]?.type||"")&&!_[U]?.config?.notInput||_[U]?.config?.isInput,I=U=>["j-table","j-input-rows","j-input-cards"].includes(_[U]?.type||"");let $;const Q=(U,ae)=>{Object.keys(U).forEach(K=>{const q=U[K];ae&&(K=ae+"."+K),q!=null&&typeof q=="object"&&!Xo(q)&&Q(q,K),b[K]=q})},ue=(U,ae)=>{let K=U.id;return K||(U.config?.table&&U.config?.field?K=`${U.config.table}.${U.config.field}`:U.config?.table?K=U.config?.table:U.config?.field&&(K=U.config?.field),ae&&I(ae)&&(K=`${ae}.${K}`)),K||Qo("j")},xe=(U,ae,K,q="")=>{U.forEach(te=>{te.id=ue(te,q);const Ce={id:te.id,slot:te.slot,type:te.type||"",getCompType:te.getCompType,getCompConfig:te.getCompConfig,config:{},children:[]};ae.push(Ce);const{children:ke}=te;fo(Ce,te,["children","config"]),fo(Ce.config,te.config||{},[]),_[te.id]&&console.warn("有重复的组件id:"+te.id),_[te.id]=Ce,a.readonly===!0&&(Ce.config.readonly=!0);let Le=!1,ot;q!==""&&I(q)&&(Le=!0,Ce.config=te.config||{},Ce.config.parentTableId=q,ot=_[q]?.config?.table);const We=Ce.config||{};if(E(te.id))!K&&Le===!1&&(We?.defaultValue===0?b[te.id]=We?.defaultValue:b[te.id]=We?.defaultValue||void 0),We.table&&We.field?T[`${We.table}_${We.field}`.toLowerCase()]=te.id:We.field&&(Le?T[`${ot}_${We.field}`.toLowerCase()]=te.id:T[`${We.field}`.toLowerCase()]=te.id);else if(Le&&We.field)T[`${ot}_${We.field}`.toLowerCase()]=te.id;else if(I(te.id))!K&&!We.isSubTable&&(b[te.id]=[]),We.table&&(T[We.table.toLowerCase()||""]=te.id),We.isSubTable||L.push(Ce);else if(We?.defaultValue)b[te.id]=We?.defaultValue;else if(te.type==="collapse"&&We?.isExpand){const vn=[];(We?.groups||[]).forEach(wn=>{vn.push(wn.i)}),b[te.id]=vn}ke&&ke.length>0&&xe(ke,Ce.children,K,Ce.id)})},_e=async(U,ae)=>{y.value=!1;const K=!!ae;B.splice(0,B.length),T={},F={},L=[],$=ae,Dn(b),Dn(_),V.value={},K&&Q(ae,""),xe(U,B,K),D=xt(b),await(0,n.nextTick)(),y.value=!0,await(0,n.nextTick)(),st(a.config?.codeInit,{})},Y=(U,ae,K)=>{const q=[];return ae.forEach(te=>{const Ce={};Object.keys(te).forEach(ke=>{if(!K||K(ke,te[ke],U)){const Le=Be(ke);if(Le?.type==="j-table")Ce[Le?.id||""]=Y(ke,te[ke],K);else{let ot=T[`${U}_${ke}`.toLowerCase()]||ke;ot=ot.indexOf(".")!==-1?ot.split(".")[1]:ot,Ce[ot]=te[ke]}}}),q.push(Ce)}),q},z=(U,ae)=>{Object.keys(U||{}).forEach(K=>{let q=U[K];const te=Be(K);if(te===void 0)q&&(Xo(q)&&(q=q[0]||{}),typeof q=="object"?Object.keys(q).forEach(Ce=>{if(!ae||ae(K,q[Ce],K)){let ke=Ce;K!=="main"&&(ke=`${K}_${Ce}`),F[ke]=K,b[T[ke.toLowerCase()]||Ce]=q[Ce]}}):b[K]=q);else if(I(te.id||"")){if(!Array.isArray(q)){console.warn("表格数据不是数组:"+K);return}q?.length>0?b[T[K.toLowerCase()]||K]=Y(K,q,ae):b[T[K.toLowerCase()]||K]=[]}else(!ae||ae(K,q,K))&&(b[T[K.toLowerCase()]||K]=q)}),$&&Object.keys(b).forEach(K=>{const q=Be(K);(q===void 0||!["j-tabs","j-collapse"].includes(q.type||""))&&gl($,K,b[K])})},ie=(U,ae=!1)=>{const K={};return Object.keys(U).forEach(q=>{if(q==="parentRow")return;const te=_[q];if(te){const Ce=te.config?.table,ke=te.config?.field;if(ae)ke?K[ke]=U[q]:K[q]=U[q];else if(I(q)){const Le=[];U[q].forEach(ot=>{Le.push(ie(ot,!0))}),K[Ce||q]=Le}else Ce&&ke?(K[Ce]=K[Ce]||{},K[Ce][ke]=U[q]):ke&&(K[ke]=U[q])}else ae?q!=="_X_ROW_KEY"&&q!=="_isHover"&&(K[q]=U[q]):F[q]?(K[F[q]]=K[F[q]]||{},K[F[q]][q.replace(`${F[q]}_`,"")]=U[q]):K[q]=U[q]}),K},fe=(U=!0)=>U?ie(b):b,de=(U,ae,K,q)=>{let te=_[U];if(te==null){const ke=U.split(".");te=_[ke[ke.length-1]]||{}}if(!te)return{};const Ce=_t({config:{...te.config||{},...V.value[te.id||""]||{}},getCompConfig:te.getCompConfig,formData:b,getTableData:K,row:ae,pRowData:q});return Ce._componentId=te?.id,Ce},ve=(U,ae,K,q)=>{const te=de(U,ae,K,q);if(te.isNotRule!==!0&&te.display!==!1){const Ce=te.rule||[],ke=Ce.find(Le=>Le.type==="only");return ke&&(ke.validator=async(Le,ot)=>{if(ot&&!await i({table:Le.table,key:Le.key,keyName:Le.keyName,field:Le.field,keyValue:Le.getKeyValue?Le.getKeyValue():"",value:ot,paramNames:Le.paramNames,getParams:Le.getParams,withProjectId:Le.withProjectId,getValue:Le.getValue,formData:b}))throw h(Le.message)||h("数据值重复")}),{rules:Ce,myGridtableId:I(te._componentId)?te._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:Te}=am(b,ve),X=async()=>{k.value={};const U=await Te();return Object.keys(U).length>0?(k.value=U,m(`${h(_[Object.keys(U)[0]]?.config?.label)}:${h(U[Object.keys(U)[0]].msg)}`),!1):!0},ye=()=>{k.value={},Dn(b),Object.keys(D||{}).forEach(U=>{b[U]=D[U]})},Be=U=>{let ae=_[U];return ae===void 0&&T[U.toLowerCase()]&&(ae=_[T[U.toLowerCase()]]),ae},Me=({id:U,i:ae,value:K,type:q})=>{if(q==="add")b[U].push(K);else if(q==="delete")b[U].splice(ae,1);else{const te=Be(U);te&&(te.config.parentTableId?b[te.config.parentTableId][ae][U]=K:b[U]=K)}},ft=({id:U,i:ae})=>{const K=Be(U);if(K){if(K.config.parentTableId){const q=b[K.config.parentTableId],te=K.id?K.id.replace(`${K.config.parentTableId}.`,""):"";if(ae!=null)return(q[ae]||{})[te||""];const Ce=[];return q&&q.forEach(ke=>{Ce.push(ke[te||""])}),Ce}if(I(K.id||"")){const q=[];return b[K.id||""].forEach(te=>{q.push(ie(te,!0))}),q}return b[K.id||""]}if(b[U])return b[U]},mt=async({id:U,i:ae})=>{const K=ft({id:U,i:ae}),q=Be(U);if(q&&g?.getLabel)if(ae!==void 0){const te=K[ae],Ce=b[q.config.parentTableId||""][ae],ke=_t({config:q.config,getCompConfig:q.getCompConfig,formData:b,tableData:b[q.config.parentTableId||""],row:Ce});return await g?.getLabel({value:te,config:ke,formData:b,tableData:b[q.config.parentTableId||""],row:Ce})}else{const te=_t({config:q.config,getCompConfig:q.getCompConfig,formData:b});return await g?.getLabel({value:K,config:te,formData:b})}return K},ze=async(U,ae)=>g?.loadViewDataList?await g?.loadViewDataList(U,ae,!1):[],jn=U=>(U.set=Me,U.get=ft,U.setFormData=z,U.getFormData=fe,U.getLabel=mt,U.getViewData=ze,U.getDateNow=ae=>na(new Date,ae||"YYYY-MM-DD HH:mm:ss"),U.httpGet=s||(()=>{console.log("当前状态不支持")}),U.httpPost=c||(()=>{console.log("当前状态不支持")}),U.loading=ae=>{Fn(ae)},U.showMsg=({text:ae,type:K})=>{switch(K){case"success":d&&d(ae);break;case"warning":u&&u(ae);break;case"error":p&&p(ae);break;case"info":f&&f(ae);break;default:f&&f(ae);break}console.log("showMsg",ae,K)},U),st=async(U,ae)=>{if(U&&U.trim()){U=`async (jcode) => {${U}}`;const{res:K,fn:q}=hl(U);K&&await q(jn(ae))}},Et=(U,ae)=>{V.value[U]={...V.value[U]||{},...ae}};return a.schema&&_e(a.schema),bl({formData:b,components:_,compsConfig:V,errorFields:k,isAutoWindow:R,gutter:w,span:x,labelWidth:v,labelPosition:C,getValue:ft,formChange:M}),vl({contextType:"form"}),t({init:_e,reset:ye,validate:X,setValue:Me,getValue:ft,getLabel:mt,setFormData:z,getFormData:fe,setCompConfig:Et}),(U,ae)=>{const K=(0,n.resolveComponent)("j-form-item"),q=(0,n.resolveComponent)("el-row"),te=(0,n.resolveComponent)("el-form");return y.value?((0,n.openBlock)(),(0,n.createBlock)(te,{key:0,class:(0,n.normalizeClass)(["j-form",e.isAutoSize&&"j-block",e.isAutoSize&&"j-form-auto"]),"label-position":C.value,"label-width":v.value,size:e.config?.size,onSubmit:ae[0]||(ae[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[R.value?((0,n.openBlock)(),(0,n.createBlock)(K,(0,n.mergeProps)({key:0},B[0],{"is-not-col":""}),null,16)):((0,n.openBlock)(),(0,n.createBlock)(q,{key:1,gutter:w.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(B,Ce=>(0,n.createVNode)(K,(0,n.mergeProps)({key:Ce.id},{ref_for:!0},Ce),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):(0,n.createCommentVNode)("",!0)}}}),rm=lm,fs=se(rm),ps=se(Mi),im={class:"j-page"},sm=(0,n.defineComponent)({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=(0,n.ref)(!1),l=(0,n.reactive)([]),r={},i=(0,n.reactive)({}),s=(g,m)=>{g.forEach(y=>{y.id=y.id||Qo("c");const w={id:y.id,slot:y.slot,type:y.type||"",getCompConfig:y.getCompConfig,getCompType:y.getCompType},{children:x}=y;r[y.id]=w,w.config=[],fo(w.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(i[y.id]=y.config.defaultValue),m.push(w),x&&x.length>0&&(w.children=[],s(x,w.children))})},c=g=>{a.value=!1,l.splice(0,l.length),Dn(r),Dn(i),s(g,l),(0,n.nextTick)(()=>{a.value=!0})};o.schema&&c(o.schema);const d=new yl,u=new Map,p=(g,m,y,...w)=>{if(y?.immediate){const x=u.get(g)||new Map;x.set(m,w),u.set(g,x)}return d.emit(g,m,...w)},f=(g,m)=>{d.on(g,m);const y=u.get(g);y&&(u.delete(g),y.forEach((w,x)=>{m(x,...w||[])}))},h=(g,m)=>{d.off(g,m)};return ui({registerMethod:(g,m)=>(f(g,m),()=>{h(g,m)})}),vl({contextType:"page"}),t({init:c,call:p,on:f,off:h}),(g,m)=>{const y=(0,n.resolveComponent)("j-comp");return(0,n.openBlock)(),(0,n.createElementBlock)("div",im,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l,w=>((0,n.openBlock)(),(0,n.createBlock)(y,{key:w.id,id:w.id,type:w.type,config:w.config,children:w.children},null,8,["id","type","config","children"]))),128))])}}}),cm=sm,hs=se(cm),dm=(0,n.defineComponent)({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.ref)("");return(0,n.watch)(()=>o.modelValue,r=>{r?l.value=r:(l.value=Kt(),a("update:modelValue",l.value))},{immediate:!0}),(r,i)=>{const s=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(s,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=c=>l.value=c),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),um=dm,gs=se(um),fm={key:0,class:"j-panel-top"},pm=["title"],hm={style:{margin:"0","font-size":"14px"}},gm={key:1},mm={key:1,class:"j-panel-bottom"},ym=(0,n.defineComponent)({name:"JPanel",__name:"panel",props:{title:{},toolBtns:{default:()=>[]},bootmBtns:{default:()=>[]},bootmRightBtns:{default:()=>[]},bodyStyle:{default:()=>({padding:"8px"})},noPadding:{type:Boolean,default:!1},notTitle:{type:Boolean,default:!1},flexWidth:{},height:{},unit:{default:"%"},notSetWidth:{type:Boolean,default:!1},size:{default:"default"}},setup(e){const{openLayer:t}=Wn(),o=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,l)=>{const r=(0,n.resolveComponent)("j-button"),i=(0,n.resolveComponent)("el-tooltip"),s=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-block",style:(0,n.normalizeStyle)({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[(0,n.createElementVNode)("div",{class:"j-panel",style:(0,n.normalizeStyle)({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",fm,[e.notTitle?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"j-panel-top-left",title:e.title||""},[(0,n.renderSlot)(a.$slots,"title",{},()=>[(0,n.createElementVNode)("span",hm,(0,n.toDisplayString)(e.title||""),1)])],8,pm)),e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("span",gm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.toolBtns,c=>((0,n.openBlock)(),(0,n.createBlock)(i,{key:c.id,placement:"top",content:c.label||""},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(r,(0,n.mergeProps)({ref_for:!0},c.config,{onClick:d=>o(c),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):(0,n.createCommentVNode)("",!0)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"j-panel-body",style:(0,n.normalizeStyle)(e.bodyStyle)},[(0,n.renderSlot)(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",mm,[(0,n.createVNode)(s,{list:e.bootmBtns},null,8,["list"]),(0,n.createVNode)(s,{list:e.bootmRightBtns},null,8,["list"])])):(0,n.createCommentVNode)("",!0)],4)],4)}}}),bm=ym,ms=se(bm),vm={class:"j-input-rows"},wm={key:0,class:"j-input-rows-num"},Cm={key:1,class:"j-input-rows-char"},xm=(0,n.defineComponent)({name:"JInputRows",__name:"input-rows",props:{modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},isCompact:{type:Boolean,default:!1},showNum:{type:Boolean,default:!1},showChar:{type:Boolean,default:!1},isWrap:{type:Boolean,default:!1},id:{type:String,default:""}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=C=>C==null,a=e,l=t,{formData:r}=Qt(),i=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),s=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),c=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),d=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),u=(0,n.computed)(()=>a.editConfig.readonly),p=(0,n.computed)(()=>a.editConfig.drag),f=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)(),g=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],m=(0,n.ref)([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(C=>{C._i||(C._i=Kt())})):(m.value=[],l("update:modelValue",m.value)),(0,n.watch)(()=>a.modelValue,C=>{m.value=a.modelValue||[],m.value=C||[],m.value.forEach(R=>{R._i||(R._i=Kt())})},{deep:!0});const w=()=>{const C={_i:Kt()};a.columns.forEach(R=>{const b=R.config?.valueRowKey||R.id||"";b&&(C[b]=xt(R.config?.defaultValue))}),m.value.push(C),l("change",{id:a.id,value:C,data:C,formData:r,tableData:m.value,type:"add"})},x=C=>{const R=m.value[C];m.value.splice(C,1),l("change",{id:a.id,value:R,data:R,formData:r,tableData:m.value,type:"delete"})},v=C=>{l("rowChange",C)};return(0,n.onMounted)(()=>{if(!p.value||!h.value)return;const C=h.value,{initSortable:R}=ei(C,{handle:".j-input-rows-drag",onEnd:b=>{const{oldIndex:k,newIndex:B}=b;if(o(k)||o(B)||k===B||k<0||B<0)return;const _=m.value.splice(k,1)[0];m.value.splice(B,0,_),l("change",{id:a.id,value:_,data:_,formData:r,tableData:m.value,type:"sort"})}});R()}),go({getTableData:()=>m.value,rowChange:v}),(C,R)=>{const b=(0,n.resolveComponent)("j-comp"),k=(0,n.resolveComponent)("j-icon"),B=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",vm,[(0,n.createElementVNode)("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(m.value,(_,V)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:_._i+V,class:(0,n.normalizeClass)([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?((0,n.openBlock)(),(0,n.createElementBlock)("div",wm,(0,n.toDisplayString)(V+1),1)):(0,n.createCommentVNode)("",!0),e.showChar?((0,n.openBlock)(),(0,n.createElementBlock)("div",Cm,(0,n.toDisplayString)(g[V%26]),1)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,T=>((0,n.openBlock)(),(0,n.createBlock)(b,(0,n.mergeProps)({key:T.id,ref_for:!0},T,{row:_}),null,16,["row"]))),128)),p.value?((0,n.openBlock)(),(0,n.createBlock)(k,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):(0,n.createCommentVNode)("",!0),d.value&&(f.value||m.value.length>1)&&!u.value?((0,n.openBlock)(),(0,n.createBlock)(k,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:T=>x(V)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)],2))),128))],512),!u.value&&i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":c.value}),class:"j-input-rows-actions"},[i.value?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:w},null,8,["label"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)])}}}),km=xm,ys=se(km),Sm={class:"j-input-layer"},Em=(0,n.defineComponent)({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchInputList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=g=>!!(g==null||typeof g=="string"&&g.trim()===""||Array.isArray(g)&&g.length===0),a=e,l=t,r=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.ref)(""),c=(0,n.computed)({get(){return a.modelValue},set(g){l("update:modelValue",g)}}),d=(0,n.computed)({get(){return o(c.value)?"":o(s.value)?a.getText?a.getText(c.value):c.value:s.value},set(g){g||p()}});(0,n.watch)(()=>a.modelValue,()=>{s.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},p=()=>{s.value="",c.value="",l("change",{value:"",data:void 0})},f=async()=>{if(!i.value)return;const g=i.value.getSelection();if(a.isMultiSelect){const m=[],y=[];g.forEach(w=>{const x=w[a.labelKey],v=w[a.valueKey];m.push(x!=null?String(x):""),v===0||v?y.push(String(v)):y.push("")}),s.value=m.join(","),c.value=y.join(","),l("change",{value:y.join(","),data:g})}else if(g.length>0){const m=g[0],y=m[a.labelKey],w=m[a.valueKey];s.value=y!=null?String(y):"";const x=w!=null?String(w):"";c.value=x,l("change",{value:x,data:m})}else s.value="",c.value="",l("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},h=()=>{i.value&&i.value.clearSelection&&i.value.clearSelection()};return(g,m)=>{const y=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Sm,[e.onlyButton?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(Zo),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):((0,n.openBlock)(),(0,n.createBlock)(y,{key:0,modelValue:d.value,"onUpdate:modelValue":m[0]||(m[0]=w=>d.value=w),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:p},(0,n.createSlots)({_:2},[e.readonly?void 0:{name:"append",fn:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(Zo),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),(0,n.createVNode)((0,n.unref)(Cl),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:f,onClosed:h},{default:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(xl),{ref_key:"tableRef",ref:i,columns:e.columns,"row-key":e.valueKey,"is-tree":e.isTree,"is-page":e.isPage,sort:e.sidx,"is-multiple":e.isMultiSelect,"load-data":e.loadLayerData,immediate:!0},null,8,["columns","row-key","is-tree","is-page","sort","is-multiple","load-data"])]),_:1},8,["title","width","height"])])}}}),Bm=Em,bs=se(Bm),Rm=(0,n.defineComponent)({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"default"},size:{type:String,default:"default"},layerLabel:{type:String,default:"设置"},layerHeight:{type:Number,default:400},layerWidth:{type:Number,default:600},formConfig:{type:Object,default:()=>({})},schema:{type:Array,default:()=>[]}},setup(e){const t=e,o=Qt(),{t:a}=Je(),l=(0,n.computed)(()=>t.formConfig?.gutter||16),r=(0,n.computed)(()=>t.formConfig?.span||24),i=(0,n.computed)(()=>t.formConfig?.labelWidth||o.labelWidth?.value),s=(0,n.computed)(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),c=(0,n.computed)(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=(0,n.ref)(!1),u=()=>{d.value=!0};return bl({...o,isAutoWindow:c,gutter:l,span:r,labelWidth:i}),(p,f)=>{const h=(0,n.resolveComponent)("j-button"),g=(0,n.resolveComponent)("j-form-item"),m=(0,n.resolveComponent)("el-row"),y=(0,n.resolveComponent)("el-form"),w=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(h,(0,n.mergeProps)(p.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),(0,n.createVNode)(w,{visible:d.value,"onUpdate:visible":f[1]||(f[1]=x=>d.value=x),title:(0,n.unref)(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(y,{class:(0,n.normalizeClass)(["j-block","j-layer-form"]),"label-position":s.value,"label-width":i.value,size:e.formConfig?.size,onSubmit:f[0]||(f[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[c.value?((0,n.openBlock)(),(0,n.createBlock)(g,(0,n.normalizeProps)((0,n.mergeProps)({key:0},e.schema[0])),null,16)):((0,n.openBlock)(),(0,n.createBlock)(m,{key:1,gutter:l.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.schema,x=>((0,n.openBlock)(),(0,n.createBlock)(g,(0,n.mergeProps)({key:x.id,ref_for:!0},x),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}}),_m=Rm,vs=se(_m),Tm=(0,n.defineComponent)({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.computed)({get(){return o.modelValue},set(i){a("update:modelValue",i)}}),r=i=>{a("change",i)};return(0,n.onMounted)(()=>{o.autoFocus&&!o.readonly&&setTimeout(()=>{const i=l.value===o.activeValue?o.inactiveValue:o.activeValue;l.value=i,r(i)},100)}),(i,s)=>{const c=(0,n.resolveComponent)("el-switch");return(0,n.openBlock)(),(0,n.createBlock)(c,(0,n.mergeProps)(i.$attrs,{id:e.id,modelValue:l.value,"onUpdate:modelValue":s[0]||(s[0]=d=>l.value=d),size:e.size,width:e.width,"inline-prompt":e.inlinePrompt,"active-icon":e.activeIcon,"inactive-icon":e.inactiveIcon,"active-action-icon":e.activeActionIcon,"inactive-action-icon":e.inactiveActionIcon,"active-text":e.activeText,"inactive-text":e.inactiveText,"active-value":e.activeValue,"inactive-value":e.inactiveValue,name:e.name,"validate-event":e.validateEvent,"before-change":e.beforeChange,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:r}),(0,n.createSlots)({_:2},[i.$slots["active-action"]?{name:"active-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"active-action")]),key:"0"}:void 0,i.$slots["inactive-action"]?{name:"inactive-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"inactive-action")]),key:"1"}:void 0,i.$slots.active?{name:"active",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"active")]),key:"2"}:void 0,i.$slots.inactive?{name:"inactive",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(i.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}}),Mm=Tm,ws=se(Mm),Vm=(0,n.defineComponent)({name:"JTabs",__name:"tabs",props:{modelValue:{},type:{default:""},closable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},tabPosition:{default:"top"},stretch:{type:Boolean,default:!1},beforeLeave:{},isFill:{type:Boolean}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,a=d=>{o("update:modelValue",d)},l=(d,u)=>{o("tab-click",d,u)},r=d=>{o("tab-change",d)},i=d=>{o("tab-remove",d)},s=()=>{o("tab-add")},c=(d,u)=>{o("edit",d,u)};return(d,u)=>{const p=(0,n.resolveComponent)("el-tabs");return(0,n.openBlock)(),(0,n.createBlock)(p,(0,n.mergeProps)(d.$attrs,{class:{isFill:e.isFill},"model-value":e.modelValue,type:e.type,closable:e.closable,addable:e.addable,editable:e.editable,"tab-position":e.tabPosition,stretch:e.stretch,"before-leave":e.beforeLeave,"onUpdate:modelValue":a,onTabClick:l,onTabChange:r,onTabRemove:i,onTabAdd:s,onEdit:c}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(d.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}}),Nm=Vm,Cs=se(Nm),Am=(0,n.defineComponent)({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=r=>{o("update:modelValue",r)},l=r=>{o("change",r)};return(r,i)=>{const s=(0,n.resolveComponent)("el-collapse");return(0,n.openBlock)(),(0,n.createBlock)(s,(0,n.mergeProps)(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:l,"onUpdate:modelValue":a}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}}),Pm=Am,xs=se(Pm),jm={class:"j-editor"},Om=(0,n.defineComponent)({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,l=(0,n.ref)(),r=(0,n.ref)(),i=(0,n.shallowRef)(),s=(0,n.computed)(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let c=!1;const d=p=>{if(!p)return"";let f=p;return o.apiUrl&&o.token&&(f=f.replace(/{learun_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${o.token}`)),f},u=p=>{if(!p)return"";let f=p;if(o.apiUrl){const h=`${o.apiUrl}/system/annexesfile/`;f=f.split(h).join("{learun_img_api}"),o.token&&(f=f.split(`token=${o.token}`).join("{learun_img_token}"))}return f};return(0,n.onMounted)(()=>{const p={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};p.onChange=h=>{if(c)return;const g=u(h.getHtml());a("update:value",g),a("change",{value:g})};const f=(0,Nr.createEditor)({selector:l.value,html:d(o.value),config:p,mode:"default"});i.value=f,(0,Nr.createToolbar)({editor:f,selector:r.value,mode:"default"})}),(0,n.watch)(()=>o.value,p=>{const f=i.value;if(f){const h=f.getHtml(),g=d(p);u(h)!==p&&(c=!0,f.setHtml(g),c=!1)}}),(0,n.watch)(()=>o.readonly,p=>{const f=i.value;f&&(p?f.disable():f.enable())}),(0,n.onBeforeUnmount)(()=>{const p=i.value;p?.destroy()}),(p,f)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",jm,[(0,n.createElementVNode)("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),(0,n.createElementVNode)("div",{ref_key:"editorRef",ref:l,class:"j-editor-content",style:(0,n.normalizeStyle)(s.value)},null,4)]))}}),Im=$i(Om,[["__scopeId","data-v-60cd5d0b"]]),ks=se(Im),zm={key:0,class:"j-map-loading"},Lm=(0,n.defineComponent)({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(!0),i=(0,n.ref)();let s=null,c=null,d=null,u=null;const p=async()=>{r.value=!0;try{s=await ti(a.mapKey)}catch(w){console.error("Failed to load Baidu Map:",w),r.value=!1;return}if(c!=null){h(a.lng,a.lat),r.value=!1;return}if(!i.value)return;c=new s.Map(i.value,{enableMapClick:!1});const y=new s.Point(121.480248,31.236276);c.centerAndZoom(y,17),d=new s.Marker(y,{enableDragging:!0}),c.addOverlay(d),d.addEventListener("dragend",w=>{f(w.point)}),c.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),u=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),u.addEventListener("locationSuccess",w=>{f(w.point)}),u.addEventListener("locationError",w=>{alert(w.message)}),c.addControl(u),c.addEventListener("click",w=>{f(w.point)}),c.enableScrollWheelZoom(!0),h(a.lng,a.lat),r.value=!1},f=y=>{new s.Geocoder().getLocation(y,w=>{d.setPosition(y),c.panTo(y),l("update:address",w.address),l("update:lng",y.lng),l("update:lat",y.lat),l("change",{value:{address:w.address,lng:y.lng,lat:y.lat}})})},h=(y,w)=>{if(y&&w&&s){const x=new s.Point(y,w);d&&d.setPosition(x),c&&c.panTo(x)}};let g=null;return t({setPoint:h,querySearchAsync:(y,w)=>{!c||!s||(g||(g=new s.LocalSearch(c,{onSearchComplete:x=>{const v=[];if(x){const C=x.getCurrentNumPois();for(let R=0;R<C;R++)v.push(x.getPoi(R))}w(v)}})),g.search(y))}}),(0,n.onMounted)(()=>{p()}),(y,w)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-map",style:(0,n.normalizeStyle)({height:e.height})},[r.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",zm,[(0,n.createVNode)(Cn,{icon:"mdi:loading",class:"is-loading",size:30})])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref_key:"mapRef",ref:i,class:"j-map-container"},null,512)],4))}}),Hm=Lm,Dm=se(Hm);function Ss(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Jn(e){return e.originalEvent||e.srcEvent}function kl(e){Ss(e),Ss(Jn(e))}function Yn(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}var Es=1500;function Bs(e,t,o){var a=this,l=o.get("dragging",!1);function r(i){if(!i.hover){var s=i.originalEvent,c=a._findTargetGfx(s),d=c&&e.get(c);c&&d&&(i.stopPropagation(),l.hover({element:d,gfx:c}),l.move(s))}}l&&t.on("drag.start",function(i){t.once("drag.move",Es,function(s){r(s)})}),(function(){var i,s;t.on("element.hover",function(c){i=c.gfx,s=c.element}),t.on("element.hover",Es,function(c){s&&t.fire("element.out",{element:s,gfx:i})}),t.on("element.out",function(){i=null,s=null})})(),this._findTargetGfx=function(i){var s,c;if(i instanceof MouseEvent)return s=Yn(i),c=document.elementFromPoint(s.x,s.y),Fm(c)}}Bs.$inject=["elementRegistry","eventBus","injector"];function Fm(e){return(0,W.closest)(e,"svg, .djs-element",!0)}var $m={__init__:["hoverFix"],hoverFix:["type",Bs]};function Rs(){return/mac/i.test(navigator.platform)}function _s(e,t){return(Jn(e)||e).button===t}function en(e){return _s(e,0)}function Wm(e){return _s(e,1)}function Ts(e){var t=Jn(e)||e;return en(e)?Rs()?t.metaKey:t.ctrlKey:!1}function Sl(e){var t=Jn(e)||e;return en(e)&&t.shiftKey}function yo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Um(e){return["M",e.x,e.y]}function El(e){return["L",e.x,e.y]}function Jm(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function Ym(e,t){const o=e.length,a=[Um(e[0])];for(let l=1;l<o;l++){const r=e[l-1],i=e[l],s=e[l+1];if(!s||!t){a.push(El(i));continue}const c=Math.min(t,Bl(i.x-r.x,i.y-r.y),Bl(s.x-i.x,s.y-i.y));if(!c){a.push(El(i));continue}const d=sa(i,r,c),u=sa(i,r,c*.5),p=sa(i,s,c),f=sa(i,s,c*.5);a.push(El(d)),a.push(Jm(u,f,p))}return a}function sa(e,t,o){const a=t.x-e.x,l=t.y-e.y,r=o/Bl(a,l);return{x:e.x+a*r,y:e.y+l*r}}function Bl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Rl(e,t,o){(0,S.isNumber)(t)&&(o=t,t=null),t||(t={});const a=(0,N.create)("path",t);return(0,S.isNumber)(o)&&(a.dataset.cornerRadius=String(o)),Ms(a,e)}function Ms(e,t){return(0,N.attr)(e,{d:yo(Ym(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function Km(e){return!0}function ca(e){return en(e)||Wm(e)}var Vs=500;function Ns(e,t,o){var a=this;function l(B,_,V){if(!s(B,_)){var T,F,L;V?F=t.getGraphics(V):(T=_.delegateTarget||_.target,T&&(F=T,V=t.get(F))),!(!F||!V)&&(L=e.fire(B,{element:V,gfx:F,originalEvent:_}),L===!1&&(_.stopPropagation(),_.preventDefault()))}}var r={};function i(B){return r[B]}function s(B,_){return!(d[B]||en)(_)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},d={"element.contextmenu":Km,"element.mousedown":ca,"element.mouseup":ca,"element.click":ca,"element.dblclick":ca};function u(B,_,V){var T=c[B];if(!T)throw new Error("unmapped DOM event name <"+B+">");return l(T,_,V)}var p="svg, .djs-element";function f(B,_,V,T){var F=r[V]=function(L){l(V,L)};T&&(d[V]=T),F.$delegate=W.delegate.bind(B,p,_,F)}function h(B,_,V){var T=i(V);T&&W.delegate.unbind(B,_,T.$delegate)}function g(B){(0,S.forEach)(c,function(_,V){f(B,V,_)})}function m(B){(0,S.forEach)(c,function(_,V){h(B,V,_)})}e.on("canvas.destroy",function(B){m(B.svg)}),e.on("canvas.init",function(B){g(B.svg)}),e.on(["shape.added","connection.added"],function(B){var _=B.element,V=B.gfx;e.fire("interactionEvents.createHit",{element:_,gfx:V})}),e.on(["shape.changed","connection.changed"],Vs,function(B){var _=B.element,V=B.gfx;e.fire("interactionEvents.updateHit",{element:_,gfx:V})}),e.on("interactionEvents.createHit",Vs,function(B){var _=B.element,V=B.gfx;a.createDefaultHit(_,V)}),e.on("interactionEvents.updateHit",function(B){var _=B.element,V=B.gfx;a.updateDefaultHit(_,V)});var y=R("djs-hit djs-hit-stroke"),w=R("djs-hit djs-hit-click-stroke"),x=R("djs-hit djs-hit-all"),v=R("djs-hit djs-hit-no-move"),C={all:x,"click-stroke":w,stroke:y,"no-move":v};function R(B,_){return _=(0,S.assign)({stroke:"white",strokeWidth:15},_||{}),o.cls(B,["no-fill","no-border"],_)}function b(B,_){var V=C[_];if(!V)throw new Error("invalid hit type <"+_+">");return(0,N.attr)(B,V),B}function k(B,_){(0,N.append)(B,_)}this.removeHits=function(B){(0,S.forEach)((0,W.queryAll)(".djs-hit",B),N.remove)},this.createDefaultHit=function(B,_){var V=B.waypoints,T=B.isFrame,F;return V?this.createWaypointsHit(_,V):(F=T?"stroke":"all",this.createBoxHit(_,F,{width:B.width,height:B.height}))},this.createWaypointsHit=function(B,_){var V=Rl(_);return b(V,"stroke"),k(B,V),V},this.createBoxHit=function(B,_,V){V=(0,S.assign)({x:0,y:0},V);var T=(0,N.create)("rect");return b(T,_),(0,N.attr)(T,V),k(B,T),T},this.updateDefaultHit=function(B,_){var V=(0,W.query)(".djs-hit",_);if(V)return B.waypoints?Ms(V,B.waypoints):(0,N.attr)(V,{width:B.width,height:B.height}),V},this.fire=l,this.triggerMouseEvent=u,this.mouseHandler=i,this.registerEvent=f,this.unregisterEvent=h}Ns.$inject=["eventBus","elementRegistry","styles"];var _l={__init__:["interactionEvents"],interactionEvents:["type",Ns]};function Kn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var l=a.element;o.deselect(l)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}Kn.$inject=["eventBus","canvas"],Kn.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},Kn.prototype.get=function(){return this._selectedElements},Kn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},Kn.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();(0,S.isArray)(e)||(e=e?[e]:[]);var l=this._canvas,r=l.getRootElement();e=e.filter(function(i){return r===l.findRoot(i)}),t?(0,S.forEach)(e,function(i){o.indexOf(i)===-1&&o.push(i)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var As="hover",Ps="selected";function js(e,t){this._canvas=e;function o(l,r){e.addMarker(l,r)}function a(l,r){e.removeMarker(l,r)}t.on("element.hover",function(l){o(l.element,As)}),t.on("element.out",function(l){a(l.element,As)}),t.on("selection.changed",function(l){function r(d){a(d,Ps)}function i(d){o(d,Ps)}var s=l.oldSelection,c=l.newSelection;(0,S.forEach)(s,function(d){c.indexOf(d)===-1&&r(d)}),(0,S.forEach)(c,function(d){s.indexOf(d)===-1&&i(d)})})}js.$inject=["canvas","eventBus"];function Os(e,t,o,a){e.on("create.end",500,function(l){var r=l.context,i=r.canExecute,s=r.elements,c=(r.hints||{}).autoSelect;if(i){if(c===!1)return;(0,S.isArray)(c)?t.select(c):t.select(s.filter(Gm))}}),e.on("connect.end",500,function(l){var r=l.context.connection;r&&t.select(r)}),e.on("shape.move.end",500,function(l){var r=l.previousSelection||[],i=a.get(l.context.shape.id);(0,S.find)(r,function(s){return i.id===s.id})||t.select(i)}),e.on("element.click",function(l){if(en(l)){var r=l.element;r===o.getRootElement()&&(r=null);var i=t.isSelected(r),s=t.get().length>1,c=Sl(l);if(i&&s)return c?t.deselect(r):t.select(r);i?t.deselect(r):t.select(r,c)}})}Os.$inject=["eventBus","selection","canvas","elementRegistry"];function Gm(e){return!e.hidden}var Gn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[_l],selection:["type",Kn],selectionVisuals:["type",js],selectionBehavior:["type",Os]},qm=/^djs-cursor-.*$/;function Tl(e){var t=(0,W.classes)(document.body);t.removeMatching(qm),e&&t.add("djs-cursor-"+e)}function Is(){Tl(null)}var Xm=5e3;function zs(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Xm,o),function(){e.off(t,o)}}function Ls(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function qn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hs(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ds(e,t){return e=(0,S.isArray)(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var Xn=Math.round,Fs="djs-drag-active";function xn(e){e.preventDefault()}function Zm(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Qm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $s(e,t,o,a){var l={threshold:5,trapClick:!0},r;function i(v){var C=t.viewbox(),R=t._container.getBoundingClientRect();return{x:C.x+(v.x-R.left)/C.scale,y:C.y+(v.y-R.top)/C.scale}}function s(v,C){C=C||r;var R=e.createEvent((0,S.assign)({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+v,R)===!1?!1:e.fire(C.prefix+"."+v,R)}function c(v){var C=v.filter(function(R){return a.get(R.id)});C.length&&o.select(C)}function d(v,C){var R=r.payload,b=r.displacement,k=r.globalStart,B=Yn(v),_=qn(B,k),V=r.localStart,T=i(B),F=qn(T,V);if(!r.active&&(C||Qm(_)>r.threshold)){if((0,S.assign)(R,{x:Xn(V.x+b.x),y:Xn(V.y+b.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(R.previousSelection=o.get(),o.select(null)),r.cursor&&Tl(r.cursor),t.addMarker(t.getRootElement(),Fs)}kl(v),r.active&&((0,S.assign)(R,{x:Xn(T.x+b.x),y:Xn(T.y+b.y),dx:Xn(F.x),dy:Xn(F.y)},{originalEvent:v}),s("move"))}function u(v){var C,R=!0;r.active&&(v&&(r.payload.originalEvent=v,kl(v)),R=s("end")),R===!1&&s("rejected"),C=w(R!==!0),s("ended",C)}function p(v){Ds("Escape",v)&&(xn(v),y())}function f(v){var C;r.active&&(C=zs(e),setTimeout(C,400),xn(v)),u(v)}function h(v){d(v)}function g(v){var C=r.payload;C.hoverGfx=v.gfx,C.hover=v.element,s("hover")}function m(v){s("out");var C=r.payload;C.hoverGfx=null,C.hover=null}function y(v){var C;if(r){var R=r.active;R&&s("cancel"),C=w(v),R&&s("canceled",C)}}function w(v){var C,R;s("cleanup"),Is(),r.trapClick?R=f:R=u,W.event.unbind(document,"mousemove",d),W.event.unbind(document,"dragstart",xn),W.event.unbind(document,"selectstart",xn),W.event.unbind(document,"mousedown",R,!0),W.event.unbind(document,"mouseup",R,!0),W.event.unbind(document,"keyup",p),W.event.unbind(document,"touchstart",h,!0),W.event.unbind(document,"touchcancel",y,!0),W.event.unbind(document,"touchmove",d,!0),W.event.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",m),t.removeMarker(t.getRootElement(),Fs);var b=r.payload.previousSelection;return v!==!1&&b&&!o.get().length&&c(b),C=r,r=null,C}function x(v,C,R,b){r&&y(!1),typeof C=="string"&&(b=R,R=C,C=null),b=(0,S.assign)({},l,b||{});var k=b.data||{},B,_,V,T,F;b.trapClick?T=f:T=u,v?(B=Jn(v)||v,_=Yn(v),kl(v),B.type==="dragstart"&&xn(B)):(B=null,_={x:0,y:0}),V=i(_),C||(C=V),F=Zm(B),r=(0,S.assign)({prefix:R,data:k,payload:{},globalStart:_,displacement:qn(C,V),localStart:V,isTouch:F},b),b.manual||(F?(W.event.bind(document,"touchstart",h,!0),W.event.bind(document,"touchcancel",y,!0),W.event.bind(document,"touchmove",d,!0),W.event.bind(document,"touchend",u,!0)):(W.event.bind(document,"mousemove",d),W.event.bind(document,"dragstart",xn),W.event.bind(document,"selectstart",xn),W.event.bind(document,"mousedown",T,!0),W.event.bind(document,"mouseup",T,!0)),W.event.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",m)),s("init"),b.autoActivate&&d(v,!0)}e.on("diagram.destroy",y),this.init=x,this.move=d,this.hover=g,this.out=m,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){(0,S.assign)(l,v)}}$s.$inject=["eventBus","canvas","selection","elementRegistry"];var kn={__depends__:[$m,Gn],dragging:["type",$s]};function Ml(e){return e.childNodes[0]}function da(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}da.prototype.next=function(){return this._prefix+ ++this._counter};var ey=new da("ps"),ty=["marker-start","marker-mid","marker-end"],ny=["circle","ellipse","line","path","polygon","polyline","path","rect"];function tn(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}tn.$inject=["elementRegistry","eventBus","canvas","styles"],tn.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},tn.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},tn.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var l=(0,N.clone)(o),r=o.getBoundingClientRect();return this._cloneMarkers(Ml(l),a),(0,N.attr)(l,this._styles.cls(a,[],{x:r.top,y:r.left})),(0,N.append)(t,l),(0,N.attr)(l,"data-preview-support-element-id",e.id),l},tn.prototype.addFrame=function(e,t){var o=(0,N.create)("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return(0,N.append)(t,o),(0,N.attr)(o,"data-preview-support-element-id",e.id),o},tn.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(l=>{a._cloneMarkers(l,t,o)}),ry(e)&&ty.forEach(function(l){if((0,N.attr)(e,l)){var r=oy(e,l,a._canvas.getContainer());r&&a._cloneMarker(o,e,r,l,t)}})},tn.prototype._cloneMarker=function(e,t,o,a,l="djs-dragger"){var r=[o.id,l,ey.next()].join("-"),i=(0,W.query)("marker#"+o.id,e);e=e||this._canvas._svg;var s=i||(0,N.clone)(o);s.id=r,(0,N.classes)(s).add(l);var c=(0,W.query)(":scope > defs",e);c||(c=(0,N.create)("defs"),(0,N.append)(e,c)),(0,N.append)(c,s),(0,N.attr)(t,a,ly(s.id))};function oy(e,t,o){return(0,W.query)("marker#"+ay((0,N.attr)(e,t)),o||document)}function ay(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function ly(e){return"url(#"+e+")"}function ry(e){return ny.indexOf(e.nodeName)!==-1}var Vl={__init__:["previewSupport"],previewSupport:["type",tn]};function Nl(e){this._commandStack=e.get("commandStack",!1)}Nl.$inject=["injector"],Nl.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};var Zn={__init__:["rules"],rules:["type",Nl]};function iy(e){return(0,S.filter)(e,function(t){return!(0,S.find)(e,function(o){return o!==t&&Ws(t,o)})})}function Ws(e,t){if(t){if(e===t)return t;if(e.parent)return Ws(e.parent,t)}}function Us(e,t,o){var a=!o||e.indexOf(t)===-1;return a&&e.push(t),a}function Al(e,t,o){o=o||0,(0,S.isArray)(e)||(e=[e]),(0,S.forEach)(e,function(a,l){var r=t(a,l,o);(0,S.isArray)(r)&&r.length&&Al(r,t,o+1)})}function sy(e,t,o){var a=[],l=[];return Al(e,function(r,i,s){Us(a,r,t);var c=r.children;if((o===-1||s<o)&&c&&Us(l,c,t))return c}),a}function cy(e,t){return sy(e,!t,-1)}function dy(e,t,o){(0,S.isUndefined)(t)&&(t=!0),(0,S.isObject)(t)&&(o=t,t=!0),o=o||{};var a=bo(o.allShapes),l=bo(o.allConnections),r=bo(o.enclosedElements),i=bo(o.enclosedConnections),s=bo(o.topLevel,t&&(0,S.groupBy)(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),a[u.source.id]&&a[u.target.id]&&(i[u.id]=r[u.id]=u),l[u.id]=u}function d(u){if(r[u.id]=u,u.waypoints)i[u.id]=l[u.id]=u;else return a[u.id]=u,(0,S.forEach)(u.incoming,c),(0,S.forEach)(u.outgoing,c),u.children}return Al(e,d),{allShapes:a,allConnections:l,topLevel:s,enclosedConnections:i,enclosedElements:r}}function It(e,t){t=!!t,(0,S.isArray)(e)||(e=[e]);var o,a,l,r;return(0,S.forEach)(e,function(i){var s=i;i.waypoints&&!t&&(s=It(i.waypoints,!0));var c=s.x,d=s.y,u=s.height||0,p=s.width||0;(c<o||o===void 0)&&(o=c),(d<a||a===void 0)&&(a=d),(c+p>l||l===void 0)&&(l=c+p),(d+u>r||r===void 0)&&(r=d+u)}),{x:o,y:a,height:r-a,width:l-o}}function uy(e,t){var o={};return(0,S.forEach)(e,function(a){var l=a;l.waypoints&&(l=It(l)),!(0,S.isNumber)(t.y)&&l.x>t.x&&(o[a.id]=a),!(0,S.isNumber)(t.x)&&l.y>t.y&&(o[a.id]=a),l.x>t.x&&l.y>t.y&&((0,S.isNumber)(t.width)&&(0,S.isNumber)(t.height)&&l.width+l.x<t.width+t.x&&l.height+l.y<t.height+t.y||!(0,S.isNumber)(t.width)||!(0,S.isNumber)(t.height))&&(o[a.id]=a)}),o}function fy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function py(e){return!!(e&&e.isFrame)}function bo(e,t){return(0,S.assign)({},e||{},t||{})}function vt(e){return(0,S.isObject)(e)&&(0,S.has)(e,"waypoints")}function Qn(e){return(0,S.isObject)(e)&&(0,S.has)(e,"labelTarget")}var hy="drop-ok",Js="drop-not-ok",Ys="attach-ok",Ks="new-parent",Gs="create",gy=2e3;function qs(e,t,o,a,l){function r(c,d,u,p,f){if(!d)return!1;c=(0,S.filter)(c,function(x){var v=x.labelTarget;return!x.parent&&!(Qn(x)&&c.indexOf(v)!==-1)});var h=(0,S.find)(c,function(x){return!vt(x)}),g=!1,m=!1,y=!1;Zs(c)&&(g=l.allowed("shape.attach",{position:u,shape:h,target:d})),g||(Zs(c)?y=l.allowed("shape.create",{position:u,shape:h,source:p,target:d}):y=l.allowed("elements.create",{elements:c,position:u,target:d}));var w=f.connectionTarget;return y||g?(h&&p&&(m=l.allowed("connection.create",{source:w===p?h:p,target:w===p?p:h,hints:{targetParent:d,targetAttach:g}})),{attach:g,connect:m}):y===null||g===null?null:!1}function i(c,d){[Ys,hy,Js,Ks].forEach(function(u){u===d?e.addMarker(c,u):e.removeMarker(c,u)})}o.on(["create.move","create.hover"],function(c){var d=c.context,u=d.elements,p=c.hover,f=d.source,h=d.hints||{};if(!p){d.canExecute=!1,d.target=null;return}Xs(c);var g={x:c.x,y:c.y},m=d.canExecute=p&&r(u,p,g,f,h);p&&m!==null&&(d.target=p,m&&m.attach?i(p,Ys):i(p,m?Ks:Js))}),o.on(["create.end","create.out","create.cleanup"],function(c){var d=c.hover;d&&i(d,null)}),o.on("create.end",function(c){var d=c.context,u=d.source,p=d.shape,f=d.elements,h=d.target,g=d.canExecute,m=g&&g.attach,y=g&&g.connect,w=d.hints||{};if(g===!1||!h)return!1;Xs(c);var x={x:c.x,y:c.y};y?p=a.appendShape(u,p,x,h,{attach:m,connection:y===!0?{}:y,connectionTarget:w.connectionTarget}):(f=a.createElements(f,x,h,(0,S.assign)({},w,{attach:m})),p=(0,S.find)(f,function(v){return!vt(v)})),(0,S.assign)(d,{elements:f,shape:p}),(0,S.assign)(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Gs&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",s),o.once(["create.cancel","create.end"],gy,function(){o.off("elements.changed",s)})}),this.start=function(c,d,u){(0,S.isArray)(d)||(d=[d]);var p=(0,S.find)(d,function(h){return!vt(h)});if(p){u=(0,S.assign)({elements:d,hints:{},shape:p},u||{}),(0,S.forEach)(d,function(h){(0,S.isNumber)(h.x)||(h.x=0),(0,S.isNumber)(h.y)||(h.y=0)});var f=It((0,S.filter)(d,function(h){return!h.hidden}));(0,S.forEach)(d,function(h){vt(h)&&(h.waypoints=(0,S.map)(h.waypoints,function(g){return{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2}})),(0,S.assign)(h,{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2})}),t.init(c,Gs,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:d,context:u}})}}}qs.$inject=["canvas","dragging","eventBus","modeling","rules"];function Xs(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function Zs(e){return e&&e.length===1&&!vt(e[0])}function my(e,t,o,a,l){var r=(0,N.createTransform)();r.setTranslate(t,o);var i=(0,N.createTransform)();i.setRotate(a||0,0,0);var s=(0,N.createTransform)();s.setScale(l||1,l||1),(0,N.transform)(e,[r,i,s])}function zt(e,t,o){var a=(0,N.createTransform)();a.setTranslate(t,o),(0,N.transform)(e,a)}function yy(e,t){var o=(0,N.createTransform)();o.setRotate(t,0,0),(0,N.transform)(e,o)}var by=750;function Qs(e,t,o,a,l){function r(i){var s=(0,N.create)("g");(0,N.attr)(s,l.cls("djs-drag-group",["no-events"]));var c=(0,N.create)("g");return i.forEach(function(d){var u;d.hidden||(d.waypoints?(u=o._createContainer("connection",c),o.drawConnection(Ml(u),d)):(u=o._createContainer("shape",c),o.drawShape(Ml(u),d),zt(u,d.x,d.y)),a.addDragger(d,s,u))}),s}t.on("create.move",by,function(i){var s=i.hover,c=i.context,d=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(d));var p;s?(u.parentNode||(p=e.getActiveLayer(),(0,N.append)(p,u)),zt(u,i.x,i.y)):(0,N.remove)(u)}),t.on("create.cleanup",function(i){var s=i.context.dragGroup;s&&(0,N.remove)(s)})}Qs.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var ec={__depends__:[kn,Vl,Zn,Gn],__init__:["create","createPreview"],create:["type",qs],createPreview:["type",Qs]};function vo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pl(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var l=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),r=vo(e,t);return Math.abs(l/r)<=a}var vy=2;function nn(e,t){var o=Array.from(arguments).flat();for(const[a,l]of Object.entries({x:"v",y:"h"}))if(wy(a,o))return l;return!1}function wy(e,t){const o=t[0];return(0,S.every)(t,function(a){return Math.abs(o[e]-a[e])<=vy})}function tc(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function jl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Cy=/,?([a-z]),?/gi,nc=parseFloat,Qe=Math,on=Qe.PI,Lt=Qe.min,Ht=Qe.max,oc=Qe.pow,an=Qe.abs,xy=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,ky=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,ac=Array.isArray||function(e){return e instanceof Array};function Sy(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ey(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function By(e){function t(){var o=Array.prototype.slice.call(arguments,0).join("␀"),a=t.cache=t.cache||{},l=t.count=t.count||[];return Sy(a,o)?(Ey(l,o),a[o]):(l.length>=1e3&&delete a[l.shift()],l.push(o),a[o]=e(...arguments),a[o])}return t}function Ry(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(e).replace(xy,function(a,l,r){var i=[],s=l.toLowerCase();for(r.replace(ky,function(c,d){d&&i.push(+d)}),s=="m"&&i.length>2&&(o.push([l,...i.splice(0,2)]),s="l",l=l=="m"?"l":"L");i.length>=t[s]&&(o.push([l,...i.splice(0,t[s])]),!!t[s]););}),o.toString=Il,o}function _y(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function Ty(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Ol(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function Il(){return this.join(",").replace(Cy,"$1")}function My(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var l=e[o],r=t[o]=new Array(l.length),i=0,s=l.length;i<s;i++)r[i]=l[i];return t.toString=Il,t}function lc(e,t,o,a,l,r,i,s,c){var d=1-c,u=oc(d,3),p=oc(d,2),f=c*c*c,h=u*e+p*3*c*o+d*3*c*c*l+f*i,g=u*t+p*3*c*a+d*3*c*c*r+f*s;return{x:ua(h),y:ua(g)}}function rc(e){var t=Oy(...e);return Ol(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ln(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function Vy(e,t){return e=Ol(e),t=Ol(t),ln(t,e.x,e.y)||ln(t,e.x2,e.y)||ln(t,e.x,e.y2)||ln(t,e.x2,e.y2)||ln(e,t.x,t.y)||ln(e,t.x2,t.y)||ln(e,t.x,t.y2)||ln(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function ic(e,t,o,a,l){return e*(e*(-3*t+9*o-9*a+3*l)+6*t-12*o+6*a)-3*t+3*o}function sc(e,t,o,a,l,r,i,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var d=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,g=0;g<u;g++){var m=d*p[g]+d,y=ic(m,e,o,l,i),w=ic(m,t,a,r,s),x=y*y+w*w;h+=f[g]*Qe.sqrt(x)}return d*h}function Ny(e,t,o,a,l,r,i,s){if(!(Ht(e,o)<Lt(l,i)||Lt(e,o)>Ht(l,i)||Ht(t,a)<Lt(r,s)||Lt(t,a)>Ht(r,s))){var c=(e*a-t*o)*(l-i)-(e-o)*(l*s-r*i),d=(e*a-t*o)*(r-s)-(t-a)*(l*s-r*i),u=(e-o)*(r-s)-(t-a)*(l-i);if(u){var p=ua(c/u),f=ua(d/u),h=+p.toFixed(2),g=+f.toFixed(2);if(!(h<+Lt(e,o).toFixed(2)||h>+Ht(e,o).toFixed(2)||h<+Lt(l,i).toFixed(2)||h>+Ht(l,i).toFixed(2)||g<+Lt(t,a).toFixed(2)||g>+Ht(t,a).toFixed(2)||g<+Lt(r,s).toFixed(2)||g>+Ht(r,s).toFixed(2)))return{x:p,y:f}}}}function ua(e){return Math.round(e*1e11)/1e11}function Ay(e,t,o){if(!Vy(rc(e),rc(t)))return o?0:[];var a=sc(...e),l=sc(...t),r=dc(e)?1:~~(a/5)||1,i=dc(t)?1:~~(l/5)||1,s=new Array(r+1),c=new Array(i+1),d={},u=o?0:[],p,f;for(p=0;p<r+1;p++){var h=lc(...e,p/r);s[p]={x:h.x,y:h.y,t:p/r}}for(p=0;p<i+1;p++)h=lc(...t,p/i),c[p]={x:h.x,y:h.y,t:p/i};for(p=0;p<r;p++)for(f=0;f<i;f++){var g=s[p],m=s[p+1],y=c[f],w=c[f+1],x=an(m.x-g.x)<.01?"y":"x",v=an(w.x-y.x)<.01?"y":"x",C=Ny(g.x,g.y,m.x,m.y,y.x,y.y,w.x,w.y),R;if(C){if(R=C.x.toFixed(9)+"#"+C.y.toFixed(9),d[R])continue;d[R]=!0;var b=g.t+an((C[x]-g[x])/(m[x]-g[x]))*(m.t-g.t),k=y.t+an((C[v]-y[v])/(w[v]-y[v]))*(w.t-y.t);b>=0&&b<=1&&k>=0&&k<=1&&(o?u++:u.push({x:C.x,y:C.y,t1:b,t2:k}))}}return u}function cc(e,t,o){e=pc(e),t=pc(t);for(var a,l,r,i,s,c,d,u,p,f,h=o?0:[],g=0,m=e.length;g<m;g++){var y=e[g];if(y[0]=="M")a=s=y[1],l=c=y[2];else{y[0]=="C"?(p=[a,l,...y.slice(1)],a=p[6],l=p[7]):(p=[a,l,a,l,s,c,s,c],a=s,l=c);for(var w=0,x=t.length;w<x;w++){var v=t[w];if(v[0]=="M")r=d=v[1],i=u=v[2];else{v[0]=="C"?(f=[r,i,...v.slice(1)],r=f[6],i=f[7]):(f=[r,i,r,i,d,u,d,u],r=d,i=u);var C=Ay(p,f,o);if(o)h+=C;else{for(var R=0,b=C.length;R<b;R++)C[R].segment1=g,C[R].segment2=w,C[R].bez1=p,C[R].bez2=f;h=h.concat(C)}}}}}return h}function Py(e){return ac(e)&&ac(e[0])}function jy(e){if(_y(e))return e;var t=new Array(e.length),o=0,a=0,l=0,r=0,i=0,s;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],l=o,r=a,i++,t[0]=["M",o,a]);for(var c,d,u=i,p=e.length;u<p;u++){if(d=e[u],s=d[0],t[u]=c=new Array(d.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=+d[6]+o,c[7]=+d[7]+a;break;case"V":c[1]=+d[1]+a;break;case"H":c[1]=+d[1]+o;break;case"M":l=+d[1]+o,r=+d[2]+a;default:for(var f=1,h=d.length;f<h;f++)c[f]=+d[f]+(f%2?o:a)}else for(var g=0,m=d.length;g<m;g++)c[g]=d[g];switch(s=s.toUpperCase(),c[0]){case"Z":o=+l,a=+r;break;case"H":o=c[1];break;case"V":a=c[1];break;case"M":l=c[c.length-2],r=c[c.length-1];default:o=c[c.length-2],a=c[c.length-1]}}return t.toString=Il,t}function dc(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function fa(e,t,o,a){return[e,t,o,a,o,a]}function uc(e,t,o,a,l,r){var i=.3333333333333333,s=2/3;return[i*e+s*o,i*t+s*a,i*l+s*o,i*r+s*a,l,r]}function fc(e,t,o,a,l,r,i,s,c,d){var u=on*120/180,p=on/180*(+l||0),f=[],h,g=By(function(de,ve,Te){return{x:de*Qe.cos(Te)-ve*Qe.sin(Te),y:de*Qe.sin(Te)+ve*Qe.cos(Te)}});if(d)k=d[0],B=d[1],R=d[2],b=d[3];else{h=g(e,t,-p),e=h.x,t=h.y,h=g(s,c,-p),s=h.x,c=h.y;var m=(e-s)/2,y=(t-c)/2,w=m*m/(o*o)+y*y/(a*a);w>1&&(w=Qe.sqrt(w),o=w*o,a=w*a);var x=o*o,v=a*a,C=(r==i?-1:1)*Qe.sqrt(an((x*v-x*y*y-v*m*m)/(x*y*y+v*m*m))),R=C*o*y/a+(e+s)/2,b=C*-a*m/o+(t+c)/2,k=Qe.asin(((t-b)/a).toFixed(9)),B=Qe.asin(((c-b)/a).toFixed(9));k=e<R?on-k:k,B=s<R?on-B:B,k<0&&(k=on*2+k),B<0&&(B=on*2+B),i&&k>B&&(k=k-on*2),!i&&B>k&&(B=B-on*2)}var _=B-k;if(an(_)>u){var V=B,T=s,F=c;B=k+u*(i&&B>k?1:-1),s=R+o*Qe.cos(B),c=b+a*Qe.sin(B),f=fc(s,c,o,a,l,0,i,T,F,[B,V,R,b])}_=B-k;var L=Qe.cos(k),D=Qe.sin(k),M=Qe.cos(B),E=Qe.sin(B),I=Qe.tan(_/4),$=4/3*o*I,Q=4/3*a*I,ue=[e,t],xe=[e+$*D,t-Q*L],_e=[s+$*E,c-Q*M],Y=[s,c];if(xe[0]=2*ue[0]-xe[0],xe[1]=2*ue[1]-xe[1],d)return[xe,_e,Y].concat(f);f=[xe,_e,Y].concat(f).join().split(",");for(var z=[],ie=0,fe=f.length;ie<fe;ie++)z[ie]=ie%2?g(f[ie-1],f[ie],p).y:g(f[ie],f[ie+1],p).x;return z}function Oy(e,t,o,a,l,r,i,s){for(var c=[],d=[[],[]],u,p,f,h,g,m,y,w,x=0;x<2;++x){if(x==0?(p=6*e-12*o+6*l,u=-3*e+9*o-9*l+3*i,f=3*o-3*e):(p=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*s,f=3*a-3*t),an(u)<1e-12){if(an(p)<1e-12)continue;h=-f/p,0<h&&h<1&&c.push(h);continue}y=p*p-4*f*u,w=Qe.sqrt(y),!(y<0)&&(g=(-p+w)/(2*u),0<g&&g<1&&c.push(g),m=(-p-w)/(2*u),0<m&&m<1&&c.push(m))}for(var v=c.length,C=v,R;v--;)h=c[v],R=1-h,d[0][v]=R*R*R*e+3*R*R*h*o+3*R*h*h*l+h*h*h*i,d[1][v]=R*R*R*t+3*R*R*h*a+3*R*h*h*r+h*h*h*s;return d[0][C]=e,d[1][C]=t,d[0][C+1]=i,d[1][C+1]=s,d[0].length=d[1].length=C+2,{x0:Lt(...d[0]),y0:Lt(...d[1]),x1:Ht(...d[0]),y1:Ht(...d[1])}}function pc(e){if(Py(e)||(e=Ry(e)),Ty(e))return e;for(var t=My(jy(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(f,h,g){var m,y;if(!f)return["C",h.x,h.y,h.x,h.y,h.x,h.y];switch(!(f[0]in{T:1,Q:1})&&(h.qx=h.qy=null),f[0]){case"M":h.X=f[1],h.Y=f[2];break;case"A":f=["C",...fc(h.x,h.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(m=h.x*2-h.bx,y=h.y*2-h.by):(m=h.x,y=h.y),f=["C",m,y,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(h.qx=h.x*2-h.qx,h.qy=h.y*2-h.qy):(h.qx=h.x,h.qy=h.y),f=["C",...uc(h.x,h.y,h.qx,h.qy,f[1],f[2])];break;case"Q":h.qx=f[1],h.qy=f[2],f=["C",...uc(h.x,h.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...fa(h.x,h.y,f[1],f[2])];break;case"H":f=["C",...fa(h.x,h.y,f[1],h.y)];break;case"V":f=["C",...fa(h.x,h.y,h.x,f[1])];break;case"Z":f=["C",...fa(h.x,h.y,h.X,h.Y)];break}return f},l=function(f,h){if(f[h].length>7){f[h].shift();for(var g=f[h];g.length;)r[h]="A",f.splice(h++,0,["C",...g.splice(0,6)]);f.splice(h,1),d=t.length}},r=[],i="",s="",c=0,d=t.length;c<d;c++){t[c]&&(i=t[c][0]),i!="C"&&(r[c]=i,c&&(s=r[c-1])),t[c]=a(t[c],o,s),r[c]!="A"&&i=="C"&&(r[c]="C"),l(t,c);var u=t[c],p=u.length;o.x=u[p-2],o.y=u[p-1],o.bx=nc(u[p-4])||o.x,o.by=nc(u[p-3])||o.y}return t}function Iy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function wo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Oe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function hc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function zy(e){return wo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Ly(e){for(var t=e.waypoints,o=t.reduce(function(s,c,d){var u=t[d-1];if(u){var p=s[s.length-1],f=p&&p.endLength||0,h=Fy(u,c);s.push({start:u,end:c,startLength:f,endLength:f+h,length:h})}return s},[]),a=o.reduce(function(s,c){return s+c.length},0)/2,l=0,r=o[l];r.endLength<a;)r=o[++l];var i=(a-r.startLength)/r.length;return{x:r.start.x+(r.end.x-r.start.x)*i,y:r.start.y+(r.end.y-r.start.y)*i}}function qe(e){return vt(e)?Ly(e):zy(e)}function rn(e,t,o){o=o||0,(0,S.isObject)(o)||(o={x:o,y:o});var a=Oe(e),l=Oe(t),r=a.bottom+o.y<=l.top,i=a.left-o.x>=l.right,s=a.top-o.y>=l.bottom,c=a.right+o.x<=l.left,d=r?"top":s?"bottom":null,u=c?"left":i?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function zl(e,t,o){var a=Hy(e,t);return a.length===1||a.length===2&&vo(a[0],a[1])<1?wo(a[0]):a.length>1?(a=(0,S.sortBy)(a,function(l){var r=Math.floor(l.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,l.segment2+"#"+r}),wo(a[o?0:a.length-1])):null}function Hy(e,t){return cc(e,t)}function Dy(e){e=e.slice();for(var t=0,o,a,l;e[t];)o=e[t],a=e[t-1],l=e[t+1],vo(o,l)===0||Pl(a,l,o)?e.splice(t,1):t++;return e}function Fy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gc(e,t,o,a){function l(i,s){return a.allowed("connection.create",{source:i,target:s})}function r(i,s){return l(s,i)}e.on("connect.hover",function(i){var s=i.context,c=s.start,d=i.hover,u;if(s.hover=d,u=s.canExecute=l(c,d),!(0,S.isNil)(u)){if(u!==!1){s.source=c,s.target=d;return}u=s.canExecute=r(c,d),!(0,S.isNil)(u)&&u!==!1&&(s.source=d,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(i){var s=i.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(i){var s=i.context,c=s.canExecute,d=s.connectionStart,u={x:i.x,y:i.y},p=s.source,f=s.target;if(!c)return!1;var h=null,g={connectionStart:Ll(s)?u:d,connectionEnd:Ll(s)?d:u};(0,S.isObject)(c)&&(h=c),s.connection=o.connect(p,f,h,g)}),this.start=function(i,s,c,d){(0,S.isObject)(c)||(d=c,c=qe(s)),t.init(i,"connect",{autoActivate:d,data:{shape:s,context:{start:s,connectionStart:c}}})}}gc.$inject=["eventBus","dragging","modeling","rules"];function Ll(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var $y=1100,Wy=900,mc="connect-ok",yc="connect-not-ok";function bc(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(l){var r=l.context,i=r.canExecute,s=r.hover,c=r.source,d=r.start,u=r.startPosition,p=r.target,f=r.connectionStart||u,h=r.connectionEnd||{x:l.x,y:l.y},g=f,m=h;Ll(r)&&(g=h,m=f),a.drawPreview(r,i,{source:c||d,target:p||s,connectionStart:g,connectionEnd:m})}),t.on("connect.hover",Wy,function(l){var r=l.context,i=l.hover,s=r.canExecute;s!==null&&o.addMarker(i,s?mc:yc)}),t.on(["connect.out","connect.cleanup"],$y,function(l){var r=l.hover;r&&(o.removeMarker(r,mc),o.removeMarker(r,yc))}),a&&t.on("connect.cleanup",function(l){a.cleanUp(l.context)})}bc.$inject=["injector","eventBus","canvas"];var Hl={__depends__:[Gn,Zn,kn],__init__:["connectPreview"],connect:["type",gc],connectPreview:["type",bc]},Uy=15;function vc(e,t){var o;function a(s){return i(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function l(s){var c=o.start,d=o.button,u=Yn(s),p=qn(u,c);!o.dragging&&Jy(p)>Uy&&(o.dragging=!0,d===0&&zs(e),Tl("grab")),o.dragging&&(p=qn(u,o.last||o.start),t.scroll({dx:p.x,dy:p.y}),o.last=u),s.preventDefault()}function r(s){W.event.unbind(document,"mousemove",l),W.event.unbind(document,"mouseup",r),o=null,Is()}function i(s){if(!(0,W.closest)(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:c,start:Yn(s)},W.event.bind(document,"mousemove",l),W.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!o}}vc.$inject=["eventBus","canvas"];function Jy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var wc={__init__:["moveCanvas"],moveCanvas:["type",vc]};function Dl(e){return Math.log(e)/Math.log(10)}function Cc(e,t){var o=Dl(e.min),a=Dl(e.max);return(Math.abs(o)+Math.abs(a))/t}function Yy(e,t){return Math.max(e.min,Math.min(e.max,t))}var Ky=Math.sign||function(e){return e>=0?1:-1},Fl={min:.2,max:4},xc=10,Gy=.1,qy=.75;function Dt(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=(0,S.bind)(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||qy;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}Dt.$inject=["config.zoomScroll","eventBus","canvas"],Dt.prototype.scroll=function(t){this._canvas.scroll(t)},Dt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Dt.prototype.zoom=function(t,o){var a=Cc(Fl,xc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Gy&&(this._zoom(t,o,a),this._totalDelta=0)},Dt.prototype._handleWheel=function(t){if(this._enabled){var o=this._container;t.preventDefault();var a=t.ctrlKey||Rs()&&t.metaKey,l=t.shiftKey,r=-1*this._scale,i;if(a?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,a){var s=o.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};i=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Ky(t.deltaY)*r,this.zoom(i,c)}else l?i={dx:r*t.deltaY,dy:0}:i={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(i)}},Dt.prototype.stepZoom=function(t,o){var a=Cc(Fl,xc);this._zoom(t,o,a)},Dt.prototype._zoom=function(e,t,o){var a=this._canvas,l=e>0?1:-1,r=Dl(a.zoom()),i=Math.round(r/o)*o;i+=o*l;var s=Math.pow(10,i);a.zoom(Yy(Fl,s),t)},Dt.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,l=this._enabled;return typeof t>"u"&&(t=!l),l!==t&&W.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},Dt.prototype._init=function(e){this.toggle(e)};var kc={__init__:["zoomScroll"],zoomScroll:["type",Dt]};function Ye(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Ye.$inject=["eventBus","injector"],Ye.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const o={command:e,context:t};this._pushAction(o),this._internalExecute(o),this._popAction()},Ye.prototype.canExecute=function(e,t){const o={command:e,context:t},a=this._getHandler(e);let l=this._fire(e,"canExecute",o);if(l===void 0){if(!a)return!1;a.canExecute&&(l=a.canExecute(t))}return l},Ye.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Ye.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Ye.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Ye.prototype.register=function(e,t){this._setHandler(e,t)},Ye.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const o=this._injector.instantiate(t);this.register(e,o)},Ye.prototype.canUndo=function(){return!!this._getUndoAction()},Ye.prototype.canRedo=function(){return!!this._getRedoAction()},Ye.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Ye.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Ye.prototype._internalUndo=function(e){const t=e.command,o=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},Ye.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let l;o=this._eventBus.createEvent(o);for(const r of a)if(l=this._eventBus.fire("commandStack."+r,o),o.cancelBubble)break;return l},Ye.prototype._createId=function(){return this._uid++},Ye.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Ye.prototype._internalExecute=function(e,t){const o=e.command,a=e.context,l=this._getHandler(o);if(!l)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),l.preExecute&&l.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),l.execute&&this._markDirty(l.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),l.postExecute&&l.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},Ye.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},Ye.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:(0,S.uniqueBy)("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Ye.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=(0,S.isArray)(e)?e:[e],t.dirty=t.dirty.concat(e))},Ye.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},Ye.prototype._revertedAction=function(e){this._stackIdx--},Ye.prototype._getHandler=function(e){return this._handlerMap[e]},Ye.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var Xy={commandStack:["type",Ye]};function Sn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function pa(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function sn(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function $l(e,t){return!e||!t?-1:e.indexOf(t)}function eo(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var o;o=e[0];)t(o);return e}}var Zy=1e3;function ut(e){this._eventBus=e}ut.$inject=["eventBus"];function Qy(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}ut.prototype.on=function(e,t,o,a,l,r){if(((0,S.isFunction)(t)||(0,S.isNumber)(t))&&(r=l,l=a,a=o,o=t,t=null),(0,S.isFunction)(o)&&(r=l,l=a,a=o,o=Zy),(0,S.isObject)(l)&&(r=l,l=!1),!(0,S.isFunction)(a))throw new Error("handlerFn must be a function");(0,S.isArray)(e)||(e=[e]);var i=this._eventBus;(0,S.forEach)(e,function(s){var c=["commandStack",s,t].filter(function(d){return d}).join(".");i.on(c,o,l?Qy(a,r):a,r)})},ut.prototype.canExecute=Gt("canExecute"),ut.prototype.preExecute=Gt("preExecute"),ut.prototype.preExecuted=Gt("preExecuted"),ut.prototype.execute=Gt("execute"),ut.prototype.executed=Gt("executed"),ut.prototype.postExecute=Gt("postExecute"),ut.prototype.postExecuted=Gt("postExecuted"),ut.prototype.revert=Gt("revert"),ut.prototype.reverted=Gt("reverted");function Gt(e){return function(o,a,l,r,i){((0,S.isFunction)(o)||(0,S.isNumber)(o))&&(i=r,r=l,l=a,a=o,o=null),this.on(o,e,a,l,r,i)}}var eb=250,Sc=1400;function Wl(e,t,o){ut.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",Sc,function(l){var r=l.context,i=r.shapes,s=r.validatedShapes;r.shapes=Ec(i),r.validatedShapes=Ec(s)}),a&&t.on("shape.move.start",eb,function(l){var r=l.context,i=r.shapes,s=[];(0,S.forEach)(i,function(c){(0,S.forEach)(c.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&s.push(d),c.labelTarget&&s.push(c)})}),(0,S.forEach)(s,function(c){a.makeDraggable(r,c,!0)})}),this.preExecuted("elements.move",Sc,function(l){var r=l.context.closure,i=r.enclosedElements,s=[];(0,S.forEach)(i,function(c){(0,S.forEach)(c.labels,function(d){i[d.id]||s.push(d)})}),r.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(l){var r=l.context;eo((r.connection||r.shape).labels,function(i){o.removeShape(i,{nested:!0})})}),this.execute("shape.delete",function(l){var r=l.context,i=r.shape,s=i.labelTarget;s&&(r.labelTargetIndex=$l(s.labels,i),r.labelTarget=s,i.labelTarget=null)}),this.revert("shape.delete",function(l){var r=l.context,i=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(sn(s.labels,i,c),i.labelTarget=s)})}Sn(Wl,ut),Wl.$inject=["injector","eventBus","modeling"];function Ec(e){return(0,S.filter)(e,function(t){return e.indexOf(t.labelTarget)===-1})}var tb={__init__:["labelSupport"],labelSupport:["type",Wl]};function Bc(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Rc(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function nb(e,t,o,a){var l=o.inverse;return Object.defineProperty(e,"remove",{value:function(r){var i=this.indexOf(r);return i!==-1&&(this.splice(i,1),t.unset(r,l,a)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,i){var s=this.indexOf(r);if(typeof i>"u"){if(s!==-1)return;i=this.length}s!==-1&&this.splice(s,1),this.splice(i,0,r),s===-1&&t.set(r,l,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function ob(e){return e.__refs_collection===!0}function ab(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function _c(e,t,o){var a=nb(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(l){e.set(l,t.inverse,o)})}function lb(e,t,o){var a=t.inverse,l=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return l},set:function(r){if(r!==l){var i=l;l=null,i&&e.unset(i,a,o),l=r,e.set(l,a,o)}}})}function St(e,t){if(!(this instanceof St))return new St(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}St.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?_c(this,t,e):lb(this,t,e)},St.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return ob(o)||_c(this,t,e),o},St.prototype.ensureBound=function(e,t){ab(e,t)||this.bind(e,t)},St.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},St.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var Ul=new St({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Tc=new St({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Mc=new St({name:"attachers",collection:!0},{name:"host"}),Vc=new St({name:"outgoing",collection:!0},{name:"source"}),Nc=new St({name:"incoming",collection:!0},{name:"target"});function to(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,o=this.labels;!e&&t?o.remove(t):o.add(e,0)}}),Ul.bind(this,"parent"),Tc.bind(this,"labels"),Vc.bind(this,"outgoing"),Nc.bind(this,"incoming")}function Co(){to.call(this),Ul.bind(this,"children"),Mc.bind(this,"host"),Mc.bind(this,"attachers")}Sn(Co,to);function Ac(){to.call(this),Ul.bind(this,"children")}Sn(Ac,Co);function Pc(){Co.call(this),Tc.bind(this,"labelTarget")}Sn(Pc,Co);function jc(){to.call(this),Vc.bind(this,"source"),Nc.bind(this,"target")}Sn(jc,to);var rb={connection:jc,shape:Co,label:Pc,root:Ac};function ib(e,t){var o=rb[e];if(!o)throw new Error("unknown type: <"+e+">");return(0,S.assign)(new o,t)}function sb(e){return e instanceof to}function cn(){this._uid=12}cn.prototype.createRoot=function(e){return this.create("root",e)},cn.prototype.createLabel=function(e){return this.create("label",e)},cn.prototype.createShape=function(e){return this.create("shape",e)},cn.prototype.createConnection=function(e){return this.create("connection",e)},cn.prototype.create=function(e,t){return t=(0,S.assign)({},t||{}),t.id||(t.id=e+"_"+this._uid++),ib(e,t)};var cb={width:90,height:20};function En(){cn.call(this),this._translate=Rc}(0,Yt.default)(En,cn),En.$inject=[],En.prototype.baseCreate=cn.prototype.create,En.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Ue({type:"label"},cb,t)):this.createFlowElement(e,t)},En.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Bc()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=Ue({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},En.prototype._getDefaultSize=function(e){let t={width:100,height:80};switch(e){case"startEvent":case"endEvent":case"myEvent":t={width:36,height:36};break;case"gatewayAnd":case"gatewayXor":case"gatewayInclusive":t={width:50,height:50};break;case"subprocess":case"userTask":case"scriptTask":t={width:100,height:80};break}return t};function ha(e,t){this._modeling=e,this._canvas=t}ha.$inject=["modeling","canvas"],ha.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;(0,S.forEach)(o,function(l){var r={x:0,y:0};(0,S.isDefined)(a.left)?r.x=a.left-l.x:(0,S.isDefined)(a.right)?r.x=a.right-l.width-l.x:(0,S.isDefined)(a.center)?r.x=a.center-Math.round(l.width/2)-l.x:(0,S.isDefined)(a.top)?r.y=a.top-l.y:(0,S.isDefined)(a.bottom)?r.y=a.bottom-l.height-l.y:(0,S.isDefined)(a.middle)&&(r.y=a.middle-Math.round(l.height/2)-l.y),t.moveElements([l],r,l.parent)})},ha.prototype.postExecute=function(e){};function ga(e){this._modeling=e}ga.$inject=["modeling"],ga.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,l=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:l.attach}),e.shape=a},ga.prototype.postExecute=function(e){var t=e.hints||{};db(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function db(e,t){return(0,S.some)(e.outgoing,function(o){return o.target===t})}function ma(e,t){this._canvas=e,this._layouter=t}ma.$inject=["canvas","layouter"],ma.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,l=e.parent,r=e.parentIndex,i=e.hints;if(!o||!a)throw new Error("source and target required");if(!l)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,i)),this._canvas.addConnection(t,l,r),t},ma.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ya=Math.round;function Jl(e){this._modeling=e}Jl.$inject=["modeling"],Jl.prototype.preExecute=function(e){var t=e.elements,o=e.parent,a=e.parentIndex,l=e.position,r=e.hints,i=this._modeling;(0,S.forEach)(t,function(u){(0,S.isNumber)(u.x)||(u.x=0),(0,S.isNumber)(u.y)||(u.y=0)});var s=It((0,S.filter)(t,function(u){return!u.hidden}));(0,S.forEach)(t,function(u){vt(u)&&(u.waypoints=(0,S.map)(u.waypoints,function(p){return{x:ya(p.x-s.x-s.width/2+l.x),y:ya(p.y-s.y-s.height/2+l.y)}})),(0,S.assign)(u,{x:ya(u.x-s.x-s.width/2+l.x),y:ya(u.y-s.y-s.height/2+l.y)})});var c=iy(t),d={};(0,S.forEach)(t,function(u){if(vt(u)){d[u.id]=(0,S.isNumber)(a)?i.createConnection(d[u.source.id],d[u.target.id],a,u,u.parent||o,r):i.createConnection(d[u.source.id],d[u.target.id],u,u.parent||o,r);return}var p=(0,S.assign)({},r);c.indexOf(u)===-1&&(p.autoResize=!1),Qn(u)&&(p=(0,S.omit)(p,["attach"])),d[u.id]=(0,S.isNumber)(a)?i.createShape(u,(0,S.pick)(u,["x","y","width","height"]),u.parent||o,a,p):i.createShape(u,(0,S.pick)(u,["x","y","width","height"]),u.parent||o,p)}),e.elements=(0,S.values)(d)};var Oc=Math.round;function dn(e){this._canvas=e}dn.$inject=["canvas"],dn.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,l=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?(0,S.assign)(t,o):(0,S.assign)(t,{x:o.x-Oc(t.width/2),y:o.y-Oc(t.height/2)}),this._canvas.addShape(t,a,l),t},dn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function xo(e){dn.call(this,e)}Sn(xo,dn),xo.$inject=["canvas"];var ub=dn.prototype.execute;xo.prototype.execute=function(e){var t=e.shape;return pb(t),t.labelTarget=e.labelTarget,ub.call(this,e)};var fb=dn.prototype.revert;xo.prototype.revert=function(e){return e.shape.labelTarget=null,fb.call(this,e)};function pb(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ko(e,t){this._canvas=e,this._modeling=t}ko.$inject=["canvas","modeling"],ko.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;eo(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),eo(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},ko.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=$l(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ko.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,sn(o.children,t,a),this._canvas.addConnection(t,o),t};function Yl(e,t){this._modeling=e,this._elementRegistry=t}Yl.$inject=["modeling","elementRegistry"],Yl.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;(0,S.forEach)(a,function(l){o.get(l.id)&&(l.waypoints?t.removeConnection(l):t.removeShape(l))})};function So(e,t){this._canvas=e,this._modeling=t}So.$inject=["canvas","modeling"],So.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;eo(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),eo(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),eo(o.children,function(a){vt(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},So.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=$l(a.children,o),t.removeShape(o),o},So.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,l=e.oldParentIndex;return sn(a.children,o,l),t.addShape(o,a),o};function ba(e){this._modeling=e}ba.$inject=["modeling"];var Ic={x:"y",y:"x"};ba.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,l=e.dimension;function r(y,w){y.range.min=Math.min(w[a],y.range.min),y.range.max=Math.max(w[a]+w[l],y.range.max)}function i(y){return y[a]+y[l]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function d(y,w){var x={y:0};x[a]=y-i(w),x[a]&&(x[Ic[a]]=0,t.moveElements([w],x,w.parent))}var u=o[0],p=s(o),f=o[p],h,g,m=0;(0,S.forEach)(o,function(y,w){var x,v,C;if(y.elements.length<2){w&&w!==o.length-1&&(r(y,y.elements[0]),m+=c(y.range));return}x=(0,S.sortBy)(y.elements,a),v=x[0],w===p&&(v=x[s(x)]),C=i(v),y.range=null,(0,S.forEach)(x,function(R){if(d(C,R),y.range===null){y.range={min:R[a],max:R[a]+R[l]};return}r(y,R)}),w&&w!==o.length-1&&(m+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),h=Math.round((g-m)/(o.length-1)),!(h<o.length-1)&&(0,S.forEach)(o,function(y,w){var x={},v;y===u||y===f||(v=o[w-1],y.range.max=0,(0,S.forEach)(y.elements,function(C,R){x[Ic[a]]=0,x[a]=v.range.max-C[a]+h,y.range.min!==C[a]&&(x[a]+=C[a]-y.range.min),x[a]&&t.moveElements([C],x,C.parent),y.range.max=Math.max(C[a]+C[l],R?y.range.max:0)}))})},ba.prototype.postExecute=function(e){};function va(e,t){this._layouter=e,this._canvas=t}va.$inject=["layouter","canvas"],va.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return(0,S.assign)(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},va.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Kl(){}Kl.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,l=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=pa(r.children,t),sn(a.children,t,l),t.parent=a,(0,S.forEach)(t.waypoints,function(i){i.x+=o.x,i.y+=o.y,i.original&&(i.original.x+=o.x,i.original.y+=o.y)}),t},Kl.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,l=e.oldParentIndex,r=e.delta;return pa(o.children,t),sn(a.children,t,l),t.parent=a,(0,S.forEach)(t.waypoints,function(i){i.x-=r.x,i.y-=r.y,i.original&&(i.original.x-=r.x,i.original.y-=r.y)}),t};function wa(e,t,o){var a=Ls(t),l=Ls(o),r=qn(e,a),i={x:r.x*(o.width/t.width),y:r.y*(o.height/t.height)};return wo({x:l.x+i.x,y:l.y+i.y})}function Gl(e,t,o){var a=Ca(e),l=Lc(a,t),r=a[0];return l.length?l[l.length-1]:wa(r.original||r,o,t)}function ql(e,t,o){var a=Ca(e),l=Lc(a,t),r=a[a.length-1];return l.length?l[0]:wa(r.original||r,o,t)}function Xl(e,t,o){var a=Ca(e),l=zc(t,o),r=a[0];return wa(r.original||r,l,t)}function Zl(e,t,o){var a=Ca(e),l=zc(t,o),r=a[a.length-1];return wa(r.original||r,l,t)}function zc(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ca(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Lc(e,t){return(0,S.filter)((0,S.map)(e,gb),function(o){return hb(o,t)})}function hb(e,t){return rn(t,e,1)==="intersect"}function gb(e){return e.original||e}function Ql(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ql.prototype.add=function(e,t){return this.addAll([e],t)},Ql.prototype.addAll=function(e,t){var o=dy(e,!!t,this);return(0,S.assign)(this,o),this};function Eo(e){this._modeling=e}Eo.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},Eo.prototype.moveClosure=function(e,t,o,a,l){var r=this._modeling,i=e.allShapes,s=e.allConnections,c=e.enclosedConnections,d=e.topLevel,u=!1;l&&l.parent===o&&(u=!0),(0,S.forEach)(i,function(p){r.moveShape(p,t,d[p.id]&&!u&&o,{recurse:!1,layout:!1})}),(0,S.forEach)(s,function(p){var f=!!i[p.source.id],h=!!i[p.target.id];c[p.id]&&f&&h?r.moveConnection(p,t,d[p.id]&&!u&&o):r.layoutConnection(p,{connectionStart:f&&Xl(p,p.source,t),connectionEnd:h&&Zl(p,p.target,t)})})},Eo.prototype.getClosure=function(e){return new Ql().addAll(e,!0)};function xa(e){this._helper=new Eo(e)}xa.$inject=["modeling"],xa.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},xa.prototype.postExecute=function(e){var t=e.hints,o;t&&t.primaryShape&&(o=t.primaryShape,t.oldParent=o.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,o)};function Bn(e){this._modeling=e,this._helper=new Eo(e)}Bn.$inject=["modeling"],Bn.prototype.execute=function(e){var t=e.shape,o=e.delta,a=e.newParent||t.parent,l=e.newParentIndex,r=t.parent;return e.oldBounds=(0,S.pick)(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=pa(r.children,t),sn(a.children,t,l),(0,S.assign)(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},Bn.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,l=this._modeling;a.layout!==!1&&((0,S.forEach)(t.incoming,function(r){l.layoutConnection(r,{connectionEnd:Zl(r,t,o)})}),(0,S.forEach)(t.outgoing,function(r){l.layoutConnection(r,{connectionStart:Xl(r,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},Bn.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,l=e.delta;return sn(o.children,t,a),(0,S.assign)(t,{parent:o,x:t.x-l.x,y:t.y-l.y}),t},Bn.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Bn.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Bo(e){this._modeling=e}Bo.$inject=["modeling"],Bo.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,l=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return(0,S.isArray)(l)&&(e.oldWaypoints=a.waypoints,a.waypoints=l),t&&(e.oldSource=a.source,a.source=t),o&&(e.oldTarget=a.target,a.target=o),a},Bo.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,a=e.newTarget,l=e.dockingOrPoints,r=e.hints||{},i={};r.connectionStart&&(i.connectionStart=r.connectionStart),r.connectionEnd&&(i.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(o&&(!a||r.docking==="source")&&(i.connectionStart=i.connectionStart||Hc((0,S.isArray)(l)?l[0]:l)),a&&(!o||r.docking==="target")&&(i.connectionEnd=i.connectionEnd||Hc((0,S.isArray)(l)?l[l.length-1]:l)),r.newWaypoints&&(i.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,i))},Bo.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,l=e.connection;return t&&(l.source=t),o&&(l.target=o),a&&(l.waypoints=a),l};function Hc(e){return e.original||e}function qt(e,t){this._modeling=e,this._rules=t}qt.$inject=["modeling","rules"],qt.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,l=e.oldShape,r=e.newData,i=e.hints||{},s;function c(g,m,y){return a.allowed("connection.reconnect",{connection:y,source:g,target:m})}var d={x:r.x,y:r.y},u={x:l.x,y:l.y,width:l.width,height:l.height};s=e.newShape=e.newShape||t.createShape(r,d,l.parent,i),l.host&&o.updateAttachment(s,l.host);var p;i.moveChildren!==!1&&(p=l.children.slice(),o.moveElements(p,{x:0,y:0},s,i));var f=l.incoming.slice(),h=l.outgoing.slice();(0,S.forEach)(f,function(g){var m=g.source;c(m,s,g)&&t.reconnectEnd(g,s,ql(g,s,u),i)}),(0,S.forEach)(h,function(g){var m=g.target;c(s,m,g)&&t.reconnectStart(g,s,Gl(g,s,u),i)})},qt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},qt.prototype.execute=function(e){},qt.prototype.revert=function(e){},qt.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},qt.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},qt.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function Ro(e){this._modeling=e}Ro.$inject=["modeling"],Ro.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},(0,S.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Ro.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds;(e.hints||{}).layout!==!1&&((0,S.forEach)(o.incoming,function(l){t.layoutConnection(l,{connectionEnd:ql(l,o,a)})}),(0,S.forEach)(o.outgoing,function(l){t.layoutConnection(l,{connectionStart:Gl(l,o,a)})}))},Ro.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return(0,S.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function mb(e,t){var o=[];return(0,S.forEach)(e.concat(t),function(a){var l=a.incoming,r=a.outgoing;(0,S.forEach)(l.concat(r),function(i){var s=i.source,c=i.target;(_o(e,s)||_o(e,c)||_o(t,s)||_o(t,c))&&(_o(o,i)||o.push(i))})}),o}function _o(e,t){return e.indexOf(t)!==-1}function yb(e,t,o){var a=e.x,l=e.y,r=e.width,i=e.height,s=o.x,c=o.y;switch(t){case"n":return{x:a,y:l+c,width:r,height:i-c};case"s":return{x:a,y:l,width:r,height:i+c};case"w":return{x:a+s,y:l,width:r-s,height:i};case"e":return{x:a,y:l,width:r+s,height:i};default:throw new Error("unknown direction: "+t)}}function un(e){this._modeling=e}un.$inject=["modeling"],un.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,l=e.resizingShapes,r=e.start,i={};this.moveShapes(a,t),(0,S.forEach)(l,function(s){i[s.id]=vb(s)}),this.resizeShapes(l,t,o),this.updateConnectionWaypoints(mb(a,l),t,o,r,a,l,i)},un.prototype.execute=function(){},un.prototype.revert=function(){},un.prototype.moveShapes=function(e,t){var o=this;(0,S.forEach)(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},un.prototype.resizeShapes=function(e,t,o){var a=this;(0,S.forEach)(e,function(l){var r=yb(l,o,t);a._modeling.resizeShape(l,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},un.prototype.updateConnectionWaypoints=function(e,t,o,a,l,r,i){var s=this,c=l.concat(r);(0,S.forEach)(e,function(d){var u=d.source,p=d.target,f=bb(d),h=Fc(o),g={};fn(c,u)&&fn(c,p)?(f=(0,S.map)(f,function(m){return $c(m,a,o)&&(m[h]=m[h]+t[h]),m.original&&$c(m.original,a,o)&&(m.original[h]=m.original[h]+t[h]),m}),s._modeling.updateWaypoints(d,f,{labelBehavior:!1})):(fn(c,u)||fn(c,p))&&(fn(l,u)?g.connectionStart=Xl(d,u,t):fn(l,p)?g.connectionEnd=Zl(d,p,t):fn(r,u)?g.connectionStart=Gl(d,u,i[u.id]):fn(r,p)&&(g.connectionEnd=ql(d,p,i[p.id])),s._modeling.layoutConnection(d,g))})};function Dc(e){return(0,S.assign)({},e)}function bb(e){return(0,S.map)(e.waypoints,function(t){return t=Dc(t),t.original&&(t.original=Dc(t.original)),t})}function Fc(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function $c(e,t,o){var a=Fc(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function fn(e,t){return e.indexOf(t)!==-1}function vb(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function ka(e){this._modeling=e}ka.$inject=["modeling"],ka.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=Wc(o),t.collapsed=!t.collapsed;var a=Uc(o,t.collapsed);return[t].concat(a)},ka.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,l=Jc(a,o);return t.collapsed=!t.collapsed,[t].concat(l)};function Wc(e){var t={};return(0,S.forEach)(e,function(o){t[o.id]=o.hidden,o.children&&(t=(0,S.assign)({},t,Wc(o.children)))}),t}function Uc(e,t){var o=[];return(0,S.forEach)(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(Uc(a.children,a.collapsed||t)))}),o}function Jc(e,t){var o=[];return(0,S.forEach)(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(Jc(a.children,t)))}),o}function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Yc(a,t),Kc(o,t),t.host=o,t},Sa.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,l=e.attacherIdx;return t.host=a,Yc(o,t),Kc(a,t,l),t};function Yc(e,t){return pa(e&&e.attachers,t)}function Kc(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),sn(a,t,o)}}function er(){}er.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},er.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function je(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}je.$inject=["eventBus","elementFactory","commandStack"],je.prototype.getHandlers=function(){return{"shape.append":ga,"shape.create":dn,"shape.delete":So,"shape.move":Bn,"shape.resize":Ro,"shape.replace":qt,"shape.toggleCollapse":ka,spaceTool:un,"label.create":xo,"connection.create":ma,"connection.delete":ko,"connection.move":Kl,"connection.layout":va,"connection.updateWaypoints":er,"connection.reconnect":Bo,"elements.create":Jl,"elements.move":xa,"elements.delete":Yl,"elements.distribute":ba,"elements.align":ha,"element.updateAttachment":Sa}},je.prototype.registerHandlers=function(e){(0,S.forEach)(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},je.prototype.moveShape=function(e,t,o,a,l){typeof a=="object"&&(l=a,a=null);var r={shape:e,delta:t,newParent:o,newParentIndex:a,hints:l||{}};this._commandStack.execute("shape.move",r)},je.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},je.prototype.moveElements=function(e,t,o,a){a=a||{};var l=a.attach,r=o,i;l===!0?(i=o,r=o.parent):l===!1&&(i=null);var s={shapes:e,delta:t,newParent:r,newHost:i,hints:a};this._commandStack.execute("elements.move",s)},je.prototype.moveConnection=function(e,t,o,a,l){typeof a=="object"&&(l=a,a=void 0);var r={connection:e,delta:t,newParent:o,newParentIndex:a,hints:l||{}};this._commandStack.execute("connection.move",r)},je.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},je.prototype.createConnection=function(e,t,o,a,l,r){typeof o=="object"&&(r=l,l=a,a=o,o=void 0),a=this._create("connection",a);var i={source:e,target:t,parent:l,parentIndex:o,connection:a,hints:r};return this._commandStack.execute("connection.create",i),i.connection},je.prototype.createShape=function(e,t,o,a,l){typeof a!="number"&&(l=a,a=void 0),l=l||{};var r=l.attach,i,s;e=this._create("shape",e),r?(i=o.parent,s=o):i=o;var c={position:t,shape:e,parent:i,parentIndex:a,host:s,hints:l};return this._commandStack.execute("shape.create",c),c.shape},je.prototype.createElements=function(e,t,o,a,l){(0,S.isArray)(e)||(e=[e]),typeof a!="number"&&(l=a,a=void 0),l=l||{};var r={position:t,elements:e,parent:o,parentIndex:a,hints:l};return this._commandStack.execute("elements.create",r),r.elements},je.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var l={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",l),l.shape},je.prototype.appendShape=function(e,t,o,a,l){l=l||{},t=this._create("shape",t);var r={source:e,position:o,target:a,shape:t,connection:l.connection,connectionParent:l.connectionParent,hints:l};return this._commandStack.execute("shape.append",r),r.shape},je.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},je.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},je.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},je.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},je.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},je.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},je.prototype.resizeShape=function(e,t,o,a){var l={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",l)},je.prototype.createSpace=function(e,t,o,a,l){var r={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:l};this._commandStack.execute("spaceTool",r)},je.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},je.prototype.reconnect=function(e,t,o,a,l){var r={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:l||{}};this._commandStack.execute("connection.reconnect",r)},je.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,(0,S.assign)(a,{docking:"source"}))},je.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,(0,S.assign)(a,{docking:"target"}))},je.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},je.prototype._create=function(e,t){return sb(t)?t:this._elementFactory.create(e,t)},je.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function Gc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function tr(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function wb(e,t){Array.isArray(e)&&e.forEach(t)}function Ea(e){const t=e.businessObject;if(t)return t.name||""}function Cb(e,t){const o=e.businessObject;return o.name=t,e}var xb={width:90,height:20},zC=15;function nr(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function qc(e){return To(e.label)}function kb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],l=Sb(e),r=Math.atan((a.y-o.y)/(a.x-o.x));let{x:i,y:s}=l;return Math.abs(r)<Math.PI/2?s-=15:i+=15,{x:i,y:s}}function Sb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function Xc(e){return e.waypoints?kb(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+xb.height/2}}function To(e){return e&&!!e.labelTarget}var Eb={width:0,height:0};function Zc(e,t){function o(s,c){const d=s.label||s,u=s.labelTarget||s;return Cb(d,c,u!==d),[d,u]}function a(s){const{element:c,newLabel:d}=s,{businessObject:u}=c;if(!To(c)&&nr(c)&&!qc(c)&&!Qc(d)){let f=Xc(c);f={x:f.x,y:f.y+7},e.createLabel(c,f,{id:u.id+"_label",businessObject:u})}}function l(s){return s.oldLabel=Ea(s.element),o(s.element,s.newLabel)}function r(s){return o(s.element,s.oldLabel)}function i(s){const{element:c,newLabel:d}=s,u=c.label||c,p=s.hints||{};let{newBounds:f}=s;if(!To(u))return;if(To(u)&&Qc(d)){p.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const h=Ea(u);typeof f>"u"&&(f=t.getExternalLabelBounds(u,h)),f&&e.resizeShape(u,f,Eb)}this.preExecute=a,this.execute=l,this.revert=r,this.postExecute=i}Zc.$inject=["modeling","textRenderer"];function Qc(e){return!e||!e.trim()}function Mo(e,t,o){je.call(this,e,t,o)}(0,Yt.default)(Mo,je),Mo.$inject=["eventBus","elementFactory","commandStack"],Mo.prototype.getHandlers=function(){const e=je.prototype.getHandlers.call(this);return e["element.updateLabel"]=Zc,e},Mo.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function or(e,t){ut.call(this,e);function o(a){const{context:l}=a,r=l.hints||{};let i;!l.cropped&&r.createElementsBehavior!==!1&&(i=l.connection,i.waypoints=t.getCroppedWaypoints(i),l.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}(0,Yt.default)(or,ut),or.$inject=["eventBus","connectionDocking"];function ed(){}ed.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||qe(t.source||e.source),t.connectionEnd||qe(t.target||e.target)]};var Ba=20,Bb=5,Ra=Math.round,td=20,Rb={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function _b(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Tb(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function nd(e,t,o){var a=rn(t,e,Bb),l=o.split(":")[0],r=Ra((t.x-e.x)/2+e.x),i=Ra((t.y-e.y)/2+e.y),s,c,d=Tb(l,a),u=/h|r|l/.test(l),p=!1,f=!1;return d?(s=u?{x:r,y:e.y}:{x:e.x,y:i},c=u?"h:h":"v:v"):(p=_b(a,l),c=u?"h:v":"v:h",p?u?(f=i===e.y,s={x:e.x+Ba*(/l/.test(l)?-1:1),y:f?i+Ba:i}):(f=r===e.x,s={x:f?r+Ba:r,y:e.y+Ba*(/t/.test(l)?-1:1)}):s={x:r,y:i}),{waypoints:ar(e,s,c).concat(s),directions:c,turnNextDirections:f}}function Mb(e,t,o){return nd(e,t,o)}function Vb(e,t,o){var a=nd(t,e,od(o));return{waypoints:a.waypoints.slice().reverse(),directions:od(a.directions),turnNextDirections:a.turnNextDirections}}function Nb(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var l=o+":"+a;return{waypoints:ar(e.waypoints[e.waypoints.length-1],t.waypoints[0],l),directions:l}}function od(e){return e.split(":").reverse().join(":")}function Ab(e,t,o){var a=Ra((t.x-e.x)/2+e.x),l=Ra((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:l},{x:t.x,y:l}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function ar(e,t,o){if(o=o||"h:h",!Fb(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ld(o)){var a=Mb(e,t,o),l=Vb(e,t,o),r=Nb(a,l);return[].concat(a.waypoints,r.waypoints,l.waypoints)}return Ab(e,t,o)}function Pb(e,t,o){var a=ar(e,t,o);return a.unshift(e),a.push(t),id(a)}function jb(e,t,o,a,l){var r=(0,S.without)(l&&l.preferredLayouts||[],"straight")[0]||"h:h",i=rn(e,t,Rb[r]||0),s=Db(i,r);o=o||qe(e),a=a||qe(t);var c=s.split(":");return Pb(rd(o,e,c[0],$b(i)),rd(a,t,c[1],i),s)}function Ob(e,t,o,a,l,r){(0,S.isArray)(o)&&(l=o,r=a,o=qe(e),a=qe(t)),r=(0,S.assign)({preferredLayouts:[]},r),l=l||[];var i=r.preferredLayouts.indexOf("straight")!==-1&&zb(e,t,o,a,r);return i||(i=r.connectionEnd&&Hb(t,e,a,l),i)||(i=r.connectionStart&&Lb(e,t,o,l),i)?i:!r.connectionStart&&!r.connectionEnd&&l&&l.length?l:jb(e,t,o,a,r)}function Ib(e,t,o){return e>=t&&e<=o}function ad(e,t,o){return Ib(t[e],o[e],o[e]+o[{x:"width",y:"height"}[e]])}function zb(e,t,o,a,l){var r={},i,s=rn(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(i="x"),/left|right/.test(s)&&(i="y"),l.preserveDocking==="target"?ad(i,a,e)?(r[i]=a[i],[{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y,original:{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y}},{x:a.x,y:a.y}]):null:ad(i,o,t)?(r[i]=o[i],[{x:o.x,y:o.y},{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y,original:{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y}}]):null):null}function Lb(e,t,o,a){return lr(e,t,o,a)}function Hb(e,t,o,a){var l=a.slice().reverse();return l=lr(e,t,o,l),l?l.reverse():null}function lr(e,t,o,a){function l(u){return u.length<3?!0:u.length>4?!1:!!(0,S.find)(u,function(p,f){var h=u[f-1];return h&&vo(p,h)<3})}function r(u,p,f){switch(nn(p,u)){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function i(u,p,f){var h;for(h=u.length-2;h!==0;h--)if(tc(u[h],p,td)||tc(u[h],f,td))return u.slice(h);return u}if(l(a))return null;var s=a[0],c=a.slice(),d;return c[0]=o,c[1]=r(c[1],s,o),d=i(c,e,t),d!==c&&(c=lr(e,t,o,d)),c&&nn(c)?null:c}function Db(e,t){if(ld(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function Fb(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ld(e){return e&&/t|r|b|l/.test(e)}function $b(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function rd(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function id(e){return e.reduce(function(t,o,a){var l=t[t.length-1],r=e[a+1];return Pl(l,r,o,0)||t.push(o),t},[])}function rr(){}(0,Yt.default)(rr,ed);var Rn=(e,t)=>e.type===t;rr.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,l=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:i}=t,s,c;return i===void 0&&(r=_a(l&&l[0],o),i=_a(l&&l[l.length-1],a)),r||(r=_a(l&&l[0],o)),i||(i=_a(l&&l[l.length-1],a)),Rn(e,"myline")&&(o===a?s={preferredLayouts:Wb(o,e)}:Rn(o,"gatewayAnd")||Rn(o,"gatewayXor")||Rn(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:Rn(a,"gatewayAnd")||Rn(a,"gatewayXor")||Rn(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Ue(s,t),c=id(Ob(o,a,r,i,l,s))),c||[r,i]};function _a(e,t){return e?e.original||e:qe(t)}function Wb(e,t){const{waypoints:o}=t,a=o&&o.length&&rn(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function sd(e){return(0,S.assign)({original:e.point.original||e.point},e.actual)}function pn(e,t){this._elementRegistry=e,this._graphicsFactory=t}pn.$inject=["elementRegistry","graphicsFactory"],pn.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),l=this.getDockingPoint(e,o),r=e.waypoints.slice(a.idx+1,l.idx);return r.unshift(sd(a)),r.push(sd(l)),r},pn.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,l=o?0:a.length-1,r=a[l];return{point:r,actual:this._getIntersection(t,e,o)||r,idx:l}},pn.prototype._getIntersection=function(e,t,o){return zl(this._getShapePath(e),this._getConnectionPath(t),o)},pn.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},pn.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},pn.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var cd={__depends__:[Xy,tb,Gn],__init__:["modeling","elementUpdater"],modeling:["type",Mo],layouter:["type",rr],elementUpdater:["type",or],elementFactory:["type",En],connectionDocking:["type",pn]},Ub=1e3;function _n(e,t){var o=this;t=t||Ub,e.on(["render.shape","render.connection"],t,function(a,l){var r=a.type,i=l.element,s=l.gfx,c=l.attrs;if(o.canRender(i))return r==="render.shape"?o.drawShape(s,i,c):o.drawConnection(s,i,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,l){if(o.canRender(l))return a.type==="render.getShapePath"?o.getShapePath(l):o.getConnectionPath(l)})}_n.prototype.canRender=function(e){},_n.prototype.drawShape=function(e,t){},_n.prototype.drawConnection=function(e,t){},_n.prototype.getShapePath=function(e){},_n.prototype.getConnectionPath=function(e){};function Jb(e){return e.businessObject}function Ta(e,t){return e.businessObject.strokeWidth||t||1}function Mt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Xe(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function Yb(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2;return yo([["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]])}function Kb(e,t){const{x:o,y:a,width:l,height:r}=e;return yo([["M",o+t,a],["l",l-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-l,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]])}function Gb(e){const{x:t,y:o,width:a,height:l}=e,r=a/2,i=l/2;return yo([["M",t+r,o],["l",r,i],["l",-r,i],["l",-r,-i],["z"]])}function qb(e){const{x:t,y:o,width:a,height:l}=e;return yo([["M",t,o],["l",a,0],["l",0,l],["l",-a,0],["z"]])}var ir=10,sr=.95,hn=(e,t)=>e.type===t;function Tn(e,t,o,a,l,r,i){_n.call(this,e,i);const s="var(--j-color-bg-container)",c="var(--j-color-text)",d={};Object.keys(r.palette).forEach(M=>{const E=r.palette[M];d[E.type]=E.options});const{computeStyle:u}=t;function p(M){return D[M]}function f(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2})}function h(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2,fill:"white"})}function g(M,E,I,$){I=f(I);const Q=Rl(E,I,$);return(0,N.append)(M,Q),Q}function m(M,E,I){return g(M,E,I,5)}function y(M,E,I,$,Q){Gc($)&&(Q=$,$=0),$=$||0,Q=u(Q,{stroke:c,strokeWidth:2,fill:s}),Q.fill==="none"&&delete Q.fillOpacity;const ue=E/2,xe=I/2,_e=(0,N.create)("circle");return(0,N.attr)(_e,{cx:ue,cy:xe,r:Math.round((E+I)/4-$)}),(0,N.attr)(_e,Q),(0,N.append)(M,_e),_e}function w(M,E,I,$,Q,ue){Gc(Q)&&(ue=Q,Q=0),Q=Q||0,ue=u(ue,{stroke:c,strokeWidth:2,fill:s});const xe=(0,N.create)("rect");return(0,N.attr)(xe,{x:Q,y:Q,width:E-Q*2,height:I-Q*2,rx:$,ry:$}),(0,N.attr)(xe,ue),(0,N.append)(M,xe),xe}function x(M,E,I){I=u(I,["no-fill"],{strokeWidth:2,stroke:c});const $=(0,N.create)("path");return(0,N.attr)($,{d:E}),(0,N.attr)($,I),(0,N.append)(M,$),$}function v(M,E,I,$){const Q=E/2,ue=I/2,xe=[{x:Q,y:0},{x:E,y:ue},{x:Q,y:I},{x:0,y:ue}].map(Y=>Y.x+","+Y.y).join(" ");$=u($,{stroke:c,strokeWidth:2,fill:s});const _e=(0,N.create)("polygon");return(0,N.attr)(_e,{points:xe}),(0,N.attr)(_e,$),(0,N.append)(M,_e),_e}function C(M,E,I,$){return x(E,I,Ue({"data-marker":M},$))}function R(M,E,I){I=Ue({size:{width:100}},I);const $=l.createText(E||"",I);return(0,N.classes)($).add("djs-label"),(0,N.append)(M,$),$}function b(M,E,I){return R(M,Jb(E).name,{box:E,align:I,padding:5,style:{fill:Xe(E,c)}})}function k(M,E){const I={width:90,height:30,x:E.width/2+E.x,y:E.height/2+E.y};return R(M,Ea(E),{box:I,fitBox:!0,style:Ue({},l.getExternalStyle(),{fill:Xe(E,c)})})}function B(M,E,I){const $=I&&I.indexOf("SubProcessMarker")!==-1;let Q;$?Q={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:Q={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},wb(I,ue=>{p(ue)(M,E,Q)})}function _(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function V(M,E){const{ref:I={x:0,y:0},scale:$=1,element:Q,parentGfx:ue=a._svg}=E,xe=(0,N.create)("marker",{id:M,viewBox:"0 0 20 20",refX:I.x,refY:I.y,markerWidth:20*$,markerHeight:20*$,orient:"auto"});(0,N.append)(xe,Q);let _e=(0,W.query)(":scope > defs",ue);_e||(_e=(0,N.create)("defs"),(0,N.append)(ue,_e)),(0,N.append)(_e,xe)}function T(M,E,I,$){const Q=E+"-"+_(I)+"-"+_($)+"-"+Bc();return F(M,Q,E,I,$),"url(#"+Q+")"}function F(M,E,I,$,Q){I==="sequenceflow-end"&&V(E,{element:(0,N.create)("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:Q,stroke:Q,strokeWidth:1})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),I==="messageflow-start"&&V(E,{element:(0,N.create)("circle",{cx:6,cy:6,r:3.5,...h({fill:$,stroke:Q,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6},parentGfx:M}),I==="messageflow-end"&&V(E,{element:(0,N.create)("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:$,stroke:Q,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5},parentGfx:M}),I==="association-start"&&V(E,{element:(0,N.create)("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:Q,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5,parentGfx:M}),I==="association-end"&&V(E,{element:(0,N.create)("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:Q,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),I==="conditional-flow-marker"&&V(E,{element:(0,N.create)("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:$,stroke:Q})}),ref:{x:-1,y:10},scale:.5,parentGfx:M}),I==="conditional-default-flow-marker"&&V(E,{element:(0,N.create)("path",{d:"M 6 4 L 10 16",...h({stroke:Q,fill:"none"})}),ref:{x:0,y:10},scale:.5,parentGfx:M})}function L(M,E,I,$){const Q=d[E.type]?.icon||E.icon;Q&&x(M,o.getScaledPath(Q,{abspos:{x:I,y:$}}),{strokeWidth:0,fill:Xe(E,d[E.type]?.iconFill||E.iconFill)})}const D={event(M,E,I){return"fillOpacity"in I||(I.fillOpacity=sr),y(M,E.width,E.height,I)},startEvent(M,E){const I={fill:Mt(E,d.startEvent?.fill||E.fill),stroke:Xe(E,d.startEvent?.stroke||E.stroke),strokeWidth:Ta(E,d.startEvent?.strokeWidth||E.strokeWidth)},$=p("event")(M,E,I);return L(M,E,18,18),$},endEvent(M,E){const I=p("event")(M,E,{strokeWidth:Ta(E,d.endEvent?.strokeWidth||E.strokeWidth||4),fill:Mt(E,d.endEvent?.fill||E.fill),stroke:Xe(E,d.endEvent?.stroke||E.stroke)});return L(M,E,18,18),I},gateway(M,E){const I={fillOpacity:sr,strokeWidth:Ta(E,d[E.type]?.strokeWidth||E.strokeWidth||4),fill:Mt(E,d[E.type]?.fill||E.fill),stroke:Xe(E,d[E.type]?.stroke||E.stroke)};return v(M,E.width,E.height,I)},gatewayAnd(M,E){const I=p("gateway")(M,E);return x(M,o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:d[E.type]?.width||E.width,containerHeight:d[E.type]?.height||E.height,position:{mx:.47,my:.29}}),{strokeWidth:1,fill:Xe(E,d[E.type]?.iconFill||E.iconFill),stroke:Xe(E,d[E.type]?.iconFill||E.iconFill)}),I},gatewayXor(M,E){const I=p("gateway")(M,E);return x(M,o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),{strokeWidth:1,fill:Xe(E,d[E.type]?.iconFill||E.iconFill),stroke:Xe(E,d[E.type]?.iconFill||E.iconFill)}),I},gatewayInclusive(M,E){const I=p("gateway")(M,E);return y(M,E.width,E.height,E.height*.24,{strokeWidth:2.5,fill:Xe(E,s),stroke:Xe(E,d[E.type]?.iconFill||E.iconFill)}),I},activity(M,E,I){return I=I||{},"fillOpacity"in I||(I.fillOpacity=sr),w(M,E.width,E.height,ir,I)},task(M,E){const I={fill:Mt(E,s),stroke:Xe(E,c)},$=p("activity")(M,E,I);return b(M,E,"center-middle"),B(M,E),$},userTask(M,E){const I=p("task")(M,E),$=15,Q=12;return x(M,o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Mt(E,s),stroke:Xe(E,c)}),x(M,o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Mt(E,s),stroke:Xe(E,c)}),x(M,o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Xe(E,c),stroke:Xe(E,c)}),I},scriptTask(M,E){const I=p("task")(M,E);return x(M,o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Xe(E,c)}),I},SubProcessMarker(M,E){zt(w(M,14,14,0,{strokeWidth:1,fill:Mt(E,s),stroke:Xe(E,c)}),E.width/2-7.5,E.height-20),C("sub-process",M,o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}}),{fill:Mt(E,s),stroke:Xe(E,c)})},subprocess(M,E,I){I=Ue({fill:Mt(E,s),stroke:Xe(E,c)},I);const $=p("activity")(M,E,I);return b(M,E,"center-middle"),B(M,E,["SubProcessMarker"]),$},label(M,E){return k(M,E)},myline(M,E){const I=Mt(E,r.lineStroke||s),$=Xe(E,r.lineStroke||c);return m(M,E.waypoints,{markerEnd:T(M,"sequenceflow-end",I,$),stroke:$})},default(M,E){const I={strokeWidth:Ta(E,d[E.type]?.strokeWidth||E.strokeWidth||1),fill:Mt(E,d[E.type]?.fill||E.fill),stroke:Xe(E,d[E.type]?.stroke||E.stroke)},$=w(M,E.width,E.height,E.radius||ir,I);return b(M,E,"center-middle"),B(M,E),L(M,E,E.iconX,E.iconY),$}};this.handlers=D,this._drawPath=x}(0,Yt.default)(Tn,_n),Tn.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],Tn.prototype.canRender=function(){return!0},Tn.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},Tn.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},Tn.prototype.getShapePath=function(e){return hn(e,"startEvent")||hn(e,"endEvent")?Yb(e):hn(e,"userTask")||hn(e,"scriptTask")||hn(e,"subprocess")?Kb(e,ir):hn(e,"gatewayAnd")||hn(e,"gatewayXor")||hn(e,"gatewayInclusive")?Gb(e):qb(e)};var Xb=0,Zb={width:150,height:50};function Qb(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function ev(e){return(0,S.isObject)(e)?(0,S.assign)({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function tv(e,t){t.textContent=e;var o;try{var a,l=e==="";return t.textContent=l?"dummy":e,o=t.getBBox(),a={width:o.width+o.x*2,height:o.height},l&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function nv(e,t,o){for(var a=e.shift(),l=a,r;;){if(r=tv(l,o),r.width=l?r.width:0,l===" "||l===""||r.width<Math.round(t)||l.length<2)return ov(e,l,a,r);l=lv(l,r.width,t)}}function ov(e,t,o,a){if(t.length<o.length){var l=o.slice(t.length).trim();e.unshift(l)}return{width:a.width,height:a.height,text:t}}var dd="­";function av(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,l=[],r=0;if(o.length>1)for(;a=o.shift();)if(a.length+r<t)l.push(a),r+=a.length;else{(a==="-"||a===dd)&&l.pop();break}var i=l[l.length-1];return i&&i===dd&&(l[l.length-1]="-"),l.join("")}function lv(e,t,o){var a=Math.max(e.length*(o/t),1),l=av(e,a);return l||(l=e.slice(0,Math.max(Math.round(a-1),1))),l}function rv(){var e=document.getElementById("helper-svg");return e||(e=(0,N.create)("svg"),(0,N.attr)(e,{id:"helper-svg"}),(0,W.assignStyle)(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function Ma(e){this._config=(0,S.assign)({},{size:Zb,padding:Xb,style:{},align:"center-top"},e||{})}Ma.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ma.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ma.prototype.layoutText=function(e,t){var o=(0,S.assign)({},this._config.size,t.box),a=(0,S.assign)({},this._config.style,t.style),l=Qb(t.align||this._config.align),r=ev(t.padding!==void 0?t.padding:this._config.padding),i=t.fitBox||!1,s=iv(a),c=e.split(/\u00AD?\r?\n/),d=[],u=o.width-r.left-r.right,p=(0,N.create)("text");for((0,N.attr)(p,{x:0,y:0}),(0,N.attr)(p,a),(0,N.append)(rv(),p);c.length;)d.push(nv(c,u,p));l.vertical==="middle"&&(r.top=r.bottom=0);var f=(0,S.reduce)(d,function(y,w,x){return y+(s||w.height)},0)+r.top+r.bottom,h=(0,S.reduce)(d,function(y,w,x){return w.width>y?w.width:y},0),g=r.top;l.vertical==="middle"&&(g+=(o.height-f)/2),g-=(s||d[0].height)/4;var m=(0,N.create)("text");return(0,N.attr)(m,a),(0,S.forEach)(d,function(y){var w;switch(g+=s||y.height,l.horizontal){case"left":w=r.left;break;case"right":w=(i?h:u)-r.right-y.width;break;default:w=Math.max(((i?h:u)-y.width)/2+r.left,0)}var x=(0,N.create)("tspan");(0,N.attr)(x,{x:w,y:g}),x.textContent=y.text,(0,N.append)(m,x)}),(0,N.remove)(p),{dimensions:{width:h,height:f},element:m}};function iv(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var sv=12,cv=1.2,dv=30;function ud(e){const t=Ue({fontFamily:"Arial, sans-serif",fontSize:sv,fontWeight:"normal",lineHeight:cv},e&&e.defaultStyle||{}),o=Ue({},t,{fontSize:parseInt(t.fontSize,10)-1},e&&e.externalStyle||{}),a=new Ma({style:t});this.getExternalLabelBounds=function(l,r){const i=a.getDimensions(r,{box:{width:90,height:30,x:l.width/2+l.x,y:l.height/2+l.y},style:o});return{x:Math.round(l.x+l.width/2-i.width/2),y:Math.round(l.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}},this.getTextAnnotationBounds=function(l,r){const i=a.getDimensions(r,{box:l,style:t,align:"left-top",padding:5});return{x:l.x,y:l.y,width:l.width,height:Math.max(dv,Math.round(i.height))}},this.createText=function(l,r){return a.createText(l,r||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return o}}ud.$inject=["config.textRenderer"];function uv(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,l;o.abspos?(a=o.abspos.x,l=o.abspos.y):(a=o.containerWidth*o.position.mx,l=o.containerHeight*o.position.my);let r={};typeof t=="object"?(r=t,r.d.indexOf("{mx},{my}")===-1&&(r.d="m {mx},{my}"+r.d),r.width&&(a-=r.width/2),r.height&&(l-=r.height/2)):r=this.pathMap[t];const i={};if(o.position){const s=o.containerHeight/r.height*o.yScaleFactor,c=o.containerWidth/r.width*o.xScaleFactor;for(let d=0;d<r.heightElements.length;d++)i["y"+d]=r.heightElements[d]*s;for(let d=0;d<r.widthElements.length;d++)i["x"+d]=r.widthElements[d]*c}return gv(r.d,{mx:a,my:l,e:i})}}var fv=/\{([^}]+)\}/g,pv=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function hv(e,t,o){let a=o;return t.replace(pv,(l,r,i,s,c)=>{r=r||s,a&&(r in a&&(a=a[r]),typeof a=="function"&&c&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function gv(e,t){return String(e).replace(fv,(o,a)=>hv(o,a,t))}var fd={__init__:["myRenderer"],myRenderer:["type",Tn],textRenderer:["type",ud],pathMap:["type",uv]};function pd(e,t){return Ue({id:e.id,type:e.type,businessObject:e},t)}function mv(e,t,o){const a=e.waypoint;return!a||a.length<2?[qe(t),qe(o)]:a.map(l=>({x:l.x,y:l.y}))}function gn(e,t,o,a,l,r){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=l,this._translate=Rc,this._textRenderer=r,this._modeling=t}gn.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],gn.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),l=this._getTarget(e);t=this._elementFactory.createConnection(pd(e,{source:a,target:l,waypoints:mv(e,a,l)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(pd(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},gn.prototype.addLabel=function(e,t){const o=this._elementFactory.createLabel({id:e.id+"_label",labelTarget:t,type:"label",x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),businessObject:e});return this._canvas.addShape(o,t.parent)},gn.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=Ue(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name:l}=t;if(l&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const r={x:t.x+12,y:t.y+42,width:10,height:10,name:l,id:e},i=this._textRenderer.getExternalLabelBounds(r,t.name);this._modeling.resizeShape(r,i,{width:0,height:0}),o&&this.addLabel(r,o)}}},gn.prototype._getSource=function(e){return this._getElement(e.from)},gn.prototype._getTarget=function(e){return this._getElement(e.to)},gn.prototype._getElement=function(e){return this._elementRegistry.get(e)};var hd={myImporter:["type",gn]},gd=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(l=>({x:l.x,y:l.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const l=t.find(r=>r.id===a.id);l&&(l.name=a.name||"",l.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},md=(e,t)=>{const o=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),l=e.filter(r=>r.type==="myline");a.forEach(r=>{o.add(r)}),l.forEach(r=>{o.add(r)})},yv=(0,n.defineComponent)({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(),i={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const b=s.get("eventBus");b.on("element.dblclick",k=>{l("elementDblclick",k.element.businessObject)}),b.on("element.click",k=>{l("elementClick",k.element.businessObject)})},p=function(){return{palette:a.paletteOptions||i,lineStroke:a.lineStroke}},f=()=>{let b={__init__:["myOptions"],myOptions:["type",p]};s=new qo.default({canvas:{container:r.value},modules:[Hl,ec,cd,wc,kc,b,fd,hd]});const k=s.get("canvas"),B=s.get("elementFactory");d();const _=B.createRoot();k.setRootElement(_),u()};(0,n.onMounted)(()=>{f()});const h=b=>{const k=b==null?1:c+b;s.get("canvas").zoom(k),c=k},g=()=>(s.get("canvas").zoom(1),gd(s.get("elementRegistry").getAll())),m=b=>{s.clear(),d(),md(b,s)},y=b=>{s.get("myImporter").update(b.id,b)};return t({reset:()=>{d()},zoom:b=>{h(b)},getData:()=>g(),setData:b=>{m(b)},updateElemet:b=>{y(b)}}),(b,k)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),bv=yv;function cr(e){return e&&e[e.length-1]}function yd(e){return e.y}function bd(e){return e.x}var vv={left:bd,center:bd,right:function(e){return e.x+e.width},top:yd,middle:yd,bottom:function(e){return e.y+e.height}};function no(e,t){this._modeling=e,this._rules=t}no.$inject=["modeling","rules"],no.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},no.prototype._isType=function(e,t){return t.indexOf(e)!==-1},no.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,l=o.dimension,r={},i={},s=!1,c,d,u;function p(f,h){return Math.round((f[a]+h[a]+h[l])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=cr(t),r[e]=u[a]+u[l];else if(this._isType(e,["center","middle"])){if((0,S.forEach)(t,function(f){var h=f[a]+Math.round(f[l]/2);i[h]?i[h].elements.push(f):i[h]={elements:[f],center:h}}),c=(0,S.sortBy)(i,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=cr(c).center,r;d=t[0],t=(0,S.sortBy)(t,function(f){return f[a]+f[l]}),u=cr(t),r[e]=p(d,u)}return r},no.prototype.trigger=function(e,t){var o=this._modeling,a,l=(0,S.filter)(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:l}),(0,S.isArray)(a)&&(l=a),!(l.length<2||!a)){var r=vv[t],i=(0,S.sortBy)(l,r),s=this._alignmentPosition(t,i);o.alignElements(i,s)}};var wv={__init__:["alignElements"],alignElements:["type",no]},Va=Math.round,Cv=Math.max;function xv(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function kv(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var vd=10;function Sv(e,t){var o,a;for(o=0;a=e[o];o++)if(vo(a,t)<=vd)return{point:e[o],bendpoint:!0,index:o};return null}function Ev(e,t){var o=cc(xv(t,vd),kv(e)),a=o[0],l=o[o.length-1],r;return a?a!==l?a.segment2!==l.segment2?(r=Cv(a.segment2,l.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Va(a.x+l.x)/2,y:Va(a.y+l.y)/2},index:a.segment2}:{point:{x:Va(a.x),y:Va(a.y)},index:a.segment2}:null}function Bv(e,t){return Sv(e,t)||Ev(e,t)}function Rv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function _v(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[1],lambda:t[1]}],l=a[0].n*t[0]+a[1].n*t[1],r=a[0].lambda*t[0]+a[1].lambda*t[1];return-l/r}function wd(e,t){var o=t[0],a=t[1],l={x:a.x-o.x,y:a.y-o.y},r=_v([o.x,o.y],[l.x,l.y],[e.x,e.y]);return{x:o.x+r*l.x,y:o.y+r*l.y}}function Tv(e,t){var o=wd(e,t);return Rv({x:o.x-e.x,y:o.y-e.y})}var Cd="djs-bendpoint",xd="djs-segment-dragger";function Mv(e,t){var o=Yn(t),a=e._container.getBoundingClientRect(),l={x:a.left,y:a.top},r=e.viewbox();return{x:r.x+(o.x-l.x)/r.scale,y:r.y+(o.y-l.y)/r.scale}}function dr(e,t,o){return Bv(t,Mv(e,o))}function ur(e,t){var o=(0,N.create)("g");(0,N.classes)(o).add(Cd),(0,N.append)(e,o);var a=(0,N.create)("circle");(0,N.attr)(a,{cx:0,cy:0,r:4}),(0,N.classes)(a).add("djs-visual"),(0,N.append)(o,a);var l=(0,N.create)("circle");return(0,N.attr)(l,{cx:0,cy:0,r:10}),(0,N.classes)(l).add("djs-hit"),(0,N.append)(o,l),t&&(0,N.classes)(o).add(t),o}function Vv(e,t,o,a){var l=(0,N.create)("g");(0,N.append)(e,l);var r=18,i=6,s=11,c=Av(t,o,a),d=i+s,u=(0,N.create)("rect");(0,N.attr)(u,{x:-r/2,y:-i/2,width:r,height:i}),(0,N.classes)(u).add("djs-visual"),(0,N.append)(l,u);var p=(0,N.create)("rect");return(0,N.attr)(p,{x:-c/2,y:-d/2,width:c,height:d}),(0,N.classes)(p).add("djs-hit"),(0,N.append)(l,p),yy(l,a==="v"?90:0,0,0),l}function kd(e,t,o){var a=(0,N.create)("g"),l=jl(t,o),r=nn(t,o);return(0,N.append)(e,a),Vv(a,t,o,r),(0,N.classes)(a).add(xd),(0,N.classes)(a).add(r==="h"?"horizontal":"vertical"),zt(a,l.x,l.y),a}function fr(e){return Math.abs(Math.round(e*2/3))}function Nv(e,t){return wd(e,Pv(e,t))}function Av(e,t,o){var a=t.x-e.x,l=t.y-e.y;return fr(o==="h"?a:l)}function Pv(e,t){for(var o=t.waypoints,a=1/0,l,r=0;r<o.length-1;r++){var i=o[r],s=o[r+1],c=Tv(e,[i,s]);c<a&&(a=c,l=r)}return[o[l],o[l+1]]}function pr(e){return CSS.escape(e)}function Sd(e,t,o,a,l){function r(v,C,R){var b=v.index,k=v.point,B,_,V,T,F,L;return b<=0||v.bendpoint?!1:(B=C[b-1],_=C[b],V=jl(B,_),T=nn(B,_),F=Math.abs(k.x-V.x),L=Math.abs(k.y-V.y),T&&F<=R&&L<=R)}function i(v,C){var R=v.waypoints,b,k,B,_;return C.index<=0||C.bendpoint||(b={start:R[C.index-1],end:R[C.index]},k=nn(b.start,b.end),!k)?null:(k==="h"?B=b.end.x-b.start.x:B=b.end.y-b.start.y,_=fr(B)/2,_)}function s(v,C){var R=C.waypoints,b=dr(t,R,v),k;if(b)return k=i(C,b),r(b,R,k)?l.start(v,C,b.index):a.start(v,C,b.index,!b.bendpoint),!0}function c(v,C,R){W.event.bind(v,C,function(b){o.triggerMouseEvent(C,b,R),b.stopPropagation()})}function d(v,C){var R=t.getLayer("overlays"),b=(0,W.query)('.djs-bendpoints[data-element-id="'+pr(v.id)+'"]',R);return!b&&C&&(b=(0,N.create)("g"),(0,N.attr)(b,{"data-element-id":v.id}),(0,N.classes)(b).add("djs-bendpoints"),(0,N.append)(R,b),c(b,"mousedown",v),c(b,"click",v),c(b,"dblclick",v)),b}function u(v,C){return(0,W.query)('.djs-segment-dragger[data-segment-idx="'+v+'"]',C)}function p(v,C){C.waypoints.forEach(function(R,b){var k=ur(v);(0,N.append)(v,k),zt(k,R.x,R.y)}),ur(v,"floating")}function f(v,C){for(var R=C.waypoints,b,k,B,_=1;_<R.length;_++)b=R[_-1],k=R[_],nn(b,k)&&(B=kd(v,b,k),(0,N.attr)(B,{"data-segment-idx":_}),c(B,"mousemove",C))}function h(v){(0,S.forEach)((0,W.queryAll)("."+Cd,v),function(C){(0,N.remove)(C)})}function g(v){(0,S.forEach)((0,W.queryAll)("."+xd,v),function(C){(0,N.remove)(C)})}function m(v){var C=d(v);return C||(C=d(v,!0),p(C,v),f(C,v)),C}function y(v){var C=d(v);C&&(g(C),h(C),f(C,v),p(C,v))}function w(v,C){var R=(0,W.query)(".floating",v),b=C.point;R&&zt(R,b.x,b.y)}function x(v,C,R){var b=u(C.index,v),k=R[C.index-1],B=R[C.index],_=C.point,V=jl(k,B),T=nn(k,B),F,L;b&&(F=jv(b),L={x:_.x-V.x,y:_.y-V.y},T==="v"&&(L={x:L.y,y:L.x}),zt(F,L.x,L.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var C=d(v.element);C&&(0,N.remove)(C)}),e.on("element.marker.update",function(v){var C=v.element,R;C.waypoints&&(R=m(C),v.add?(0,N.classes)(R).add(v.marker):(0,N.classes)(R).remove(v.marker))}),e.on("element.mousemove",function(v){var C=v.element,R=C.waypoints,b,k;if(R){if(b=d(C,!0),k=dr(t,R,v.originalEvent),!k)return;w(b,k),k.bendpoint||x(b,k,R)}}),e.on("element.mousedown",function(v){if(en(v)){var C=v.originalEvent,R=v.element;if(R.waypoints)return s(C,R)}}),e.on("selection.changed",function(v){var C=v.newSelection[0];C&&C.waypoints&&m(C)}),e.on("element.hover",function(v){var C=v.element;C.waypoints&&(m(C),o.registerEvent(v.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(v){o.unregisterEvent(v.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(v){var C=v.element,R=v.newId;if(C.waypoints){var b=d(C);b&&(0,N.attr)(b,{"data-element-id":R})}}),this.addHandles=m,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}Sd.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function jv(e){return(0,W.query)(".djs-visual",e)}var Ed=Math.round,Mn="reconnectStart",Vn="reconnectEnd",Vo="updateWaypoints";function hr(e,t,o,a,l,r){this._injector=e,this.start=function(i,s,c,d){var u=o.getGraphics(s),p=s.source,f=s.target,h=s.waypoints,g;!d&&c===0?g=Mn:!d&&c===h.length-1?g=Vn:g=Vo;var m=g===Vo?"connection.updateWaypoints":"connection.reconnect",y=l.allowed(m,{connection:s,source:p,target:f});y===!1&&(y=l.allowed(m,{connection:s,source:f,target:p})),y!==!1&&a.init(i,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:d,type:g}}})},t.on("bendpoint.move.hover",function(i){var s=i.context,c=s.connection,d=c.source,u=c.target,p=i.hover,f=s.type;s.hover=p;var h;if(p){var g=f===Vo?"connection.updateWaypoints":"connection.reconnect";if(h=s.allowed=l.allowed(g,{connection:c,source:f===Mn?p:d,target:f===Vn?p:u}),h){s.source=f===Mn?p:d,s.target=f===Vn?p:u;return}h===!1&&(h=s.allowed=l.allowed(g,{connection:c,source:f===Vn?p:u,target:f===Mn?p:d})),h&&(s.source=f===Vn?p:u,s.target=f===Mn?p:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(i){var s=i.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Vo&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(i){var s=i.context,c=s.allowed,d=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),h=s.source,g=s.target,m=s.type,y=s.hints||{},w={x:Ed(i.x),y:Ed(i.y)};if(!c)return!1;m===Vo?(p?f.splice(d,0,w):f[d]=w,y.bendpointMove={insert:p,bendpointIndex:d},f=this.cropWaypoints(u,f),r.updateWaypoints(u,Dy(f),y)):(m===Mn?(y.docking="source",Na(s)&&(y.docking="target",y.newWaypoints=f.reverse())):m===Vn&&(y.docking="target",Na(s)&&(y.docking="source",y.newWaypoints=f.reverse())),r.reconnect(u,h,g,w,y))},this)}hr.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],hr.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Na(e){var t=e.hover,o=e.source,a=e.target,l=e.type;if(l===Mn)return t&&a&&t===a&&o!==a;if(l===Vn)return t&&o&&t===o&&o!==a}var Ov="reconnectStart",Iv="reconnectEnd",Bd="updateWaypoints",No="connect-ok",Aa="connect-not-ok",Rd="connect-hover",_d="djs-updating",Td="djs-dragging",Md=1100;function Vd(e,t,o,a){this._injector=t;var l=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(r){var i=r.context,s=i.bendpointIndex,c=i.connection,d=i.insert,u=c.waypoints,p=u.slice();i.waypoints=u,d&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p,(0,N.classes)(i.draggerGfx=ur(a.getLayer("overlays"))).add("djs-dragging"),a.addMarker(c,Td),a.addMarker(c,_d)}),o.on("bendpoint.move.hover",function(r){var i=r.context,s=i.allowed,c=i.hover,d=i.type;if(c){if(a.addMarker(c,Rd),d===Bd)return;s?(a.removeMarker(c,Aa),a.addMarker(c,No)):s===!1&&(a.removeMarker(c,No),a.addMarker(c,Aa))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],Md,function(r){var i=r.context,s=i.hover,c=i.target;s&&(a.removeMarker(s,Rd),a.removeMarker(s,c?No:Aa))}),o.on("bendpoint.move.move",function(r){var i=r.context,s=i.allowed,c=i.bendpointIndex,d=i.draggerGfx,u=i.hover,p=i.type,f=i.connection,h=f.source,g=f.target,m=f.waypoints.slice(),y={x:r.x,y:r.y},w=i.hints||{},x={};l&&(w.connectionStart&&(x.connectionStart=w.connectionStart),w.connectionEnd&&(x.connectionEnd=w.connectionEnd),p===Ov?Na(i)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||h,m=m.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||h,x.target=g):p===Iv?Na(i)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=h,m=m.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=h,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,m[c]=y),p===Bd&&(m=e.cropWaypoints(f,m)),x.waypoints=m,l.drawPreview(i,s,x)),zt(d,r.x,r.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],Md,function(r){var i=r.context,s=i.connection,c=i.draggerGfx,d=i.hover,u=i.target;s.waypoints=i.waypoints,(0,N.remove)(c),a.removeMarker(s,_d),a.removeMarker(s,Td),d&&(a.removeMarker(d,No),a.removeMarker(d,u?No:Aa)),l&&l.cleanUp(i)})}Vd.$inject=["bendpointMove","injector","eventBus","canvas"];var Nd="connect-hover",Ad="djs-updating";function Pd(e,t,o){return gr(e,t,e[t]+o)}function gr(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function zv(e,t,o,a){var l=Math.max(t[a],o[a]),r=Math.min(t[a],o[a]),i=20;return gr(t,a,Math.min(Math.max(r+i,e[a]),l-i))}function jd(e){return e==="x"?"y":"x"}function Od(e,t,o){var a,l;return e.original?e.original:(a=qe(t),l=jd(o),gr(e,l,a[l]))}function Id(e,t,o,a,l,r){var i=e.get("connectionDocking",!1);this.start=function(p,f,h){var g,m=o.getGraphics(f),y=h-1,w=h,x=f.waypoints,v=x[y],C=x[w],R=dr(o,x,p),b=nn(v,C),k,B;b&&(k=b==="v"?"x":"y",y===0&&(v=Od(v,f.source,k)),w===x.length-1&&(C=Od(C,f.target,k)),R?B=R.point:B={x:(v.x+C.x)/2,y:(v.y+C.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:w,segmentStart:v,segmentEnd:C,axis:k,dragPosition:B},a.init(p,B,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:g}}))};function s(p,f){if(!i)return f;var h=p.waypoints,g;return p.waypoints=f,g=i.getCroppedWaypoints(p),p.waypoints=h,g}function c(p){l.update("connection",p.connection,p.connectionGfx)}function d(p,f,h){var g=p.newWaypoints,m=g[p.segmentStartIndex+f],y=g[p.segmentEndIndex+f],w=zv(h,m,y,jd(p.axis));zt(p.draggerGfx,w.x,w.y)}function u(p,f){var h=0;return{waypoints:p.filter(function(g,m){return Pl(p[m-1],p[m+1],g)?(h=m<=f?h-1:h,!1):!0}),segmentOffset:h}}t.on("connectionSegment.move.start",function(p){var f=p.context,h=p.connection,g=o.getLayer("overlays");f.originalWaypoints=h.waypoints.slice(),f.draggerGfx=kd(g,f.segmentStart,f.segmentEnd),(0,N.classes)(f.draggerGfx).add("djs-dragging"),o.addMarker(h,Ad)}),t.on("connectionSegment.move.move",function(p){var f=p.context,h=f.connection,g=f.segmentStartIndex,m=f.segmentEndIndex,y=f.segmentStart,w=f.segmentEnd,x=f.axis,v=f.originalWaypoints.slice(),C=Pd(y,x,p["d"+x]),R=Pd(w,x,p["d"+x]),b=v.length,k=0;v[g]=C,v[m]=R;var B,_;g<2&&(B=rn(h.source,C),g===1?B==="intersect"&&(v.shift(),v[0]=C,k--):B!=="intersect"&&(v.unshift(y),k++)),m>b-3&&(_=rn(h.target,R),m===b-2?_==="intersect"&&(v.pop(),v[v.length-1]=R):_!=="intersect"&&v.push(w)),f.newWaypoints=h.waypoints=s(h,v),d(f,k,p),f.newSegmentStartIndex=g+k,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,o.addMarker(p.hover,Nd)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&o.removeMarker(f,Nd)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,h=f.connection;f.draggerGfx&&(0,N.remove)(f.draggerGfx),o.removeMarker(h,Ad)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,h=f.connection;h.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,h=f.connection,g=f.newWaypoints,m=f.newSegmentStartIndex;g=g.map(function(R){return{original:R.original,x:Math.round(R.x),y:Math.round(R.y)}});var y=u(g,m),w=y.waypoints,x=s(h,w),v=y.segmentOffset,C={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+v}};r.updateWaypoints(h,x,C)})}Id.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Lv=Math.abs,zd=Math.round;function Hv(e,t,o){o=o===void 0?10:o;var a,l;for(a=0;a<t.length;a++)if(l=t[a],Lv(l-e)<=o)return l}function Dv(e){return{x:e.x,y:e.y}}function Fv(e){return{x:e.x+e.width,y:e.y+e.height}}function oo(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:zd(e.x+e.width/2),y:zd(e.y+e.height/2)}}function Pa(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function Xt(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,l=e[t],r=e.snapped=e.snapped||{};return o===!1?r[t]=!1:(r[t]=!0,a=o-l,e[t]+=a,e["d"+t]+=a),l}function Ld(e){return e.children||[]}var $v=Math.abs,Hd=Math.round,mr=10;function Dd(e){function t(r,i){if((0,S.isArray)(r)){for(var s=r.length;s--;)if($v(r[s]-i)<=mr)return r[s]}else{r=+r;var c=i%r;if(c<mr)return i-c;if(c>r-mr)return i-c+r}return i}function o(r,i){if(r.waypoints)return Nv(i,r);if(r.width)return{x:Hd(r.width/2+r.x),y:Hd(r.height/2+r.y)}}function a(r){var i=r.context,s=i.snapPoints,c=i.connection,d=c.waypoints,u=i.segmentStart,p=i.segmentStartIndex,f=i.segmentEnd,h=i.segmentEndIndex,g=i.axis;if(s)return s;var m=[d[p-1],u,f,d[h+1]];return p<2&&m.unshift(o(c.source,r)),h>d.length-3&&m.unshift(o(c.target,r)),i.snapPoints=s={horizontal:[],vertical:[]},(0,S.forEach)(m,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var i=a(r),s=r.x,c=r.y,d,u;if(i){d=t(i.vertical,s),u=t(i.horizontal,c);var p=s-d,f=c-u;(0,S.assign)(r,{dx:r.dx-p,dy:r.dy-f,x:d,y:u}),(p||i.vertical.indexOf(s)!==-1)&&Xt(r,"x",d),(f||i.horizontal.indexOf(c)!==-1)&&Xt(r,"y",u)}});function l(r){var i=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(i)return i;var d=[s[c-1],s[c+1]];return r.snapPoints=i={horizontal:[],vertical:[]},(0,S.forEach)(d,function(u){u&&(u=u.original||u,i.horizontal.push(u.y),i.vertical.push(u.x))}),i}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var i=r.context.hover,s=i&&o(i,r);!vt(i)||!s||!s.x||!s.y||(Xt(r,"x",s.x),Xt(r,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var i=r.context,s=l(i),c=i.hover,d=c&&o(c,r),u=r.x,p=r.y,f,h;if(s){f=t(d?s.vertical.concat([d.x]):s.vertical,u),h=t(d?s.horizontal.concat([d.y]):s.horizontal,p);var g=u-f,m=p-h;(0,S.assign)(r,{dx:r.dx-g,dy:r.dy-m,x:r.x-g,y:r.y-m}),(g||s.vertical.indexOf(u)!==-1)&&Xt(r,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Xt(r,"y",h)}})}Dd.$inject=["eventBus"];var Wv={__depends__:[kn,Zn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Sd],bendpointMove:["type",hr],bendpointMovePreview:["type",Vd],connectionSegmentMove:["type",Id],bendpointSnapping:["type",Dd]},Uv="djs-dragger";function Zt(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Zt.$inject=["injector","canvas","graphicsFactory","elementFactory"],Zt.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,l=e.getConnection,r=o.source,i=o.target,s=o.waypoints,c=o.connectionStart,d=o.connectionEnd,u=o.noLayout,p=o.noCropping,f=o.noNoop,h,g=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),(0,N.clear)(a),l||(l=e.getConnection=Jv(function(m,y,w){return g.getConnection(m,y,w)})),t&&(h=l(t,r,i)),!h){!f&&this.drawNoopPreview(a,o);return}h.waypoints=s||[],this._layouter&&!u&&(h.waypoints=this._layouter.layoutConnection(h,{source:r,target:i,connectionStart:c,connectionEnd:d,waypoints:o.waypoints||h.waypoints})),(!h.waypoints||!h.waypoints.length)&&(h.waypoints=[r?qe(r):c,i?qe(i):d]),this._connectionDocking&&(r||i)&&!p&&(h.waypoints=this._connectionDocking.getCroppedWaypoints(h,r,i)),this._graphicsFactory.drawConnection(a,h,{stroke:"var(--element-dragger-color)"})},Zt.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,l=t.connectionStart||qe(o),r=t.connectionEnd||qe(a),i=this.cropWaypoints(l,r,o,a);(0,N.append)(e,this.createNoopConnection(i[0],i[1]))},Zt.prototype.cropWaypoints=function(e,t,o,a){var l=this._graphicsFactory,r=o&&l.getShapePath(o),i=a&&l.getShapePath(a),s=l.getConnectionPath({waypoints:[e,t]});return e=o&&zl(r,s,!0)||e,t=a&&zl(i,s,!1)||t,[e,t]},Zt.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&(0,N.remove)(e.connectionPreviewGfx)},Zt.prototype.getConnection=function(e){var t=Yv(e);return this._elementFactory.createConnection(t)},Zt.prototype.createConnectionPreviewGfx=function(){var e=(0,N.create)("g");return(0,N.attr)(e,{pointerEvents:"none"}),(0,N.classes)(e).add(Uv),(0,N.append)(this._canvas.getActiveLayer(),e),e},Zt.prototype.createNoopConnection=function(e,t){return Rl([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Jv(e){var t={};return function(o){var a=JSON.stringify(o),l=t[a];return l||(l=t[a]=e.apply(null,arguments)),l}}function Yv(e){return(0,S.isObject)(e)?e:{}}var Kv={__init__:["connectionPreview"],connectionPreview:["type",Zt]},Gv=new da("ov"),qv=500;function it(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=Gv,this._overlayDefaults=(0,S.assign)({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Xv(o.getContainer()),this._init()}it.$inject=["config.overlays","eventBus","canvas","elementRegistry"],it.prototype.get=function(e){if((0,S.isString)(e)&&(e={id:e}),(0,S.isString)(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?(0,S.filter)(t.overlays,(0,S.matchPattern)({type:e.type})):t.overlays.slice():[]}else return e.type?(0,S.filter)(this._overlays,(0,S.matchPattern)({type:e.type})):e.id?this._overlays[e.id]:null},it.prototype.add=function(e,t,o){if((0,S.isObject)(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=(0,S.assign)({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},it.prototype.remove=function(e){var t=this.get(e)||[];(0,S.isArray)(t)||(t=[t]);var o=this;(0,S.forEach)(t,function(a){var l=o._getOverlayContainer(a.element,!0);if(a&&((0,W.remove)(a.html),(0,W.remove)(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),l){var r=l.overlays.indexOf(a);r!==-1&&l.overlays.splice(r,1)}})},it.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},it.prototype.show=function(){ja(this._overlayRoot)},it.prototype.hide=function(){ja(this._overlayRoot,!1)},it.prototype.clear=function(){this._overlays={},this._overlayContainers=[],(0,W.clear)(this._overlayRoot)},it.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,l=t.y;if(t.waypoints){var r=It(t);a=r.x,l=r.y}Fd(o,a,l),(0,W.attr)(e.html,"data-container-id",t.id)},it.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,l=t.left,r=t.top;if(t.right!==void 0){var i;a.waypoints?i=It(a).width:i=a.width,l=t.right*-1+i}if(t.bottom!==void 0){var s;a.waypoints?s=It(a).height:s=a.height,r=t.bottom*-1+s}Fd(o,l||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},it.prototype._createOverlayContainer=function(e){var t=(0,W.domify)('<div class="djs-overlays" />');(0,W.assignStyle)(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},it.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";$d(this._overlayRoot,o)},it.prototype._getOverlayContainer=function(e,t){var o=(0,S.find)(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},it.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,l,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),(0,S.isString)(a)&&(a=(0,W.domify)(a)),r=this._getOverlayContainer(o),l=(0,W.domify)('<div class="djs-overlay" data-overlay-id="'+t+'">'),(0,W.assignStyle)(l,{position:"absolute"}),l.appendChild(a),e.type&&(0,W.classes)(l).add("djs-overlay-"+e.type);var i=this._canvas.findRoot(o),s=this._canvas.getRootElement();ja(l,i===s),e.htmlContainer=l,r.overlays.push(e),r.html.appendChild(l),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},it.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),l=o&&o.minZoom,r=o&&o.maxZoom,i=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(a!==s||o&&((0,S.isDefined)(l)&&l>t.scale||(0,S.isDefined)(r)&&r<t.scale))&&(c=!1),ja(i,c),this._updateOverlayScale(e,t)},it.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,l,r=e.htmlContainer,i,s="";o!==!0&&(o===!1?(a=1,l=1):(a=o.min,l=o.max),(0,S.isDefined)(a)&&t.scale<a&&(i=(1/t.scale||1)*a),(0,S.isDefined)(l)&&t.scale>l&&(i=(1/t.scale||1)*l)),(0,S.isDefined)(i)&&(s="scale("+i+","+i+")"),$d(r,s)},it.prototype._updateOverlaysVisibilty=function(e){var t=this;(0,S.forEach)(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},it.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var l=a.element;(0,S.forEach)(t.get({element:l}),function(s){t.remove(s.id)});var r=t._getOverlayContainer(l);if(r){(0,W.remove)(r.html);var i=t._overlayContainers.indexOf(r);i!==-1&&t._overlayContainers.splice(i,1)}}),e.on("element.changed",qv,function(a){var l=a.element,r=t._getOverlayContainer(l,!0);r&&((0,S.forEach)(r.overlays,function(i){t._updateOverlay(i)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(a){var l=t._getOverlayContainer(a.element,!0);l&&(0,W.classes)(l.html)[a.add?"add":"remove"](a.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function Xv(e){var t=(0,W.domify)('<div class="djs-overlay-container" />');return(0,W.assignStyle)(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Fd(e,t,o){(0,W.assignStyle)(e,{left:t+"px",top:o+"px"})}function ja(e,t){e.style.display=t===!1?"none":""}function $d(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}var Zv={__init__:["overlays"],overlays:["type",it]},Qv=new da;function ao(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ao.$inject=["eventBus"],ao.prototype.schedule=function(e,t=Qv.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},ao.prototype._schedule=function(e,t){const o=ew();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(a){o.reject(a)}}catch(a){console.error("Scheduler#_schedule execution failed",a)}}),promise:o.promise}},ao.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ao.prototype._cancel=function(e){clearTimeout(e.executionId)};function ew(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}var tw={scheduler:["type",ao]},nw="djs-element-hidden",Oa=".entry",ow=1e3,Wd=8,aw=300;function et(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}et.$inject=["canvas","elementRegistry","eventBus","scheduler"],et.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var l=a.target,r=(0,S.isArray)(l)?l:[l];if(r.filter(function(s){return o.includes(s)}).length){e.close();var i=r.filter(function(s){return e._elementRegistry.get(s.id)});i.length&&e._updateAndOpen(i.length>1?i:i[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current;((0,S.isArray)(a.target)?a.target:[a.target]).includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},et.prototype._createContainer=function(){var e=(0,W.domify)('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},et.prototype.registerProvider=function(e,t){t||(t=e,e=ow),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},et.prototype.getEntries=function(e){var t=this._getProviders(),o=(0,S.isArray)(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return(0,S.forEach)(t,function(l){if((0,S.isFunction)(l[o])){var r=l[o](e);(0,S.isFunction)(r)?a=r(a):(0,S.forEach)(r,function(i,s){a[s]=i})}}),a},et.prototype.trigger=function(e,t,o){var a=this,l,r,i=t.delegateTarget||t.target;if(!i)return t.preventDefault();if(l=(0,W.attr)(i,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(l,"hover",r,o)},aw);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(l,e,r,o)},et.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var l=this._current.target,r=this._current.entries[e];if(r){var i=r.action;if(this._eventBus.fire("contextPad.trigger",{entry:r,event:o})!==!1){if((0,S.isFunction)(i)){if(t==="click")return i(o,l,a)}else if(i[t])return i[t](o,l,a);o.preventDefault()}}}},et.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},et.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},et.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;(0,S.forEach)(t,function(l,r){var i=l.group||"default",s=(0,W.domify)(l.html||'<div class="entry" draggable="true"></div>'),c;(0,W.attr)(s,"data-action",r),c=(0,W.query)("[data-group="+pr(i)+"]",o),c||(c=(0,W.domify)('<div class="group"></div>'),(0,W.attr)(c,"data-group",i),o.appendChild(c)),c.appendChild(s),l.className&&lw(s,l.className),l.title&&(0,W.attr)(s,"title",l.title),l.imageUrl&&(a=(0,W.domify)("<img>"),(0,W.attr)(a,"src",l.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),(0,W.classes)(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},et.prototype._createHtml=function(e){var t=this,o=(0,W.domify)('<div class="djs-context-pad"></div>');return W.delegate.bind(o,Oa,"click",function(a){t.trigger("click",a)}),W.delegate.bind(o,Oa,"dragstart",function(a){t.trigger("dragstart",a)}),W.delegate.bind(o,Oa,"mouseover",function(a){t.trigger("mouseover",a)}),W.delegate.bind(o,Oa,"mouseout",function(a){t.trigger("mouseout",a)}),W.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},et.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&iw(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},et.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},et.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return(0,S.isArray)(e)!==(0,S.isArray)(o)?!1:(0,S.isArray)(e)?e.length===o.length&&(0,S.every)(e,function(a){return o.includes(a)}):o===e},et.prototype.isShown=function(){return this.isOpen()&&(0,W.classes)(this._current.html).has("open")},et.prototype.show=function(){this.isOpen()&&((0,W.classes)(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},et.prototype.hide=function(){this.isOpen()&&((0,W.classes)(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},et.prototype._getPosition=function(e){if(!(0,S.isArray)(e)&&vt(e)){var t=this._canvas.viewbox(),o=rw(e),a=o.x*t.scale-t.x*t.scale,l=o.y*t.scale-t.y*t.scale;return{left:a+Wd*this._canvas.zoom(),top:l}}var r=this._canvas.getContainer().getBoundingClientRect(),i=this._getTargetBounds(e);return{left:i.right-r.left+Wd*this._canvas.zoom(),top:i.top-r.top}},et.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},et.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target;((0,S.isArray)(o)?o:[o]).some(function(a){return t._canvas.hasMarker(a,nw)})?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},et.prototype._getTargetBounds=function(e){var t=this;return((0,S.isArray)(e)?e:[e]).map(function(o){return t._canvas.getGraphics(o)}).reduce(function(o,a){const l=a.getBoundingClientRect();return o.top=Math.min(o.top,l.top),o.right=Math.max(o.right,l.right),o.bottom=Math.max(o.bottom,l.bottom),o.left=Math.min(o.left,l.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function lw(e,t){var o=(0,W.classes)(e);t=(0,S.isArray)(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function rw(e){return e.waypoints[e.waypoints.length-1]}function iw(e,t){return e=(0,S.isArray)(e)?e:[e],t=(0,S.isArray)(t)?t:[t],e.length===t.length&&(0,S.every)(e,function(o){return t.includes(o)})}var sw={__depends__:[_l,tw,Zv],contextPad:["type",et]},cw=250;function Nn(e){this._eventBus=e,this._tools=[],this._active=null}Nn.$inject=["eventBus"],Nn.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},Nn.prototype.isActive=function(e){return e&&this._active===e},Nn.prototype.length=function(e){return this._tools.length},Nn.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Nn.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.on(t.tool+".init",function(l){if(!l.context.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),(0,S.forEach)(t,function(l){a.push(l+".ended"),a.push(l+".canceled")}),o.on(a,cw,function(l){this._active&&(dw(l)||this.setActive(null))},this)};function dw(e){var t=e.originalEvent&&e.originalEvent.target;return t&&(0,W.closest)(t,'.group[data-group="tools"]')}var yr={__depends__:[kn],__init__:["toolManager"],toolManager:["type",Nn]};function br(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){(t._svg=a.svg).addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}br.$inject=["eventBus"],br.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||uw(0,0)};function uw(e,t){var o=document.createEvent("MouseEvent"),a=e,l=t,r=e,i=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,l,r,i,!1,!1,!1,!1,0,null),o}var vr={__init__:["mouse"],mouse:["type",br]},wr=1500,Ud="grab";function lo(e,t,o,a,l,r){this._dragging=o,this._mouse=r;var i=this,s=a.get("keyboard",!1);l.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",wr,function(c){if(Ts(c))return i.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(wr,function(c){if(!(!Jd(c.keyEvent)||i.isActive())){var d=i._mouse.getLastMoveEvent();i.activateMove(d,!!d)}},"keyboard.keydown"),s&&s.addListener(wr,function(c){!Jd(c.keyEvent)||!i.isActive()||i.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var d=c.originalEvent.target;if(!c.hover&&!(d instanceof SVGElement))return!1;e.once("hand.ended",function(){i.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var d=t.viewbox().scale;t.scroll({dx:c.dx*d,dy:c.dy*d})}),e.on("hand.move.end",function(c){var d=c.context.reactivate;return!Ts(c)&&d&&e.once("hand.move.ended",function(u){i.activateHand(u.originalEvent,!0,!0)}),!1})}lo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],lo.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Ud,data:{context:o||{}}})},lo.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Ud,data:{context:{reactivate:o}}})},lo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},lo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Jd(e){return Ds("Space",e)}var fw={__depends__:[yr,vr],__init__:["handTool"],handTool:["type",lo]},Yd="crosshair";function An(e,t,o,a,l,r,i){this._selection=l,this._dragging=o,this._mouse=i;var s=this,c={create:function(d){var u=t.getActiveLayer(),p=d.frame=(0,N.create)("rect");(0,N.attr)(p,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),(0,N.append)(u,p)},update:function(d){var u=d.frame,p=d.bbox;(0,N.attr)(u,{x:p.x,y:p.y,width:p.width,height:p.height})},remove:function(d){d.frame&&(0,N.remove)(d.frame)}};r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(d){var u=d.originalEvent.target;!d.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(d.originalEvent,!0)})}),e.on("lasso.end",0,function(d){var u=d.context,p=Cr(d),f=a.filter(function(g){return g}),h=Sl(d);s.select(f,p,h?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=Cr(d),c.create(u),u.selection=l.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=Cr(d),c.update(u)}),e.on("lasso.cleanup",function(d){var u=d.context;c.remove(u)}),e.on("element.mousedown",1500,function(d){if(Sl(d))return s.activateLasso(d.originalEvent),!0})}An.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],An.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Yd,data:{context:{}}})},An.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Yd,data:{context:{}},keepSelection:!0})},An.prototype.select=function(e,t,o=[]){var a=uy(e,t);this._selection.select([...o,...(0,S.values)(a)])},An.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},An.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Cr(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}var pw={__depends__:[yr,vr],__init__:["lassoTool"],lassoTool:["type",An]},Kd="connect-ok",Gd="connect-not-ok";function ro(e,t,o,a,l,r,i){var s=this;this._dragging=t,this._rules=r,this._mouse=i,l.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var d=c.context,u=c.hover,p=d.canStartConnect=s.canStartConnect(u);p!==null&&(d.startTarget=u,a.addMarker(u,p?Kd:Gd))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var d=c.context.startTarget,u=c.context.canStartConnect;d&&a.removeMarker(d,u?Kd:Gd)}),e.on(["global-connect.ended"],function(c){var d=c.context.startTarget,u={x:c.x,y:c.y};if(s.canStartConnect(d))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,d,u)}),!1})}ro.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ro.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ro.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ro.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ro.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var hw={__depends__:[Hl,Zn,kn,yr,vr],globalConnect:["type",ro]},gw=500,mw=1e3;function Pn(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function l(r){var i=(0,N.create)("rect");return(0,N.attr)(i,(0,S.assign)({x:0,y:0,rx:4,width:100,height:100},o)),i}e.on(["shape.added","shape.changed"],gw,function(r){var i=r.element,s=r.gfx,c=(0,W.query)(".djs-outline",s);c||(c=a.getOutline(i)||l(s),(0,N.append)(s,c)),a.updateShapeOutline(c,i)}),e.on(["connection.added","connection.changed"],function(r){var i=r.element,s=r.gfx,c=(0,W.query)(".djs-outline",s);c||(c=l(s),(0,N.append)(s,c)),a.updateConnectionOutline(c,i)})}Pn.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&(0,S.forEach)(a,function(l){o=o||l.updateOutline(t,e)}),o||(0,N.attr)(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},Pn.prototype.updateConnectionOutline=function(e,t){var o=It(t);(0,N.attr)(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},Pn.prototype.registerProvider=function(e,t){t||(t=e,e=mw),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},Pn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Pn.prototype.getOutline=function(e){var t;return(0,S.forEach)(this._getProviders(),function(o){(0,S.isFunction)(o.getOutline)&&(t=t||o.getOutline(e))}),t},Pn.$inject=["eventBus","styles","elementRegistry"];var Ia=6;function xr(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(l){o.isSelected(l.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(l){var r=l.newSelection;a._updateMultiSelectionOutline(r)})}xr.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");(0,N.clear)(t);var o=e.length>1;if((0,N.classes)(this._canvas.getContainer())[o?"add":"remove"]("djs-multi-select"),!!o){var a=yw(It(e)),l=(0,N.create)("rect");(0,N.attr)(l,(0,S.assign)({rx:3},a)),(0,N.classes)(l).add("djs-selection-outline"),(0,N.append)(t,l)}},xr.$inject=["eventBus","canvas","selection"];function yw(e){return{x:e.x-Ia,y:e.y-Ia,width:e.width+Ia*2,height:e.height+Ia*2}}var qd={__depends__:[Gn],__init__:["outline","multiSelectionOutline"],outline:["type",Pn],multiSelectionOutline:["type",xr]},bw=500,vw=1250,ww=1500,za=Math.round;function Cw(e){return{x:e.x+za(e.width/2),y:e.y+za(e.height/2)}}function Xd(e,t,o,a,l){function r(s,c,d,u){return l.allowed("elements.move",{shapes:s,delta:c,position:d,target:u})}e.on("shape.move.start",ww,function(s){var c=s.context,d=s.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=xw(u),(0,S.assign)(c,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",vw,function(s){var c=s.context,d=c.validatedShapes;if(!(c.canExecute=r(d)))return!1}),e.on("shape.move.move",bw,function(s){var c=s.context,d=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f=r(d,p,{x:s.x,y:s.y},u);if(c.delta=p,c.canExecute=f,f===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,d=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;d.x=za(d.x),d.y=za(d.y),!(d.x===0&&d.y===0)&&o.moveElements(f,d,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(en(s)){var c=Jn(s);if(!c)throw new Error("must supply DOM mousedown event");return i(c,s.element)}});function i(s,c,d,u){if((0,S.isObject)(d)&&(u=d,d=!1),!(c.waypoints||!c.parent)&&!(0,N.classes)(s.target).has("djs-hit-no-move")){var p=Cw(c);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:c,context:u||{}}}),!0}}this.start=i}Xd.$inject=["eventBus","dragging","modeling","selection","rules"];function xw(e){var t=(0,S.groupBy)(e,"id");return(0,S.filter)(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var Zd=499,kr="djs-dragging",Qd="drop-ok",eu="drop-not-ok",tu="new-parent",nu="attach-ok";function ou(e,t,o,a){function l(c){return kw(r(c))}function r(c){var d=cy(c,!0),u=d.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=d.concat(u);return[...new Set(p)]}function i(c,d){[nu,Qd,eu,tu].forEach(function(u){u===d?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,d,u){a.addDragger(d,c.dragGroup),u&&t.addMarker(d,kr),c.allDraggedElements?c.allDraggedElements.push(d):c.allDraggedElements=[d]}e.on("shape.move.start",Zd,function(c){var d=c.context,u=d.shapes,p=d.allDraggedElements,f=l(u);if(!d.dragGroup){var h=(0,N.create)("g");(0,N.attr)(h,o.cls("djs-drag-group",["no-events"])),(0,N.append)(t.getActiveLayer(),h),d.dragGroup=h}f.forEach(function(g){a.addDragger(g,d.dragGroup)}),p?p=(0,S.flatten)([p,r(u)]):p=r(u),(0,S.forEach)(p,function(g){t.addMarker(g,kr)}),d.allDraggedElements=p,d.differentParents=Sw(u)}),e.on("shape.move.move",Zd,function(c){var d=c.context,u=d.dragGroup,p=d.target,f=d.shape.parent,h=d.canExecute;p&&(h==="attach"?i(p,nu):d.canExecute&&f&&p.id!==f.id?i(p,tu):i(p,d.canExecute?Qd:eu)),zt(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var d=c.context.target;d&&i(d,null)}),e.on("shape.move.cleanup",function(c){var d=c.context,u=d.allDraggedElements,p=d.dragGroup;(0,S.forEach)(u,function(f){t.removeMarker(f,kr)}),p&&(0,N.remove)(p)}),this.makeDraggable=s}ou.$inject=["eventBus","canvas","styles","previewSupport"];function kw(e){return(0,S.filter)(e,function(t){return vt(t)?(0,S.find)(e,(0,S.matchPattern)({id:t.source.id}))&&(0,S.find)(e,(0,S.matchPattern)({id:t.target.id})):!0})}function Sw(e){return(0,S.size)((0,S.groupBy)(e,function(t){return t.parent&&t.parent.id}))!==1}var Ew={__depends__:[_l,Gn,qd,Zn,kn,Vl],__init__:["move","movePreview"],move:["type",Xd],movePreview:["type",ou]},au=".djs-palette-toggle",lu=".entry",Bw=au+", "+lu,Sr="djs-palette-",Rw="shown",Er="open",ru="two-column",_w=1e3;function tt(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var l=a.tool;o.updateToolHighlight(l)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}tt.$inject=["eventBus","canvas"],tt.prototype.registerProvider=function(e,t){t||(t=e,e=_w),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},tt.prototype.getEntries=function(){return this._getProviders().reduce(Mw,{})},tt.prototype._rebuild=function(){this._diagramInitialized&&this._getProviders().length&&(this._container||this._init(),this._update())},tt.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=(0,W.domify)(tt.HTML_MARKUP);o.appendChild(a),(0,W.classes)(o).add(Sr+Rw),W.delegate.bind(a,Bw,"click",function(l){var r=l.delegateTarget;if((0,W.matches)(r,au))return e.toggle();e.trigger("click",l)}),W.event.bind(a,"mousedown",function(l){l.stopPropagation()}),W.delegate.bind(a,lu,"dragstart",function(l){e.trigger("dragstart",l)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},tt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},tt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,l,r=(0,W.classes)(o),i=(0,W.classes)(t);"twoColumn"in e?l=e.twoColumn:l=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(ru,l),i.toggle(Sr+ru,l),"open"in e&&(r.toggle(Er,e.open),i.toggle(Sr+Er,e.open)),a.fire("palette.changed",{twoColumn:l,open:this.isOpen()})},tt.prototype._update=function(){var e=(0,W.query)(".djs-palette-entries",this._container),t=this._entries=this.getEntries();(0,W.clear)(e),(0,S.forEach)(t,function(o,a){var l=o.group||"default",r=(0,W.query)("[data-group="+pr(l)+"]",e);r||(r=(0,W.domify)('<div class="group"></div>'),(0,W.attr)(r,"data-group",l),e.appendChild(r));var i=(0,W.domify)(o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'));if(r.appendChild(i),!o.separator&&((0,W.attr)(i,"data-action",a),o.title&&(0,W.attr)(i,"title",o.title),o.className&&Tw(i,o.className),o.imageUrl)){var s=(0,W.domify)("<img>");(0,W.attr)(s,"src",o.imageUrl),i.appendChild(s)}}),this.open()},tt.prototype.trigger=function(e,t,o){var a,l,r=t.delegateTarget||t.target;return r?(a=(0,W.attr)(r,"data-action"),l=t.originalEvent||t,this.triggerEntry(a,e,l,o)):t.preventDefault()},tt.prototype.triggerEntry=function(e,t,o,a){var l=this._entries[e],r;if(l&&(r=l.action,this._eventBus.fire("palette.trigger",{entry:l,event:o})!==!1)){if((0,S.isFunction)(r)){if(t==="click")return r(o,a)}else if(r[t])return r[t](o,a);o.preventDefault()}},tt.prototype._layoutChanged=function(){this._toggleState({})},tt.prototype._needsCollapse=function(e,t){return e<Object.keys(t).length*46+50},tt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},tt.prototype.open=function(){this._toggleState({open:!0})},tt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},tt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},tt.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=(0,W.query)(".djs-palette-entries",this._container),this._toolsContainer=(0,W.query)("[data-group=tools]",t)),o=this._toolsContainer,(0,S.forEach)(o.children,function(a){var l=a.getAttribute("data-action");if(l){var r=(0,W.classes)(a);l=l.replace("-tool",""),r.contains("entry")&&l===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},tt.prototype.isOpen=function(){return(0,W.classes)(this._container).has(Er)},tt.prototype._getParentContainer=function(){return this._canvas.getContainer()},tt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Tw(e,t){var o=(0,W.classes)(e);((0,S.isArray)(t)?t:t.split(/\s+/g)).forEach(function(a){o.add(a)})}function Mw(e,t){var o=t.getPaletteEntries();return(0,S.isFunction)(o)?o(e):((0,S.forEach)(o,function(a,l){e[l]=a}),e)}var Vw={__init__:["palette"],palette:["type",tt]};function iu(e,t,o,a){e.on("element.changed",function(l){var r=l.element;(r.parent||r===t.getRootElement())&&(l.gfx=o.getGraphics(r)),l.gfx&&e.fire(fy(r)+".changed",l)}),e.on("elements.changed",function(l){var r=l.elements;r.forEach(function(i){e.fire("element.changed",{element:i})}),a.updateContainments(r)}),e.on("shape.changed",function(l){a.update("shape",l.element,l.gfx)}),e.on("connection.changed",function(l){a.update("connection",l.element,l.gfx)})}iu.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Nw={__init__:["changeSupport"],changeSupport:["type",iu]},La=Math.max,Ha=Math.min,Aw=20;function Pw(e,t,o){var a=o.x,l=o.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+l,r.height=e.height-l):t.indexOf("s")!==-1&&(r.height=e.height+l),t.indexOf("e")!==-1?r.width=e.width+a:t.indexOf("w")!==-1&&(r.x=e.x+a,r.width=e.width-a),r}function Da(e,t,o){var a=t[e],l=o.min&&o.min[e],r=o.max&&o.max[e];return(0,S.isNumber)(l)&&(a=(/top|left/.test(e)?Ha:La)(a,l)),(0,S.isNumber)(r)&&(a=(/top|left/.test(e)?La:Ha)(a,r)),a}function jw(e,t){if(!t)return e;var o=Oe(e);return hc({top:Da("top",o,t),right:Da("right",o,t),bottom:Da("bottom",o,t),left:Da("left",o,t)})}function Ow(e,t,o,a){var l=Oe(t),r={top:/n/.test(e)?l.bottom-o.height:l.top,left:/w/.test(e)?l.right-o.width:l.left,bottom:/s/.test(e)?l.top+o.height:l.bottom,right:/e/.test(e)?l.left+o.width:l.right},i=a?Oe(a):r;return hc({top:Ha(r.top,i.top),left:Ha(r.left,i.left),bottom:La(r.bottom,i.bottom),right:La(r.right,i.right)})}function Ao(e,t){return typeof e<"u"?e:Aw}function Iw(e,t){var o,a,l,r;return typeof t=="object"?(o=Ao(t.left),a=Ao(t.right),l=Ao(t.top),r=Ao(t.bottom)):o=a=l=r=Ao(t),{x:e.x-o,y:e.y-l,width:e.width+o+a,height:e.height+l+r}}function zw(e){return!(e.waypoints||e.type==="label")}function Lw(e,t){var o;if(e.length===void 0?o=(0,S.filter)(e.children,zw):o=e,o.length)return Iw(It(o),t)}var su=10;function Po(e,t,o,a){this._dragging=a,this._rules=t;var l=this;function r(c,d){var u=c.shape,p=c.direction,f=c.resizeConstraints,h;c.delta=d,h=Pw(u,p,d),c.newBounds=jw(h,f),c.canExecute=l.canResize(c)}function i(c){var d=c.resizeConstraints,u=c.minBounds;d===void 0&&(u===void 0&&(u=l.computeMinResizeBox(c)),c.resizeConstraints={min:Oe(u)})}function s(c){var d=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Iy(p),!Hw(d,p))return;o.resizeShape(d,p)}}e.on("resize.start",function(c){i(c.context)}),e.on("resize.move",function(c){var d={x:c.dx,y:c.dy};r(c.context,d)}),e.on("resize.end",function(c){s(c.context)})}Po.prototype.canResize=function(e){var t=this._rules,o=(0,S.pick)(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},Po.prototype.activate=function(e,t,o){var a=this._dragging,l,r;if(typeof o=="string"&&(o={direction:o}),l=(0,S.assign)({shape:t},o),r=l.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,cu(t,r),"resize",{autoActivate:!0,cursor:Dw(r),data:{shape:t,context:l}})},Po.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction;return Ow(o,t,e.minDimensions||{width:su,height:su},Lw(t,e.childrenBoxPadding))},Po.$inject=["eventBus","rules","modeling","dragging"];function Hw(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function cu(e,t){var o=qe(e),a=Oe(e),l={x:o.x,y:o.y};return t.indexOf("n")!==-1?l.y=a.top:t.indexOf("s")!==-1&&(l.y=a.bottom),t.indexOf("e")!==-1?l.x=a.right:t.indexOf("w")!==-1&&(l.x=a.left),l}function Dw(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var du="djs-resizing",uu="resize-not-ok",Fw=500;function fu(e,t,o){function a(r){var i=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=o.addFrame(i,t.getActiveLayer()),t.addMarker(i,du)),s.width>5&&(0,N.attr)(c,{x:s.x,width:s.width}),s.height>5&&(0,N.attr)(c,{y:s.y,height:s.height}),r.canExecute?(0,N.classes)(c).remove(uu):(0,N.classes)(c).add(uu)}function l(r){var i=r.shape;r.frame&&(0,N.remove)(r.frame),t.removeMarker(i,du)}e.on("resize.move",Fw,function(r){a(r.context)}),e.on("resize.cleanup",function(r){l(r.context)})}fu.$inject=["eventBus","canvas","previewSupport"];var Fa=-6,$a=8,Wa=20,jo="djs-resizer",$w=["n","w","s","e","nw","ne","se","sw"];function mn(e,t,o,a){this._resize=a,this._canvas=t;var l=this;e.on("selection.changed",function(r){var i=r.newSelection;l.removeResizers(),i.length===1&&(0,S.forEach)(i,(0,S.bind)(l.addResizer,l))}),e.on("shape.changed",function(r){var i=r.element;o.isSelected(i)&&(l.removeResizers(),l.addResizer(i))})}mn.prototype.makeDraggable=function(e,t,o){var a=this._resize;function l(r){en(r)&&a.activate(r,e,o)}W.event.bind(t,"mousedown",l),W.event.bind(t,"touchstart",l)},mn.prototype._createResizer=function(e,t,o,a){var l=this._getResizersParent(),r=Ww(a),i=(0,N.create)("g");(0,N.classes)(i).add(jo),(0,N.classes)(i).add(jo+"-"+e.id),(0,N.classes)(i).add(jo+"-"+a),(0,N.append)(l,i);var s=(0,N.create)("rect");(0,N.attr)(s,{x:-$a/2+r.x,y:-$a/2+r.y,width:$a,height:$a}),(0,N.classes)(s).add(jo+"-visual"),(0,N.append)(i,s);var c=(0,N.create)("rect");return(0,N.attr)(c,{x:-Wa/2+r.x,y:-Wa/2+r.y,width:Wa,height:Wa}),(0,N.classes)(c).add(jo+"-hit"),(0,N.append)(i,c),my(i,t,o),i},mn.prototype.createResizer=function(e,t){var o=cu(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},mn.prototype.addResizer=function(e){var t=this;vt(e)||!this._resize.canResize({shape:e})||(0,S.forEach)($w,function(o){t.createResizer(e,o)})},mn.prototype.removeResizers=function(){(0,N.clear)(this._getResizersParent())},mn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},mn.$inject=["eventBus","canvas","selection","resize"];function Ww(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Fa:e.indexOf("w")!==-1&&(t.x=Fa),e.indexOf("s")!==-1?t.y=-Fa:e.indexOf("n")!==-1&&(t.y=Fa),t}var Uw={__depends__:[Zn,kn,Vl],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Po],resizePreview:["type",fu],resizeHandles:["type",mn]};function Oo(e,t,o,a,l,r){this._canvas=t,this._modeling=a,this._textRenderer=r,o.registerProvider(this),e.on("element.dblclick",s=>{i(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{l.removeResizers()}),e.on("create.end",500,s=>{const{context:c,isTouch:d}=s,u=c.shape,{canExecute:p}=s.context;d||p&&(c.hints&&c.hints.createElementsBehavior===!1||i(u))}),e.on("autoPlace.end",500,s=>{i(s.shape)});function i(s,c){(c||tr(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&o.activate(s)}}Oo.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],Oo.prototype.activate=function(e){const t=Ea(e);if(t===void 0)return;const o={text:t};Ue(o,this.getEditingBBox(e));const a={};return(tr(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Ue(a,{centerVertically:!0}),nr(e)&&Ue(a,{autoResize:!0}),Ue(o,{options:a}),o},Oo.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),l={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},i=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),d=c.fontSize*i,u=c.lineHeight,p=s.fontSize*i,f=s.lineHeight,h={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(tr(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Ue(r,{width:a.width,height:a.height}),Ue(h,{fontSize:p+"px",lineHeight:f,paddingTop:7*i+"px",paddingBottom:7*i+"px",paddingLeft:5*i+"px",paddingRight:5*i+"px"}));const g=90*i,m=7*i,y=4*i;if(o.labelTarget&&(Ue(r,{width:g,height:a.height+m+y,x:l.x-g/2,y:a.y-m}),Ue(h,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})),nr(o)&&!qc(o)&&!To(o)){const w=Xc(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),v=d+m+y;Ue(r,{width:g,height:v,x:x.x-g/2,y:x.y-v/2}),Ue(h,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})}return{bounds:r,style:h}},Oo.prototype.update=function(e,t){let o;Jw(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function Jw(e){return!e||!e.trim()}var Yw={__depends__:[Nw,Uw,fl.default],__init__:["labelEditingProvider"],labelEditingProvider:["type",Oo]};function yn(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}yn.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},yn.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},yn.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},yn.prototype.getSnapLocations=function(){return this._snapLocations},yn.prototype.setSnapLocations=function(e){this._snapLocations=e},yn.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new Ua,o.initDefaults(this._defaultSnaps)),o};function Ua(){this._snapValues={}}Ua.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},Ua.prototype.snap=function(e,t,o,a){var l=this._snapValues[t];return l&&Hv(e[o],l[o],a)},Ua.prototype.initDefaults=function(e){var t=this;(0,S.forEach)(e||{},function(o,a){(0,S.forEach)(o,function(l){t.add(a,l)})})};var Kw=1250;function Ft(e,t,o){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(l){a.initSnap(l)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],Kw,function(l){var r=l.context,i=r.shape,s=r.snapContext,c=r.target;if(!(l.originalEvent&&Hs(l.originalEvent))&&!(Pa(l)||!c)){var d=s.pointsForTarget(c);d.initialized||(d=a.addSnapTargetPoints(d,i,c),d.initialized=!0),o.snap(l,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}Ft.$inject=["elementRegistry","eventBus","snapping"],Ft.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,l=o.snapContext;l||(l=o.snapContext=new yn);var r;t.get(a.id)?r=oo(a,e):r={x:e.x+oo(a).x,y:e.y+oo(a).y};var i={x:r.x-a.width/2,y:r.y-a.height/2},s={x:r.x+a.width/2,y:r.y+a.height/2};return l.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),Qn(a)||(l.setSnapOrigin("top-left",{x:i.x-e.x,y:i.y-e.y}),l.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),l},Ft.prototype.addSnapTargetPoints=function(e,t,o){return(0,S.forEach)(this.getSnapTargets(t,o),function(a){if(Qn(a)){Qn(t)&&e.add("mid",oo(a));return}if(vt(a)){if(a.waypoints.length<3)return;(0,S.forEach)(a.waypoints.slice(1,-1),function(l){e.add("mid",l)});return}e.add("mid",oo(a))}),!(0,S.isNumber)(t.x)||!(0,S.isNumber)(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",oo(t)),e},Ft.prototype.getSnapTargets=function(e,t){return Ld(t).filter(function(o){return!Gw(o)})};function Gw(e){return!!e.hidden}function io(e){e.invoke(Ft,this)}(0,Yt.default)(io,Ft),io.$inject=["injector"],io.prototype.initSnap=function(e){return Ft.prototype.initSnap.call(this,e)},io.prototype.addSnapTargetPoints=function(e,t,o){return Ft.prototype.addSnapTargetPoints.call(this,e,t,o)},io.prototype.getSnapTargets=function(e,t){return Ft.prototype.getSnapTargets.call(this,e,t)};var qw=1250;function Io(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],qw,function(a){var l=a.context,r=l.shape,i=r.parent,s=l.direction,c=l.snapContext;if(!(a.originalEvent&&Hs(a.originalEvent))&&!Pa(a)){var d=c.pointsForTarget(i);d.initialized||(d=o.addSnapTargetPoints(d,r,i,s),d.initialized=!0),Qw(s)&&Xt(a,"x",a.x),eC(s)&&Xt(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}Io.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,l=t.snapContext;l||(l=t.snapContext=new yn);var r=pu(o,a);return l.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),l},Io.prototype.addSnapTargetPoints=function(e,t,o,a){return(0,S.forEach)(this.getSnapTargets(t,o),function(l){e.add("corner",Fv(l)),e.add("corner",Dv(l))}),e.add("corner",pu(t,a)),e},Io.$inject=["eventBus","snapping"],Io.prototype.getSnapTargets=function(e,t){return Ld(t).filter(function(o){return!Xw(o,e)&&!vt(o)&&!Zw(o)&&!Qn(o)})};function pu(e,t){var o=qe(e),a=Oe(e),l={x:o.x,y:o.y};return t.indexOf("n")!==-1?l.y=a.top:t.indexOf("s")!==-1&&(l.y=a.bottom),t.indexOf("e")!==-1?l.x=a.right:t.indexOf("w")!==-1&&(l.x=a.left),l}function Xw(e,t){return e.host===t}function Zw(e){return!!e.hidden}function Qw(e){return e==="n"||e==="s"}function eC(e){return e==="e"||e==="w"}var tC=7,nC=1e3;function bn(e){this._canvas=e,this._asyncHide=(0,S.debounce)((0,S.bind)(this.hide,this),nC)}bn.$inject=["canvas"],bn.prototype.snap=function(e,t){var o=e.context.snapContext,a=o.getSnapLocations(),l={x:Pa(e,"x"),y:Pa(e,"y")};(0,S.forEach)(a,function(r){var i=o.getSnapOrigin(r),s={x:e.x+i.x,y:e.y+i.y};if((0,S.forEach)(["x","y"],function(c){var d;l[c]||(d=t.snap(s,r,c,tC),d!==void 0&&(l[c]={value:d,originValue:d-i[c]}))}),l.x&&l.y)return!1}),this.showSnapLine("vertical",l.x&&l.x.value),this.showSnapLine("horizontal",l.y&&l.y.value),(0,S.forEach)(["x","y"],function(r){var i=l[r];(0,S.isObject)(i)&&Xt(e,r,i.originValue)})},bn.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=(0,N.create)("path");return(0,N.attr)(o,{d:"M0,0 L0,0"}),(0,N.classes)(o).add("djs-snap-line"),(0,N.append)(t,o),{update:function(a){(0,S.isNumber)(a)?e==="horizontal"?(0,N.attr)(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):(0,N.attr)(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):(0,N.attr)(o,{display:"none"})}}},bn.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},bn.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},bn.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},bn.prototype.hide=function(){(0,S.forEach)(this._snapLines,function(e){e.update()})};var oC={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ft],resizeSnapping:["type",Io],snapping:["type",bn]},aC={__depends__:[oC],__init__:["createMoveSnapping"],createMoveSnapping:["type",io]};function so(e){ut.call(this,e),this.init()}so.$inject=["eventBus"],Sn(so,ut),so.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(l){a.canExecute(l,t,function(r,i,s){return o(r)},!0)})},so.prototype.init=function(){};function zo(e){so.call(this,e)}zo.$inject=["eventBus"],(0,Yt.default)(zo,so),zo.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},l=a.targetParent;if(a.targetAttach)return!1;l&&(o.parent=l);try{return Br(t,o)}finally{l&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,o=e.source,a=e.target;return Br(o,a,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return py(t)})},zo.prototype.canConnect=Br;function Br(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}var lC={__init__:["myRuleProvider"],myRuleProvider:["type",zo]};function Rr(e,t,o,a,l,r,i){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=l,this._palette=r,this._myOptions=i,r.registerProvider(this)}Rr.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],Rr.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,l=this._globalConnect,r=this._myOptions;function i(c,d,u,p,f){function h(g){const m=t.createShape(Ue({type:c},f));e.start(g,m)}return{group:d,className:u,title:p,action:{dragstart:h,click:h}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(c){o.activateHand(c)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(c){a.activateSelection(c)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(c){l.toggle(c)}}},"tool-separator":{group:"tools",separator:!0}};for(const c in r.palette){const d=r.palette[c];s[c]=i(d.type,d.group,d.className,d.title,d.options)}return s};var rC={__init__:["paletteProvider"],paletteProvider:["type",Rr]},LC=50,iC=250;function sC(e,t){t||(t={});function o(f){return f.source===e?1:-1}var a=t.defaultDistance||50,l=t.direction||"e",r=t.filter,i=t.getWeight||o,s=t.maxDistance||iC,c=t.reference||"start";r||(r=cC);function d(f,h){return l==="n"?c==="start"?Oe(f).top-Oe(h).bottom:c==="center"?Oe(f).top-qe(h).y:Oe(f).top-Oe(h).top:l==="w"?c==="start"?Oe(f).left-Oe(h).right:c==="center"?Oe(f).left-qe(h).x:Oe(f).left-Oe(h).left:l==="s"?c==="start"?Oe(h).top-Oe(f).bottom:c==="center"?qe(h).y-Oe(f).bottom:Oe(h).bottom-Oe(f).bottom:c==="start"?Oe(h).left-Oe(f).right:c==="center"?qe(h).x-Oe(f).right:Oe(h).right-Oe(f).right}var u=e.incoming.filter(r).map(function(f){var h=i(f),g=h<0?d(f.source,e):d(e,f.source);return{id:f.source.id,distance:g,weight:h}}),p=e.outgoing.filter(r).map(function(f){var h=i(f),g=h>0?d(e,f.target):d(f.target,e);return{id:f.target.id,distance:g,weight:h}});return(0,S.reduce)(u.concat(p).reduce(function(f,h){return f[h.id+"__weight_"+h.weight]=h,f},{}),function(f,h){var g=h.distance,m=h.weight;return g<0||g>s||(f[String(g)]||(f[String(g)]=0),f[String(g)]+=1*m,(!f.distance||f[f.distance]<f[String(g)])&&(f.distance=g)),f},{}).distance||a}function cC(){return!0}var dC=100;function hu(e,t,o){e.on("autoPlace",dC,function(a){var l=a.shape,r=a.source;return uC(r,l)}),e.on("autoPlace.end",function(a){o.scrollToElement(a.shape)}),this.append=function(a,l,r){e.fire("autoPlace.start",{source:a,shape:l});var i=e.fire("autoPlace",{source:a,shape:l}),s=t.appendShape(a,l,i,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:s}),s}}hu.$inject=["eventBus","modeling","canvas"];function uC(e,t,o){o||(o={});var a=o.defaultDistance||50,l=qe(e);return{x:Oe(e).right+a+t.width/2,y:l.y}}function gu(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}gu.$inject=["eventBus","selection"];var fC={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",hu],autoPlaceSelectionBehavior:["type",gu]},pC=10,hC=(e,t)=>e.type===t;function gC(e){return e.incoming.map(t=>t.source)}function mC(e){return e.outgoing.map(t=>t.target)}function _r(e){return mC(e).concat(gC(e))}function yC(e){let t=_r(e);return e.host&&(t=t.concat(_r(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(_r(a)),[]))),t.filter(o=>o.type!=="myline")}function bC(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height};return(0,S.find)(yC(e),l=>l===o?!1:rn(l,a,pC)==="intersect")}function vC(e,t,o,a){let l;for(;l=bC(e,o,t);)o=a(t,o,l);return o}function wC(e){return function(t,o,a){const l={x:o.x,y:o.y};return["x","y"].forEach(r=>{const i=e[r];if(!i)return;const s=r==="x"?"width":"height",{margin:c,minDistance:d}=i;c<0?l[r]=Math.min(a[r]+c-t[s]/2,o[r]-d+c):l[r]=Math.max(a[r]+a[s]+c+t[s]/2,o[r]+d+c)}),l}}function CC(e,t){return xC(e,t)}function xC(e,t){const o=Oe(e),a=qe(e),l=sC(e,{filter:s=>hC(s,"myline")}),r=30,i=80;return vC(e,t,{x:o.right+l+t.width/2,y:a.y+kC("left",i)},wC({y:{margin:r,minDistance:i}}))}function kC(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function mu(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return CC(a,o)})}mu.$inject=["eventBus"];var SC={__depends__:[fC],__init__:["myAutoPlace"],myAutoPlace:["type",mu]};function Tr(e,t,o,a,l,r,i){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=l,this._create=r,this._myOptions=i,t.registerProvider(this)}Tr.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Tr.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,l=this._autoPlace,r=this._create,i=this._myOptions;function s(){o.removeElements([e])}function c(p,f,h){t.start(p,f,h)}function d(p,f,h,g){typeof h!="string"&&(g=h);function m(w,x){const v=a.createShape(Ue({type:p},g));r.start(w,v,{source:x})}function y(w,x){const v=a.createShape(Ue({type:p},g));l.append(x,v)}return{group:"model",className:f,title:h,action:{dragstart:m,click:y}}}if(e.type==="label")return!1;if(e.type==="myline"||e.type==="endEvent")return{delete:{group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}}};const u={};for(const p in i.palette)if(p!=="create.start-event"){const f=i.palette[p];u[p]=d(f.type,f.className,f.title,f.options)}return u.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:c,dragstart:c}},u.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},u};var EC={__init__:["ContextPadProvider"],ContextPadProvider:["type",Tr]},BC=(0,n.defineComponent)({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,l=o,r=(0,n.ref)(),i={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const V=s.get("eventBus");V.on("element.dblclick",T=>{l("elementDblclick",T.element.businessObject)}),V.on("element.click",T=>{l("elementClick",T.element.businessObject)}),V.on("create.end",T=>{l("elementCreate",T.elements[0].businessObject)}),V.on("autoPlace.end",T=>{l("elementCreate",T.shape.businessObject)})},p=function(){return{palette:a.paletteOptions||i,lineStroke:a.lineStroke}},f=()=>{let V={__init__:["myOptions"],myOptions:["type",p]};s=new qo.default({canvas:{container:r.value},modules:[Wv,Hl,Kv,sw,ec,wv,fw,pw,hw,cd,wc,Ew,qd,Vw,kc,V,SC,fd,Yw,EC,rC,lC,aC,hd]});const T=s.get("canvas"),F=s.get("elementFactory");d();const L=F.createRoot();T.setRootElement(L),u()};(0,n.onMounted)(()=>{f()});const h=V=>{const T=V==null?1:c+V;s.get("canvas").zoom(T),c=T},g=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},y=()=>(s.get("canvas").zoom(1),gd(s.get("elementRegistry").getAll())),w=V=>{s.clear(),d(),md(V,s)},x=V=>{s.get("myImporter").update(V.id,V)};return t({reset:()=>{d()},zoom:V=>{h(V)},redo:()=>{g()},undo:()=>{m()},getData:()=>y(),setData:V=>{w(V)},updateElemet:V=>{x(V)}}),(V,T)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),RC=BC,yu=se(bv),bu=se(RC),_C=(0,n.defineComponent)({name:"JInputCards",__name:"input-cards",props:{id:{type:String,default:""},modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},gutter:{type:Number,default:16},span:Number,labelWidth:[String,Number],required:{type:Boolean,default:!1}},emits:["update:modelValue","change","rowChange"],setup(e,{expose:t,emit:o}){const a=e,l=o,{t:r}=Je(),{formData:i}=Qt(),s=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),c=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),d=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),u=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),p=(0,n.computed)(()=>a.editConfig.readonly),f=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)([]),g=b=>{l("rowChange",b)},m=()=>{const b={_i:Kt()};a.columns.forEach(k=>{const B=k.config?.valueRowKey||k.id||"";B&&(b[B]=xt(k.config?.defaultValue))}),h.value.push(b),l("change",{id:a.id,value:b,data:b,formData:i,tableData:h.value,type:"add"})},y=b=>{const k=h.value[b];h.value.splice(b,1),l("change",{id:a.id,value:k,data:k,formData:i,tableData:h.value,type:"delete"})},w=()=>{const b={isOk:!0,info:""};if(a.required&&h.value.length===0)return b.isOk=!1,b.info="请添加表格数据",b;const k=h.value.length,B=a.columns,_=B.length;for(let V=0;V<k;V++){const T=h.value[V];for(let F=0;F<_;F++){const L=B[F];if(v(L.config,V).display!==!1&&L.rule&&L.rule.length>0){const D=L.rule.length;for(let M=0;M<D;M++){const E=L.rule[M];if(E.pattern=E.pattern?E.pattern+"":"",E.pattern&&!bt(T[L.prop||""])&&!new RegExp(E.pattern.substring(1,E.pattern.length-1)).test(T[L.prop||""]))return b.info=`${r("第")}${V+1}${r("行")},${r("第")}${F+1}${r("列")},${r(L.label)}:${r(E.message)}`,b.isOk=!1,b;if(E.required&&bt(T[L.prop||""]))return b.isOk=!1,b.info=`${r("第")}${V+1}${r("行")},${r("第")}${F+1}${r("列")},${r(L.label)}:${r("不能为空")}`,b}}}}return b};a.modelValue&&a.modelValue.length>0?(h.value=a.modelValue||[],h.value.forEach(b=>{b._i||(b._i=Kt())})):(h.value=[],l("update:modelValue",h.value));const v=(b,k)=>{const B={...b};if(B.getUpConfig){const _=b.getUpConfig({formData:i,index:k,row:h.value[k],tableData:h.value,config:B});_&&Object.keys(_).forEach(V=>{B[V]=_[V]})}return B},C=b=>{const k=b||a.labelWidth;return typeof k=="string"?k:typeof k=="number"?k+"px":k};return t({validate:()=>w()}),go({getTableData:()=>h.value,rowChange:g}),(b,k)=>{const B=(0,n.resolveComponent)("j-comp"),_=(0,n.resolveComponent)("el-form-item"),V=(0,n.resolveComponent)("el-col"),T=(0,n.resolveComponent)("j-button"),F=(0,n.resolveComponent)("el-row");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createElementVNode)("div",(0,n.mergeProps)({class:"j-input-cards"},b.$attrs),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(h.value,(L,D)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-input-cards-item",key:L.i,style:{"margin-bottom":"8px"}},[(0,n.createVNode)(F,{gutter:e.gutter},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,M=>((0,n.openBlock)(),(0,n.createBlock)(V,{key:M.prop,span:M.config?.span||e.span||24,style:(0,n.normalizeStyle)({"margin-bottom":(M.getInputType?M.getInputType(L):M.inputType)=="j-input-rows"?"8px":void 0})},{default:(0,n.withCtx)(()=>[(0,n.withDirectives)((0,n.createVNode)(_,{"label-width":C(M.config?.labelWidth),label:(0,n.unref)(r)(M.config?.label||""),extra:M.config?.labelExtra,tooltip:M.config?.labelTooltip,required:M.config?.required},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(B,(0,n.mergeProps)({ref_for:!0},M,{row:L}),null,16,["row"])]),_:2},1032,["label-width","label","extra","tooltip","required"]),[[n.vShow,v(M.config,D).display!==!1]])]),_:2},1032,["span","style"]))),128)),u.value&&(f.value||h.value.length>1)&&!p.value?((0,n.openBlock)(),(0,n.createBlock)(T,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",danger:"",onClick:M=>y(D)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)]),_:2},1032,["gutter"])]))),128))],16),s.value&&!p.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":d.value})},[s.value?((0,n.openBlock)(),(0,n.createBlock)(T,{key:0,type:"link",style:{"margin-right":"8px"},label:c.value,icon:"mdi:add",onClick:m},null,8,["label"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)],64)}}}),TC=_C,vu=se(TC),MC=[Zo,hi,gi,mi,yi,bi,vi,wi,Ci,xi,ki,Si,Ei,Bi,Pi,ji,Oi,Ii,Cl,pi,zi,Li,Hi,Fi,Wi,Ui,as,Ji,Yi,Ki,Gi,qi,Xi,Zi,Qi,es,ts,ns,os,ss,cs,ds,us,fs,ps,hs,gs,ms,ls,rs,xl,ys,bs,vs,ws,Cs,xs,ks,Dm,yu,bu,vu],VC=e=>{MC.forEach(t=>{e.component(t.name,t)})},NC={install:VC};A.EncryptionFactory=Qr,A.EventBus=yl,A.HashingFactory=of,A.INJECT_KEYS=rt,A.JAutoComplete=Ei,A.JBarcode=Ui,A.JButton=Zo,A.JButtonSelect=ss,A.JButtons=hi,A.JCascaderSelect=xi,A.JCheckbox=ki,A.JCodeMirror=as,A.JCollapse=xs,A.JComp=us,A.JCount=Ji,A.JCountUp=Ki,A.JDataPanel=Gi,A.JDate=mi,A.JDecoratedTitle=ns,A.JDialog=ji,A.JDialogFull=Oi,A.JDivider=qi,A.JDrawer=Ii,A.JDynamicLayer=pi,A.JEcharts=Wi,A.JEditor=ks,A.JForm=fs,A.JFormItem=ps,A.JGuid=gs,A.JHpanel=Xi,A.JIcon=vi,A.JInput=gi,A.JInputButton=Zi,A.JInputCards=vu,A.JInputCode=Qi,A.JInputColor=es,A.JInputCount=Yi,A.JInputDecoratedTitle=os,A.JInputLayer=bs,A.JInputRows=ys,A.JInputTag=zi,A.JLayer=Cl,A.JLayerForm=vs,A.JLayout=Bi,A.JMenu=rs,A.JNowTime=bi,A.JNumber=Si,A.JPage=hs,A.JPanel=ms,A.JRadio=wi,A.JRate=Li,A.JSelect=Ci,A.JSlider=Hi,A.JSliderCaptcha=ls,A.JSwitch=ws,A.JTable=Pi,A.JTablePanel=xl,A.JTabs=Cs,A.JTime=yi,A.JTitle=ts,A.JTree=cs,A.JTreeSelect=ds,A.JUpload=Fi,A.JWorkflow=bu,A.JWorkflowViewer=yu,A.assign=Ue,A.buildShortUUID=Qo,A.buildUUID=Kt,A.clearJson=Dn,A.clone=fo,A.deepClone=xt,A.default=NC,A.eventBus=lf,A.formatToDate=ho,A.formatToDateTime=na,A.fullScreenLoading=Fn,A.getCompConfig=_t,A.getCompType=ta,A.getFunction=hl,A.getIsInputComp=ea,A.getIsTableInputComp=Yr,A.getLabel=Kr,A.getObjType=jr,A.getTextWidth=kt,A.is=Pr,A.isArray=Xo,A.isNullOrEmpty=bt,A.isObject=zu,A.loadBMap=ti,A.lowerFirst=Ju,A.myAesDecrypt=af,A.numberToChinese=Ir,A.numberToThousandSeparator=zr,A.pagination=Wu,A.paginationEx=Or,A.set=gl,A.setGroupMap=Hr,A.toArray=$r,A.toDecimal=po,A.toLeafArray=Jr,A.toSimpleTree=Yu,A.toTree=Dr,A.uniqueArray=Uu,A.upFirst=Lr,A.useAppInject=Je,A.useAppProvide=rf,A.useAuthPageInject=ii,A.useAuthPageProvide=si,A.useCompInject=oi,A.useCompProvide=vl,A.useFormInject=Qt,A.useFormProvide=bl,A.useHMenuInject=li,A.useHMenuProvide=ri,A.useInject=jt,A.useLayer=Wn,A.useLayerInject=sf,A.useLayerProvide=ci,A.useMenuInject=$n,A.useMenuProvide=ai,A.usePageInject=di,A.usePageProvide=ui,A.useProvide=Ot,A.useSortable=ei,A.useTableInject=ni,A.useTableProvide=go});