@a2simcode/ui 0.0.109 → 0.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/input-layer/index.d.ts +10 -0
- package/dist/components/input-layer/src/input-layer.vue.d.ts +10 -0
- package/dist/components/table-panel/index.d.ts +15 -0
- package/dist/components/table-panel/src/table-panel.vue.d.ts +15 -0
- package/dist/simcode-ui.es.js +6 -0
- package/dist/simcode-ui.umd.js +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
package/dist/simcode-ui.umd.js
CHANGED
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
roundFun,
|
|
14
14
|
sumFun,
|
|
15
15
|
sumproductFun,
|
|
16
|
-
getCompValue)=>{ return ${B} }`;let S;const T=si(B);if(T.res)try{S=T.fn(a,i,r,l,s,c,d,u,p,f,h,g,m,y,v)}catch(A){console.log(A,"计算组件公式运行错误")}else return console.log(T.msg),"";return Number.isNaN(S)?"":(n.decimal!==void 0&&(S=S.toFixed(n.decimal)),S)}),_=(0,o.computed)(()=>{let b=C.value;return n.thousandSeparator&&(b=Pr(b)),n.isChinese&&(b=Ar(b)),b});return(0,o.watch)(C,b=>{w("update:modelValue",b),w("change",{value:b,data:_.value})}),(b,B)=>{const S=(0,o.resolveComponent)("el-input");return(0,o.openBlock)(),(0,o.createBlock)(S,{modelValue:_.value,"onUpdate:modelValue":B[0]||(B[0]=T=>_.value=T),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),rh=ih,Il=ie(rh),lh={class:"j-block j-input-count"},sh={class:"j-input-count-top"},ch={class:"j-input-count-tool"},dh={style:{"font-weight":"600"}},uh={class:"j-input-count-codebox"},fh={key:0,class:"j-input-count-cursor"},ph={key:0,class:"fun_color"},hh={key:1,class:"comp_color"},gh={key:2,class:"num_color"},mh={key:3,class:"j-input-count-cursor"},yh={class:"j-input-count-bottom"},vh={class:"j-input-count-left"},bh={class:"mb-8px fw-600"},wh={class:"j-input-count-right"},Ch={class:"j-input-count-funs"},xh={style:{"font-weight":"600",padding:"8px"}},kh={class:"j-input-count-funs-content"},Sh={class:"j-input-count-fundes"},Eh={style:{"font-size":"14px","font-weight":"300"}},Bh=(0,o.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:n}=Ze(),a=e,i=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:"."}],l=[{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,o.ref)(!1),c=(0,o.ref)([]),d=(0,o.reactive)({cells:[],cursor:0}),u=(0,o.computed)({get(){return JSON.parse(a.modelValue||"[]")},set(b){i("update:modelValue",b.length>0?JSON.stringify(b):""),i("change",{value:b.length>0?JSON.stringify(b):"",data:b})}}),p=b=>{c.value=b},f=(b,B)=>{const S={value:b,type:B};if(d.cells.splice(d.cursor,0,S),d.cursor+=1,B==="fun"){const T={value:"(",type:B},A={value:")",type:B};d.cells.splice(d.cursor,0,T,A),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,o.computed)(()=>{const b={};return a.list.forEach(B=>{B.children.forEach(S=>{b[S.value]=`${B.label}.${S.label}`})}),b}),_=b=>C.value[b]||b;return(b,B)=>{const S=(0,o.resolveComponent)("j-button"),T=(0,o.resolveComponent)("j-icon"),A=(0,o.resolveComponent)("el-space"),R=(0,o.resolveComponent)("j-dialog");return(0,o.openBlock)(),(0,o.createElementBlock)("div",null,[(0,o.createVNode)(S,(0,o.mergeProps)(b.$attrs,{type:e.type,size:e.size,label:e.label,onClick:w}),null,16,["type","size","label"]),(0,o.createVNode)(R,{visible:s.value,title:(0,o.unref)(n)("公式设置"),height:800,width:1200,onOk:x,onClosed:v},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",lh,[(0,o.createElementVNode)("div",sh,[(0,o.createElementVNode)("div",ch,[(0,o.createElementVNode)("span",dh,(0,o.toDisplayString)((0,o.unref)(n)("计算公式"))+"=",1),(0,o.createVNode)(A,null,{default:(0,o.withCtx)(()=>[(0,o.createVNode)(S,{type:"text",onClick:h},{icon:(0,o.withCtx)(()=>[(0,o.createVNode)(T,{icon:"arrowLeft"})]),_:1}),(0,o.createVNode)(S,{type:"text",onClick:g},{icon:(0,o.withCtx)(()=>[(0,o.createVNode)(T,{icon:"arrowRight"})]),_:1}),(0,o.createVNode)(S,{type:"link",label:"退格",onClick:m}),(0,o.createVNode)(S,{type:"link",danger:"",label:"清空",onClick:y})]),_:1})]),(0,o.createElementVNode)("div",uh,[d.cells.length==0?((0,o.openBlock)(),(0,o.createElementBlock)("span",fh)):(0,o.createCommentVNode)("",!0),((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(d.cells,(j,O)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:O},[j.type=="fun"?((0,o.openBlock)(),(0,o.createElementBlock)("span",ph,(0,o.toDisplayString)(j.value.toUpperCase()),1)):j.type=="comp"?((0,o.openBlock)(),(0,o.createElementBlock)("span",hh," #"+(0,o.toDisplayString)(_(j.value))+"# ",1)):j.type=="num"?((0,o.openBlock)(),(0,o.createElementBlock)("span",gh,(0,o.toDisplayString)(j.value),1)):(0,o.createCommentVNode)("",!0),O+1==d.cursor?((0,o.openBlock)(),(0,o.createElementBlock)("span",mh)):(0,o.createCommentVNode)("",!0)],64))),128))])]),(0,o.createVNode)(A,{class:"j-input-count-mid"},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(r,(j,O)=>(0,o.createVNode)(S,{key:O,label:j.label+"",onClick:H=>f(j.value,"num")},null,8,["label","onClick"])),64))]),_:1}),(0,o.createElementVNode)("div",yh,[(0,o.createElementVNode)("div",vh,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.list,(j,O)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:O},[(0,o.createElementVNode)("div",bh,(0,o.toDisplayString)((0,o.unref)(n)(j.label)),1),(0,o.createVNode)(A,{size:[8,8],wrap:"",style:{"margin-bottom":"16px"}},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(j.children,H=>((0,o.openBlock)(),(0,o.createBlock)(S,{key:H.value,onClick:M=>f(H.value,"comp"),label:(0,o.unref)(n)(H.label)},null,8,["onClick","label"]))),128))]),_:2},1024)],64))),128))]),(0,o.createElementVNode)("div",wh,[(0,o.createElementVNode)("div",Ch,[(0,o.createElementVNode)("span",xh,(0,o.toDisplayString)((0,o.unref)(n)("函数列表")),1),(0,o.createElementVNode)("div",kh,[((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(l,(j,O)=>(0,o.createVNode)(S,{type:"text",style:{"border-radius":"0","justify-content":"left"},key:O,onMouseover:H=>p(j.des),onClick:H=>f(j.value,"fun"),label:j.label},null,8,["onMouseover","onClick","label"])),64))])]),(0,o.createElementVNode)("div",Sh,[(0,o.createElementVNode)("div",null,[(0,o.createElementVNode)("ul",null,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(c.value,(j,O)=>((0,o.openBlock)(),(0,o.createElementBlock)("li",{key:O,style:{"margin-bottom":"8px"}},[(0,o.createElementVNode)("span",Eh,(0,o.toDisplayString)((0,o.unref)(n)(j)),1)]))),128))])])])])])])]),_:1},8,["visible","title"])])}}}),Rh=Bh,Ll=ie(Rh),_h={key:0},Th=(0,o.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 n=e,a=(0,o.computed)(()=>({...n})),i=(0,o.ref)(),r=(0,o.ref)(null),l=(0,o.computed)(()=>n.options);(0,o.onMounted)(()=>{n.animation&&s()}),(0,o.watch)(()=>n.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=n.decimals,r.value.reset(),r.value.update(n.endValue))},{deep:!0}),(0,o.watch)(()=>n.endValue,f=>{r.value&&r.value.update&&r.value.update(f)});const s=()=>{r.value||(l.value.startVal=n.startValue,l.value.decimalPlaces=n.decimals,l.value.duration=n.duration,r.value=new du.CountUp(i.value,Number(n.endValue),l.value),r.value.start(()=>{n.callback?.(r.value)}))};return(0,o.onUnmounted)(()=>{r.value=null}),(0,o.onBeforeUnmount)(()=>{r.value=null}),t({myProps:a,el:i,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,o.openBlock)(),(0,o.createElementBlock)("span",{ref_key:"el",ref:i},[e.animation?(0,o.createCommentVNode)("",!0):((0,o.openBlock)(),(0,o.createElementBlock)("span",_h,(0,o.toDisplayString)(e.endValue),1))],512))}}),Mh=Th,Hl=ie(Mh),Ah={class:"j-block j-data-panel"},Ph={key:0,class:"j-data-panel-header"},Vh={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},Nh={class:"j-data-panel-header-right"},jh={class:"j-data-panel-body"},Oh=(0,o.defineComponent)({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,n)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",Ah,[e.title?((0,o.openBlock)(),(0,o.createElementBlock)("div",Ph,[(0,o.createElementVNode)("div",Vh,(0,o.toDisplayString)(e.title),1),(0,o.createElementVNode)("div",Nh,[(0,o.renderSlot)(t.$slots,"titleRight")])])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",jh,[(0,o.renderSlot)(t.$slots,"default")])]))}}),Ih=Oh,zl=ie(Ih),Lh={class:"j-divider-content"},Hh=(0,o.defineComponent)({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,n=(0,o.computed)(()=>{const i={color:t.color};return t.size&&Number(t.size)&&(i.fontSize=`${t.size}px`),i}),a=(0,o.computed)(()=>({borderTopStyle:t.borderStyle}));return(i,r)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(`j-divider-container j-divider-${e.contentPosition}`),style:(0,o.normalizeStyle)(n.value)},[(0,o.createElementVNode)("div",{class:"j-divider-line j-divider-line-left",style:(0,o.normalizeStyle)(a.value)},null,4),(0,o.createElementVNode)("div",Lh,[(0,o.createElementVNode)("span",null,(0,o.toDisplayString)(e.content||""),1)]),(0,o.createElementVNode)("div",{class:"j-divider-line j-divider-line-right",style:(0,o.normalizeStyle)(a.value)},null,4)],6))}}),zh=Hh,Dl=ie(zh),Dh={class:"j-hpanel"},Fh={class:"j-hpanel-main"},$h=(0,o.defineComponent)({name:"JHpanel",__name:"hpanel",setup(e){return(t,n)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",Dh,[(0,o.renderSlot)(t.$slots,"left"),(0,o.createElementVNode)("div",Fh,[(0,o.renderSlot)(t.$slots,"default")]),(0,o.renderSlot)(t.$slots,"right")]))}}),Wh=$h,Fl=ie(Wh),Uh=(0,o.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 n=e,a=t,i=(0,o.ref)(),r=(0,o.ref)(),l=async(u,p)=>{n.ok&&(u("保存数据中..."),r.value=await n.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),p(),i.value.close())},s=()=>n.beforeClose?n.beforeClose(r.value):!0,c=()=>{n.closed?.()},d=()=>{i.value.open(n.title||n.btnText,n.layerType),setTimeout(()=>{n.open?.(r.value)},200)};return(0,o.watch)(()=>n.modelValue,u=>{r.value=u},{immediate:!0}),(u,p)=>{const f=(0,o.resolveComponent)("j-button"),h=(0,o.resolveComponent)("j-layer");return(0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createVNode)(f,(0,o.mergeProps)({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),(0,o.createVNode)(h,{ref_key:"layerRef",ref:i,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:l,onClosed:c},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}}),Jh=Uh,$l=ie(Jh),Yh=(0,o.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 n=e,a=t,i=(0,o.computed)({get:()=>n.modelValue,set:p=>{a("update:modelValue",p)}}),r=(0,o.ref)(""),l=p=>{r.value=p},s=()=>r.value,c=p=>n.beforeClose?n.beforeClose(p):!0,d=p=>{a("change",p)},u=(0,o.computed)(()=>n.modelValue&&n.modelValue.trim()?`${n.btnText}(已设置)`:n.btnText);return(p,f)=>{const h=(0,o.resolveComponent)("j-code-mirror"),g=(0,o.resolveComponent)("j-layout"),m=(0,o.resolveComponent)("j-input-button");return(0,o.openBlock)(),(0,o.createBlock)(m,{modelValue:i.value,"onUpdate:modelValue":f[1]||(f[1]=y=>i.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:l,onChange:d},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(g,{"right-move":!1,right:560},(0,o.createSlots)({default:(0,o.withCtx)(()=>[(0,o.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,o.withCtx)(()=>[(0,o.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"])}}}),Kh=Yh,Wl=ie(Kh),Gh=(0,o.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:n}){const a=e,i=n,r=(0,o.ref)(),l=(0,o.ref)(),s=(0,o.computed)({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(m){l.value=m,i("update:modelValue",m),i("input",m)}}),c=m=>{i("input",m)},d=m=>{i("focus",m)},u=m=>{i("blur",m)},p=()=>{i("clear"),i("update:modelValue","")},f=m=>{i("change",m)},h=m=>{i("color-change",m)},g=m=>{i("active-change",m)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(m,y)=>{const w=(0,o.resolveComponent)("el-color-picker"),x=(0,o.resolveComponent)("el-input");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[(0,o.createVNode)(x,(0,o.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,o.withCtx)(()=>[(0,o.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)}}}),qh=Gh,Ul=ie(qh),Xh=(0,o.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,n=(0,o.computed)(()=>t.class||""),a=(0,o.computed)(()=>{const i={...t.style};return t.color&&(i.color=t.color),t.size&&(typeof t.size=="number"?i.fontSize=`${t.size}px`:i.fontSize=t.size),t.weight&&(i.fontWeight=t.weight),i});return(i,r)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-title",n.value]),style:(0,o.normalizeStyle)(a.value)},(0,o.toDisplayString)(e.title),7))}}),Zh=Xh,Jl=ie(Zh),Qh=(0,o.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:n}){const a=e,i=n,r=(0,o.ref)(),l=(0,o.ref)("");let s=null;const c=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return(0,In.javascript)();case"css":case"text/css":return(0,pu.css)();case"html":case"text/html":return(0,hu.html)();case"json":case"application/json":return(0,gu.json)();case"sql":case"text/x-sql":return(0,mu.sql)();case"xml":case"text/xml":return(0,yu.xml)();case"python":case"text/x-python":return(0,vu.python)();case"markdown":case"text/markdown":return(0,bu.markdown)();case"java":case"text/x-java":return(0,wu.java)();case"vue":case"text/x-vue":return(0,In.javascript)({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return(0,In.javascript)({jsx:!1,typescript:!0});case"jsx":return(0,In.javascript)({jsx:!0,typescript:!1});case"tsx":return(0,In.javascript)({jsx:!0,typescript:!0});default:return(0,In.javascript)()}},d=()=>{const m=[fu.basicSetup,(0,At.lineNumbers)(),(0,At.highlightActiveLineGutter)(),(0,At.highlightSpecialChars)(),(0,oi.history)(),(0,At.drawSelection)(),(0,At.dropCursor)(),(0,Ln.indentOnInput)(),(0,Ln.bracketMatching)(),(0,ni.closeBrackets)(),(0,At.rectangularSelection)(),(0,Ln.foldGutter)(),At.keymap.of([...ni.closeBracketsKeymap,...oi.defaultKeymap,...oi.historyKeymap,...Ln.foldKeymap]),(0,Ln.syntaxHighlighting)(Ln.defaultHighlightStyle)];return m.push(c(a.mode)),a.readonly&&m.push(ti.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push((0,ni.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(At.EditorView.updateListener.of(y=>{if(y.docChanged){const w=y.state.doc.toString();l.value=w,i("update:value",w),i("change",{value:w})}})),m},u=async()=>{r.value&&(s=new At.EditorView({state:ti.EditorState.create({doc:a.value,extensions:d()}),parent:r.value}),l.value=a.value)},p=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const y=ti.EditorState.create({doc:m,extensions:d()});r.value&&(s=new At.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,uu.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,"@"),i("update:value",m),i("change",{value:m})};let g=null;return(0,o.watch)(()=>a.value,m=>{m!==l.value&&(l.value=m,s&&p(),setTimeout(()=>{s&&a.isScrollToBottom&&f()}))}),(0,o.watch)(()=>a.mode,()=>{s&&p()}),(0,o.onMounted)(async()=>{await(0,o.nextTick)(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(g=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),g.observe(r.value))}),(0,o.onUnmounted)(()=>{g&&r.value&&(g.unobserve(r.value),g.disconnect(),g=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(m,y)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:(0,o.normalizeStyle)({height:e.height?`${e.height}px`:""})},null,4))}}),eg=Qh,Yl=ie(eg),tg=(0,o.defineComponent)({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const n=e,a=(0,o.useTemplateRef)("actionRef"),i=(0,o.ref)("0"),r=(0,o.computed)(()=>{const{actionStyle:s,toLeft:c}=n;return{...s,left:c?"0":i.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:c?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=(0,o.computed)(()=>Number.parseInt(i.value)>10&&!n.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{i.value=s}}),(s,c)=>{const d=(0,o.resolveComponent)("j-icon");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"actionRef",ref:a,style:(0,o.normalizeStyle)(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?((0,o.openBlock)(),(0,o.createBlock)(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):((0,o.openBlock)(),(0,o.createBlock)(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),ng=tg,og=(0,o.defineComponent)({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const n=e,a=(0,o.useTemplateRef)("barRef"),i=(0,o.ref)("0"),r=(0,o.computed)(()=>{const{barStyle:l,toLeft:s}=n;return{...l,width:s?"0":i.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:l=>{i.value=l}}),(l,s)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"barRef",ref:a,style:(0,o.normalizeStyle)(r.value)},null,4))}}),ag=og,ig=(0,o.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 n=e,a=(0,o.useTemplateRef)("contentRef"),i=(0,o.computed)(()=>{const{contentStyle:l}=n;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const r=(0,o.computed)(()=>({animation:`shine ${n.animationDuration}s linear ${n.animationIterationCount}`}));return(l,s)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"contentRef",ref:a,class:(0,o.normalizeClass)([{success:e.isPassing},"j-slider-captcha-content"]),style:(0,o.normalizeStyle)(i.value)},[(0,o.createElementVNode)("div",{style:(0,o.normalizeStyle)(r.value),class:"j-spine-text"},(0,o.toDisplayString)(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),rg=ig,lg=(0,o.defineComponent)({name:"JSliderCaptcha",__name:"slider-captcha",props:(0,o.mergeModels)({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:(0,o.mergeModels)(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const n=e,a=t,i=(0,o.useModel)(e,"modelValue"),r=(0,o.reactive)({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=(0,o.useTemplateRef)("wrapperRef"),s=(0,o.useTemplateRef)("barRef"),c=(0,o.useTemplateRef)("contentRef"),d=(0,o.useTemplateRef)("actionRef");(0,o.watch)(()=>r.isPassing,w=>{if(w){const{endTime:x,startTime:v}=r;a("success",{isPassing:w,time:((x-v)/1e3).toFixed(1)}),i.value=w}}),(0,o.watchEffect)(()=>{r.isPassing=!!i.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=l.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,o.unref)(d),_=(0,o.unref)(s);if(!C||!_)return;const{actionWidth:b,offset:B,wrapperWidth:S}=f(C.getEl()),T=u(w)-v;a("move",{event:w,moveDistance:v,moveX:T}),T>0&&T<=B?(C.setLeft(`${T}px`),_.setWidth(`${T+b/2}px`)):T>B&&(C.setLeft(`${S-b}px`),_.setWidth(`${S-b/2}px`),m())}}function g(w){const{isMoving:x,isPassing:v,moveDistance:C}=r;if(x&&!v){a("end",w);const _=d.value,b=(0,o.unref)(s);if(!_||!b)return;const B=u(w)-C,{actionWidth:S,offset:T,wrapperWidth:A}=f(_.getEl());B<T?y():(_.setLeft(`${A-S}px`),b.setWidth(`${A-S/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,o.unref)(d),x=(0,o.unref)(s),v=(0,o.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,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"wrapperRef",ref:l,class:(0,o.normalizeClass)(["j-slider-captcha slider-border",n.class]),style:(0,o.normalizeStyle)([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:g,onMousemove:h,onMouseup:g,onTouchend:g,onTouchmove:h},[(0,o.createVNode)(ag,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),(0,o.createVNode)(rg,{ref_key:"contentRef",ref:c,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),(0,o.createVNode)(ng,{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))}}),sg=lg,Kl=ie(sg),cg=(0,o.defineComponent)({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{getMenuMap:i,toArray:r,activeMenu:l,theme:s}=Dn(),{getHMoreMenus:c}=Qr(),d=(0,o.ref)([]);n.pId==="moreId"?d.value=c.value:d.value=r(i()[n.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,ai.useVirtualList)(d,{itemHeight:44});return(g,m)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",(0,o.mergeProps)({class:["j-sub-menu-content",{"j-menu-dark":(0,o.unref)(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},(0,o.unref)(f)),[(0,o.createElementVNode)("div",(0,o.normalizeProps)((0,o.guardReactiveProps)((0,o.unref)(h))),[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(p),y=>((0,o.openBlock)(),(0,o.createBlock)(na,{key:y.data.value,"parent-actives":(0,o.unref)(l)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),dg=cg,ug={class:"j-menu-item-label"},fg={class:"j-menu-item-label"},pg={key:1,class:(0,o.normalizeClass)(["j-menu-item-arrow","sub"])},hg={class:"j-menu-item-label"},gg=(0,o.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:n}=Ze(),{activeMenuId:a}=Dn(),i=t,r=l=>{i("click",l)};return(l,s)=>{const c=(0,o.resolveComponent)("j-icon"),d=(0,o.resolveComponent)("el-tooltip"),u=(0,o.resolveComponent)("el-popover");return e.collapsed&&!e.item.hasChildren?((0,o.openBlock)(),(0,o.createBlock)(d,{key:0,placement:"right"},{content:(0,o.withCtx)(()=>[(0,o.createElementVNode)("span",null,(0,o.toDisplayString)((0,o.unref)(n)(e.item.label)),1)]),default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=(0,o.withModifiers)(p=>r(e.item),["stop"]))},[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,o.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,o.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,o.openBlock)(),(0,o.createBlock)(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",ug,(0,o.toDisplayString)((0,o.unref)(n)(e.item.label)),1),e.item.hasChildren?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:1,class:(0,o.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,o.createCommentVNode)("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?((0,o.openBlock)(),(0,o.createBlock)(u,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}])},[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,o.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,o.normalizeStyle)({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?((0,o.openBlock)(),(0,o.createBlock)(c,{key:0,icon:e.item.icon,style:(0,o.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,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",fg,(0,o.toDisplayString)((0,o.unref)(n)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?((0,o.openBlock)(),(0,o.createElementBlock)("div",pg)):(0,o.createCommentVNode)("",!0)],6)],2)]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(dg,{"p-id":e.item.value,onClick:r},null,8,["p-id"])]),_:1},8,["placement"])):((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:2,class:(0,o.normalizeClass)(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=(0,o.withModifiers)(p=>r(e.item),["stop"]))},[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,o.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,o.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,o.openBlock)(),(0,o.createBlock)(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:(0,o.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,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",hg,(0,o.toDisplayString)((0,o.unref)(n)(e.item.label)),1),e.item.hasChildren?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:1,class:(0,o.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,o.createCommentVNode)("",!0)],6)],2))}}}),na=gg,mg=(0,o.defineComponent)({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Dn(),l=u=>{a("click",u)},{list:s,containerProps:c,wrapperProps:d}=(0,ai.useVirtualList)((0,o.computed)(()=>n.menuList),{itemHeight:44});return(u,p)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",(0,o.mergeProps)({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":(0,o.unref)(r)==="dark"}]},(0,o.unref)(c)),[(0,o.createElementVNode)("div",(0,o.normalizeProps)((0,o.guardReactiveProps)((0,o.unref)(d))),[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(s),f=>((0,o.openBlock)(),(0,o.createBlock)(na,{key:f.data.value,"parent-actives":(0,o.unref)(i)?.pid?.split(".")||[],item:f.data,collapsed:e.collapsed,class:(0,o.normalizeClass)({"menu-item-entering":f.data.entering,"menu-item-leaving":f.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),yg=mg,vg=(0,o.defineComponent)({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Dn(),l=(0,o.ref)(),s=(0,o.ref)(0);let c=null;(0,o.onMounted)(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(c=new ResizeObserver(()=>{l.value&&(s.value=l.value.offsetWidth)}),c.observe(l.value))});const d=(0,o.computed)(()=>{const h=[];let g=0,m=0;const y=n.menuList.length;return n.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<n.menuList.length&&h.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),h}),u=(0,o.computed)(()=>{const h=[];let g=0;const m=d.value.length;return n.menuList.forEach(y=>{g++,g>=m&&h.push(y)}),h}),p=(0,o.computed)(()=>{const h=i.value?.pid?.split(".")||[];return(h.length>1&&u.value.findIndex(g=>g.value===h[1])>-1||u.value.findIndex(g=>g.value===i.value?.value)>-1)&&h.push("moreId"),h}),f=h=>{a("click",h)};return el({getHMoreMenus:u}),(0,o.onUnmounted)(()=>{c&&l.value&&(c.unobserve(l.value),c.disconnect(),c=null)}),(h,g)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"menuRef",ref:l,class:(0,o.normalizeClass)(["j-menu-horizontal",{"j-menu-dark":(0,o.unref)(r)==="dark"}])},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(d.value,m=>((0,o.openBlock)(),(0,o.createBlock)(na,{key:m.value,"parent-actives":p.value,item:m,"is-horizontal":"",onClick:f},null,8,["parent-actives","item"]))),128))],2))}}),bg=vg,wg=(0,o.defineComponent)({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Dn(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=(0,o.computed)(()=>(n.menuList.forEach((h,g)=>{h.color=l[g%l.length]}),n.menuList)),c=(0,o.computed)(()=>i.value?.pid?.split(".")||[]),d=h=>{a("click",h)},{list:u,containerProps:p,wrapperProps:f}=(0,ai.useVirtualList)(s,{itemHeight:96});return(h,g)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",(0,o.mergeProps)({class:["j-menu-vertical",{"j-menu-dark":(0,o.unref)(r)==="dark"}]},(0,o.unref)(p)),[(0,o.createElementVNode)("div",(0,o.normalizeProps)((0,o.guardReactiveProps)((0,o.unref)(f))),[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(u),m=>((0,o.openBlock)(),(0,o.createBlock)(na,{key:m.data.value,"parent-actives":c.value,item:m.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),Cg=wg,xg=(0,o.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 n=e,a=t;let i={};const r=(0,o.ref)("");r.value=n.activeId||"";const l=(m,y,w,x,v)=>{w=w||[];for(let C=0,_=w.length;C<_;C++){const b=w[C],B={};B.pid=y,B.indent=x,r.value===b.value&&(B.active=!0),Object.keys(b).forEach(T=>{T!=="children"&&(B[T]=b[T])}),v&&v.includes(b.value)&&(B.open=!0),m.push(B);const S=b.children||[];S.length>0&&(B.hasChildren=!0,v||(i[B.value]=S),(!v||B.open&&!n.collapsed)&&l(m,`${y}.${B.value}`,S,x+1,v))}},s=(m,y)=>{const w=[];return l(w,"0",m,0,y),w},c=(0,o.ref)([]);let d=[];const u=()=>{i={},d=s(n.menus);const m=[];if(r.value&&n.mode==="inline"){const y=d.find(w=>w.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(n.menus,m)};(0,o.watch)(()=>n.menus,()=>{u()},{immediate:!0}),(0,o.watch)(()=>n.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=[];n.mode==="inline"&&y.push(...m.pid.split(".")),c.value=s(n.menus,y)}}},f=(0,o.computed)(()=>d.find(m=>m.value===r.value));(0,o.watch)(()=>n.activeId,()=>{r.value=n.activeId||"",p()}),(0,o.watch)(()=>n.collapsed,()=>{if(n.collapsed)c.value=s(n.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(n.menus,m)}});const h=(0,o.computed)(()=>n.theme),g=m=>{if(console.log(m),m.hasChildren){if(n.collapsed)return;const y=[];y.push(...m.pid.split(".")),m.open||y.push(m.value);const w=s(n.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 Zr({getMenuMap:()=>i,toArray:s,activeMenu:f,activeMenuId:r,theme:h}),(m,y)=>e.mode==="inline"?((0,o.openBlock)(),(0,o.createBlock)(yg,{key:0,"menu-list":c.value,collapsed:e.collapsed,onClick:g},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?((0,o.openBlock)(),(0,o.createBlock)(bg,{key:1,"menu-list":c.value,onClick:g},null,8,["menu-list"])):((0,o.openBlock)(),(0,o.createBlock)(Cg,{key:2,"menu-list":c.value,onClick:g},null,8,["menu-list"]))}}),kg=xg,Gl=ie(kg),Sg={class:"j-keyword-panel"},Eg={key:0},Bg={key:1,class:"columns-wrapper"},Rg=(0,o.defineComponent)({name:"JKeywordPanel",__name:"keyword-panel",props:(0,o.mergeModels)({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:n}=Ze(),a=e,i=(0,o.useModel)(e,"checkAll"),r=(0,o.useModel)(e,"checkFields"),l=(0,o.ref)(!1),s=(0,o.ref)(""),c=(0,o.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=()=>{i.value||(i.value=!0,l.value=!1,r.value=[])},u=f=>{f.length>0?i.value=!1:i.value=!0};return t({init:()=>{i.value?l.value=!1:l.value=!0}}),(f,h)=>{const g=(0,o.resolveComponent)("j-icon"),m=(0,o.resolveComponent)("el-input"),y=(0,o.resolveComponent)("j-checkbox");return(0,o.openBlock)(),(0,o.createElementBlock)("div",Sg,[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["range-item",{active:i.value}]),onClick:d},[(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(n)("搜索全部")),1),i.value?((0,o.openBlock)(),(0,o.createBlock)(g,{key:0,icon:"mdi:check"})):(0,o.createCommentVNode)("",!0)],2),(0,o.createElementVNode)("div",{class:"range-item",onClick:h[0]||(h[0]=w=>l.value=!l.value)},[(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(n)("搜索特定字段")),1),(0,o.createVNode)(g,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Eg,[(0,o.createVNode)(m,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=w=>s.value=w),modelModifiers:{trim:!0},class:"no-border background",placeholder:(0,o.unref)(n)("搜索"),clearable:""},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(g,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):(0,o.createCommentVNode)("",!0),l.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Bg,[(0,o.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,o.createCommentVNode)("",!0)])}}}),_g=Rg,Tg={key:0,class:"title"},Mg={class:"content"},Ag={class:"relation"},Pg={style:{width:"72px"}},Vg={class:"btn-wrapper"},Ng={class:"field-wrapper"},jg={class:"buttons"},Og=(0,o.defineComponent)({name:"JFilterPanel",__name:"filter-panel",props:(0,o.mergeModels)({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:(0,o.mergeModels)(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:n}){const{t:a}=Ze(),i=e,r=(0,o.useModel)(e,"relation"),l=(0,o.useModel)(e,"isPin"),s=(0,o.ref)([]),c=()=>{l.value=!l.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:p.value.join(","),options:u.value}),config:{style:{width:l.value?"132px":"160px"},appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,change:({value:x,row:v})=>{const C=i.columns.find(B=>B.id===x)?.config||{};let _="eq",b="text";["options"].includes(C.dataType||"")?_="in":["dateTime"].includes(C.type||"")?(_="range",b="dateTime"):["number"].includes(C.type||"")&&(b="number"),v.method=_,v.type=C.valueType||b,v.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:x})=>{const v=i.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:l.value?"134px":"130px"},appendTo:l.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=i.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=i.columns.find(_=>_.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:l.value?"246px":"296px",flex:l.value?"auto":"1"},appendTo:l.value?void 0:".j-filter-panel"}}];(0,o.onMounted)(()=>{s.value=i.searchFieldList});const u=(0,o.computed)(()=>i.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,o.computed)(()=>s.value.map(x=>x.field)),f=({data:x})=>{if(p.value.includes(x.value))return;const v=i.columns.find(b=>b.id===x.value)?.config||{};let C="eq",_="text";["options","dataItem"].includes(v.dataType||"")?C="in":["dateTime"].includes(v.type||"")&&(C="range",_="dateTime"),s.value.push({field:x.value,method:C,type:v.valueType||_})},h=n,g=()=>{s.value.length=0},m=()=>{l.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,o.resolveComponent)("j-icon"),_=(0,o.resolveComponent)("j-select"),b=(0,o.resolveComponent)("j-button-select"),B=(0,o.resolveComponent)("j-button"),S=(0,o.resolveComponent)("j-input-rows"),T=(0,o.resolveComponent)("el-tooltip");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-filter-panel",{"is-pin":l.value}])},[l.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Tg,[(0,o.createVNode)(C,{icon:"mdi:filter-outline"}),(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(a)("筛选")),1)])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",Mg,[(0,o.createElementVNode)("div",Ag,[(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(a)("筛选出符合以下")),1),(0,o.createElementVNode)("div",Pg,[(0,o.createVNode)(_,{modelValue:r.value,"onUpdate:modelValue":v[0]||(v[0]=A=>r.value=A),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(a)("条件的数据")),1)]),(0,o.createElementVNode)("div",Vg,[(0,o.createVNode)(b,{label:"添加过滤条件",options:u.value,"model-value":p.value.join(","),onChange:f},null,8,["options","model-value"]),s.value.length>0?((0,o.openBlock)(),(0,o.createBlock)(B,{key:0,type:"text",danger:"",label:"删除全部",onClick:g})):(0,o.createCommentVNode)("",!0)]),(0,o.createElementVNode)("div",Ng,[(0,o.createVNode)(S,{modelValue:s.value,"onUpdate:modelValue":v[1]||(v[1]=A=>s.value=A),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),(0,o.createVNode)(T,{placement:"bottom",content:l.value?(0,o.unref)(a)("取消固定"):(0,o.unref)(a)("固定显示")},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{class:"pin-btn",onClick:c},[(0,o.createVNode)(C,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),(0,o.createElementVNode)("div",jg,[(0,o.createVNode)(B,{label:(0,o.unref)(a)("筛选"),type:"primary",onClick:m},null,8,["label"]),(0,o.createVNode)(B,{label:(0,o.unref)(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),ql=Og,Ig={class:"j-order-panel"},Lg={class:"content"},Hg={class:"btn-wrapper"},zg={class:"field-wrapper"},Dg={class:"buttons"},Fg=(0,o.defineComponent)({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:n}){const{t:a}=Ze(),i=e,r=n,l=(0,o.computed)(()=>i.columns.filter(g=>!g.children?.length&&g.config?.sorter?.isNot!==!0).map(g=>({label:g.config?.label,value:g.id}))),s=(0,o.ref)([]),c=(0,o.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,o.resolveComponent)("j-button-select"),w=(0,o.resolveComponent)("j-input-rows"),x=(0,o.resolveComponent)("j-button");return(0,o.openBlock)(),(0,o.createElementBlock)("div",Ig,[(0,o.createElementVNode)("div",Lg,[(0,o.createElementVNode)("div",Hg,[(0,o.createVNode)(y,{label:"添加排序规则",options:l.value,"model-value":c.value.join(","),onChange:u},null,8,["options","model-value"])]),(0,o.createElementVNode)("div",zg,[(0,o.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,o.createElementVNode)("div",Dg,[(0,o.createVNode)(x,{label:(0,o.unref)(a)("排序"),type:"primary",onClick:f},null,8,["label"]),s.value.length>0?((0,o.openBlock)(),(0,o.createBlock)(x,{key:0,label:(0,o.unref)(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):(0,o.createCommentVNode)("",!0)])])}}}),$g=Fg,Wg={class:"j-column-panel"},Ug={class:"content"},Jg={class:"search-wrapper"},Yg={class:"tree-wrapper"},Kg={class:"buttons"},Gg=(0,o.defineComponent)({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:n}){const{t:a}=Ze(),i=e,r=n,l=(0,o.ref)(),s=(0,o.ref)(""),c={},d=(0,o.ref)([]),u=(0,o.ref)([]),p=(b,B)=>{const S=[],T=new Map;b.forEach(R=>{T.set(R.id||"",R),c[R.id||""]=R});const A=new Set;return B&&B.length>0&&B.forEach(R=>{const j=T.get(R.id);if(j){A.add(j.id||"");const O={id:j.id||"",label:j.config?.label||j.id||"",type:j.type,display:j.config?.display!==!1};j.children&&j.children.length>0&&(O.children=p(j.children,R.children)),S.push(O)}}),b.forEach(R=>{if(!A.has(R.id||"")){const j={id:R.id||"",label:R.config?.label||R.id||"",type:R.type,display:R.config?.display!==!1};R.children&&R.children.length>0&&(j.children=p(R.children)),S.push(j)}}),S},f=(b,B)=>B.length===0?b:b.map(S=>{const T=B.some(R=>S.label.toLowerCase().includes(R.toLowerCase())),A=S.children?f(S.children,B):[];return T||A.length>0?{...S,children:A.length>0?A:S.children}:null}).filter(Boolean),h=(0,o.computed)(()=>{if(!s.value)return u.value;const b=s.value.split(/\s+/).filter(Boolean);return f(u.value,b)}),g=(0,o.ref)([]),m=(0,o.computed)(()=>{const b=new Map;if(i.columnConfig&&i.columnConfig.length>0){const B=S=>{S.forEach(T=>{b.set(T.id,T),T.children&&B(T.children)})};B(i.columnConfig)}return b}),y=()=>{const b=B=>{const S=[];return B.forEach(T=>{let A=!0;if(m.value.size>0){const R=m.value.get(T.id||"");R?A=R.display:A=T.config?.display!==!1}else A=T.config?.display!==!1;A&&(S.push(T.id||""),T.children&&S.push(...b(T.children)))}),S};g.value=b(i.columns)},w=(b,{node:B})=>{b.includes(B.id)?g.value.push(B.id):g.value=g.value.filter(S=>S!==B.id)},x=(b,B,S)=>S==="inner"?!1:b.parent===B.parent,v=()=>{const b=B=>B.map(S=>{const T={...S,display:g.value.includes(S.id)};return S.children&&(T.children=b(S.children)),T});r("save",b(u.value))},C=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),s.value="",l.value){const b=l.value;b.setCheck&&b.setCheck(g.value);const B=b.$refs?.treeRef||b;B?.setCheckedKeys&&B.setCheckedKeys(g.value)}r("save",void 0)};return t({init:()=>{y(),d.value=p(i.columns,i.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(b,B)=>{const S=(0,o.resolveComponent)("j-icon"),T=(0,o.resolveComponent)("el-input"),A=(0,o.resolveComponent)("j-tree"),R=(0,o.resolveComponent)("j-button");return(0,o.openBlock)(),(0,o.createElementBlock)("div",Wg,[(0,o.createElementVNode)("div",Ug,[(0,o.createElementVNode)("div",Jg,[(0,o.createVNode)(T,{modelValue:s.value,"onUpdate:modelValue":B[0]||(B[0]=j=>s.value=j),modelModifiers:{trim:!0},placeholder:(0,o.unref)(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(S,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,o.createElementVNode)("div",Yg,[(0,o.createVNode)(A,{ref_key:"treeRef",ref:l,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,o.createElementVNode)("div",Kg,[(0,o.createVNode)(R,{label:(0,o.unref)(a)("确定"),type:"primary",onClick:v},null,8,["label"]),(0,o.createVNode)(R,{label:(0,o.unref)(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),qg=Gg,Xg={class:"j-table-panel-left"},Zg={class:"j-table-panel-top"},Qg={class:"j-table-panel-top-right"},e0={key:0,style:{width:"200px"}},t0={class:"j-table-panel-main"},n0={class:"j-table-panel-loading"},o0={class:"j-table-panel-loading-content"},a0={class:"j-table-panel-loading-text"},i0={key:0,class:"j-table-panel-filter-panel"},r0=(0,o.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},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:n}){const{t:a}=Ze(),{openLayer:i}=Fn(),r=e,l=n;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=(0,o.ref)();let c=[];const d=(0,o.ref)(0),u=(0,o.ref)(1);let p=r.pageSize||100;const f=(0,o.ref)(0),h=(0,o.computed)(()=>f.value>0),g=(0,o.ref)([]),m=(0,o.ref)(!1),y=(0,o.computed)(()=>r.batchButtons&&r.batchButtons.length>0),w=(0,o.computed)(()=>g.value.length>0),x=(0,o.computed)(()=>y.value&&w.value&&r.isMultiple||m.value),v=(0,o.computed)(()=>r.isPage&&!x.value);y.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const C=le=>r.rowKey?r.rowKey.split(",").map(ce=>le[ce.trim()]).join("::"):"",_=(le,ce)=>{if(!ce||ce.length===0)return le.filter(ee=>ee.config?.display!==!1).map(ee=>ee.children&&ee.children.length>0?{...ee,children:_(ee.children)}:ee);const nt=new Map(le.map(ee=>[ee.id,ee])),Ke=[];return ce.forEach(ee=>{const Ge=nt.get(ee.id);if(Ge){if(ee.display){let Bt=Ge;Ge.children&&Ge.children.length>0&&(Bt={...Ge,children:_(Ge.children,ee.children)}),Ke.push(Bt)}nt.delete(ee.id)}}),le.forEach(ee=>{if(nt.has(ee.id)&&ee.config?.display!==!1){let Ge=ee;ee.children&&ee.children.length>0&&(Ge={...ee,children:_(ee.children)}),Ke.push(Ge)}}),Ke},b=(0,o.computed)(()=>_(r.columns,ze.value)),B=(0,o.computed)(()=>zr(r.columns,le=>le.config.label)),S=(0,o.ref)(""),T=(0,o.computed)(()=>B.value.some(le=>le.config?.filter?.isSearchKeyword)),A=(0,o.ref)(),R=(0,o.ref)(!0),j=(0,o.ref)([]),O=(0,o.computed)(()=>R.value?"搜索全部":`搜索范围:${B.value.filter(le=>j.value.includes(le.id)).map(le=>le.config?.label).join("、")}`),H=()=>{A.value.init()},M=(0,o.ref)(),E=(0,o.ref)(!1),L=(0,o.ref)(!1),$=(0,o.ref)(!1),Q=(0,o.ref)([]),se=(0,o.ref)("and"),ge=(0,o.ref)(),Ee=(0,o.ref)(!1),We=(0,o.ref)([]),X=()=>{ge.value.init(We.value)},Te=le=>{We.value=le,Ee.value=!1,me()},Ne=()=>{We.value=[],me()},ye=(0,o.ref)(),je=(0,o.ref)(!1),ze=(0,o.ref)(),G=(0,o.computed)(()=>ze.value!=null),pe=()=>{ye.value?.init()},xe=le=>{ze.value=le,je.value=!1},Me=(0,o.ref)(!1),ut=()=>{Me.value=!Me.value},ht=()=>{g.value=[],s.value&&(s.value.setSelection?.([]),m.value&&(m.value=!1,s.value.setRecords(c)))},Oe=()=>{m.value=!m.value,m.value?s.value?.setRecords(g.value):(console.log(c,"tableData"),s.value?.setRecords(c)),s.value?.setSelection?.(g.value)},vt=(0,o.computed)(()=>{if(g.value.length>0&&r.isMultiple){const le=[{id:"selection_count",label:`已选${g.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:m.value?"全部":"仅选中",config:{type:"text"},click:Oe},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:ht}],ce=r.batchButtons.map(nt=>({...nt,click:()=>{nt.click&&nt.click({data:g.value,openLayer:i})}}));return[...le,...ce]}return r.buttons}),gn=(0,o.computed)(()=>vt.value.filter(le=>le.config?.display!==!1)),Et=(0,o.ref)(null),F=(0,o.ref)(0),te=()=>{F.value=Et.value?.clientWidth||0};let J;(0,o.onMounted)(()=>{(0,o.nextTick)(te),J=new ResizeObserver(()=>{te()}),Et.value&&J.observe(Et.value)}),(0,o.onBeforeUnmount)(()=>{J?.disconnect()}),(0,o.watch)(()=>gn.value,()=>{(0,o.nextTick)(te)},{deep:!0}),(0,o.watch)(Me,()=>{(0,o.nextTick)(te)});const K=(0,o.computed)(()=>{const le=gn.value;if(le.length===0)return[];const ce=F.value;if(ce<=0)return le;const nt=Math.max(0,ce-4),Ke=(qe,wt)=>qe.groupId||`__auto_${wt}`,ee=qe=>{if(qe.config?.notLabel===!0||!qe.label)return 28;const wt=24,zt=kt(qe.label||"")||0,Rt=qe.config?.icon?18:0;return Math.ceil(zt+wt+Rt+2)};if((qe=>{let wt=0,zt=null;return qe.forEach((Rt,Ho)=>{const Wa=Ke(Rt,Ho);zt!==null&&(wt+=Wa===zt?-1:8),wt+=ee(Rt),zt=Wa}),wt})(le)<=nt)return le;const Bt={id:"__table_panel_more__",label:"",config:{icon:"mdi:dots-horizontal",notLabel:!0},children:[]},ot=28,Ct=[];let He=0,Lo=null;for(let qe=0;qe<le.length;qe++){const wt=le[qe],zt=Ke(wt,qe);let Rt=He;Lo!==null&&(Rt+=zt===Lo?-1:8),Rt+=ee(wt);const Ho=le.length-(qe+1)>0?(Rt>0?8:0)+ot:0;if(Rt+Ho<=nt)Ct.push(wt),He=Rt,Lo=zt;else break}const Nn=le.slice(Ct.length);if(Nn.length===0)return le;const $a={...Bt,children:Nn};return Ct.length===0?[$a]:[...Ct,$a]});let Z;const he=async le=>{f.value++;const ce={};le&&(Z=le),Z&&(ce.query=Z);try{const nt={};nt.rel=se.value,nt.cond=(M.value?.getSearchFields?.()||Q.value).filter(ee=>ee.value!==void 0&&ee.value!==null&&ee.value!==""||["empty","not_empty"].includes(ee.method)).map(ee=>({field:ee.field,method:ee.method,value:ee.value,type:ee.type})),nt.cond.length>0?$.value=!0:$.value=!1,ce.filter=nt;const Ke=We.value.map(ee=>ee.value+" "+ee.sord).join(",");if(S.value&&(ce.keyword={value:S.value,fields:R.value?B.value.filter(ee=>ee.config?.filter?.isSearchKeyword).map(ee=>ee.id):(0,o.unref)(j)}),r.loadData){if(r.isPage){ce.pagination={rows:p,page:u.value,sort:Ke||r.sort||r.rowKey};const ee=await r.loadData(ce)||{};c=ee.rows||[],d.value=ee.records||0}else ce.sort=Ke,c=await r.loadData(ce)||[],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)}},me=async()=>{u.value=1,await he()},Ie=({rows:le,page:ce})=>{p=le,u.value=ce,he()},it=async()=>{g.value=[],m.value=!1,u.value=1,Z=void 0,await he()},Le=async le=>{g.value=[],m.value=!1,await he(le)},mn=async()=>{await it()},Vn=le=>{l("ready",le)},Br=({selections:le,record:ce,checked:nt,isMultiple:Ke})=>{let ee=[];if(!r.isMultiple){g.value=le,l("select",{selections:le,record:ce,checked:nt,isMultiple:Ke});return}if(y.value)ee=le;else if(!r.rowKey)ee=le;else{const Ge=new Map(le.map(ot=>[C(ot),ot])),Bt=new Map(g.value.map(ot=>[C(ot),ot]));c.forEach(ot=>{const Ct=C(ot);Ge.has(Ct)?Bt.set(Ct,Ge.get(Ct)):Bt.delete(Ct)}),ee=Array.from(Bt.values())}g.value=ee,l("select",{selections:ee,record:ce,checked:nt,isMultiple:Ke}),m.value&&ee.length===0?(m.value=!1,s.value&&s.value.setRecords(c)):m.value&&ee.length>0&&s.value&&(s.value.setRecords(ee),s.value.setSelection?.(ee))},Da=()=>g.value||[],Oo=le=>{g.value=le,s.value?.setSelection?.(le)},Io=()=>s.value;return(0,o.onMounted)(async()=>{r.immediate&&await Le()}),t({refreshData:Le,resetData:it,getSelection:Da,setSelection:Oo,clearSelection:()=>{ht()},getTableRef:Io}),(le,ce)=>{const nt=(0,o.resolveComponent)("j-buttons"),Ke=(0,o.resolveComponent)("j-icon"),ee=(0,o.resolveComponent)("el-popover"),Ge=(0,o.resolveComponent)("el-tooltip"),Bt=(0,o.resolveComponent)("el-input"),ot=(0,o.resolveComponent)("j-button"),Ct=(0,o.resolveComponent)("j-table");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-table-panel-wrapper",{fullscreen:Me.value,"no-padding":e.noPadding||Me.value}])},[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-table-panel",{"j-table-panel-fullscreen":Me.value}])},[(0,o.createElementVNode)("div",Xg,[(0,o.createElementVNode)("div",Zg,[(0,o.createElementVNode)("div",{ref_key:"topLeftRef",ref:Et,class:"j-table-panel-top-left"},[(0,o.createVNode)(nt,{list:K.value},null,8,["list"])],512),(0,o.createElementVNode)("div",Qg,[T.value&&!x.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",e0,[(0,o.createVNode)(Bt,{modelValue:S.value,"onUpdate:modelValue":ce[2]||(ce[2]=He=>S.value=He),modelModifiers:{trim:!0},placeholder:(0,o.unref)(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:(0,o.withKeys)(me,["enter"]),onClear:me},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(Ke,{icon:"mdi:search"})]),suffix:(0,o.withCtx)(()=>[(0,o.createVNode)(Ge,{placement:"bottom",content:O.value},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",null,[(0,o.createVNode)(ee,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:H,onHide:me},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(Ke,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(_g,{ref_key:"keywordPanelRef",ref:A,"check-all":R.value,"onUpdate:checkAll":ce[0]||(ce[0]=He=>R.value=He),"check-fields":j.value,"onUpdate:checkFields":ce[1]||(ce[1]=He=>j.value=He),columns:B.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):(0,o.createCommentVNode)("",!0),e.showFilterButton&&!E.value&&!x.value?((0,o.openBlock)(),(0,o.createBlock)(ee,{key:1,visible:L.value,"onUpdate:visible":ce[6]||(ce[6]=He=>L.value=He),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:me},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:(0,o.normalizeClass)({active:$.value})},null,8,["class"])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(ql,{ref_key:"filterPanelRef",ref:M,"is-pin":E.value,"onUpdate:isPin":ce[3]||(ce[3]=He=>E.value=He),relation:se.value,"onUpdate:relation":ce[4]||(ce[4]=He=>se.value=He),"search-field-list":Q.value,columns:B.value,onFilter:me,onClose:ce[5]||(ce[5]=He=>L.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):(0,o.createCommentVNode)("",!0),e.showOrderButton&&!x.value?((0,o.openBlock)(),(0,o.createBlock)(Ge,{key:2,placement:"bottom",content:(0,o.unref)(a)("排序")},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",null,[(0,o.createVNode)(ee,{visible:Ee.value,"onUpdate:visible":ce[7]||(ce[7]=He=>Ee.value=He),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:X},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{class:(0,o.normalizeClass)({active:We.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)($g,{ref_key:"orderPanelRef",ref:ge,columns:B.value,onSave:Te,onClear:Ne},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,o.createCommentVNode)("",!0),e.showColumnButton&&!x.value?((0,o.openBlock)(),(0,o.createBlock)(Ge,{key:3,placement:"bottom",content:(0,o.unref)(a)("显示字段")},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",null,[(0,o.createVNode)(ee,{visible:je.value,"onUpdate:visible":ce[8]||(ce[8]=He=>je.value=He),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:pe},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{class:(0,o.normalizeClass)({active:G.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(qg,{ref_key:"columnPanelRef",ref:ye,columns:e.columns,"column-config":ze.value,onSave:xe},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,o.createCommentVNode)("",!0),e.showRefreshButton&&!x.value?((0,o.openBlock)(),(0,o.createBlock)(Ge,{key:4,placement:"bottom",content:(0,o.unref)(a)("刷新")},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{type:"text",icon:"mdi:refresh",onClick:mn})]),_:1},8,["content"])):(0,o.createCommentVNode)("",!0),e.showFullscreenButton?((0,o.openBlock)(),(0,o.createBlock)(Ge,{key:5,placement:"bottom",content:Me.value?(0,o.unref)(a)("退出全屏"):(0,o.unref)(a)("全屏")},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{type:"text",icon:Me.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:ut},null,8,["icon"])]),_:1},8,["content"])):(0,o.createCommentVNode)("",!0)])]),(0,o.createElementVNode)("div",t0,[(0,o.withDirectives)((0,o.createElementVNode)("div",n0,[(0,o.createElementVNode)("div",o0,[(0,o.createVNode)(Ke,{icon:"mdi:loading",class:"loading-spin",size:24}),(0,o.createElementVNode)("div",a0,(0,o.toDisplayString)((0,o.unref)(a)("加载中")),1)])],512),[[o.vShow,h.value]]),(0,o.createVNode)(Ct,{ref_key:"tableRef",ref:s,"table-page":u.value,"onUpdate:tablePage":ce[9]||(ce[9]=He=>u.value=He),columns:b.value,"sub-columns":e.subColumns,records:(0,o.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,"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:Ie,onReady:Vn,onSelectionChanged:Br},null,8,["table-page","columns","sub-columns","records","is-tree","default-expand-all","parent-key","is-show-number","is-sub-show-number","is-multiple","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,o.openBlock)(),(0,o.createElementBlock)("div",i0,[(0,o.createVNode)(ql,{ref_key:"filterPanelRef",ref:M,"is-pin":E.value,"onUpdate:isPin":ce[10]||(ce[10]=He=>E.value=He),relation:se.value,"onUpdate:relation":ce[11]||(ce[11]=He=>se.value=He),"search-field-list":Q.value,columns:B.value,onFilter:me},null,8,["is-pin","relation","search-field-list","columns"])])):(0,o.createCommentVNode)("",!0)],2)],2)}}}),l0=r0,vi=ie(l0),s0={class:"j-button-select"},c0={class:"search-wraper"},d0={class:"options-wraper"},u0=["onClick"],f0=(0,o.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 n=e,a=t,{t:i}=Ze(),r=(0,o.ref)(""),l=(0,o.computed)(()=>r.value===""?n.options:n.options.filter(d=>(d.label||"").includes(r.value))),s=(0,o.computed)(()=>n.modelValue?(n.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,o.resolveComponent)("j-button"),f=(0,o.resolveComponent)("j-icon"),h=(0,o.resolveComponent)("el-input"),g=(0,o.resolveComponent)("el-popover");return(0,o.openBlock)(),(0,o.createBlock)(g,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:(0,o.withCtx)(()=>[(0,o.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,o.withCtx)(()=>[(0,o.createElementVNode)("div",s0,[(0,o.createElementVNode)("div",c0,[(0,o.createVNode)(h,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=m=>r.value=m),modelModifiers:{trim:!0},placeholder:(0,o.unref)(i)("搜索"),class:"no-border",clearable:""},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(f,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,o.createElementVNode)("div",d0,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(l.value,m=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:m.value,class:(0,o.normalizeClass)(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:(0,o.withModifiers)(y=>c(m),["stop"])},[m.icon?((0,o.openBlock)(),(0,o.createBlock)(f,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(i)(m.label)),1)],10,u0))),128))])])]),_:1},8,["width"])}}}),p0=f0,Xl=ie(p0),h0={class:"j-tree-item-text"},g0={key:2,class:"j-tree-item-button-group"},m0={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},y0=(0,o.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:n}){const a=e,i=n,{useData:r,t:l}=Ze(),{getTreeData:s,loadData:c}=r(),d=(0,o.ref)(),u=(0,o.ref)(!1),p=(0,o.ref)(""),f=(0,o.ref)([]),h={children:"children",label:"label",disabled:"disabled"},g=(0,o.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,o.computed)(()=>a.dataCode||a.dataType?g.value:a.list?(0,o.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,o.nextTick)(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},w=(H,M=!0)=>{d.value?.setCurrentKey(H,M)},x=()=>d.value?.getCurrentKey(),v=(H,M=!1)=>{d.value?.setCheckedKeys(H,M)},C=(H=!1)=>d.value?.getCheckedKeys(H),_=async(H,M,E,L)=>{if(p.value=H.value,a.nodeClickFlow&&a.runFlow){const $=JSON.parse(a.nodeClickFlow);await a.runFlow($,{value:H.value})}a.click&&a.click(H.value,H,L)},b=(H,{checkedKeys:M,checkedNodes:E,halfCheckedKeys:L,halfCheckedNodes:$})=>{a.check&&a.check(M,{node:H,checkedNodes:E,halfCheckedKeys:L,halfCheckedNodes:$})},B=(H,M,E,L)=>{i("node-drop",H,M,E,L)},S=H=>{const M=xt(a.treeButtons);return H&&a.filterButton?a.filterButton({buttons:M,node:H}):M},{openLayer:T}=Fn(),A=(H,M)=>{H.config?.disabled||H.click&&H.click({data:M,openLayer:T})},R=(0,o.ref)(""),j=(H,M)=>{R.value=H?M.value:"",console.log(R.value,"row")},O=(H,M,E)=>a.allowDrop?a.allowDrop(H,M,E):!(E=="inner"&&!M.data.canInner);return(0,o.onMounted)(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),(0,o.watch)(()=>a.list,()=>{u.value=!0,(0,o.nextTick)(()=>{u.value=!1})}),(0,o.watch)(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:w,getValue:x,setCheck:v,getCheck:C}),(H,M)=>{const E=(0,o.resolveComponent)("j-icon"),L=(0,o.resolveComponent)("j-button"),$=(0,o.resolveComponent)("el-dropdown-item"),Q=(0,o.resolveComponent)("el-dropdown-menu"),se=(0,o.resolveComponent)("el-dropdown"),ge=(0,o.resolveComponent)("el-tree"),Ee=(0,o.resolveComponent)("el-empty"),We=(0,o.resolveDirective)("loading");return(0,o.withDirectives)(((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!u.value&&m.value.length>0?((0,o.openBlock)(),(0,o.createBlock)(ge,{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":O,"expand-on-click-node":e.expandOnClickNode,onNodeClick:_,onCheck:b,onNodeDrop:B},{default:(0,o.withCtx)(({node:X})=>[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-tree-item-wraper",{"is-focus":R.value===X.data.value}])},[X.data.openIcon?((0,o.openBlock)(),(0,o.createBlock)(E,{key:0,class:"j-tree-item-open-icon",size:18,icon:X.data.openIcon,color:X.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,o.createCommentVNode)("",!0),X.data[e.iconKey]||e.defaultIcon?((0,o.openBlock)(),(0,o.createBlock)(E,{key:1,class:"j-tree-item-default-icon",size:18,icon:X.data[e.iconKey]||e.defaultIcon||"",color:X.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",h0,(0,o.toDisplayString)(X.label),1),S(X.data).length?((0,o.openBlock)(),(0,o.createElementBlock)("div",g0,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(S(X.data),(Te,Ne)=>((0,o.openBlock)(),(0,o.createBlock)(se,{key:Ne,trigger:"click",onVisibleChange:ye=>j(ye,X.data)},{dropdown:(0,o.withCtx)(()=>[(0,o.createVNode)(Q,null,{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(Te.children,(ye,je)=>((0,o.openBlock)(),(0,o.createBlock)($,{key:je,disabled:ye.disabled,divided:ye.divided,onClick:(0,o.withModifiers)(ze=>A(ye,X.data),["stop"])},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{class:"j-flex-item",style:(0,o.normalizeStyle)({color:ye.danger?"var(--j-color-danger)":ye.color||e.buttonIconColor||"var(--j-color-text-2)"})},[ye.icon||e.buttonDefaultIcon?((0,o.openBlock)(),(0,o.createBlock)(E,{key:0,icon:ye.icon||e.buttonDefaultIcon},null,8,["icon"])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(l)(ye.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(L,{icon:Te.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):(0,o.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,o.openBlock)(),(0,o.createElementBlock)("div",m0,[(0,o.createVNode)(Ee,{description:(0,o.unref)(l)(e.emptyDes)},null,8,["description"])]))],2)),[[We,u.value]])}}}),v0=y0,Zl=ie(v0),b0=(0,o.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 n=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:i}=Ze(),{getTreeData:r}=i(),l=(0,o.computed)(()=>r?r({dataType:n.dataType,dataCode:n.dataCode,labelKey:n.labelKey||a[n.dataType]?.label||"label",valueKey:n.valueKey||a[n.dataType]?.value||"value",pidKey:n.pidKey||a[n.dataType]?.pidKey||"pid",idKey:n.idKey||a[n.dataType]?.idKey||"id",notLoad:!1})||[]:[]),s=(0,o.computed)(()=>n.dataCode||n.dataType?l.value:n.options||[]),c=t,d=(0,o.computed)({get(){return n.modelValue},set(p){c("update:modelValue",p)}}),u=p=>{c("change",p)};return(p,f)=>{const h=(0,o.resolveComponent)("el-tree-select");return(0,o.openBlock)(),(0,o.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:n,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"])}}}),w0=b0,Ql=ie(w0),es=ie(kl),C0=ii.default;async function x0(e,t,n){const a={...n};delete a.ruleIndex,delete a.trigger;const i=new C0({[e]:[a]});let r=[];try{await i.validate({[e]:t})}catch(l){l.errors?r=l.errors.map(({message:s})=>s):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function k0(e,t,n){const a=n.map((i,r)=>({...i,ruleIndex:r})).sort(({warningOnly:i,ruleIndex:r},{warningOnly:l,ruleIndex:s})=>!!i==!!l?r-s:i?1:-1);for(let i=0;i<a.length;i+=1){const r=a[i];"pattern"in r&&(t+="");const l=await x0(e,t,r);if(l!=="")return{name:e,errors:l}}}function S0(e,t){const n=(r,l,s,c,d)=>{Object.keys(l).forEach(u=>{let p=u;s&&(p=`${s}.${u}`);const f=l[u],{rules:h,myGridtableId:g}=t(p,s?l:void 0,()=>c,d);if(h.length){const m=a(p,f,h);r.push(m)}g&&f.forEach(m=>{n(r,m,g,f,s?l:void 0)})})},a=(r,l,s)=>k0(r,l,s);return{validateForm:async()=>{const r=(0,o.unref)(e),l=[];n(l,r,"");const s=await Promise.all(l),c={};return s.forEach(d=>{d&&(c[d.name]={msg:d.errors})}),c},validateField:a}}var E0=(0,o.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:n}){const a=e,i=n,{useData:r,existField:l,httpGet:s,httpPost:c,success:d,warning:u,error:p,info:f,t:h}=Ze();let g;r&&(g=r());const m=F=>{p&&p(F)},y=(0,o.ref)(!1),w=(0,o.computed)(()=>a.config?.gutter||16),x=(0,o.computed)(()=>a.config?.span||24),v=(0,o.computed)(()=>a.config?.labelWidth),C=(0,o.computed)(()=>a.config?.labelPosition||"right"),_=(0,o.computed)(()=>S.length===1&&(S[0].type==="j-tabs"||S[0].type==="j-layout"||S[0].config?.isAutoWindow)),b=(0,o.reactive)({}),B=(0,o.ref)({}),S=[],T={},A=(0,o.ref)({});let R={},j={},O=[],H={};const M=F=>{y.value&&$&&(F.getTableData||ci($,F.id,F.formData[F.id])),i("change",F)},E=F=>Xo(T[F]?.type||"")&&!T[F]?.config?.notInput||T[F]?.config?.isInput,L=F=>["j-table","j-input-rows","j-input-cards"].includes(T[F]?.type||"");let $;const Q=(F,te)=>{Object.keys(F).forEach(J=>{const K=F[J];te&&(J=te+"."+J),K!=null&&typeof K=="object"&&!Ko(K)&&Q(K,J),b[J]=K})},se=(F,te)=>{let J=F.id;return J||(F.config?.table&&F.config?.field?J=`${F.config.table}.${F.config.field}`:F.config?.table?J=F.config?.table:F.config?.field&&(J=F.config?.field),te&&L(te)&&(J=`${te}.${J}`)),J||qo("j")},ge=(F,te,J,K="")=>{F.forEach(Z=>{Z.id=se(Z,K);const he={id:Z.id,slot:Z.slot,type:Z.type||"",getCompType:Z.getCompType,getCompConfig:Z.getCompConfig,config:{},children:[]};te.push(he);const{children:me}=Z;so(he,Z,["children","config"]),so(he.config,Z.config||{},[]),T[Z.id]&&console.warn("有重复的组件id:"+Z.id),T[Z.id]=he,a.readonly===!0&&(he.config.readonly=!0);let Ie=!1,it;K!==""&&L(K)&&(Ie=!0,he.config=Z.config||{},he.config.parentTableId=K,it=T[K]?.config?.table);const Le=he.config||{};if(E(Z.id))!J&&Ie===!1&&(Le?.defaultValue===0?b[Z.id]=Le?.defaultValue:b[Z.id]=Le?.defaultValue||void 0),Le.table&&Le.field?R[`${Le.table}_${Le.field}`.toLowerCase()]=Z.id:Le.field&&(Ie?R[`${it}_${Le.field}`.toLowerCase()]=Z.id:R[`${Le.field}`.toLowerCase()]=Z.id);else if(Ie&&Le.field)R[`${it}_${Le.field}`.toLowerCase()]=Z.id;else if(L(Z.id))!J&&!Le.isSubTable&&(b[Z.id]=[]),Le.table&&(R[Le.table.toLowerCase()||""]=Z.id),Le.isSubTable||O.push(he);else if(Le?.defaultValue)b[Z.id]=Le?.defaultValue;else if(Z.type==="collapse"&&Le?.isExpand){const mn=[];(Le?.groups||[]).forEach(Vn=>{mn.push(Vn.i)}),b[Z.id]=mn}me&&me.length>0&&ge(me,he.children,J,he.id)})},Ee=async(F,te)=>{y.value=!1;const J=!!te;S.splice(0,S.length),R={},j={},O=[],$=te,Hn(b),Hn(T),A.value={},J&&Q(te,""),ge(F,S,J),H=xt(b),(0,o.nextTick)(()=>{y.value=!0,(0,o.nextTick)(()=>{gn(a.config?.codeInit,{})})})},We=(F,te,J)=>{const K=[];return te.forEach(Z=>{const he={};Object.keys(Z).forEach(me=>{if(!J||J(me,Z[me],F)){const Ie=xe(me);if(Ie?.type==="j-table")he[Ie?.id||""]=We(me,Z[me],J);else{let it=R[`${F}_${me}`.toLowerCase()]||me;it=it.indexOf(".")!==-1?it.split(".")[1]:it,he[it]=Z[me]}}}),K.push(he)}),K},X=(F,te)=>{Object.keys(F||{}).forEach(J=>{let K=F[J];const Z=xe(J);if(Z===void 0)K&&(Ko(K)&&(K=K[0]||{}),typeof K=="object"?Object.keys(K).forEach(he=>{if(!te||te(J,K[he],J)){let me=he;J!=="main"&&(me=`${J}_${he}`),j[me]=J,b[R[me.toLowerCase()]||he]=K[he]}}):b[J]=K);else if(L(Z.id||"")){if(!Array.isArray(K)){console.warn("表格数据不是数组:"+J);return}K?.length>0?b[R[J.toLowerCase()]||J]=We(J,K,te):b[R[J.toLowerCase()]||J]=[]}else(!te||te(J,K,J))&&(b[R[J.toLowerCase()]||J]=K)}),$&&Object.keys(b).forEach(J=>{const K=xe(J);(K===void 0||!["tabs","collapse"].includes(K.type||""))&&ci($,J,b[J])})},Te=(F,te=!1)=>{const J={};return Object.keys(F).forEach(K=>{if(K==="parentRow")return;const Z=T[K];if(Z){const he=Z.config?.table,me=Z.config?.field;if(te)me?J[me]=F[K]:J[K]=F[K];else if(L(K)){const Ie=[];F[K].forEach(it=>{Ie.push(Te(it,!0))}),J[he||K]=Ie}else he&&me?(J[he]=J[he]||{},J[he][me]=F[K]):me&&(J[me]=F[K])}else te?K!=="_X_ROW_KEY"&&K!=="_isHover"&&(J[K]=F[K]):j[K]?(J[j[K]]=J[j[K]]||{},J[j[K]][K.replace(`${j[K]}_`,"")]=F[K]):J[K]=F[K]}),J},Ne=(F=!0)=>F?Te(b):b,ye=(F,te,J,K)=>{let Z=T[F];if(Z==null){const me=F.split(".");Z=T[me[me.length-1]]||{}}if(!Z)return{};const he=bn({config:{...Z.config||{},...A.value[Z.id||""]||{}},getCompConfig:Z.getCompConfig,formData:b,getTableData:J,row:te,pRowData:K});return he._componentId=Z?.id,he},je=(F,te,J,K)=>{const Z=ye(F,te,J,K);if(Z.isNotRule!==!0&&Z.display!==!1){const he=Z.rule||[],me=he.find(Ie=>Ie.type==="only");return me&&(me.validator=async(Ie,it)=>{if(it&&!await l({table:Ie.table,key:Ie.key,keyName:Ie.keyName,field:Ie.field,keyValue:Ie.getKeyValue?Ie.getKeyValue():"",value:it,paramNames:Ie.paramNames,getParams:Ie.getParams,withProjectId:Ie.withProjectId,getValue:Ie.getValue,formData:b}))throw h(Ie.message)||h("数据值重复")}),{rules:he,myGridtableId:L(Z._componentId)?Z._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:ze}=S0(b,je),G=async()=>{B.value={};const F=await ze();return Object.keys(F).length>0?(B.value=F,m(`${h(T[Object.keys(F)[0]]?.config?.label)}:${h(F[Object.keys(F)[0]].msg)}`),!1):!0},pe=()=>{B.value={},Hn(b),Object.keys(H||{}).forEach(F=>{b[F]=H[F]})},xe=F=>{let te=T[F];return te===void 0&&R[F.toLowerCase()]&&(te=T[R[F.toLowerCase()]]),te},Me=({id:F,i:te,value:J,type:K})=>{if(K==="add")b[F].push(J);else if(K==="delete")b[F].splice(te,1);else{const Z=xe(F);Z&&(Z.config.parentTableId?b[Z.config.parentTableId][te][F]=J:b[F]=J)}},ut=({id:F,i:te})=>{const J=xe(F);if(J){if(J.config.parentTableId){const K=b[J.config.parentTableId],Z=J.id?J.id.replace(`${J.config.parentTableId}.`,""):"";if(te!=null)return(K[te]||{})[Z||""];const he=[];return K&&K.forEach(me=>{he.push(me[Z||""])}),he}if(L(J.id||"")){const K=[];return b[J.id||""].forEach(Z=>{K.push(Te(Z,!0))}),K}return b[J.id||""]}if(b[F])return b[F]},ht=async({id:F,i:te})=>{const J=ut({id:F,i:te}),K=xe(F);if(K&&g?.getLabel)if(te!==void 0){const Z=J[te],he=b[K.config.parentTableId||""][te],me=bn({config:K.config,getCompConfig:K.getCompConfig,formData:b,tableData:b[K.config.parentTableId||""],row:he});return await g?.getLabel({value:Z,config:me,formData:b,tableData:b[K.config.parentTableId||""],row:he})}else{const Z=bn({config:K.config,getCompConfig:K.getCompConfig,formData:b});return await g?.getLabel({value:J,config:Z,formData:b})}return J},Oe=async(F,te)=>g?.loadViewDataList?await g?.loadViewDataList(F,te,!1):[],vt=F=>(F.set=Me,F.get=ut,F.setFormData=X,F.getFormData=Ne,F.getLabel=ht,F.getViewData=Oe,F.getDateNow=te=>fi(new Date,te||"YYYY-MM-DD HH:mm:ss"),F.httpGet=s||(()=>{console.log("当前状态不支持")}),F.httpPost=c||(()=>{console.log("当前状态不支持")}),F.loading=te=>{zn(te)},F.showMsg=({text:te,type:J})=>{switch(J){case"success":d&&d(te);break;case"warning":u&&u(te);break;case"error":p&&p(te);break;case"info":f&&f(te);break;default:f&&f(te);break}console.log("showMsg",te,J)},F),gn=async(F,te)=>{if(F&&F.trim()){F=`async (jcode) => {${F}}`;const{res:J,fn:K}=si(F);J&&await K(vt(te))}},Et=(F,te)=>{A.value[F]={...A.value[F]||{},...te}};return a.schema&&Ee(a.schema),hi({formData:b,compsConfig:A,errorFields:B,isAutoWindow:_,gutter:w,span:x,labelWidth:v,labelPosition:C,getValue:ut,formChange:M}),gi({contextType:"form"}),t({init:Ee,reset:pe,validate:G,setValue:Me,getValue:ut,getLabel:ht,setFormData:X,getFormData:Ne,setCompConfig:Et}),(F,te)=>{const J=(0,o.resolveComponent)("j-form-item"),K=(0,o.resolveComponent)("el-row"),Z=(0,o.resolveComponent)("el-form");return y.value?((0,o.openBlock)(),(0,o.createBlock)(Z,{key:0,class:(0,o.normalizeClass)([{"j-block":e.isAutoSize},{"j-form-auto":e.isAutoSize},"j-form"]),"label-position":C.value,"label-width":v.value,size:e.config?.size,onSubmit:te[0]||(te[0]=(0,o.withModifiers)(()=>{},["prevent"]))},{default:(0,o.withCtx)(()=>[_.value?((0,o.openBlock)(),(0,o.createBlock)(J,(0,o.mergeProps)({key:0},S[0],{"is-not-col":""}),null,16)):((0,o.openBlock)(),(0,o.createBlock)(K,{key:1,gutter:w.value},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(S,he=>(0,o.createVNode)(J,(0,o.mergeProps)({key:he.id,ref_for:!0},he),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):(0,o.createCommentVNode)("",!0)}}}),B0=E0,ts=ie(B0),ns=ie(xl),R0={class:"j-page"},_0=(0,o.defineComponent)({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const n=e,a=(0,o.ref)(!1),i=(0,o.reactive)([]),r={},l=(0,o.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=[],so(w.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(l[y.id]=y.config.defaultValue),m.push(w),x&&x.length>0&&(w.children=[],s(x,w.children))})},c=g=>{a.value=!1,i.splice(0,i.length),Hn(r),Hn(l),s(g,i),(0,o.nextTick)(()=>{a.value=!0})};n.schema&&c(n.schema);const d=new pi,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 il({registerMethod:(g,m)=>(f(g,m),()=>{h(g,m)})}),gi({contextType:"page"}),t({init:c,call:p,on:f,off:h}),(g,m)=>{const y=(0,o.resolveComponent)("j-comp");return(0,o.openBlock)(),(0,o.createElementBlock)("div",R0,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(i,w=>((0,o.openBlock)(),(0,o.createBlock)(y,{key:w.id,id:w.id,type:w.type,config:w.config,children:w.children},null,8,["id","type","config","children"]))),128))])}}}),T0=_0,os=ie(T0),M0=(0,o.defineComponent)({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,i=(0,o.ref)("");return(0,o.watch)(()=>n.modelValue,r=>{r?i.value=r:(i.value=Wt(),a("update:modelValue",i.value))},{immediate:!0}),(r,l)=>{const s=(0,o.resolveComponent)("el-input");return(0,o.openBlock)(),(0,o.createBlock)(s,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=c=>i.value=c),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),A0=M0,as=ie(A0),P0={key:0,class:"j-panel-top"},V0=["title"],N0={style:{margin:"0","font-size":"14px"}},j0={key:1},O0={key:1,class:"j-panel-bottom"},I0=(0,o.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}=Fn(),n=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,i)=>{const r=(0,o.resolveComponent)("j-button"),l=(0,o.resolveComponent)("el-tooltip"),s=(0,o.resolveComponent)("j-buttons");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"j-block",style:(0,o.normalizeStyle)({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[(0,o.createElementVNode)("div",{class:"j-panel",style:(0,o.normalizeStyle)({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?((0,o.openBlock)(),(0,o.createElementBlock)("div",P0,[e.notTitle?(0,o.createCommentVNode)("",!0):((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,class:"j-panel-top-left",title:e.title||""},[(0,o.renderSlot)(a.$slots,"title",{},()=>[(0,o.createElementVNode)("span",N0,(0,o.toDisplayString)(e.title||""),1)])],8,V0)),e.toolBtns&&e.toolBtns.length>0?((0,o.openBlock)(),(0,o.createElementBlock)("span",j0,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.toolBtns,c=>((0,o.openBlock)(),(0,o.createBlock)(l,{key:c.id,placement:"top",content:c.label||""},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(r,(0,o.mergeProps)({ref_for:!0},c.config,{onClick:d=>n(c),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):(0,o.createCommentVNode)("",!0)])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",{class:"j-panel-body",style:(0,o.normalizeStyle)(e.bodyStyle)},[(0,o.renderSlot)(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?((0,o.openBlock)(),(0,o.createElementBlock)("div",O0,[(0,o.createVNode)(s,{list:e.bootmBtns},null,8,["list"]),(0,o.createVNode)(s,{list:e.bootmRightBtns},null,8,["list"])])):(0,o.createCommentVNode)("",!0)],4)],4)}}}),L0=I0,is=ie(L0),H0={class:"j-input-rows"},z0={key:0,class:"j-input-rows-num"},D0={key:1,class:"j-input-rows-char"},F0=(0,o.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 n=C=>C==null,a=e,i=t,{formData:r}=Gt(),l=(0,o.computed)(()=>a.editConfig.isAddBtn!==!1),s=(0,o.computed)(()=>a.editConfig.addBtnText||"添加"),c=(0,o.computed)(()=>a.editConfig.buttonsAlign||"left"),d=(0,o.computed)(()=>a.editConfig.isRemoveBtn!==!1),u=(0,o.computed)(()=>a.editConfig.readonly),p=(0,o.computed)(()=>a.editConfig.drag),f=(0,o.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,o.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,o.ref)([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(C=>{C._i||(C._i=Wt())})):(m.value=[],i("update:modelValue",m.value)),(0,o.watch)(()=>a.modelValue,C=>{m.value=a.modelValue||[],m.value=C||[],m.value.forEach(_=>{_._i||(_._i=Wt())})},{deep:!0});const w=()=>{const C={_i:Wt()};a.columns.forEach(_=>{const b=_.config?.valueRowKey||_.id||"";b&&(C[b]=xt(_.config?.defaultValue))}),m.value.push(C),i("change",{id:a.id,value:C,data:C,formData:r,tableData:m.value,type:"add"})},x=C=>{const _=m.value[C];m.value.splice(C,1),i("change",{id:a.id,value:_,data:_,formData:r,tableData:m.value,type:"delete"})},v=C=>{i("rowChange",C)};return(0,o.onMounted)(()=>{if(!p.value||!h.value)return;const C=h.value,{initSortable:_}=Kr(C,{handle:".j-input-rows-drag",onEnd:b=>{const{oldIndex:B,newIndex:S}=b;if(n(B)||n(S)||B===S||B<0||S<0)return;const T=m.value.splice(B,1)[0];m.value.splice(S,0,T),i("change",{id:a.id,value:T,data:T,formData:r,tableData:m.value,type:"sort"})}});_()}),fo({getTableData:()=>m.value,rowChange:v}),(C,_)=>{const b=(0,o.resolveComponent)("j-comp"),B=(0,o.resolveComponent)("j-icon"),S=(0,o.resolveComponent)("j-button");return(0,o.openBlock)(),(0,o.createElementBlock)("div",H0,[(0,o.createElementVNode)("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(m.value,(T,A)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:T._i+A,class:(0,o.normalizeClass)([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?((0,o.openBlock)(),(0,o.createElementBlock)("div",z0,(0,o.toDisplayString)(A+1),1)):(0,o.createCommentVNode)("",!0),e.showChar?((0,o.openBlock)(),(0,o.createElementBlock)("div",D0,(0,o.toDisplayString)(g[A%26]),1)):(0,o.createCommentVNode)("",!0),((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.columns,R=>((0,o.openBlock)(),(0,o.createBlock)(b,(0,o.mergeProps)({key:R.id,ref_for:!0},R,{row:T}),null,16,["row"]))),128)),p.value?((0,o.openBlock)(),(0,o.createBlock)(B,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):(0,o.createCommentVNode)("",!0),d.value&&(f.value||m.value.length>1)&&!u.value?((0,o.openBlock)(),(0,o.createBlock)(B,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:R=>x(A)},null,8,["onClick"])):(0,o.createCommentVNode)("",!0)],2))),128))],512),!u.value&&l.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,style:(0,o.normalizeStyle)({"text-align":c.value}),class:"j-input-rows-actions"},[l.value?((0,o.openBlock)(),(0,o.createBlock)(S,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:w},null,8,["label"])):(0,o.createCommentVNode)("",!0)],4)):(0,o.createCommentVNode)("",!0)])}}}),$0=F0,rs=ie($0),W0={class:"j-input-layer"},U0=(0,o.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 n=g=>!!(g==null||typeof g=="string"&&g.trim()===""||Array.isArray(g)&&g.length===0),a=e,i=t,r=(0,o.ref)(),l=(0,o.ref)(),s=(0,o.ref)(""),c=(0,o.computed)({get(){return a.modelValue},set(g){i("update:modelValue",g)}}),d=(0,o.computed)({get(){return n(c.value)?"":n(s.value)?a.getText?a.getText(c.value):c.value:s.value},set(g){g||p()}});(0,o.watch)(()=>a.modelValue,()=>{s.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},p=()=>{s.value="",c.value="",i("change",{value:"",data:void 0})},f=async()=>{if(!l.value)return;const g=l.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(","),i("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,i("change",{value:x,data:m})}else s.value="",c.value="",i("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},h=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(g,m)=>{const y=(0,o.resolveComponent)("el-input");return(0,o.openBlock)(),(0,o.createElementBlock)("div",W0,[e.onlyButton?((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(Go),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):((0,o.openBlock)(),(0,o.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,o.createSlots)({_:2},[e.readonly?void 0:{name:"append",fn:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(Go),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),(0,o.createVNode)((0,o.unref)(yi),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:f,onClosed:h},{default:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(vi),{ref_key:"tableRef",ref:l,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"])])}}}),J0=U0,ls=ie(J0),Y0=(0,o.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,n=Gt(),{t:a}=Ze(),i=(0,o.computed)(()=>t.formConfig?.gutter||16),r=(0,o.computed)(()=>t.formConfig?.span||24),l=(0,o.computed)(()=>t.formConfig?.labelWidth||n.labelWidth?.value),s=(0,o.computed)(()=>t.formConfig?.labelPosition||n.labelPosition?.value||"right"),c=(0,o.computed)(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=(0,o.ref)(!1),u=()=>{d.value=!0};return hi({...n,isAutoWindow:c,gutter:i,span:r,labelWidth:l}),(p,f)=>{const h=(0,o.resolveComponent)("j-button"),g=(0,o.resolveComponent)("j-form-item"),m=(0,o.resolveComponent)("el-row"),y=(0,o.resolveComponent)("el-form"),w=(0,o.resolveComponent)("j-dialog");return(0,o.openBlock)(),(0,o.createElementBlock)("div",null,[(0,o.createVNode)(h,(0,o.mergeProps)(p.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),(0,o.createVNode)(w,{visible:d.value,"onUpdate:visible":f[1]||(f[1]=x=>d.value=x),title:(0,o.unref)(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(y,{class:(0,o.normalizeClass)(["j-block","j-layer-form"]),"label-position":s.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:f[0]||(f[0]=(0,o.withModifiers)(()=>{},["prevent"]))},{default:(0,o.withCtx)(()=>[c.value?((0,o.openBlock)(),(0,o.createBlock)(g,(0,o.normalizeProps)((0,o.mergeProps)({key:0},e.schema[0])),null,16)):((0,o.openBlock)(),(0,o.createBlock)(m,{key:1,gutter:i.value},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.schema,x=>((0,o.openBlock)(),(0,o.createBlock)(g,(0,o.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"])])}}}),K0=Y0,ss=ie(K0),G0=(0,o.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 n=e,a=t,i=(0,o.computed)({get(){return n.modelValue},set(l){a("update:modelValue",l)}}),r=l=>{a("change",l)};return(0,o.onMounted)(()=>{n.autoFocus&&!n.readonly&&setTimeout(()=>{const l=i.value===n.activeValue?n.inactiveValue:n.activeValue;i.value=l,r(l)},100)}),(l,s)=>{const c=(0,o.resolveComponent)("el-switch");return(0,o.openBlock)(),(0,o.createBlock)(c,(0,o.mergeProps)(l.$attrs,{id:e.id,modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=d=>i.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,o.createSlots)({_:2},[l.$slots["active-action"]?{name:"active-action",fn:(0,o.withCtx)(()=>[(0,o.renderSlot)(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:(0,o.withCtx)(()=>[(0,o.renderSlot)(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:(0,o.withCtx)(()=>[(0,o.renderSlot)(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:(0,o.withCtx)(()=>[(0,o.renderSlot)(l.$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"])}}}),q0=G0,cs=ie(q0),X0=(0,o.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 n=t,a=d=>{n("update:modelValue",d)},i=(d,u)=>{n("tab-click",d,u)},r=d=>{n("tab-change",d)},l=d=>{n("tab-remove",d)},s=()=>{n("tab-add")},c=(d,u)=>{n("edit",d,u)};return(d,u)=>{const p=(0,o.resolveComponent)("el-tabs");return(0,o.openBlock)(),(0,o.createBlock)(p,(0,o.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:i,onTabChange:r,onTabRemove:l,onTabAdd:s,onEdit:c}),{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(d.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}}),Z0=X0,ds=ie(Z0),Q0=(0,o.defineComponent)({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const n=t,a=r=>{n("update:modelValue",r)},i=r=>{n("change",r)};return(r,l)=>{const s=(0,o.resolveComponent)("el-collapse");return(0,o.openBlock)(),(0,o.createBlock)(s,(0,o.mergeProps)(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:i,"onUpdate:modelValue":a}),{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}}),em=Q0,us=ie(em),tm={class:"j-editor"},nm=(0,o.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 n=e,a=t,i=(0,o.ref)(),r=(0,o.ref)(),l=(0,o.shallowRef)(),s=(0,o.computed)(()=>({height:typeof n.height=="number"?`${n.height}px`:n.height,overflowY:"hidden"}));let c=!1;const d=p=>{if(!p)return"";let f=p;return n.apiUrl&&n.token&&(f=f.replace(/{learun_img_api}/g,`${n.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${n.token}`)),f},u=p=>{if(!p)return"";let f=p;if(n.apiUrl){const h=`${n.apiUrl}/system/annexesfile/`;f=f.split(h).join("{learun_img_api}"),n.token&&(f=f.split(`token=${n.token}`).join("{learun_img_token}"))}return f};return(0,o.onMounted)(()=>{const p={placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,MENU_CONF:{},...n.options};p.onChange=h=>{if(c)return;const g=u(h.getHtml());a("update:value",g),a("change",{value:g})};const f=(0,Rr.createEditor)({selector:i.value,html:d(n.value),config:p,mode:"default"});l.value=f,(0,Rr.createToolbar)({editor:f,selector:r.value,mode:"default"})}),(0,o.watch)(()=>n.value,p=>{const f=l.value;if(f){const h=f.getHtml(),g=d(p);u(h)!==p&&(c=!0,f.setHtml(g),c=!1)}}),(0,o.watch)(()=>n.readonly,p=>{const f=l.value;f&&(p?f.disable():f.enable())}),(0,o.onBeforeUnmount)(()=>{const p=l.value;p?.destroy()}),(p,f)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",tm,[(0,o.createElementVNode)("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),(0,o.createElementVNode)("div",{ref_key:"editorRef",ref:i,class:"j-editor-content",style:(0,o.normalizeStyle)(s.value)},null,4)]))}}),om=Nl(nm,[["__scopeId","data-v-179ac616"]]),fs=ie(om),am={key:0,class:"j-map-loading"},im=(0,o.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:n}){const a=e,i=n,r=(0,o.ref)(!0),l=(0,o.ref)();let s=null,c=null,d=null,u=null;const p=async()=>{r.value=!0;try{s=await Gr(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(!l.value)return;c=new s.Map(l.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),i("update:address",w.address),i("update:lng",y.lng),i("update:lat",y.lat),i("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 _=0;_<C;_++)v.push(x.getPoi(_))}w(v)}})),g.search(y))}}),(0,o.onMounted)(()=>{p()}),(y,w)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"j-map",style:(0,o.normalizeStyle)({height:e.height})},[r.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",am,[(0,o.createVNode)(vn,{icon:"mdi:loading",class:"is-loading",size:30})])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}),rm=im,lm=ie(rm);function ps(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Wn(e){return e.originalEvent||e.srcEvent}function bi(e){ps(e),ps(Wn(e))}function Un(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 hs=1500;function gs(e,t,n){var a=this,i=n.get("dragging",!1);function r(l){if(!l.hover){var s=l.originalEvent,c=a._findTargetGfx(s),d=c&&e.get(c);c&&d&&(l.stopPropagation(),i.hover({element:d,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(l){t.once("drag.move",hs,function(s){r(s)})}),(function(){var l,s;t.on("element.hover",function(c){l=c.gfx,s=c.element}),t.on("element.hover",hs,function(c){s&&t.fire("element.out",{element:s,gfx:l})}),t.on("element.out",function(){l=null,s=null})})(),this._findTargetGfx=function(l){var s,c;if(l instanceof MouseEvent)return s=Un(l),c=document.elementFromPoint(s.x,s.y),sm(c)}}gs.$inject=["elementRegistry","eventBus","injector"];function sm(e){return(0,W.closest)(e,"svg, .djs-element",!0)}var cm={__init__:["hoverFix"],hoverFix:["type",gs]};function ms(){return/mac/i.test(navigator.platform)}function ys(e,t){return(Wn(e)||e).button===t}function qt(e){return ys(e,0)}function dm(e){return ys(e,1)}function vs(e){var t=Wn(e)||e;return qt(e)?ms()?t.metaKey:t.ctrlKey:!1}function wi(e){var t=Wn(e)||e;return qt(e)&&t.shiftKey}function ho(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function um(e){return["M",e.x,e.y]}function Ci(e){return["L",e.x,e.y]}function fm(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function pm(e,t){const n=e.length,a=[um(e[0])];for(let i=1;i<n;i++){const r=e[i-1],l=e[i],s=e[i+1];if(!s||!t){a.push(Ci(l));continue}const c=Math.min(t,xi(l.x-r.x,l.y-r.y),xi(s.x-l.x,s.y-l.y));if(!c){a.push(Ci(l));continue}const d=oa(l,r,c),u=oa(l,r,c*.5),p=oa(l,s,c),f=oa(l,s,c*.5);a.push(Ci(d)),a.push(fm(u,f,p))}return a}function oa(e,t,n){const a=t.x-e.x,i=t.y-e.y,r=n/xi(a,i);return{x:e.x+a*r,y:e.y+i*r}}function xi(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ki(e,t,n){(0,k.isNumber)(t)&&(n=t,t=null),t||(t={});const a=(0,P.create)("path",t);return(0,k.isNumber)(n)&&(a.dataset.cornerRadius=String(n)),bs(a,e)}function bs(e,t){return(0,P.attr)(e,{d:ho(pm(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function hm(e){return!0}function aa(e){return qt(e)||dm(e)}var ws=500;function Cs(e,t,n){var a=this;function i(S,T,A){if(!s(S,T)){var R,j,O;A?j=t.getGraphics(A):(R=T.delegateTarget||T.target,R&&(j=R,A=t.get(j))),!(!j||!A)&&(O=e.fire(S,{element:A,gfx:j,originalEvent:T}),O===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function l(S){return r[S]}function s(S,T){return!(d[S]||qt)(T)}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":hm,"element.mousedown":aa,"element.mouseup":aa,"element.click":aa,"element.dblclick":aa};function u(S,T,A){var R=c[S];if(!R)throw new Error("unmapped DOM event name <"+S+">");return i(R,T,A)}var p="svg, .djs-element";function f(S,T,A,R){var j=r[A]=function(O){i(A,O)};R&&(d[A]=R),j.$delegate=W.delegate.bind(S,p,T,j)}function h(S,T,A){var R=l(A);R&&W.delegate.unbind(S,T,R.$delegate)}function g(S){(0,k.forEach)(c,function(T,A){f(S,A,T)})}function m(S){(0,k.forEach)(c,function(T,A){h(S,A,T)})}e.on("canvas.destroy",function(S){m(S.svg)}),e.on("canvas.init",function(S){g(S.svg)}),e.on(["shape.added","connection.added"],function(S){var T=S.element,A=S.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:A})}),e.on(["shape.changed","connection.changed"],ws,function(S){var T=S.element,A=S.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:A})}),e.on("interactionEvents.createHit",ws,function(S){var T=S.element,A=S.gfx;a.createDefaultHit(T,A)}),e.on("interactionEvents.updateHit",function(S){var T=S.element,A=S.gfx;a.updateDefaultHit(T,A)});var y=_("djs-hit djs-hit-stroke"),w=_("djs-hit djs-hit-click-stroke"),x=_("djs-hit djs-hit-all"),v=_("djs-hit djs-hit-no-move"),C={all:x,"click-stroke":w,stroke:y,"no-move":v};function _(S,T){return T=(0,k.assign)({stroke:"white",strokeWidth:15},T||{}),n.cls(S,["no-fill","no-border"],T)}function b(S,T){var A=C[T];if(!A)throw new Error("invalid hit type <"+T+">");return(0,P.attr)(S,A),S}function B(S,T){(0,P.append)(S,T)}this.removeHits=function(S){(0,k.forEach)((0,W.queryAll)(".djs-hit",S),P.remove)},this.createDefaultHit=function(S,T){var A=S.waypoints,R=S.isFrame,j;return A?this.createWaypointsHit(T,A):(j=R?"stroke":"all",this.createBoxHit(T,j,{width:S.width,height:S.height}))},this.createWaypointsHit=function(S,T){var A=ki(T);return b(A,"stroke"),B(S,A),A},this.createBoxHit=function(S,T,A){A=(0,k.assign)({x:0,y:0},A);var R=(0,P.create)("rect");return b(R,T),(0,P.attr)(R,A),B(S,R),R},this.updateDefaultHit=function(S,T){var A=(0,W.query)(".djs-hit",T);if(A)return S.waypoints?bs(A,S.waypoints):(0,P.attr)(A,{width:S.width,height:S.height}),A},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=l,this.registerEvent=f,this.unregisterEvent=h}Cs.$inject=["eventBus","elementRegistry","styles"];var Si={__init__:["interactionEvents"],interactionEvents:["type",Cs]};function Jn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(a){var i=a.element;n.deselect(i)}),e.on(["diagram.clear","root.set"],function(a){n.select(null)})}Jn.$inject=["eventBus","canvas"],Jn.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(n!==-1){var a=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},Jn.prototype.get=function(){return this._selectedElements},Jn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},Jn.prototype.select=function(e,t){var n=this._selectedElements,a=n.slice();(0,k.isArray)(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(l){return r===i.findRoot(l)}),t?(0,k.forEach)(e,function(l){n.indexOf(l)===-1&&n.push(l)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:n})};var xs="hover",ks="selected";function Ss(e,t){this._canvas=e;function n(i,r){e.addMarker(i,r)}function a(i,r){e.removeMarker(i,r)}t.on("element.hover",function(i){n(i.element,xs)}),t.on("element.out",function(i){a(i.element,xs)}),t.on("selection.changed",function(i){function r(d){a(d,ks)}function l(d){n(d,ks)}var s=i.oldSelection,c=i.newSelection;(0,k.forEach)(s,function(d){c.indexOf(d)===-1&&r(d)}),(0,k.forEach)(c,function(d){s.indexOf(d)===-1&&l(d)})})}Ss.$inject=["canvas","eventBus"];function Es(e,t,n,a){e.on("create.end",500,function(i){var r=i.context,l=r.canExecute,s=r.elements,c=(r.hints||{}).autoSelect;if(l){if(c===!1)return;(0,k.isArray)(c)?t.select(c):t.select(s.filter(gm))}}),e.on("connect.end",500,function(i){var r=i.context.connection;r&&t.select(r)}),e.on("shape.move.end",500,function(i){var r=i.previousSelection||[],l=a.get(i.context.shape.id);(0,k.find)(r,function(s){return l.id===s.id})||t.select(l)}),e.on("element.click",function(i){if(qt(i)){var r=i.element;r===n.getRootElement()&&(r=null);var l=t.isSelected(r),s=t.get().length>1,c=wi(i);if(l&&s)return c?t.deselect(r):t.select(r);l?t.deselect(r):t.select(r,c)}})}Es.$inject=["eventBus","selection","canvas","elementRegistry"];function gm(e){return!e.hidden}var Yn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Si],selection:["type",Jn],selectionVisuals:["type",Ss],selectionBehavior:["type",Es]},mm=/^djs-cursor-.*$/;function Ei(e){var t=(0,W.classes)(document.body);t.removeMatching(mm),e&&t.add("djs-cursor-"+e)}function Bs(){Ei(null)}var ym=5e3;function Rs(e,t){t=t||"element.click";function n(){return!1}return e.once(t,ym,n),function(){e.off(t,n)}}function _s(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Kn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ts(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ms(e,t){return e=(0,k.isArray)(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var Gn=Math.round,As="djs-drag-active";function wn(e){e.preventDefault()}function vm(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function bm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ps(e,t,n,a){var i={threshold:5,trapClick:!0},r;function l(v){var C=t.viewbox(),_=t._container.getBoundingClientRect();return{x:C.x+(v.x-_.left)/C.scale,y:C.y+(v.y-_.top)/C.scale}}function s(v,C){C=C||r;var _=e.createEvent((0,k.assign)({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+v,_)===!1?!1:e.fire(C.prefix+"."+v,_)}function c(v){var C=v.filter(function(_){return a.get(_.id)});C.length&&n.select(C)}function d(v,C){var _=r.payload,b=r.displacement,B=r.globalStart,S=Un(v),T=Kn(S,B),A=r.localStart,R=l(S),j=Kn(R,A);if(!r.active&&(C||bm(T)>r.threshold)){if((0,k.assign)(_,{x:Gn(A.x+b.x),y:Gn(A.y+b.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(_.previousSelection=n.get(),n.select(null)),r.cursor&&Ei(r.cursor),t.addMarker(t.getRootElement(),As)}bi(v),r.active&&((0,k.assign)(_,{x:Gn(R.x+b.x),y:Gn(R.y+b.y),dx:Gn(j.x),dy:Gn(j.y)},{originalEvent:v}),s("move"))}function u(v){var C,_=!0;r.active&&(v&&(r.payload.originalEvent=v,bi(v)),_=s("end")),_===!1&&s("rejected"),C=w(_!==!0),s("ended",C)}function p(v){Ms("Escape",v)&&(wn(v),y())}function f(v){var C;r.active&&(C=Rs(e),setTimeout(C,400),wn(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.active;_&&s("cancel"),C=w(v),_&&s("canceled",C)}}function w(v){var C,_;s("cleanup"),Bs(),r.trapClick?_=f:_=u,W.event.unbind(document,"mousemove",d),W.event.unbind(document,"dragstart",wn),W.event.unbind(document,"selectstart",wn),W.event.unbind(document,"mousedown",_,!0),W.event.unbind(document,"mouseup",_,!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(),As);var b=r.payload.previousSelection;return v!==!1&&b&&!n.get().length&&c(b),C=r,r=null,C}function x(v,C,_,b){r&&y(!1),typeof C=="string"&&(b=_,_=C,C=null),b=(0,k.assign)({},i,b||{});var B=b.data||{},S,T,A,R,j;b.trapClick?R=f:R=u,v?(S=Wn(v)||v,T=Un(v),bi(v),S.type==="dragstart"&&wn(S)):(S=null,T={x:0,y:0}),A=l(T),C||(C=A),j=vm(S),r=(0,k.assign)({prefix:_,data:B,payload:{},globalStart:T,displacement:Kn(C,A),localStart:A,isTouch:j},b),b.manual||(j?(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",wn),W.event.bind(document,"selectstart",wn),W.event.bind(document,"mousedown",R,!0),W.event.bind(document,"mouseup",R,!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,k.assign)(i,v)}}Ps.$inject=["eventBus","canvas","selection","elementRegistry"];var Cn={__depends__:[cm,Yn],dragging:["type",Ps]};function Bi(e){return e.childNodes[0]}function ia(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ia.prototype.next=function(){return this._prefix+ ++this._counter};var wm=new ia("ps"),Cm=["marker-start","marker-mid","marker-end"],xm=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Xt(e,t,n,a){this._elementRegistry=e,this._canvas=n,this._styles=a}Xt.$inject=["elementRegistry","eventBus","canvas","styles"],Xt.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")},Xt.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Xt.prototype.addDragger=function(e,t,n,a="djs-dragger"){n=n||this.getGfx(e);var i=(0,P.clone)(n),r=n.getBoundingClientRect();return this._cloneMarkers(Bi(i),a),(0,P.attr)(i,this._styles.cls(a,[],{x:r.top,y:r.left})),(0,P.append)(t,i),(0,P.attr)(i,"data-preview-support-element-id",e.id),i},Xt.prototype.addFrame=function(e,t){var n=(0,P.create)("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return(0,P.append)(t,n),(0,P.attr)(n,"data-preview-support-element-id",e.id),n},Xt.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var a=this;e.childNodes&&e.childNodes.forEach(i=>{a._cloneMarkers(i,t,n)}),Bm(e)&&Cm.forEach(function(i){if((0,P.attr)(e,i)){var r=km(e,i,a._canvas.getContainer());r&&a._cloneMarker(n,e,r,i,t)}})},Xt.prototype._cloneMarker=function(e,t,n,a,i="djs-dragger"){var r=[n.id,i,wm.next()].join("-"),l=(0,W.query)("marker#"+n.id,e);e=e||this._canvas._svg;var s=l||(0,P.clone)(n);s.id=r,(0,P.classes)(s).add(i);var c=(0,W.query)(":scope > defs",e);c||(c=(0,P.create)("defs"),(0,P.append)(e,c)),(0,P.append)(c,s),(0,P.attr)(t,a,Em(s.id))};function km(e,t,n){return(0,W.query)("marker#"+Sm((0,P.attr)(e,t)),n||document)}function Sm(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Em(e){return"url(#"+e+")"}function Bm(e){return xm.indexOf(e.nodeName)!==-1}var Ri={__init__:["previewSupport"],previewSupport:["type",Xt]};function _i(e){this._commandStack=e.get("commandStack",!1)}_i.$inject=["injector"],_i.prototype.allowed=function(e,t){var n=!0,a=this._commandStack;return a&&(n=a.canExecute(e,t)),n===void 0?!0:n};var qn={__init__:["rules"],rules:["type",_i]};function Rm(e){return(0,k.filter)(e,function(t){return!(0,k.find)(e,function(n){return n!==t&&Vs(t,n)})})}function Vs(e,t){if(t){if(e===t)return t;if(e.parent)return Vs(e.parent,t)}}function Ns(e,t,n){var a=!n||e.indexOf(t)===-1;return a&&e.push(t),a}function Ti(e,t,n){n=n||0,(0,k.isArray)(e)||(e=[e]),(0,k.forEach)(e,function(a,i){var r=t(a,i,n);(0,k.isArray)(r)&&r.length&&Ti(r,t,n+1)})}function _m(e,t,n){var a=[],i=[];return Ti(e,function(r,l,s){Ns(a,r,t);var c=r.children;if((n===-1||s<n)&&c&&Ns(i,c,t))return c}),a}function Tm(e,t){return _m(e,!t,-1)}function Mm(e,t,n){(0,k.isUndefined)(t)&&(t=!0),(0,k.isObject)(t)&&(n=t,t=!0),n=n||{};var a=go(n.allShapes),i=go(n.allConnections),r=go(n.enclosedElements),l=go(n.enclosedConnections),s=go(n.topLevel,t&&(0,k.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]&&(l[u.id]=r[u.id]=u),i[u.id]=u}function d(u){if(r[u.id]=u,u.waypoints)l[u.id]=i[u.id]=u;else return a[u.id]=u,(0,k.forEach)(u.incoming,c),(0,k.forEach)(u.outgoing,c),u.children}return Ti(e,d),{allShapes:a,allConnections:i,topLevel:s,enclosedConnections:l,enclosedElements:r}}function Nt(e,t){t=!!t,(0,k.isArray)(e)||(e=[e]);var n,a,i,r;return(0,k.forEach)(e,function(l){var s=l;l.waypoints&&!t&&(s=Nt(l.waypoints,!0));var c=s.x,d=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(d<a||a===void 0)&&(a=d),(c+p>i||i===void 0)&&(i=c+p),(d+u>r||r===void 0)&&(r=d+u)}),{x:n,y:a,height:r-a,width:i-n}}function Am(e,t){var n={};return(0,k.forEach)(e,function(a){var i=a;i.waypoints&&(i=Nt(i)),!(0,k.isNumber)(t.y)&&i.x>t.x&&(n[a.id]=a),!(0,k.isNumber)(t.x)&&i.y>t.y&&(n[a.id]=a),i.x>t.x&&i.y>t.y&&((0,k.isNumber)(t.width)&&(0,k.isNumber)(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y||!(0,k.isNumber)(t.width)||!(0,k.isNumber)(t.height))&&(n[a.id]=a)}),n}function Pm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Vm(e){return!!(e&&e.isFrame)}function go(e,t){return(0,k.assign)({},e||{},t||{})}function yt(e){return(0,k.isObject)(e)&&(0,k.has)(e,"waypoints")}function Xn(e){return(0,k.isObject)(e)&&(0,k.has)(e,"labelTarget")}var Nm="drop-ok",js="drop-not-ok",Os="attach-ok",Is="new-parent",Ls="create",jm=2e3;function Hs(e,t,n,a,i){function r(c,d,u,p,f){if(!d)return!1;c=(0,k.filter)(c,function(x){var v=x.labelTarget;return!x.parent&&!(Xn(x)&&c.indexOf(v)!==-1)});var h=(0,k.find)(c,function(x){return!yt(x)}),g=!1,m=!1,y=!1;Ds(c)&&(g=i.allowed("shape.attach",{position:u,shape:h,target:d})),g||(Ds(c)?y=i.allowed("shape.create",{position:u,shape:h,source:p,target:d}):y=i.allowed("elements.create",{elements:c,position:u,target:d}));var w=f.connectionTarget;return y||g?(h&&p&&(m=i.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 l(c,d){[Os,Nm,js,Is].forEach(function(u){u===d?e.addMarker(c,u):e.removeMarker(c,u)})}n.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}zs(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?l(p,Os):l(p,m?Is:js))}),n.on(["create.end","create.out","create.cleanup"],function(c){var d=c.hover;d&&l(d,null)}),n.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;zs(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,k.assign)({},w,{attach:m})),p=(0,k.find)(f,function(v){return!yt(v)})),(0,k.assign)(d,{elements:f,shape:p}),(0,k.assign)(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Ls&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],jm,function(){n.off("elements.changed",s)})}),this.start=function(c,d,u){(0,k.isArray)(d)||(d=[d]);var p=(0,k.find)(d,function(h){return!yt(h)});if(p){u=(0,k.assign)({elements:d,hints:{},shape:p},u||{}),(0,k.forEach)(d,function(h){(0,k.isNumber)(h.x)||(h.x=0),(0,k.isNumber)(h.y)||(h.y=0)});var f=Nt((0,k.filter)(d,function(h){return!h.hidden}));(0,k.forEach)(d,function(h){yt(h)&&(h.waypoints=(0,k.map)(h.waypoints,function(g){return{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2}})),(0,k.assign)(h,{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2})}),t.init(c,Ls,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:d,context:u}})}}}Hs.$inject=["canvas","dragging","eventBus","modeling","rules"];function zs(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 Ds(e){return e&&e.length===1&&!yt(e[0])}function Om(e,t,n,a,i){var r=(0,P.createTransform)();r.setTranslate(t,n);var l=(0,P.createTransform)();l.setRotate(a||0,0,0);var s=(0,P.createTransform)();s.setScale(i||1,i||1),(0,P.transform)(e,[r,l,s])}function jt(e,t,n){var a=(0,P.createTransform)();a.setTranslate(t,n),(0,P.transform)(e,a)}function Im(e,t){var n=(0,P.createTransform)();n.setRotate(t,0,0),(0,P.transform)(e,n)}var Lm=750;function Fs(e,t,n,a,i){function r(l){var s=(0,P.create)("g");(0,P.attr)(s,i.cls("djs-drag-group",["no-events"]));var c=(0,P.create)("g");return l.forEach(function(d){var u;d.hidden||(d.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Bi(u),d)):(u=n._createContainer("shape",c),n.drawShape(Bi(u),d),jt(u,d.x,d.y)),a.addDragger(d,s,u))}),s}t.on("create.move",Lm,function(l){var s=l.hover,c=l.context,d=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(d));var p;s?(u.parentNode||(p=e.getActiveLayer(),(0,P.append)(p,u)),jt(u,l.x,l.y)):(0,P.remove)(u)}),t.on("create.cleanup",function(l){var s=l.context.dragGroup;s&&(0,P.remove)(s)})}Fs.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var $s={__depends__:[Cn,Ri,qn,Yn],__init__:["create","createPreview"],create:["type",Hs],createPreview:["type",Fs]};function mo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Mi(e,t,n,a){if(typeof a>"u"&&(a=5),!e||!t||!n)return!1;var i=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=mo(e,t);return Math.abs(i/r)<=a}var Hm=2;function Zt(e,t){var n=Array.from(arguments).flat();for(const[a,i]of Object.entries({x:"v",y:"h"}))if(zm(a,n))return i;return!1}function zm(e,t){const n=t[0];return(0,k.every)(t,function(a){return Math.abs(n[e]-a[e])<=Hm})}function Ws(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Ai(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Dm=/,?([a-z]),?/gi,Us=parseFloat,Qe=Math,Qt=Qe.PI,Ot=Qe.min,It=Qe.max,Js=Qe.pow,en=Qe.abs,Fm=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,$m=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Ys=Array.isArray||function(e){return e instanceof Array};function Wm(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Um(e,t){for(var n=0,a=e.length;n<a;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function Jm(e){function t(){var n=Array.prototype.slice.call(arguments,0).join("␀"),a=t.cache=t.cache||{},i=t.count=t.count||[];return Wm(a,n)?(Um(i,n),a[n]):(i.length>=1e3&&delete a[i.shift()],i.push(n),a[n]=e(...arguments),a[n])}return t}function Ym(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},n=[];return String(e).replace(Fm,function(a,i,r){var l=[],s=i.toLowerCase();for(r.replace($m,function(c,d){d&&l.push(+d)}),s=="m"&&l.length>2&&(n.push([i,...l.splice(0,2)]),s="l",i=i=="m"?"l":"L");l.length>=t[s]&&(n.push([i,...l.splice(0,t[s])]),!!t[s]););}),n.toString=Vi,n}function Km(e){for(var t=0,n=e.length;t<n;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function Gm(e){for(var t=0,n=e.length;t<n;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Pi(e,t,n,a){return arguments.length===1&&(t=e.y,n=e.width,a=e.height,e=e.x),{x:e,y:t,width:n,height:a,x2:e+n,y2:t+a}}function Vi(){return this.join(",").replace(Dm,"$1")}function qm(e){for(var t=new Array(e.length),n=0,a=e.length;n<a;n++)for(var i=e[n],r=t[n]=new Array(i.length),l=0,s=i.length;l<s;l++)r[l]=i[l];return t.toString=Vi,t}function Ks(e,t,n,a,i,r,l,s,c){var d=1-c,u=Js(d,3),p=Js(d,2),f=c*c*c,h=u*e+p*3*c*n+d*3*c*c*i+f*l,g=u*t+p*3*c*a+d*3*c*c*r+f*s;return{x:ra(h),y:ra(g)}}function Gs(e){var t=ny(...e);return Pi(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tn(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Xm(e,t){return e=Pi(e),t=Pi(t),tn(t,e.x,e.y)||tn(t,e.x2,e.y)||tn(t,e.x,e.y2)||tn(t,e.x2,e.y2)||tn(e,t.x,t.y)||tn(e,t.x2,t.y)||tn(e,t.x,t.y2)||tn(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 qs(e,t,n,a,i){return e*(e*(-3*t+9*n-9*a+3*i)+6*t-12*n+6*a)-3*t+3*n}function Xs(e,t,n,a,i,r,l,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=qs(m,e,n,i,l),w=qs(m,t,a,r,s),x=y*y+w*w;h+=f[g]*Qe.sqrt(x)}return d*h}function Zm(e,t,n,a,i,r,l,s){if(!(It(e,n)<Ot(i,l)||Ot(e,n)>It(i,l)||It(t,a)<Ot(r,s)||Ot(t,a)>It(r,s))){var c=(e*a-t*n)*(i-l)-(e-n)*(i*s-r*l),d=(e*a-t*n)*(r-s)-(t-a)*(i*s-r*l),u=(e-n)*(r-s)-(t-a)*(i-l);if(u){var p=ra(c/u),f=ra(d/u),h=+p.toFixed(2),g=+f.toFixed(2);if(!(h<+Ot(e,n).toFixed(2)||h>+It(e,n).toFixed(2)||h<+Ot(i,l).toFixed(2)||h>+It(i,l).toFixed(2)||g<+Ot(t,a).toFixed(2)||g>+It(t,a).toFixed(2)||g<+Ot(r,s).toFixed(2)||g>+It(r,s).toFixed(2)))return{x:p,y:f}}}}function ra(e){return Math.round(e*1e11)/1e11}function Qm(e,t,n){if(!Xm(Gs(e),Gs(t)))return n?0:[];var a=Xs(...e),i=Xs(...t),r=Qs(e)?1:~~(a/5)||1,l=Qs(t)?1:~~(i/5)||1,s=new Array(r+1),c=new Array(l+1),d={},u=n?0:[],p,f;for(p=0;p<r+1;p++){var h=Ks(...e,p/r);s[p]={x:h.x,y:h.y,t:p/r}}for(p=0;p<l+1;p++)h=Ks(...t,p/l),c[p]={x:h.x,y:h.y,t:p/l};for(p=0;p<r;p++)for(f=0;f<l;f++){var g=s[p],m=s[p+1],y=c[f],w=c[f+1],x=en(m.x-g.x)<.01?"y":"x",v=en(w.x-y.x)<.01?"y":"x",C=Zm(g.x,g.y,m.x,m.y,y.x,y.y,w.x,w.y),_;if(C){if(_=C.x.toFixed(9)+"#"+C.y.toFixed(9),d[_])continue;d[_]=!0;var b=g.t+en((C[x]-g[x])/(m[x]-g[x]))*(m.t-g.t),B=y.t+en((C[v]-y[v])/(w[v]-y[v]))*(w.t-y.t);b>=0&&b<=1&&B>=0&&B<=1&&(n?u++:u.push({x:C.x,y:C.y,t1:b,t2:B}))}}return u}function Zs(e,t,n){e=nc(e),t=nc(t);for(var a,i,r,l,s,c,d,u,p,f,h=n?0:[],g=0,m=e.length;g<m;g++){var y=e[g];if(y[0]=="M")a=s=y[1],i=c=y[2];else{y[0]=="C"?(p=[a,i,...y.slice(1)],a=p[6],i=p[7]):(p=[a,i,a,i,s,c,s,c],a=s,i=c);for(var w=0,x=t.length;w<x;w++){var v=t[w];if(v[0]=="M")r=d=v[1],l=u=v[2];else{v[0]=="C"?(f=[r,l,...v.slice(1)],r=f[6],l=f[7]):(f=[r,l,r,l,d,u,d,u],r=d,l=u);var C=Qm(p,f,n);if(n)h+=C;else{for(var _=0,b=C.length;_<b;_++)C[_].segment1=g,C[_].segment2=w,C[_].bez1=p,C[_].bez2=f;h=h.concat(C)}}}}}return h}function ey(e){return Ys(e)&&Ys(e[0])}function ty(e){if(Km(e))return e;var t=new Array(e.length),n=0,a=0,i=0,r=0,l=0,s;e[0][0]=="M"&&(n=+e[0][1],a=+e[0][2],i=n,r=a,l++,t[0]=["M",n,a]);for(var c,d,u=l,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]+n,c[7]=+d[7]+a;break;case"V":c[1]=+d[1]+a;break;case"H":c[1]=+d[1]+n;break;case"M":i=+d[1]+n,r=+d[2]+a;default:for(var f=1,h=d.length;f<h;f++)c[f]=+d[f]+(f%2?n:a)}else for(var g=0,m=d.length;g<m;g++)c[g]=d[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+i,a=+r;break;case"H":n=c[1];break;case"V":a=c[1];break;case"M":i=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],a=c[c.length-1]}}return t.toString=Vi,t}function Qs(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function la(e,t,n,a){return[e,t,n,a,n,a]}function ec(e,t,n,a,i,r){var l=.3333333333333333,s=2/3;return[l*e+s*n,l*t+s*a,l*i+s*n,l*r+s*a,i,r]}function tc(e,t,n,a,i,r,l,s,c,d){var u=Qt*120/180,p=Qt/180*(+i||0),f=[],h,g=Jm(function(ye,je,ze){return{x:ye*Qe.cos(ze)-je*Qe.sin(ze),y:ye*Qe.sin(ze)+je*Qe.cos(ze)}});if(d)B=d[0],S=d[1],_=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/(n*n)+y*y/(a*a);w>1&&(w=Qe.sqrt(w),n=w*n,a=w*a);var x=n*n,v=a*a,C=(r==l?-1:1)*Qe.sqrt(en((x*v-x*y*y-v*m*m)/(x*y*y+v*m*m))),_=C*n*y/a+(e+s)/2,b=C*-a*m/n+(t+c)/2,B=Qe.asin(((t-b)/a).toFixed(9)),S=Qe.asin(((c-b)/a).toFixed(9));B=e<_?Qt-B:B,S=s<_?Qt-S:S,B<0&&(B=Qt*2+B),S<0&&(S=Qt*2+S),l&&B>S&&(B=B-Qt*2),!l&&S>B&&(S=S-Qt*2)}var T=S-B;if(en(T)>u){var A=S,R=s,j=c;S=B+u*(l&&S>B?1:-1),s=_+n*Qe.cos(S),c=b+a*Qe.sin(S),f=tc(s,c,n,a,i,0,l,R,j,[S,A,_,b])}T=S-B;var O=Qe.cos(B),H=Qe.sin(B),M=Qe.cos(S),E=Qe.sin(S),L=Qe.tan(T/4),$=4/3*n*L,Q=4/3*a*L,se=[e,t],ge=[e+$*H,t-Q*O],Ee=[s+$*E,c-Q*M],We=[s,c];if(ge[0]=2*se[0]-ge[0],ge[1]=2*se[1]-ge[1],d)return[ge,Ee,We].concat(f);f=[ge,Ee,We].concat(f).join().split(",");for(var X=[],Te=0,Ne=f.length;Te<Ne;Te++)X[Te]=Te%2?g(f[Te-1],f[Te],p).y:g(f[Te],f[Te+1],p).x;return X}function ny(e,t,n,a,i,r,l,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*n+6*i,u=-3*e+9*n-9*i+3*l,f=3*n-3*e):(p=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*s,f=3*a-3*t),en(u)<1e-12){if(en(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,_;v--;)h=c[v],_=1-h,d[0][v]=_*_*_*e+3*_*_*h*n+3*_*h*h*i+h*h*h*l,d[1][v]=_*_*_*t+3*_*_*h*a+3*_*h*h*r+h*h*h*s;return d[0][C]=e,d[1][C]=t,d[0][C+1]=l,d[1][C+1]=s,d[0].length=d[1].length=C+2,{x0:Ot(...d[0]),y0:Ot(...d[1]),x1:It(...d[0]),y1:It(...d[1])}}function nc(e){if(ey(e)||(e=Ym(e)),Gm(e))return e;for(var t=qm(ty(e)),n={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",...tc(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",...ec(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",...ec(h.x,h.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...la(h.x,h.y,f[1],f[2])];break;case"H":f=["C",...la(h.x,h.y,f[1],h.y)];break;case"V":f=["C",...la(h.x,h.y,h.x,f[1])];break;case"Z":f=["C",...la(h.x,h.y,h.X,h.Y)];break}return f},i=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=[],l="",s="",c=0,d=t.length;c<d;c++){t[c]&&(l=t[c][0]),l!="C"&&(r[c]=l,c&&(s=r[c-1])),t[c]=a(t[c],n,s),r[c]!="A"&&l=="C"&&(r[c]="C"),i(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Us(u[p-4])||n.x,n.by=Us(u[p-3])||n.y}return t}function oy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function yo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ve(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function oc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function ay(e){return yo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function iy(e){for(var t=e.waypoints,n=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=sy(u,c);s.push({start:u,end:c,startLength:f,endLength:f+h,length:h})}return s},[]),a=n.reduce(function(s,c){return s+c.length},0)/2,i=0,r=n[i];r.endLength<a;)r=n[++i];var l=(a-r.startLength)/r.length;return{x:r.start.x+(r.end.x-r.start.x)*l,y:r.start.y+(r.end.y-r.start.y)*l}}function Je(e){return yt(e)?iy(e):ay(e)}function nn(e,t,n){n=n||0,(0,k.isObject)(n)||(n={x:n,y:n});var a=Ve(e),i=Ve(t),r=a.bottom+n.y<=i.top,l=a.left-n.x>=i.right,s=a.top-n.y>=i.bottom,c=a.right+n.x<=i.left,d=r?"top":s?"bottom":null,u=c?"left":l?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function Ni(e,t,n){var a=ry(e,t);return a.length===1||a.length===2&&mo(a[0],a[1])<1?yo(a[0]):a.length>1?(a=(0,k.sortBy)(a,function(i){var r=Math.floor(i.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,i.segment2+"#"+r}),yo(a[n?0:a.length-1])):null}function ry(e,t){return Zs(e,t)}function ly(e){e=e.slice();for(var t=0,n,a,i;e[t];)n=e[t],a=e[t-1],i=e[t+1],mo(n,i)===0||Mi(a,i,n)?e.splice(t,1):t++;return e}function sy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ac(e,t,n,a){function i(l,s){return a.allowed("connection.create",{source:l,target:s})}function r(l,s){return i(s,l)}e.on("connect.hover",function(l){var s=l.context,c=s.start,d=l.hover,u;if(s.hover=d,u=s.canExecute=i(c,d),!(0,k.isNil)(u)){if(u!==!1){s.source=c,s.target=d;return}u=s.canExecute=r(c,d),!(0,k.isNil)(u)&&u!==!1&&(s.source=d,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(l){var s=l.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(l){var s=l.context,c=s.canExecute,d=s.connectionStart,u={x:l.x,y:l.y},p=s.source,f=s.target;if(!c)return!1;var h=null,g={connectionStart:ji(s)?u:d,connectionEnd:ji(s)?d:u};(0,k.isObject)(c)&&(h=c),s.connection=n.connect(p,f,h,g)}),this.start=function(l,s,c,d){(0,k.isObject)(c)||(d=c,c=Je(s)),t.init(l,"connect",{autoActivate:d,data:{shape:s,context:{start:s,connectionStart:c}}})}}ac.$inject=["eventBus","dragging","modeling","rules"];function ji(e){var t=e.hover,n=e.source,a=e.target;return t&&n&&t===n&&n!==a}var cy=1100,dy=900,ic="connect-ok",rc="connect-not-ok";function lc(e,t,n){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(i){var r=i.context,l=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:i.x,y:i.y},g=f,m=h;ji(r)&&(g=h,m=f),a.drawPreview(r,l,{source:c||d,target:p||s,connectionStart:g,connectionEnd:m})}),t.on("connect.hover",dy,function(i){var r=i.context,l=i.hover,s=r.canExecute;s!==null&&n.addMarker(l,s?ic:rc)}),t.on(["connect.out","connect.cleanup"],cy,function(i){var r=i.hover;r&&(n.removeMarker(r,ic),n.removeMarker(r,rc))}),a&&t.on("connect.cleanup",function(i){a.cleanUp(i.context)})}lc.$inject=["injector","eventBus","canvas"];var Oi={__depends__:[Yn,qn,Cn],__init__:["connectPreview"],connect:["type",ac],connectPreview:["type",lc]},uy=15;function sc(e,t){var n;function a(s){return l(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function i(s){var c=n.start,d=n.button,u=Un(s),p=Kn(u,c);!n.dragging&&fy(p)>uy&&(n.dragging=!0,d===0&&Rs(e),Ei("grab")),n.dragging&&(p=Kn(u,n.last||n.start),t.scroll({dx:p.x,dy:p.y}),n.last=u),s.preventDefault()}function r(s){W.event.unbind(document,"mousemove",i),W.event.unbind(document,"mouseup",r),n=null,Bs()}function l(s){if(!(0,W.closest)(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Un(s)},W.event.bind(document,"mousemove",i),W.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}sc.$inject=["eventBus","canvas"];function fy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var cc={__init__:["moveCanvas"],moveCanvas:["type",sc]};function Ii(e){return Math.log(e)/Math.log(10)}function dc(e,t){var n=Ii(e.min),a=Ii(e.max);return(Math.abs(n)+Math.abs(a))/t}function py(e,t){return Math.max(e.min,Math.min(e.max,t))}var hy=Math.sign||function(e){return e>=0?1:-1},Li={min:.2,max:4},uc=10,gy=.1,my=.75;function Lt(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=(0,k.bind)(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||my;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}Lt.$inject=["config.zoomScroll","eventBus","canvas"],Lt.prototype.scroll=function(t){this._canvas.scroll(t)},Lt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Lt.prototype.zoom=function(t,n){var a=dc(Li,uc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>gy&&(this._zoom(t,n,a),this._totalDelta=0)},Lt.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var a=t.ctrlKey||ms()&&t.metaKey,i=t.shiftKey,r=-1*this._scale,l;if(a?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,a){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*hy(t.deltaY)*r,this.zoom(l,c)}else i?l={dx:r*t.deltaY,dy:0}:l={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(l)}},Lt.prototype.stepZoom=function(t,n){var a=dc(Li,uc);this._zoom(t,n,a)},Lt.prototype._zoom=function(e,t,n){var a=this._canvas,i=e>0?1:-1,r=Ii(a.zoom()),l=Math.round(r/n)*n;l+=n*i;var s=Math.pow(10,l);a.zoom(py(Li,s),t)},Lt.prototype.toggle=function(t){var n=this._container,a=this._handleWheel,i=this._enabled;return typeof t>"u"&&(t=!i),i!==t&&W.event[t?"bind":"unbind"](n,"wheel",a,!1),this._enabled=t,t},Lt.prototype._init=function(e){this.toggle(e)};var fc={__init__:["zoomScroll"],zoomScroll:["type",Lt]};function $e(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)}$e.$inject=["eventBus","injector"],$e.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},$e.prototype.canExecute=function(e,t){const n={command:e,context:t},a=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(i===void 0){if(!a)return!1;a.canExecute&&(i=a.canExecute(t))}return i},$e.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},$e.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()}},$e.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()}},$e.prototype.register=function(e,t){this._setHandler(e,t)},$e.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},$e.prototype.canUndo=function(){return!!this._getUndoAction()},$e.prototype.canRedo=function(){return!!this._getRedoAction()},$e.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},$e.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},$e.prototype._internalUndo=function(e){const t=e.command,n=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},$e.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const a=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const r of a)if(i=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return i},$e.prototype._createId=function(){return this._uid++},$e.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},$e.prototype._internalExecute=function(e,t){const n=e.command,a=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(a),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(a)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(a),this._fire(n,"postExecuted",e)),this._popAction()},$e.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,a=n[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()),n.push(e)},$e.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,a=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:(0,k.uniqueBy)("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},$e.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=(0,k.isArray)(e)?e:[e],t.dirty=t.dirty.concat(e))},$e.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},$e.prototype._revertedAction=function(e){this._stackIdx--},$e.prototype._getHandler=function(e){return this._handlerMap[e]},$e.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 yy={commandStack:["type",$e]};function xn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function sa(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function on(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var a=e.indexOf(t);if(a!==-1){if(a===n)return;if(n!==-1)e.splice(a,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Hi(e,t){return!e||!t?-1:e.indexOf(t)}function Zn(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}var vy=1e3;function dt(e){this._eventBus=e}dt.$inject=["eventBus"];function by(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}dt.prototype.on=function(e,t,n,a,i,r){if(((0,k.isFunction)(t)||(0,k.isNumber)(t))&&(r=i,i=a,a=n,n=t,t=null),(0,k.isFunction)(n)&&(r=i,i=a,a=n,n=vy),(0,k.isObject)(i)&&(r=i,i=!1),!(0,k.isFunction)(a))throw new Error("handlerFn must be a function");(0,k.isArray)(e)||(e=[e]);var l=this._eventBus;(0,k.forEach)(e,function(s){var c=["commandStack",s,t].filter(function(d){return d}).join(".");l.on(c,n,i?by(a,r):a,r)})},dt.prototype.canExecute=Ut("canExecute"),dt.prototype.preExecute=Ut("preExecute"),dt.prototype.preExecuted=Ut("preExecuted"),dt.prototype.execute=Ut("execute"),dt.prototype.executed=Ut("executed"),dt.prototype.postExecute=Ut("postExecute"),dt.prototype.postExecuted=Ut("postExecuted"),dt.prototype.revert=Ut("revert"),dt.prototype.reverted=Ut("reverted");function Ut(e){return function(n,a,i,r,l){((0,k.isFunction)(n)||(0,k.isNumber)(n))&&(l=r,r=i,i=a,a=n,n=null),this.on(n,e,a,i,r,l)}}var wy=250,pc=1400;function zi(e,t,n){dt.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",pc,function(i){var r=i.context,l=r.shapes,s=r.validatedShapes;r.shapes=hc(l),r.validatedShapes=hc(s)}),a&&t.on("shape.move.start",wy,function(i){var r=i.context,l=r.shapes,s=[];(0,k.forEach)(l,function(c){(0,k.forEach)(c.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&s.push(d),c.labelTarget&&s.push(c)})}),(0,k.forEach)(s,function(c){a.makeDraggable(r,c,!0)})}),this.preExecuted("elements.move",pc,function(i){var r=i.context.closure,l=r.enclosedElements,s=[];(0,k.forEach)(l,function(c){(0,k.forEach)(c.labels,function(d){l[d.id]||s.push(d)})}),r.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(i){var r=i.context;Zn((r.connection||r.shape).labels,function(l){n.removeShape(l,{nested:!0})})}),this.execute("shape.delete",function(i){var r=i.context,l=r.shape,s=l.labelTarget;s&&(r.labelTargetIndex=Hi(s.labels,l),r.labelTarget=s,l.labelTarget=null)}),this.revert("shape.delete",function(i){var r=i.context,l=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(on(s.labels,l,c),l.labelTarget=s)})}xn(zi,dt),zi.$inject=["injector","eventBus","modeling"];function hc(e){return(0,k.filter)(e,function(t){return e.indexOf(t.labelTarget)===-1})}var Cy={__init__:["labelSupport"],labelSupport:["type",zi]};function gc(){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 mc(e,t){if(t){let n=e;return Object.keys(t).forEach(a=>{n=n.replace(new RegExp(`{${a}}`,"g"),t[a])}),n}return e}function xy(e,t,n,a){var i=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var l=this.indexOf(r);return l!==-1&&(this.splice(l,1),t.unset(r,i,a)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,l){var s=this.indexOf(r);if(typeof l>"u"){if(s!==-1)return;l=this.length}s!==-1&&this.splice(s,1),this.splice(l,0,r),s===-1&&t.set(r,i,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function ky(e){return e.__refs_collection===!0}function Sy(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function yc(e,t,n){var a=xy(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(i){e.set(i,t.inverse,n)})}function Ey(e,t,n){var a=t.inverse,i=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(r){if(r!==i){var l=i;i=null,l&&e.unset(l,a,n),i=r,e.set(i,a,n)}}})}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?yc(this,t,e):Ey(this,t,e)},St.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return ky(n)||yc(this,t,e),n},St.prototype.ensureBound=function(e,t){Sy(e,t)||this.bind(e,t)},St.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},St.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Di=new St({name:"children",enumerable:!0,collection:!0},{name:"parent"}),vc=new St({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),bc=new St({name:"attachers",collection:!0},{name:"host"}),wc=new St({name:"outgoing",collection:!0},{name:"source"}),Cc=new St({name:"incoming",collection:!0},{name:"target"});function Qn(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Di.bind(this,"parent"),vc.bind(this,"labels"),wc.bind(this,"outgoing"),Cc.bind(this,"incoming")}function vo(){Qn.call(this),Di.bind(this,"children"),bc.bind(this,"host"),bc.bind(this,"attachers")}xn(vo,Qn);function xc(){Qn.call(this),Di.bind(this,"children")}xn(xc,vo);function kc(){vo.call(this),vc.bind(this,"labelTarget")}xn(kc,vo);function Sc(){Qn.call(this),wc.bind(this,"source"),Cc.bind(this,"target")}xn(Sc,Qn);var By={connection:Sc,shape:vo,label:kc,root:xc};function Ry(e,t){var n=By[e];if(!n)throw new Error("unknown type: <"+e+">");return(0,k.assign)(new n,t)}function _y(e){return e instanceof Qn}function an(){this._uid=12}an.prototype.createRoot=function(e){return this.create("root",e)},an.prototype.createLabel=function(e){return this.create("label",e)},an.prototype.createShape=function(e){return this.create("shape",e)},an.prototype.createConnection=function(e){return this.create("connection",e)},an.prototype.create=function(e,t){return t=(0,k.assign)({},t||{}),t.id||(t.id=e+"_"+this._uid++),Ry(e,t)};var Ty={width:90,height:20};function kn(){an.call(this),this._translate=mc}(0,$t.default)(kn,an),kn.$inject=[],kn.prototype.baseCreate=an.prototype.create,kn.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Fe({type:"label"},Ty,t)):this.createFlowElement(e,t)},kn.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:gc()},e==="connection"&&(t.type="myline");const{businessObject:n}=t;n.type=t.type;const a=this._getDefaultSize(n.type);return t=Fe({businessObject:n,id:n.id},a,t),this.baseCreate(e,t)},kn.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 ca(e,t){this._modeling=e,this._canvas=t}ca.$inject=["modeling","canvas"],ca.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,a=e.alignment;(0,k.forEach)(n,function(i){var r={x:0,y:0};(0,k.isDefined)(a.left)?r.x=a.left-i.x:(0,k.isDefined)(a.right)?r.x=a.right-i.width-i.x:(0,k.isDefined)(a.center)?r.x=a.center-Math.round(i.width/2)-i.x:(0,k.isDefined)(a.top)?r.y=a.top-i.y:(0,k.isDefined)(a.bottom)?r.y=a.bottom-i.height-i.y:(0,k.isDefined)(a.middle)&&(r.y=a.middle-Math.round(i.height/2)-i.y),t.moveElements([i],r,i.parent)})},ca.prototype.postExecute=function(e){};function da(e){this._modeling=e}da.$inject=["modeling"],da.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,a=e.shape,i=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,n,{attach:i.attach}),e.shape=a},da.prototype.postExecute=function(e){var t=e.hints||{};My(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 My(e,t){return(0,k.some)(e.outgoing,function(n){return n.target===t})}function ua(e,t){this._canvas=e,this._layouter=t}ua.$inject=["canvas","layouter"],ua.prototype.execute=function(e){var t=e.connection,n=e.source,a=e.target,i=e.parent,r=e.parentIndex,l=e.hints;if(!n||!a)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,i,r),t},ua.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var fa=Math.round;function Fi(e){this._modeling=e}Fi.$inject=["modeling"],Fi.prototype.preExecute=function(e){var t=e.elements,n=e.parent,a=e.parentIndex,i=e.position,r=e.hints,l=this._modeling;(0,k.forEach)(t,function(u){(0,k.isNumber)(u.x)||(u.x=0),(0,k.isNumber)(u.y)||(u.y=0)});var s=Nt((0,k.filter)(t,function(u){return!u.hidden}));(0,k.forEach)(t,function(u){yt(u)&&(u.waypoints=(0,k.map)(u.waypoints,function(p){return{x:fa(p.x-s.x-s.width/2+i.x),y:fa(p.y-s.y-s.height/2+i.y)}})),(0,k.assign)(u,{x:fa(u.x-s.x-s.width/2+i.x),y:fa(u.y-s.y-s.height/2+i.y)})});var c=Rm(t),d={};(0,k.forEach)(t,function(u){if(yt(u)){d[u.id]=(0,k.isNumber)(a)?l.createConnection(d[u.source.id],d[u.target.id],a,u,u.parent||n,r):l.createConnection(d[u.source.id],d[u.target.id],u,u.parent||n,r);return}var p=(0,k.assign)({},r);c.indexOf(u)===-1&&(p.autoResize=!1),Xn(u)&&(p=(0,k.omit)(p,["attach"])),d[u.id]=(0,k.isNumber)(a)?l.createShape(u,(0,k.pick)(u,["x","y","width","height"]),u.parent||n,a,p):l.createShape(u,(0,k.pick)(u,["x","y","width","height"]),u.parent||n,p)}),e.elements=(0,k.values)(d)};var Ec=Math.round;function rn(e){this._canvas=e}rn.$inject=["canvas"],rn.prototype.execute=function(e){var t=e.shape,n=e.position,a=e.parent,i=e.parentIndex;if(!a)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?(0,k.assign)(t,n):(0,k.assign)(t,{x:n.x-Ec(t.width/2),y:n.y-Ec(t.height/2)}),this._canvas.addShape(t,a,i),t},rn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function bo(e){rn.call(this,e)}xn(bo,rn),bo.$inject=["canvas"];var Ay=rn.prototype.execute;bo.prototype.execute=function(e){var t=e.shape;return Vy(t),t.labelTarget=e.labelTarget,Ay.call(this,e)};var Py=rn.prototype.revert;bo.prototype.revert=function(e){return e.shape.labelTarget=null,Py.call(this,e)};function Vy(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function wo(e,t){this._canvas=e,this._modeling=t}wo.$inject=["canvas","modeling"],wo.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Zn(n.incoming,function(a){t.removeConnection(a,{nested:!0})}),Zn(n.outgoing,function(a){t.removeConnection(a,{nested:!0})})},wo.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hi(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},wo.prototype.revert=function(e){var t=e.connection,n=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,on(n.children,t,a),this._canvas.addConnection(t,n),t};function $i(e,t){this._modeling=e,this._elementRegistry=t}$i.$inject=["modeling","elementRegistry"],$i.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,a=e.elements;(0,k.forEach)(a,function(i){n.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function Co(e,t){this._canvas=e,this._modeling=t}Co.$inject=["canvas","modeling"],Co.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Zn(n.incoming,function(a){t.removeConnection(a,{nested:!0})}),Zn(n.outgoing,function(a){t.removeConnection(a,{nested:!0})}),Zn(n.children,function(a){yt(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},Co.prototype.execute=function(e){var t=this._canvas,n=e.shape,a=n.parent;return e.oldParent=a,e.oldParentIndex=Hi(a.children,n),t.removeShape(n),n},Co.prototype.revert=function(e){var t=this._canvas,n=e.shape,a=e.oldParent,i=e.oldParentIndex;return on(a.children,n,i),t.addShape(n,a),n};function pa(e){this._modeling=e}pa.$inject=["modeling"];var Bc={x:"y",y:"x"};pa.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,a=e.axis,i=e.dimension;function r(y,w){y.range.min=Math.min(w[a],y.range.min),y.range.max=Math.max(w[a]+w[i],y.range.max)}function l(y){return y[a]+y[i]/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-l(w),x[a]&&(x[Bc[a]]=0,t.moveElements([w],x,w.parent))}var u=n[0],p=s(n),f=n[p],h,g,m=0;(0,k.forEach)(n,function(y,w){var x,v,C;if(y.elements.length<2){w&&w!==n.length-1&&(r(y,y.elements[0]),m+=c(y.range));return}x=(0,k.sortBy)(y.elements,a),v=x[0],w===p&&(v=x[s(x)]),C=l(v),y.range=null,(0,k.forEach)(x,function(_){if(d(C,_),y.range===null){y.range={min:_[a],max:_[a]+_[i]};return}r(y,_)}),w&&w!==n.length-1&&(m+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),h=Math.round((g-m)/(n.length-1)),!(h<n.length-1)&&(0,k.forEach)(n,function(y,w){var x={},v;y===u||y===f||(v=n[w-1],y.range.max=0,(0,k.forEach)(y.elements,function(C,_){x[Bc[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[i],_?y.range.max:0)}))})},pa.prototype.postExecute=function(e){};function ha(e,t){this._layouter=e,this._canvas=t}ha.$inject=["layouter","canvas"],ha.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return(0,k.assign)(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},ha.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Wi(){}Wi.prototype.execute=function(e){var t=e.connection,n=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=sa(r.children,t),on(a.children,t,i),t.parent=a,(0,k.forEach)(t.waypoints,function(l){l.x+=n.x,l.y+=n.y,l.original&&(l.original.x+=n.x,l.original.y+=n.y)}),t},Wi.prototype.revert=function(e){var t=e.connection,n=t.parent,a=e.oldParent,i=e.oldParentIndex,r=e.delta;return sa(n.children,t),on(a.children,t,i),t.parent=a,(0,k.forEach)(t.waypoints,function(l){l.x-=r.x,l.y-=r.y,l.original&&(l.original.x-=r.x,l.original.y-=r.y)}),t};function ga(e,t,n){var a=_s(t),i=_s(n),r=Kn(e,a),l={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return yo({x:i.x+l.x,y:i.y+l.y})}function Ui(e,t,n){var a=ma(e),i=_c(a,t),r=a[0];return i.length?i[i.length-1]:ga(r.original||r,n,t)}function Ji(e,t,n){var a=ma(e),i=_c(a,t),r=a[a.length-1];return i.length?i[0]:ga(r.original||r,n,t)}function Yi(e,t,n){var a=ma(e),i=Rc(t,n),r=a[0];return ga(r.original||r,i,t)}function Ki(e,t,n){var a=ma(e),i=Rc(t,n),r=a[a.length-1];return ga(r.original||r,i,t)}function Rc(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ma(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function _c(e,t){return(0,k.filter)((0,k.map)(e,jy),function(n){return Ny(n,t)})}function Ny(e,t){return nn(t,e,1)==="intersect"}function jy(e){return e.original||e}function Gi(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Gi.prototype.add=function(e,t){return this.addAll([e],t)},Gi.prototype.addAll=function(e,t){var n=Mm(e,!!t,this);return(0,k.assign)(this,n),this};function xo(e){this._modeling=e}xo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},xo.prototype.moveClosure=function(e,t,n,a,i){var r=this._modeling,l=e.allShapes,s=e.allConnections,c=e.enclosedConnections,d=e.topLevel,u=!1;i&&i.parent===n&&(u=!0),(0,k.forEach)(l,function(p){r.moveShape(p,t,d[p.id]&&!u&&n,{recurse:!1,layout:!1})}),(0,k.forEach)(s,function(p){var f=!!l[p.source.id],h=!!l[p.target.id];c[p.id]&&f&&h?r.moveConnection(p,t,d[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&Yi(p,p.source,t),connectionEnd:h&&Ki(p,p.target,t)})})},xo.prototype.getClosure=function(e){return new Gi().addAll(e,!0)};function ya(e){this._helper=new xo(e)}ya.$inject=["modeling"],ya.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},ya.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Sn(e){this._modeling=e,this._helper=new xo(e)}Sn.$inject=["modeling"],Sn.prototype.execute=function(e){var t=e.shape,n=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldBounds=(0,k.pick)(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=sa(r.children,t),on(a.children,t,i),(0,k.assign)(t,{parent:a,x:t.x+n.x,y:t.y+n.y}),t},Sn.prototype.postExecute=function(e){var t=e.shape,n=e.delta,a=e.hints,i=this._modeling;a.layout!==!1&&((0,k.forEach)(t.incoming,function(r){i.layoutConnection(r,{connectionEnd:Ki(r,t,n)})}),(0,k.forEach)(t.outgoing,function(r){i.layoutConnection(r,{connectionStart:Yi(r,t,n)})})),a.recurse!==!1&&this.moveChildren(e)},Sn.prototype.revert=function(e){var t=e.shape,n=e.oldParent,a=e.oldParentIndex,i=e.delta;return on(n.children,t,a),(0,k.assign)(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},Sn.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Sn.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ko(e){this._modeling=e}ko.$inject=["modeling"],ko.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,a=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return(0,k.isArray)(i)&&(e.oldWaypoints=a.waypoints,a.waypoints=i),t&&(e.oldSource=a.source,a.source=t),n&&(e.oldTarget=a.target,a.target=n),a},ko.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,a=e.newTarget,i=e.dockingOrPoints,r=e.hints||{},l={};r.connectionStart&&(l.connectionStart=r.connectionStart),r.connectionEnd&&(l.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!a||r.docking==="source")&&(l.connectionStart=l.connectionStart||Tc((0,k.isArray)(i)?i[0]:i)),a&&(!n||r.docking==="target")&&(l.connectionEnd=l.connectionEnd||Tc((0,k.isArray)(i)?i[i.length-1]:i)),r.newWaypoints&&(l.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,l))},ko.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,a=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),a&&(i.waypoints=a),i};function Tc(e){return e.original||e}function Jt(e,t){this._modeling=e,this._rules=t}Jt.$inject=["modeling","rules"],Jt.prototype.preExecute=function(e){var t=this,n=this._modeling,a=this._rules,i=e.oldShape,r=e.newData,l=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:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(r,d,i.parent,l),i.host&&n.updateAttachment(s,i.host);var p;l.moveChildren!==!1&&(p=i.children.slice(),n.moveElements(p,{x:0,y:0},s,l));var f=i.incoming.slice(),h=i.outgoing.slice();(0,k.forEach)(f,function(g){var m=g.source;c(m,s,g)&&t.reconnectEnd(g,s,Ji(g,s,u),l)}),(0,k.forEach)(h,function(g){var m=g.target;c(s,m,g)&&t.reconnectStart(g,s,Ui(g,s,u),l)})},Jt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Jt.prototype.execute=function(e){},Jt.prototype.revert=function(e){},Jt.prototype.createShape=function(e,t,n,a){return this._modeling.createShape(e,t,n,a)},Jt.prototype.reconnectStart=function(e,t,n,a){this._modeling.reconnectStart(e,t,n,a)},Jt.prototype.reconnectEnd=function(e,t,n,a){this._modeling.reconnectEnd(e,t,n,a)};function So(e){this._modeling=e}So.$inject=["modeling"],So.prototype.execute=function(e){var t=e.shape,n=e.newBounds,a=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(n.width<a.width||n.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&n.width<10||n.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,k.assign)(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},So.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,a=e.oldBounds;(e.hints||{}).layout!==!1&&((0,k.forEach)(n.incoming,function(i){t.layoutConnection(i,{connectionEnd:Ji(i,n,a)})}),(0,k.forEach)(n.outgoing,function(i){t.layoutConnection(i,{connectionStart:Ui(i,n,a)})}))},So.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return(0,k.assign)(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Oy(e,t){var n=[];return(0,k.forEach)(e.concat(t),function(a){var i=a.incoming,r=a.outgoing;(0,k.forEach)(i.concat(r),function(l){var s=l.source,c=l.target;(Eo(e,s)||Eo(e,c)||Eo(t,s)||Eo(t,c))&&(Eo(n,l)||n.push(l))})}),n}function Eo(e,t){return e.indexOf(t)!==-1}function Iy(e,t,n){var a=e.x,i=e.y,r=e.width,l=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:a,y:i+c,width:r,height:l-c};case"s":return{x:a,y:i,width:r,height:l+c};case"w":return{x:a+s,y:i,width:r-s,height:l};case"e":return{x:a,y:i,width:r+s,height:l};default:throw new Error("unknown direction: "+t)}}function ln(e){this._modeling=e}ln.$inject=["modeling"],ln.prototype.preExecute=function(e){var t=e.delta,n=e.direction,a=e.movingShapes,i=e.resizingShapes,r=e.start,l={};this.moveShapes(a,t),(0,k.forEach)(i,function(s){l[s.id]=Hy(s)}),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(Oy(a,i),t,n,r,a,i,l)},ln.prototype.execute=function(){},ln.prototype.revert=function(){},ln.prototype.moveShapes=function(e,t){var n=this;(0,k.forEach)(e,function(a){n._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},ln.prototype.resizeShapes=function(e,t,n){var a=this;(0,k.forEach)(e,function(i){var r=Iy(i,n,t);a._modeling.resizeShape(i,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},ln.prototype.updateConnectionWaypoints=function(e,t,n,a,i,r,l){var s=this,c=i.concat(r);(0,k.forEach)(e,function(d){var u=d.source,p=d.target,f=Ly(d),h=Ac(n),g={};sn(c,u)&&sn(c,p)?(f=(0,k.map)(f,function(m){return Pc(m,a,n)&&(m[h]=m[h]+t[h]),m.original&&Pc(m.original,a,n)&&(m.original[h]=m.original[h]+t[h]),m}),s._modeling.updateWaypoints(d,f,{labelBehavior:!1})):(sn(c,u)||sn(c,p))&&(sn(i,u)?g.connectionStart=Yi(d,u,t):sn(i,p)?g.connectionEnd=Ki(d,p,t):sn(r,u)?g.connectionStart=Ui(d,u,l[u.id]):sn(r,p)&&(g.connectionEnd=Ji(d,p,l[p.id])),s._modeling.layoutConnection(d,g))})};function Mc(e){return(0,k.assign)({},e)}function Ly(e){return(0,k.map)(e.waypoints,function(t){return t=Mc(t),t.original&&(t.original=Mc(t.original)),t})}function Ac(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Pc(e,t,n){var a=Ac(n);if(/e|s/.test(n))return e[a]>t;if(/n|w/.test(n))return e[a]<t}function sn(e,t){return e.indexOf(t)!==-1}function Hy(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function va(e){this._modeling=e}va.$inject=["modeling"],va.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Vc(n),t.collapsed=!t.collapsed;var a=Nc(n,t.collapsed);return[t].concat(a)},va.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,a=t.children,i=jc(a,n);return t.collapsed=!t.collapsed,[t].concat(i)};function Vc(e){var t={};return(0,k.forEach)(e,function(n){t[n.id]=n.hidden,n.children&&(t=(0,k.assign)({},t,Vc(n.children)))}),t}function Nc(e,t){var n=[];return(0,k.forEach)(e,function(a){a.hidden=t,n=n.concat(a),a.children&&(n=n.concat(Nc(a.children,a.collapsed||t)))}),n}function jc(e,t){var n=[];return(0,k.forEach)(e,function(a){a.hidden=t[a.id],n=n.concat(a),a.children&&(n=n.concat(jc(a.children,t)))}),n}function ba(e){this._modeling=e}ba.$inject=["modeling"],ba.prototype.execute=function(e){var t=e.shape,n=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Oc(a,t),Ic(n,t),t.host=n,t},ba.prototype.revert=function(e){var t=e.shape,n=e.newHost,a=e.oldHost,i=e.attacherIdx;return t.host=a,Oc(n,t),Ic(a,t,i),t};function Oc(e,t){return sa(e&&e.attachers,t)}function Ic(e,t,n){if(e){var a=e.attachers;a||(e.attachers=a=[]),on(a,t,n)}}function qi(){}qi.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},qi.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ae(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var a=this;e.on("diagram.init",function(){a.registerHandlers(n)})}Ae.$inject=["eventBus","elementFactory","commandStack"],Ae.prototype.getHandlers=function(){return{"shape.append":da,"shape.create":rn,"shape.delete":Co,"shape.move":Sn,"shape.resize":So,"shape.replace":Jt,"shape.toggleCollapse":va,spaceTool:ln,"label.create":bo,"connection.create":ua,"connection.delete":wo,"connection.move":Wi,"connection.layout":ha,"connection.updateWaypoints":qi,"connection.reconnect":ko,"elements.create":Fi,"elements.move":ya,"elements.delete":$i,"elements.distribute":pa,"elements.align":ca,"element.updateAttachment":ba}},Ae.prototype.registerHandlers=function(e){(0,k.forEach)(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ae.prototype.moveShape=function(e,t,n,a,i){typeof a=="object"&&(i=a,a=null);var r={shape:e,delta:t,newParent:n,newParentIndex:a,hints:i||{}};this._commandStack.execute("shape.move",r)},Ae.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ae.prototype.moveElements=function(e,t,n,a){a=a||{};var i=a.attach,r=n,l;i===!0?(l=n,r=n.parent):i===!1&&(l=null);var s={shapes:e,delta:t,newParent:r,newHost:l,hints:a};this._commandStack.execute("elements.move",s)},Ae.prototype.moveConnection=function(e,t,n,a,i){typeof a=="object"&&(i=a,a=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:a,hints:i||{}};this._commandStack.execute("connection.move",r)},Ae.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ae.prototype.createConnection=function(e,t,n,a,i,r){typeof n=="object"&&(r=i,i=a,a=n,n=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:i,parentIndex:n,connection:a,hints:r};return this._commandStack.execute("connection.create",l),l.connection},Ae.prototype.createShape=function(e,t,n,a,i){typeof a!="number"&&(i=a,a=void 0),i=i||{};var r=i.attach,l,s;e=this._create("shape",e),r?(l=n.parent,s=n):l=n;var c={position:t,shape:e,parent:l,parentIndex:a,host:s,hints:i};return this._commandStack.execute("shape.create",c),c.shape},Ae.prototype.createElements=function(e,t,n,a,i){(0,k.isArray)(e)||(e=[e]),typeof a!="number"&&(i=a,a=void 0),i=i||{};var r={position:t,elements:e,parent:n,parentIndex:a,hints:i};return this._commandStack.execute("elements.create",r),r.elements},Ae.prototype.createLabel=function(e,t,n,a){n=this._create("label",n);var i={labelTarget:e,position:t,parent:a||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},Ae.prototype.appendShape=function(e,t,n,a,i){i=i||{},t=this._create("shape",t);var r={source:e,position:n,target:a,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",r),r.shape},Ae.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ae.prototype.distributeElements=function(e,t,n){var a={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",a)},Ae.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ae.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ae.prototype.replaceShape=function(e,t,n){var a={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",a),a.newShape},Ae.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ae.prototype.resizeShape=function(e,t,n,a){var i={shape:e,newBounds:t,minBounds:n,hints:a};this._commandStack.execute("shape.resize",i)},Ae.prototype.createSpace=function(e,t,n,a,i){var r={delta:n,direction:a,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",r)},Ae.prototype.updateWaypoints=function(e,t,n){var a={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",a)},Ae.prototype.reconnect=function(e,t,n,a,i){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:a,hints:i||{}};this._commandStack.execute("connection.reconnect",r)},Ae.prototype.reconnectStart=function(e,t,n,a){a||(a={}),this.reconnect(e,t,e.target,n,(0,k.assign)(a,{docking:"source"}))},Ae.prototype.reconnectEnd=function(e,t,n,a){a||(a={}),this.reconnect(e,e.source,t,n,(0,k.assign)(a,{docking:"target"}))},Ae.prototype.connect=function(e,t,n,a){return this.createConnection(e,t,n||{},e.parent,a)},Ae.prototype._create=function(e,t){return _y(t)?t:this._elementFactory.create(e,t)},Ae.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Lc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xi(e,t){if(!e||!t||!Array.isArray(t))return!1;const n=e.type||e.businessObject&&e.businessObject.type;return t.includes(n)}function zy(e,t){Array.isArray(e)&&e.forEach(t)}function wa(e){const t=e.businessObject;if(t)return t.name||""}function Dy(e,t){const n=e.businessObject;return n.name=t,e}var Fy={width:90,height:20},iC=15;function Zi(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function Hc(e){return Bo(e.label)}function $y(e){const t=e.length/2-1,n=e[Math.floor(t)],a=e[Math.ceil(t+.01)],i=Wy(e),r=Math.atan((a.y-n.y)/(a.x-n.x));let{x:l,y:s}=i;return Math.abs(r)<Math.PI/2?s-=15:l+=15,{x:l,y:s}}function Wy(e){const t=e.length/2-1,n=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:n.x+(a.x-n.x)/2,y:n.y+(a.y-n.y)/2}}function zc(e){return e.waypoints?$y(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Fy.height/2}}function Bo(e){return e&&!!e.labelTarget}var Uy={width:0,height:0};function Dc(e,t){function n(s,c){const d=s.label||s,u=s.labelTarget||s;return Dy(d,c,u!==d),[d,u]}function a(s){const{element:c,newLabel:d}=s,{businessObject:u}=c;if(!Bo(c)&&Zi(c)&&!Hc(c)&&!Fc(d)){let f=zc(c);f={x:f.x,y:f.y+7},e.createLabel(c,f,{id:u.id+"_label",businessObject:u})}}function i(s){return s.oldLabel=wa(s.element),n(s.element,s.newLabel)}function r(s){return n(s.element,s.oldLabel)}function l(s){const{element:c,newLabel:d}=s,u=c.label||c,p=s.hints||{};let{newBounds:f}=s;if(!Bo(u))return;if(Bo(u)&&Fc(d)){p.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const h=wa(u);typeof f>"u"&&(f=t.getExternalLabelBounds(u,h)),f&&e.resizeShape(u,f,Uy)}this.preExecute=a,this.execute=i,this.revert=r,this.postExecute=l}Dc.$inject=["modeling","textRenderer"];function Fc(e){return!e||!e.trim()}function Ro(e,t,n){Ae.call(this,e,t,n)}(0,$t.default)(Ro,Ae),Ro.$inject=["eventBus","elementFactory","commandStack"],Ro.prototype.getHandlers=function(){const e=Ae.prototype.getHandlers.call(this);return e["element.updateLabel"]=Dc,e},Ro.prototype.updateLabel=function(e,t,n,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:a||{}})};function Qi(e,t){dt.call(this,e);function n(a){const{context:i}=a,r=i.hints||{};let l;!i.cropped&&r.createElementsBehavior!==!1&&(l=i.connection,l.waypoints=t.getCroppedWaypoints(l),i.cropped=!0)}this.executed(["connection.layout","connection.create"],n)}(0,$t.default)(Qi,dt),Qi.$inject=["eventBus","connectionDocking"];function $c(){}$c.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Je(t.source||e.source),t.connectionEnd||Je(t.target||e.target)]};var Ca=20,Jy=5,xa=Math.round,Wc=20,Yy={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Ky(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Gy(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Uc(e,t,n){var a=nn(t,e,Jy),i=n.split(":")[0],r=xa((t.x-e.x)/2+e.x),l=xa((t.y-e.y)/2+e.y),s,c,d=Gy(i,a),u=/h|r|l/.test(i),p=!1,f=!1;return d?(s=u?{x:r,y:e.y}:{x:e.x,y:l},c=u?"h:h":"v:v"):(p=Ky(a,i),c=u?"h:v":"v:h",p?u?(f=l===e.y,s={x:e.x+Ca*(/l/.test(i)?-1:1),y:f?l+Ca:l}):(f=r===e.x,s={x:f?r+Ca:r,y:e.y+Ca*(/t/.test(i)?-1:1)}):s={x:r,y:l}),{waypoints:er(e,s,c).concat(s),directions:c,turnNextDirections:f}}function qy(e,t,n){return Uc(e,t,n)}function Xy(e,t,n){var a=Uc(t,e,Jc(n));return{waypoints:a.waypoints.slice().reverse(),directions:Jc(a.directions),turnNextDirections:a.turnNextDirections}}function Zy(e,t){var n=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var i=n+":"+a;return{waypoints:er(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}function Jc(e){return e.split(":").reverse().join(":")}function Qy(e,t,n){var a=xa((t.x-e.x)/2+e.x),i=xa((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(n==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function er(e,t,n){if(n=n||"h:h",!sv(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Kc(n)){var a=qy(e,t,n),i=Xy(e,t,n),r=Zy(a,i);return[].concat(a.waypoints,r.waypoints,i.waypoints)}return Qy(e,t,n)}function ev(e,t,n){var a=er(e,t,n);return a.unshift(e),a.push(t),qc(a)}function tv(e,t,n,a,i){var r=(0,k.without)(i&&i.preferredLayouts||[],"straight")[0]||"h:h",l=nn(e,t,Yy[r]||0),s=lv(l,r);n=n||Je(e),a=a||Je(t);var c=s.split(":");return ev(Gc(n,e,c[0],cv(l)),Gc(a,t,c[1],l),s)}function nv(e,t,n,a,i,r){(0,k.isArray)(n)&&(i=n,r=a,n=Je(e),a=Je(t)),r=(0,k.assign)({preferredLayouts:[]},r),i=i||[];var l=r.preferredLayouts.indexOf("straight")!==-1&&av(e,t,n,a,r);return l||(l=r.connectionEnd&&rv(t,e,a,i),l)||(l=r.connectionStart&&iv(e,t,n,i),l)?l:!r.connectionStart&&!r.connectionEnd&&i&&i.length?i:tv(e,t,n,a,r)}function ov(e,t,n){return e>=t&&e<=n}function Yc(e,t,n){return ov(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function av(e,t,n,a,i){var r={},l,s=nn(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(l="x"),/left|right/.test(s)&&(l="y"),i.preserveDocking==="target"?Yc(l,a,e)?(r[l]=a[l],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:a.x,y:a.y}]):null:Yc(l,n,t)?(r[l]=n[l],[{x:n.x,y:n.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 iv(e,t,n,a){return tr(e,t,n,a)}function rv(e,t,n,a){var i=a.slice().reverse();return i=tr(e,t,n,i),i?i.reverse():null}function tr(e,t,n,a){function i(u){return u.length<3?!0:u.length>4?!1:!!(0,k.find)(u,function(p,f){var h=u[f-1];return h&&mo(p,h)<3})}function r(u,p,f){switch(Zt(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 l(u,p,f){var h;for(h=u.length-2;h!==0;h--)if(Ws(u[h],p,Wc)||Ws(u[h],f,Wc))return u.slice(h);return u}if(i(a))return null;var s=a[0],c=a.slice(),d;return c[0]=n,c[1]=r(c[1],s,n),d=l(c,e,t),d!==c&&(c=tr(e,t,n,d)),c&&Zt(c)?null:c}function lv(e,t){if(Kc(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 sv(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Kc(e){return e&&/t|r|b|l/.test(e)}function cv(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 Gc(e,t,n,a){if(n==="h"&&(n=/left/.test(a)?"l":"r"),n==="v"&&(n=/top/.test(a)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function qc(e){return e.reduce(function(t,n,a){var i=t[t.length-1],r=e[a+1];return Mi(i,r,n,0)||t.push(n),t},[])}function nr(){}(0,$t.default)(nr,$c);var En=(e,t)=>e.type===t;nr.prototype.layoutConnection=function(e,t){t||(t={});const n=t.source||e.source,a=t.target||e.target,i=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:l}=t,s,c;return l===void 0&&(r=ka(i&&i[0],n),l=ka(i&&i[i.length-1],a)),r||(r=ka(i&&i[0],n)),l||(l=ka(i&&i[i.length-1],a)),En(e,"myline")&&(n===a?s={preferredLayouts:dv(n,e)}:En(n,"gatewayAnd")||En(n,"gatewayXor")||En(n,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:En(a,"gatewayAnd")||En(a,"gatewayXor")||En(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Fe(s,t),c=qc(nv(n,a,r,l,i,s))),c||[r,l]};function ka(e,t){return e?e.original||e:Je(t)}function dv(e,t){const{waypoints:n}=t,a=n&&n.length&&nn(n[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function Xc(e){return(0,k.assign)({original:e.point.original||e.point},e.actual)}function cn(e,t){this._elementRegistry=e,this._graphicsFactory=t}cn.$inject=["elementRegistry","graphicsFactory"],cn.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var a=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),r=e.waypoints.slice(a.idx+1,i.idx);return r.unshift(Xc(a)),r.push(Xc(i)),r},cn.prototype.getDockingPoint=function(e,t,n){var a=e.waypoints,i=n?0:a.length-1,r=a[i];return{point:r,actual:this._getIntersection(t,e,n)||r,idx:i}},cn.prototype._getIntersection=function(e,t,n){return Ni(this._getShapePath(e),this._getConnectionPath(t),n)},cn.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},cn.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},cn.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Zc={__depends__:[yy,Cy,Yn],__init__:["modeling","elementUpdater"],modeling:["type",Ro],layouter:["type",nr],elementUpdater:["type",Qi],elementFactory:["type",kn],connectionDocking:["type",cn]},uv=1e3;function Bn(e,t){var n=this;t=t||uv,e.on(["render.shape","render.connection"],t,function(a,i){var r=a.type,l=i.element,s=i.gfx,c=i.attrs;if(n.canRender(l))return r==="render.shape"?n.drawShape(s,l,c):n.drawConnection(s,l,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,i){if(n.canRender(i))return a.type==="render.getShapePath"?n.getShapePath(i):n.getConnectionPath(i)})}Bn.prototype.canRender=function(e){},Bn.prototype.drawShape=function(e,t){},Bn.prototype.drawConnection=function(e,t){},Bn.prototype.getShapePath=function(e){},Bn.prototype.getConnectionPath=function(e){};function fv(e){return e.businessObject}function Sa(e,t){return e.businessObject.strokeWidth||t||1}function Mt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Ye(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function pv(e){const t=e.x+e.width/2,n=e.y+e.height/2,a=e.width/2;return ho([["M",t,n],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]])}function hv(e,t){const{x:n,y:a,width:i,height:r}=e;return ho([["M",n+t,a],["l",i-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-i,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]])}function gv(e){const{x:t,y:n,width:a,height:i}=e,r=a/2,l=i/2;return ho([["M",t+r,n],["l",r,l],["l",-r,l],["l",-r,-l],["z"]])}function mv(e){const{x:t,y:n,width:a,height:i}=e;return ho([["M",t,n],["l",a,0],["l",0,i],["l",-a,0],["z"]])}var or=10,ar=.95,dn=(e,t)=>e.type===t;function Rn(e,t,n,a,i,r,l){Bn.call(this,e,l);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 H[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,L,$){L=f(L);const Q=ki(E,L,$);return(0,P.append)(M,Q),Q}function m(M,E,L){return g(M,E,L,5)}function y(M,E,L,$,Q){Lc($)&&(Q=$,$=0),$=$||0,Q=u(Q,{stroke:c,strokeWidth:2,fill:s}),Q.fill==="none"&&delete Q.fillOpacity;const se=E/2,ge=L/2,Ee=(0,P.create)("circle");return(0,P.attr)(Ee,{cx:se,cy:ge,r:Math.round((E+L)/4-$)}),(0,P.attr)(Ee,Q),(0,P.append)(M,Ee),Ee}function w(M,E,L,$,Q,se){Lc(Q)&&(se=Q,Q=0),Q=Q||0,se=u(se,{stroke:c,strokeWidth:2,fill:s});const ge=(0,P.create)("rect");return(0,P.attr)(ge,{x:Q,y:Q,width:E-Q*2,height:L-Q*2,rx:$,ry:$}),(0,P.attr)(ge,se),(0,P.append)(M,ge),ge}function x(M,E,L){L=u(L,["no-fill"],{strokeWidth:2,stroke:c});const $=(0,P.create)("path");return(0,P.attr)($,{d:E}),(0,P.attr)($,L),(0,P.append)(M,$),$}function v(M,E,L,$){const Q=E/2,se=L/2,ge=[{x:Q,y:0},{x:E,y:se},{x:Q,y:L},{x:0,y:se}].map(We=>We.x+","+We.y).join(" ");$=u($,{stroke:c,strokeWidth:2,fill:s});const Ee=(0,P.create)("polygon");return(0,P.attr)(Ee,{points:ge}),(0,P.attr)(Ee,$),(0,P.append)(M,Ee),Ee}function C(M,E,L,$){return x(E,L,Fe({"data-marker":M},$))}function _(M,E,L){L=Fe({size:{width:100}},L);const $=i.createText(E||"",L);return(0,P.classes)($).add("djs-label"),(0,P.append)(M,$),$}function b(M,E,L){return _(M,fv(E).name,{box:E,align:L,padding:5,style:{fill:Ye(E,c)}})}function B(M,E){const L={width:90,height:30,x:E.width/2+E.x,y:E.height/2+E.y};return _(M,wa(E),{box:L,fitBox:!0,style:Fe({},i.getExternalStyle(),{fill:Ye(E,c)})})}function S(M,E,L){const $=L&&L.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},zy(L,se=>{p(se)(M,E,Q)})}function T(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function A(M,E){const{ref:L={x:0,y:0},scale:$=1,element:Q,parentGfx:se=a._svg}=E,ge=(0,P.create)("marker",{id:M,viewBox:"0 0 20 20",refX:L.x,refY:L.y,markerWidth:20*$,markerHeight:20*$,orient:"auto"});(0,P.append)(ge,Q);let Ee=(0,W.query)(":scope > defs",se);Ee||(Ee=(0,P.create)("defs"),(0,P.append)(se,Ee)),(0,P.append)(Ee,ge)}function R(M,E,L,$){const Q=E+"-"+T(L)+"-"+T($)+"-"+gc();return j(M,Q,E,L,$),"url(#"+Q+")"}function j(M,E,L,$,Q){L==="sequenceflow-end"&&A(E,{element:(0,P.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}),L==="messageflow-start"&&A(E,{element:(0,P.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}),L==="messageflow-end"&&A(E,{element:(0,P.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}),L==="association-start"&&A(E,{element:(0,P.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}),L==="association-end"&&A(E,{element:(0,P.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}),L==="conditional-flow-marker"&&A(E,{element:(0,P.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}),L==="conditional-default-flow-marker"&&A(E,{element:(0,P.create)("path",{d:"M 6 4 L 10 16",...h({stroke:Q,fill:"none"})}),ref:{x:0,y:10},scale:.5,parentGfx:M})}function O(M,E,L,$){const Q=d[E.type]?.icon||E.icon;Q&&x(M,n.getScaledPath(Q,{abspos:{x:L,y:$}}),{strokeWidth:0,fill:Ye(E,d[E.type]?.iconFill||E.iconFill)})}const H={event(M,E,L){return"fillOpacity"in L||(L.fillOpacity=ar),y(M,E.width,E.height,L)},startEvent(M,E){const L={fill:Mt(E,d.startEvent?.fill||E.fill),stroke:Ye(E,d.startEvent?.stroke||E.stroke),strokeWidth:Sa(E,d.startEvent?.strokeWidth||E.strokeWidth)},$=p("event")(M,E,L);return O(M,E,18,18),$},endEvent(M,E){const L=p("event")(M,E,{strokeWidth:Sa(E,d.endEvent?.strokeWidth||E.strokeWidth||4),fill:Mt(E,d.endEvent?.fill||E.fill),stroke:Ye(E,d.endEvent?.stroke||E.stroke)});return O(M,E,18,18),L},gateway(M,E){const L={fillOpacity:ar,strokeWidth:Sa(E,d[E.type]?.strokeWidth||E.strokeWidth||4),fill:Mt(E,d[E.type]?.fill||E.fill),stroke:Ye(E,d[E.type]?.stroke||E.stroke)};return v(M,E.width,E.height,L)},gatewayAnd(M,E){const L=p("gateway")(M,E);return x(M,n.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:Ye(E,d[E.type]?.iconFill||E.iconFill),stroke:Ye(E,d[E.type]?.iconFill||E.iconFill)}),L},gatewayXor(M,E){const L=p("gateway")(M,E);return x(M,n.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),{strokeWidth:1,fill:Ye(E,d[E.type]?.iconFill||E.iconFill),stroke:Ye(E,d[E.type]?.iconFill||E.iconFill)}),L},gatewayInclusive(M,E){const L=p("gateway")(M,E);return y(M,E.width,E.height,E.height*.24,{strokeWidth:2.5,fill:Ye(E,s),stroke:Ye(E,d[E.type]?.iconFill||E.iconFill)}),L},activity(M,E,L){return L=L||{},"fillOpacity"in L||(L.fillOpacity=ar),w(M,E.width,E.height,or,L)},task(M,E){const L={fill:Mt(E,s),stroke:Ye(E,c)},$=p("activity")(M,E,L);return b(M,E,"center-middle"),S(M,E),$},userTask(M,E){const L=p("task")(M,E),$=15,Q=12;return x(M,n.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Mt(E,s),stroke:Ye(E,c)}),x(M,n.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Mt(E,s),stroke:Ye(E,c)}),x(M,n.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Ye(E,c),stroke:Ye(E,c)}),L},scriptTask(M,E){const L=p("task")(M,E);return x(M,n.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Ye(E,c)}),L},SubProcessMarker(M,E){jt(w(M,14,14,0,{strokeWidth:1,fill:Mt(E,s),stroke:Ye(E,c)}),E.width/2-7.5,E.height-20),C("sub-process",M,n.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:Ye(E,c)})},subprocess(M,E,L){L=Fe({fill:Mt(E,s),stroke:Ye(E,c)},L);const $=p("activity")(M,E,L);return b(M,E,"center-middle"),S(M,E,["SubProcessMarker"]),$},label(M,E){return B(M,E)},myline(M,E){const L=Mt(E,r.lineStroke||s),$=Ye(E,r.lineStroke||c);return m(M,E.waypoints,{markerEnd:R(M,"sequenceflow-end",L,$),stroke:$})},default(M,E){const L={strokeWidth:Sa(E,d[E.type]?.strokeWidth||E.strokeWidth||1),fill:Mt(E,d[E.type]?.fill||E.fill),stroke:Ye(E,d[E.type]?.stroke||E.stroke)},$=w(M,E.width,E.height,E.radius||or,L);return b(M,E,"center-middle"),S(M,E),O(M,E,E.iconX,E.iconY),$}};this.handlers=H,this._drawPath=x}(0,$t.default)(Rn,Bn),Rn.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],Rn.prototype.canRender=function(){return!0},Rn.prototype.drawShape=function(e,t){const{type:n}=t;return(this.handlers[n]||this.handlers.default)(e,t)},Rn.prototype.drawConnection=function(e,t){const{type:n}=t,a=this.handlers[n];return a(e,t)},Rn.prototype.getShapePath=function(e){return dn(e,"startEvent")||dn(e,"endEvent")?pv(e):dn(e,"userTask")||dn(e,"scriptTask")||dn(e,"subprocess")?hv(e,or):dn(e,"gatewayAnd")||dn(e,"gatewayXor")||dn(e,"gatewayInclusive")?gv(e):mv(e)};var yv=0,vv={width:150,height:50};function bv(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function wv(e){return(0,k.isObject)(e)?(0,k.assign)({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function Cv(e,t){t.textContent=e;var n;try{var a,i=e==="";return t.textContent=i?"dummy":e,n=t.getBBox(),a={width:n.width+n.x*2,height:n.height},i&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function xv(e,t,n){for(var a=e.shift(),i=a,r;;){if(r=Cv(i,n),r.width=i?r.width:0,i===" "||i===""||r.width<Math.round(t)||i.length<2)return kv(e,i,a,r);i=Ev(i,r.width,t)}}function kv(e,t,n,a){if(t.length<n.length){var i=n.slice(t.length).trim();e.unshift(i)}return{width:a.width,height:a.height,text:t}}var Qc="";function Sv(e,t){var n=e.split(/(\s|-|\u00AD)/g),a,i=[],r=0;if(n.length>1)for(;a=n.shift();)if(a.length+r<t)i.push(a),r+=a.length;else{(a==="-"||a===Qc)&&i.pop();break}var l=i[i.length-1];return l&&l===Qc&&(i[i.length-1]="-"),i.join("")}function Ev(e,t,n){var a=Math.max(e.length*(n/t),1),i=Sv(e,a);return i||(i=e.slice(0,Math.max(Math.round(a-1),1))),i}function Bv(){var e=document.getElementById("helper-svg");return e||(e=(0,P.create)("svg"),(0,P.attr)(e,{id:"helper-svg"}),(0,W.assignStyle)(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function Ea(e){this._config=(0,k.assign)({},{size:vv,padding:yv,style:{},align:"center-top"},e||{})}Ea.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ea.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ea.prototype.layoutText=function(e,t){var n=(0,k.assign)({},this._config.size,t.box),a=(0,k.assign)({},this._config.style,t.style),i=bv(t.align||this._config.align),r=wv(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,s=Rv(a),c=e.split(/\u00AD?\r?\n/),d=[],u=n.width-r.left-r.right,p=(0,P.create)("text");for((0,P.attr)(p,{x:0,y:0}),(0,P.attr)(p,a),(0,P.append)(Bv(),p);c.length;)d.push(xv(c,u,p));i.vertical==="middle"&&(r.top=r.bottom=0);var f=(0,k.reduce)(d,function(y,w,x){return y+(s||w.height)},0)+r.top+r.bottom,h=(0,k.reduce)(d,function(y,w,x){return w.width>y?w.width:y},0),g=r.top;i.vertical==="middle"&&(g+=(n.height-f)/2),g-=(s||d[0].height)/4;var m=(0,P.create)("text");return(0,P.attr)(m,a),(0,k.forEach)(d,function(y){var w;switch(g+=s||y.height,i.horizontal){case"left":w=r.left;break;case"right":w=(l?h:u)-r.right-y.width;break;default:w=Math.max(((l?h:u)-y.width)/2+r.left,0)}var x=(0,P.create)("tspan");(0,P.attr)(x,{x:w,y:g}),x.textContent=y.text,(0,P.append)(m,x)}),(0,P.remove)(p),{dimensions:{width:h,height:f},element:m}};function Rv(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var _v=12,Tv=1.2,Mv=30;function ed(e){const t=Fe({fontFamily:"Arial, sans-serif",fontSize:_v,fontWeight:"normal",lineHeight:Tv},e&&e.defaultStyle||{}),n=Fe({},t,{fontSize:parseInt(t.fontSize,10)-1},e&&e.externalStyle||{}),a=new Ea({style:t});this.getExternalLabelBounds=function(i,r){const l=a.getDimensions(r,{box:{width:90,height:30,x:i.width/2+i.x,y:i.height/2+i.y},style:n});return{x:Math.round(i.x+i.width/2-l.width/2),y:Math.round(i.y),width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(i,r){const l=a.getDimensions(r,{box:i,style:t,align:"left-top",padding:5});return{x:i.x,y:i.y,width:i.width,height:Math.max(Mv,Math.round(l.height))}},this.createText=function(i,r){return a.createText(i,r||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return n}}ed.$inject=["config.textRenderer"];function Av(){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,n){let a,i;n.abspos?(a=n.abspos.x,i=n.abspos.y):(a=n.containerWidth*n.position.mx,i=n.containerHeight*n.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&&(i-=r.height/2)):r=this.pathMap[t];const l={};if(n.position){const s=n.containerHeight/r.height*n.yScaleFactor,c=n.containerWidth/r.width*n.xScaleFactor;for(let d=0;d<r.heightElements.length;d++)l["y"+d]=r.heightElements[d]*s;for(let d=0;d<r.widthElements.length;d++)l["x"+d]=r.widthElements[d]*c}return jv(r.d,{mx:a,my:i,e:l})}}var Pv=/\{([^}]+)\}/g,Vv=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Nv(e,t,n){let a=n;return t.replace(Vv,(i,r,l,s,c)=>{r=r||s,a&&(r in a&&(a=a[r]),typeof a=="function"&&c&&(a=a()))}),a=(a==null||a===n?e:a)+"",a}function jv(e,t){return String(e).replace(Pv,(n,a)=>Nv(n,a,t))}var td={__init__:["myRenderer"],myRenderer:["type",Rn],textRenderer:["type",ed],pathMap:["type",Av]};function nd(e,t){return Fe({id:e.id,type:e.type,businessObject:e},t)}function Ov(e,t,n){const a=e.waypoint;return!a||a.length<2?[Je(t),Je(n)]:a.map(i=>({x:i.x,y:i.y}))}function un(e,t,n,a,i,r){this._eventBus=e,this._canvas=n,this._elementFactory=a,this._elementRegistry=i,this._translate=mc,this._textRenderer=r,this._modeling=t}un.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],un.prototype.add=function(e){let t;const{label:n}=e;if(n&&(n.id=e.id,n.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),i=this._getTarget(e);t=this._elementFactory.createConnection(nd(e,{source:a,target:i,waypoints:Ov(e,a,i)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(nd(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return n&&t&&this.addLabel(n,t),t},un.prototype.addLabel=function(e,t){const n=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(n,t.parent)},un.prototype.update=function(e,t){const n=this._elementRegistry.get(e);n.businessObject=Fe(n.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(n),this._canvas.addConnection(n,n.parent)):(this._canvas.removeShape(n),this._canvas.addShape(n,n.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=n.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,n.parent);else{const{name:i}=t;if(i&&["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:i,id:e},l=this._textRenderer.getExternalLabelBounds(r,t.name);this._modeling.resizeShape(r,l,{width:0,height:0}),n&&this.addLabel(r,n)}}},un.prototype._getSource=function(e){return this._getElement(e.from)},un.prototype._getTarget=function(e){return this._getElement(e.to)},un.prototype._getElement=function(e){return this._elementRegistry.get(e)};var od={myImporter:["type",un]},ad=e=>{const t=[];return e.forEach(n=>{if(n.type!==void 0){const a=n.businessObject;if(n.type==="myline")n.source&&n.target&&(a.from=n.source.id,a.to=n.target.id,a.waypoint=n.waypoints.map(i=>({x:i.x,y:i.y})),t.push(a));else if(n.type!=="label")a.x=n.x,a.y=n.y,t.push(a);else{const i=t.find(r=>r.id===a.id);i&&(i.name=a.name||"",i.label={x:n.x,y:n.y,height:n.height,width:n.width})}}}),t},id=(e,t)=>{const n=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),i=e.filter(r=>r.type==="myline");a.forEach(r=>{n.add(r)}),i.forEach(r=>{n.add(r)})},Iv=(0,o.defineComponent)({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=(0,o.ref)(),l={"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",B=>{i("elementDblclick",B.element.businessObject)}),b.on("element.click",B=>{i("elementClick",B.element.businessObject)})},p=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},f=()=>{let b={__init__:["myOptions"],myOptions:["type",p]};s=new Yo.default({canvas:{container:r.value},modules:[Oi,$s,Zc,cc,fc,b,td,od]});const B=s.get("canvas"),S=s.get("elementFactory");d();const T=S.createRoot();B.setRootElement(T),u()};(0,o.onMounted)(()=>{f()});const h=b=>{const B=b==null?1:c+b;s.get("canvas").zoom(B),c=B},g=()=>(s.get("canvas").zoom(1),ad(s.get("elementRegistry").getAll())),m=b=>{s.clear(),d(),id(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,B)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),Lv=Iv;function ir(e){return e&&e[e.length-1]}function rd(e){return e.y}function ld(e){return e.x}var Hv={left:ld,center:ld,right:function(e){return e.x+e.width},top:rd,middle:rd,bottom:function(e){return e.y+e.height}};function eo(e,t){this._modeling=e,this._rules=t}eo.$inject=["modeling","rules"],eo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",a="width";return t.indexOf(e)!==-1&&(n="y",a="height"),{axis:n,dimension:a}},eo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},eo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),a=n.axis,i=n.dimension,r={},l={},s=!1,c,d,u;function p(f,h){return Math.round((f[a]+h[a]+h[i])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=ir(t),r[e]=u[a]+u[i];else if(this._isType(e,["center","middle"])){if((0,k.forEach)(t,function(f){var h=f[a]+Math.round(f[i]/2);l[h]?l[h].elements.push(f):l[h]={elements:[f],center:h}}),c=(0,k.sortBy)(l,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=ir(c).center,r;d=t[0],t=(0,k.sortBy)(t,function(f){return f[a]+f[i]}),u=ir(t),r[e]=p(d,u)}return r},eo.prototype.trigger=function(e,t){var n=this._modeling,a,i=(0,k.filter)(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:i}),(0,k.isArray)(a)&&(i=a),!(i.length<2||!a)){var r=Hv[t],l=(0,k.sortBy)(i,r),s=this._alignmentPosition(t,l);n.alignElements(l,s)}};var zv={__init__:["alignElements"],alignElements:["type",eo]},Ba=Math.round,Dv=Math.max;function Fv(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 $v(e){var t=[];return e.forEach(function(n,a){t.push([a===0?"M":"L",n.x,n.y])}),t}var sd=10;function Wv(e,t){var n,a;for(n=0;a=e[n];n++)if(mo(a,t)<=sd)return{point:e[n],bendpoint:!0,index:n};return null}function Uv(e,t){var n=Zs(Fv(t,sd),$v(e)),a=n[0],i=n[n.length-1],r;return a?a!==i?a.segment2!==i.segment2?(r=Dv(a.segment2,i.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Ba(a.x+i.x)/2,y:Ba(a.y+i.y)/2},index:a.segment2}:{point:{x:Ba(a.x),y:Ba(a.y)},index:a.segment2}:null}function Jv(e,t){return Wv(e,t)||Uv(e,t)}function Yv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Kv(e,t,n){var a=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],i=a[0].n*t[0]+a[1].n*t[1],r=a[0].lambda*t[0]+a[1].lambda*t[1];return-i/r}function cd(e,t){var n=t[0],a=t[1],i={x:a.x-n.x,y:a.y-n.y},r=Kv([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+r*i.x,y:n.y+r*i.y}}function Gv(e,t){var n=cd(e,t);return Yv({x:n.x-e.x,y:n.y-e.y})}var dd="djs-bendpoint",ud="djs-segment-dragger";function qv(e,t){var n=Un(t),a=e._container.getBoundingClientRect(),i={x:a.left,y:a.top},r=e.viewbox();return{x:r.x+(n.x-i.x)/r.scale,y:r.y+(n.y-i.y)/r.scale}}function rr(e,t,n){return Jv(t,qv(e,n))}function lr(e,t){var n=(0,P.create)("g");(0,P.classes)(n).add(dd),(0,P.append)(e,n);var a=(0,P.create)("circle");(0,P.attr)(a,{cx:0,cy:0,r:4}),(0,P.classes)(a).add("djs-visual"),(0,P.append)(n,a);var i=(0,P.create)("circle");return(0,P.attr)(i,{cx:0,cy:0,r:10}),(0,P.classes)(i).add("djs-hit"),(0,P.append)(n,i),t&&(0,P.classes)(n).add(t),n}function Xv(e,t,n,a){var i=(0,P.create)("g");(0,P.append)(e,i);var r=18,l=6,s=11,c=Qv(t,n,a),d=l+s,u=(0,P.create)("rect");(0,P.attr)(u,{x:-r/2,y:-l/2,width:r,height:l}),(0,P.classes)(u).add("djs-visual"),(0,P.append)(i,u);var p=(0,P.create)("rect");return(0,P.attr)(p,{x:-c/2,y:-d/2,width:c,height:d}),(0,P.classes)(p).add("djs-hit"),(0,P.append)(i,p),Im(i,a==="v"?90:0,0,0),i}function fd(e,t,n){var a=(0,P.create)("g"),i=Ai(t,n),r=Zt(t,n);return(0,P.append)(e,a),Xv(a,t,n,r),(0,P.classes)(a).add(ud),(0,P.classes)(a).add(r==="h"?"horizontal":"vertical"),jt(a,i.x,i.y),a}function sr(e){return Math.abs(Math.round(e*2/3))}function Zv(e,t){return cd(e,eb(e,t))}function Qv(e,t,n){var a=t.x-e.x,i=t.y-e.y;return sr(n==="h"?a:i)}function eb(e,t){for(var n=t.waypoints,a=1/0,i,r=0;r<n.length-1;r++){var l=n[r],s=n[r+1],c=Gv(e,[l,s]);c<a&&(a=c,i=r)}return[n[i],n[i+1]]}function cr(e){return CSS.escape(e)}function pd(e,t,n,a,i){function r(v,C,_){var b=v.index,B=v.point,S,T,A,R,j,O;return b<=0||v.bendpoint?!1:(S=C[b-1],T=C[b],A=Ai(S,T),R=Zt(S,T),j=Math.abs(B.x-A.x),O=Math.abs(B.y-A.y),R&&j<=_&&O<=_)}function l(v,C){var _=v.waypoints,b,B,S,T;return C.index<=0||C.bendpoint||(b={start:_[C.index-1],end:_[C.index]},B=Zt(b.start,b.end),!B)?null:(B==="h"?S=b.end.x-b.start.x:S=b.end.y-b.start.y,T=sr(S)/2,T)}function s(v,C){var _=C.waypoints,b=rr(t,_,v),B;if(b)return B=l(C,b),r(b,_,B)?i.start(v,C,b.index):a.start(v,C,b.index,!b.bendpoint),!0}function c(v,C,_){W.event.bind(v,C,function(b){n.triggerMouseEvent(C,b,_),b.stopPropagation()})}function d(v,C){var _=t.getLayer("overlays"),b=(0,W.query)('.djs-bendpoints[data-element-id="'+cr(v.id)+'"]',_);return!b&&C&&(b=(0,P.create)("g"),(0,P.attr)(b,{"data-element-id":v.id}),(0,P.classes)(b).add("djs-bendpoints"),(0,P.append)(_,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(_,b){var B=lr(v);(0,P.append)(v,B),jt(B,_.x,_.y)}),lr(v,"floating")}function f(v,C){for(var _=C.waypoints,b,B,S,T=1;T<_.length;T++)b=_[T-1],B=_[T],Zt(b,B)&&(S=fd(v,b,B),(0,P.attr)(S,{"data-segment-idx":T}),c(S,"mousemove",C))}function h(v){(0,k.forEach)((0,W.queryAll)("."+dd,v),function(C){(0,P.remove)(C)})}function g(v){(0,k.forEach)((0,W.queryAll)("."+ud,v),function(C){(0,P.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 _=(0,W.query)(".floating",v),b=C.point;_&&jt(_,b.x,b.y)}function x(v,C,_){var b=u(C.index,v),B=_[C.index-1],S=_[C.index],T=C.point,A=Ai(B,S),R=Zt(B,S),j,O;b&&(j=tb(b),O={x:T.x-A.x,y:T.y-A.y},R==="v"&&(O={x:O.y,y:O.x}),jt(j,O.x,O.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var C=d(v.element);C&&(0,P.remove)(C)}),e.on("element.marker.update",function(v){var C=v.element,_;C.waypoints&&(_=m(C),v.add?(0,P.classes)(_).add(v.marker):(0,P.classes)(_).remove(v.marker))}),e.on("element.mousemove",function(v){var C=v.element,_=C.waypoints,b,B;if(_){if(b=d(C,!0),B=rr(t,_,v.originalEvent),!B)return;w(b,B),B.bendpoint||x(b,B,_)}}),e.on("element.mousedown",function(v){if(qt(v)){var C=v.originalEvent,_=v.element;if(_.waypoints)return s(C,_)}}),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),n.registerEvent(v.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(v){n.unregisterEvent(v.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(v){var C=v.element,_=v.newId;if(C.waypoints){var b=d(C);b&&(0,P.attr)(b,{"data-element-id":_})}}),this.addHandles=m,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}pd.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function tb(e){return(0,W.query)(".djs-visual",e)}var hd=Math.round,_n="reconnectStart",Tn="reconnectEnd",_o="updateWaypoints";function dr(e,t,n,a,i,r){this._injector=e,this.start=function(l,s,c,d){var u=n.getGraphics(s),p=s.source,f=s.target,h=s.waypoints,g;!d&&c===0?g=_n:!d&&c===h.length-1?g=Tn:g=_o;var m=g===_o?"connection.updateWaypoints":"connection.reconnect",y=i.allowed(m,{connection:s,source:p,target:f});y===!1&&(y=i.allowed(m,{connection:s,source:f,target:p})),y!==!1&&a.init(l,"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(l){var s=l.context,c=s.connection,d=c.source,u=c.target,p=l.hover,f=s.type;s.hover=p;var h;if(p){var g=f===_o?"connection.updateWaypoints":"connection.reconnect";if(h=s.allowed=i.allowed(g,{connection:c,source:f===_n?p:d,target:f===Tn?p:u}),h){s.source=f===_n?p:d,s.target=f===Tn?p:u;return}h===!1&&(h=s.allowed=i.allowed(g,{connection:c,source:f===Tn?p:u,target:f===_n?p:d})),h&&(s.source=f===Tn?p:u,s.target=f===_n?p:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var s=l.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==_o&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(l){var s=l.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:hd(l.x),y:hd(l.y)};if(!c)return!1;m===_o?(p?f.splice(d,0,w):f[d]=w,y.bendpointMove={insert:p,bendpointIndex:d},f=this.cropWaypoints(u,f),r.updateWaypoints(u,ly(f),y)):(m===_n?(y.docking="source",Ra(s)&&(y.docking="target",y.newWaypoints=f.reverse())):m===Tn&&(y.docking="target",Ra(s)&&(y.docking="source",y.newWaypoints=f.reverse())),r.reconnect(u,h,g,w,y))},this)}dr.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],dr.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Ra(e){var t=e.hover,n=e.source,a=e.target,i=e.type;if(i===_n)return t&&a&&t===a&&n!==a;if(i===Tn)return t&&n&&t===n&&n!==a}var nb="reconnectStart",ob="reconnectEnd",gd="updateWaypoints",To="connect-ok",_a="connect-not-ok",md="connect-hover",yd="djs-updating",vd="djs-dragging",bd=1100;function wd(e,t,n,a){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var l=r.context,s=l.bendpointIndex,c=l.connection,d=l.insert,u=c.waypoints,p=u.slice();l.waypoints=u,d&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p,(0,P.classes)(l.draggerGfx=lr(a.getLayer("overlays"))).add("djs-dragging"),a.addMarker(c,vd),a.addMarker(c,yd)}),n.on("bendpoint.move.hover",function(r){var l=r.context,s=l.allowed,c=l.hover,d=l.type;if(c){if(a.addMarker(c,md),d===gd)return;s?(a.removeMarker(c,_a),a.addMarker(c,To)):s===!1&&(a.removeMarker(c,To),a.addMarker(c,_a))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],bd,function(r){var l=r.context,s=l.hover,c=l.target;s&&(a.removeMarker(s,md),a.removeMarker(s,c?To:_a))}),n.on("bendpoint.move.move",function(r){var l=r.context,s=l.allowed,c=l.bendpointIndex,d=l.draggerGfx,u=l.hover,p=l.type,f=l.connection,h=f.source,g=f.target,m=f.waypoints.slice(),y={x:r.x,y:r.y},w=l.hints||{},x={};i&&(w.connectionStart&&(x.connectionStart=w.connectionStart),w.connectionEnd&&(x.connectionEnd=w.connectionEnd),p===nb?Ra(l)?(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===ob?Ra(l)?(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===gd&&(m=e.cropWaypoints(f,m)),x.waypoints=m,i.drawPreview(l,s,x)),jt(d,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],bd,function(r){var l=r.context,s=l.connection,c=l.draggerGfx,d=l.hover,u=l.target;s.waypoints=l.waypoints,(0,P.remove)(c),a.removeMarker(s,yd),a.removeMarker(s,vd),d&&(a.removeMarker(d,To),a.removeMarker(d,u?To:_a)),i&&i.cleanUp(l)})}wd.$inject=["bendpointMove","injector","eventBus","canvas"];var Cd="connect-hover",xd="djs-updating";function kd(e,t,n){return ur(e,t,e[t]+n)}function ur(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function ab(e,t,n,a){var i=Math.max(t[a],n[a]),r=Math.min(t[a],n[a]),l=20;return ur(t,a,Math.min(Math.max(r+l,e[a]),i-l))}function Sd(e){return e==="x"?"y":"x"}function Ed(e,t,n){var a,i;return e.original?e.original:(a=Je(t),i=Sd(n),ur(e,i,a[i]))}function Bd(e,t,n,a,i,r){var l=e.get("connectionDocking",!1);this.start=function(p,f,h){var g,m=n.getGraphics(f),y=h-1,w=h,x=f.waypoints,v=x[y],C=x[w],_=rr(n,x,p),b=Zt(v,C),B,S;b&&(B=b==="v"?"x":"y",y===0&&(v=Ed(v,f.source,B)),w===x.length-1&&(C=Ed(C,f.target,B)),_?S=_.point:S={x:(v.x+C.x)/2,y:(v.y+C.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:w,segmentStart:v,segmentEnd:C,axis:B,dragPosition:S},a.init(p,S,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:g}}))};function s(p,f){if(!l)return f;var h=p.waypoints,g;return p.waypoints=f,g=l.getCroppedWaypoints(p),p.waypoints=h,g}function c(p){i.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=ab(h,m,y,Sd(p.axis));jt(p.draggerGfx,w.x,w.y)}function u(p,f){var h=0;return{waypoints:p.filter(function(g,m){return Mi(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=n.getLayer("overlays");f.originalWaypoints=h.waypoints.slice(),f.draggerGfx=fd(g,f.segmentStart,f.segmentEnd),(0,P.classes)(f.draggerGfx).add("djs-dragging"),n.addMarker(h,xd)}),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=kd(y,x,p["d"+x]),_=kd(w,x,p["d"+x]),b=v.length,B=0;v[g]=C,v[m]=_;var S,T;g<2&&(S=nn(h.source,C),g===1?S==="intersect"&&(v.shift(),v[0]=C,B--):S!=="intersect"&&(v.unshift(y),B++)),m>b-3&&(T=nn(h.target,_),m===b-2?T==="intersect"&&(v.pop(),v[v.length-1]=_):T!=="intersect"&&v.push(w)),f.newWaypoints=h.waypoints=s(h,v),d(f,B,p),f.newSegmentStartIndex=g+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Cd)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Cd)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,h=f.connection;f.draggerGfx&&(0,P.remove)(f.draggerGfx),n.removeMarker(h,xd)}),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(_){return{original:_.original,x:Math.round(_.x),y:Math.round(_.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)})}Bd.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ib=Math.abs,Rd=Math.round;function rb(e,t,n){n=n===void 0?10:n;var a,i;for(a=0;a<t.length;a++)if(i=t[a],ib(i-e)<=n)return i}function lb(e){return{x:e.x,y:e.y}}function sb(e){return{x:e.x+e.width,y:e.y+e.height}}function to(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Rd(e.x+e.width/2),y:Rd(e.y+e.height/2)}}function Ta(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Yt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var a,i=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,a=n-i,e[t]+=a,e["d"+t]+=a),i}function _d(e){return e.children||[]}var cb=Math.abs,Td=Math.round,fr=10;function Md(e){function t(r,l){if((0,k.isArray)(r)){for(var s=r.length;s--;)if(cb(r[s]-l)<=fr)return r[s]}else{r=+r;var c=l%r;if(c<fr)return l-c;if(c>r-fr)return l-c+r}return l}function n(r,l){if(r.waypoints)return Zv(l,r);if(r.width)return{x:Td(r.width/2+r.x),y:Td(r.height/2+r.y)}}function a(r){var l=r.context,s=l.snapPoints,c=l.connection,d=c.waypoints,u=l.segmentStart,p=l.segmentStartIndex,f=l.segmentEnd,h=l.segmentEndIndex,g=l.axis;if(s)return s;var m=[d[p-1],u,f,d[h+1]];return p<2&&m.unshift(n(c.source,r)),h>d.length-3&&m.unshift(n(c.target,r)),l.snapPoints=s={horizontal:[],vertical:[]},(0,k.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 l=a(r),s=r.x,c=r.y,d,u;if(l){d=t(l.vertical,s),u=t(l.horizontal,c);var p=s-d,f=c-u;(0,k.assign)(r,{dx:r.dx-p,dy:r.dy-f,x:d,y:u}),(p||l.vertical.indexOf(s)!==-1)&&Yt(r,"x",d),(f||l.horizontal.indexOf(c)!==-1)&&Yt(r,"y",u)}});function i(r){var l=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(l)return l;var d=[s[c-1],s[c+1]];return r.snapPoints=l={horizontal:[],vertical:[]},(0,k.forEach)(d,function(u){u&&(u=u.original||u,l.horizontal.push(u.y),l.vertical.push(u.x))}),l}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var l=r.context.hover,s=l&&n(l,r);!yt(l)||!s||!s.x||!s.y||(Yt(r,"x",s.x),Yt(r,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var l=r.context,s=i(l),c=l.hover,d=c&&n(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,k.assign)(r,{dx:r.dx-g,dy:r.dy-m,x:r.x-g,y:r.y-m}),(g||s.vertical.indexOf(u)!==-1)&&Yt(r,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Yt(r,"y",h)}})}Md.$inject=["eventBus"];var db={__depends__:[Cn,qn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",pd],bendpointMove:["type",dr],bendpointMovePreview:["type",wd],connectionSegmentMove:["type",Bd],bendpointSnapping:["type",Md]},ub="djs-dragger";function Kt(e,t,n,a){this._canvas=t,this._graphicsFactory=n,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Kt.$inject=["injector","canvas","graphicsFactory","elementFactory"],Kt.prototype.drawPreview=function(e,t,n){n=n||{};var a=e.connectionPreviewGfx,i=e.getConnection,r=n.source,l=n.target,s=n.waypoints,c=n.connectionStart,d=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,h,g=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),(0,P.clear)(a),i||(i=e.getConnection=fb(function(m,y,w){return g.getConnection(m,y,w)})),t&&(h=i(t,r,l)),!h){!f&&this.drawNoopPreview(a,n);return}h.waypoints=s||[],this._layouter&&!u&&(h.waypoints=this._layouter.layoutConnection(h,{source:r,target:l,connectionStart:c,connectionEnd:d,waypoints:n.waypoints||h.waypoints})),(!h.waypoints||!h.waypoints.length)&&(h.waypoints=[r?Je(r):c,l?Je(l):d]),this._connectionDocking&&(r||l)&&!p&&(h.waypoints=this._connectionDocking.getCroppedWaypoints(h,r,l)),this._graphicsFactory.drawConnection(a,h,{stroke:"var(--element-dragger-color)"})},Kt.prototype.drawNoopPreview=function(e,t){var n=t.source,a=t.target,i=t.connectionStart||Je(n),r=t.connectionEnd||Je(a),l=this.cropWaypoints(i,r,n,a);(0,P.append)(e,this.createNoopConnection(l[0],l[1]))},Kt.prototype.cropWaypoints=function(e,t,n,a){var i=this._graphicsFactory,r=n&&i.getShapePath(n),l=a&&i.getShapePath(a),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&Ni(r,s,!0)||e,t=a&&Ni(l,s,!1)||t,[e,t]},Kt.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&(0,P.remove)(e.connectionPreviewGfx)},Kt.prototype.getConnection=function(e){var t=pb(e);return this._elementFactory.createConnection(t)},Kt.prototype.createConnectionPreviewGfx=function(){var e=(0,P.create)("g");return(0,P.attr)(e,{pointerEvents:"none"}),(0,P.classes)(e).add(ub),(0,P.append)(this._canvas.getActiveLayer(),e),e},Kt.prototype.createNoopConnection=function(e,t){return ki([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function fb(e){var t={};return function(n){var a=JSON.stringify(n),i=t[a];return i||(i=t[a]=e.apply(null,arguments)),i}}function pb(e){return(0,k.isObject)(e)?e:{}}var hb={__init__:["connectionPreview"],connectionPreview:["type",Kt]},gb=new ia("ov"),mb=500;function st(e,t,n,a){this._eventBus=t,this._canvas=n,this._elementRegistry=a,this._ids=gb,this._overlayDefaults=(0,k.assign)({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=yb(n.getContainer()),this._init()}st.$inject=["config.overlays","eventBus","canvas","elementRegistry"],st.prototype.get=function(e){if((0,k.isString)(e)&&(e={id:e}),(0,k.isString)(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?(0,k.filter)(t.overlays,(0,k.matchPattern)({type:e.type})):t.overlays.slice():[]}else return e.type?(0,k.filter)(this._overlays,(0,k.matchPattern)({type:e.type})):e.id?this._overlays[e.id]:null},st.prototype.add=function(e,t,n){if((0,k.isObject)(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return n=(0,k.assign)({},this._overlayDefaults,n,{id:a,type:t,element:e,html:n.html}),this._addOverlay(n),a},st.prototype.remove=function(e){var t=this.get(e)||[];(0,k.isArray)(t)||(t=[t]);var n=this;(0,k.forEach)(t,function(a){var i=n._getOverlayContainer(a.element,!0);if(a&&((0,W.remove)(a.html),(0,W.remove)(a.htmlContainer),delete a.htmlContainer,delete a.element,delete n._overlays[a.id]),i){var r=i.overlays.indexOf(a);r!==-1&&i.overlays.splice(r,1)}})},st.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},st.prototype.show=function(){Ma(this._overlayRoot)},st.prototype.hide=function(){Ma(this._overlayRoot,!1)},st.prototype.clear=function(){this._overlays={},this._overlayContainers=[],(0,W.clear)(this._overlayRoot)},st.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,a=t.x,i=t.y;if(t.waypoints){var r=Nt(t);a=r.x,i=r.y}Ad(n,a,i),(0,W.attr)(e.html,"data-container-id",t.id)},st.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,a=e.element,i=t.left,r=t.top;if(t.right!==void 0){var l;a.waypoints?l=Nt(a).width:l=a.width,i=t.right*-1+l}if(t.bottom!==void 0){var s;a.waypoints?s=Nt(a).height:s=a.height,r=t.bottom*-1+s}Ad(n,i||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},st.prototype._createOverlayContainer=function(e){var t=(0,W.domify)('<div class="djs-overlays" />');(0,W.assignStyle)(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},st.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Pd(this._overlayRoot,n)},st.prototype._getOverlayContainer=function(e,t){var n=(0,k.find)(this._overlayContainers,function(a){return a.element===e});return!n&&!t?this._createOverlayContainer(e):n},st.prototype._addOverlay=function(e){var t=e.id,n=e.element,a=e.html,i,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),(0,k.isString)(a)&&(a=(0,W.domify)(a)),r=this._getOverlayContainer(n),i=(0,W.domify)('<div class="djs-overlay" data-overlay-id="'+t+'">'),(0,W.assignStyle)(i,{position:"absolute"}),i.appendChild(a),e.type&&(0,W.classes)(i).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ma(i,l===s),e.htmlContainer=i,r.overlays.push(e),r.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},st.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,a=this._canvas.findRoot(e.element),i=n&&n.minZoom,r=n&&n.maxZoom,l=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(a!==s||n&&((0,k.isDefined)(i)&&i>t.scale||(0,k.isDefined)(r)&&r<t.scale))&&(c=!1),Ma(l,c),this._updateOverlayScale(e,t)},st.prototype._updateOverlayScale=function(e,t){var n=e.scale,a,i,r=e.htmlContainer,l,s="";n!==!0&&(n===!1?(a=1,i=1):(a=n.min,i=n.max),(0,k.isDefined)(a)&&t.scale<a&&(l=(1/t.scale||1)*a),(0,k.isDefined)(i)&&t.scale>i&&(l=(1/t.scale||1)*i)),(0,k.isDefined)(l)&&(s="scale("+l+","+l+")"),Pd(r,s)},st.prototype._updateOverlaysVisibilty=function(e){var t=this;(0,k.forEach)(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},st.prototype._init=function(){var e=this._eventBus,t=this;function n(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){n(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var i=a.element;(0,k.forEach)(t.get({element:i}),function(s){t.remove(s.id)});var r=t._getOverlayContainer(i);if(r){(0,W.remove)(r.html);var l=t._overlayContainers.indexOf(r);l!==-1&&t._overlayContainers.splice(l,1)}}),e.on("element.changed",mb,function(a){var i=a.element,r=t._getOverlayContainer(i,!0);r&&((0,k.forEach)(r.overlays,function(l){t._updateOverlay(l)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(a){var i=t._getOverlayContainer(a.element,!0);i&&(0,W.classes)(i.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 yb(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 Ad(e,t,n){(0,W.assignStyle)(e,{left:t+"px",top:n+"px"})}function Ma(e,t){e.style.display=t===!1?"none":""}function Pd(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}var vb={__init__:["overlays"],overlays:["type",st]},bb=new ia;function no(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}no.$inject=["eventBus"],no.prototype.schedule=function(e,t=bb.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},no.prototype._schedule=function(e,t){const n=wb();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(a){n.reject(a)}}catch(a){console.error("Scheduler#_schedule execution failed",a)}}),promise:n.promise}},no.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},no.prototype._cancel=function(e){clearTimeout(e.executionId)};function wb(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}var Cb={scheduler:["type",no]},xb="djs-element-hidden",Aa=".entry",kb=1e3,Vd=8,Sb=300;function et(e,t,n,a){this._canvas=e,this._elementRegistry=t,this._eventBus=n,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 n=t.newSelection,a=n.length?n.length===1?n[0]:n:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,a=e._current;if(a){var i=a.target,r=(0,k.isArray)(i)?i:[i];if(r.filter(function(s){return n.includes(s)}).length){e.close();var l=r.filter(function(s){return e._elementRegistry.get(s.id)});l.length&&e._updateAndOpen(l.length>1?l:l[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,a=e._current;((0,k.isArray)(a.target)?a.target:[a.target]).includes(n)&&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=kb),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},et.prototype.getEntries=function(e){var t=this._getProviders(),n=(0,k.isArray)(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return(0,k.forEach)(t,function(i){if((0,k.isFunction)(i[n])){var r=i[n](e);(0,k.isFunction)(r)?a=r(a):(0,k.forEach)(r,function(l,s){a[s]=l})}}),a},et.prototype.trigger=function(e,t,n){var a=this,i,r,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(i=(0,W.attr)(l,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(i,"hover",r,n)},Sb);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,n)},et.prototype.triggerEntry=function(e,t,n,a){if(this.isShown()){var i=this._current.target,r=this._current.entries[e];if(r){var l=r.action;if(this._eventBus.fire("contextPad.trigger",{entry:r,event:n})!==!1){if((0,k.isFunction)(l)){if(t==="click")return l(n,i,a)}else if(l[t])return l[t](n,i,a);n.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),n=this._createHtml(e),a;(0,k.forEach)(t,function(i,r){var l=i.group||"default",s=(0,W.domify)(i.html||'<div class="entry" draggable="true"></div>'),c;(0,W.attr)(s,"data-action",r),c=(0,W.query)("[data-group="+cr(l)+"]",n),c||(c=(0,W.domify)('<div class="group"></div>'),(0,W.attr)(c,"data-group",l),n.appendChild(c)),c.appendChild(s),i.className&&Eb(s,i.className),i.title&&(0,W.attr)(s,"title",i.title),i.imageUrl&&(a=(0,W.domify)("<img>"),(0,W.attr)(a,"src",i.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),(0,W.classes)(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},et.prototype._createHtml=function(e){var t=this,n=(0,W.domify)('<div class="djs-context-pad"></div>');return W.delegate.bind(n,Aa,"click",function(a){t.trigger("click",a)}),W.delegate.bind(n,Aa,"dragstart",function(a){t.trigger("dragstart",a)}),W.delegate.bind(n,Aa,"mouseover",function(a){t.trigger("mouseover",a)}),W.delegate.bind(n,Aa,"mouseout",function(a){t.trigger("mouseout",a)}),W.event.bind(n,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},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()&&Rb(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 n=t.target;return(0,k.isArray)(e)!==(0,k.isArray)(n)?!1:(0,k.isArray)(e)?e.length===n.length&&(0,k.every)(e,function(a){return n.includes(a)}):n===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,k.isArray)(e)&&yt(e)){var t=this._canvas.viewbox(),n=Bb(e),a=n.x*t.scale-t.x*t.scale,i=n.y*t.scale-t.y*t.scale;return{left:a+Vd*this._canvas.zoom(),top:i}}var r=this._canvas.getContainer().getBoundingClientRect(),l=this._getTargetBounds(e);return{left:l.right-r.left+Vd*this._canvas.zoom(),top:l.top-r.top}},et.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(a){a in n&&(t.style[a]=n[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},et.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target;((0,k.isArray)(n)?n:[n]).some(function(a){return t._canvas.hasMarker(a,xb)})?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},et.prototype._getTargetBounds=function(e){var t=this;return((0,k.isArray)(e)?e:[e]).map(function(n){return t._canvas.getGraphics(n)}).reduce(function(n,a){const i=a.getBoundingClientRect();return n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n.left=Math.min(n.left,i.left),n.x=n.left,n.y=n.top,n.width=n.right-n.left,n.height=n.bottom-n.top,n},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Eb(e,t){var n=(0,W.classes)(e);t=(0,k.isArray)(t)?t:t.split(/\s+/g),t.forEach(function(a){n.add(a)})}function Bb(e){return e.waypoints[e.waypoints.length-1]}function Rb(e,t){return e=(0,k.isArray)(e)?e:[e],t=(0,k.isArray)(t)?t:[t],e.length===t.length&&(0,k.every)(e,function(n){return t.includes(n)})}var _b={__depends__:[Si,Cb,vb],contextPad:["type",et]},Tb=250;function Mn(e){this._eventBus=e,this._tools=[],this._active=null}Mn.$inject=["eventBus"],Mn.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Mn.prototype.isActive=function(e){return e&&this._active===e},Mn.prototype.length=function(e){return this._tools.length},Mn.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Mn.prototype.bindEvents=function(e,t){var n=this._eventBus,a=[];n.on(t.tool+".init",function(i){if(!i.context.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),(0,k.forEach)(t,function(i){a.push(i+".ended"),a.push(i+".canceled")}),n.on(a,Tb,function(i){this._active&&(Mb(i)||this.setActive(null))},this)};function Mb(e){var t=e.originalEvent&&e.originalEvent.target;return t&&(0,W.closest)(t,'.group[data-group="tools"]')}var pr={__depends__:[Cn],__init__:["toolManager"],toolManager:["type",Mn]};function hr(e){var t=this;this._lastMoveEvent=null;function n(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){(t._svg=a.svg).addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}hr.$inject=["eventBus"],hr.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Ab(0,0)};function Ab(e,t){var n=document.createEvent("MouseEvent"),a=e,i=t,r=e,l=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,a,i,r,l,!1,!1,!1,!1,0,null),n}var gr={__init__:["mouse"],mouse:["type",hr]},mr=1500,Nd="grab";function oo(e,t,n,a,i,r){this._dragging=n,this._mouse=r;var l=this,s=a.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",mr,function(c){if(vs(c))return l.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(mr,function(c){if(!(!jd(c.keyEvent)||l.isActive())){var d=l._mouse.getLastMoveEvent();l.activateMove(d,!!d)}},"keyboard.keydown"),s&&s.addListener(mr,function(c){!jd(c.keyEvent)||!l.isActive()||l.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(){l.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!vs(c)&&d&&e.once("hand.move.ended",function(u){l.activateHand(u.originalEvent,!0,!0)}),!1})}oo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],oo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Nd,data:{context:n||{}}})},oo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Nd,data:{context:{reactivate:n}}})},oo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},oo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function jd(e){return Ms("Space",e)}var Pb={__depends__:[pr,gr],__init__:["handTool"],handTool:["type",oo]},Od="crosshair";function An(e,t,n,a,i,r,l){this._selection=i,this._dragging=n,this._mouse=l;var s=this,c={create:function(d){var u=t.getActiveLayer(),p=d.frame=(0,P.create)("rect");(0,P.attr)(p,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),(0,P.append)(u,p)},update:function(d){var u=d.frame,p=d.bbox;(0,P.attr)(u,{x:p.x,y:p.y,width:p.width,height:p.height})},remove:function(d){d.frame&&(0,P.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=yr(d),f=a.filter(function(g){return g}),h=wi(d);s.select(f,p,h?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=yr(d),c.create(u),u.selection=i.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=yr(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(wi(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:Od,data:{context:{}}})},An.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Od,data:{context:{}},keepSelection:!0})},An.prototype.select=function(e,t,n=[]){var a=Am(e,t);this._selection.select([...n,...(0,k.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 yr(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},a;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?a={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?a={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?a={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?a={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:a={x:n.x,y:n.y,width:0,height:0},a}var Vb={__depends__:[pr,gr],__init__:["lassoTool"],lassoTool:["type",An]},Id="connect-ok",Ld="connect-not-ok";function ao(e,t,n,a,i,r,l){var s=this;this._dragging=t,this._rules=r,this._mouse=l,i.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?Id:Ld))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var d=c.context.startTarget,u=c.context.canStartConnect;d&&a.removeMarker(d,u?Id:Ld)}),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")}),n.start(null,d,u)}),!1})}ao.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ao.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ao.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ao.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ao.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Nb={__depends__:[Oi,qn,Cn,pr,gr],globalConnect:["type",ao]},jb=500,Ob=1e3;function Pn(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),a=this;function i(r){var l=(0,P.create)("rect");return(0,P.attr)(l,(0,k.assign)({x:0,y:0,rx:4,width:100,height:100},n)),l}e.on(["shape.added","shape.changed"],jb,function(r){var l=r.element,s=r.gfx,c=(0,W.query)(".djs-outline",s);c||(c=a.getOutline(l)||i(s),(0,P.append)(s,c)),a.updateShapeOutline(c,l)}),e.on(["connection.added","connection.changed"],function(r){var l=r.element,s=r.gfx,c=(0,W.query)(".djs-outline",s);c||(c=i(s),(0,P.append)(s,c)),a.updateConnectionOutline(c,l)})}Pn.prototype.updateShapeOutline=function(e,t){var n=!1,a=this._getProviders();a.length&&(0,k.forEach)(a,function(i){n=n||i.updateOutline(t,e)}),n||(0,P.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 n=Nt(t);(0,P.attr)(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+this.offset*2,height:n.height+this.offset*2})},Pn.prototype.registerProvider=function(e,t){t||(t=e,e=Ob),this._eventBus.on("outline.getProviders",e,function(n){n.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,k.forEach)(this._getProviders(),function(n){(0,k.isFunction)(n.getOutline)&&(t=t||n.getOutline(e))}),t},Pn.$inject=["eventBus","styles","elementRegistry"];var Pa=6;function vr(e,t,n){this._canvas=t;var a=this;e.on("element.changed",function(i){n.isSelected(i.element)&&a._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(i){var r=i.newSelection;a._updateMultiSelectionOutline(r)})}vr.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");(0,P.clear)(t);var n=e.length>1;if((0,P.classes)(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),!!n){var a=Ib(Nt(e)),i=(0,P.create)("rect");(0,P.attr)(i,(0,k.assign)({rx:3},a)),(0,P.classes)(i).add("djs-selection-outline"),(0,P.append)(t,i)}},vr.$inject=["eventBus","canvas","selection"];function Ib(e){return{x:e.x-Pa,y:e.y-Pa,width:e.width+Pa*2,height:e.height+Pa*2}}var Hd={__depends__:[Yn],__init__:["outline","multiSelectionOutline"],outline:["type",Pn],multiSelectionOutline:["type",vr]},Lb=500,Hb=1250,zb=1500,Va=Math.round;function Db(e){return{x:e.x+Va(e.width/2),y:e.y+Va(e.height/2)}}function zd(e,t,n,a,i){function r(s,c,d,u){return i.allowed("elements.move",{shapes:s,delta:c,position:d,target:u})}e.on("shape.move.start",zb,function(s){var c=s.context,d=s.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=Fb(u),(0,k.assign)(c,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",Hb,function(s){var c=s.context,d=c.validatedShapes;if(!(c.canExecute=r(d)))return!1}),e.on("shape.move.move",Lb,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=Va(d.x),d.y=Va(d.y),!(d.x===0&&d.y===0)&&n.moveElements(f,d,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(qt(s)){var c=Wn(s);if(!c)throw new Error("must supply DOM mousedown event");return l(c,s.element)}});function l(s,c,d,u){if((0,k.isObject)(d)&&(u=d,d=!1),!(c.waypoints||!c.parent)&&!(0,P.classes)(s.target).has("djs-hit-no-move")){var p=Db(c);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:c,context:u||{}}}),!0}}this.start=l}zd.$inject=["eventBus","dragging","modeling","selection","rules"];function Fb(e){var t=(0,k.groupBy)(e,"id");return(0,k.filter)(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Dd=499,br="djs-dragging",Fd="drop-ok",$d="drop-not-ok",Wd="new-parent",Ud="attach-ok";function Jd(e,t,n,a){function i(c){return $b(r(c))}function r(c){var d=Tm(c,!0),u=d.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=d.concat(u);return[...new Set(p)]}function l(c,d){[Ud,Fd,$d,Wd].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,br),c.allDraggedElements?c.allDraggedElements.push(d):c.allDraggedElements=[d]}e.on("shape.move.start",Dd,function(c){var d=c.context,u=d.shapes,p=d.allDraggedElements,f=i(u);if(!d.dragGroup){var h=(0,P.create)("g");(0,P.attr)(h,n.cls("djs-drag-group",["no-events"])),(0,P.append)(t.getActiveLayer(),h),d.dragGroup=h}f.forEach(function(g){a.addDragger(g,d.dragGroup)}),p?p=(0,k.flatten)([p,r(u)]):p=r(u),(0,k.forEach)(p,function(g){t.addMarker(g,br)}),d.allDraggedElements=p,d.differentParents=Wb(u)}),e.on("shape.move.move",Dd,function(c){var d=c.context,u=d.dragGroup,p=d.target,f=d.shape.parent,h=d.canExecute;p&&(h==="attach"?l(p,Ud):d.canExecute&&f&&p.id!==f.id?l(p,Wd):l(p,d.canExecute?Fd:$d)),jt(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var d=c.context.target;d&&l(d,null)}),e.on("shape.move.cleanup",function(c){var d=c.context,u=d.allDraggedElements,p=d.dragGroup;(0,k.forEach)(u,function(f){t.removeMarker(f,br)}),p&&(0,P.remove)(p)}),this.makeDraggable=s}Jd.$inject=["eventBus","canvas","styles","previewSupport"];function $b(e){return(0,k.filter)(e,function(t){return yt(t)?(0,k.find)(e,(0,k.matchPattern)({id:t.source.id}))&&(0,k.find)(e,(0,k.matchPattern)({id:t.target.id})):!0})}function Wb(e){return(0,k.size)((0,k.groupBy)(e,function(t){return t.parent&&t.parent.id}))!==1}var Ub={__depends__:[Si,Yn,Hd,qn,Cn,Ri],__init__:["move","movePreview"],move:["type",zd],movePreview:["type",Jd]},Yd=".djs-palette-toggle",Kd=".entry",Jb=Yd+", "+Kd,wr="djs-palette-",Yb="shown",Cr="open",Gd="two-column",Kb=1e3;function tt(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(a){var i=a.tool;n.updateToolHighlight(i)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}tt.$inject=["eventBus","canvas"],tt.prototype.registerProvider=function(e,t){t||(t=e,e=Kb),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},tt.prototype.getEntries=function(){return this._getProviders().reduce(qb,{})},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,n=this._getParentContainer(),a=this._container=(0,W.domify)(tt.HTML_MARKUP);n.appendChild(a),(0,W.classes)(n).add(wr+Yb),W.delegate.bind(a,Jb,"click",function(i){var r=i.delegateTarget;if((0,W.matches)(r,Yd))return e.toggle();e.trigger("click",i)}),W.event.bind(a,"mousedown",function(i){i.stopPropagation()}),W.delegate.bind(a,Kd,"dragstart",function(i){e.trigger("dragstart",i)}),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(),n=this._container,a=this._eventBus,i,r=(0,W.classes)(n),l=(0,W.classes)(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(Gd,i),l.toggle(wr+Gd,i),"open"in e&&(r.toggle(Cr,e.open),l.toggle(wr+Cr,e.open)),a.fire("palette.changed",{twoColumn:i,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,k.forEach)(t,function(n,a){var i=n.group||"default",r=(0,W.query)("[data-group="+cr(i)+"]",e);r||(r=(0,W.domify)('<div class="group"></div>'),(0,W.attr)(r,"data-group",i),e.appendChild(r));var l=(0,W.domify)(n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'));if(r.appendChild(l),!n.separator&&((0,W.attr)(l,"data-action",a),n.title&&(0,W.attr)(l,"title",n.title),n.className&&Gb(l,n.className),n.imageUrl)){var s=(0,W.domify)("<img>");(0,W.attr)(s,"src",n.imageUrl),l.appendChild(s)}}),this.open()},tt.prototype.trigger=function(e,t,n){var a,i,r=t.delegateTarget||t.target;return r?(a=(0,W.attr)(r,"data-action"),i=t.originalEvent||t,this.triggerEntry(a,e,i,n)):t.preventDefault()},tt.prototype.triggerEntry=function(e,t,n,a){var i=this._entries[e],r;if(i&&(r=i.action,this._eventBus.fire("palette.trigger",{entry:i,event:n})!==!1)){if((0,k.isFunction)(r)){if(t==="click")return r(n,a)}else if(r[t])return r[t](n,a);n.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,n;this._toolsContainer||(t=(0,W.query)(".djs-palette-entries",this._container),this._toolsContainer=(0,W.query)("[data-group=tools]",t)),n=this._toolsContainer,(0,k.forEach)(n.children,function(a){var i=a.getAttribute("data-action");if(i){var r=(0,W.classes)(a);i=i.replace("-tool",""),r.contains("entry")&&i===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},tt.prototype.isOpen=function(){return(0,W.classes)(this._container).has(Cr)},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 Gb(e,t){var n=(0,W.classes)(e);((0,k.isArray)(t)?t:t.split(/\s+/g)).forEach(function(a){n.add(a)})}function qb(e,t){var n=t.getPaletteEntries();return(0,k.isFunction)(n)?n(e):((0,k.forEach)(n,function(a,i){e[i]=a}),e)}var Xb={__init__:["palette"],palette:["type",tt]};function qd(e,t,n,a){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Pm(r)+".changed",i)}),e.on("elements.changed",function(i){var r=i.elements;r.forEach(function(l){e.fire("element.changed",{element:l})}),a.updateContainments(r)}),e.on("shape.changed",function(i){a.update("shape",i.element,i.gfx)}),e.on("connection.changed",function(i){a.update("connection",i.element,i.gfx)})}qd.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Zb={__init__:["changeSupport"],changeSupport:["type",qd]},Na=Math.max,ja=Math.min,Qb=20;function ew(e,t,n){var a=n.x,i=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+i,r.height=e.height-i):t.indexOf("s")!==-1&&(r.height=e.height+i),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 Oa(e,t,n){var a=t[e],i=n.min&&n.min[e],r=n.max&&n.max[e];return(0,k.isNumber)(i)&&(a=(/top|left/.test(e)?ja:Na)(a,i)),(0,k.isNumber)(r)&&(a=(/top|left/.test(e)?Na:ja)(a,r)),a}function tw(e,t){if(!t)return e;var n=Ve(e);return oc({top:Oa("top",n,t),right:Oa("right",n,t),bottom:Oa("bottom",n,t),left:Oa("left",n,t)})}function nw(e,t,n,a){var i=Ve(t),r={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},l=a?Ve(a):r;return oc({top:ja(r.top,l.top),left:ja(r.left,l.left),bottom:Na(r.bottom,l.bottom),right:Na(r.right,l.right)})}function Mo(e,t){return typeof e<"u"?e:Qb}function ow(e,t){var n,a,i,r;return typeof t=="object"?(n=Mo(t.left),a=Mo(t.right),i=Mo(t.top),r=Mo(t.bottom)):n=a=i=r=Mo(t),{x:e.x-n,y:e.y-i,width:e.width+n+a,height:e.height+i+r}}function aw(e){return!(e.waypoints||e.type==="label")}function iw(e,t){var n;if(e.length===void 0?n=(0,k.filter)(e.children,aw):n=e,n.length)return ow(Nt(n),t)}var Xd=10;function Ao(e,t,n,a){this._dragging=a,this._rules=t;var i=this;function r(c,d){var u=c.shape,p=c.direction,f=c.resizeConstraints,h;c.delta=d,h=ew(u,p,d),c.newBounds=tw(h,f),c.canExecute=i.canResize(c)}function l(c){var d=c.resizeConstraints,u=c.minBounds;d===void 0&&(u===void 0&&(u=i.computeMinResizeBox(c)),c.resizeConstraints={min:Ve(u)})}function s(c){var d=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=oy(p),!rw(d,p))return;n.resizeShape(d,p)}}e.on("resize.start",function(c){l(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)})}Ao.prototype.canResize=function(e){var t=this._rules,n=(0,k.pick)(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ao.prototype.activate=function(e,t,n){var a=this._dragging,i,r;if(typeof n=="string"&&(n={direction:n}),i=(0,k.assign)({shape:t},n),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,Zd(t,r),"resize",{autoActivate:!0,cursor:lw(r),data:{shape:t,context:i}})},Ao.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction;return nw(n,t,e.minDimensions||{width:Xd,height:Xd},iw(t,e.childrenBoxPadding))},Ao.$inject=["eventBus","rules","modeling","dragging"];function rw(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Zd(e,t){var n=Je(e),a=Ve(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function lw(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 Qd="djs-resizing",eu="resize-not-ok",sw=500;function tu(e,t,n){function a(r){var l=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(l,t.getActiveLayer()),t.addMarker(l,Qd)),s.width>5&&(0,P.attr)(c,{x:s.x,width:s.width}),s.height>5&&(0,P.attr)(c,{y:s.y,height:s.height}),r.canExecute?(0,P.classes)(c).remove(eu):(0,P.classes)(c).add(eu)}function i(r){var l=r.shape;r.frame&&(0,P.remove)(r.frame),t.removeMarker(l,Qd)}e.on("resize.move",sw,function(r){a(r.context)}),e.on("resize.cleanup",function(r){i(r.context)})}tu.$inject=["eventBus","canvas","previewSupport"];var Ia=-6,La=8,Ha=20,Po="djs-resizer",cw=["n","w","s","e","nw","ne","se","sw"];function fn(e,t,n,a){this._resize=a,this._canvas=t;var i=this;e.on("selection.changed",function(r){var l=r.newSelection;i.removeResizers(),l.length===1&&(0,k.forEach)(l,(0,k.bind)(i.addResizer,i))}),e.on("shape.changed",function(r){var l=r.element;n.isSelected(l)&&(i.removeResizers(),i.addResizer(l))})}fn.prototype.makeDraggable=function(e,t,n){var a=this._resize;function i(r){qt(r)&&a.activate(r,e,n)}W.event.bind(t,"mousedown",i),W.event.bind(t,"touchstart",i)},fn.prototype._createResizer=function(e,t,n,a){var i=this._getResizersParent(),r=dw(a),l=(0,P.create)("g");(0,P.classes)(l).add(Po),(0,P.classes)(l).add(Po+"-"+e.id),(0,P.classes)(l).add(Po+"-"+a),(0,P.append)(i,l);var s=(0,P.create)("rect");(0,P.attr)(s,{x:-La/2+r.x,y:-La/2+r.y,width:La,height:La}),(0,P.classes)(s).add(Po+"-visual"),(0,P.append)(l,s);var c=(0,P.create)("rect");return(0,P.attr)(c,{x:-Ha/2+r.x,y:-Ha/2+r.y,width:Ha,height:Ha}),(0,P.classes)(c).add(Po+"-hit"),(0,P.append)(l,c),Om(l,t,n),l},fn.prototype.createResizer=function(e,t){var n=Zd(e,t),a=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,a,t)},fn.prototype.addResizer=function(e){var t=this;yt(e)||!this._resize.canResize({shape:e})||(0,k.forEach)(cw,function(n){t.createResizer(e,n)})},fn.prototype.removeResizers=function(){(0,P.clear)(this._getResizersParent())},fn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},fn.$inject=["eventBus","canvas","selection","resize"];function dw(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ia:e.indexOf("w")!==-1&&(t.x=Ia),e.indexOf("s")!==-1?t.y=-Ia:e.indexOf("n")!==-1&&(t.y=Ia),t}var uw={__depends__:[qn,Cn,Ri],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ao],resizePreview:["type",tu],resizeHandles:["type",fn]};function Vo(e,t,n,a,i,r){this._canvas=t,this._modeling=a,this._textRenderer=r,n.registerProvider(this),e.on("element.dblclick",s=>{l(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{n.isActive()&&n.complete()}),e.on(["commandStack.changed"],()=>{n.isActive()&&n.cancel()}),e.on("directEditing.activate",()=>{i.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||l(u))}),e.on("autoPlace.end",500,s=>{l(s.shape)});function l(s,c){(c||Xi(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&n.activate(s)}}Vo.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],Vo.prototype.activate=function(e){const t=wa(e);if(t===void 0)return;const n={text:t};Fe(n,this.getEditingBBox(e));const a={};return(Xi(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Fe(a,{centerVertically:!0}),Zi(e)&&Fe(a,{autoResize:!0}),Fe(n,{options:a}),n},Vo.prototype.getEditingBBox=function(e){const t=this._canvas,n=e.label||e,a=t.getAbsoluteBBox(n),i={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},l=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),d=c.fontSize*l,u=c.lineHeight,p=s.fontSize*l,f=s.lineHeight,h={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Xi(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Fe(r,{width:a.width,height:a.height}),Fe(h,{fontSize:p+"px",lineHeight:f,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));const g=90*l,m=7*l,y=4*l;if(n.labelTarget&&(Fe(r,{width:g,height:a.height+m+y,x:i.x-g/2,y:a.y-m}),Fe(h,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})),Zi(n)&&!Hc(n)&&!Bo(n)){const w=zc(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),v=d+m+y;Fe(r,{width:g,height:v,x:x.x-g/2,y:x.y-v/2}),Fe(h,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})}return{bounds:r,style:h}},Vo.prototype.update=function(e,t){let n;fw(t)&&(t=null),this._modeling.updateLabel(e,t,n)};function fw(e){return!e||!e.trim()}var pw={__depends__:[Zb,uw,ri.default],__init__:["labelEditingProvider"],labelEditingProvider:["type",Vo]};function pn(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}pn.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},pn.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},pn.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},pn.prototype.getSnapLocations=function(){return this._snapLocations},pn.prototype.setSnapLocations=function(e){this._snapLocations=e},pn.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new za,n.initDefaults(this._defaultSnaps)),n};function za(){this._snapValues={}}za.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},za.prototype.snap=function(e,t,n,a){var i=this._snapValues[t];return i&&rb(e[n],i[n],a)},za.prototype.initDefaults=function(e){var t=this;(0,k.forEach)(e||{},function(n,a){(0,k.forEach)(n,function(i){t.add(a,i)})})};var hw=1250;function Ht(e,t,n){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(i){a.initSnap(i)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],hw,function(i){var r=i.context,l=r.shape,s=r.snapContext,c=r.target;if(!(i.originalEvent&&Ts(i.originalEvent))&&!(Ta(i)||!c)){var d=s.pointsForTarget(c);d.initialized||(d=a.addSnapTargetPoints(d,l,c),d.initialized=!0),n.snap(i,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ht.$inject=["elementRegistry","eventBus","snapping"],Ht.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,a=n.shape,i=n.snapContext;i||(i=n.snapContext=new pn);var r;t.get(a.id)?r=to(a,e):r={x:e.x+to(a).x,y:e.y+to(a).y};var l={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 i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),Xn(a)||(i.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),i.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),i},Ht.prototype.addSnapTargetPoints=function(e,t,n){return(0,k.forEach)(this.getSnapTargets(t,n),function(a){if(Xn(a)){Xn(t)&&e.add("mid",to(a));return}if(yt(a)){if(a.waypoints.length<3)return;(0,k.forEach)(a.waypoints.slice(1,-1),function(i){e.add("mid",i)});return}e.add("mid",to(a))}),!(0,k.isNumber)(t.x)||!(0,k.isNumber)(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",to(t)),e},Ht.prototype.getSnapTargets=function(e,t){return _d(t).filter(function(n){return!gw(n)})};function gw(e){return!!e.hidden}function io(e){e.invoke(Ht,this)}(0,$t.default)(io,Ht),io.$inject=["injector"],io.prototype.initSnap=function(e){return Ht.prototype.initSnap.call(this,e)},io.prototype.addSnapTargetPoints=function(e,t,n){return Ht.prototype.addSnapTargetPoints.call(this,e,t,n)},io.prototype.getSnapTargets=function(e,t){return Ht.prototype.getSnapTargets.call(this,e,t)};var mw=1250;function No(e,t){var n=this;e.on(["resize.start"],function(a){n.initSnap(a)}),e.on(["resize.move","resize.end"],mw,function(a){var i=a.context,r=i.shape,l=r.parent,s=i.direction,c=i.snapContext;if(!(a.originalEvent&&Ts(a.originalEvent))&&!Ta(a)){var d=c.pointsForTarget(l);d.initialized||(d=n.addSnapTargetPoints(d,r,l,s),d.initialized=!0),bw(s)&&Yt(a,"x",a.x),ww(s)&&Yt(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}No.prototype.initSnap=function(e){var t=e.context,n=t.shape,a=t.direction,i=t.snapContext;i||(i=t.snapContext=new pn);var r=nu(n,a);return i.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),i},No.prototype.addSnapTargetPoints=function(e,t,n,a){return(0,k.forEach)(this.getSnapTargets(t,n),function(i){e.add("corner",sb(i)),e.add("corner",lb(i))}),e.add("corner",nu(t,a)),e},No.$inject=["eventBus","snapping"],No.prototype.getSnapTargets=function(e,t){return _d(t).filter(function(n){return!yw(n,e)&&!yt(n)&&!vw(n)&&!Xn(n)})};function nu(e,t){var n=Je(e),a=Ve(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function yw(e,t){return e.host===t}function vw(e){return!!e.hidden}function bw(e){return e==="n"||e==="s"}function ww(e){return e==="e"||e==="w"}var Cw=7,xw=1e3;function hn(e){this._canvas=e,this._asyncHide=(0,k.debounce)((0,k.bind)(this.hide,this),xw)}hn.$inject=["canvas"],hn.prototype.snap=function(e,t){var n=e.context.snapContext,a=n.getSnapLocations(),i={x:Ta(e,"x"),y:Ta(e,"y")};(0,k.forEach)(a,function(r){var l=n.getSnapOrigin(r),s={x:e.x+l.x,y:e.y+l.y};if((0,k.forEach)(["x","y"],function(c){var d;i[c]||(d=t.snap(s,r,c,Cw),d!==void 0&&(i[c]={value:d,originValue:d-l[c]}))}),i.x&&i.y)return!1}),this.showSnapLine("vertical",i.x&&i.x.value),this.showSnapLine("horizontal",i.y&&i.y.value),(0,k.forEach)(["x","y"],function(r){var l=i[r];(0,k.isObject)(l)&&Yt(e,r,l.originValue)})},hn.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=(0,P.create)("path");return(0,P.attr)(n,{d:"M0,0 L0,0"}),(0,P.classes)(n).add("djs-snap-line"),(0,P.append)(t,n),{update:function(a){(0,k.isNumber)(a)?e==="horizontal"?(0,P.attr)(n,{d:"M-100000,"+a+" L+100000,"+a,display:""}):(0,P.attr)(n,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):(0,P.attr)(n,{display:"none"})}}},hn.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},hn.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},hn.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},hn.prototype.hide=function(){(0,k.forEach)(this._snapLines,function(e){e.update()})};var kw={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ht],resizeSnapping:["type",No],snapping:["type",hn]},Sw={__depends__:[kw],__init__:["createMoveSnapping"],createMoveSnapping:["type",io]};function ro(e){dt.call(this,e),this.init()}ro.$inject=["eventBus"],xn(ro,dt),ro.prototype.addRule=function(e,t,n){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){a.canExecute(i,t,function(r,l,s){return n(r)},!0)})},ro.prototype.init=function(){};function jo(e){ro.call(this,e)}jo.$inject=["eventBus"],(0,$t.default)(jo,ro),jo.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,n=e.target,a=e.hints||{},i=a.targetParent;if(a.targetAttach)return!1;i&&(n.parent=i);try{return xr(t,n)}finally{i&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,a=e.target;return xr(n,a,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,n=e.shape;return t.parent&&(t=parent),!(n.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==n.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return Vm(t)})},jo.prototype.canConnect=xr;function xr(e,t,n){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}var Ew={__init__:["myRuleProvider"],myRuleProvider:["type",jo]};function kr(e,t,n,a,i,r,l){this._create=e,this._elementFactory=t,this._handTool=n,this._lassoTool=a,this._globalConnect=i,this._palette=r,this._myOptions=l,r.registerProvider(this)}kr.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],kr.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,n=this._handTool,a=this._lassoTool,i=this._globalConnect,r=this._myOptions;function l(c,d,u,p,f){function h(g){const m=t.createShape(Fe({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){n.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){i.toggle(c)}}},"tool-separator":{group:"tools",separator:!0}};for(const c in r.palette){const d=r.palette[c];s[c]=l(d.type,d.group,d.className,d.title,d.options)}return s};var Bw={__init__:["paletteProvider"],paletteProvider:["type",kr]},rC=50,Rw=250;function _w(e,t){t||(t={});function n(f){return f.source===e?1:-1}var a=t.defaultDistance||50,i=t.direction||"e",r=t.filter,l=t.getWeight||n,s=t.maxDistance||Rw,c=t.reference||"start";r||(r=Tw);function d(f,h){return i==="n"?c==="start"?Ve(f).top-Ve(h).bottom:c==="center"?Ve(f).top-Je(h).y:Ve(f).top-Ve(h).top:i==="w"?c==="start"?Ve(f).left-Ve(h).right:c==="center"?Ve(f).left-Je(h).x:Ve(f).left-Ve(h).left:i==="s"?c==="start"?Ve(h).top-Ve(f).bottom:c==="center"?Je(h).y-Ve(f).bottom:Ve(h).bottom-Ve(f).bottom:c==="start"?Ve(h).left-Ve(f).right:c==="center"?Je(h).x-Ve(f).right:Ve(h).right-Ve(f).right}var u=e.incoming.filter(r).map(function(f){var h=l(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=l(f),g=h>0?d(e,f.target):d(f.target,e);return{id:f.target.id,distance:g,weight:h}});return(0,k.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 Tw(){return!0}var Mw=100;function ou(e,t,n){e.on("autoPlace",Mw,function(a){var i=a.shape,r=a.source;return Aw(r,i)}),e.on("autoPlace.end",function(a){n.scrollToElement(a.shape)}),this.append=function(a,i,r){e.fire("autoPlace.start",{source:a,shape:i});var l=e.fire("autoPlace",{source:a,shape:i}),s=t.appendShape(a,i,l,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:s}),s}}ou.$inject=["eventBus","modeling","canvas"];function Aw(e,t,n){n||(n={});var a=n.defaultDistance||50,i=Je(e);return{x:Ve(e).right+a+t.width/2,y:i.y}}function au(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}au.$inject=["eventBus","selection"];var Pw={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ou],autoPlaceSelectionBehavior:["type",au]},Vw=10,Nw=(e,t)=>e.type===t;function jw(e){return e.incoming.map(t=>t.source)}function Ow(e){return e.outgoing.map(t=>t.target)}function Sr(e){return Ow(e).concat(jw(e))}function Iw(e){let t=Sr(e);return e.host&&(t=t.concat(Sr(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((n,a)=>n.concat(Sr(a)),[]))),t.filter(n=>n.type!=="myline")}function Lw(e,t,n){const a={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height};return(0,k.find)(Iw(e),i=>i===n?!1:nn(i,a,Vw)==="intersect")}function Hw(e,t,n,a){let i;for(;i=Lw(e,n,t);)n=a(t,n,i);return n}function zw(e){return function(t,n,a){const i={x:n.x,y:n.y};return["x","y"].forEach(r=>{const l=e[r];if(!l)return;const s=r==="x"?"width":"height",{margin:c,minDistance:d}=l;c<0?i[r]=Math.min(a[r]+c-t[s]/2,n[r]-d+c):i[r]=Math.max(a[r]+a[s]+c+t[s]/2,n[r]+d+c)}),i}}function Dw(e,t){return Fw(e,t)}function Fw(e,t){const n=Ve(e),a=Je(e),i=_w(e,{filter:s=>Nw(s,"myline")}),r=30,l=80;return Hw(e,t,{x:n.right+i+t.width/2,y:a.y+$w("left",l)},zw({y:{margin:r,minDistance:l}}))}function $w(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function iu(e){e.on("autoPlace",t=>{const{shape:n,source:a}=t;return Dw(a,n)})}iu.$inject=["eventBus"];var Ww={__depends__:[Pw],__init__:["myAutoPlace"],myAutoPlace:["type",iu]};function Er(e,t,n,a,i,r,l){this._connect=e,this._modeling=n,this._elementFactory=a,this._autoPlace=i,this._create=r,this._myOptions=l,t.registerProvider(this)}Er.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Er.prototype.getContextPadEntries=function(e){const t=this._connect,n=this._modeling,a=this._elementFactory,i=this._autoPlace,r=this._create,l=this._myOptions;function s(){n.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(Fe({type:p},g));r.start(w,v,{source:x})}function y(w,x){const v=a.createShape(Fe({type:p},g));i.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 l.palette)if(p!=="create.start-event"){const f=l.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 Uw={__init__:["ContextPadProvider"],ContextPadProvider:["type",Er]},Jw=(0,o.defineComponent)({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=(0,o.ref)(),l={"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 A=s.get("eventBus");A.on("element.dblclick",R=>{i("elementDblclick",R.element.businessObject)}),A.on("element.click",R=>{i("elementClick",R.element.businessObject)}),A.on("create.end",R=>{i("elementCreate",R.elements[0].businessObject)}),A.on("autoPlace.end",R=>{i("elementCreate",R.shape.businessObject)})},p=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},f=()=>{let A={__init__:["myOptions"],myOptions:["type",p]};s=new Yo.default({canvas:{container:r.value},modules:[db,Oi,hb,_b,$s,zv,Pb,Vb,Nb,Zc,cc,Ub,Hd,Xb,fc,A,Ww,td,pw,Uw,Bw,Ew,Sw,od]});const R=s.get("canvas"),j=s.get("elementFactory");d();const O=j.createRoot();R.setRootElement(O),u()};(0,o.onMounted)(()=>{f()});const h=A=>{const R=A==null?1:c+A;s.get("canvas").zoom(R),c=R},g=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},y=()=>(s.get("canvas").zoom(1),ad(s.get("elementRegistry").getAll())),w=A=>{s.clear(),d(),id(A,s)},x=A=>{s.get("myImporter").update(A.id,A)};return t({reset:()=>{d()},zoom:A=>{h(A)},redo:()=>{g()},undo:()=>{m()},getData:()=>y(),setData:A=>{w(A)},updateElemet:A=>{x(A)}}),(A,R)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),Yw=Jw,ru=ie(Lv),lu=ie(Yw),Kw=(0,o.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:n}){const a=e,i=n,{t:r}=Ze(),{formData:l}=Gt(),s=(0,o.computed)(()=>a.editConfig.isAddBtn!==!1),c=(0,o.computed)(()=>a.editConfig.addBtnText||"添加"),d=(0,o.computed)(()=>a.editConfig.buttonsAlign||"left"),u=(0,o.computed)(()=>a.editConfig.isRemoveBtn!==!1),p=(0,o.computed)(()=>a.editConfig.readonly),f=(0,o.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,o.ref)([]),g=b=>{i("rowChange",b)},m=()=>{const b={_i:Wt()};a.columns.forEach(B=>{const S=B.config?.valueRowKey||B.id||"";S&&(b[S]=xt(B.config?.defaultValue))}),h.value.push(b),i("change",{id:a.id,value:b,data:b,formData:l,tableData:h.value,type:"add"})},y=b=>{const B=h.value[b];h.value.splice(b,1),i("change",{id:a.id,value:B,data:B,formData:l,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 B=h.value.length,S=a.columns,T=S.length;for(let A=0;A<B;A++){const R=h.value[A];for(let j=0;j<T;j++){const O=S[j];if(v(O.config,A).display!==!1&&O.rule&&O.rule.length>0){const H=O.rule.length;for(let M=0;M<H;M++){const E=O.rule[M];if(E.pattern=E.pattern?E.pattern+"":"",E.pattern&&!Tt(R[O.prop||""])&&!new RegExp(E.pattern.substring(1,E.pattern.length-1)).test(R[O.prop||""]))return b.info=`${r("第")}${A+1}${r("行")},${r("第")}${j+1}${r("列")},${r(O.label)}:${r(E.message)}`,b.isOk=!1,b;if(E.required&&Tt(R[O.prop||""]))return b.isOk=!1,b.info=`${r("第")}${A+1}${r("行")},${r("第")}${j+1}${r("列")},${r(O.label)}:${r("不能为空")}`,b}}}}return b};a.modelValue&&a.modelValue.length>0?(h.value=a.modelValue||[],h.value.forEach(b=>{b._i||(b._i=Wt())})):(h.value=[],i("update:modelValue",h.value));const v=(b,B)=>{const S={...b};if(S.getUpConfig){const T=b.getUpConfig({formData:l,index:B,row:h.value[B],tableData:h.value,config:S});T&&Object.keys(T).forEach(A=>{S[A]=T[A]})}return S},C=b=>{const B=b||a.labelWidth;return typeof B=="string"?B:typeof B=="number"?B+"px":B};return t({validate:()=>w()}),fo({getTableData:()=>h.value,rowChange:g}),(b,B)=>{const S=(0,o.resolveComponent)("j-comp"),T=(0,o.resolveComponent)("el-form-item"),A=(0,o.resolveComponent)("el-col"),R=(0,o.resolveComponent)("j-button"),j=(0,o.resolveComponent)("el-row");return(0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createElementVNode)("div",(0,o.mergeProps)({class:"j-input-cards"},b.$attrs),[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(h.value,(O,H)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"j-input-cards-item",key:O.i,style:{"margin-bottom":"8px"}},[(0,o.createVNode)(j,{gutter:e.gutter},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.columns,M=>((0,o.openBlock)(),(0,o.createBlock)(A,{key:M.prop,span:M.config?.span||e.span||24,style:(0,o.normalizeStyle)({"margin-bottom":(M.getInputType?M.getInputType(O):M.inputType)=="j-input-rows"?"8px":void 0})},{default:(0,o.withCtx)(()=>[(0,o.withDirectives)((0,o.createVNode)(T,{"label-width":C(M.config?.labelWidth),label:(0,o.unref)(r)(M.config?.label||""),extra:M.config?.labelExtra,tooltip:M.config?.labelTooltip,required:M.config?.required},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(S,(0,o.mergeProps)({ref_for:!0},M,{row:O}),null,16,["row"])]),_:2},1032,["label-width","label","extra","tooltip","required"]),[[o.vShow,v(M.config,H).display!==!1]])]),_:2},1032,["span","style"]))),128)),u.value&&(f.value||h.value.length>1)&&!p.value?((0,o.openBlock)(),(0,o.createBlock)(R,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",danger:"",onClick:M=>y(H)},null,8,["onClick"])):(0,o.createCommentVNode)("",!0)]),_:2},1032,["gutter"])]))),128))],16),s.value&&!p.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,style:(0,o.normalizeStyle)({"text-align":d.value})},[s.value?((0,o.openBlock)(),(0,o.createBlock)(R,{key:0,type:"link",style:{"margin-right":"8px"},label:c.value,icon:"mdi:add",onClick:m},null,8,["label"])):(0,o.createCommentVNode)("",!0)],4)):(0,o.createCommentVNode)("",!0)],64)}}}),Gw=Kw,su=ie(Gw),qw=[Go,sl,cl,dl,ul,fl,pl,hl,gl,ml,yl,vl,El,Bl,Rl,_l,yi,ll,Tl,Ml,Al,Vl,jl,Ol,Yl,Il,Ll,Hl,zl,Dl,Fl,$l,Wl,Ul,Jl,Xl,Zl,Ql,es,ts,ns,os,as,is,Kl,Gl,vi,rs,ls,ss,cs,ds,us,fs,lm,ru,lu,su],Xw=e=>{qw.forEach(t=>{e.component(t.name,t)})},Zw={install:Xw};V.EncryptionFactory=Yr,V.EventBus=pi,V.HashingFactory=Yu,V.INJECT_KEYS=lt,V.JAutoComplete=yl,V.JBarcode=Ol,V.JButton=Go,V.JButtonSelect=Xl,V.JButtons=sl,V.JCascaderSelect=hl,V.JCheckbox=gl,V.JCodeMirror=Yl,V.JCollapse=us,V.JComp=es,V.JCount=Il,V.JCountUp=Hl,V.JDataPanel=zl,V.JDate=dl,V.JDialog=Bl,V.JDialogFull=Rl,V.JDivider=Dl,V.JDrawer=_l,V.JDynamicLayer=ll,V.JEcharts=jl,V.JEditor=fs,V.JForm=ts,V.JFormItem=ns,V.JGuid=as,V.JHpanel=Fl,V.JIcon=ul,V.JInput=cl,V.JInputButton=$l,V.JInputCards=su,V.JInputCode=Wl,V.JInputColor=Ul,V.JInputCount=Ll,V.JInputLayer=ls,V.JInputRows=rs,V.JInputTag=Tl,V.JLayer=yi,V.JLayerForm=ss,V.JLayout=vl,V.JMenu=Gl,V.JNumber=ml,V.JPage=os,V.JPanel=is,V.JRadio=fl,V.JRate=Ml,V.JSelect=pl,V.JSlider=Al,V.JSliderCaptcha=Kl,V.JSwitch=cs,V.JTable=El,V.JTablePanel=vi,V.JTabs=ds,V.JTitle=Jl,V.JTree=Zl,V.JTreeSelect=Ql,V.JUpload=Vl,V.JWorkflow=lu,V.JWorkflowViewer=ru,V.assign=Fe,V.buildShortUUID=qo,V.buildUUID=Wt,V.clearJson=Hn,V.clone=so,V.deepClone=xt,V.default=Zw,V.eventBus=Gu,V.formatToDate=uo,V.formatToDateTime=fi,V.fullScreenLoading=zn,V.getCompConfig=bn,V.getCompType=ui,V.getFunction=si,V.getIsInputComp=Xo,V.getIsTableInputComp=Dr,V.getLabel=Fr,V.getObjType=Mr,V.getTextWidth=kt,V.is=Tr,V.isArray=Ko,V.isNullOrEmpty=Tt,V.isObject=Ru,V.loadBMap=Gr,V.lowerFirst=Ou,V.myAesDecrypt=Ku,V.numberToChinese=Ar,V.numberToThousandSeparator=Pr,V.pagination=Vu,V.paginationEx=Nu,V.set=ci,V.setGroupMap=Nr,V.toArray=Ir,V.toDecimal=co,V.toLeafArray=zr,V.toSimpleTree=Iu,V.toTree=jr,V.uniqueArray=ju,V.upFirst=Vr,V.useAppInject=Ze,V.useAppProvide=qu,V.useAuthPageInject=tl,V.useAuthPageProvide=nl,V.useCompInject=Xr,V.useCompProvide=gi,V.useFormInject=Gt,V.useFormProvide=hi,V.useHMenuInject=Qr,V.useHMenuProvide=el,V.useInject=Pt,V.useLayer=Fn,V.useLayerInject=Xu,V.useLayerProvide=ol,V.useMenuInject=Dn,V.useMenuProvide=Zr,V.usePageInject=al,V.usePageProvide=il,V.useProvide=Vt,V.useSortable=Kr,V.useTableInject=qr,V.useTableProvide=fo});
|
|
16
|
+
getCompValue)=>{ return ${B} }`;let S;const T=si(B);if(T.res)try{S=T.fn(a,i,r,l,s,c,d,u,p,f,h,g,m,y,v)}catch(A){console.log(A,"计算组件公式运行错误")}else return console.log(T.msg),"";return Number.isNaN(S)?"":(n.decimal!==void 0&&(S=S.toFixed(n.decimal)),S)}),_=(0,o.computed)(()=>{let b=C.value;return n.thousandSeparator&&(b=Pr(b)),n.isChinese&&(b=Ar(b)),b});return(0,o.watch)(C,b=>{w("update:modelValue",b),w("change",{value:b,data:_.value})}),(b,B)=>{const S=(0,o.resolveComponent)("el-input");return(0,o.openBlock)(),(0,o.createBlock)(S,{modelValue:_.value,"onUpdate:modelValue":B[0]||(B[0]=T=>_.value=T),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),rh=ih,Il=ie(rh),lh={class:"j-block j-input-count"},sh={class:"j-input-count-top"},ch={class:"j-input-count-tool"},dh={style:{"font-weight":"600"}},uh={class:"j-input-count-codebox"},fh={key:0,class:"j-input-count-cursor"},ph={key:0,class:"fun_color"},hh={key:1,class:"comp_color"},gh={key:2,class:"num_color"},mh={key:3,class:"j-input-count-cursor"},yh={class:"j-input-count-bottom"},vh={class:"j-input-count-left"},bh={class:"mb-8px fw-600"},wh={class:"j-input-count-right"},Ch={class:"j-input-count-funs"},xh={style:{"font-weight":"600",padding:"8px"}},kh={class:"j-input-count-funs-content"},Sh={class:"j-input-count-fundes"},Eh={style:{"font-size":"14px","font-weight":"300"}},Bh=(0,o.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:n}=Ze(),a=e,i=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:"."}],l=[{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,o.ref)(!1),c=(0,o.ref)([]),d=(0,o.reactive)({cells:[],cursor:0}),u=(0,o.computed)({get(){return JSON.parse(a.modelValue||"[]")},set(b){i("update:modelValue",b.length>0?JSON.stringify(b):""),i("change",{value:b.length>0?JSON.stringify(b):"",data:b})}}),p=b=>{c.value=b},f=(b,B)=>{const S={value:b,type:B};if(d.cells.splice(d.cursor,0,S),d.cursor+=1,B==="fun"){const T={value:"(",type:B},A={value:")",type:B};d.cells.splice(d.cursor,0,T,A),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,o.computed)(()=>{const b={};return a.list.forEach(B=>{B.children.forEach(S=>{b[S.value]=`${B.label}.${S.label}`})}),b}),_=b=>C.value[b]||b;return(b,B)=>{const S=(0,o.resolveComponent)("j-button"),T=(0,o.resolveComponent)("j-icon"),A=(0,o.resolveComponent)("el-space"),R=(0,o.resolveComponent)("j-dialog");return(0,o.openBlock)(),(0,o.createElementBlock)("div",null,[(0,o.createVNode)(S,(0,o.mergeProps)(b.$attrs,{type:e.type,size:e.size,label:e.label,onClick:w}),null,16,["type","size","label"]),(0,o.createVNode)(R,{visible:s.value,title:(0,o.unref)(n)("公式设置"),height:800,width:1200,onOk:x,onClosed:v},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",lh,[(0,o.createElementVNode)("div",sh,[(0,o.createElementVNode)("div",ch,[(0,o.createElementVNode)("span",dh,(0,o.toDisplayString)((0,o.unref)(n)("计算公式"))+"=",1),(0,o.createVNode)(A,null,{default:(0,o.withCtx)(()=>[(0,o.createVNode)(S,{type:"text",onClick:h},{icon:(0,o.withCtx)(()=>[(0,o.createVNode)(T,{icon:"arrowLeft"})]),_:1}),(0,o.createVNode)(S,{type:"text",onClick:g},{icon:(0,o.withCtx)(()=>[(0,o.createVNode)(T,{icon:"arrowRight"})]),_:1}),(0,o.createVNode)(S,{type:"link",label:"退格",onClick:m}),(0,o.createVNode)(S,{type:"link",danger:"",label:"清空",onClick:y})]),_:1})]),(0,o.createElementVNode)("div",uh,[d.cells.length==0?((0,o.openBlock)(),(0,o.createElementBlock)("span",fh)):(0,o.createCommentVNode)("",!0),((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(d.cells,(j,O)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:O},[j.type=="fun"?((0,o.openBlock)(),(0,o.createElementBlock)("span",ph,(0,o.toDisplayString)(j.value.toUpperCase()),1)):j.type=="comp"?((0,o.openBlock)(),(0,o.createElementBlock)("span",hh," #"+(0,o.toDisplayString)(_(j.value))+"# ",1)):j.type=="num"?((0,o.openBlock)(),(0,o.createElementBlock)("span",gh,(0,o.toDisplayString)(j.value),1)):(0,o.createCommentVNode)("",!0),O+1==d.cursor?((0,o.openBlock)(),(0,o.createElementBlock)("span",mh)):(0,o.createCommentVNode)("",!0)],64))),128))])]),(0,o.createVNode)(A,{class:"j-input-count-mid"},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(r,(j,O)=>(0,o.createVNode)(S,{key:O,label:j.label+"",onClick:H=>f(j.value,"num")},null,8,["label","onClick"])),64))]),_:1}),(0,o.createElementVNode)("div",yh,[(0,o.createElementVNode)("div",vh,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.list,(j,O)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:O},[(0,o.createElementVNode)("div",bh,(0,o.toDisplayString)((0,o.unref)(n)(j.label)),1),(0,o.createVNode)(A,{size:[8,8],wrap:"",style:{"margin-bottom":"16px"}},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(j.children,H=>((0,o.openBlock)(),(0,o.createBlock)(S,{key:H.value,onClick:M=>f(H.value,"comp"),label:(0,o.unref)(n)(H.label)},null,8,["onClick","label"]))),128))]),_:2},1024)],64))),128))]),(0,o.createElementVNode)("div",wh,[(0,o.createElementVNode)("div",Ch,[(0,o.createElementVNode)("span",xh,(0,o.toDisplayString)((0,o.unref)(n)("函数列表")),1),(0,o.createElementVNode)("div",kh,[((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(l,(j,O)=>(0,o.createVNode)(S,{type:"text",style:{"border-radius":"0","justify-content":"left"},key:O,onMouseover:H=>p(j.des),onClick:H=>f(j.value,"fun"),label:j.label},null,8,["onMouseover","onClick","label"])),64))])]),(0,o.createElementVNode)("div",Sh,[(0,o.createElementVNode)("div",null,[(0,o.createElementVNode)("ul",null,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(c.value,(j,O)=>((0,o.openBlock)(),(0,o.createElementBlock)("li",{key:O,style:{"margin-bottom":"8px"}},[(0,o.createElementVNode)("span",Eh,(0,o.toDisplayString)((0,o.unref)(n)(j)),1)]))),128))])])])])])])]),_:1},8,["visible","title"])])}}}),Rh=Bh,Ll=ie(Rh),_h={key:0},Th=(0,o.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 n=e,a=(0,o.computed)(()=>({...n})),i=(0,o.ref)(),r=(0,o.ref)(null),l=(0,o.computed)(()=>n.options);(0,o.onMounted)(()=>{n.animation&&s()}),(0,o.watch)(()=>n.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=n.decimals,r.value.reset(),r.value.update(n.endValue))},{deep:!0}),(0,o.watch)(()=>n.endValue,f=>{r.value&&r.value.update&&r.value.update(f)});const s=()=>{r.value||(l.value.startVal=n.startValue,l.value.decimalPlaces=n.decimals,l.value.duration=n.duration,r.value=new du.CountUp(i.value,Number(n.endValue),l.value),r.value.start(()=>{n.callback?.(r.value)}))};return(0,o.onUnmounted)(()=>{r.value=null}),(0,o.onBeforeUnmount)(()=>{r.value=null}),t({myProps:a,el:i,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,o.openBlock)(),(0,o.createElementBlock)("span",{ref_key:"el",ref:i},[e.animation?(0,o.createCommentVNode)("",!0):((0,o.openBlock)(),(0,o.createElementBlock)("span",_h,(0,o.toDisplayString)(e.endValue),1))],512))}}),Mh=Th,Hl=ie(Mh),Ah={class:"j-block j-data-panel"},Ph={key:0,class:"j-data-panel-header"},Vh={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},Nh={class:"j-data-panel-header-right"},jh={class:"j-data-panel-body"},Oh=(0,o.defineComponent)({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,n)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",Ah,[e.title?((0,o.openBlock)(),(0,o.createElementBlock)("div",Ph,[(0,o.createElementVNode)("div",Vh,(0,o.toDisplayString)(e.title),1),(0,o.createElementVNode)("div",Nh,[(0,o.renderSlot)(t.$slots,"titleRight")])])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",jh,[(0,o.renderSlot)(t.$slots,"default")])]))}}),Ih=Oh,zl=ie(Ih),Lh={class:"j-divider-content"},Hh=(0,o.defineComponent)({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,n=(0,o.computed)(()=>{const i={color:t.color};return t.size&&Number(t.size)&&(i.fontSize=`${t.size}px`),i}),a=(0,o.computed)(()=>({borderTopStyle:t.borderStyle}));return(i,r)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(`j-divider-container j-divider-${e.contentPosition}`),style:(0,o.normalizeStyle)(n.value)},[(0,o.createElementVNode)("div",{class:"j-divider-line j-divider-line-left",style:(0,o.normalizeStyle)(a.value)},null,4),(0,o.createElementVNode)("div",Lh,[(0,o.createElementVNode)("span",null,(0,o.toDisplayString)(e.content||""),1)]),(0,o.createElementVNode)("div",{class:"j-divider-line j-divider-line-right",style:(0,o.normalizeStyle)(a.value)},null,4)],6))}}),zh=Hh,Dl=ie(zh),Dh={class:"j-hpanel"},Fh={class:"j-hpanel-main"},$h=(0,o.defineComponent)({name:"JHpanel",__name:"hpanel",setup(e){return(t,n)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",Dh,[(0,o.renderSlot)(t.$slots,"left"),(0,o.createElementVNode)("div",Fh,[(0,o.renderSlot)(t.$slots,"default")]),(0,o.renderSlot)(t.$slots,"right")]))}}),Wh=$h,Fl=ie(Wh),Uh=(0,o.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 n=e,a=t,i=(0,o.ref)(),r=(0,o.ref)(),l=async(u,p)=>{n.ok&&(u("保存数据中..."),r.value=await n.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),p(),i.value.close())},s=()=>n.beforeClose?n.beforeClose(r.value):!0,c=()=>{n.closed?.()},d=()=>{i.value.open(n.title||n.btnText,n.layerType),setTimeout(()=>{n.open?.(r.value)},200)};return(0,o.watch)(()=>n.modelValue,u=>{r.value=u},{immediate:!0}),(u,p)=>{const f=(0,o.resolveComponent)("j-button"),h=(0,o.resolveComponent)("j-layer");return(0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createVNode)(f,(0,o.mergeProps)({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),(0,o.createVNode)(h,{ref_key:"layerRef",ref:i,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:l,onClosed:c},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}}),Jh=Uh,$l=ie(Jh),Yh=(0,o.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 n=e,a=t,i=(0,o.computed)({get:()=>n.modelValue,set:p=>{a("update:modelValue",p)}}),r=(0,o.ref)(""),l=p=>{r.value=p},s=()=>r.value,c=p=>n.beforeClose?n.beforeClose(p):!0,d=p=>{a("change",p)},u=(0,o.computed)(()=>n.modelValue&&n.modelValue.trim()?`${n.btnText}(已设置)`:n.btnText);return(p,f)=>{const h=(0,o.resolveComponent)("j-code-mirror"),g=(0,o.resolveComponent)("j-layout"),m=(0,o.resolveComponent)("j-input-button");return(0,o.openBlock)(),(0,o.createBlock)(m,{modelValue:i.value,"onUpdate:modelValue":f[1]||(f[1]=y=>i.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:l,onChange:d},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(g,{"right-move":!1,right:560},(0,o.createSlots)({default:(0,o.withCtx)(()=>[(0,o.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,o.withCtx)(()=>[(0,o.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"])}}}),Kh=Yh,Wl=ie(Kh),Gh=(0,o.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:n}){const a=e,i=n,r=(0,o.ref)(),l=(0,o.ref)(),s=(0,o.computed)({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(m){l.value=m,i("update:modelValue",m),i("input",m)}}),c=m=>{i("input",m)},d=m=>{i("focus",m)},u=m=>{i("blur",m)},p=()=>{i("clear"),i("update:modelValue","")},f=m=>{i("change",m)},h=m=>{i("color-change",m)},g=m=>{i("active-change",m)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(m,y)=>{const w=(0,o.resolveComponent)("el-color-picker"),x=(0,o.resolveComponent)("el-input");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[(0,o.createVNode)(x,(0,o.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,o.withCtx)(()=>[(0,o.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)}}}),qh=Gh,Ul=ie(qh),Xh=(0,o.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,n=(0,o.computed)(()=>t.class||""),a=(0,o.computed)(()=>{const i={...t.style};return t.color&&(i.color=t.color),t.size&&(typeof t.size=="number"?i.fontSize=`${t.size}px`:i.fontSize=t.size),t.weight&&(i.fontWeight=t.weight),i});return(i,r)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-title",n.value]),style:(0,o.normalizeStyle)(a.value)},(0,o.toDisplayString)(e.title),7))}}),Zh=Xh,Jl=ie(Zh),Qh=(0,o.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:n}){const a=e,i=n,r=(0,o.ref)(),l=(0,o.ref)("");let s=null;const c=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return(0,In.javascript)();case"css":case"text/css":return(0,pu.css)();case"html":case"text/html":return(0,hu.html)();case"json":case"application/json":return(0,gu.json)();case"sql":case"text/x-sql":return(0,mu.sql)();case"xml":case"text/xml":return(0,yu.xml)();case"python":case"text/x-python":return(0,vu.python)();case"markdown":case"text/markdown":return(0,bu.markdown)();case"java":case"text/x-java":return(0,wu.java)();case"vue":case"text/x-vue":return(0,In.javascript)({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return(0,In.javascript)({jsx:!1,typescript:!0});case"jsx":return(0,In.javascript)({jsx:!0,typescript:!1});case"tsx":return(0,In.javascript)({jsx:!0,typescript:!0});default:return(0,In.javascript)()}},d=()=>{const m=[fu.basicSetup,(0,At.lineNumbers)(),(0,At.highlightActiveLineGutter)(),(0,At.highlightSpecialChars)(),(0,oi.history)(),(0,At.drawSelection)(),(0,At.dropCursor)(),(0,Ln.indentOnInput)(),(0,Ln.bracketMatching)(),(0,ni.closeBrackets)(),(0,At.rectangularSelection)(),(0,Ln.foldGutter)(),At.keymap.of([...ni.closeBracketsKeymap,...oi.defaultKeymap,...oi.historyKeymap,...Ln.foldKeymap]),(0,Ln.syntaxHighlighting)(Ln.defaultHighlightStyle)];return m.push(c(a.mode)),a.readonly&&m.push(ti.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push((0,ni.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(At.EditorView.updateListener.of(y=>{if(y.docChanged){const w=y.state.doc.toString();l.value=w,i("update:value",w),i("change",{value:w})}})),m},u=async()=>{r.value&&(s=new At.EditorView({state:ti.EditorState.create({doc:a.value,extensions:d()}),parent:r.value}),l.value=a.value)},p=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const y=ti.EditorState.create({doc:m,extensions:d()});r.value&&(s=new At.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,uu.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,"@"),i("update:value",m),i("change",{value:m})};let g=null;return(0,o.watch)(()=>a.value,m=>{m!==l.value&&(l.value=m,s&&p(),setTimeout(()=>{s&&a.isScrollToBottom&&f()}))}),(0,o.watch)(()=>a.mode,()=>{s&&p()}),(0,o.onMounted)(async()=>{await(0,o.nextTick)(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(g=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),g.observe(r.value))}),(0,o.onUnmounted)(()=>{g&&r.value&&(g.unobserve(r.value),g.disconnect(),g=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(m,y)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:(0,o.normalizeStyle)({height:e.height?`${e.height}px`:""})},null,4))}}),eg=Qh,Yl=ie(eg),tg=(0,o.defineComponent)({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const n=e,a=(0,o.useTemplateRef)("actionRef"),i=(0,o.ref)("0"),r=(0,o.computed)(()=>{const{actionStyle:s,toLeft:c}=n;return{...s,left:c?"0":i.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:c?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=(0,o.computed)(()=>Number.parseInt(i.value)>10&&!n.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{i.value=s}}),(s,c)=>{const d=(0,o.resolveComponent)("j-icon");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"actionRef",ref:a,style:(0,o.normalizeStyle)(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?((0,o.openBlock)(),(0,o.createBlock)(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):((0,o.openBlock)(),(0,o.createBlock)(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),ng=tg,og=(0,o.defineComponent)({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const n=e,a=(0,o.useTemplateRef)("barRef"),i=(0,o.ref)("0"),r=(0,o.computed)(()=>{const{barStyle:l,toLeft:s}=n;return{...l,width:s?"0":i.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:l=>{i.value=l}}),(l,s)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"barRef",ref:a,style:(0,o.normalizeStyle)(r.value)},null,4))}}),ag=og,ig=(0,o.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 n=e,a=(0,o.useTemplateRef)("contentRef"),i=(0,o.computed)(()=>{const{contentStyle:l}=n;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const r=(0,o.computed)(()=>({animation:`shine ${n.animationDuration}s linear ${n.animationIterationCount}`}));return(l,s)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"contentRef",ref:a,class:(0,o.normalizeClass)([{success:e.isPassing},"j-slider-captcha-content"]),style:(0,o.normalizeStyle)(i.value)},[(0,o.createElementVNode)("div",{style:(0,o.normalizeStyle)(r.value),class:"j-spine-text"},(0,o.toDisplayString)(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),rg=ig,lg=(0,o.defineComponent)({name:"JSliderCaptcha",__name:"slider-captcha",props:(0,o.mergeModels)({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:(0,o.mergeModels)(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const n=e,a=t,i=(0,o.useModel)(e,"modelValue"),r=(0,o.reactive)({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=(0,o.useTemplateRef)("wrapperRef"),s=(0,o.useTemplateRef)("barRef"),c=(0,o.useTemplateRef)("contentRef"),d=(0,o.useTemplateRef)("actionRef");(0,o.watch)(()=>r.isPassing,w=>{if(w){const{endTime:x,startTime:v}=r;a("success",{isPassing:w,time:((x-v)/1e3).toFixed(1)}),i.value=w}}),(0,o.watchEffect)(()=>{r.isPassing=!!i.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=l.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,o.unref)(d),_=(0,o.unref)(s);if(!C||!_)return;const{actionWidth:b,offset:B,wrapperWidth:S}=f(C.getEl()),T=u(w)-v;a("move",{event:w,moveDistance:v,moveX:T}),T>0&&T<=B?(C.setLeft(`${T}px`),_.setWidth(`${T+b/2}px`)):T>B&&(C.setLeft(`${S-b}px`),_.setWidth(`${S-b/2}px`),m())}}function g(w){const{isMoving:x,isPassing:v,moveDistance:C}=r;if(x&&!v){a("end",w);const _=d.value,b=(0,o.unref)(s);if(!_||!b)return;const B=u(w)-C,{actionWidth:S,offset:T,wrapperWidth:A}=f(_.getEl());B<T?y():(_.setLeft(`${A-S}px`),b.setWidth(`${A-S/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,o.unref)(d),x=(0,o.unref)(s),v=(0,o.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,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"wrapperRef",ref:l,class:(0,o.normalizeClass)(["j-slider-captcha slider-border",n.class]),style:(0,o.normalizeStyle)([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:g,onMousemove:h,onMouseup:g,onTouchend:g,onTouchmove:h},[(0,o.createVNode)(ag,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),(0,o.createVNode)(rg,{ref_key:"contentRef",ref:c,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),(0,o.createVNode)(ng,{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))}}),sg=lg,Kl=ie(sg),cg=(0,o.defineComponent)({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{getMenuMap:i,toArray:r,activeMenu:l,theme:s}=Dn(),{getHMoreMenus:c}=Qr(),d=(0,o.ref)([]);n.pId==="moreId"?d.value=c.value:d.value=r(i()[n.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,ai.useVirtualList)(d,{itemHeight:44});return(g,m)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",(0,o.mergeProps)({class:["j-sub-menu-content",{"j-menu-dark":(0,o.unref)(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},(0,o.unref)(f)),[(0,o.createElementVNode)("div",(0,o.normalizeProps)((0,o.guardReactiveProps)((0,o.unref)(h))),[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(p),y=>((0,o.openBlock)(),(0,o.createBlock)(na,{key:y.data.value,"parent-actives":(0,o.unref)(l)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),dg=cg,ug={class:"j-menu-item-label"},fg={class:"j-menu-item-label"},pg={key:1,class:(0,o.normalizeClass)(["j-menu-item-arrow","sub"])},hg={class:"j-menu-item-label"},gg=(0,o.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:n}=Ze(),{activeMenuId:a}=Dn(),i=t,r=l=>{i("click",l)};return(l,s)=>{const c=(0,o.resolveComponent)("j-icon"),d=(0,o.resolveComponent)("el-tooltip"),u=(0,o.resolveComponent)("el-popover");return e.collapsed&&!e.item.hasChildren?((0,o.openBlock)(),(0,o.createBlock)(d,{key:0,placement:"right"},{content:(0,o.withCtx)(()=>[(0,o.createElementVNode)("span",null,(0,o.toDisplayString)((0,o.unref)(n)(e.item.label)),1)]),default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=(0,o.withModifiers)(p=>r(e.item),["stop"]))},[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,o.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,o.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,o.openBlock)(),(0,o.createBlock)(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",ug,(0,o.toDisplayString)((0,o.unref)(n)(e.item.label)),1),e.item.hasChildren?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:1,class:(0,o.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,o.createCommentVNode)("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?((0,o.openBlock)(),(0,o.createBlock)(u,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}])},[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,o.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,o.normalizeStyle)({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?((0,o.openBlock)(),(0,o.createBlock)(c,{key:0,icon:e.item.icon,style:(0,o.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,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",fg,(0,o.toDisplayString)((0,o.unref)(n)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?((0,o.openBlock)(),(0,o.createElementBlock)("div",pg)):(0,o.createCommentVNode)("",!0)],6)],2)]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(dg,{"p-id":e.item.value,onClick:r},null,8,["p-id"])]),_:1},8,["placement"])):((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:2,class:(0,o.normalizeClass)(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=(0,o.withModifiers)(p=>r(e.item),["stop"]))},[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,o.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,o.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,o.openBlock)(),(0,o.createBlock)(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:(0,o.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,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",hg,(0,o.toDisplayString)((0,o.unref)(n)(e.item.label)),1),e.item.hasChildren?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:1,class:(0,o.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,o.createCommentVNode)("",!0)],6)],2))}}}),na=gg,mg=(0,o.defineComponent)({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Dn(),l=u=>{a("click",u)},{list:s,containerProps:c,wrapperProps:d}=(0,ai.useVirtualList)((0,o.computed)(()=>n.menuList),{itemHeight:44});return(u,p)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",(0,o.mergeProps)({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":(0,o.unref)(r)==="dark"}]},(0,o.unref)(c)),[(0,o.createElementVNode)("div",(0,o.normalizeProps)((0,o.guardReactiveProps)((0,o.unref)(d))),[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(s),f=>((0,o.openBlock)(),(0,o.createBlock)(na,{key:f.data.value,"parent-actives":(0,o.unref)(i)?.pid?.split(".")||[],item:f.data,collapsed:e.collapsed,class:(0,o.normalizeClass)({"menu-item-entering":f.data.entering,"menu-item-leaving":f.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),yg=mg,vg=(0,o.defineComponent)({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Dn(),l=(0,o.ref)(),s=(0,o.ref)(0);let c=null;(0,o.onMounted)(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(c=new ResizeObserver(()=>{l.value&&(s.value=l.value.offsetWidth)}),c.observe(l.value))});const d=(0,o.computed)(()=>{const h=[];let g=0,m=0;const y=n.menuList.length;return n.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<n.menuList.length&&h.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),h}),u=(0,o.computed)(()=>{const h=[];let g=0;const m=d.value.length;return n.menuList.forEach(y=>{g++,g>=m&&h.push(y)}),h}),p=(0,o.computed)(()=>{const h=i.value?.pid?.split(".")||[];return(h.length>1&&u.value.findIndex(g=>g.value===h[1])>-1||u.value.findIndex(g=>g.value===i.value?.value)>-1)&&h.push("moreId"),h}),f=h=>{a("click",h)};return el({getHMoreMenus:u}),(0,o.onUnmounted)(()=>{c&&l.value&&(c.unobserve(l.value),c.disconnect(),c=null)}),(h,g)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"menuRef",ref:l,class:(0,o.normalizeClass)(["j-menu-horizontal",{"j-menu-dark":(0,o.unref)(r)==="dark"}])},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(d.value,m=>((0,o.openBlock)(),(0,o.createBlock)(na,{key:m.value,"parent-actives":p.value,item:m,"is-horizontal":"",onClick:f},null,8,["parent-actives","item"]))),128))],2))}}),bg=vg,wg=(0,o.defineComponent)({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const n=e,a=t,{activeMenu:i,theme:r}=Dn(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=(0,o.computed)(()=>(n.menuList.forEach((h,g)=>{h.color=l[g%l.length]}),n.menuList)),c=(0,o.computed)(()=>i.value?.pid?.split(".")||[]),d=h=>{a("click",h)},{list:u,containerProps:p,wrapperProps:f}=(0,ai.useVirtualList)(s,{itemHeight:96});return(h,g)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",(0,o.mergeProps)({class:["j-menu-vertical",{"j-menu-dark":(0,o.unref)(r)==="dark"}]},(0,o.unref)(p)),[(0,o.createElementVNode)("div",(0,o.normalizeProps)((0,o.guardReactiveProps)((0,o.unref)(f))),[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(u),m=>((0,o.openBlock)(),(0,o.createBlock)(na,{key:m.data.value,"parent-actives":c.value,item:m.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),Cg=wg,xg=(0,o.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 n=e,a=t;let i={};const r=(0,o.ref)("");r.value=n.activeId||"";const l=(m,y,w,x,v)=>{w=w||[];for(let C=0,_=w.length;C<_;C++){const b=w[C],B={};B.pid=y,B.indent=x,r.value===b.value&&(B.active=!0),Object.keys(b).forEach(T=>{T!=="children"&&(B[T]=b[T])}),v&&v.includes(b.value)&&(B.open=!0),m.push(B);const S=b.children||[];S.length>0&&(B.hasChildren=!0,v||(i[B.value]=S),(!v||B.open&&!n.collapsed)&&l(m,`${y}.${B.value}`,S,x+1,v))}},s=(m,y)=>{const w=[];return l(w,"0",m,0,y),w},c=(0,o.ref)([]);let d=[];const u=()=>{i={},d=s(n.menus);const m=[];if(r.value&&n.mode==="inline"){const y=d.find(w=>w.value===r.value);y&&m.push(...y.pid.split("."))}c.value=s(n.menus,m)};(0,o.watch)(()=>n.menus,()=>{u()},{immediate:!0}),(0,o.watch)(()=>n.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=[];n.mode==="inline"&&y.push(...m.pid.split(".")),c.value=s(n.menus,y)}}},f=(0,o.computed)(()=>d.find(m=>m.value===r.value));(0,o.watch)(()=>n.activeId,()=>{r.value=n.activeId||"",p()}),(0,o.watch)(()=>n.collapsed,()=>{if(n.collapsed)c.value=s(n.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(n.menus,m)}});const h=(0,o.computed)(()=>n.theme),g=m=>{if(console.log(m),m.hasChildren){if(n.collapsed)return;const y=[];y.push(...m.pid.split(".")),m.open||y.push(m.value);const w=s(n.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 Zr({getMenuMap:()=>i,toArray:s,activeMenu:f,activeMenuId:r,theme:h}),(m,y)=>e.mode==="inline"?((0,o.openBlock)(),(0,o.createBlock)(yg,{key:0,"menu-list":c.value,collapsed:e.collapsed,onClick:g},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?((0,o.openBlock)(),(0,o.createBlock)(bg,{key:1,"menu-list":c.value,onClick:g},null,8,["menu-list"])):((0,o.openBlock)(),(0,o.createBlock)(Cg,{key:2,"menu-list":c.value,onClick:g},null,8,["menu-list"]))}}),kg=xg,Gl=ie(kg),Sg={class:"j-keyword-panel"},Eg={key:0},Bg={key:1,class:"columns-wrapper"},Rg=(0,o.defineComponent)({name:"JKeywordPanel",__name:"keyword-panel",props:(0,o.mergeModels)({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:n}=Ze(),a=e,i=(0,o.useModel)(e,"checkAll"),r=(0,o.useModel)(e,"checkFields"),l=(0,o.ref)(!1),s=(0,o.ref)(""),c=(0,o.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=()=>{i.value||(i.value=!0,l.value=!1,r.value=[])},u=f=>{f.length>0?i.value=!1:i.value=!0};return t({init:()=>{i.value?l.value=!1:l.value=!0}}),(f,h)=>{const g=(0,o.resolveComponent)("j-icon"),m=(0,o.resolveComponent)("el-input"),y=(0,o.resolveComponent)("j-checkbox");return(0,o.openBlock)(),(0,o.createElementBlock)("div",Sg,[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["range-item",{active:i.value}]),onClick:d},[(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(n)("搜索全部")),1),i.value?((0,o.openBlock)(),(0,o.createBlock)(g,{key:0,icon:"mdi:check"})):(0,o.createCommentVNode)("",!0)],2),(0,o.createElementVNode)("div",{class:"range-item",onClick:h[0]||(h[0]=w=>l.value=!l.value)},[(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(n)("搜索特定字段")),1),(0,o.createVNode)(g,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Eg,[(0,o.createVNode)(m,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=w=>s.value=w),modelModifiers:{trim:!0},class:"no-border background",placeholder:(0,o.unref)(n)("搜索"),clearable:""},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(g,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):(0,o.createCommentVNode)("",!0),l.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Bg,[(0,o.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,o.createCommentVNode)("",!0)])}}}),_g=Rg,Tg={key:0,class:"title"},Mg={class:"content"},Ag={class:"relation"},Pg={style:{width:"72px"}},Vg={class:"btn-wrapper"},Ng={class:"field-wrapper"},jg={class:"buttons"},Og=(0,o.defineComponent)({name:"JFilterPanel",__name:"filter-panel",props:(0,o.mergeModels)({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:(0,o.mergeModels)(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:n}){const{t:a}=Ze(),i=e,r=(0,o.useModel)(e,"relation"),l=(0,o.useModel)(e,"isPin"),s=(0,o.ref)([]),c=()=>{l.value=!l.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:p.value.join(","),options:u.value}),config:{style:{width:l.value?"132px":"160px"},appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,change:({value:x,row:v})=>{const C=i.columns.find(B=>B.id===x)?.config||{};let _="eq",b="text";["options"].includes(C.dataType||"")?_="in":["dateTime"].includes(C.type||"")?(_="range",b="dateTime"):["number"].includes(C.type||"")&&(b="number"),v.method=_,v.type=C.valueType||b,v.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:x})=>{const v=i.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:l.value?"134px":"130px"},appendTo:l.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=i.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=i.columns.find(_=>_.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:l.value?"246px":"296px",flex:l.value?"auto":"1"},appendTo:l.value?void 0:".j-filter-panel"}}];(0,o.onMounted)(()=>{s.value=i.searchFieldList});const u=(0,o.computed)(()=>i.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,o.computed)(()=>s.value.map(x=>x.field)),f=({data:x})=>{if(p.value.includes(x.value))return;const v=i.columns.find(b=>b.id===x.value)?.config||{};let C="eq",_="text";["options","dataItem"].includes(v.dataType||"")?C="in":["dateTime"].includes(v.type||"")&&(C="range",_="dateTime"),s.value.push({field:x.value,method:C,type:v.valueType||_})},h=n,g=()=>{s.value.length=0},m=()=>{l.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,o.resolveComponent)("j-icon"),_=(0,o.resolveComponent)("j-select"),b=(0,o.resolveComponent)("j-button-select"),B=(0,o.resolveComponent)("j-button"),S=(0,o.resolveComponent)("j-input-rows"),T=(0,o.resolveComponent)("el-tooltip");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-filter-panel",{"is-pin":l.value}])},[l.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Tg,[(0,o.createVNode)(C,{icon:"mdi:filter-outline"}),(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(a)("筛选")),1)])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",Mg,[(0,o.createElementVNode)("div",Ag,[(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(a)("筛选出符合以下")),1),(0,o.createElementVNode)("div",Pg,[(0,o.createVNode)(_,{modelValue:r.value,"onUpdate:modelValue":v[0]||(v[0]=A=>r.value=A),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(a)("条件的数据")),1)]),(0,o.createElementVNode)("div",Vg,[(0,o.createVNode)(b,{label:"添加过滤条件",options:u.value,"model-value":p.value.join(","),onChange:f},null,8,["options","model-value"]),s.value.length>0?((0,o.openBlock)(),(0,o.createBlock)(B,{key:0,type:"text",danger:"",label:"删除全部",onClick:g})):(0,o.createCommentVNode)("",!0)]),(0,o.createElementVNode)("div",Ng,[(0,o.createVNode)(S,{modelValue:s.value,"onUpdate:modelValue":v[1]||(v[1]=A=>s.value=A),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),(0,o.createVNode)(T,{placement:"bottom",content:l.value?(0,o.unref)(a)("取消固定"):(0,o.unref)(a)("固定显示")},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{class:"pin-btn",onClick:c},[(0,o.createVNode)(C,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),(0,o.createElementVNode)("div",jg,[(0,o.createVNode)(B,{label:(0,o.unref)(a)("筛选"),type:"primary",onClick:m},null,8,["label"]),(0,o.createVNode)(B,{label:(0,o.unref)(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),ql=Og,Ig={class:"j-order-panel"},Lg={class:"content"},Hg={class:"btn-wrapper"},zg={class:"field-wrapper"},Dg={class:"buttons"},Fg=(0,o.defineComponent)({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:n}){const{t:a}=Ze(),i=e,r=n,l=(0,o.computed)(()=>i.columns.filter(g=>!g.children?.length&&g.config?.sorter?.isNot!==!0).map(g=>({label:g.config?.label,value:g.id}))),s=(0,o.ref)([]),c=(0,o.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,o.resolveComponent)("j-button-select"),w=(0,o.resolveComponent)("j-input-rows"),x=(0,o.resolveComponent)("j-button");return(0,o.openBlock)(),(0,o.createElementBlock)("div",Ig,[(0,o.createElementVNode)("div",Lg,[(0,o.createElementVNode)("div",Hg,[(0,o.createVNode)(y,{label:"添加排序规则",options:l.value,"model-value":c.value.join(","),onChange:u},null,8,["options","model-value"])]),(0,o.createElementVNode)("div",zg,[(0,o.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,o.createElementVNode)("div",Dg,[(0,o.createVNode)(x,{label:(0,o.unref)(a)("排序"),type:"primary",onClick:f},null,8,["label"]),s.value.length>0?((0,o.openBlock)(),(0,o.createBlock)(x,{key:0,label:(0,o.unref)(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):(0,o.createCommentVNode)("",!0)])])}}}),$g=Fg,Wg={class:"j-column-panel"},Ug={class:"content"},Jg={class:"search-wrapper"},Yg={class:"tree-wrapper"},Kg={class:"buttons"},Gg=(0,o.defineComponent)({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:n}){const{t:a}=Ze(),i=e,r=n,l=(0,o.ref)(),s=(0,o.ref)(""),c={},d=(0,o.ref)([]),u=(0,o.ref)([]),p=(b,B)=>{const S=[],T=new Map;b.forEach(R=>{T.set(R.id||"",R),c[R.id||""]=R});const A=new Set;return B&&B.length>0&&B.forEach(R=>{const j=T.get(R.id);if(j){A.add(j.id||"");const O={id:j.id||"",label:j.config?.label||j.id||"",type:j.type,display:j.config?.display!==!1};j.children&&j.children.length>0&&(O.children=p(j.children,R.children)),S.push(O)}}),b.forEach(R=>{if(!A.has(R.id||"")){const j={id:R.id||"",label:R.config?.label||R.id||"",type:R.type,display:R.config?.display!==!1};R.children&&R.children.length>0&&(j.children=p(R.children)),S.push(j)}}),S},f=(b,B)=>B.length===0?b:b.map(S=>{const T=B.some(R=>S.label.toLowerCase().includes(R.toLowerCase())),A=S.children?f(S.children,B):[];return T||A.length>0?{...S,children:A.length>0?A:S.children}:null}).filter(Boolean),h=(0,o.computed)(()=>{if(!s.value)return u.value;const b=s.value.split(/\s+/).filter(Boolean);return f(u.value,b)}),g=(0,o.ref)([]),m=(0,o.computed)(()=>{const b=new Map;if(i.columnConfig&&i.columnConfig.length>0){const B=S=>{S.forEach(T=>{b.set(T.id,T),T.children&&B(T.children)})};B(i.columnConfig)}return b}),y=()=>{const b=B=>{const S=[];return B.forEach(T=>{let A=!0;if(m.value.size>0){const R=m.value.get(T.id||"");R?A=R.display:A=T.config?.display!==!1}else A=T.config?.display!==!1;A&&(S.push(T.id||""),T.children&&S.push(...b(T.children)))}),S};g.value=b(i.columns)},w=(b,{node:B})=>{b.includes(B.id)?g.value.push(B.id):g.value=g.value.filter(S=>S!==B.id)},x=(b,B,S)=>S==="inner"?!1:b.parent===B.parent,v=()=>{const b=B=>B.map(S=>{const T={...S,display:g.value.includes(S.id)};return S.children&&(T.children=b(S.children)),T});r("save",b(u.value))},C=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),s.value="",l.value){const b=l.value;b.setCheck&&b.setCheck(g.value);const B=b.$refs?.treeRef||b;B?.setCheckedKeys&&B.setCheckedKeys(g.value)}r("save",void 0)};return t({init:()=>{y(),d.value=p(i.columns,i.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(b,B)=>{const S=(0,o.resolveComponent)("j-icon"),T=(0,o.resolveComponent)("el-input"),A=(0,o.resolveComponent)("j-tree"),R=(0,o.resolveComponent)("j-button");return(0,o.openBlock)(),(0,o.createElementBlock)("div",Wg,[(0,o.createElementVNode)("div",Ug,[(0,o.createElementVNode)("div",Jg,[(0,o.createVNode)(T,{modelValue:s.value,"onUpdate:modelValue":B[0]||(B[0]=j=>s.value=j),modelModifiers:{trim:!0},placeholder:(0,o.unref)(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(S,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,o.createElementVNode)("div",Yg,[(0,o.createVNode)(A,{ref_key:"treeRef",ref:l,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,o.createElementVNode)("div",Kg,[(0,o.createVNode)(R,{label:(0,o.unref)(a)("确定"),type:"primary",onClick:v},null,8,["label"]),(0,o.createVNode)(R,{label:(0,o.unref)(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),qg=Gg,Xg={class:"j-table-panel-left"},Zg={class:"j-table-panel-top"},Qg={class:"j-table-panel-top-right"},e0={key:0,style:{width:"200px"}},t0={class:"j-table-panel-main"},n0={class:"j-table-panel-loading"},o0={class:"j-table-panel-loading-content"},a0={class:"j-table-panel-loading-text"},i0={key:0,class:"j-table-panel-filter-panel"},r0=(0,o.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:n}){const{t:a}=Ze(),{openLayer:i}=Fn(),r=e,l=n;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=(0,o.ref)();let c=[];const d=(0,o.ref)(0),u=(0,o.ref)(1);let p=r.pageSize||100;const f=(0,o.ref)(0),h=(0,o.computed)(()=>f.value>0),g=(0,o.ref)([]),m=(0,o.ref)(!1),y=(0,o.computed)(()=>r.batchButtons&&r.batchButtons.length>0),w=(0,o.computed)(()=>g.value.length>0),x=(0,o.computed)(()=>y.value&&w.value&&r.isMultiple||m.value),v=(0,o.computed)(()=>r.isPage&&!x.value);y.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const C=le=>r.rowKey?r.rowKey.split(",").map(ce=>le[ce.trim()]).join("::"):"",_=(le,ce)=>{if(!ce||ce.length===0)return le.filter(ee=>ee.config?.display!==!1).map(ee=>ee.children&&ee.children.length>0?{...ee,children:_(ee.children)}:ee);const nt=new Map(le.map(ee=>[ee.id,ee])),Ke=[];return ce.forEach(ee=>{const Ge=nt.get(ee.id);if(Ge){if(ee.display){let Bt=Ge;Ge.children&&Ge.children.length>0&&(Bt={...Ge,children:_(Ge.children,ee.children)}),Ke.push(Bt)}nt.delete(ee.id)}}),le.forEach(ee=>{if(nt.has(ee.id)&&ee.config?.display!==!1){let Ge=ee;ee.children&&ee.children.length>0&&(Ge={...ee,children:_(ee.children)}),Ke.push(Ge)}}),Ke},b=(0,o.computed)(()=>_(r.columns,ze.value)),B=(0,o.computed)(()=>zr(r.columns,le=>le.config.label)),S=(0,o.ref)(""),T=(0,o.computed)(()=>B.value.some(le=>le.config?.filter?.isSearchKeyword)),A=(0,o.ref)(),R=(0,o.ref)(!0),j=(0,o.ref)([]),O=(0,o.computed)(()=>R.value?"搜索全部":`搜索范围:${B.value.filter(le=>j.value.includes(le.id)).map(le=>le.config?.label).join("、")}`),H=()=>{A.value.init()},M=(0,o.ref)(),E=(0,o.ref)(!1),L=(0,o.ref)(!1),$=(0,o.ref)(!1),Q=(0,o.ref)([]),se=(0,o.ref)("and"),ge=(0,o.ref)(),Ee=(0,o.ref)(!1),We=(0,o.ref)([]),X=()=>{ge.value.init(We.value)},Te=le=>{We.value=le,Ee.value=!1,me()},Ne=()=>{We.value=[],me()},ye=(0,o.ref)(),je=(0,o.ref)(!1),ze=(0,o.ref)(),G=(0,o.computed)(()=>ze.value!=null),pe=()=>{ye.value?.init()},xe=le=>{ze.value=le,je.value=!1},Me=(0,o.ref)(!1),ut=()=>{Me.value=!Me.value},ht=()=>{g.value=[],s.value&&(s.value.setSelection?.([]),m.value&&(m.value=!1,s.value.setRecords(c)))},Oe=()=>{m.value=!m.value,m.value?s.value?.setRecords(g.value):(console.log(c,"tableData"),s.value?.setRecords(c)),s.value?.setSelection?.(g.value)},vt=(0,o.computed)(()=>{if(g.value.length>0&&r.isMultiple){const le=[{id:"selection_count",label:`已选${g.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:m.value?"全部":"仅选中",config:{type:"text"},click:Oe},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:ht}],ce=r.batchButtons.map(nt=>({...nt,click:()=>{nt.click&&nt.click({data:g.value,openLayer:i})}}));return[...le,...ce]}return r.buttons}),gn=(0,o.computed)(()=>vt.value.filter(le=>le.config?.display!==!1)),Et=(0,o.ref)(null),F=(0,o.ref)(0),te=()=>{F.value=Et.value?.clientWidth||0};let J;(0,o.onMounted)(()=>{(0,o.nextTick)(te),J=new ResizeObserver(()=>{te()}),Et.value&&J.observe(Et.value)}),(0,o.onBeforeUnmount)(()=>{J?.disconnect()}),(0,o.watch)(()=>gn.value,()=>{(0,o.nextTick)(te)},{deep:!0}),(0,o.watch)(Me,()=>{(0,o.nextTick)(te)});const K=(0,o.computed)(()=>{const le=gn.value;if(le.length===0)return[];const ce=F.value;if(ce<=0)return le;const nt=Math.max(0,ce-4),Ke=(qe,wt)=>qe.groupId||`__auto_${wt}`,ee=qe=>{if(qe.config?.notLabel===!0||!qe.label)return 28;const wt=24,zt=kt(qe.label||"")||0,Rt=qe.config?.icon?18:0;return Math.ceil(zt+wt+Rt+2)};if((qe=>{let wt=0,zt=null;return qe.forEach((Rt,Ho)=>{const Wa=Ke(Rt,Ho);zt!==null&&(wt+=Wa===zt?-1:8),wt+=ee(Rt),zt=Wa}),wt})(le)<=nt)return le;const Bt={id:"__table_panel_more__",label:"",config:{icon:"mdi:dots-horizontal",notLabel:!0},children:[]},ot=28,Ct=[];let He=0,Lo=null;for(let qe=0;qe<le.length;qe++){const wt=le[qe],zt=Ke(wt,qe);let Rt=He;Lo!==null&&(Rt+=zt===Lo?-1:8),Rt+=ee(wt);const Ho=le.length-(qe+1)>0?(Rt>0?8:0)+ot:0;if(Rt+Ho<=nt)Ct.push(wt),He=Rt,Lo=zt;else break}const Nn=le.slice(Ct.length);if(Nn.length===0)return le;const $a={...Bt,children:Nn};return Ct.length===0?[$a]:[...Ct,$a]});let Z;const he=async le=>{f.value++;const ce={};le&&(Z=le),Z&&(ce.query=Z);try{const nt={};nt.rel=se.value,nt.cond=(M.value?.getSearchFields?.()||Q.value).filter(ee=>ee.value!==void 0&&ee.value!==null&&ee.value!==""||["empty","not_empty"].includes(ee.method)).map(ee=>({field:ee.field,method:ee.method,value:ee.value,type:ee.type})),nt.cond.length>0?$.value=!0:$.value=!1,ce.filter=nt;const Ke=We.value.map(ee=>ee.value+" "+ee.sord).join(",");if(S.value&&(ce.keyword={value:S.value,fields:R.value?B.value.filter(ee=>ee.config?.filter?.isSearchKeyword).map(ee=>ee.id):(0,o.unref)(j)}),r.loadData){if(r.isPage){ce.pagination={rows:p,page:u.value,sort:Ke||r.sort||r.rowKey};const ee=await r.loadData(ce)||{};c=ee.rows||[],d.value=ee.records||0}else ce.sort=Ke,c=await r.loadData(ce)||[],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)}},me=async()=>{u.value=1,await he()},Ie=({rows:le,page:ce})=>{p=le,u.value=ce,he()},it=async()=>{g.value=[],m.value=!1,u.value=1,Z=void 0,await he()},Le=async le=>{g.value=[],m.value=!1,await he(le)},mn=async()=>{await it()},Vn=le=>{l("ready",le)},Br=({selections:le,record:ce,checked:nt,isMultiple:Ke})=>{let ee=[];if(!r.isMultiple){g.value=le,l("select",{selections:le,record:ce,checked:nt,isMultiple:Ke});return}if(y.value)ee=le;else if(!r.rowKey)ee=le;else{const Ge=new Map(le.map(ot=>[C(ot),ot])),Bt=new Map(g.value.map(ot=>[C(ot),ot]));c.forEach(ot=>{const Ct=C(ot);Ge.has(Ct)?Bt.set(Ct,Ge.get(Ct)):Bt.delete(Ct)}),ee=Array.from(Bt.values())}g.value=ee,l("select",{selections:ee,record:ce,checked:nt,isMultiple:Ke}),m.value&&ee.length===0?(m.value=!1,s.value&&s.value.setRecords(c)):m.value&&ee.length>0&&s.value&&(s.value.setRecords(ee),s.value.setSelection?.(ee))},Da=()=>g.value||[],Oo=le=>{g.value=le,s.value?.setSelection?.(le)},Io=()=>s.value;return(0,o.onMounted)(async()=>{r.immediate&&await Le()}),t({refreshData:Le,resetData:it,getSelection:Da,setSelection:Oo,clearSelection:()=>{ht()},getTableRef:Io}),(le,ce)=>{const nt=(0,o.resolveComponent)("j-buttons"),Ke=(0,o.resolveComponent)("j-icon"),ee=(0,o.resolveComponent)("el-popover"),Ge=(0,o.resolveComponent)("el-tooltip"),Bt=(0,o.resolveComponent)("el-input"),ot=(0,o.resolveComponent)("j-button"),Ct=(0,o.resolveComponent)("j-table");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-table-panel-wrapper",{fullscreen:Me.value,"no-padding":e.noPadding||Me.value}])},[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-table-panel",{"j-table-panel-fullscreen":Me.value}])},[(0,o.createElementVNode)("div",Xg,[(0,o.createElementVNode)("div",Zg,[(0,o.createElementVNode)("div",{ref_key:"topLeftRef",ref:Et,class:"j-table-panel-top-left"},[(0,o.createVNode)(nt,{list:K.value},null,8,["list"])],512),(0,o.createElementVNode)("div",Qg,[T.value&&!x.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",e0,[(0,o.createVNode)(Bt,{modelValue:S.value,"onUpdate:modelValue":ce[2]||(ce[2]=He=>S.value=He),modelModifiers:{trim:!0},placeholder:(0,o.unref)(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:(0,o.withKeys)(me,["enter"]),onClear:me},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(Ke,{icon:"mdi:search"})]),suffix:(0,o.withCtx)(()=>[(0,o.createVNode)(Ge,{placement:"bottom",content:O.value},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",null,[(0,o.createVNode)(ee,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:H,onHide:me},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(Ke,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(_g,{ref_key:"keywordPanelRef",ref:A,"check-all":R.value,"onUpdate:checkAll":ce[0]||(ce[0]=He=>R.value=He),"check-fields":j.value,"onUpdate:checkFields":ce[1]||(ce[1]=He=>j.value=He),columns:B.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):(0,o.createCommentVNode)("",!0),e.showFilterButton&&!E.value&&!x.value?((0,o.openBlock)(),(0,o.createBlock)(ee,{key:1,visible:L.value,"onUpdate:visible":ce[6]||(ce[6]=He=>L.value=He),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:me},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:(0,o.normalizeClass)({active:$.value})},null,8,["class"])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(ql,{ref_key:"filterPanelRef",ref:M,"is-pin":E.value,"onUpdate:isPin":ce[3]||(ce[3]=He=>E.value=He),relation:se.value,"onUpdate:relation":ce[4]||(ce[4]=He=>se.value=He),"search-field-list":Q.value,columns:B.value,onFilter:me,onClose:ce[5]||(ce[5]=He=>L.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):(0,o.createCommentVNode)("",!0),e.showOrderButton&&!x.value?((0,o.openBlock)(),(0,o.createBlock)(Ge,{key:2,placement:"bottom",content:(0,o.unref)(a)("排序")},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",null,[(0,o.createVNode)(ee,{visible:Ee.value,"onUpdate:visible":ce[7]||(ce[7]=He=>Ee.value=He),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:X},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{class:(0,o.normalizeClass)({active:We.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)($g,{ref_key:"orderPanelRef",ref:ge,columns:B.value,onSave:Te,onClear:Ne},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,o.createCommentVNode)("",!0),e.showColumnButton&&!x.value?((0,o.openBlock)(),(0,o.createBlock)(Ge,{key:3,placement:"bottom",content:(0,o.unref)(a)("显示字段")},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",null,[(0,o.createVNode)(ee,{visible:je.value,"onUpdate:visible":ce[8]||(ce[8]=He=>je.value=He),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:pe},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{class:(0,o.normalizeClass)({active:G.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(qg,{ref_key:"columnPanelRef",ref:ye,columns:e.columns,"column-config":ze.value,onSave:xe},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,o.createCommentVNode)("",!0),e.showRefreshButton&&!x.value?((0,o.openBlock)(),(0,o.createBlock)(Ge,{key:4,placement:"bottom",content:(0,o.unref)(a)("刷新")},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{type:"text",icon:"mdi:refresh",onClick:mn})]),_:1},8,["content"])):(0,o.createCommentVNode)("",!0),e.showFullscreenButton?((0,o.openBlock)(),(0,o.createBlock)(Ge,{key:5,placement:"bottom",content:Me.value?(0,o.unref)(a)("退出全屏"):(0,o.unref)(a)("全屏")},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(ot,{type:"text",icon:Me.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:ut},null,8,["icon"])]),_:1},8,["content"])):(0,o.createCommentVNode)("",!0)])]),(0,o.createElementVNode)("div",t0,[(0,o.withDirectives)((0,o.createElementVNode)("div",n0,[(0,o.createElementVNode)("div",o0,[(0,o.createVNode)(Ke,{icon:"mdi:loading",class:"loading-spin",size:24}),(0,o.createElementVNode)("div",a0,(0,o.toDisplayString)((0,o.unref)(a)("加载中")),1)])],512),[[o.vShow,h.value]]),(0,o.createVNode)(Ct,{ref_key:"tableRef",ref:s,"table-page":u.value,"onUpdate:tablePage":ce[9]||(ce[9]=He=>u.value=He),columns:b.value,"sub-columns":e.subColumns,records:(0,o.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:Ie,onReady:Vn,onSelectionChanged:Br},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,o.openBlock)(),(0,o.createElementBlock)("div",i0,[(0,o.createVNode)(ql,{ref_key:"filterPanelRef",ref:M,"is-pin":E.value,"onUpdate:isPin":ce[10]||(ce[10]=He=>E.value=He),relation:se.value,"onUpdate:relation":ce[11]||(ce[11]=He=>se.value=He),"search-field-list":Q.value,columns:B.value,onFilter:me},null,8,["is-pin","relation","search-field-list","columns"])])):(0,o.createCommentVNode)("",!0)],2)],2)}}}),l0=r0,vi=ie(l0),s0={class:"j-button-select"},c0={class:"search-wraper"},d0={class:"options-wraper"},u0=["onClick"],f0=(0,o.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 n=e,a=t,{t:i}=Ze(),r=(0,o.ref)(""),l=(0,o.computed)(()=>r.value===""?n.options:n.options.filter(d=>(d.label||"").includes(r.value))),s=(0,o.computed)(()=>n.modelValue?(n.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,o.resolveComponent)("j-button"),f=(0,o.resolveComponent)("j-icon"),h=(0,o.resolveComponent)("el-input"),g=(0,o.resolveComponent)("el-popover");return(0,o.openBlock)(),(0,o.createBlock)(g,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:(0,o.withCtx)(()=>[(0,o.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,o.withCtx)(()=>[(0,o.createElementVNode)("div",s0,[(0,o.createElementVNode)("div",c0,[(0,o.createVNode)(h,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=m=>r.value=m),modelModifiers:{trim:!0},placeholder:(0,o.unref)(i)("搜索"),class:"no-border",clearable:""},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(f,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,o.createElementVNode)("div",d0,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(l.value,m=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:m.value,class:(0,o.normalizeClass)(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:(0,o.withModifiers)(y=>c(m),["stop"])},[m.icon?((0,o.openBlock)(),(0,o.createBlock)(f,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(i)(m.label)),1)],10,u0))),128))])])]),_:1},8,["width"])}}}),p0=f0,Xl=ie(p0),h0={class:"j-tree-item-text"},g0={key:2,class:"j-tree-item-button-group"},m0={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},y0=(0,o.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:n}){const a=e,i=n,{useData:r,t:l}=Ze(),{getTreeData:s,loadData:c}=r(),d=(0,o.ref)(),u=(0,o.ref)(!1),p=(0,o.ref)(""),f=(0,o.ref)([]),h={children:"children",label:"label",disabled:"disabled"},g=(0,o.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,o.computed)(()=>a.dataCode||a.dataType?g.value:a.list?(0,o.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,o.nextTick)(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},w=(H,M=!0)=>{d.value?.setCurrentKey(H,M)},x=()=>d.value?.getCurrentKey(),v=(H,M=!1)=>{d.value?.setCheckedKeys(H,M)},C=(H=!1)=>d.value?.getCheckedKeys(H),_=async(H,M,E,L)=>{if(p.value=H.value,a.nodeClickFlow&&a.runFlow){const $=JSON.parse(a.nodeClickFlow);await a.runFlow($,{value:H.value})}a.click&&a.click(H.value,H,L)},b=(H,{checkedKeys:M,checkedNodes:E,halfCheckedKeys:L,halfCheckedNodes:$})=>{a.check&&a.check(M,{node:H,checkedNodes:E,halfCheckedKeys:L,halfCheckedNodes:$})},B=(H,M,E,L)=>{i("node-drop",H,M,E,L)},S=H=>{const M=xt(a.treeButtons);return H&&a.filterButton?a.filterButton({buttons:M,node:H}):M},{openLayer:T}=Fn(),A=(H,M)=>{H.config?.disabled||H.click&&H.click({data:M,openLayer:T})},R=(0,o.ref)(""),j=(H,M)=>{R.value=H?M.value:"",console.log(R.value,"row")},O=(H,M,E)=>a.allowDrop?a.allowDrop(H,M,E):!(E=="inner"&&!M.data.canInner);return(0,o.onMounted)(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),(0,o.watch)(()=>a.list,()=>{u.value=!0,(0,o.nextTick)(()=>{u.value=!1})}),(0,o.watch)(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:w,getValue:x,setCheck:v,getCheck:C}),(H,M)=>{const E=(0,o.resolveComponent)("j-icon"),L=(0,o.resolveComponent)("j-button"),$=(0,o.resolveComponent)("el-dropdown-item"),Q=(0,o.resolveComponent)("el-dropdown-menu"),se=(0,o.resolveComponent)("el-dropdown"),ge=(0,o.resolveComponent)("el-tree"),Ee=(0,o.resolveComponent)("el-empty"),We=(0,o.resolveDirective)("loading");return(0,o.withDirectives)(((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!u.value&&m.value.length>0?((0,o.openBlock)(),(0,o.createBlock)(ge,{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":O,"expand-on-click-node":e.expandOnClickNode,onNodeClick:_,onCheck:b,onNodeDrop:B},{default:(0,o.withCtx)(({node:X})=>[(0,o.createElementVNode)("div",{class:(0,o.normalizeClass)(["j-tree-item-wraper",{"is-focus":R.value===X.data.value}])},[X.data.openIcon?((0,o.openBlock)(),(0,o.createBlock)(E,{key:0,class:"j-tree-item-open-icon",size:18,icon:X.data.openIcon,color:X.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,o.createCommentVNode)("",!0),X.data[e.iconKey]||e.defaultIcon?((0,o.openBlock)(),(0,o.createBlock)(E,{key:1,class:"j-tree-item-default-icon",size:18,icon:X.data[e.iconKey]||e.defaultIcon||"",color:X.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",h0,(0,o.toDisplayString)(X.label),1),S(X.data).length?((0,o.openBlock)(),(0,o.createElementBlock)("div",g0,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(S(X.data),(Te,Ne)=>((0,o.openBlock)(),(0,o.createBlock)(se,{key:Ne,trigger:"click",onVisibleChange:ye=>j(ye,X.data)},{dropdown:(0,o.withCtx)(()=>[(0,o.createVNode)(Q,null,{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(Te.children,(ye,je)=>((0,o.openBlock)(),(0,o.createBlock)($,{key:je,disabled:ye.disabled,divided:ye.divided,onClick:(0,o.withModifiers)(ze=>A(ye,X.data),["stop"])},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{class:"j-flex-item",style:(0,o.normalizeStyle)({color:ye.danger?"var(--j-color-danger)":ye.color||e.buttonIconColor||"var(--j-color-text-2)"})},[ye.icon||e.buttonDefaultIcon?((0,o.openBlock)(),(0,o.createBlock)(E,{key:0,icon:ye.icon||e.buttonDefaultIcon},null,8,["icon"])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",null,(0,o.toDisplayString)((0,o.unref)(l)(ye.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(L,{icon:Te.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):(0,o.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,o.openBlock)(),(0,o.createElementBlock)("div",m0,[(0,o.createVNode)(Ee,{description:(0,o.unref)(l)(e.emptyDes)},null,8,["description"])]))],2)),[[We,u.value]])}}}),v0=y0,Zl=ie(v0),b0=(0,o.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 n=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:i}=Ze(),{getTreeData:r}=i(),l=(0,o.computed)(()=>r?r({dataType:n.dataType,dataCode:n.dataCode,labelKey:n.labelKey||a[n.dataType]?.label||"label",valueKey:n.valueKey||a[n.dataType]?.value||"value",pidKey:n.pidKey||a[n.dataType]?.pidKey||"pid",idKey:n.idKey||a[n.dataType]?.idKey||"id",notLoad:!1})||[]:[]),s=(0,o.computed)(()=>n.dataCode||n.dataType?l.value:n.options||[]),c=t,d=(0,o.computed)({get(){return n.modelValue},set(p){c("update:modelValue",p)}}),u=p=>{c("change",p)};return(p,f)=>{const h=(0,o.resolveComponent)("el-tree-select");return(0,o.openBlock)(),(0,o.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:n,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"])}}}),w0=b0,Ql=ie(w0),es=ie(kl),C0=ii.default;async function x0(e,t,n){const a={...n};delete a.ruleIndex,delete a.trigger;const i=new C0({[e]:[a]});let r=[];try{await i.validate({[e]:t})}catch(l){l.errors?r=l.errors.map(({message:s})=>s):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function k0(e,t,n){const a=n.map((i,r)=>({...i,ruleIndex:r})).sort(({warningOnly:i,ruleIndex:r},{warningOnly:l,ruleIndex:s})=>!!i==!!l?r-s:i?1:-1);for(let i=0;i<a.length;i+=1){const r=a[i];"pattern"in r&&(t+="");const l=await x0(e,t,r);if(l!=="")return{name:e,errors:l}}}function S0(e,t){const n=(r,l,s,c,d)=>{Object.keys(l).forEach(u=>{let p=u;s&&(p=`${s}.${u}`);const f=l[u],{rules:h,myGridtableId:g}=t(p,s?l:void 0,()=>c,d);if(h.length){const m=a(p,f,h);r.push(m)}g&&f.forEach(m=>{n(r,m,g,f,s?l:void 0)})})},a=(r,l,s)=>k0(r,l,s);return{validateForm:async()=>{const r=(0,o.unref)(e),l=[];n(l,r,"");const s=await Promise.all(l),c={};return s.forEach(d=>{d&&(c[d.name]={msg:d.errors})}),c},validateField:a}}var E0=(0,o.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:n}){const a=e,i=n,{useData:r,existField:l,httpGet:s,httpPost:c,success:d,warning:u,error:p,info:f,t:h}=Ze();let g;r&&(g=r());const m=F=>{p&&p(F)},y=(0,o.ref)(!1),w=(0,o.computed)(()=>a.config?.gutter||16),x=(0,o.computed)(()=>a.config?.span||24),v=(0,o.computed)(()=>a.config?.labelWidth),C=(0,o.computed)(()=>a.config?.labelPosition||"right"),_=(0,o.computed)(()=>S.length===1&&(S[0].type==="j-tabs"||S[0].type==="j-layout"||S[0].config?.isAutoWindow)),b=(0,o.reactive)({}),B=(0,o.ref)({}),S=[],T={},A=(0,o.ref)({});let R={},j={},O=[],H={};const M=F=>{y.value&&$&&(F.getTableData||ci($,F.id,F.formData[F.id])),i("change",F)},E=F=>Xo(T[F]?.type||"")&&!T[F]?.config?.notInput||T[F]?.config?.isInput,L=F=>["j-table","j-input-rows","j-input-cards"].includes(T[F]?.type||"");let $;const Q=(F,te)=>{Object.keys(F).forEach(J=>{const K=F[J];te&&(J=te+"."+J),K!=null&&typeof K=="object"&&!Ko(K)&&Q(K,J),b[J]=K})},se=(F,te)=>{let J=F.id;return J||(F.config?.table&&F.config?.field?J=`${F.config.table}.${F.config.field}`:F.config?.table?J=F.config?.table:F.config?.field&&(J=F.config?.field),te&&L(te)&&(J=`${te}.${J}`)),J||qo("j")},ge=(F,te,J,K="")=>{F.forEach(Z=>{Z.id=se(Z,K);const he={id:Z.id,slot:Z.slot,type:Z.type||"",getCompType:Z.getCompType,getCompConfig:Z.getCompConfig,config:{},children:[]};te.push(he);const{children:me}=Z;so(he,Z,["children","config"]),so(he.config,Z.config||{},[]),T[Z.id]&&console.warn("有重复的组件id:"+Z.id),T[Z.id]=he,a.readonly===!0&&(he.config.readonly=!0);let Ie=!1,it;K!==""&&L(K)&&(Ie=!0,he.config=Z.config||{},he.config.parentTableId=K,it=T[K]?.config?.table);const Le=he.config||{};if(E(Z.id))!J&&Ie===!1&&(Le?.defaultValue===0?b[Z.id]=Le?.defaultValue:b[Z.id]=Le?.defaultValue||void 0),Le.table&&Le.field?R[`${Le.table}_${Le.field}`.toLowerCase()]=Z.id:Le.field&&(Ie?R[`${it}_${Le.field}`.toLowerCase()]=Z.id:R[`${Le.field}`.toLowerCase()]=Z.id);else if(Ie&&Le.field)R[`${it}_${Le.field}`.toLowerCase()]=Z.id;else if(L(Z.id))!J&&!Le.isSubTable&&(b[Z.id]=[]),Le.table&&(R[Le.table.toLowerCase()||""]=Z.id),Le.isSubTable||O.push(he);else if(Le?.defaultValue)b[Z.id]=Le?.defaultValue;else if(Z.type==="collapse"&&Le?.isExpand){const mn=[];(Le?.groups||[]).forEach(Vn=>{mn.push(Vn.i)}),b[Z.id]=mn}me&&me.length>0&&ge(me,he.children,J,he.id)})},Ee=async(F,te)=>{y.value=!1;const J=!!te;S.splice(0,S.length),R={},j={},O=[],$=te,Hn(b),Hn(T),A.value={},J&&Q(te,""),ge(F,S,J),H=xt(b),(0,o.nextTick)(()=>{y.value=!0,(0,o.nextTick)(()=>{gn(a.config?.codeInit,{})})})},We=(F,te,J)=>{const K=[];return te.forEach(Z=>{const he={};Object.keys(Z).forEach(me=>{if(!J||J(me,Z[me],F)){const Ie=xe(me);if(Ie?.type==="j-table")he[Ie?.id||""]=We(me,Z[me],J);else{let it=R[`${F}_${me}`.toLowerCase()]||me;it=it.indexOf(".")!==-1?it.split(".")[1]:it,he[it]=Z[me]}}}),K.push(he)}),K},X=(F,te)=>{Object.keys(F||{}).forEach(J=>{let K=F[J];const Z=xe(J);if(Z===void 0)K&&(Ko(K)&&(K=K[0]||{}),typeof K=="object"?Object.keys(K).forEach(he=>{if(!te||te(J,K[he],J)){let me=he;J!=="main"&&(me=`${J}_${he}`),j[me]=J,b[R[me.toLowerCase()]||he]=K[he]}}):b[J]=K);else if(L(Z.id||"")){if(!Array.isArray(K)){console.warn("表格数据不是数组:"+J);return}K?.length>0?b[R[J.toLowerCase()]||J]=We(J,K,te):b[R[J.toLowerCase()]||J]=[]}else(!te||te(J,K,J))&&(b[R[J.toLowerCase()]||J]=K)}),$&&Object.keys(b).forEach(J=>{const K=xe(J);(K===void 0||!["tabs","collapse"].includes(K.type||""))&&ci($,J,b[J])})},Te=(F,te=!1)=>{const J={};return Object.keys(F).forEach(K=>{if(K==="parentRow")return;const Z=T[K];if(Z){const he=Z.config?.table,me=Z.config?.field;if(te)me?J[me]=F[K]:J[K]=F[K];else if(L(K)){const Ie=[];F[K].forEach(it=>{Ie.push(Te(it,!0))}),J[he||K]=Ie}else he&&me?(J[he]=J[he]||{},J[he][me]=F[K]):me&&(J[me]=F[K])}else te?K!=="_X_ROW_KEY"&&K!=="_isHover"&&(J[K]=F[K]):j[K]?(J[j[K]]=J[j[K]]||{},J[j[K]][K.replace(`${j[K]}_`,"")]=F[K]):J[K]=F[K]}),J},Ne=(F=!0)=>F?Te(b):b,ye=(F,te,J,K)=>{let Z=T[F];if(Z==null){const me=F.split(".");Z=T[me[me.length-1]]||{}}if(!Z)return{};const he=bn({config:{...Z.config||{},...A.value[Z.id||""]||{}},getCompConfig:Z.getCompConfig,formData:b,getTableData:J,row:te,pRowData:K});return he._componentId=Z?.id,he},je=(F,te,J,K)=>{const Z=ye(F,te,J,K);if(Z.isNotRule!==!0&&Z.display!==!1){const he=Z.rule||[],me=he.find(Ie=>Ie.type==="only");return me&&(me.validator=async(Ie,it)=>{if(it&&!await l({table:Ie.table,key:Ie.key,keyName:Ie.keyName,field:Ie.field,keyValue:Ie.getKeyValue?Ie.getKeyValue():"",value:it,paramNames:Ie.paramNames,getParams:Ie.getParams,withProjectId:Ie.withProjectId,getValue:Ie.getValue,formData:b}))throw h(Ie.message)||h("数据值重复")}),{rules:he,myGridtableId:L(Z._componentId)?Z._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:ze}=S0(b,je),G=async()=>{B.value={};const F=await ze();return Object.keys(F).length>0?(B.value=F,m(`${h(T[Object.keys(F)[0]]?.config?.label)}:${h(F[Object.keys(F)[0]].msg)}`),!1):!0},pe=()=>{B.value={},Hn(b),Object.keys(H||{}).forEach(F=>{b[F]=H[F]})},xe=F=>{let te=T[F];return te===void 0&&R[F.toLowerCase()]&&(te=T[R[F.toLowerCase()]]),te},Me=({id:F,i:te,value:J,type:K})=>{if(K==="add")b[F].push(J);else if(K==="delete")b[F].splice(te,1);else{const Z=xe(F);Z&&(Z.config.parentTableId?b[Z.config.parentTableId][te][F]=J:b[F]=J)}},ut=({id:F,i:te})=>{const J=xe(F);if(J){if(J.config.parentTableId){const K=b[J.config.parentTableId],Z=J.id?J.id.replace(`${J.config.parentTableId}.`,""):"";if(te!=null)return(K[te]||{})[Z||""];const he=[];return K&&K.forEach(me=>{he.push(me[Z||""])}),he}if(L(J.id||"")){const K=[];return b[J.id||""].forEach(Z=>{K.push(Te(Z,!0))}),K}return b[J.id||""]}if(b[F])return b[F]},ht=async({id:F,i:te})=>{const J=ut({id:F,i:te}),K=xe(F);if(K&&g?.getLabel)if(te!==void 0){const Z=J[te],he=b[K.config.parentTableId||""][te],me=bn({config:K.config,getCompConfig:K.getCompConfig,formData:b,tableData:b[K.config.parentTableId||""],row:he});return await g?.getLabel({value:Z,config:me,formData:b,tableData:b[K.config.parentTableId||""],row:he})}else{const Z=bn({config:K.config,getCompConfig:K.getCompConfig,formData:b});return await g?.getLabel({value:J,config:Z,formData:b})}return J},Oe=async(F,te)=>g?.loadViewDataList?await g?.loadViewDataList(F,te,!1):[],vt=F=>(F.set=Me,F.get=ut,F.setFormData=X,F.getFormData=Ne,F.getLabel=ht,F.getViewData=Oe,F.getDateNow=te=>fi(new Date,te||"YYYY-MM-DD HH:mm:ss"),F.httpGet=s||(()=>{console.log("当前状态不支持")}),F.httpPost=c||(()=>{console.log("当前状态不支持")}),F.loading=te=>{zn(te)},F.showMsg=({text:te,type:J})=>{switch(J){case"success":d&&d(te);break;case"warning":u&&u(te);break;case"error":p&&p(te);break;case"info":f&&f(te);break;default:f&&f(te);break}console.log("showMsg",te,J)},F),gn=async(F,te)=>{if(F&&F.trim()){F=`async (jcode) => {${F}}`;const{res:J,fn:K}=si(F);J&&await K(vt(te))}},Et=(F,te)=>{A.value[F]={...A.value[F]||{},...te}};return a.schema&&Ee(a.schema),hi({formData:b,compsConfig:A,errorFields:B,isAutoWindow:_,gutter:w,span:x,labelWidth:v,labelPosition:C,getValue:ut,formChange:M}),gi({contextType:"form"}),t({init:Ee,reset:pe,validate:G,setValue:Me,getValue:ut,getLabel:ht,setFormData:X,getFormData:Ne,setCompConfig:Et}),(F,te)=>{const J=(0,o.resolveComponent)("j-form-item"),K=(0,o.resolveComponent)("el-row"),Z=(0,o.resolveComponent)("el-form");return y.value?((0,o.openBlock)(),(0,o.createBlock)(Z,{key:0,class:(0,o.normalizeClass)([{"j-block":e.isAutoSize},{"j-form-auto":e.isAutoSize},"j-form"]),"label-position":C.value,"label-width":v.value,size:e.config?.size,onSubmit:te[0]||(te[0]=(0,o.withModifiers)(()=>{},["prevent"]))},{default:(0,o.withCtx)(()=>[_.value?((0,o.openBlock)(),(0,o.createBlock)(J,(0,o.mergeProps)({key:0},S[0],{"is-not-col":""}),null,16)):((0,o.openBlock)(),(0,o.createBlock)(K,{key:1,gutter:w.value},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(S,he=>(0,o.createVNode)(J,(0,o.mergeProps)({key:he.id,ref_for:!0},he),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):(0,o.createCommentVNode)("",!0)}}}),B0=E0,ts=ie(B0),ns=ie(xl),R0={class:"j-page"},_0=(0,o.defineComponent)({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const n=e,a=(0,o.ref)(!1),i=(0,o.reactive)([]),r={},l=(0,o.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=[],so(w.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(l[y.id]=y.config.defaultValue),m.push(w),x&&x.length>0&&(w.children=[],s(x,w.children))})},c=g=>{a.value=!1,i.splice(0,i.length),Hn(r),Hn(l),s(g,i),(0,o.nextTick)(()=>{a.value=!0})};n.schema&&c(n.schema);const d=new pi,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 il({registerMethod:(g,m)=>(f(g,m),()=>{h(g,m)})}),gi({contextType:"page"}),t({init:c,call:p,on:f,off:h}),(g,m)=>{const y=(0,o.resolveComponent)("j-comp");return(0,o.openBlock)(),(0,o.createElementBlock)("div",R0,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(i,w=>((0,o.openBlock)(),(0,o.createBlock)(y,{key:w.id,id:w.id,type:w.type,config:w.config,children:w.children},null,8,["id","type","config","children"]))),128))])}}}),T0=_0,os=ie(T0),M0=(0,o.defineComponent)({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,i=(0,o.ref)("");return(0,o.watch)(()=>n.modelValue,r=>{r?i.value=r:(i.value=Wt(),a("update:modelValue",i.value))},{immediate:!0}),(r,l)=>{const s=(0,o.resolveComponent)("el-input");return(0,o.openBlock)(),(0,o.createBlock)(s,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=c=>i.value=c),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),A0=M0,as=ie(A0),P0={key:0,class:"j-panel-top"},V0=["title"],N0={style:{margin:"0","font-size":"14px"}},j0={key:1},O0={key:1,class:"j-panel-bottom"},I0=(0,o.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}=Fn(),n=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,i)=>{const r=(0,o.resolveComponent)("j-button"),l=(0,o.resolveComponent)("el-tooltip"),s=(0,o.resolveComponent)("j-buttons");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"j-block",style:(0,o.normalizeStyle)({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[(0,o.createElementVNode)("div",{class:"j-panel",style:(0,o.normalizeStyle)({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?((0,o.openBlock)(),(0,o.createElementBlock)("div",P0,[e.notTitle?(0,o.createCommentVNode)("",!0):((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,class:"j-panel-top-left",title:e.title||""},[(0,o.renderSlot)(a.$slots,"title",{},()=>[(0,o.createElementVNode)("span",N0,(0,o.toDisplayString)(e.title||""),1)])],8,V0)),e.toolBtns&&e.toolBtns.length>0?((0,o.openBlock)(),(0,o.createElementBlock)("span",j0,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.toolBtns,c=>((0,o.openBlock)(),(0,o.createBlock)(l,{key:c.id,placement:"top",content:c.label||""},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(r,(0,o.mergeProps)({ref_for:!0},c.config,{onClick:d=>n(c),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):(0,o.createCommentVNode)("",!0)])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",{class:"j-panel-body",style:(0,o.normalizeStyle)(e.bodyStyle)},[(0,o.renderSlot)(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?((0,o.openBlock)(),(0,o.createElementBlock)("div",O0,[(0,o.createVNode)(s,{list:e.bootmBtns},null,8,["list"]),(0,o.createVNode)(s,{list:e.bootmRightBtns},null,8,["list"])])):(0,o.createCommentVNode)("",!0)],4)],4)}}}),L0=I0,is=ie(L0),H0={class:"j-input-rows"},z0={key:0,class:"j-input-rows-num"},D0={key:1,class:"j-input-rows-char"},F0=(0,o.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 n=C=>C==null,a=e,i=t,{formData:r}=Gt(),l=(0,o.computed)(()=>a.editConfig.isAddBtn!==!1),s=(0,o.computed)(()=>a.editConfig.addBtnText||"添加"),c=(0,o.computed)(()=>a.editConfig.buttonsAlign||"left"),d=(0,o.computed)(()=>a.editConfig.isRemoveBtn!==!1),u=(0,o.computed)(()=>a.editConfig.readonly),p=(0,o.computed)(()=>a.editConfig.drag),f=(0,o.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,o.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,o.ref)([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(C=>{C._i||(C._i=Wt())})):(m.value=[],i("update:modelValue",m.value)),(0,o.watch)(()=>a.modelValue,C=>{m.value=a.modelValue||[],m.value=C||[],m.value.forEach(_=>{_._i||(_._i=Wt())})},{deep:!0});const w=()=>{const C={_i:Wt()};a.columns.forEach(_=>{const b=_.config?.valueRowKey||_.id||"";b&&(C[b]=xt(_.config?.defaultValue))}),m.value.push(C),i("change",{id:a.id,value:C,data:C,formData:r,tableData:m.value,type:"add"})},x=C=>{const _=m.value[C];m.value.splice(C,1),i("change",{id:a.id,value:_,data:_,formData:r,tableData:m.value,type:"delete"})},v=C=>{i("rowChange",C)};return(0,o.onMounted)(()=>{if(!p.value||!h.value)return;const C=h.value,{initSortable:_}=Kr(C,{handle:".j-input-rows-drag",onEnd:b=>{const{oldIndex:B,newIndex:S}=b;if(n(B)||n(S)||B===S||B<0||S<0)return;const T=m.value.splice(B,1)[0];m.value.splice(S,0,T),i("change",{id:a.id,value:T,data:T,formData:r,tableData:m.value,type:"sort"})}});_()}),fo({getTableData:()=>m.value,rowChange:v}),(C,_)=>{const b=(0,o.resolveComponent)("j-comp"),B=(0,o.resolveComponent)("j-icon"),S=(0,o.resolveComponent)("j-button");return(0,o.openBlock)(),(0,o.createElementBlock)("div",H0,[(0,o.createElementVNode)("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(m.value,(T,A)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:T._i+A,class:(0,o.normalizeClass)([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?((0,o.openBlock)(),(0,o.createElementBlock)("div",z0,(0,o.toDisplayString)(A+1),1)):(0,o.createCommentVNode)("",!0),e.showChar?((0,o.openBlock)(),(0,o.createElementBlock)("div",D0,(0,o.toDisplayString)(g[A%26]),1)):(0,o.createCommentVNode)("",!0),((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.columns,R=>((0,o.openBlock)(),(0,o.createBlock)(b,(0,o.mergeProps)({key:R.id,ref_for:!0},R,{row:T}),null,16,["row"]))),128)),p.value?((0,o.openBlock)(),(0,o.createBlock)(B,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):(0,o.createCommentVNode)("",!0),d.value&&(f.value||m.value.length>1)&&!u.value?((0,o.openBlock)(),(0,o.createBlock)(B,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:R=>x(A)},null,8,["onClick"])):(0,o.createCommentVNode)("",!0)],2))),128))],512),!u.value&&l.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,style:(0,o.normalizeStyle)({"text-align":c.value}),class:"j-input-rows-actions"},[l.value?((0,o.openBlock)(),(0,o.createBlock)(S,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:w},null,8,["label"])):(0,o.createCommentVNode)("",!0)],4)):(0,o.createCommentVNode)("",!0)])}}}),$0=F0,rs=ie($0),W0={class:"j-input-layer"},U0=(0,o.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 n=g=>!!(g==null||typeof g=="string"&&g.trim()===""||Array.isArray(g)&&g.length===0),a=e,i=t,r=(0,o.ref)(),l=(0,o.ref)(),s=(0,o.ref)(""),c=(0,o.computed)({get(){return a.modelValue},set(g){i("update:modelValue",g)}}),d=(0,o.computed)({get(){return n(c.value)?"":n(s.value)?a.getText?a.getText(c.value):c.value:s.value},set(g){g||p()}});(0,o.watch)(()=>a.modelValue,()=>{s.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},p=()=>{s.value="",c.value="",i("change",{value:"",data:void 0})},f=async()=>{if(!l.value)return;const g=l.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(","),i("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,i("change",{value:x,data:m})}else s.value="",c.value="",i("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},h=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(g,m)=>{const y=(0,o.resolveComponent)("el-input");return(0,o.openBlock)(),(0,o.createElementBlock)("div",W0,[e.onlyButton?((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(Go),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):((0,o.openBlock)(),(0,o.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,o.createSlots)({_:2},[e.readonly?void 0:{name:"append",fn:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(Go),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),(0,o.createVNode)((0,o.unref)(yi),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:f,onClosed:h},{default:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(vi),{ref_key:"tableRef",ref:l,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"])])}}}),J0=U0,ls=ie(J0),Y0=(0,o.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,n=Gt(),{t:a}=Ze(),i=(0,o.computed)(()=>t.formConfig?.gutter||16),r=(0,o.computed)(()=>t.formConfig?.span||24),l=(0,o.computed)(()=>t.formConfig?.labelWidth||n.labelWidth?.value),s=(0,o.computed)(()=>t.formConfig?.labelPosition||n.labelPosition?.value||"right"),c=(0,o.computed)(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=(0,o.ref)(!1),u=()=>{d.value=!0};return hi({...n,isAutoWindow:c,gutter:i,span:r,labelWidth:l}),(p,f)=>{const h=(0,o.resolveComponent)("j-button"),g=(0,o.resolveComponent)("j-form-item"),m=(0,o.resolveComponent)("el-row"),y=(0,o.resolveComponent)("el-form"),w=(0,o.resolveComponent)("j-dialog");return(0,o.openBlock)(),(0,o.createElementBlock)("div",null,[(0,o.createVNode)(h,(0,o.mergeProps)(p.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),(0,o.createVNode)(w,{visible:d.value,"onUpdate:visible":f[1]||(f[1]=x=>d.value=x),title:(0,o.unref)(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(y,{class:(0,o.normalizeClass)(["j-block","j-layer-form"]),"label-position":s.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:f[0]||(f[0]=(0,o.withModifiers)(()=>{},["prevent"]))},{default:(0,o.withCtx)(()=>[c.value?((0,o.openBlock)(),(0,o.createBlock)(g,(0,o.normalizeProps)((0,o.mergeProps)({key:0},e.schema[0])),null,16)):((0,o.openBlock)(),(0,o.createBlock)(m,{key:1,gutter:i.value},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.schema,x=>((0,o.openBlock)(),(0,o.createBlock)(g,(0,o.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"])])}}}),K0=Y0,ss=ie(K0),G0=(0,o.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 n=e,a=t,i=(0,o.computed)({get(){return n.modelValue},set(l){a("update:modelValue",l)}}),r=l=>{a("change",l)};return(0,o.onMounted)(()=>{n.autoFocus&&!n.readonly&&setTimeout(()=>{const l=i.value===n.activeValue?n.inactiveValue:n.activeValue;i.value=l,r(l)},100)}),(l,s)=>{const c=(0,o.resolveComponent)("el-switch");return(0,o.openBlock)(),(0,o.createBlock)(c,(0,o.mergeProps)(l.$attrs,{id:e.id,modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=d=>i.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,o.createSlots)({_:2},[l.$slots["active-action"]?{name:"active-action",fn:(0,o.withCtx)(()=>[(0,o.renderSlot)(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:(0,o.withCtx)(()=>[(0,o.renderSlot)(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:(0,o.withCtx)(()=>[(0,o.renderSlot)(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:(0,o.withCtx)(()=>[(0,o.renderSlot)(l.$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"])}}}),q0=G0,cs=ie(q0),X0=(0,o.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 n=t,a=d=>{n("update:modelValue",d)},i=(d,u)=>{n("tab-click",d,u)},r=d=>{n("tab-change",d)},l=d=>{n("tab-remove",d)},s=()=>{n("tab-add")},c=(d,u)=>{n("edit",d,u)};return(d,u)=>{const p=(0,o.resolveComponent)("el-tabs");return(0,o.openBlock)(),(0,o.createBlock)(p,(0,o.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:i,onTabChange:r,onTabRemove:l,onTabAdd:s,onEdit:c}),{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(d.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}}),Z0=X0,ds=ie(Z0),Q0=(0,o.defineComponent)({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const n=t,a=r=>{n("update:modelValue",r)},i=r=>{n("change",r)};return(r,l)=>{const s=(0,o.resolveComponent)("el-collapse");return(0,o.openBlock)(),(0,o.createBlock)(s,(0,o.mergeProps)(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:i,"onUpdate:modelValue":a}),{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}}),em=Q0,us=ie(em),tm={class:"j-editor"},nm=(0,o.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 n=e,a=t,i=(0,o.ref)(),r=(0,o.ref)(),l=(0,o.shallowRef)(),s=(0,o.computed)(()=>({height:typeof n.height=="number"?`${n.height}px`:n.height,overflowY:"hidden"}));let c=!1;const d=p=>{if(!p)return"";let f=p;return n.apiUrl&&n.token&&(f=f.replace(/{learun_img_api}/g,`${n.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${n.token}`)),f},u=p=>{if(!p)return"";let f=p;if(n.apiUrl){const h=`${n.apiUrl}/system/annexesfile/`;f=f.split(h).join("{learun_img_api}"),n.token&&(f=f.split(`token=${n.token}`).join("{learun_img_token}"))}return f};return(0,o.onMounted)(()=>{const p={placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,MENU_CONF:{},...n.options};p.onChange=h=>{if(c)return;const g=u(h.getHtml());a("update:value",g),a("change",{value:g})};const f=(0,Rr.createEditor)({selector:i.value,html:d(n.value),config:p,mode:"default"});l.value=f,(0,Rr.createToolbar)({editor:f,selector:r.value,mode:"default"})}),(0,o.watch)(()=>n.value,p=>{const f=l.value;if(f){const h=f.getHtml(),g=d(p);u(h)!==p&&(c=!0,f.setHtml(g),c=!1)}}),(0,o.watch)(()=>n.readonly,p=>{const f=l.value;f&&(p?f.disable():f.enable())}),(0,o.onBeforeUnmount)(()=>{const p=l.value;p?.destroy()}),(p,f)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",tm,[(0,o.createElementVNode)("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),(0,o.createElementVNode)("div",{ref_key:"editorRef",ref:i,class:"j-editor-content",style:(0,o.normalizeStyle)(s.value)},null,4)]))}}),om=Nl(nm,[["__scopeId","data-v-179ac616"]]),fs=ie(om),am={key:0,class:"j-map-loading"},im=(0,o.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:n}){const a=e,i=n,r=(0,o.ref)(!0),l=(0,o.ref)();let s=null,c=null,d=null,u=null;const p=async()=>{r.value=!0;try{s=await Gr(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(!l.value)return;c=new s.Map(l.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),i("update:address",w.address),i("update:lng",y.lng),i("update:lat",y.lat),i("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 _=0;_<C;_++)v.push(x.getPoi(_))}w(v)}})),g.search(y))}}),(0,o.onMounted)(()=>{p()}),(y,w)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"j-map",style:(0,o.normalizeStyle)({height:e.height})},[r.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",am,[(0,o.createVNode)(vn,{icon:"mdi:loading",class:"is-loading",size:30})])):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}),rm=im,lm=ie(rm);function ps(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Wn(e){return e.originalEvent||e.srcEvent}function bi(e){ps(e),ps(Wn(e))}function Un(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 hs=1500;function gs(e,t,n){var a=this,i=n.get("dragging",!1);function r(l){if(!l.hover){var s=l.originalEvent,c=a._findTargetGfx(s),d=c&&e.get(c);c&&d&&(l.stopPropagation(),i.hover({element:d,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(l){t.once("drag.move",hs,function(s){r(s)})}),(function(){var l,s;t.on("element.hover",function(c){l=c.gfx,s=c.element}),t.on("element.hover",hs,function(c){s&&t.fire("element.out",{element:s,gfx:l})}),t.on("element.out",function(){l=null,s=null})})(),this._findTargetGfx=function(l){var s,c;if(l instanceof MouseEvent)return s=Un(l),c=document.elementFromPoint(s.x,s.y),sm(c)}}gs.$inject=["elementRegistry","eventBus","injector"];function sm(e){return(0,W.closest)(e,"svg, .djs-element",!0)}var cm={__init__:["hoverFix"],hoverFix:["type",gs]};function ms(){return/mac/i.test(navigator.platform)}function ys(e,t){return(Wn(e)||e).button===t}function qt(e){return ys(e,0)}function dm(e){return ys(e,1)}function vs(e){var t=Wn(e)||e;return qt(e)?ms()?t.metaKey:t.ctrlKey:!1}function wi(e){var t=Wn(e)||e;return qt(e)&&t.shiftKey}function ho(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function um(e){return["M",e.x,e.y]}function Ci(e){return["L",e.x,e.y]}function fm(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function pm(e,t){const n=e.length,a=[um(e[0])];for(let i=1;i<n;i++){const r=e[i-1],l=e[i],s=e[i+1];if(!s||!t){a.push(Ci(l));continue}const c=Math.min(t,xi(l.x-r.x,l.y-r.y),xi(s.x-l.x,s.y-l.y));if(!c){a.push(Ci(l));continue}const d=oa(l,r,c),u=oa(l,r,c*.5),p=oa(l,s,c),f=oa(l,s,c*.5);a.push(Ci(d)),a.push(fm(u,f,p))}return a}function oa(e,t,n){const a=t.x-e.x,i=t.y-e.y,r=n/xi(a,i);return{x:e.x+a*r,y:e.y+i*r}}function xi(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ki(e,t,n){(0,k.isNumber)(t)&&(n=t,t=null),t||(t={});const a=(0,P.create)("path",t);return(0,k.isNumber)(n)&&(a.dataset.cornerRadius=String(n)),bs(a,e)}function bs(e,t){return(0,P.attr)(e,{d:ho(pm(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function hm(e){return!0}function aa(e){return qt(e)||dm(e)}var ws=500;function Cs(e,t,n){var a=this;function i(S,T,A){if(!s(S,T)){var R,j,O;A?j=t.getGraphics(A):(R=T.delegateTarget||T.target,R&&(j=R,A=t.get(j))),!(!j||!A)&&(O=e.fire(S,{element:A,gfx:j,originalEvent:T}),O===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function l(S){return r[S]}function s(S,T){return!(d[S]||qt)(T)}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":hm,"element.mousedown":aa,"element.mouseup":aa,"element.click":aa,"element.dblclick":aa};function u(S,T,A){var R=c[S];if(!R)throw new Error("unmapped DOM event name <"+S+">");return i(R,T,A)}var p="svg, .djs-element";function f(S,T,A,R){var j=r[A]=function(O){i(A,O)};R&&(d[A]=R),j.$delegate=W.delegate.bind(S,p,T,j)}function h(S,T,A){var R=l(A);R&&W.delegate.unbind(S,T,R.$delegate)}function g(S){(0,k.forEach)(c,function(T,A){f(S,A,T)})}function m(S){(0,k.forEach)(c,function(T,A){h(S,A,T)})}e.on("canvas.destroy",function(S){m(S.svg)}),e.on("canvas.init",function(S){g(S.svg)}),e.on(["shape.added","connection.added"],function(S){var T=S.element,A=S.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:A})}),e.on(["shape.changed","connection.changed"],ws,function(S){var T=S.element,A=S.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:A})}),e.on("interactionEvents.createHit",ws,function(S){var T=S.element,A=S.gfx;a.createDefaultHit(T,A)}),e.on("interactionEvents.updateHit",function(S){var T=S.element,A=S.gfx;a.updateDefaultHit(T,A)});var y=_("djs-hit djs-hit-stroke"),w=_("djs-hit djs-hit-click-stroke"),x=_("djs-hit djs-hit-all"),v=_("djs-hit djs-hit-no-move"),C={all:x,"click-stroke":w,stroke:y,"no-move":v};function _(S,T){return T=(0,k.assign)({stroke:"white",strokeWidth:15},T||{}),n.cls(S,["no-fill","no-border"],T)}function b(S,T){var A=C[T];if(!A)throw new Error("invalid hit type <"+T+">");return(0,P.attr)(S,A),S}function B(S,T){(0,P.append)(S,T)}this.removeHits=function(S){(0,k.forEach)((0,W.queryAll)(".djs-hit",S),P.remove)},this.createDefaultHit=function(S,T){var A=S.waypoints,R=S.isFrame,j;return A?this.createWaypointsHit(T,A):(j=R?"stroke":"all",this.createBoxHit(T,j,{width:S.width,height:S.height}))},this.createWaypointsHit=function(S,T){var A=ki(T);return b(A,"stroke"),B(S,A),A},this.createBoxHit=function(S,T,A){A=(0,k.assign)({x:0,y:0},A);var R=(0,P.create)("rect");return b(R,T),(0,P.attr)(R,A),B(S,R),R},this.updateDefaultHit=function(S,T){var A=(0,W.query)(".djs-hit",T);if(A)return S.waypoints?bs(A,S.waypoints):(0,P.attr)(A,{width:S.width,height:S.height}),A},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=l,this.registerEvent=f,this.unregisterEvent=h}Cs.$inject=["eventBus","elementRegistry","styles"];var Si={__init__:["interactionEvents"],interactionEvents:["type",Cs]};function Jn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(a){var i=a.element;n.deselect(i)}),e.on(["diagram.clear","root.set"],function(a){n.select(null)})}Jn.$inject=["eventBus","canvas"],Jn.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(n!==-1){var a=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},Jn.prototype.get=function(){return this._selectedElements},Jn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},Jn.prototype.select=function(e,t){var n=this._selectedElements,a=n.slice();(0,k.isArray)(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(l){return r===i.findRoot(l)}),t?(0,k.forEach)(e,function(l){n.indexOf(l)===-1&&n.push(l)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:n})};var xs="hover",ks="selected";function Ss(e,t){this._canvas=e;function n(i,r){e.addMarker(i,r)}function a(i,r){e.removeMarker(i,r)}t.on("element.hover",function(i){n(i.element,xs)}),t.on("element.out",function(i){a(i.element,xs)}),t.on("selection.changed",function(i){function r(d){a(d,ks)}function l(d){n(d,ks)}var s=i.oldSelection,c=i.newSelection;(0,k.forEach)(s,function(d){c.indexOf(d)===-1&&r(d)}),(0,k.forEach)(c,function(d){s.indexOf(d)===-1&&l(d)})})}Ss.$inject=["canvas","eventBus"];function Es(e,t,n,a){e.on("create.end",500,function(i){var r=i.context,l=r.canExecute,s=r.elements,c=(r.hints||{}).autoSelect;if(l){if(c===!1)return;(0,k.isArray)(c)?t.select(c):t.select(s.filter(gm))}}),e.on("connect.end",500,function(i){var r=i.context.connection;r&&t.select(r)}),e.on("shape.move.end",500,function(i){var r=i.previousSelection||[],l=a.get(i.context.shape.id);(0,k.find)(r,function(s){return l.id===s.id})||t.select(l)}),e.on("element.click",function(i){if(qt(i)){var r=i.element;r===n.getRootElement()&&(r=null);var l=t.isSelected(r),s=t.get().length>1,c=wi(i);if(l&&s)return c?t.deselect(r):t.select(r);l?t.deselect(r):t.select(r,c)}})}Es.$inject=["eventBus","selection","canvas","elementRegistry"];function gm(e){return!e.hidden}var Yn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Si],selection:["type",Jn],selectionVisuals:["type",Ss],selectionBehavior:["type",Es]},mm=/^djs-cursor-.*$/;function Ei(e){var t=(0,W.classes)(document.body);t.removeMatching(mm),e&&t.add("djs-cursor-"+e)}function Bs(){Ei(null)}var ym=5e3;function Rs(e,t){t=t||"element.click";function n(){return!1}return e.once(t,ym,n),function(){e.off(t,n)}}function _s(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Kn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ts(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ms(e,t){return e=(0,k.isArray)(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var Gn=Math.round,As="djs-drag-active";function wn(e){e.preventDefault()}function vm(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function bm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ps(e,t,n,a){var i={threshold:5,trapClick:!0},r;function l(v){var C=t.viewbox(),_=t._container.getBoundingClientRect();return{x:C.x+(v.x-_.left)/C.scale,y:C.y+(v.y-_.top)/C.scale}}function s(v,C){C=C||r;var _=e.createEvent((0,k.assign)({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+v,_)===!1?!1:e.fire(C.prefix+"."+v,_)}function c(v){var C=v.filter(function(_){return a.get(_.id)});C.length&&n.select(C)}function d(v,C){var _=r.payload,b=r.displacement,B=r.globalStart,S=Un(v),T=Kn(S,B),A=r.localStart,R=l(S),j=Kn(R,A);if(!r.active&&(C||bm(T)>r.threshold)){if((0,k.assign)(_,{x:Gn(A.x+b.x),y:Gn(A.y+b.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(_.previousSelection=n.get(),n.select(null)),r.cursor&&Ei(r.cursor),t.addMarker(t.getRootElement(),As)}bi(v),r.active&&((0,k.assign)(_,{x:Gn(R.x+b.x),y:Gn(R.y+b.y),dx:Gn(j.x),dy:Gn(j.y)},{originalEvent:v}),s("move"))}function u(v){var C,_=!0;r.active&&(v&&(r.payload.originalEvent=v,bi(v)),_=s("end")),_===!1&&s("rejected"),C=w(_!==!0),s("ended",C)}function p(v){Ms("Escape",v)&&(wn(v),y())}function f(v){var C;r.active&&(C=Rs(e),setTimeout(C,400),wn(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.active;_&&s("cancel"),C=w(v),_&&s("canceled",C)}}function w(v){var C,_;s("cleanup"),Bs(),r.trapClick?_=f:_=u,W.event.unbind(document,"mousemove",d),W.event.unbind(document,"dragstart",wn),W.event.unbind(document,"selectstart",wn),W.event.unbind(document,"mousedown",_,!0),W.event.unbind(document,"mouseup",_,!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(),As);var b=r.payload.previousSelection;return v!==!1&&b&&!n.get().length&&c(b),C=r,r=null,C}function x(v,C,_,b){r&&y(!1),typeof C=="string"&&(b=_,_=C,C=null),b=(0,k.assign)({},i,b||{});var B=b.data||{},S,T,A,R,j;b.trapClick?R=f:R=u,v?(S=Wn(v)||v,T=Un(v),bi(v),S.type==="dragstart"&&wn(S)):(S=null,T={x:0,y:0}),A=l(T),C||(C=A),j=vm(S),r=(0,k.assign)({prefix:_,data:B,payload:{},globalStart:T,displacement:Kn(C,A),localStart:A,isTouch:j},b),b.manual||(j?(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",wn),W.event.bind(document,"selectstart",wn),W.event.bind(document,"mousedown",R,!0),W.event.bind(document,"mouseup",R,!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,k.assign)(i,v)}}Ps.$inject=["eventBus","canvas","selection","elementRegistry"];var Cn={__depends__:[cm,Yn],dragging:["type",Ps]};function Bi(e){return e.childNodes[0]}function ia(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ia.prototype.next=function(){return this._prefix+ ++this._counter};var wm=new ia("ps"),Cm=["marker-start","marker-mid","marker-end"],xm=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Xt(e,t,n,a){this._elementRegistry=e,this._canvas=n,this._styles=a}Xt.$inject=["elementRegistry","eventBus","canvas","styles"],Xt.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")},Xt.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Xt.prototype.addDragger=function(e,t,n,a="djs-dragger"){n=n||this.getGfx(e);var i=(0,P.clone)(n),r=n.getBoundingClientRect();return this._cloneMarkers(Bi(i),a),(0,P.attr)(i,this._styles.cls(a,[],{x:r.top,y:r.left})),(0,P.append)(t,i),(0,P.attr)(i,"data-preview-support-element-id",e.id),i},Xt.prototype.addFrame=function(e,t){var n=(0,P.create)("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return(0,P.append)(t,n),(0,P.attr)(n,"data-preview-support-element-id",e.id),n},Xt.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var a=this;e.childNodes&&e.childNodes.forEach(i=>{a._cloneMarkers(i,t,n)}),Bm(e)&&Cm.forEach(function(i){if((0,P.attr)(e,i)){var r=km(e,i,a._canvas.getContainer());r&&a._cloneMarker(n,e,r,i,t)}})},Xt.prototype._cloneMarker=function(e,t,n,a,i="djs-dragger"){var r=[n.id,i,wm.next()].join("-"),l=(0,W.query)("marker#"+n.id,e);e=e||this._canvas._svg;var s=l||(0,P.clone)(n);s.id=r,(0,P.classes)(s).add(i);var c=(0,W.query)(":scope > defs",e);c||(c=(0,P.create)("defs"),(0,P.append)(e,c)),(0,P.append)(c,s),(0,P.attr)(t,a,Em(s.id))};function km(e,t,n){return(0,W.query)("marker#"+Sm((0,P.attr)(e,t)),n||document)}function Sm(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Em(e){return"url(#"+e+")"}function Bm(e){return xm.indexOf(e.nodeName)!==-1}var Ri={__init__:["previewSupport"],previewSupport:["type",Xt]};function _i(e){this._commandStack=e.get("commandStack",!1)}_i.$inject=["injector"],_i.prototype.allowed=function(e,t){var n=!0,a=this._commandStack;return a&&(n=a.canExecute(e,t)),n===void 0?!0:n};var qn={__init__:["rules"],rules:["type",_i]};function Rm(e){return(0,k.filter)(e,function(t){return!(0,k.find)(e,function(n){return n!==t&&Vs(t,n)})})}function Vs(e,t){if(t){if(e===t)return t;if(e.parent)return Vs(e.parent,t)}}function Ns(e,t,n){var a=!n||e.indexOf(t)===-1;return a&&e.push(t),a}function Ti(e,t,n){n=n||0,(0,k.isArray)(e)||(e=[e]),(0,k.forEach)(e,function(a,i){var r=t(a,i,n);(0,k.isArray)(r)&&r.length&&Ti(r,t,n+1)})}function _m(e,t,n){var a=[],i=[];return Ti(e,function(r,l,s){Ns(a,r,t);var c=r.children;if((n===-1||s<n)&&c&&Ns(i,c,t))return c}),a}function Tm(e,t){return _m(e,!t,-1)}function Mm(e,t,n){(0,k.isUndefined)(t)&&(t=!0),(0,k.isObject)(t)&&(n=t,t=!0),n=n||{};var a=go(n.allShapes),i=go(n.allConnections),r=go(n.enclosedElements),l=go(n.enclosedConnections),s=go(n.topLevel,t&&(0,k.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]&&(l[u.id]=r[u.id]=u),i[u.id]=u}function d(u){if(r[u.id]=u,u.waypoints)l[u.id]=i[u.id]=u;else return a[u.id]=u,(0,k.forEach)(u.incoming,c),(0,k.forEach)(u.outgoing,c),u.children}return Ti(e,d),{allShapes:a,allConnections:i,topLevel:s,enclosedConnections:l,enclosedElements:r}}function Nt(e,t){t=!!t,(0,k.isArray)(e)||(e=[e]);var n,a,i,r;return(0,k.forEach)(e,function(l){var s=l;l.waypoints&&!t&&(s=Nt(l.waypoints,!0));var c=s.x,d=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(d<a||a===void 0)&&(a=d),(c+p>i||i===void 0)&&(i=c+p),(d+u>r||r===void 0)&&(r=d+u)}),{x:n,y:a,height:r-a,width:i-n}}function Am(e,t){var n={};return(0,k.forEach)(e,function(a){var i=a;i.waypoints&&(i=Nt(i)),!(0,k.isNumber)(t.y)&&i.x>t.x&&(n[a.id]=a),!(0,k.isNumber)(t.x)&&i.y>t.y&&(n[a.id]=a),i.x>t.x&&i.y>t.y&&((0,k.isNumber)(t.width)&&(0,k.isNumber)(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y||!(0,k.isNumber)(t.width)||!(0,k.isNumber)(t.height))&&(n[a.id]=a)}),n}function Pm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Vm(e){return!!(e&&e.isFrame)}function go(e,t){return(0,k.assign)({},e||{},t||{})}function yt(e){return(0,k.isObject)(e)&&(0,k.has)(e,"waypoints")}function Xn(e){return(0,k.isObject)(e)&&(0,k.has)(e,"labelTarget")}var Nm="drop-ok",js="drop-not-ok",Os="attach-ok",Is="new-parent",Ls="create",jm=2e3;function Hs(e,t,n,a,i){function r(c,d,u,p,f){if(!d)return!1;c=(0,k.filter)(c,function(x){var v=x.labelTarget;return!x.parent&&!(Xn(x)&&c.indexOf(v)!==-1)});var h=(0,k.find)(c,function(x){return!yt(x)}),g=!1,m=!1,y=!1;Ds(c)&&(g=i.allowed("shape.attach",{position:u,shape:h,target:d})),g||(Ds(c)?y=i.allowed("shape.create",{position:u,shape:h,source:p,target:d}):y=i.allowed("elements.create",{elements:c,position:u,target:d}));var w=f.connectionTarget;return y||g?(h&&p&&(m=i.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 l(c,d){[Os,Nm,js,Is].forEach(function(u){u===d?e.addMarker(c,u):e.removeMarker(c,u)})}n.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}zs(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?l(p,Os):l(p,m?Is:js))}),n.on(["create.end","create.out","create.cleanup"],function(c){var d=c.hover;d&&l(d,null)}),n.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;zs(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,k.assign)({},w,{attach:m})),p=(0,k.find)(f,function(v){return!yt(v)})),(0,k.assign)(d,{elements:f,shape:p}),(0,k.assign)(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Ls&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],jm,function(){n.off("elements.changed",s)})}),this.start=function(c,d,u){(0,k.isArray)(d)||(d=[d]);var p=(0,k.find)(d,function(h){return!yt(h)});if(p){u=(0,k.assign)({elements:d,hints:{},shape:p},u||{}),(0,k.forEach)(d,function(h){(0,k.isNumber)(h.x)||(h.x=0),(0,k.isNumber)(h.y)||(h.y=0)});var f=Nt((0,k.filter)(d,function(h){return!h.hidden}));(0,k.forEach)(d,function(h){yt(h)&&(h.waypoints=(0,k.map)(h.waypoints,function(g){return{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2}})),(0,k.assign)(h,{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2})}),t.init(c,Ls,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:d,context:u}})}}}Hs.$inject=["canvas","dragging","eventBus","modeling","rules"];function zs(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 Ds(e){return e&&e.length===1&&!yt(e[0])}function Om(e,t,n,a,i){var r=(0,P.createTransform)();r.setTranslate(t,n);var l=(0,P.createTransform)();l.setRotate(a||0,0,0);var s=(0,P.createTransform)();s.setScale(i||1,i||1),(0,P.transform)(e,[r,l,s])}function jt(e,t,n){var a=(0,P.createTransform)();a.setTranslate(t,n),(0,P.transform)(e,a)}function Im(e,t){var n=(0,P.createTransform)();n.setRotate(t,0,0),(0,P.transform)(e,n)}var Lm=750;function Fs(e,t,n,a,i){function r(l){var s=(0,P.create)("g");(0,P.attr)(s,i.cls("djs-drag-group",["no-events"]));var c=(0,P.create)("g");return l.forEach(function(d){var u;d.hidden||(d.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Bi(u),d)):(u=n._createContainer("shape",c),n.drawShape(Bi(u),d),jt(u,d.x,d.y)),a.addDragger(d,s,u))}),s}t.on("create.move",Lm,function(l){var s=l.hover,c=l.context,d=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(d));var p;s?(u.parentNode||(p=e.getActiveLayer(),(0,P.append)(p,u)),jt(u,l.x,l.y)):(0,P.remove)(u)}),t.on("create.cleanup",function(l){var s=l.context.dragGroup;s&&(0,P.remove)(s)})}Fs.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var $s={__depends__:[Cn,Ri,qn,Yn],__init__:["create","createPreview"],create:["type",Hs],createPreview:["type",Fs]};function mo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Mi(e,t,n,a){if(typeof a>"u"&&(a=5),!e||!t||!n)return!1;var i=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=mo(e,t);return Math.abs(i/r)<=a}var Hm=2;function Zt(e,t){var n=Array.from(arguments).flat();for(const[a,i]of Object.entries({x:"v",y:"h"}))if(zm(a,n))return i;return!1}function zm(e,t){const n=t[0];return(0,k.every)(t,function(a){return Math.abs(n[e]-a[e])<=Hm})}function Ws(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Ai(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Dm=/,?([a-z]),?/gi,Us=parseFloat,Qe=Math,Qt=Qe.PI,Ot=Qe.min,It=Qe.max,Js=Qe.pow,en=Qe.abs,Fm=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,$m=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Ys=Array.isArray||function(e){return e instanceof Array};function Wm(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Um(e,t){for(var n=0,a=e.length;n<a;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function Jm(e){function t(){var n=Array.prototype.slice.call(arguments,0).join("␀"),a=t.cache=t.cache||{},i=t.count=t.count||[];return Wm(a,n)?(Um(i,n),a[n]):(i.length>=1e3&&delete a[i.shift()],i.push(n),a[n]=e(...arguments),a[n])}return t}function Ym(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},n=[];return String(e).replace(Fm,function(a,i,r){var l=[],s=i.toLowerCase();for(r.replace($m,function(c,d){d&&l.push(+d)}),s=="m"&&l.length>2&&(n.push([i,...l.splice(0,2)]),s="l",i=i=="m"?"l":"L");l.length>=t[s]&&(n.push([i,...l.splice(0,t[s])]),!!t[s]););}),n.toString=Vi,n}function Km(e){for(var t=0,n=e.length;t<n;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function Gm(e){for(var t=0,n=e.length;t<n;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Pi(e,t,n,a){return arguments.length===1&&(t=e.y,n=e.width,a=e.height,e=e.x),{x:e,y:t,width:n,height:a,x2:e+n,y2:t+a}}function Vi(){return this.join(",").replace(Dm,"$1")}function qm(e){for(var t=new Array(e.length),n=0,a=e.length;n<a;n++)for(var i=e[n],r=t[n]=new Array(i.length),l=0,s=i.length;l<s;l++)r[l]=i[l];return t.toString=Vi,t}function Ks(e,t,n,a,i,r,l,s,c){var d=1-c,u=Js(d,3),p=Js(d,2),f=c*c*c,h=u*e+p*3*c*n+d*3*c*c*i+f*l,g=u*t+p*3*c*a+d*3*c*c*r+f*s;return{x:ra(h),y:ra(g)}}function Gs(e){var t=ny(...e);return Pi(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tn(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Xm(e,t){return e=Pi(e),t=Pi(t),tn(t,e.x,e.y)||tn(t,e.x2,e.y)||tn(t,e.x,e.y2)||tn(t,e.x2,e.y2)||tn(e,t.x,t.y)||tn(e,t.x2,t.y)||tn(e,t.x,t.y2)||tn(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 qs(e,t,n,a,i){return e*(e*(-3*t+9*n-9*a+3*i)+6*t-12*n+6*a)-3*t+3*n}function Xs(e,t,n,a,i,r,l,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=qs(m,e,n,i,l),w=qs(m,t,a,r,s),x=y*y+w*w;h+=f[g]*Qe.sqrt(x)}return d*h}function Zm(e,t,n,a,i,r,l,s){if(!(It(e,n)<Ot(i,l)||Ot(e,n)>It(i,l)||It(t,a)<Ot(r,s)||Ot(t,a)>It(r,s))){var c=(e*a-t*n)*(i-l)-(e-n)*(i*s-r*l),d=(e*a-t*n)*(r-s)-(t-a)*(i*s-r*l),u=(e-n)*(r-s)-(t-a)*(i-l);if(u){var p=ra(c/u),f=ra(d/u),h=+p.toFixed(2),g=+f.toFixed(2);if(!(h<+Ot(e,n).toFixed(2)||h>+It(e,n).toFixed(2)||h<+Ot(i,l).toFixed(2)||h>+It(i,l).toFixed(2)||g<+Ot(t,a).toFixed(2)||g>+It(t,a).toFixed(2)||g<+Ot(r,s).toFixed(2)||g>+It(r,s).toFixed(2)))return{x:p,y:f}}}}function ra(e){return Math.round(e*1e11)/1e11}function Qm(e,t,n){if(!Xm(Gs(e),Gs(t)))return n?0:[];var a=Xs(...e),i=Xs(...t),r=Qs(e)?1:~~(a/5)||1,l=Qs(t)?1:~~(i/5)||1,s=new Array(r+1),c=new Array(l+1),d={},u=n?0:[],p,f;for(p=0;p<r+1;p++){var h=Ks(...e,p/r);s[p]={x:h.x,y:h.y,t:p/r}}for(p=0;p<l+1;p++)h=Ks(...t,p/l),c[p]={x:h.x,y:h.y,t:p/l};for(p=0;p<r;p++)for(f=0;f<l;f++){var g=s[p],m=s[p+1],y=c[f],w=c[f+1],x=en(m.x-g.x)<.01?"y":"x",v=en(w.x-y.x)<.01?"y":"x",C=Zm(g.x,g.y,m.x,m.y,y.x,y.y,w.x,w.y),_;if(C){if(_=C.x.toFixed(9)+"#"+C.y.toFixed(9),d[_])continue;d[_]=!0;var b=g.t+en((C[x]-g[x])/(m[x]-g[x]))*(m.t-g.t),B=y.t+en((C[v]-y[v])/(w[v]-y[v]))*(w.t-y.t);b>=0&&b<=1&&B>=0&&B<=1&&(n?u++:u.push({x:C.x,y:C.y,t1:b,t2:B}))}}return u}function Zs(e,t,n){e=nc(e),t=nc(t);for(var a,i,r,l,s,c,d,u,p,f,h=n?0:[],g=0,m=e.length;g<m;g++){var y=e[g];if(y[0]=="M")a=s=y[1],i=c=y[2];else{y[0]=="C"?(p=[a,i,...y.slice(1)],a=p[6],i=p[7]):(p=[a,i,a,i,s,c,s,c],a=s,i=c);for(var w=0,x=t.length;w<x;w++){var v=t[w];if(v[0]=="M")r=d=v[1],l=u=v[2];else{v[0]=="C"?(f=[r,l,...v.slice(1)],r=f[6],l=f[7]):(f=[r,l,r,l,d,u,d,u],r=d,l=u);var C=Qm(p,f,n);if(n)h+=C;else{for(var _=0,b=C.length;_<b;_++)C[_].segment1=g,C[_].segment2=w,C[_].bez1=p,C[_].bez2=f;h=h.concat(C)}}}}}return h}function ey(e){return Ys(e)&&Ys(e[0])}function ty(e){if(Km(e))return e;var t=new Array(e.length),n=0,a=0,i=0,r=0,l=0,s;e[0][0]=="M"&&(n=+e[0][1],a=+e[0][2],i=n,r=a,l++,t[0]=["M",n,a]);for(var c,d,u=l,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]+n,c[7]=+d[7]+a;break;case"V":c[1]=+d[1]+a;break;case"H":c[1]=+d[1]+n;break;case"M":i=+d[1]+n,r=+d[2]+a;default:for(var f=1,h=d.length;f<h;f++)c[f]=+d[f]+(f%2?n:a)}else for(var g=0,m=d.length;g<m;g++)c[g]=d[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+i,a=+r;break;case"H":n=c[1];break;case"V":a=c[1];break;case"M":i=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],a=c[c.length-1]}}return t.toString=Vi,t}function Qs(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function la(e,t,n,a){return[e,t,n,a,n,a]}function ec(e,t,n,a,i,r){var l=.3333333333333333,s=2/3;return[l*e+s*n,l*t+s*a,l*i+s*n,l*r+s*a,i,r]}function tc(e,t,n,a,i,r,l,s,c,d){var u=Qt*120/180,p=Qt/180*(+i||0),f=[],h,g=Jm(function(ye,je,ze){return{x:ye*Qe.cos(ze)-je*Qe.sin(ze),y:ye*Qe.sin(ze)+je*Qe.cos(ze)}});if(d)B=d[0],S=d[1],_=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/(n*n)+y*y/(a*a);w>1&&(w=Qe.sqrt(w),n=w*n,a=w*a);var x=n*n,v=a*a,C=(r==l?-1:1)*Qe.sqrt(en((x*v-x*y*y-v*m*m)/(x*y*y+v*m*m))),_=C*n*y/a+(e+s)/2,b=C*-a*m/n+(t+c)/2,B=Qe.asin(((t-b)/a).toFixed(9)),S=Qe.asin(((c-b)/a).toFixed(9));B=e<_?Qt-B:B,S=s<_?Qt-S:S,B<0&&(B=Qt*2+B),S<0&&(S=Qt*2+S),l&&B>S&&(B=B-Qt*2),!l&&S>B&&(S=S-Qt*2)}var T=S-B;if(en(T)>u){var A=S,R=s,j=c;S=B+u*(l&&S>B?1:-1),s=_+n*Qe.cos(S),c=b+a*Qe.sin(S),f=tc(s,c,n,a,i,0,l,R,j,[S,A,_,b])}T=S-B;var O=Qe.cos(B),H=Qe.sin(B),M=Qe.cos(S),E=Qe.sin(S),L=Qe.tan(T/4),$=4/3*n*L,Q=4/3*a*L,se=[e,t],ge=[e+$*H,t-Q*O],Ee=[s+$*E,c-Q*M],We=[s,c];if(ge[0]=2*se[0]-ge[0],ge[1]=2*se[1]-ge[1],d)return[ge,Ee,We].concat(f);f=[ge,Ee,We].concat(f).join().split(",");for(var X=[],Te=0,Ne=f.length;Te<Ne;Te++)X[Te]=Te%2?g(f[Te-1],f[Te],p).y:g(f[Te],f[Te+1],p).x;return X}function ny(e,t,n,a,i,r,l,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*n+6*i,u=-3*e+9*n-9*i+3*l,f=3*n-3*e):(p=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*s,f=3*a-3*t),en(u)<1e-12){if(en(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,_;v--;)h=c[v],_=1-h,d[0][v]=_*_*_*e+3*_*_*h*n+3*_*h*h*i+h*h*h*l,d[1][v]=_*_*_*t+3*_*_*h*a+3*_*h*h*r+h*h*h*s;return d[0][C]=e,d[1][C]=t,d[0][C+1]=l,d[1][C+1]=s,d[0].length=d[1].length=C+2,{x0:Ot(...d[0]),y0:Ot(...d[1]),x1:It(...d[0]),y1:It(...d[1])}}function nc(e){if(ey(e)||(e=Ym(e)),Gm(e))return e;for(var t=qm(ty(e)),n={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",...tc(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",...ec(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",...ec(h.x,h.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...la(h.x,h.y,f[1],f[2])];break;case"H":f=["C",...la(h.x,h.y,f[1],h.y)];break;case"V":f=["C",...la(h.x,h.y,h.x,f[1])];break;case"Z":f=["C",...la(h.x,h.y,h.X,h.Y)];break}return f},i=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=[],l="",s="",c=0,d=t.length;c<d;c++){t[c]&&(l=t[c][0]),l!="C"&&(r[c]=l,c&&(s=r[c-1])),t[c]=a(t[c],n,s),r[c]!="A"&&l=="C"&&(r[c]="C"),i(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Us(u[p-4])||n.x,n.by=Us(u[p-3])||n.y}return t}function oy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function yo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ve(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function oc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function ay(e){return yo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function iy(e){for(var t=e.waypoints,n=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=sy(u,c);s.push({start:u,end:c,startLength:f,endLength:f+h,length:h})}return s},[]),a=n.reduce(function(s,c){return s+c.length},0)/2,i=0,r=n[i];r.endLength<a;)r=n[++i];var l=(a-r.startLength)/r.length;return{x:r.start.x+(r.end.x-r.start.x)*l,y:r.start.y+(r.end.y-r.start.y)*l}}function Je(e){return yt(e)?iy(e):ay(e)}function nn(e,t,n){n=n||0,(0,k.isObject)(n)||(n={x:n,y:n});var a=Ve(e),i=Ve(t),r=a.bottom+n.y<=i.top,l=a.left-n.x>=i.right,s=a.top-n.y>=i.bottom,c=a.right+n.x<=i.left,d=r?"top":s?"bottom":null,u=c?"left":l?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function Ni(e,t,n){var a=ry(e,t);return a.length===1||a.length===2&&mo(a[0],a[1])<1?yo(a[0]):a.length>1?(a=(0,k.sortBy)(a,function(i){var r=Math.floor(i.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,i.segment2+"#"+r}),yo(a[n?0:a.length-1])):null}function ry(e,t){return Zs(e,t)}function ly(e){e=e.slice();for(var t=0,n,a,i;e[t];)n=e[t],a=e[t-1],i=e[t+1],mo(n,i)===0||Mi(a,i,n)?e.splice(t,1):t++;return e}function sy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ac(e,t,n,a){function i(l,s){return a.allowed("connection.create",{source:l,target:s})}function r(l,s){return i(s,l)}e.on("connect.hover",function(l){var s=l.context,c=s.start,d=l.hover,u;if(s.hover=d,u=s.canExecute=i(c,d),!(0,k.isNil)(u)){if(u!==!1){s.source=c,s.target=d;return}u=s.canExecute=r(c,d),!(0,k.isNil)(u)&&u!==!1&&(s.source=d,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(l){var s=l.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(l){var s=l.context,c=s.canExecute,d=s.connectionStart,u={x:l.x,y:l.y},p=s.source,f=s.target;if(!c)return!1;var h=null,g={connectionStart:ji(s)?u:d,connectionEnd:ji(s)?d:u};(0,k.isObject)(c)&&(h=c),s.connection=n.connect(p,f,h,g)}),this.start=function(l,s,c,d){(0,k.isObject)(c)||(d=c,c=Je(s)),t.init(l,"connect",{autoActivate:d,data:{shape:s,context:{start:s,connectionStart:c}}})}}ac.$inject=["eventBus","dragging","modeling","rules"];function ji(e){var t=e.hover,n=e.source,a=e.target;return t&&n&&t===n&&n!==a}var cy=1100,dy=900,ic="connect-ok",rc="connect-not-ok";function lc(e,t,n){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(i){var r=i.context,l=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:i.x,y:i.y},g=f,m=h;ji(r)&&(g=h,m=f),a.drawPreview(r,l,{source:c||d,target:p||s,connectionStart:g,connectionEnd:m})}),t.on("connect.hover",dy,function(i){var r=i.context,l=i.hover,s=r.canExecute;s!==null&&n.addMarker(l,s?ic:rc)}),t.on(["connect.out","connect.cleanup"],cy,function(i){var r=i.hover;r&&(n.removeMarker(r,ic),n.removeMarker(r,rc))}),a&&t.on("connect.cleanup",function(i){a.cleanUp(i.context)})}lc.$inject=["injector","eventBus","canvas"];var Oi={__depends__:[Yn,qn,Cn],__init__:["connectPreview"],connect:["type",ac],connectPreview:["type",lc]},uy=15;function sc(e,t){var n;function a(s){return l(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function i(s){var c=n.start,d=n.button,u=Un(s),p=Kn(u,c);!n.dragging&&fy(p)>uy&&(n.dragging=!0,d===0&&Rs(e),Ei("grab")),n.dragging&&(p=Kn(u,n.last||n.start),t.scroll({dx:p.x,dy:p.y}),n.last=u),s.preventDefault()}function r(s){W.event.unbind(document,"mousemove",i),W.event.unbind(document,"mouseup",r),n=null,Bs()}function l(s){if(!(0,W.closest)(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Un(s)},W.event.bind(document,"mousemove",i),W.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}sc.$inject=["eventBus","canvas"];function fy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var cc={__init__:["moveCanvas"],moveCanvas:["type",sc]};function Ii(e){return Math.log(e)/Math.log(10)}function dc(e,t){var n=Ii(e.min),a=Ii(e.max);return(Math.abs(n)+Math.abs(a))/t}function py(e,t){return Math.max(e.min,Math.min(e.max,t))}var hy=Math.sign||function(e){return e>=0?1:-1},Li={min:.2,max:4},uc=10,gy=.1,my=.75;function Lt(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=(0,k.bind)(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||my;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}Lt.$inject=["config.zoomScroll","eventBus","canvas"],Lt.prototype.scroll=function(t){this._canvas.scroll(t)},Lt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Lt.prototype.zoom=function(t,n){var a=dc(Li,uc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>gy&&(this._zoom(t,n,a),this._totalDelta=0)},Lt.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var a=t.ctrlKey||ms()&&t.metaKey,i=t.shiftKey,r=-1*this._scale,l;if(a?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,a){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*hy(t.deltaY)*r,this.zoom(l,c)}else i?l={dx:r*t.deltaY,dy:0}:l={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(l)}},Lt.prototype.stepZoom=function(t,n){var a=dc(Li,uc);this._zoom(t,n,a)},Lt.prototype._zoom=function(e,t,n){var a=this._canvas,i=e>0?1:-1,r=Ii(a.zoom()),l=Math.round(r/n)*n;l+=n*i;var s=Math.pow(10,l);a.zoom(py(Li,s),t)},Lt.prototype.toggle=function(t){var n=this._container,a=this._handleWheel,i=this._enabled;return typeof t>"u"&&(t=!i),i!==t&&W.event[t?"bind":"unbind"](n,"wheel",a,!1),this._enabled=t,t},Lt.prototype._init=function(e){this.toggle(e)};var fc={__init__:["zoomScroll"],zoomScroll:["type",Lt]};function $e(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)}$e.$inject=["eventBus","injector"],$e.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},$e.prototype.canExecute=function(e,t){const n={command:e,context:t},a=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(i===void 0){if(!a)return!1;a.canExecute&&(i=a.canExecute(t))}return i},$e.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},$e.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()}},$e.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()}},$e.prototype.register=function(e,t){this._setHandler(e,t)},$e.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},$e.prototype.canUndo=function(){return!!this._getUndoAction()},$e.prototype.canRedo=function(){return!!this._getRedoAction()},$e.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},$e.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},$e.prototype._internalUndo=function(e){const t=e.command,n=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},$e.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const a=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const r of a)if(i=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return i},$e.prototype._createId=function(){return this._uid++},$e.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},$e.prototype._internalExecute=function(e,t){const n=e.command,a=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(a),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(a)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(a),this._fire(n,"postExecuted",e)),this._popAction()},$e.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,a=n[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()),n.push(e)},$e.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,a=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:(0,k.uniqueBy)("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},$e.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=(0,k.isArray)(e)?e:[e],t.dirty=t.dirty.concat(e))},$e.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},$e.prototype._revertedAction=function(e){this._stackIdx--},$e.prototype._getHandler=function(e){return this._handlerMap[e]},$e.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 yy={commandStack:["type",$e]};function xn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function sa(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function on(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var a=e.indexOf(t);if(a!==-1){if(a===n)return;if(n!==-1)e.splice(a,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Hi(e,t){return!e||!t?-1:e.indexOf(t)}function Zn(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}var vy=1e3;function dt(e){this._eventBus=e}dt.$inject=["eventBus"];function by(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}dt.prototype.on=function(e,t,n,a,i,r){if(((0,k.isFunction)(t)||(0,k.isNumber)(t))&&(r=i,i=a,a=n,n=t,t=null),(0,k.isFunction)(n)&&(r=i,i=a,a=n,n=vy),(0,k.isObject)(i)&&(r=i,i=!1),!(0,k.isFunction)(a))throw new Error("handlerFn must be a function");(0,k.isArray)(e)||(e=[e]);var l=this._eventBus;(0,k.forEach)(e,function(s){var c=["commandStack",s,t].filter(function(d){return d}).join(".");l.on(c,n,i?by(a,r):a,r)})},dt.prototype.canExecute=Ut("canExecute"),dt.prototype.preExecute=Ut("preExecute"),dt.prototype.preExecuted=Ut("preExecuted"),dt.prototype.execute=Ut("execute"),dt.prototype.executed=Ut("executed"),dt.prototype.postExecute=Ut("postExecute"),dt.prototype.postExecuted=Ut("postExecuted"),dt.prototype.revert=Ut("revert"),dt.prototype.reverted=Ut("reverted");function Ut(e){return function(n,a,i,r,l){((0,k.isFunction)(n)||(0,k.isNumber)(n))&&(l=r,r=i,i=a,a=n,n=null),this.on(n,e,a,i,r,l)}}var wy=250,pc=1400;function zi(e,t,n){dt.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",pc,function(i){var r=i.context,l=r.shapes,s=r.validatedShapes;r.shapes=hc(l),r.validatedShapes=hc(s)}),a&&t.on("shape.move.start",wy,function(i){var r=i.context,l=r.shapes,s=[];(0,k.forEach)(l,function(c){(0,k.forEach)(c.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&s.push(d),c.labelTarget&&s.push(c)})}),(0,k.forEach)(s,function(c){a.makeDraggable(r,c,!0)})}),this.preExecuted("elements.move",pc,function(i){var r=i.context.closure,l=r.enclosedElements,s=[];(0,k.forEach)(l,function(c){(0,k.forEach)(c.labels,function(d){l[d.id]||s.push(d)})}),r.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(i){var r=i.context;Zn((r.connection||r.shape).labels,function(l){n.removeShape(l,{nested:!0})})}),this.execute("shape.delete",function(i){var r=i.context,l=r.shape,s=l.labelTarget;s&&(r.labelTargetIndex=Hi(s.labels,l),r.labelTarget=s,l.labelTarget=null)}),this.revert("shape.delete",function(i){var r=i.context,l=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(on(s.labels,l,c),l.labelTarget=s)})}xn(zi,dt),zi.$inject=["injector","eventBus","modeling"];function hc(e){return(0,k.filter)(e,function(t){return e.indexOf(t.labelTarget)===-1})}var Cy={__init__:["labelSupport"],labelSupport:["type",zi]};function gc(){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 mc(e,t){if(t){let n=e;return Object.keys(t).forEach(a=>{n=n.replace(new RegExp(`{${a}}`,"g"),t[a])}),n}return e}function xy(e,t,n,a){var i=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var l=this.indexOf(r);return l!==-1&&(this.splice(l,1),t.unset(r,i,a)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,l){var s=this.indexOf(r);if(typeof l>"u"){if(s!==-1)return;l=this.length}s!==-1&&this.splice(s,1),this.splice(l,0,r),s===-1&&t.set(r,i,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function ky(e){return e.__refs_collection===!0}function Sy(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function yc(e,t,n){var a=xy(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(i){e.set(i,t.inverse,n)})}function Ey(e,t,n){var a=t.inverse,i=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(r){if(r!==i){var l=i;i=null,l&&e.unset(l,a,n),i=r,e.set(i,a,n)}}})}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?yc(this,t,e):Ey(this,t,e)},St.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return ky(n)||yc(this,t,e),n},St.prototype.ensureBound=function(e,t){Sy(e,t)||this.bind(e,t)},St.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},St.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Di=new St({name:"children",enumerable:!0,collection:!0},{name:"parent"}),vc=new St({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),bc=new St({name:"attachers",collection:!0},{name:"host"}),wc=new St({name:"outgoing",collection:!0},{name:"source"}),Cc=new St({name:"incoming",collection:!0},{name:"target"});function Qn(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Di.bind(this,"parent"),vc.bind(this,"labels"),wc.bind(this,"outgoing"),Cc.bind(this,"incoming")}function vo(){Qn.call(this),Di.bind(this,"children"),bc.bind(this,"host"),bc.bind(this,"attachers")}xn(vo,Qn);function xc(){Qn.call(this),Di.bind(this,"children")}xn(xc,vo);function kc(){vo.call(this),vc.bind(this,"labelTarget")}xn(kc,vo);function Sc(){Qn.call(this),wc.bind(this,"source"),Cc.bind(this,"target")}xn(Sc,Qn);var By={connection:Sc,shape:vo,label:kc,root:xc};function Ry(e,t){var n=By[e];if(!n)throw new Error("unknown type: <"+e+">");return(0,k.assign)(new n,t)}function _y(e){return e instanceof Qn}function an(){this._uid=12}an.prototype.createRoot=function(e){return this.create("root",e)},an.prototype.createLabel=function(e){return this.create("label",e)},an.prototype.createShape=function(e){return this.create("shape",e)},an.prototype.createConnection=function(e){return this.create("connection",e)},an.prototype.create=function(e,t){return t=(0,k.assign)({},t||{}),t.id||(t.id=e+"_"+this._uid++),Ry(e,t)};var Ty={width:90,height:20};function kn(){an.call(this),this._translate=mc}(0,$t.default)(kn,an),kn.$inject=[],kn.prototype.baseCreate=an.prototype.create,kn.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Fe({type:"label"},Ty,t)):this.createFlowElement(e,t)},kn.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:gc()},e==="connection"&&(t.type="myline");const{businessObject:n}=t;n.type=t.type;const a=this._getDefaultSize(n.type);return t=Fe({businessObject:n,id:n.id},a,t),this.baseCreate(e,t)},kn.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 ca(e,t){this._modeling=e,this._canvas=t}ca.$inject=["modeling","canvas"],ca.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,a=e.alignment;(0,k.forEach)(n,function(i){var r={x:0,y:0};(0,k.isDefined)(a.left)?r.x=a.left-i.x:(0,k.isDefined)(a.right)?r.x=a.right-i.width-i.x:(0,k.isDefined)(a.center)?r.x=a.center-Math.round(i.width/2)-i.x:(0,k.isDefined)(a.top)?r.y=a.top-i.y:(0,k.isDefined)(a.bottom)?r.y=a.bottom-i.height-i.y:(0,k.isDefined)(a.middle)&&(r.y=a.middle-Math.round(i.height/2)-i.y),t.moveElements([i],r,i.parent)})},ca.prototype.postExecute=function(e){};function da(e){this._modeling=e}da.$inject=["modeling"],da.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,a=e.shape,i=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,n,{attach:i.attach}),e.shape=a},da.prototype.postExecute=function(e){var t=e.hints||{};My(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 My(e,t){return(0,k.some)(e.outgoing,function(n){return n.target===t})}function ua(e,t){this._canvas=e,this._layouter=t}ua.$inject=["canvas","layouter"],ua.prototype.execute=function(e){var t=e.connection,n=e.source,a=e.target,i=e.parent,r=e.parentIndex,l=e.hints;if(!n||!a)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,i,r),t},ua.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var fa=Math.round;function Fi(e){this._modeling=e}Fi.$inject=["modeling"],Fi.prototype.preExecute=function(e){var t=e.elements,n=e.parent,a=e.parentIndex,i=e.position,r=e.hints,l=this._modeling;(0,k.forEach)(t,function(u){(0,k.isNumber)(u.x)||(u.x=0),(0,k.isNumber)(u.y)||(u.y=0)});var s=Nt((0,k.filter)(t,function(u){return!u.hidden}));(0,k.forEach)(t,function(u){yt(u)&&(u.waypoints=(0,k.map)(u.waypoints,function(p){return{x:fa(p.x-s.x-s.width/2+i.x),y:fa(p.y-s.y-s.height/2+i.y)}})),(0,k.assign)(u,{x:fa(u.x-s.x-s.width/2+i.x),y:fa(u.y-s.y-s.height/2+i.y)})});var c=Rm(t),d={};(0,k.forEach)(t,function(u){if(yt(u)){d[u.id]=(0,k.isNumber)(a)?l.createConnection(d[u.source.id],d[u.target.id],a,u,u.parent||n,r):l.createConnection(d[u.source.id],d[u.target.id],u,u.parent||n,r);return}var p=(0,k.assign)({},r);c.indexOf(u)===-1&&(p.autoResize=!1),Xn(u)&&(p=(0,k.omit)(p,["attach"])),d[u.id]=(0,k.isNumber)(a)?l.createShape(u,(0,k.pick)(u,["x","y","width","height"]),u.parent||n,a,p):l.createShape(u,(0,k.pick)(u,["x","y","width","height"]),u.parent||n,p)}),e.elements=(0,k.values)(d)};var Ec=Math.round;function rn(e){this._canvas=e}rn.$inject=["canvas"],rn.prototype.execute=function(e){var t=e.shape,n=e.position,a=e.parent,i=e.parentIndex;if(!a)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?(0,k.assign)(t,n):(0,k.assign)(t,{x:n.x-Ec(t.width/2),y:n.y-Ec(t.height/2)}),this._canvas.addShape(t,a,i),t},rn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function bo(e){rn.call(this,e)}xn(bo,rn),bo.$inject=["canvas"];var Ay=rn.prototype.execute;bo.prototype.execute=function(e){var t=e.shape;return Vy(t),t.labelTarget=e.labelTarget,Ay.call(this,e)};var Py=rn.prototype.revert;bo.prototype.revert=function(e){return e.shape.labelTarget=null,Py.call(this,e)};function Vy(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function wo(e,t){this._canvas=e,this._modeling=t}wo.$inject=["canvas","modeling"],wo.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Zn(n.incoming,function(a){t.removeConnection(a,{nested:!0})}),Zn(n.outgoing,function(a){t.removeConnection(a,{nested:!0})})},wo.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hi(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},wo.prototype.revert=function(e){var t=e.connection,n=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,on(n.children,t,a),this._canvas.addConnection(t,n),t};function $i(e,t){this._modeling=e,this._elementRegistry=t}$i.$inject=["modeling","elementRegistry"],$i.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,a=e.elements;(0,k.forEach)(a,function(i){n.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function Co(e,t){this._canvas=e,this._modeling=t}Co.$inject=["canvas","modeling"],Co.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Zn(n.incoming,function(a){t.removeConnection(a,{nested:!0})}),Zn(n.outgoing,function(a){t.removeConnection(a,{nested:!0})}),Zn(n.children,function(a){yt(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},Co.prototype.execute=function(e){var t=this._canvas,n=e.shape,a=n.parent;return e.oldParent=a,e.oldParentIndex=Hi(a.children,n),t.removeShape(n),n},Co.prototype.revert=function(e){var t=this._canvas,n=e.shape,a=e.oldParent,i=e.oldParentIndex;return on(a.children,n,i),t.addShape(n,a),n};function pa(e){this._modeling=e}pa.$inject=["modeling"];var Bc={x:"y",y:"x"};pa.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,a=e.axis,i=e.dimension;function r(y,w){y.range.min=Math.min(w[a],y.range.min),y.range.max=Math.max(w[a]+w[i],y.range.max)}function l(y){return y[a]+y[i]/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-l(w),x[a]&&(x[Bc[a]]=0,t.moveElements([w],x,w.parent))}var u=n[0],p=s(n),f=n[p],h,g,m=0;(0,k.forEach)(n,function(y,w){var x,v,C;if(y.elements.length<2){w&&w!==n.length-1&&(r(y,y.elements[0]),m+=c(y.range));return}x=(0,k.sortBy)(y.elements,a),v=x[0],w===p&&(v=x[s(x)]),C=l(v),y.range=null,(0,k.forEach)(x,function(_){if(d(C,_),y.range===null){y.range={min:_[a],max:_[a]+_[i]};return}r(y,_)}),w&&w!==n.length-1&&(m+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),h=Math.round((g-m)/(n.length-1)),!(h<n.length-1)&&(0,k.forEach)(n,function(y,w){var x={},v;y===u||y===f||(v=n[w-1],y.range.max=0,(0,k.forEach)(y.elements,function(C,_){x[Bc[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[i],_?y.range.max:0)}))})},pa.prototype.postExecute=function(e){};function ha(e,t){this._layouter=e,this._canvas=t}ha.$inject=["layouter","canvas"],ha.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return(0,k.assign)(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},ha.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Wi(){}Wi.prototype.execute=function(e){var t=e.connection,n=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=sa(r.children,t),on(a.children,t,i),t.parent=a,(0,k.forEach)(t.waypoints,function(l){l.x+=n.x,l.y+=n.y,l.original&&(l.original.x+=n.x,l.original.y+=n.y)}),t},Wi.prototype.revert=function(e){var t=e.connection,n=t.parent,a=e.oldParent,i=e.oldParentIndex,r=e.delta;return sa(n.children,t),on(a.children,t,i),t.parent=a,(0,k.forEach)(t.waypoints,function(l){l.x-=r.x,l.y-=r.y,l.original&&(l.original.x-=r.x,l.original.y-=r.y)}),t};function ga(e,t,n){var a=_s(t),i=_s(n),r=Kn(e,a),l={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return yo({x:i.x+l.x,y:i.y+l.y})}function Ui(e,t,n){var a=ma(e),i=_c(a,t),r=a[0];return i.length?i[i.length-1]:ga(r.original||r,n,t)}function Ji(e,t,n){var a=ma(e),i=_c(a,t),r=a[a.length-1];return i.length?i[0]:ga(r.original||r,n,t)}function Yi(e,t,n){var a=ma(e),i=Rc(t,n),r=a[0];return ga(r.original||r,i,t)}function Ki(e,t,n){var a=ma(e),i=Rc(t,n),r=a[a.length-1];return ga(r.original||r,i,t)}function Rc(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ma(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function _c(e,t){return(0,k.filter)((0,k.map)(e,jy),function(n){return Ny(n,t)})}function Ny(e,t){return nn(t,e,1)==="intersect"}function jy(e){return e.original||e}function Gi(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Gi.prototype.add=function(e,t){return this.addAll([e],t)},Gi.prototype.addAll=function(e,t){var n=Mm(e,!!t,this);return(0,k.assign)(this,n),this};function xo(e){this._modeling=e}xo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},xo.prototype.moveClosure=function(e,t,n,a,i){var r=this._modeling,l=e.allShapes,s=e.allConnections,c=e.enclosedConnections,d=e.topLevel,u=!1;i&&i.parent===n&&(u=!0),(0,k.forEach)(l,function(p){r.moveShape(p,t,d[p.id]&&!u&&n,{recurse:!1,layout:!1})}),(0,k.forEach)(s,function(p){var f=!!l[p.source.id],h=!!l[p.target.id];c[p.id]&&f&&h?r.moveConnection(p,t,d[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&Yi(p,p.source,t),connectionEnd:h&&Ki(p,p.target,t)})})},xo.prototype.getClosure=function(e){return new Gi().addAll(e,!0)};function ya(e){this._helper=new xo(e)}ya.$inject=["modeling"],ya.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},ya.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Sn(e){this._modeling=e,this._helper=new xo(e)}Sn.$inject=["modeling"],Sn.prototype.execute=function(e){var t=e.shape,n=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldBounds=(0,k.pick)(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=sa(r.children,t),on(a.children,t,i),(0,k.assign)(t,{parent:a,x:t.x+n.x,y:t.y+n.y}),t},Sn.prototype.postExecute=function(e){var t=e.shape,n=e.delta,a=e.hints,i=this._modeling;a.layout!==!1&&((0,k.forEach)(t.incoming,function(r){i.layoutConnection(r,{connectionEnd:Ki(r,t,n)})}),(0,k.forEach)(t.outgoing,function(r){i.layoutConnection(r,{connectionStart:Yi(r,t,n)})})),a.recurse!==!1&&this.moveChildren(e)},Sn.prototype.revert=function(e){var t=e.shape,n=e.oldParent,a=e.oldParentIndex,i=e.delta;return on(n.children,t,a),(0,k.assign)(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},Sn.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Sn.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ko(e){this._modeling=e}ko.$inject=["modeling"],ko.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,a=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return(0,k.isArray)(i)&&(e.oldWaypoints=a.waypoints,a.waypoints=i),t&&(e.oldSource=a.source,a.source=t),n&&(e.oldTarget=a.target,a.target=n),a},ko.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,a=e.newTarget,i=e.dockingOrPoints,r=e.hints||{},l={};r.connectionStart&&(l.connectionStart=r.connectionStart),r.connectionEnd&&(l.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!a||r.docking==="source")&&(l.connectionStart=l.connectionStart||Tc((0,k.isArray)(i)?i[0]:i)),a&&(!n||r.docking==="target")&&(l.connectionEnd=l.connectionEnd||Tc((0,k.isArray)(i)?i[i.length-1]:i)),r.newWaypoints&&(l.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,l))},ko.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,a=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),a&&(i.waypoints=a),i};function Tc(e){return e.original||e}function Jt(e,t){this._modeling=e,this._rules=t}Jt.$inject=["modeling","rules"],Jt.prototype.preExecute=function(e){var t=this,n=this._modeling,a=this._rules,i=e.oldShape,r=e.newData,l=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:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(r,d,i.parent,l),i.host&&n.updateAttachment(s,i.host);var p;l.moveChildren!==!1&&(p=i.children.slice(),n.moveElements(p,{x:0,y:0},s,l));var f=i.incoming.slice(),h=i.outgoing.slice();(0,k.forEach)(f,function(g){var m=g.source;c(m,s,g)&&t.reconnectEnd(g,s,Ji(g,s,u),l)}),(0,k.forEach)(h,function(g){var m=g.target;c(s,m,g)&&t.reconnectStart(g,s,Ui(g,s,u),l)})},Jt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Jt.prototype.execute=function(e){},Jt.prototype.revert=function(e){},Jt.prototype.createShape=function(e,t,n,a){return this._modeling.createShape(e,t,n,a)},Jt.prototype.reconnectStart=function(e,t,n,a){this._modeling.reconnectStart(e,t,n,a)},Jt.prototype.reconnectEnd=function(e,t,n,a){this._modeling.reconnectEnd(e,t,n,a)};function So(e){this._modeling=e}So.$inject=["modeling"],So.prototype.execute=function(e){var t=e.shape,n=e.newBounds,a=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(n.width<a.width||n.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&n.width<10||n.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,k.assign)(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},So.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,a=e.oldBounds;(e.hints||{}).layout!==!1&&((0,k.forEach)(n.incoming,function(i){t.layoutConnection(i,{connectionEnd:Ji(i,n,a)})}),(0,k.forEach)(n.outgoing,function(i){t.layoutConnection(i,{connectionStart:Ui(i,n,a)})}))},So.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return(0,k.assign)(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Oy(e,t){var n=[];return(0,k.forEach)(e.concat(t),function(a){var i=a.incoming,r=a.outgoing;(0,k.forEach)(i.concat(r),function(l){var s=l.source,c=l.target;(Eo(e,s)||Eo(e,c)||Eo(t,s)||Eo(t,c))&&(Eo(n,l)||n.push(l))})}),n}function Eo(e,t){return e.indexOf(t)!==-1}function Iy(e,t,n){var a=e.x,i=e.y,r=e.width,l=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:a,y:i+c,width:r,height:l-c};case"s":return{x:a,y:i,width:r,height:l+c};case"w":return{x:a+s,y:i,width:r-s,height:l};case"e":return{x:a,y:i,width:r+s,height:l};default:throw new Error("unknown direction: "+t)}}function ln(e){this._modeling=e}ln.$inject=["modeling"],ln.prototype.preExecute=function(e){var t=e.delta,n=e.direction,a=e.movingShapes,i=e.resizingShapes,r=e.start,l={};this.moveShapes(a,t),(0,k.forEach)(i,function(s){l[s.id]=Hy(s)}),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(Oy(a,i),t,n,r,a,i,l)},ln.prototype.execute=function(){},ln.prototype.revert=function(){},ln.prototype.moveShapes=function(e,t){var n=this;(0,k.forEach)(e,function(a){n._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},ln.prototype.resizeShapes=function(e,t,n){var a=this;(0,k.forEach)(e,function(i){var r=Iy(i,n,t);a._modeling.resizeShape(i,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},ln.prototype.updateConnectionWaypoints=function(e,t,n,a,i,r,l){var s=this,c=i.concat(r);(0,k.forEach)(e,function(d){var u=d.source,p=d.target,f=Ly(d),h=Ac(n),g={};sn(c,u)&&sn(c,p)?(f=(0,k.map)(f,function(m){return Pc(m,a,n)&&(m[h]=m[h]+t[h]),m.original&&Pc(m.original,a,n)&&(m.original[h]=m.original[h]+t[h]),m}),s._modeling.updateWaypoints(d,f,{labelBehavior:!1})):(sn(c,u)||sn(c,p))&&(sn(i,u)?g.connectionStart=Yi(d,u,t):sn(i,p)?g.connectionEnd=Ki(d,p,t):sn(r,u)?g.connectionStart=Ui(d,u,l[u.id]):sn(r,p)&&(g.connectionEnd=Ji(d,p,l[p.id])),s._modeling.layoutConnection(d,g))})};function Mc(e){return(0,k.assign)({},e)}function Ly(e){return(0,k.map)(e.waypoints,function(t){return t=Mc(t),t.original&&(t.original=Mc(t.original)),t})}function Ac(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Pc(e,t,n){var a=Ac(n);if(/e|s/.test(n))return e[a]>t;if(/n|w/.test(n))return e[a]<t}function sn(e,t){return e.indexOf(t)!==-1}function Hy(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function va(e){this._modeling=e}va.$inject=["modeling"],va.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Vc(n),t.collapsed=!t.collapsed;var a=Nc(n,t.collapsed);return[t].concat(a)},va.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,a=t.children,i=jc(a,n);return t.collapsed=!t.collapsed,[t].concat(i)};function Vc(e){var t={};return(0,k.forEach)(e,function(n){t[n.id]=n.hidden,n.children&&(t=(0,k.assign)({},t,Vc(n.children)))}),t}function Nc(e,t){var n=[];return(0,k.forEach)(e,function(a){a.hidden=t,n=n.concat(a),a.children&&(n=n.concat(Nc(a.children,a.collapsed||t)))}),n}function jc(e,t){var n=[];return(0,k.forEach)(e,function(a){a.hidden=t[a.id],n=n.concat(a),a.children&&(n=n.concat(jc(a.children,t)))}),n}function ba(e){this._modeling=e}ba.$inject=["modeling"],ba.prototype.execute=function(e){var t=e.shape,n=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Oc(a,t),Ic(n,t),t.host=n,t},ba.prototype.revert=function(e){var t=e.shape,n=e.newHost,a=e.oldHost,i=e.attacherIdx;return t.host=a,Oc(n,t),Ic(a,t,i),t};function Oc(e,t){return sa(e&&e.attachers,t)}function Ic(e,t,n){if(e){var a=e.attachers;a||(e.attachers=a=[]),on(a,t,n)}}function qi(){}qi.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},qi.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ae(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var a=this;e.on("diagram.init",function(){a.registerHandlers(n)})}Ae.$inject=["eventBus","elementFactory","commandStack"],Ae.prototype.getHandlers=function(){return{"shape.append":da,"shape.create":rn,"shape.delete":Co,"shape.move":Sn,"shape.resize":So,"shape.replace":Jt,"shape.toggleCollapse":va,spaceTool:ln,"label.create":bo,"connection.create":ua,"connection.delete":wo,"connection.move":Wi,"connection.layout":ha,"connection.updateWaypoints":qi,"connection.reconnect":ko,"elements.create":Fi,"elements.move":ya,"elements.delete":$i,"elements.distribute":pa,"elements.align":ca,"element.updateAttachment":ba}},Ae.prototype.registerHandlers=function(e){(0,k.forEach)(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ae.prototype.moveShape=function(e,t,n,a,i){typeof a=="object"&&(i=a,a=null);var r={shape:e,delta:t,newParent:n,newParentIndex:a,hints:i||{}};this._commandStack.execute("shape.move",r)},Ae.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ae.prototype.moveElements=function(e,t,n,a){a=a||{};var i=a.attach,r=n,l;i===!0?(l=n,r=n.parent):i===!1&&(l=null);var s={shapes:e,delta:t,newParent:r,newHost:l,hints:a};this._commandStack.execute("elements.move",s)},Ae.prototype.moveConnection=function(e,t,n,a,i){typeof a=="object"&&(i=a,a=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:a,hints:i||{}};this._commandStack.execute("connection.move",r)},Ae.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ae.prototype.createConnection=function(e,t,n,a,i,r){typeof n=="object"&&(r=i,i=a,a=n,n=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:i,parentIndex:n,connection:a,hints:r};return this._commandStack.execute("connection.create",l),l.connection},Ae.prototype.createShape=function(e,t,n,a,i){typeof a!="number"&&(i=a,a=void 0),i=i||{};var r=i.attach,l,s;e=this._create("shape",e),r?(l=n.parent,s=n):l=n;var c={position:t,shape:e,parent:l,parentIndex:a,host:s,hints:i};return this._commandStack.execute("shape.create",c),c.shape},Ae.prototype.createElements=function(e,t,n,a,i){(0,k.isArray)(e)||(e=[e]),typeof a!="number"&&(i=a,a=void 0),i=i||{};var r={position:t,elements:e,parent:n,parentIndex:a,hints:i};return this._commandStack.execute("elements.create",r),r.elements},Ae.prototype.createLabel=function(e,t,n,a){n=this._create("label",n);var i={labelTarget:e,position:t,parent:a||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},Ae.prototype.appendShape=function(e,t,n,a,i){i=i||{},t=this._create("shape",t);var r={source:e,position:n,target:a,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",r),r.shape},Ae.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ae.prototype.distributeElements=function(e,t,n){var a={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",a)},Ae.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ae.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ae.prototype.replaceShape=function(e,t,n){var a={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",a),a.newShape},Ae.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ae.prototype.resizeShape=function(e,t,n,a){var i={shape:e,newBounds:t,minBounds:n,hints:a};this._commandStack.execute("shape.resize",i)},Ae.prototype.createSpace=function(e,t,n,a,i){var r={delta:n,direction:a,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",r)},Ae.prototype.updateWaypoints=function(e,t,n){var a={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",a)},Ae.prototype.reconnect=function(e,t,n,a,i){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:a,hints:i||{}};this._commandStack.execute("connection.reconnect",r)},Ae.prototype.reconnectStart=function(e,t,n,a){a||(a={}),this.reconnect(e,t,e.target,n,(0,k.assign)(a,{docking:"source"}))},Ae.prototype.reconnectEnd=function(e,t,n,a){a||(a={}),this.reconnect(e,e.source,t,n,(0,k.assign)(a,{docking:"target"}))},Ae.prototype.connect=function(e,t,n,a){return this.createConnection(e,t,n||{},e.parent,a)},Ae.prototype._create=function(e,t){return _y(t)?t:this._elementFactory.create(e,t)},Ae.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Lc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xi(e,t){if(!e||!t||!Array.isArray(t))return!1;const n=e.type||e.businessObject&&e.businessObject.type;return t.includes(n)}function zy(e,t){Array.isArray(e)&&e.forEach(t)}function wa(e){const t=e.businessObject;if(t)return t.name||""}function Dy(e,t){const n=e.businessObject;return n.name=t,e}var Fy={width:90,height:20},iC=15;function Zi(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function Hc(e){return Bo(e.label)}function $y(e){const t=e.length/2-1,n=e[Math.floor(t)],a=e[Math.ceil(t+.01)],i=Wy(e),r=Math.atan((a.y-n.y)/(a.x-n.x));let{x:l,y:s}=i;return Math.abs(r)<Math.PI/2?s-=15:l+=15,{x:l,y:s}}function Wy(e){const t=e.length/2-1,n=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:n.x+(a.x-n.x)/2,y:n.y+(a.y-n.y)/2}}function zc(e){return e.waypoints?$y(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Fy.height/2}}function Bo(e){return e&&!!e.labelTarget}var Uy={width:0,height:0};function Dc(e,t){function n(s,c){const d=s.label||s,u=s.labelTarget||s;return Dy(d,c,u!==d),[d,u]}function a(s){const{element:c,newLabel:d}=s,{businessObject:u}=c;if(!Bo(c)&&Zi(c)&&!Hc(c)&&!Fc(d)){let f=zc(c);f={x:f.x,y:f.y+7},e.createLabel(c,f,{id:u.id+"_label",businessObject:u})}}function i(s){return s.oldLabel=wa(s.element),n(s.element,s.newLabel)}function r(s){return n(s.element,s.oldLabel)}function l(s){const{element:c,newLabel:d}=s,u=c.label||c,p=s.hints||{};let{newBounds:f}=s;if(!Bo(u))return;if(Bo(u)&&Fc(d)){p.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const h=wa(u);typeof f>"u"&&(f=t.getExternalLabelBounds(u,h)),f&&e.resizeShape(u,f,Uy)}this.preExecute=a,this.execute=i,this.revert=r,this.postExecute=l}Dc.$inject=["modeling","textRenderer"];function Fc(e){return!e||!e.trim()}function Ro(e,t,n){Ae.call(this,e,t,n)}(0,$t.default)(Ro,Ae),Ro.$inject=["eventBus","elementFactory","commandStack"],Ro.prototype.getHandlers=function(){const e=Ae.prototype.getHandlers.call(this);return e["element.updateLabel"]=Dc,e},Ro.prototype.updateLabel=function(e,t,n,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:a||{}})};function Qi(e,t){dt.call(this,e);function n(a){const{context:i}=a,r=i.hints||{};let l;!i.cropped&&r.createElementsBehavior!==!1&&(l=i.connection,l.waypoints=t.getCroppedWaypoints(l),i.cropped=!0)}this.executed(["connection.layout","connection.create"],n)}(0,$t.default)(Qi,dt),Qi.$inject=["eventBus","connectionDocking"];function $c(){}$c.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Je(t.source||e.source),t.connectionEnd||Je(t.target||e.target)]};var Ca=20,Jy=5,xa=Math.round,Wc=20,Yy={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Ky(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Gy(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Uc(e,t,n){var a=nn(t,e,Jy),i=n.split(":")[0],r=xa((t.x-e.x)/2+e.x),l=xa((t.y-e.y)/2+e.y),s,c,d=Gy(i,a),u=/h|r|l/.test(i),p=!1,f=!1;return d?(s=u?{x:r,y:e.y}:{x:e.x,y:l},c=u?"h:h":"v:v"):(p=Ky(a,i),c=u?"h:v":"v:h",p?u?(f=l===e.y,s={x:e.x+Ca*(/l/.test(i)?-1:1),y:f?l+Ca:l}):(f=r===e.x,s={x:f?r+Ca:r,y:e.y+Ca*(/t/.test(i)?-1:1)}):s={x:r,y:l}),{waypoints:er(e,s,c).concat(s),directions:c,turnNextDirections:f}}function qy(e,t,n){return Uc(e,t,n)}function Xy(e,t,n){var a=Uc(t,e,Jc(n));return{waypoints:a.waypoints.slice().reverse(),directions:Jc(a.directions),turnNextDirections:a.turnNextDirections}}function Zy(e,t){var n=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var i=n+":"+a;return{waypoints:er(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}function Jc(e){return e.split(":").reverse().join(":")}function Qy(e,t,n){var a=xa((t.x-e.x)/2+e.x),i=xa((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(n==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function er(e,t,n){if(n=n||"h:h",!sv(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Kc(n)){var a=qy(e,t,n),i=Xy(e,t,n),r=Zy(a,i);return[].concat(a.waypoints,r.waypoints,i.waypoints)}return Qy(e,t,n)}function ev(e,t,n){var a=er(e,t,n);return a.unshift(e),a.push(t),qc(a)}function tv(e,t,n,a,i){var r=(0,k.without)(i&&i.preferredLayouts||[],"straight")[0]||"h:h",l=nn(e,t,Yy[r]||0),s=lv(l,r);n=n||Je(e),a=a||Je(t);var c=s.split(":");return ev(Gc(n,e,c[0],cv(l)),Gc(a,t,c[1],l),s)}function nv(e,t,n,a,i,r){(0,k.isArray)(n)&&(i=n,r=a,n=Je(e),a=Je(t)),r=(0,k.assign)({preferredLayouts:[]},r),i=i||[];var l=r.preferredLayouts.indexOf("straight")!==-1&&av(e,t,n,a,r);return l||(l=r.connectionEnd&&rv(t,e,a,i),l)||(l=r.connectionStart&&iv(e,t,n,i),l)?l:!r.connectionStart&&!r.connectionEnd&&i&&i.length?i:tv(e,t,n,a,r)}function ov(e,t,n){return e>=t&&e<=n}function Yc(e,t,n){return ov(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function av(e,t,n,a,i){var r={},l,s=nn(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(l="x"),/left|right/.test(s)&&(l="y"),i.preserveDocking==="target"?Yc(l,a,e)?(r[l]=a[l],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:a.x,y:a.y}]):null:Yc(l,n,t)?(r[l]=n[l],[{x:n.x,y:n.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 iv(e,t,n,a){return tr(e,t,n,a)}function rv(e,t,n,a){var i=a.slice().reverse();return i=tr(e,t,n,i),i?i.reverse():null}function tr(e,t,n,a){function i(u){return u.length<3?!0:u.length>4?!1:!!(0,k.find)(u,function(p,f){var h=u[f-1];return h&&mo(p,h)<3})}function r(u,p,f){switch(Zt(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 l(u,p,f){var h;for(h=u.length-2;h!==0;h--)if(Ws(u[h],p,Wc)||Ws(u[h],f,Wc))return u.slice(h);return u}if(i(a))return null;var s=a[0],c=a.slice(),d;return c[0]=n,c[1]=r(c[1],s,n),d=l(c,e,t),d!==c&&(c=tr(e,t,n,d)),c&&Zt(c)?null:c}function lv(e,t){if(Kc(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 sv(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Kc(e){return e&&/t|r|b|l/.test(e)}function cv(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 Gc(e,t,n,a){if(n==="h"&&(n=/left/.test(a)?"l":"r"),n==="v"&&(n=/top/.test(a)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function qc(e){return e.reduce(function(t,n,a){var i=t[t.length-1],r=e[a+1];return Mi(i,r,n,0)||t.push(n),t},[])}function nr(){}(0,$t.default)(nr,$c);var En=(e,t)=>e.type===t;nr.prototype.layoutConnection=function(e,t){t||(t={});const n=t.source||e.source,a=t.target||e.target,i=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:l}=t,s,c;return l===void 0&&(r=ka(i&&i[0],n),l=ka(i&&i[i.length-1],a)),r||(r=ka(i&&i[0],n)),l||(l=ka(i&&i[i.length-1],a)),En(e,"myline")&&(n===a?s={preferredLayouts:dv(n,e)}:En(n,"gatewayAnd")||En(n,"gatewayXor")||En(n,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:En(a,"gatewayAnd")||En(a,"gatewayXor")||En(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Fe(s,t),c=qc(nv(n,a,r,l,i,s))),c||[r,l]};function ka(e,t){return e?e.original||e:Je(t)}function dv(e,t){const{waypoints:n}=t,a=n&&n.length&&nn(n[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function Xc(e){return(0,k.assign)({original:e.point.original||e.point},e.actual)}function cn(e,t){this._elementRegistry=e,this._graphicsFactory=t}cn.$inject=["elementRegistry","graphicsFactory"],cn.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var a=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),r=e.waypoints.slice(a.idx+1,i.idx);return r.unshift(Xc(a)),r.push(Xc(i)),r},cn.prototype.getDockingPoint=function(e,t,n){var a=e.waypoints,i=n?0:a.length-1,r=a[i];return{point:r,actual:this._getIntersection(t,e,n)||r,idx:i}},cn.prototype._getIntersection=function(e,t,n){return Ni(this._getShapePath(e),this._getConnectionPath(t),n)},cn.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},cn.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},cn.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Zc={__depends__:[yy,Cy,Yn],__init__:["modeling","elementUpdater"],modeling:["type",Ro],layouter:["type",nr],elementUpdater:["type",Qi],elementFactory:["type",kn],connectionDocking:["type",cn]},uv=1e3;function Bn(e,t){var n=this;t=t||uv,e.on(["render.shape","render.connection"],t,function(a,i){var r=a.type,l=i.element,s=i.gfx,c=i.attrs;if(n.canRender(l))return r==="render.shape"?n.drawShape(s,l,c):n.drawConnection(s,l,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,i){if(n.canRender(i))return a.type==="render.getShapePath"?n.getShapePath(i):n.getConnectionPath(i)})}Bn.prototype.canRender=function(e){},Bn.prototype.drawShape=function(e,t){},Bn.prototype.drawConnection=function(e,t){},Bn.prototype.getShapePath=function(e){},Bn.prototype.getConnectionPath=function(e){};function fv(e){return e.businessObject}function Sa(e,t){return e.businessObject.strokeWidth||t||1}function Mt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Ye(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function pv(e){const t=e.x+e.width/2,n=e.y+e.height/2,a=e.width/2;return ho([["M",t,n],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]])}function hv(e,t){const{x:n,y:a,width:i,height:r}=e;return ho([["M",n+t,a],["l",i-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-i,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]])}function gv(e){const{x:t,y:n,width:a,height:i}=e,r=a/2,l=i/2;return ho([["M",t+r,n],["l",r,l],["l",-r,l],["l",-r,-l],["z"]])}function mv(e){const{x:t,y:n,width:a,height:i}=e;return ho([["M",t,n],["l",a,0],["l",0,i],["l",-a,0],["z"]])}var or=10,ar=.95,dn=(e,t)=>e.type===t;function Rn(e,t,n,a,i,r,l){Bn.call(this,e,l);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 H[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,L,$){L=f(L);const Q=ki(E,L,$);return(0,P.append)(M,Q),Q}function m(M,E,L){return g(M,E,L,5)}function y(M,E,L,$,Q){Lc($)&&(Q=$,$=0),$=$||0,Q=u(Q,{stroke:c,strokeWidth:2,fill:s}),Q.fill==="none"&&delete Q.fillOpacity;const se=E/2,ge=L/2,Ee=(0,P.create)("circle");return(0,P.attr)(Ee,{cx:se,cy:ge,r:Math.round((E+L)/4-$)}),(0,P.attr)(Ee,Q),(0,P.append)(M,Ee),Ee}function w(M,E,L,$,Q,se){Lc(Q)&&(se=Q,Q=0),Q=Q||0,se=u(se,{stroke:c,strokeWidth:2,fill:s});const ge=(0,P.create)("rect");return(0,P.attr)(ge,{x:Q,y:Q,width:E-Q*2,height:L-Q*2,rx:$,ry:$}),(0,P.attr)(ge,se),(0,P.append)(M,ge),ge}function x(M,E,L){L=u(L,["no-fill"],{strokeWidth:2,stroke:c});const $=(0,P.create)("path");return(0,P.attr)($,{d:E}),(0,P.attr)($,L),(0,P.append)(M,$),$}function v(M,E,L,$){const Q=E/2,se=L/2,ge=[{x:Q,y:0},{x:E,y:se},{x:Q,y:L},{x:0,y:se}].map(We=>We.x+","+We.y).join(" ");$=u($,{stroke:c,strokeWidth:2,fill:s});const Ee=(0,P.create)("polygon");return(0,P.attr)(Ee,{points:ge}),(0,P.attr)(Ee,$),(0,P.append)(M,Ee),Ee}function C(M,E,L,$){return x(E,L,Fe({"data-marker":M},$))}function _(M,E,L){L=Fe({size:{width:100}},L);const $=i.createText(E||"",L);return(0,P.classes)($).add("djs-label"),(0,P.append)(M,$),$}function b(M,E,L){return _(M,fv(E).name,{box:E,align:L,padding:5,style:{fill:Ye(E,c)}})}function B(M,E){const L={width:90,height:30,x:E.width/2+E.x,y:E.height/2+E.y};return _(M,wa(E),{box:L,fitBox:!0,style:Fe({},i.getExternalStyle(),{fill:Ye(E,c)})})}function S(M,E,L){const $=L&&L.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},zy(L,se=>{p(se)(M,E,Q)})}function T(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function A(M,E){const{ref:L={x:0,y:0},scale:$=1,element:Q,parentGfx:se=a._svg}=E,ge=(0,P.create)("marker",{id:M,viewBox:"0 0 20 20",refX:L.x,refY:L.y,markerWidth:20*$,markerHeight:20*$,orient:"auto"});(0,P.append)(ge,Q);let Ee=(0,W.query)(":scope > defs",se);Ee||(Ee=(0,P.create)("defs"),(0,P.append)(se,Ee)),(0,P.append)(Ee,ge)}function R(M,E,L,$){const Q=E+"-"+T(L)+"-"+T($)+"-"+gc();return j(M,Q,E,L,$),"url(#"+Q+")"}function j(M,E,L,$,Q){L==="sequenceflow-end"&&A(E,{element:(0,P.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}),L==="messageflow-start"&&A(E,{element:(0,P.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}),L==="messageflow-end"&&A(E,{element:(0,P.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}),L==="association-start"&&A(E,{element:(0,P.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}),L==="association-end"&&A(E,{element:(0,P.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}),L==="conditional-flow-marker"&&A(E,{element:(0,P.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}),L==="conditional-default-flow-marker"&&A(E,{element:(0,P.create)("path",{d:"M 6 4 L 10 16",...h({stroke:Q,fill:"none"})}),ref:{x:0,y:10},scale:.5,parentGfx:M})}function O(M,E,L,$){const Q=d[E.type]?.icon||E.icon;Q&&x(M,n.getScaledPath(Q,{abspos:{x:L,y:$}}),{strokeWidth:0,fill:Ye(E,d[E.type]?.iconFill||E.iconFill)})}const H={event(M,E,L){return"fillOpacity"in L||(L.fillOpacity=ar),y(M,E.width,E.height,L)},startEvent(M,E){const L={fill:Mt(E,d.startEvent?.fill||E.fill),stroke:Ye(E,d.startEvent?.stroke||E.stroke),strokeWidth:Sa(E,d.startEvent?.strokeWidth||E.strokeWidth)},$=p("event")(M,E,L);return O(M,E,18,18),$},endEvent(M,E){const L=p("event")(M,E,{strokeWidth:Sa(E,d.endEvent?.strokeWidth||E.strokeWidth||4),fill:Mt(E,d.endEvent?.fill||E.fill),stroke:Ye(E,d.endEvent?.stroke||E.stroke)});return O(M,E,18,18),L},gateway(M,E){const L={fillOpacity:ar,strokeWidth:Sa(E,d[E.type]?.strokeWidth||E.strokeWidth||4),fill:Mt(E,d[E.type]?.fill||E.fill),stroke:Ye(E,d[E.type]?.stroke||E.stroke)};return v(M,E.width,E.height,L)},gatewayAnd(M,E){const L=p("gateway")(M,E);return x(M,n.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:Ye(E,d[E.type]?.iconFill||E.iconFill),stroke:Ye(E,d[E.type]?.iconFill||E.iconFill)}),L},gatewayXor(M,E){const L=p("gateway")(M,E);return x(M,n.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),{strokeWidth:1,fill:Ye(E,d[E.type]?.iconFill||E.iconFill),stroke:Ye(E,d[E.type]?.iconFill||E.iconFill)}),L},gatewayInclusive(M,E){const L=p("gateway")(M,E);return y(M,E.width,E.height,E.height*.24,{strokeWidth:2.5,fill:Ye(E,s),stroke:Ye(E,d[E.type]?.iconFill||E.iconFill)}),L},activity(M,E,L){return L=L||{},"fillOpacity"in L||(L.fillOpacity=ar),w(M,E.width,E.height,or,L)},task(M,E){const L={fill:Mt(E,s),stroke:Ye(E,c)},$=p("activity")(M,E,L);return b(M,E,"center-middle"),S(M,E),$},userTask(M,E){const L=p("task")(M,E),$=15,Q=12;return x(M,n.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Mt(E,s),stroke:Ye(E,c)}),x(M,n.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Mt(E,s),stroke:Ye(E,c)}),x(M,n.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:$,y:Q}}),{strokeWidth:.5,fill:Ye(E,c),stroke:Ye(E,c)}),L},scriptTask(M,E){const L=p("task")(M,E);return x(M,n.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Ye(E,c)}),L},SubProcessMarker(M,E){jt(w(M,14,14,0,{strokeWidth:1,fill:Mt(E,s),stroke:Ye(E,c)}),E.width/2-7.5,E.height-20),C("sub-process",M,n.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:Ye(E,c)})},subprocess(M,E,L){L=Fe({fill:Mt(E,s),stroke:Ye(E,c)},L);const $=p("activity")(M,E,L);return b(M,E,"center-middle"),S(M,E,["SubProcessMarker"]),$},label(M,E){return B(M,E)},myline(M,E){const L=Mt(E,r.lineStroke||s),$=Ye(E,r.lineStroke||c);return m(M,E.waypoints,{markerEnd:R(M,"sequenceflow-end",L,$),stroke:$})},default(M,E){const L={strokeWidth:Sa(E,d[E.type]?.strokeWidth||E.strokeWidth||1),fill:Mt(E,d[E.type]?.fill||E.fill),stroke:Ye(E,d[E.type]?.stroke||E.stroke)},$=w(M,E.width,E.height,E.radius||or,L);return b(M,E,"center-middle"),S(M,E),O(M,E,E.iconX,E.iconY),$}};this.handlers=H,this._drawPath=x}(0,$t.default)(Rn,Bn),Rn.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],Rn.prototype.canRender=function(){return!0},Rn.prototype.drawShape=function(e,t){const{type:n}=t;return(this.handlers[n]||this.handlers.default)(e,t)},Rn.prototype.drawConnection=function(e,t){const{type:n}=t,a=this.handlers[n];return a(e,t)},Rn.prototype.getShapePath=function(e){return dn(e,"startEvent")||dn(e,"endEvent")?pv(e):dn(e,"userTask")||dn(e,"scriptTask")||dn(e,"subprocess")?hv(e,or):dn(e,"gatewayAnd")||dn(e,"gatewayXor")||dn(e,"gatewayInclusive")?gv(e):mv(e)};var yv=0,vv={width:150,height:50};function bv(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function wv(e){return(0,k.isObject)(e)?(0,k.assign)({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function Cv(e,t){t.textContent=e;var n;try{var a,i=e==="";return t.textContent=i?"dummy":e,n=t.getBBox(),a={width:n.width+n.x*2,height:n.height},i&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function xv(e,t,n){for(var a=e.shift(),i=a,r;;){if(r=Cv(i,n),r.width=i?r.width:0,i===" "||i===""||r.width<Math.round(t)||i.length<2)return kv(e,i,a,r);i=Ev(i,r.width,t)}}function kv(e,t,n,a){if(t.length<n.length){var i=n.slice(t.length).trim();e.unshift(i)}return{width:a.width,height:a.height,text:t}}var Qc="";function Sv(e,t){var n=e.split(/(\s|-|\u00AD)/g),a,i=[],r=0;if(n.length>1)for(;a=n.shift();)if(a.length+r<t)i.push(a),r+=a.length;else{(a==="-"||a===Qc)&&i.pop();break}var l=i[i.length-1];return l&&l===Qc&&(i[i.length-1]="-"),i.join("")}function Ev(e,t,n){var a=Math.max(e.length*(n/t),1),i=Sv(e,a);return i||(i=e.slice(0,Math.max(Math.round(a-1),1))),i}function Bv(){var e=document.getElementById("helper-svg");return e||(e=(0,P.create)("svg"),(0,P.attr)(e,{id:"helper-svg"}),(0,W.assignStyle)(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function Ea(e){this._config=(0,k.assign)({},{size:vv,padding:yv,style:{},align:"center-top"},e||{})}Ea.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ea.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ea.prototype.layoutText=function(e,t){var n=(0,k.assign)({},this._config.size,t.box),a=(0,k.assign)({},this._config.style,t.style),i=bv(t.align||this._config.align),r=wv(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,s=Rv(a),c=e.split(/\u00AD?\r?\n/),d=[],u=n.width-r.left-r.right,p=(0,P.create)("text");for((0,P.attr)(p,{x:0,y:0}),(0,P.attr)(p,a),(0,P.append)(Bv(),p);c.length;)d.push(xv(c,u,p));i.vertical==="middle"&&(r.top=r.bottom=0);var f=(0,k.reduce)(d,function(y,w,x){return y+(s||w.height)},0)+r.top+r.bottom,h=(0,k.reduce)(d,function(y,w,x){return w.width>y?w.width:y},0),g=r.top;i.vertical==="middle"&&(g+=(n.height-f)/2),g-=(s||d[0].height)/4;var m=(0,P.create)("text");return(0,P.attr)(m,a),(0,k.forEach)(d,function(y){var w;switch(g+=s||y.height,i.horizontal){case"left":w=r.left;break;case"right":w=(l?h:u)-r.right-y.width;break;default:w=Math.max(((l?h:u)-y.width)/2+r.left,0)}var x=(0,P.create)("tspan");(0,P.attr)(x,{x:w,y:g}),x.textContent=y.text,(0,P.append)(m,x)}),(0,P.remove)(p),{dimensions:{width:h,height:f},element:m}};function Rv(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var _v=12,Tv=1.2,Mv=30;function ed(e){const t=Fe({fontFamily:"Arial, sans-serif",fontSize:_v,fontWeight:"normal",lineHeight:Tv},e&&e.defaultStyle||{}),n=Fe({},t,{fontSize:parseInt(t.fontSize,10)-1},e&&e.externalStyle||{}),a=new Ea({style:t});this.getExternalLabelBounds=function(i,r){const l=a.getDimensions(r,{box:{width:90,height:30,x:i.width/2+i.x,y:i.height/2+i.y},style:n});return{x:Math.round(i.x+i.width/2-l.width/2),y:Math.round(i.y),width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(i,r){const l=a.getDimensions(r,{box:i,style:t,align:"left-top",padding:5});return{x:i.x,y:i.y,width:i.width,height:Math.max(Mv,Math.round(l.height))}},this.createText=function(i,r){return a.createText(i,r||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return n}}ed.$inject=["config.textRenderer"];function Av(){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,n){let a,i;n.abspos?(a=n.abspos.x,i=n.abspos.y):(a=n.containerWidth*n.position.mx,i=n.containerHeight*n.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&&(i-=r.height/2)):r=this.pathMap[t];const l={};if(n.position){const s=n.containerHeight/r.height*n.yScaleFactor,c=n.containerWidth/r.width*n.xScaleFactor;for(let d=0;d<r.heightElements.length;d++)l["y"+d]=r.heightElements[d]*s;for(let d=0;d<r.widthElements.length;d++)l["x"+d]=r.widthElements[d]*c}return jv(r.d,{mx:a,my:i,e:l})}}var Pv=/\{([^}]+)\}/g,Vv=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Nv(e,t,n){let a=n;return t.replace(Vv,(i,r,l,s,c)=>{r=r||s,a&&(r in a&&(a=a[r]),typeof a=="function"&&c&&(a=a()))}),a=(a==null||a===n?e:a)+"",a}function jv(e,t){return String(e).replace(Pv,(n,a)=>Nv(n,a,t))}var td={__init__:["myRenderer"],myRenderer:["type",Rn],textRenderer:["type",ed],pathMap:["type",Av]};function nd(e,t){return Fe({id:e.id,type:e.type,businessObject:e},t)}function Ov(e,t,n){const a=e.waypoint;return!a||a.length<2?[Je(t),Je(n)]:a.map(i=>({x:i.x,y:i.y}))}function un(e,t,n,a,i,r){this._eventBus=e,this._canvas=n,this._elementFactory=a,this._elementRegistry=i,this._translate=mc,this._textRenderer=r,this._modeling=t}un.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],un.prototype.add=function(e){let t;const{label:n}=e;if(n&&(n.id=e.id,n.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),i=this._getTarget(e);t=this._elementFactory.createConnection(nd(e,{source:a,target:i,waypoints:Ov(e,a,i)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(nd(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return n&&t&&this.addLabel(n,t),t},un.prototype.addLabel=function(e,t){const n=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(n,t.parent)},un.prototype.update=function(e,t){const n=this._elementRegistry.get(e);n.businessObject=Fe(n.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(n),this._canvas.addConnection(n,n.parent)):(this._canvas.removeShape(n),this._canvas.addShape(n,n.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=n.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,n.parent);else{const{name:i}=t;if(i&&["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:i,id:e},l=this._textRenderer.getExternalLabelBounds(r,t.name);this._modeling.resizeShape(r,l,{width:0,height:0}),n&&this.addLabel(r,n)}}},un.prototype._getSource=function(e){return this._getElement(e.from)},un.prototype._getTarget=function(e){return this._getElement(e.to)},un.prototype._getElement=function(e){return this._elementRegistry.get(e)};var od={myImporter:["type",un]},ad=e=>{const t=[];return e.forEach(n=>{if(n.type!==void 0){const a=n.businessObject;if(n.type==="myline")n.source&&n.target&&(a.from=n.source.id,a.to=n.target.id,a.waypoint=n.waypoints.map(i=>({x:i.x,y:i.y})),t.push(a));else if(n.type!=="label")a.x=n.x,a.y=n.y,t.push(a);else{const i=t.find(r=>r.id===a.id);i&&(i.name=a.name||"",i.label={x:n.x,y:n.y,height:n.height,width:n.width})}}}),t},id=(e,t)=>{const n=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),i=e.filter(r=>r.type==="myline");a.forEach(r=>{n.add(r)}),i.forEach(r=>{n.add(r)})},Iv=(0,o.defineComponent)({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=(0,o.ref)(),l={"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",B=>{i("elementDblclick",B.element.businessObject)}),b.on("element.click",B=>{i("elementClick",B.element.businessObject)})},p=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},f=()=>{let b={__init__:["myOptions"],myOptions:["type",p]};s=new Yo.default({canvas:{container:r.value},modules:[Oi,$s,Zc,cc,fc,b,td,od]});const B=s.get("canvas"),S=s.get("elementFactory");d();const T=S.createRoot();B.setRootElement(T),u()};(0,o.onMounted)(()=>{f()});const h=b=>{const B=b==null?1:c+b;s.get("canvas").zoom(B),c=B},g=()=>(s.get("canvas").zoom(1),ad(s.get("elementRegistry").getAll())),m=b=>{s.clear(),d(),id(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,B)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),Lv=Iv;function ir(e){return e&&e[e.length-1]}function rd(e){return e.y}function ld(e){return e.x}var Hv={left:ld,center:ld,right:function(e){return e.x+e.width},top:rd,middle:rd,bottom:function(e){return e.y+e.height}};function eo(e,t){this._modeling=e,this._rules=t}eo.$inject=["modeling","rules"],eo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",a="width";return t.indexOf(e)!==-1&&(n="y",a="height"),{axis:n,dimension:a}},eo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},eo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),a=n.axis,i=n.dimension,r={},l={},s=!1,c,d,u;function p(f,h){return Math.round((f[a]+h[a]+h[i])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=ir(t),r[e]=u[a]+u[i];else if(this._isType(e,["center","middle"])){if((0,k.forEach)(t,function(f){var h=f[a]+Math.round(f[i]/2);l[h]?l[h].elements.push(f):l[h]={elements:[f],center:h}}),c=(0,k.sortBy)(l,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=ir(c).center,r;d=t[0],t=(0,k.sortBy)(t,function(f){return f[a]+f[i]}),u=ir(t),r[e]=p(d,u)}return r},eo.prototype.trigger=function(e,t){var n=this._modeling,a,i=(0,k.filter)(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:i}),(0,k.isArray)(a)&&(i=a),!(i.length<2||!a)){var r=Hv[t],l=(0,k.sortBy)(i,r),s=this._alignmentPosition(t,l);n.alignElements(l,s)}};var zv={__init__:["alignElements"],alignElements:["type",eo]},Ba=Math.round,Dv=Math.max;function Fv(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 $v(e){var t=[];return e.forEach(function(n,a){t.push([a===0?"M":"L",n.x,n.y])}),t}var sd=10;function Wv(e,t){var n,a;for(n=0;a=e[n];n++)if(mo(a,t)<=sd)return{point:e[n],bendpoint:!0,index:n};return null}function Uv(e,t){var n=Zs(Fv(t,sd),$v(e)),a=n[0],i=n[n.length-1],r;return a?a!==i?a.segment2!==i.segment2?(r=Dv(a.segment2,i.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Ba(a.x+i.x)/2,y:Ba(a.y+i.y)/2},index:a.segment2}:{point:{x:Ba(a.x),y:Ba(a.y)},index:a.segment2}:null}function Jv(e,t){return Wv(e,t)||Uv(e,t)}function Yv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Kv(e,t,n){var a=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],i=a[0].n*t[0]+a[1].n*t[1],r=a[0].lambda*t[0]+a[1].lambda*t[1];return-i/r}function cd(e,t){var n=t[0],a=t[1],i={x:a.x-n.x,y:a.y-n.y},r=Kv([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+r*i.x,y:n.y+r*i.y}}function Gv(e,t){var n=cd(e,t);return Yv({x:n.x-e.x,y:n.y-e.y})}var dd="djs-bendpoint",ud="djs-segment-dragger";function qv(e,t){var n=Un(t),a=e._container.getBoundingClientRect(),i={x:a.left,y:a.top},r=e.viewbox();return{x:r.x+(n.x-i.x)/r.scale,y:r.y+(n.y-i.y)/r.scale}}function rr(e,t,n){return Jv(t,qv(e,n))}function lr(e,t){var n=(0,P.create)("g");(0,P.classes)(n).add(dd),(0,P.append)(e,n);var a=(0,P.create)("circle");(0,P.attr)(a,{cx:0,cy:0,r:4}),(0,P.classes)(a).add("djs-visual"),(0,P.append)(n,a);var i=(0,P.create)("circle");return(0,P.attr)(i,{cx:0,cy:0,r:10}),(0,P.classes)(i).add("djs-hit"),(0,P.append)(n,i),t&&(0,P.classes)(n).add(t),n}function Xv(e,t,n,a){var i=(0,P.create)("g");(0,P.append)(e,i);var r=18,l=6,s=11,c=Qv(t,n,a),d=l+s,u=(0,P.create)("rect");(0,P.attr)(u,{x:-r/2,y:-l/2,width:r,height:l}),(0,P.classes)(u).add("djs-visual"),(0,P.append)(i,u);var p=(0,P.create)("rect");return(0,P.attr)(p,{x:-c/2,y:-d/2,width:c,height:d}),(0,P.classes)(p).add("djs-hit"),(0,P.append)(i,p),Im(i,a==="v"?90:0,0,0),i}function fd(e,t,n){var a=(0,P.create)("g"),i=Ai(t,n),r=Zt(t,n);return(0,P.append)(e,a),Xv(a,t,n,r),(0,P.classes)(a).add(ud),(0,P.classes)(a).add(r==="h"?"horizontal":"vertical"),jt(a,i.x,i.y),a}function sr(e){return Math.abs(Math.round(e*2/3))}function Zv(e,t){return cd(e,eb(e,t))}function Qv(e,t,n){var a=t.x-e.x,i=t.y-e.y;return sr(n==="h"?a:i)}function eb(e,t){for(var n=t.waypoints,a=1/0,i,r=0;r<n.length-1;r++){var l=n[r],s=n[r+1],c=Gv(e,[l,s]);c<a&&(a=c,i=r)}return[n[i],n[i+1]]}function cr(e){return CSS.escape(e)}function pd(e,t,n,a,i){function r(v,C,_){var b=v.index,B=v.point,S,T,A,R,j,O;return b<=0||v.bendpoint?!1:(S=C[b-1],T=C[b],A=Ai(S,T),R=Zt(S,T),j=Math.abs(B.x-A.x),O=Math.abs(B.y-A.y),R&&j<=_&&O<=_)}function l(v,C){var _=v.waypoints,b,B,S,T;return C.index<=0||C.bendpoint||(b={start:_[C.index-1],end:_[C.index]},B=Zt(b.start,b.end),!B)?null:(B==="h"?S=b.end.x-b.start.x:S=b.end.y-b.start.y,T=sr(S)/2,T)}function s(v,C){var _=C.waypoints,b=rr(t,_,v),B;if(b)return B=l(C,b),r(b,_,B)?i.start(v,C,b.index):a.start(v,C,b.index,!b.bendpoint),!0}function c(v,C,_){W.event.bind(v,C,function(b){n.triggerMouseEvent(C,b,_),b.stopPropagation()})}function d(v,C){var _=t.getLayer("overlays"),b=(0,W.query)('.djs-bendpoints[data-element-id="'+cr(v.id)+'"]',_);return!b&&C&&(b=(0,P.create)("g"),(0,P.attr)(b,{"data-element-id":v.id}),(0,P.classes)(b).add("djs-bendpoints"),(0,P.append)(_,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(_,b){var B=lr(v);(0,P.append)(v,B),jt(B,_.x,_.y)}),lr(v,"floating")}function f(v,C){for(var _=C.waypoints,b,B,S,T=1;T<_.length;T++)b=_[T-1],B=_[T],Zt(b,B)&&(S=fd(v,b,B),(0,P.attr)(S,{"data-segment-idx":T}),c(S,"mousemove",C))}function h(v){(0,k.forEach)((0,W.queryAll)("."+dd,v),function(C){(0,P.remove)(C)})}function g(v){(0,k.forEach)((0,W.queryAll)("."+ud,v),function(C){(0,P.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 _=(0,W.query)(".floating",v),b=C.point;_&&jt(_,b.x,b.y)}function x(v,C,_){var b=u(C.index,v),B=_[C.index-1],S=_[C.index],T=C.point,A=Ai(B,S),R=Zt(B,S),j,O;b&&(j=tb(b),O={x:T.x-A.x,y:T.y-A.y},R==="v"&&(O={x:O.y,y:O.x}),jt(j,O.x,O.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var C=d(v.element);C&&(0,P.remove)(C)}),e.on("element.marker.update",function(v){var C=v.element,_;C.waypoints&&(_=m(C),v.add?(0,P.classes)(_).add(v.marker):(0,P.classes)(_).remove(v.marker))}),e.on("element.mousemove",function(v){var C=v.element,_=C.waypoints,b,B;if(_){if(b=d(C,!0),B=rr(t,_,v.originalEvent),!B)return;w(b,B),B.bendpoint||x(b,B,_)}}),e.on("element.mousedown",function(v){if(qt(v)){var C=v.originalEvent,_=v.element;if(_.waypoints)return s(C,_)}}),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),n.registerEvent(v.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(v){n.unregisterEvent(v.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(v){var C=v.element,_=v.newId;if(C.waypoints){var b=d(C);b&&(0,P.attr)(b,{"data-element-id":_})}}),this.addHandles=m,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}pd.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function tb(e){return(0,W.query)(".djs-visual",e)}var hd=Math.round,_n="reconnectStart",Tn="reconnectEnd",_o="updateWaypoints";function dr(e,t,n,a,i,r){this._injector=e,this.start=function(l,s,c,d){var u=n.getGraphics(s),p=s.source,f=s.target,h=s.waypoints,g;!d&&c===0?g=_n:!d&&c===h.length-1?g=Tn:g=_o;var m=g===_o?"connection.updateWaypoints":"connection.reconnect",y=i.allowed(m,{connection:s,source:p,target:f});y===!1&&(y=i.allowed(m,{connection:s,source:f,target:p})),y!==!1&&a.init(l,"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(l){var s=l.context,c=s.connection,d=c.source,u=c.target,p=l.hover,f=s.type;s.hover=p;var h;if(p){var g=f===_o?"connection.updateWaypoints":"connection.reconnect";if(h=s.allowed=i.allowed(g,{connection:c,source:f===_n?p:d,target:f===Tn?p:u}),h){s.source=f===_n?p:d,s.target=f===Tn?p:u;return}h===!1&&(h=s.allowed=i.allowed(g,{connection:c,source:f===Tn?p:u,target:f===_n?p:d})),h&&(s.source=f===Tn?p:u,s.target=f===_n?p:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var s=l.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==_o&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(l){var s=l.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:hd(l.x),y:hd(l.y)};if(!c)return!1;m===_o?(p?f.splice(d,0,w):f[d]=w,y.bendpointMove={insert:p,bendpointIndex:d},f=this.cropWaypoints(u,f),r.updateWaypoints(u,ly(f),y)):(m===_n?(y.docking="source",Ra(s)&&(y.docking="target",y.newWaypoints=f.reverse())):m===Tn&&(y.docking="target",Ra(s)&&(y.docking="source",y.newWaypoints=f.reverse())),r.reconnect(u,h,g,w,y))},this)}dr.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],dr.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Ra(e){var t=e.hover,n=e.source,a=e.target,i=e.type;if(i===_n)return t&&a&&t===a&&n!==a;if(i===Tn)return t&&n&&t===n&&n!==a}var nb="reconnectStart",ob="reconnectEnd",gd="updateWaypoints",To="connect-ok",_a="connect-not-ok",md="connect-hover",yd="djs-updating",vd="djs-dragging",bd=1100;function wd(e,t,n,a){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var l=r.context,s=l.bendpointIndex,c=l.connection,d=l.insert,u=c.waypoints,p=u.slice();l.waypoints=u,d&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p,(0,P.classes)(l.draggerGfx=lr(a.getLayer("overlays"))).add("djs-dragging"),a.addMarker(c,vd),a.addMarker(c,yd)}),n.on("bendpoint.move.hover",function(r){var l=r.context,s=l.allowed,c=l.hover,d=l.type;if(c){if(a.addMarker(c,md),d===gd)return;s?(a.removeMarker(c,_a),a.addMarker(c,To)):s===!1&&(a.removeMarker(c,To),a.addMarker(c,_a))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],bd,function(r){var l=r.context,s=l.hover,c=l.target;s&&(a.removeMarker(s,md),a.removeMarker(s,c?To:_a))}),n.on("bendpoint.move.move",function(r){var l=r.context,s=l.allowed,c=l.bendpointIndex,d=l.draggerGfx,u=l.hover,p=l.type,f=l.connection,h=f.source,g=f.target,m=f.waypoints.slice(),y={x:r.x,y:r.y},w=l.hints||{},x={};i&&(w.connectionStart&&(x.connectionStart=w.connectionStart),w.connectionEnd&&(x.connectionEnd=w.connectionEnd),p===nb?Ra(l)?(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===ob?Ra(l)?(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===gd&&(m=e.cropWaypoints(f,m)),x.waypoints=m,i.drawPreview(l,s,x)),jt(d,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],bd,function(r){var l=r.context,s=l.connection,c=l.draggerGfx,d=l.hover,u=l.target;s.waypoints=l.waypoints,(0,P.remove)(c),a.removeMarker(s,yd),a.removeMarker(s,vd),d&&(a.removeMarker(d,To),a.removeMarker(d,u?To:_a)),i&&i.cleanUp(l)})}wd.$inject=["bendpointMove","injector","eventBus","canvas"];var Cd="connect-hover",xd="djs-updating";function kd(e,t,n){return ur(e,t,e[t]+n)}function ur(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function ab(e,t,n,a){var i=Math.max(t[a],n[a]),r=Math.min(t[a],n[a]),l=20;return ur(t,a,Math.min(Math.max(r+l,e[a]),i-l))}function Sd(e){return e==="x"?"y":"x"}function Ed(e,t,n){var a,i;return e.original?e.original:(a=Je(t),i=Sd(n),ur(e,i,a[i]))}function Bd(e,t,n,a,i,r){var l=e.get("connectionDocking",!1);this.start=function(p,f,h){var g,m=n.getGraphics(f),y=h-1,w=h,x=f.waypoints,v=x[y],C=x[w],_=rr(n,x,p),b=Zt(v,C),B,S;b&&(B=b==="v"?"x":"y",y===0&&(v=Ed(v,f.source,B)),w===x.length-1&&(C=Ed(C,f.target,B)),_?S=_.point:S={x:(v.x+C.x)/2,y:(v.y+C.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:w,segmentStart:v,segmentEnd:C,axis:B,dragPosition:S},a.init(p,S,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:g}}))};function s(p,f){if(!l)return f;var h=p.waypoints,g;return p.waypoints=f,g=l.getCroppedWaypoints(p),p.waypoints=h,g}function c(p){i.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=ab(h,m,y,Sd(p.axis));jt(p.draggerGfx,w.x,w.y)}function u(p,f){var h=0;return{waypoints:p.filter(function(g,m){return Mi(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=n.getLayer("overlays");f.originalWaypoints=h.waypoints.slice(),f.draggerGfx=fd(g,f.segmentStart,f.segmentEnd),(0,P.classes)(f.draggerGfx).add("djs-dragging"),n.addMarker(h,xd)}),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=kd(y,x,p["d"+x]),_=kd(w,x,p["d"+x]),b=v.length,B=0;v[g]=C,v[m]=_;var S,T;g<2&&(S=nn(h.source,C),g===1?S==="intersect"&&(v.shift(),v[0]=C,B--):S!=="intersect"&&(v.unshift(y),B++)),m>b-3&&(T=nn(h.target,_),m===b-2?T==="intersect"&&(v.pop(),v[v.length-1]=_):T!=="intersect"&&v.push(w)),f.newWaypoints=h.waypoints=s(h,v),d(f,B,p),f.newSegmentStartIndex=g+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Cd)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Cd)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,h=f.connection;f.draggerGfx&&(0,P.remove)(f.draggerGfx),n.removeMarker(h,xd)}),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(_){return{original:_.original,x:Math.round(_.x),y:Math.round(_.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)})}Bd.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ib=Math.abs,Rd=Math.round;function rb(e,t,n){n=n===void 0?10:n;var a,i;for(a=0;a<t.length;a++)if(i=t[a],ib(i-e)<=n)return i}function lb(e){return{x:e.x,y:e.y}}function sb(e){return{x:e.x+e.width,y:e.y+e.height}}function to(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Rd(e.x+e.width/2),y:Rd(e.y+e.height/2)}}function Ta(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Yt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var a,i=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,a=n-i,e[t]+=a,e["d"+t]+=a),i}function _d(e){return e.children||[]}var cb=Math.abs,Td=Math.round,fr=10;function Md(e){function t(r,l){if((0,k.isArray)(r)){for(var s=r.length;s--;)if(cb(r[s]-l)<=fr)return r[s]}else{r=+r;var c=l%r;if(c<fr)return l-c;if(c>r-fr)return l-c+r}return l}function n(r,l){if(r.waypoints)return Zv(l,r);if(r.width)return{x:Td(r.width/2+r.x),y:Td(r.height/2+r.y)}}function a(r){var l=r.context,s=l.snapPoints,c=l.connection,d=c.waypoints,u=l.segmentStart,p=l.segmentStartIndex,f=l.segmentEnd,h=l.segmentEndIndex,g=l.axis;if(s)return s;var m=[d[p-1],u,f,d[h+1]];return p<2&&m.unshift(n(c.source,r)),h>d.length-3&&m.unshift(n(c.target,r)),l.snapPoints=s={horizontal:[],vertical:[]},(0,k.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 l=a(r),s=r.x,c=r.y,d,u;if(l){d=t(l.vertical,s),u=t(l.horizontal,c);var p=s-d,f=c-u;(0,k.assign)(r,{dx:r.dx-p,dy:r.dy-f,x:d,y:u}),(p||l.vertical.indexOf(s)!==-1)&&Yt(r,"x",d),(f||l.horizontal.indexOf(c)!==-1)&&Yt(r,"y",u)}});function i(r){var l=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(l)return l;var d=[s[c-1],s[c+1]];return r.snapPoints=l={horizontal:[],vertical:[]},(0,k.forEach)(d,function(u){u&&(u=u.original||u,l.horizontal.push(u.y),l.vertical.push(u.x))}),l}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var l=r.context.hover,s=l&&n(l,r);!yt(l)||!s||!s.x||!s.y||(Yt(r,"x",s.x),Yt(r,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var l=r.context,s=i(l),c=l.hover,d=c&&n(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,k.assign)(r,{dx:r.dx-g,dy:r.dy-m,x:r.x-g,y:r.y-m}),(g||s.vertical.indexOf(u)!==-1)&&Yt(r,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Yt(r,"y",h)}})}Md.$inject=["eventBus"];var db={__depends__:[Cn,qn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",pd],bendpointMove:["type",dr],bendpointMovePreview:["type",wd],connectionSegmentMove:["type",Bd],bendpointSnapping:["type",Md]},ub="djs-dragger";function Kt(e,t,n,a){this._canvas=t,this._graphicsFactory=n,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Kt.$inject=["injector","canvas","graphicsFactory","elementFactory"],Kt.prototype.drawPreview=function(e,t,n){n=n||{};var a=e.connectionPreviewGfx,i=e.getConnection,r=n.source,l=n.target,s=n.waypoints,c=n.connectionStart,d=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,h,g=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),(0,P.clear)(a),i||(i=e.getConnection=fb(function(m,y,w){return g.getConnection(m,y,w)})),t&&(h=i(t,r,l)),!h){!f&&this.drawNoopPreview(a,n);return}h.waypoints=s||[],this._layouter&&!u&&(h.waypoints=this._layouter.layoutConnection(h,{source:r,target:l,connectionStart:c,connectionEnd:d,waypoints:n.waypoints||h.waypoints})),(!h.waypoints||!h.waypoints.length)&&(h.waypoints=[r?Je(r):c,l?Je(l):d]),this._connectionDocking&&(r||l)&&!p&&(h.waypoints=this._connectionDocking.getCroppedWaypoints(h,r,l)),this._graphicsFactory.drawConnection(a,h,{stroke:"var(--element-dragger-color)"})},Kt.prototype.drawNoopPreview=function(e,t){var n=t.source,a=t.target,i=t.connectionStart||Je(n),r=t.connectionEnd||Je(a),l=this.cropWaypoints(i,r,n,a);(0,P.append)(e,this.createNoopConnection(l[0],l[1]))},Kt.prototype.cropWaypoints=function(e,t,n,a){var i=this._graphicsFactory,r=n&&i.getShapePath(n),l=a&&i.getShapePath(a),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&Ni(r,s,!0)||e,t=a&&Ni(l,s,!1)||t,[e,t]},Kt.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&(0,P.remove)(e.connectionPreviewGfx)},Kt.prototype.getConnection=function(e){var t=pb(e);return this._elementFactory.createConnection(t)},Kt.prototype.createConnectionPreviewGfx=function(){var e=(0,P.create)("g");return(0,P.attr)(e,{pointerEvents:"none"}),(0,P.classes)(e).add(ub),(0,P.append)(this._canvas.getActiveLayer(),e),e},Kt.prototype.createNoopConnection=function(e,t){return ki([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function fb(e){var t={};return function(n){var a=JSON.stringify(n),i=t[a];return i||(i=t[a]=e.apply(null,arguments)),i}}function pb(e){return(0,k.isObject)(e)?e:{}}var hb={__init__:["connectionPreview"],connectionPreview:["type",Kt]},gb=new ia("ov"),mb=500;function st(e,t,n,a){this._eventBus=t,this._canvas=n,this._elementRegistry=a,this._ids=gb,this._overlayDefaults=(0,k.assign)({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=yb(n.getContainer()),this._init()}st.$inject=["config.overlays","eventBus","canvas","elementRegistry"],st.prototype.get=function(e){if((0,k.isString)(e)&&(e={id:e}),(0,k.isString)(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?(0,k.filter)(t.overlays,(0,k.matchPattern)({type:e.type})):t.overlays.slice():[]}else return e.type?(0,k.filter)(this._overlays,(0,k.matchPattern)({type:e.type})):e.id?this._overlays[e.id]:null},st.prototype.add=function(e,t,n){if((0,k.isObject)(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return n=(0,k.assign)({},this._overlayDefaults,n,{id:a,type:t,element:e,html:n.html}),this._addOverlay(n),a},st.prototype.remove=function(e){var t=this.get(e)||[];(0,k.isArray)(t)||(t=[t]);var n=this;(0,k.forEach)(t,function(a){var i=n._getOverlayContainer(a.element,!0);if(a&&((0,W.remove)(a.html),(0,W.remove)(a.htmlContainer),delete a.htmlContainer,delete a.element,delete n._overlays[a.id]),i){var r=i.overlays.indexOf(a);r!==-1&&i.overlays.splice(r,1)}})},st.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},st.prototype.show=function(){Ma(this._overlayRoot)},st.prototype.hide=function(){Ma(this._overlayRoot,!1)},st.prototype.clear=function(){this._overlays={},this._overlayContainers=[],(0,W.clear)(this._overlayRoot)},st.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,a=t.x,i=t.y;if(t.waypoints){var r=Nt(t);a=r.x,i=r.y}Ad(n,a,i),(0,W.attr)(e.html,"data-container-id",t.id)},st.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,a=e.element,i=t.left,r=t.top;if(t.right!==void 0){var l;a.waypoints?l=Nt(a).width:l=a.width,i=t.right*-1+l}if(t.bottom!==void 0){var s;a.waypoints?s=Nt(a).height:s=a.height,r=t.bottom*-1+s}Ad(n,i||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},st.prototype._createOverlayContainer=function(e){var t=(0,W.domify)('<div class="djs-overlays" />');(0,W.assignStyle)(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},st.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Pd(this._overlayRoot,n)},st.prototype._getOverlayContainer=function(e,t){var n=(0,k.find)(this._overlayContainers,function(a){return a.element===e});return!n&&!t?this._createOverlayContainer(e):n},st.prototype._addOverlay=function(e){var t=e.id,n=e.element,a=e.html,i,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),(0,k.isString)(a)&&(a=(0,W.domify)(a)),r=this._getOverlayContainer(n),i=(0,W.domify)('<div class="djs-overlay" data-overlay-id="'+t+'">'),(0,W.assignStyle)(i,{position:"absolute"}),i.appendChild(a),e.type&&(0,W.classes)(i).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ma(i,l===s),e.htmlContainer=i,r.overlays.push(e),r.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},st.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,a=this._canvas.findRoot(e.element),i=n&&n.minZoom,r=n&&n.maxZoom,l=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(a!==s||n&&((0,k.isDefined)(i)&&i>t.scale||(0,k.isDefined)(r)&&r<t.scale))&&(c=!1),Ma(l,c),this._updateOverlayScale(e,t)},st.prototype._updateOverlayScale=function(e,t){var n=e.scale,a,i,r=e.htmlContainer,l,s="";n!==!0&&(n===!1?(a=1,i=1):(a=n.min,i=n.max),(0,k.isDefined)(a)&&t.scale<a&&(l=(1/t.scale||1)*a),(0,k.isDefined)(i)&&t.scale>i&&(l=(1/t.scale||1)*i)),(0,k.isDefined)(l)&&(s="scale("+l+","+l+")"),Pd(r,s)},st.prototype._updateOverlaysVisibilty=function(e){var t=this;(0,k.forEach)(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},st.prototype._init=function(){var e=this._eventBus,t=this;function n(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){n(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var i=a.element;(0,k.forEach)(t.get({element:i}),function(s){t.remove(s.id)});var r=t._getOverlayContainer(i);if(r){(0,W.remove)(r.html);var l=t._overlayContainers.indexOf(r);l!==-1&&t._overlayContainers.splice(l,1)}}),e.on("element.changed",mb,function(a){var i=a.element,r=t._getOverlayContainer(i,!0);r&&((0,k.forEach)(r.overlays,function(l){t._updateOverlay(l)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(a){var i=t._getOverlayContainer(a.element,!0);i&&(0,W.classes)(i.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 yb(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 Ad(e,t,n){(0,W.assignStyle)(e,{left:t+"px",top:n+"px"})}function Ma(e,t){e.style.display=t===!1?"none":""}function Pd(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}var vb={__init__:["overlays"],overlays:["type",st]},bb=new ia;function no(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}no.$inject=["eventBus"],no.prototype.schedule=function(e,t=bb.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},no.prototype._schedule=function(e,t){const n=wb();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(a){n.reject(a)}}catch(a){console.error("Scheduler#_schedule execution failed",a)}}),promise:n.promise}},no.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},no.prototype._cancel=function(e){clearTimeout(e.executionId)};function wb(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}var Cb={scheduler:["type",no]},xb="djs-element-hidden",Aa=".entry",kb=1e3,Vd=8,Sb=300;function et(e,t,n,a){this._canvas=e,this._elementRegistry=t,this._eventBus=n,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 n=t.newSelection,a=n.length?n.length===1?n[0]:n:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,a=e._current;if(a){var i=a.target,r=(0,k.isArray)(i)?i:[i];if(r.filter(function(s){return n.includes(s)}).length){e.close();var l=r.filter(function(s){return e._elementRegistry.get(s.id)});l.length&&e._updateAndOpen(l.length>1?l:l[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,a=e._current;((0,k.isArray)(a.target)?a.target:[a.target]).includes(n)&&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=kb),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},et.prototype.getEntries=function(e){var t=this._getProviders(),n=(0,k.isArray)(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return(0,k.forEach)(t,function(i){if((0,k.isFunction)(i[n])){var r=i[n](e);(0,k.isFunction)(r)?a=r(a):(0,k.forEach)(r,function(l,s){a[s]=l})}}),a},et.prototype.trigger=function(e,t,n){var a=this,i,r,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(i=(0,W.attr)(l,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(i,"hover",r,n)},Sb);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,n)},et.prototype.triggerEntry=function(e,t,n,a){if(this.isShown()){var i=this._current.target,r=this._current.entries[e];if(r){var l=r.action;if(this._eventBus.fire("contextPad.trigger",{entry:r,event:n})!==!1){if((0,k.isFunction)(l)){if(t==="click")return l(n,i,a)}else if(l[t])return l[t](n,i,a);n.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),n=this._createHtml(e),a;(0,k.forEach)(t,function(i,r){var l=i.group||"default",s=(0,W.domify)(i.html||'<div class="entry" draggable="true"></div>'),c;(0,W.attr)(s,"data-action",r),c=(0,W.query)("[data-group="+cr(l)+"]",n),c||(c=(0,W.domify)('<div class="group"></div>'),(0,W.attr)(c,"data-group",l),n.appendChild(c)),c.appendChild(s),i.className&&Eb(s,i.className),i.title&&(0,W.attr)(s,"title",i.title),i.imageUrl&&(a=(0,W.domify)("<img>"),(0,W.attr)(a,"src",i.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),(0,W.classes)(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},et.prototype._createHtml=function(e){var t=this,n=(0,W.domify)('<div class="djs-context-pad"></div>');return W.delegate.bind(n,Aa,"click",function(a){t.trigger("click",a)}),W.delegate.bind(n,Aa,"dragstart",function(a){t.trigger("dragstart",a)}),W.delegate.bind(n,Aa,"mouseover",function(a){t.trigger("mouseover",a)}),W.delegate.bind(n,Aa,"mouseout",function(a){t.trigger("mouseout",a)}),W.event.bind(n,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},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()&&Rb(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 n=t.target;return(0,k.isArray)(e)!==(0,k.isArray)(n)?!1:(0,k.isArray)(e)?e.length===n.length&&(0,k.every)(e,function(a){return n.includes(a)}):n===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,k.isArray)(e)&&yt(e)){var t=this._canvas.viewbox(),n=Bb(e),a=n.x*t.scale-t.x*t.scale,i=n.y*t.scale-t.y*t.scale;return{left:a+Vd*this._canvas.zoom(),top:i}}var r=this._canvas.getContainer().getBoundingClientRect(),l=this._getTargetBounds(e);return{left:l.right-r.left+Vd*this._canvas.zoom(),top:l.top-r.top}},et.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(a){a in n&&(t.style[a]=n[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},et.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target;((0,k.isArray)(n)?n:[n]).some(function(a){return t._canvas.hasMarker(a,xb)})?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},et.prototype._getTargetBounds=function(e){var t=this;return((0,k.isArray)(e)?e:[e]).map(function(n){return t._canvas.getGraphics(n)}).reduce(function(n,a){const i=a.getBoundingClientRect();return n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n.left=Math.min(n.left,i.left),n.x=n.left,n.y=n.top,n.width=n.right-n.left,n.height=n.bottom-n.top,n},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Eb(e,t){var n=(0,W.classes)(e);t=(0,k.isArray)(t)?t:t.split(/\s+/g),t.forEach(function(a){n.add(a)})}function Bb(e){return e.waypoints[e.waypoints.length-1]}function Rb(e,t){return e=(0,k.isArray)(e)?e:[e],t=(0,k.isArray)(t)?t:[t],e.length===t.length&&(0,k.every)(e,function(n){return t.includes(n)})}var _b={__depends__:[Si,Cb,vb],contextPad:["type",et]},Tb=250;function Mn(e){this._eventBus=e,this._tools=[],this._active=null}Mn.$inject=["eventBus"],Mn.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Mn.prototype.isActive=function(e){return e&&this._active===e},Mn.prototype.length=function(e){return this._tools.length},Mn.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Mn.prototype.bindEvents=function(e,t){var n=this._eventBus,a=[];n.on(t.tool+".init",function(i){if(!i.context.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),(0,k.forEach)(t,function(i){a.push(i+".ended"),a.push(i+".canceled")}),n.on(a,Tb,function(i){this._active&&(Mb(i)||this.setActive(null))},this)};function Mb(e){var t=e.originalEvent&&e.originalEvent.target;return t&&(0,W.closest)(t,'.group[data-group="tools"]')}var pr={__depends__:[Cn],__init__:["toolManager"],toolManager:["type",Mn]};function hr(e){var t=this;this._lastMoveEvent=null;function n(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){(t._svg=a.svg).addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}hr.$inject=["eventBus"],hr.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Ab(0,0)};function Ab(e,t){var n=document.createEvent("MouseEvent"),a=e,i=t,r=e,l=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,a,i,r,l,!1,!1,!1,!1,0,null),n}var gr={__init__:["mouse"],mouse:["type",hr]},mr=1500,Nd="grab";function oo(e,t,n,a,i,r){this._dragging=n,this._mouse=r;var l=this,s=a.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",mr,function(c){if(vs(c))return l.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(mr,function(c){if(!(!jd(c.keyEvent)||l.isActive())){var d=l._mouse.getLastMoveEvent();l.activateMove(d,!!d)}},"keyboard.keydown"),s&&s.addListener(mr,function(c){!jd(c.keyEvent)||!l.isActive()||l.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(){l.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!vs(c)&&d&&e.once("hand.move.ended",function(u){l.activateHand(u.originalEvent,!0,!0)}),!1})}oo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],oo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Nd,data:{context:n||{}}})},oo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Nd,data:{context:{reactivate:n}}})},oo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},oo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function jd(e){return Ms("Space",e)}var Pb={__depends__:[pr,gr],__init__:["handTool"],handTool:["type",oo]},Od="crosshair";function An(e,t,n,a,i,r,l){this._selection=i,this._dragging=n,this._mouse=l;var s=this,c={create:function(d){var u=t.getActiveLayer(),p=d.frame=(0,P.create)("rect");(0,P.attr)(p,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),(0,P.append)(u,p)},update:function(d){var u=d.frame,p=d.bbox;(0,P.attr)(u,{x:p.x,y:p.y,width:p.width,height:p.height})},remove:function(d){d.frame&&(0,P.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=yr(d),f=a.filter(function(g){return g}),h=wi(d);s.select(f,p,h?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=yr(d),c.create(u),u.selection=i.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=yr(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(wi(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:Od,data:{context:{}}})},An.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Od,data:{context:{}},keepSelection:!0})},An.prototype.select=function(e,t,n=[]){var a=Am(e,t);this._selection.select([...n,...(0,k.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 yr(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},a;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?a={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?a={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?a={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?a={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:a={x:n.x,y:n.y,width:0,height:0},a}var Vb={__depends__:[pr,gr],__init__:["lassoTool"],lassoTool:["type",An]},Id="connect-ok",Ld="connect-not-ok";function ao(e,t,n,a,i,r,l){var s=this;this._dragging=t,this._rules=r,this._mouse=l,i.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?Id:Ld))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var d=c.context.startTarget,u=c.context.canStartConnect;d&&a.removeMarker(d,u?Id:Ld)}),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")}),n.start(null,d,u)}),!1})}ao.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ao.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ao.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ao.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ao.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Nb={__depends__:[Oi,qn,Cn,pr,gr],globalConnect:["type",ao]},jb=500,Ob=1e3;function Pn(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),a=this;function i(r){var l=(0,P.create)("rect");return(0,P.attr)(l,(0,k.assign)({x:0,y:0,rx:4,width:100,height:100},n)),l}e.on(["shape.added","shape.changed"],jb,function(r){var l=r.element,s=r.gfx,c=(0,W.query)(".djs-outline",s);c||(c=a.getOutline(l)||i(s),(0,P.append)(s,c)),a.updateShapeOutline(c,l)}),e.on(["connection.added","connection.changed"],function(r){var l=r.element,s=r.gfx,c=(0,W.query)(".djs-outline",s);c||(c=i(s),(0,P.append)(s,c)),a.updateConnectionOutline(c,l)})}Pn.prototype.updateShapeOutline=function(e,t){var n=!1,a=this._getProviders();a.length&&(0,k.forEach)(a,function(i){n=n||i.updateOutline(t,e)}),n||(0,P.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 n=Nt(t);(0,P.attr)(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+this.offset*2,height:n.height+this.offset*2})},Pn.prototype.registerProvider=function(e,t){t||(t=e,e=Ob),this._eventBus.on("outline.getProviders",e,function(n){n.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,k.forEach)(this._getProviders(),function(n){(0,k.isFunction)(n.getOutline)&&(t=t||n.getOutline(e))}),t},Pn.$inject=["eventBus","styles","elementRegistry"];var Pa=6;function vr(e,t,n){this._canvas=t;var a=this;e.on("element.changed",function(i){n.isSelected(i.element)&&a._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(i){var r=i.newSelection;a._updateMultiSelectionOutline(r)})}vr.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");(0,P.clear)(t);var n=e.length>1;if((0,P.classes)(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),!!n){var a=Ib(Nt(e)),i=(0,P.create)("rect");(0,P.attr)(i,(0,k.assign)({rx:3},a)),(0,P.classes)(i).add("djs-selection-outline"),(0,P.append)(t,i)}},vr.$inject=["eventBus","canvas","selection"];function Ib(e){return{x:e.x-Pa,y:e.y-Pa,width:e.width+Pa*2,height:e.height+Pa*2}}var Hd={__depends__:[Yn],__init__:["outline","multiSelectionOutline"],outline:["type",Pn],multiSelectionOutline:["type",vr]},Lb=500,Hb=1250,zb=1500,Va=Math.round;function Db(e){return{x:e.x+Va(e.width/2),y:e.y+Va(e.height/2)}}function zd(e,t,n,a,i){function r(s,c,d,u){return i.allowed("elements.move",{shapes:s,delta:c,position:d,target:u})}e.on("shape.move.start",zb,function(s){var c=s.context,d=s.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=Fb(u),(0,k.assign)(c,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",Hb,function(s){var c=s.context,d=c.validatedShapes;if(!(c.canExecute=r(d)))return!1}),e.on("shape.move.move",Lb,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=Va(d.x),d.y=Va(d.y),!(d.x===0&&d.y===0)&&n.moveElements(f,d,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(qt(s)){var c=Wn(s);if(!c)throw new Error("must supply DOM mousedown event");return l(c,s.element)}});function l(s,c,d,u){if((0,k.isObject)(d)&&(u=d,d=!1),!(c.waypoints||!c.parent)&&!(0,P.classes)(s.target).has("djs-hit-no-move")){var p=Db(c);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:c,context:u||{}}}),!0}}this.start=l}zd.$inject=["eventBus","dragging","modeling","selection","rules"];function Fb(e){var t=(0,k.groupBy)(e,"id");return(0,k.filter)(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Dd=499,br="djs-dragging",Fd="drop-ok",$d="drop-not-ok",Wd="new-parent",Ud="attach-ok";function Jd(e,t,n,a){function i(c){return $b(r(c))}function r(c){var d=Tm(c,!0),u=d.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=d.concat(u);return[...new Set(p)]}function l(c,d){[Ud,Fd,$d,Wd].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,br),c.allDraggedElements?c.allDraggedElements.push(d):c.allDraggedElements=[d]}e.on("shape.move.start",Dd,function(c){var d=c.context,u=d.shapes,p=d.allDraggedElements,f=i(u);if(!d.dragGroup){var h=(0,P.create)("g");(0,P.attr)(h,n.cls("djs-drag-group",["no-events"])),(0,P.append)(t.getActiveLayer(),h),d.dragGroup=h}f.forEach(function(g){a.addDragger(g,d.dragGroup)}),p?p=(0,k.flatten)([p,r(u)]):p=r(u),(0,k.forEach)(p,function(g){t.addMarker(g,br)}),d.allDraggedElements=p,d.differentParents=Wb(u)}),e.on("shape.move.move",Dd,function(c){var d=c.context,u=d.dragGroup,p=d.target,f=d.shape.parent,h=d.canExecute;p&&(h==="attach"?l(p,Ud):d.canExecute&&f&&p.id!==f.id?l(p,Wd):l(p,d.canExecute?Fd:$d)),jt(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var d=c.context.target;d&&l(d,null)}),e.on("shape.move.cleanup",function(c){var d=c.context,u=d.allDraggedElements,p=d.dragGroup;(0,k.forEach)(u,function(f){t.removeMarker(f,br)}),p&&(0,P.remove)(p)}),this.makeDraggable=s}Jd.$inject=["eventBus","canvas","styles","previewSupport"];function $b(e){return(0,k.filter)(e,function(t){return yt(t)?(0,k.find)(e,(0,k.matchPattern)({id:t.source.id}))&&(0,k.find)(e,(0,k.matchPattern)({id:t.target.id})):!0})}function Wb(e){return(0,k.size)((0,k.groupBy)(e,function(t){return t.parent&&t.parent.id}))!==1}var Ub={__depends__:[Si,Yn,Hd,qn,Cn,Ri],__init__:["move","movePreview"],move:["type",zd],movePreview:["type",Jd]},Yd=".djs-palette-toggle",Kd=".entry",Jb=Yd+", "+Kd,wr="djs-palette-",Yb="shown",Cr="open",Gd="two-column",Kb=1e3;function tt(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(a){var i=a.tool;n.updateToolHighlight(i)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}tt.$inject=["eventBus","canvas"],tt.prototype.registerProvider=function(e,t){t||(t=e,e=Kb),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},tt.prototype.getEntries=function(){return this._getProviders().reduce(qb,{})},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,n=this._getParentContainer(),a=this._container=(0,W.domify)(tt.HTML_MARKUP);n.appendChild(a),(0,W.classes)(n).add(wr+Yb),W.delegate.bind(a,Jb,"click",function(i){var r=i.delegateTarget;if((0,W.matches)(r,Yd))return e.toggle();e.trigger("click",i)}),W.event.bind(a,"mousedown",function(i){i.stopPropagation()}),W.delegate.bind(a,Kd,"dragstart",function(i){e.trigger("dragstart",i)}),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(),n=this._container,a=this._eventBus,i,r=(0,W.classes)(n),l=(0,W.classes)(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(Gd,i),l.toggle(wr+Gd,i),"open"in e&&(r.toggle(Cr,e.open),l.toggle(wr+Cr,e.open)),a.fire("palette.changed",{twoColumn:i,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,k.forEach)(t,function(n,a){var i=n.group||"default",r=(0,W.query)("[data-group="+cr(i)+"]",e);r||(r=(0,W.domify)('<div class="group"></div>'),(0,W.attr)(r,"data-group",i),e.appendChild(r));var l=(0,W.domify)(n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'));if(r.appendChild(l),!n.separator&&((0,W.attr)(l,"data-action",a),n.title&&(0,W.attr)(l,"title",n.title),n.className&&Gb(l,n.className),n.imageUrl)){var s=(0,W.domify)("<img>");(0,W.attr)(s,"src",n.imageUrl),l.appendChild(s)}}),this.open()},tt.prototype.trigger=function(e,t,n){var a,i,r=t.delegateTarget||t.target;return r?(a=(0,W.attr)(r,"data-action"),i=t.originalEvent||t,this.triggerEntry(a,e,i,n)):t.preventDefault()},tt.prototype.triggerEntry=function(e,t,n,a){var i=this._entries[e],r;if(i&&(r=i.action,this._eventBus.fire("palette.trigger",{entry:i,event:n})!==!1)){if((0,k.isFunction)(r)){if(t==="click")return r(n,a)}else if(r[t])return r[t](n,a);n.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,n;this._toolsContainer||(t=(0,W.query)(".djs-palette-entries",this._container),this._toolsContainer=(0,W.query)("[data-group=tools]",t)),n=this._toolsContainer,(0,k.forEach)(n.children,function(a){var i=a.getAttribute("data-action");if(i){var r=(0,W.classes)(a);i=i.replace("-tool",""),r.contains("entry")&&i===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},tt.prototype.isOpen=function(){return(0,W.classes)(this._container).has(Cr)},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 Gb(e,t){var n=(0,W.classes)(e);((0,k.isArray)(t)?t:t.split(/\s+/g)).forEach(function(a){n.add(a)})}function qb(e,t){var n=t.getPaletteEntries();return(0,k.isFunction)(n)?n(e):((0,k.forEach)(n,function(a,i){e[i]=a}),e)}var Xb={__init__:["palette"],palette:["type",tt]};function qd(e,t,n,a){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Pm(r)+".changed",i)}),e.on("elements.changed",function(i){var r=i.elements;r.forEach(function(l){e.fire("element.changed",{element:l})}),a.updateContainments(r)}),e.on("shape.changed",function(i){a.update("shape",i.element,i.gfx)}),e.on("connection.changed",function(i){a.update("connection",i.element,i.gfx)})}qd.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Zb={__init__:["changeSupport"],changeSupport:["type",qd]},Na=Math.max,ja=Math.min,Qb=20;function ew(e,t,n){var a=n.x,i=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+i,r.height=e.height-i):t.indexOf("s")!==-1&&(r.height=e.height+i),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 Oa(e,t,n){var a=t[e],i=n.min&&n.min[e],r=n.max&&n.max[e];return(0,k.isNumber)(i)&&(a=(/top|left/.test(e)?ja:Na)(a,i)),(0,k.isNumber)(r)&&(a=(/top|left/.test(e)?Na:ja)(a,r)),a}function tw(e,t){if(!t)return e;var n=Ve(e);return oc({top:Oa("top",n,t),right:Oa("right",n,t),bottom:Oa("bottom",n,t),left:Oa("left",n,t)})}function nw(e,t,n,a){var i=Ve(t),r={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},l=a?Ve(a):r;return oc({top:ja(r.top,l.top),left:ja(r.left,l.left),bottom:Na(r.bottom,l.bottom),right:Na(r.right,l.right)})}function Mo(e,t){return typeof e<"u"?e:Qb}function ow(e,t){var n,a,i,r;return typeof t=="object"?(n=Mo(t.left),a=Mo(t.right),i=Mo(t.top),r=Mo(t.bottom)):n=a=i=r=Mo(t),{x:e.x-n,y:e.y-i,width:e.width+n+a,height:e.height+i+r}}function aw(e){return!(e.waypoints||e.type==="label")}function iw(e,t){var n;if(e.length===void 0?n=(0,k.filter)(e.children,aw):n=e,n.length)return ow(Nt(n),t)}var Xd=10;function Ao(e,t,n,a){this._dragging=a,this._rules=t;var i=this;function r(c,d){var u=c.shape,p=c.direction,f=c.resizeConstraints,h;c.delta=d,h=ew(u,p,d),c.newBounds=tw(h,f),c.canExecute=i.canResize(c)}function l(c){var d=c.resizeConstraints,u=c.minBounds;d===void 0&&(u===void 0&&(u=i.computeMinResizeBox(c)),c.resizeConstraints={min:Ve(u)})}function s(c){var d=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=oy(p),!rw(d,p))return;n.resizeShape(d,p)}}e.on("resize.start",function(c){l(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)})}Ao.prototype.canResize=function(e){var t=this._rules,n=(0,k.pick)(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ao.prototype.activate=function(e,t,n){var a=this._dragging,i,r;if(typeof n=="string"&&(n={direction:n}),i=(0,k.assign)({shape:t},n),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,Zd(t,r),"resize",{autoActivate:!0,cursor:lw(r),data:{shape:t,context:i}})},Ao.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction;return nw(n,t,e.minDimensions||{width:Xd,height:Xd},iw(t,e.childrenBoxPadding))},Ao.$inject=["eventBus","rules","modeling","dragging"];function rw(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Zd(e,t){var n=Je(e),a=Ve(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function lw(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 Qd="djs-resizing",eu="resize-not-ok",sw=500;function tu(e,t,n){function a(r){var l=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(l,t.getActiveLayer()),t.addMarker(l,Qd)),s.width>5&&(0,P.attr)(c,{x:s.x,width:s.width}),s.height>5&&(0,P.attr)(c,{y:s.y,height:s.height}),r.canExecute?(0,P.classes)(c).remove(eu):(0,P.classes)(c).add(eu)}function i(r){var l=r.shape;r.frame&&(0,P.remove)(r.frame),t.removeMarker(l,Qd)}e.on("resize.move",sw,function(r){a(r.context)}),e.on("resize.cleanup",function(r){i(r.context)})}tu.$inject=["eventBus","canvas","previewSupport"];var Ia=-6,La=8,Ha=20,Po="djs-resizer",cw=["n","w","s","e","nw","ne","se","sw"];function fn(e,t,n,a){this._resize=a,this._canvas=t;var i=this;e.on("selection.changed",function(r){var l=r.newSelection;i.removeResizers(),l.length===1&&(0,k.forEach)(l,(0,k.bind)(i.addResizer,i))}),e.on("shape.changed",function(r){var l=r.element;n.isSelected(l)&&(i.removeResizers(),i.addResizer(l))})}fn.prototype.makeDraggable=function(e,t,n){var a=this._resize;function i(r){qt(r)&&a.activate(r,e,n)}W.event.bind(t,"mousedown",i),W.event.bind(t,"touchstart",i)},fn.prototype._createResizer=function(e,t,n,a){var i=this._getResizersParent(),r=dw(a),l=(0,P.create)("g");(0,P.classes)(l).add(Po),(0,P.classes)(l).add(Po+"-"+e.id),(0,P.classes)(l).add(Po+"-"+a),(0,P.append)(i,l);var s=(0,P.create)("rect");(0,P.attr)(s,{x:-La/2+r.x,y:-La/2+r.y,width:La,height:La}),(0,P.classes)(s).add(Po+"-visual"),(0,P.append)(l,s);var c=(0,P.create)("rect");return(0,P.attr)(c,{x:-Ha/2+r.x,y:-Ha/2+r.y,width:Ha,height:Ha}),(0,P.classes)(c).add(Po+"-hit"),(0,P.append)(l,c),Om(l,t,n),l},fn.prototype.createResizer=function(e,t){var n=Zd(e,t),a=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,a,t)},fn.prototype.addResizer=function(e){var t=this;yt(e)||!this._resize.canResize({shape:e})||(0,k.forEach)(cw,function(n){t.createResizer(e,n)})},fn.prototype.removeResizers=function(){(0,P.clear)(this._getResizersParent())},fn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},fn.$inject=["eventBus","canvas","selection","resize"];function dw(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ia:e.indexOf("w")!==-1&&(t.x=Ia),e.indexOf("s")!==-1?t.y=-Ia:e.indexOf("n")!==-1&&(t.y=Ia),t}var uw={__depends__:[qn,Cn,Ri],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ao],resizePreview:["type",tu],resizeHandles:["type",fn]};function Vo(e,t,n,a,i,r){this._canvas=t,this._modeling=a,this._textRenderer=r,n.registerProvider(this),e.on("element.dblclick",s=>{l(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{n.isActive()&&n.complete()}),e.on(["commandStack.changed"],()=>{n.isActive()&&n.cancel()}),e.on("directEditing.activate",()=>{i.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||l(u))}),e.on("autoPlace.end",500,s=>{l(s.shape)});function l(s,c){(c||Xi(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&n.activate(s)}}Vo.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],Vo.prototype.activate=function(e){const t=wa(e);if(t===void 0)return;const n={text:t};Fe(n,this.getEditingBBox(e));const a={};return(Xi(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Fe(a,{centerVertically:!0}),Zi(e)&&Fe(a,{autoResize:!0}),Fe(n,{options:a}),n},Vo.prototype.getEditingBBox=function(e){const t=this._canvas,n=e.label||e,a=t.getAbsoluteBBox(n),i={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},l=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),d=c.fontSize*l,u=c.lineHeight,p=s.fontSize*l,f=s.lineHeight,h={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Xi(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Fe(r,{width:a.width,height:a.height}),Fe(h,{fontSize:p+"px",lineHeight:f,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));const g=90*l,m=7*l,y=4*l;if(n.labelTarget&&(Fe(r,{width:g,height:a.height+m+y,x:i.x-g/2,y:a.y-m}),Fe(h,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})),Zi(n)&&!Hc(n)&&!Bo(n)){const w=zc(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),v=d+m+y;Fe(r,{width:g,height:v,x:x.x-g/2,y:x.y-v/2}),Fe(h,{fontSize:d+"px",lineHeight:u,paddingTop:m+"px",paddingBottom:y+"px"})}return{bounds:r,style:h}},Vo.prototype.update=function(e,t){let n;fw(t)&&(t=null),this._modeling.updateLabel(e,t,n)};function fw(e){return!e||!e.trim()}var pw={__depends__:[Zb,uw,ri.default],__init__:["labelEditingProvider"],labelEditingProvider:["type",Vo]};function pn(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}pn.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},pn.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},pn.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},pn.prototype.getSnapLocations=function(){return this._snapLocations},pn.prototype.setSnapLocations=function(e){this._snapLocations=e},pn.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new za,n.initDefaults(this._defaultSnaps)),n};function za(){this._snapValues={}}za.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},za.prototype.snap=function(e,t,n,a){var i=this._snapValues[t];return i&&rb(e[n],i[n],a)},za.prototype.initDefaults=function(e){var t=this;(0,k.forEach)(e||{},function(n,a){(0,k.forEach)(n,function(i){t.add(a,i)})})};var hw=1250;function Ht(e,t,n){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(i){a.initSnap(i)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],hw,function(i){var r=i.context,l=r.shape,s=r.snapContext,c=r.target;if(!(i.originalEvent&&Ts(i.originalEvent))&&!(Ta(i)||!c)){var d=s.pointsForTarget(c);d.initialized||(d=a.addSnapTargetPoints(d,l,c),d.initialized=!0),n.snap(i,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ht.$inject=["elementRegistry","eventBus","snapping"],Ht.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,a=n.shape,i=n.snapContext;i||(i=n.snapContext=new pn);var r;t.get(a.id)?r=to(a,e):r={x:e.x+to(a).x,y:e.y+to(a).y};var l={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 i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),Xn(a)||(i.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),i.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),i},Ht.prototype.addSnapTargetPoints=function(e,t,n){return(0,k.forEach)(this.getSnapTargets(t,n),function(a){if(Xn(a)){Xn(t)&&e.add("mid",to(a));return}if(yt(a)){if(a.waypoints.length<3)return;(0,k.forEach)(a.waypoints.slice(1,-1),function(i){e.add("mid",i)});return}e.add("mid",to(a))}),!(0,k.isNumber)(t.x)||!(0,k.isNumber)(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",to(t)),e},Ht.prototype.getSnapTargets=function(e,t){return _d(t).filter(function(n){return!gw(n)})};function gw(e){return!!e.hidden}function io(e){e.invoke(Ht,this)}(0,$t.default)(io,Ht),io.$inject=["injector"],io.prototype.initSnap=function(e){return Ht.prototype.initSnap.call(this,e)},io.prototype.addSnapTargetPoints=function(e,t,n){return Ht.prototype.addSnapTargetPoints.call(this,e,t,n)},io.prototype.getSnapTargets=function(e,t){return Ht.prototype.getSnapTargets.call(this,e,t)};var mw=1250;function No(e,t){var n=this;e.on(["resize.start"],function(a){n.initSnap(a)}),e.on(["resize.move","resize.end"],mw,function(a){var i=a.context,r=i.shape,l=r.parent,s=i.direction,c=i.snapContext;if(!(a.originalEvent&&Ts(a.originalEvent))&&!Ta(a)){var d=c.pointsForTarget(l);d.initialized||(d=n.addSnapTargetPoints(d,r,l,s),d.initialized=!0),bw(s)&&Yt(a,"x",a.x),ww(s)&&Yt(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}No.prototype.initSnap=function(e){var t=e.context,n=t.shape,a=t.direction,i=t.snapContext;i||(i=t.snapContext=new pn);var r=nu(n,a);return i.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),i},No.prototype.addSnapTargetPoints=function(e,t,n,a){return(0,k.forEach)(this.getSnapTargets(t,n),function(i){e.add("corner",sb(i)),e.add("corner",lb(i))}),e.add("corner",nu(t,a)),e},No.$inject=["eventBus","snapping"],No.prototype.getSnapTargets=function(e,t){return _d(t).filter(function(n){return!yw(n,e)&&!yt(n)&&!vw(n)&&!Xn(n)})};function nu(e,t){var n=Je(e),a=Ve(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function yw(e,t){return e.host===t}function vw(e){return!!e.hidden}function bw(e){return e==="n"||e==="s"}function ww(e){return e==="e"||e==="w"}var Cw=7,xw=1e3;function hn(e){this._canvas=e,this._asyncHide=(0,k.debounce)((0,k.bind)(this.hide,this),xw)}hn.$inject=["canvas"],hn.prototype.snap=function(e,t){var n=e.context.snapContext,a=n.getSnapLocations(),i={x:Ta(e,"x"),y:Ta(e,"y")};(0,k.forEach)(a,function(r){var l=n.getSnapOrigin(r),s={x:e.x+l.x,y:e.y+l.y};if((0,k.forEach)(["x","y"],function(c){var d;i[c]||(d=t.snap(s,r,c,Cw),d!==void 0&&(i[c]={value:d,originValue:d-l[c]}))}),i.x&&i.y)return!1}),this.showSnapLine("vertical",i.x&&i.x.value),this.showSnapLine("horizontal",i.y&&i.y.value),(0,k.forEach)(["x","y"],function(r){var l=i[r];(0,k.isObject)(l)&&Yt(e,r,l.originValue)})},hn.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=(0,P.create)("path");return(0,P.attr)(n,{d:"M0,0 L0,0"}),(0,P.classes)(n).add("djs-snap-line"),(0,P.append)(t,n),{update:function(a){(0,k.isNumber)(a)?e==="horizontal"?(0,P.attr)(n,{d:"M-100000,"+a+" L+100000,"+a,display:""}):(0,P.attr)(n,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):(0,P.attr)(n,{display:"none"})}}},hn.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},hn.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},hn.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},hn.prototype.hide=function(){(0,k.forEach)(this._snapLines,function(e){e.update()})};var kw={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ht],resizeSnapping:["type",No],snapping:["type",hn]},Sw={__depends__:[kw],__init__:["createMoveSnapping"],createMoveSnapping:["type",io]};function ro(e){dt.call(this,e),this.init()}ro.$inject=["eventBus"],xn(ro,dt),ro.prototype.addRule=function(e,t,n){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){a.canExecute(i,t,function(r,l,s){return n(r)},!0)})},ro.prototype.init=function(){};function jo(e){ro.call(this,e)}jo.$inject=["eventBus"],(0,$t.default)(jo,ro),jo.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,n=e.target,a=e.hints||{},i=a.targetParent;if(a.targetAttach)return!1;i&&(n.parent=i);try{return xr(t,n)}finally{i&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,a=e.target;return xr(n,a,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,n=e.shape;return t.parent&&(t=parent),!(n.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==n.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return Vm(t)})},jo.prototype.canConnect=xr;function xr(e,t,n){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}var Ew={__init__:["myRuleProvider"],myRuleProvider:["type",jo]};function kr(e,t,n,a,i,r,l){this._create=e,this._elementFactory=t,this._handTool=n,this._lassoTool=a,this._globalConnect=i,this._palette=r,this._myOptions=l,r.registerProvider(this)}kr.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],kr.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,n=this._handTool,a=this._lassoTool,i=this._globalConnect,r=this._myOptions;function l(c,d,u,p,f){function h(g){const m=t.createShape(Fe({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){n.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){i.toggle(c)}}},"tool-separator":{group:"tools",separator:!0}};for(const c in r.palette){const d=r.palette[c];s[c]=l(d.type,d.group,d.className,d.title,d.options)}return s};var Bw={__init__:["paletteProvider"],paletteProvider:["type",kr]},rC=50,Rw=250;function _w(e,t){t||(t={});function n(f){return f.source===e?1:-1}var a=t.defaultDistance||50,i=t.direction||"e",r=t.filter,l=t.getWeight||n,s=t.maxDistance||Rw,c=t.reference||"start";r||(r=Tw);function d(f,h){return i==="n"?c==="start"?Ve(f).top-Ve(h).bottom:c==="center"?Ve(f).top-Je(h).y:Ve(f).top-Ve(h).top:i==="w"?c==="start"?Ve(f).left-Ve(h).right:c==="center"?Ve(f).left-Je(h).x:Ve(f).left-Ve(h).left:i==="s"?c==="start"?Ve(h).top-Ve(f).bottom:c==="center"?Je(h).y-Ve(f).bottom:Ve(h).bottom-Ve(f).bottom:c==="start"?Ve(h).left-Ve(f).right:c==="center"?Je(h).x-Ve(f).right:Ve(h).right-Ve(f).right}var u=e.incoming.filter(r).map(function(f){var h=l(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=l(f),g=h>0?d(e,f.target):d(f.target,e);return{id:f.target.id,distance:g,weight:h}});return(0,k.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 Tw(){return!0}var Mw=100;function ou(e,t,n){e.on("autoPlace",Mw,function(a){var i=a.shape,r=a.source;return Aw(r,i)}),e.on("autoPlace.end",function(a){n.scrollToElement(a.shape)}),this.append=function(a,i,r){e.fire("autoPlace.start",{source:a,shape:i});var l=e.fire("autoPlace",{source:a,shape:i}),s=t.appendShape(a,i,l,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:s}),s}}ou.$inject=["eventBus","modeling","canvas"];function Aw(e,t,n){n||(n={});var a=n.defaultDistance||50,i=Je(e);return{x:Ve(e).right+a+t.width/2,y:i.y}}function au(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}au.$inject=["eventBus","selection"];var Pw={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ou],autoPlaceSelectionBehavior:["type",au]},Vw=10,Nw=(e,t)=>e.type===t;function jw(e){return e.incoming.map(t=>t.source)}function Ow(e){return e.outgoing.map(t=>t.target)}function Sr(e){return Ow(e).concat(jw(e))}function Iw(e){let t=Sr(e);return e.host&&(t=t.concat(Sr(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((n,a)=>n.concat(Sr(a)),[]))),t.filter(n=>n.type!=="myline")}function Lw(e,t,n){const a={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height};return(0,k.find)(Iw(e),i=>i===n?!1:nn(i,a,Vw)==="intersect")}function Hw(e,t,n,a){let i;for(;i=Lw(e,n,t);)n=a(t,n,i);return n}function zw(e){return function(t,n,a){const i={x:n.x,y:n.y};return["x","y"].forEach(r=>{const l=e[r];if(!l)return;const s=r==="x"?"width":"height",{margin:c,minDistance:d}=l;c<0?i[r]=Math.min(a[r]+c-t[s]/2,n[r]-d+c):i[r]=Math.max(a[r]+a[s]+c+t[s]/2,n[r]+d+c)}),i}}function Dw(e,t){return Fw(e,t)}function Fw(e,t){const n=Ve(e),a=Je(e),i=_w(e,{filter:s=>Nw(s,"myline")}),r=30,l=80;return Hw(e,t,{x:n.right+i+t.width/2,y:a.y+$w("left",l)},zw({y:{margin:r,minDistance:l}}))}function $w(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function iu(e){e.on("autoPlace",t=>{const{shape:n,source:a}=t;return Dw(a,n)})}iu.$inject=["eventBus"];var Ww={__depends__:[Pw],__init__:["myAutoPlace"],myAutoPlace:["type",iu]};function Er(e,t,n,a,i,r,l){this._connect=e,this._modeling=n,this._elementFactory=a,this._autoPlace=i,this._create=r,this._myOptions=l,t.registerProvider(this)}Er.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Er.prototype.getContextPadEntries=function(e){const t=this._connect,n=this._modeling,a=this._elementFactory,i=this._autoPlace,r=this._create,l=this._myOptions;function s(){n.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(Fe({type:p},g));r.start(w,v,{source:x})}function y(w,x){const v=a.createShape(Fe({type:p},g));i.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 l.palette)if(p!=="create.start-event"){const f=l.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 Uw={__init__:["ContextPadProvider"],ContextPadProvider:["type",Er]},Jw=(0,o.defineComponent)({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:n}){const a=e,i=n,r=(0,o.ref)(),l={"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 A=s.get("eventBus");A.on("element.dblclick",R=>{i("elementDblclick",R.element.businessObject)}),A.on("element.click",R=>{i("elementClick",R.element.businessObject)}),A.on("create.end",R=>{i("elementCreate",R.elements[0].businessObject)}),A.on("autoPlace.end",R=>{i("elementCreate",R.shape.businessObject)})},p=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},f=()=>{let A={__init__:["myOptions"],myOptions:["type",p]};s=new Yo.default({canvas:{container:r.value},modules:[db,Oi,hb,_b,$s,zv,Pb,Vb,Nb,Zc,cc,Ub,Hd,Xb,fc,A,Ww,td,pw,Uw,Bw,Ew,Sw,od]});const R=s.get("canvas"),j=s.get("elementFactory");d();const O=j.createRoot();R.setRootElement(O),u()};(0,o.onMounted)(()=>{f()});const h=A=>{const R=A==null?1:c+A;s.get("canvas").zoom(R),c=R},g=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},y=()=>(s.get("canvas").zoom(1),ad(s.get("elementRegistry").getAll())),w=A=>{s.clear(),d(),id(A,s)},x=A=>{s.get("myImporter").update(A.id,A)};return t({reset:()=>{d()},zoom:A=>{h(A)},redo:()=>{g()},undo:()=>{m()},getData:()=>y(),setData:A=>{w(A)},updateElemet:A=>{x(A)}}),(A,R)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),Yw=Jw,ru=ie(Lv),lu=ie(Yw),Kw=(0,o.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:n}){const a=e,i=n,{t:r}=Ze(),{formData:l}=Gt(),s=(0,o.computed)(()=>a.editConfig.isAddBtn!==!1),c=(0,o.computed)(()=>a.editConfig.addBtnText||"添加"),d=(0,o.computed)(()=>a.editConfig.buttonsAlign||"left"),u=(0,o.computed)(()=>a.editConfig.isRemoveBtn!==!1),p=(0,o.computed)(()=>a.editConfig.readonly),f=(0,o.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,o.ref)([]),g=b=>{i("rowChange",b)},m=()=>{const b={_i:Wt()};a.columns.forEach(B=>{const S=B.config?.valueRowKey||B.id||"";S&&(b[S]=xt(B.config?.defaultValue))}),h.value.push(b),i("change",{id:a.id,value:b,data:b,formData:l,tableData:h.value,type:"add"})},y=b=>{const B=h.value[b];h.value.splice(b,1),i("change",{id:a.id,value:B,data:B,formData:l,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 B=h.value.length,S=a.columns,T=S.length;for(let A=0;A<B;A++){const R=h.value[A];for(let j=0;j<T;j++){const O=S[j];if(v(O.config,A).display!==!1&&O.rule&&O.rule.length>0){const H=O.rule.length;for(let M=0;M<H;M++){const E=O.rule[M];if(E.pattern=E.pattern?E.pattern+"":"",E.pattern&&!Tt(R[O.prop||""])&&!new RegExp(E.pattern.substring(1,E.pattern.length-1)).test(R[O.prop||""]))return b.info=`${r("第")}${A+1}${r("行")},${r("第")}${j+1}${r("列")},${r(O.label)}:${r(E.message)}`,b.isOk=!1,b;if(E.required&&Tt(R[O.prop||""]))return b.isOk=!1,b.info=`${r("第")}${A+1}${r("行")},${r("第")}${j+1}${r("列")},${r(O.label)}:${r("不能为空")}`,b}}}}return b};a.modelValue&&a.modelValue.length>0?(h.value=a.modelValue||[],h.value.forEach(b=>{b._i||(b._i=Wt())})):(h.value=[],i("update:modelValue",h.value));const v=(b,B)=>{const S={...b};if(S.getUpConfig){const T=b.getUpConfig({formData:l,index:B,row:h.value[B],tableData:h.value,config:S});T&&Object.keys(T).forEach(A=>{S[A]=T[A]})}return S},C=b=>{const B=b||a.labelWidth;return typeof B=="string"?B:typeof B=="number"?B+"px":B};return t({validate:()=>w()}),fo({getTableData:()=>h.value,rowChange:g}),(b,B)=>{const S=(0,o.resolveComponent)("j-comp"),T=(0,o.resolveComponent)("el-form-item"),A=(0,o.resolveComponent)("el-col"),R=(0,o.resolveComponent)("j-button"),j=(0,o.resolveComponent)("el-row");return(0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createElementVNode)("div",(0,o.mergeProps)({class:"j-input-cards"},b.$attrs),[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(h.value,(O,H)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"j-input-cards-item",key:O.i,style:{"margin-bottom":"8px"}},[(0,o.createVNode)(j,{gutter:e.gutter},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.columns,M=>((0,o.openBlock)(),(0,o.createBlock)(A,{key:M.prop,span:M.config?.span||e.span||24,style:(0,o.normalizeStyle)({"margin-bottom":(M.getInputType?M.getInputType(O):M.inputType)=="j-input-rows"?"8px":void 0})},{default:(0,o.withCtx)(()=>[(0,o.withDirectives)((0,o.createVNode)(T,{"label-width":C(M.config?.labelWidth),label:(0,o.unref)(r)(M.config?.label||""),extra:M.config?.labelExtra,tooltip:M.config?.labelTooltip,required:M.config?.required},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(S,(0,o.mergeProps)({ref_for:!0},M,{row:O}),null,16,["row"])]),_:2},1032,["label-width","label","extra","tooltip","required"]),[[o.vShow,v(M.config,H).display!==!1]])]),_:2},1032,["span","style"]))),128)),u.value&&(f.value||h.value.length>1)&&!p.value?((0,o.openBlock)(),(0,o.createBlock)(R,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",danger:"",onClick:M=>y(H)},null,8,["onClick"])):(0,o.createCommentVNode)("",!0)]),_:2},1032,["gutter"])]))),128))],16),s.value&&!p.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,style:(0,o.normalizeStyle)({"text-align":d.value})},[s.value?((0,o.openBlock)(),(0,o.createBlock)(R,{key:0,type:"link",style:{"margin-right":"8px"},label:c.value,icon:"mdi:add",onClick:m},null,8,["label"])):(0,o.createCommentVNode)("",!0)],4)):(0,o.createCommentVNode)("",!0)],64)}}}),Gw=Kw,su=ie(Gw),qw=[Go,sl,cl,dl,ul,fl,pl,hl,gl,ml,yl,vl,El,Bl,Rl,_l,yi,ll,Tl,Ml,Al,Vl,jl,Ol,Yl,Il,Ll,Hl,zl,Dl,Fl,$l,Wl,Ul,Jl,Xl,Zl,Ql,es,ts,ns,os,as,is,Kl,Gl,vi,rs,ls,ss,cs,ds,us,fs,lm,ru,lu,su],Xw=e=>{qw.forEach(t=>{e.component(t.name,t)})},Zw={install:Xw};V.EncryptionFactory=Yr,V.EventBus=pi,V.HashingFactory=Yu,V.INJECT_KEYS=lt,V.JAutoComplete=yl,V.JBarcode=Ol,V.JButton=Go,V.JButtonSelect=Xl,V.JButtons=sl,V.JCascaderSelect=hl,V.JCheckbox=gl,V.JCodeMirror=Yl,V.JCollapse=us,V.JComp=es,V.JCount=Il,V.JCountUp=Hl,V.JDataPanel=zl,V.JDate=dl,V.JDialog=Bl,V.JDialogFull=Rl,V.JDivider=Dl,V.JDrawer=_l,V.JDynamicLayer=ll,V.JEcharts=jl,V.JEditor=fs,V.JForm=ts,V.JFormItem=ns,V.JGuid=as,V.JHpanel=Fl,V.JIcon=ul,V.JInput=cl,V.JInputButton=$l,V.JInputCards=su,V.JInputCode=Wl,V.JInputColor=Ul,V.JInputCount=Ll,V.JInputLayer=ls,V.JInputRows=rs,V.JInputTag=Tl,V.JLayer=yi,V.JLayerForm=ss,V.JLayout=vl,V.JMenu=Gl,V.JNumber=ml,V.JPage=os,V.JPanel=is,V.JRadio=fl,V.JRate=Ml,V.JSelect=pl,V.JSlider=Al,V.JSliderCaptcha=Kl,V.JSwitch=cs,V.JTable=El,V.JTablePanel=vi,V.JTabs=ds,V.JTitle=Jl,V.JTree=Zl,V.JTreeSelect=Ql,V.JUpload=Vl,V.JWorkflow=lu,V.JWorkflowViewer=ru,V.assign=Fe,V.buildShortUUID=qo,V.buildUUID=Wt,V.clearJson=Hn,V.clone=so,V.deepClone=xt,V.default=Zw,V.eventBus=Gu,V.formatToDate=uo,V.formatToDateTime=fi,V.fullScreenLoading=zn,V.getCompConfig=bn,V.getCompType=ui,V.getFunction=si,V.getIsInputComp=Xo,V.getIsTableInputComp=Dr,V.getLabel=Fr,V.getObjType=Mr,V.getTextWidth=kt,V.is=Tr,V.isArray=Ko,V.isNullOrEmpty=Tt,V.isObject=Ru,V.loadBMap=Gr,V.lowerFirst=Ou,V.myAesDecrypt=Ku,V.numberToChinese=Ar,V.numberToThousandSeparator=Pr,V.pagination=Vu,V.paginationEx=Nu,V.set=ci,V.setGroupMap=Nr,V.toArray=Ir,V.toDecimal=co,V.toLeafArray=zr,V.toSimpleTree=Iu,V.toTree=jr,V.uniqueArray=ju,V.upFirst=Vr,V.useAppInject=Ze,V.useAppProvide=qu,V.useAuthPageInject=tl,V.useAuthPageProvide=nl,V.useCompInject=Xr,V.useCompProvide=gi,V.useFormInject=Gt,V.useFormProvide=hi,V.useHMenuInject=Qr,V.useHMenuProvide=el,V.useInject=Pt,V.useLayer=Fn,V.useLayerInject=Xu,V.useLayerProvide=ol,V.useMenuInject=Dn,V.useMenuProvide=Zr,V.usePageInject=al,V.usePageProvide=il,V.useProvide=Vt,V.useSortable=Kr,V.useTableInject=qr,V.useTableProvide=fo});
|