@kong-ui-public/entities-plugins 9.109.0 → 9.109.1
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/entities-plugins.es.js +946 -946
- package/dist/entities-plugins.umd.js +3 -3
- package/dist/style.css +1 -1
- package/dist/types/components/free-form/Datakit/constants.d.ts +0 -24
- package/dist/types/components/free-form/Datakit/constants.d.ts.map +1 -1
- package/dist/types/components/free-form/Datakit/flow-editor/FlowCanvas.vue.d.ts.map +1 -1
- package/dist/types/components/free-form/Datakit/flow-editor/constants.d.ts +24 -0
- package/dist/types/components/free-form/Datakit/flow-editor/constants.d.ts.map +1 -1
- package/dist/types/components/free-form/Datakit/flow-editor/store/flow.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -116,12 +116,12 @@ will extend the wait time by about 12 minutes, continuously adjusting as new req
|
|
|
116
116
|
input: API
|
|
117
117
|
status: 200
|
|
118
118
|
`},Symbol.toStringTag,{value:"Module"})),t1={class:"dk-code-editor"},n1={class:"examples-content"},o1={ref:"editor-root",class:"editor"},fl="YAML Syntax",r1="datakit.insert-example",i1=ve(t.defineComponent({__name:"CodeEditor",props:{editing:{type:Boolean}},emits:["change","error"],setup(e,{expose:n,emit:o}){const{t:r}=Ze.createI18n("en-us",rt),{formData:i}=ze(),a=o,l=t.useTemplateRef("editor-root"),s=t.shallowRef(null);function c(f){const u=s.value,p=u==null?void 0:u.getModel();if(!u||!p)return;const m=ul[f];u.getValue()!==m&&(u.pushUndoStop(),u.executeEdits(r1,[{range:p.getFullModelRange(),text:m}]),u.pushUndoStop()),d()}function d(){const f=s.value,u=f==null?void 0:f.getModel();!f||!u||(f.setPosition(u.getFullModelRange().getEndPosition()),f.focus())}return t.onMounted(()=>{const f=Tr.editor.create(l.value,{language:"yaml",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2,scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep"});if(s.value=f,i.config&&Object.keys(i.config).length>0){const u={...i.config};u.nodes&&u.nodes.length===0&&delete u.nodes;const p=Object.keys(u).length===0?"":oi.dump(t.toRaw(u),{schema:ni,noArrayIndent:!0});f.setValue(p),d()}f.onDidChangeModelContent(()=>{const u=f.getModel(),p=f.getValue()||"";try{const m=oi.load(p,{schema:ni,json:!0});Tr.editor.setModelMarkers(u,fl,[]),i.config=m,a("change",m)}catch(m){const{message:y,mark:_}=m,{line:g,column:h}=_||{line:0,column:0},w=y.split(`
|
|
119
|
-
`)[0],b=[{startLineNumber:g+1,startColumn:h+1,endLineNumber:g+1,endColumn:h+2,message:w,severity:Tr.MarkerSeverity.Error,source:fl}];Tr.editor.setModelMarkers(u,fl,b),a("error",w)}})}),t.onBeforeUnmount(()=>{var f;(f=s.value)==null||f.dispose()}),n({setExampleCode:c}),(f,u)=>(t.openBlock(),t.createElementBlock("div",t1,[t.createVNode(t.unref(Pe.KAlert),{class:"examples"},{icon:t.withCtx(()=>[t.createVNode(t.unref(Se.SparklesIcon))]),default:t.withCtx(()=>[t.createElementVNode("div",n1,[t.createTextVNode(t.toDisplayString(t.unref(r)("plugins.free-form.datakit.description_example"))+" ",1),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ul,(p,m)=>t.createVNode(t.unref(Pe.KButton),{key:m,appearance:"secondary",size:"small",onClick:y=>c(m)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(r)(`plugins.free-form.datakit.examples.${m}`)),1)]),_:2},1032,["onClick"])),64))])]),_:1}),t.createElementVNode("div",o1,null,512)]))}}),[["__scopeId","data-v-5f51e876"]]),Pu=44,a1=220,Ou=366,l1=1e3,s1=Pu+parseFloat(Nd),$u=["request","service_request","service_response","response","vault"],bo=$u,Bu=["call","jq","exit","property","static","branch","cache"],Vu=["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","TRACE","CONNECT"],nr="application/x-datakit+json",ri={delete:["Delete"],undo:["Mod","Z"],redo:{mac:["Mod","Shift","Z"],windows:["Mod","Y"],linux:["Mod","Shift","Z"]},copy:["Mod","C"],paste:["Mod","V"],duplicate:["Mod","D"]},ii=1,c1=0,d1=1,u1=2,f1=3,wo=parseInt(_C,10),xt={call:{icon:Se.NetworkIcon,colors:{foreground:yC,background:iC}},jq:{icon:Se.CodeblockIcon,colors:{foreground:fC,background:tC}},exit:{icon:Se.GatewayIcon,colors:{foreground:Ya,background:cC}},property:{icon:Se.StackIcon,colors:{foreground:gC,background:hC}},static:{icon:Se.VitalsIcon,colors:{foreground:pC,background:mC}},branch:{icon:Se.ArrowSplitIcon,colors:{foreground:dC,background:eC}},cache:{icon:Se.StackIcon,colors:{foreground:uC,background:"#fff0f7"}},vault:{icon:Se.KeyIcon},request:{icon:Se.CloudIcon},service_request:{icon:Se.CloudIcon},service_response:{icon:Se.CloudIcon},response:{icon:Se.CloudIcon}},{t:pl}=Ze.createI18n("en-us",rt);function Bt(e){return pl(`plugins.free-form.datakit.flow_editor.node_types.${e}.description`)}function Fn(e){return pl(`plugins.free-form.datakit.flow_editor.node_types.${e}.summary`)}function p1(e){return pl(`plugins.free-form.datakit.flow_editor.node_types.${e}.name`)}const ml={call:{type:"call",summary:Fn("call"),description:Bt("call"),io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]},output:{fields:[{name:"headers"},{name:"body"},{name:"status"}]}},...xt.call},jq:{type:"jq",summary:Fn("jq"),description:Bt("jq"),io:{input:{fields:[],configurable:!0},output:{fields:[]}},...xt.jq},exit:{type:"exit",summary:Fn("exit"),description:Bt("exit"),io:{input:{fields:[{name:"headers"},{name:"body"}]}},...xt.exit},property:{type:"property",summary:Fn("property"),description:Bt("property"),io:{input:{fields:[],configurable:!0},output:{fields:[]}},...xt.property},static:{type:"static",summary:Fn("static"),description:Bt("static"),io:{output:{fields:[],configurable:!0}},...xt.static},branch:{type:"branch",summary:Fn("branch"),description:Bt("branch"),io:{input:{fields:[]},next:{branches:[{name:"then"},{name:"else"}]}},...xt.branch},cache:{type:"cache",summary:Fn("cache"),description:Bt("cache"),io:{input:{fields:[{name:"data"},{name:"key"},{name:"ttl"}]},output:{fields:[{name:"data"},{name:"hit"},{name:"miss"},{name:"stored"}]}},...xt.cache}},ai={request:{type:"request",description:Bt("request"),io:{output:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...xt.request},service_request:{type:"service_request",description:Bt("service_request"),io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...xt.service_request},service_response:{type:"service_response",description:Bt("service_response"),io:{output:{fields:[{name:"headers"},{name:"body"}]}},...xt.service_response},response:{type:"response",description:Bt("response"),io:{input:{fields:[{name:"headers"},{name:"body"}]}},...xt.response},vault:{type:"vault",io:{output:{fields:[],configurable:!0}},...xt.vault,hidden:!0}},gl=Object.keys(ai),hl=e=>gl.includes(e),m1=e=>[...gl,...Bu].includes(e),Vt=e=>gl.includes(e),Ru=e=>Vt(e.type),Du=e=>!!(e!=null&&e.startsWith("node:")),li=e=>Object.prototype.hasOwnProperty.call(e,"ownerId");function ln(e){return lo(e)}function yl(e,n){if(e.length!==n.length)return!1;if(e.length===0)return!0;const o=new Set(n);return e.every(r=>o.has(r))}function ko(e){return`${e}:${Gr()}`}function si(e){const[n,o]=e.split(".");return{nodeName:n,fieldName:o}}function Mu(e){const[n,o]=e.split(".");return{nodeId:n,fieldId:o}}function Co(e){return Vt(e)?ai[e]:ml[e]}function Lu(e){var i,a,l,s;const n=Co(e),o=((a=(i=n.io)==null?void 0:i.input)==null?void 0:a.fields.map(({name:c})=>c))??[],r=((s=(l=n.io)==null?void 0:l.output)==null?void 0:s.fields.map(({name:c})=>c))??[];return{input:o,output:r}}function or(e){var o,r,i;return((i=(r=(o=Co(e).io)==null?void 0:o.next)==null?void 0:r.branches)==null?void 0:i.map(({name:a})=>a))??[]}function Fu(e){return(e??[]).map(n=>({id:ko("field"),name:n}))}function _n(e,n,o){if(o)return e.fields[n].find(r=>r.name===o)}function bn(e,n,o){if(o)return e.fields[n].find(r=>r.id===o)}function _l(e,n){return n?e.fields.output.some(o=>o.id===n):!0}function Uu(e,n){return n?e.fields.input.some(o=>o.id===n):!0}function g1(e){const n=["request","service_request","vault"].includes(e)?"request":"response",o=ai[e];return{name:e,phase:n,position:{x:0,y:0},fields:Lu(o.type),expanded:{},hidden:o.hidden}}function Ku(e,n){const r=(typeof e=="string"&&m1(e)?e.toUpperCase():e).replace(/_\d+$/,"");for(let i=1;;i++){const a=`${r}_${i}`;if(!n.has(a))return a}}function bl(e,n){return`${e}:${n}`}function h1(e){const n=e.lastIndexOf(":");if(n===-1)throw new Error(`Invalid group ID format: ${e}`);const o=e.slice(0,n),r=e.slice(n+1);return{nodeId:o,branch:r}}function ci(e,n){return`${e}:${n}`}function ju(e,n,o,r,i){return{id:bl(e,n),ownerId:e,branch:n,phase:o,memberIds:[...r],position:i!=null&&i.position?{...i.position}:void 0,dimensions:i!=null&&i.dimensions?{...i.dimensions}:void 0}}function y1(e){return e.map(({source:n,target:o})=>({source:n,target:o}))}function _1(e){const n=[];for(const o of e)for(const r of o.memberIds)n.push({source:o.ownerId,target:r});return n}function Gu(e,n){return[...y1(e),..._1(n)]}function di(e,n){const o=new Map;for(const{source:r,target:i}of e)o.has(r)||o.set(r,[]),o.get(r).push(i),o.has(i)||o.set(i,[]);return n&&(o.has(n.source)||o.set(n.source,[]),o.get(n.source).push(n.target),o.has(n.target)||o.set(n.target,[])),o}function wl(e){const n=new Set,o=new Set;function r(i){if(o.has(i))return!0;if(n.has(i))return!1;n.add(i),o.add(i);for(const a of e.get(i)??[])if(r(a))return!0;return o.delete(i),!1}for(const i of e.keys())if(r(i))return!0;return!1}function kl(e,n){const o=e.config;if(!o)return[];const r=o[n];return Array.isArray(r)?r.filter(i=>typeof i=="string"&&Du(i)):[]}function b1({state:e,groupMapById:n,getNodeById:o,history:r}){const i=t.computed(()=>{const S=new Map;for(const v of e.value.groups)for(const D of v.memberIds)S.set(D,{ownerId:v.ownerId,branch:v.branch});return S}),a=t.computed(()=>{const S=new Map;for(const v of e.value.groups)for(const D of v.memberIds)S.set(D,v);return S}),l=t.computed(()=>{const S=new Map;for(const v of e.value.groups)S.has(v.ownerId)||S.set(v.ownerId,[]),S.get(v.ownerId).push(v);return S}),s=t.computed(()=>Gu(e.value.edges,e.value.groups)),c=t.computed(()=>di(s.value));function d(S,v){return S?or(S.type).includes(v):!1}function f(S,v){if(v===S.id)return!1;const D=o(v);return!(!D||Vt(D.type)||D.phase!==S.phase)}function u(S,v){const D=[],L=new Set;for(const k of v)L.has(k)||(L.add(k),f(S,k)&&D.push(k));return D}function p(S,v,D){const L=o(S);return d(L,v)?u(L,D):[]}function m(S,v,D){const L=bl(S.id,v),k=n.value.get(L);D.length>0?k?(k.phase!==S.phase&&(k.phase=S.phase),yl(k.memberIds,D)||(k.position=void 0,k.dimensions=void 0,k.memberIds=[...D])):e.value.groups.push(ju(S.id,v,S.phase,D)):k&&(e.value.groups=e.value.groups.filter(J=>J.id!==L))}function y(S,v,D,L={}){const k=o(S);if(!d(k,v))return!1;const J=u(k,D),I=kl(k,v);if(yl(I,J))return!1;const G=k.config??(k.config={});return J.length>0?G[v]=[...J]:(delete G[v],Object.keys(G).length===0&&delete k.config),m(k,v,J),(L.commit??!0)&&r.commit(L.tag??`branch:set:${v}`),!0}function _(S){e.value.groups=e.value.groups.filter(v=>v.ownerId!==S)}function g(S,v){const D=n.value.get(bl(S,v));if(D)return[...D.memberIds];const L=o(S);return L?kl(L,v):[]}function h(S){return i.value.get(S)}function w(S,v){if(S===v)return!0;const D=new Set,L=[v];for(;L.length>0;){const k=L.pop();if(D.has(k))continue;if(D.add(k),k===S)return!0;const J=c.value.get(k);if(J)for(const I of J)D.has(I)||L.push(I)}return!1}function b(S,v,D,L={}){const k=o(S);if(!k||!d(k,v)||!f(k,D)||w(S,D))return!1;const J=kl(k,v);if(J.includes(D))return!1;x(D);const I=[...J,D];return y(S,v,I,{commit:!1})?((L.commit??!0)&&r.commit(L.tag??`branch:add:${v}`),!0):!1}function x(S){const v=h(S);if(!v)return;const L=g(v.ownerId,v.branch).filter(k=>k!==S);y(v.ownerId,v.branch,L,{commit:!1})}function E(S){let v=0;const D=new Set;let L=a.value.get(S);for(;L&&!D.has(L.id);)v+=1,D.add(L.id),L=a.value.get(L.ownerId);return v}function C(S){const v=n.value.get(S);return v?E(v.ownerId):0}function N(S){return S?n.value.has(S):!1}return{memberGroupMap:a,groupsByOwner:l,findMembership:h,getMembers:g,wouldCreateCycle:w,setMembers:y,prepareMembers:p,addMember:b,dropTarget:x,clear:_,getNodeDepth:E,getGroupDepth:C,isGroupId:N}}function w1(e,n){const{commit:o,undo:r,redo:i,canUndo:a,canRedo:l,clear:s,reset:c,undoStack:d,redoStack:f}=Ye.useManualRefHistory(e,{capacity:n==null?void 0:n.capacity,clone:n==null?void 0:n.clone});let u;function p(b){var x;(x=n==null?void 0:n.onHistoryChange)==null||x.call(n,b,e.value)}function m(b){if(!b){u=void 0,o(),p("commit");return}if(b!=="*"&&u!==b){u=b,o(),p("commit");return}o(),d.value.shift(),p("commit")}function y(){r(),u=void 0,p("undo")}function _(){i(),u=void 0,p("redo")}function g(){s(),u=void 0,p("clear")}function h(){c(),u=void 0,p("reset")}function w(){r(),f.value.shift(),u=void 0,p("revert")}return{canUndo:a,canRedo:l,commit:m,undo:y,redo:_,clear:g,reset:h,revert:w}}function k1(e){var n,o;return((o=(n=e.config)==null?void 0:n.resources)==null?void 0:o.vault)||{}}function C1(e){const{resources:n}=e.config||{};return n!=null&&n.vault?Object.keys(n.vault):[]}function E1(e){const n=Object.entries(e);if(n.length===0)return;const o={};for(const[r,i]of n)o[r]=i;return o}function qu(e,n){var g,h,w,b,x,E,C;const o=((g=e.config)==null?void 0:g.nodes)??[],r=((h=e.__ui_data)==null?void 0:h.nodes)??[],i=((w=e.__ui_data)==null?void 0:w.groups)??[],a=new Map(r.map(N=>[N.name,N])),l=new Map(i.map(N=>[N.name,N])),s=[],c=[],d=new Map,f=[],u=[],p=new Map,m=N=>{const S=new Set,v=[...N];for(;v.length>0;){const D=v.shift();if(!S.has(D)&&(S.add(D),hl(D)||(d.get(D).phase="request"),!!p.has(D)))for(const L of p.get(D))S.has(L)||v.push(L)}};let y=!1;for(const N of o){const S=a.get(N.name);!S&&!y&&(y=!0);const v=Hu({type:N.type,configNode:N,uiNode:S,pluginData:e});s.push(v),d.set(v.name,v)}for(const N of s){const S=or(N.type);if(!S.length)continue;const v=N.config;if(v)for(const D of S){const L=v[D];if(!Array.isArray(L)){l.has(ci(N.name,D))&&(y=!0);continue}const k=[];for(const J of L){if(typeof J!="string")continue;const I=d.get(J);I&&!Vt(I.type)&&k.push(I.id)}if(k.length){v[D]=k;const J=ci(N.name,D),I=l.get(J),G=I?{position:ln(I.position)}:void 0,j=ju(N.id,D,N.phase,k,G);f.push(j),!I&&!y&&(y=!0)}else delete v[D],l.has(ci(N.name,D))&&(y=!0)}}for(const N of bo)if(!d.has(N)){let S=a.get(N);S||(y||(y=!0),S=g1(N));const v=Hu({type:N,uiNode:S,pluginData:e});s.push(v),d.set(v.name,v)}for(const N of o)x1(N,u);for(const N of u){const S=d.get(N.source),v=d.get(N.target);if(!S||!v){S||console.warn(`[initEditorState] skip: source "${N.source}" not found`),v||console.warn(`[initEditorState] skip: target "${N.target}" not found`);continue}p.has(N.source)||p.set(N.source,new Set),p.get(N.source).add(N.target),p.has(N.target)||p.set(N.target,new Set),p.get(N.target).add(N.source),c.push({id:ko("edge"),source:S.id,sourceField:(b=_n(S,"output",N.sourceField))==null?void 0:b.id,target:v.id,targetField:(x=_n(v,"input",N.targetField))==null?void 0:x.id})}m(["request","service_request"]);let _=null;return(C=(E=e.config)==null?void 0:E.resources)!=null&&C.cache&&(_={...e.config.resources.cache},e.partials&&(_.partial_id=e.partials[0].id)),{nodes:s,edges:c,groups:f,pendingLayout:y?n?"keepHistory":"clearHistory":!1,pendingFitView:!0,..._?{cacheConfig:_}:{}}}function zu(e){const{type:n,name:o,phase:r,position:i,fields:a,config:l}=e,s=Lu(n),c=Co(n);return{id:ko("node"),type:n,name:o??n,phase:r??"request",position:i??{x:0,y:0},expanded:{},fields:{input:Fu((a==null?void 0:a.input)??s.input),output:Fu((a==null?void 0:a.output)??s.output)},hidden:e.hidden||c.hidden,config:l?ln(l):{}}}function N1(e){return Vt(e)?e==="request"||e==="service_request"?"request":"response":"request"}function Hu({type:e,configNode:n,uiNode:o,pluginData:r}){return zu({type:e,name:n==null?void 0:n.name,phase:(o==null?void 0:o.phase)??N1(e),position:o==null?void 0:o.position,fields:v1({type:e,uiNode:o,configNode:n,pluginData:r}),hidden:o==null?void 0:o.hidden,config:A1({type:e,configNode:n,pluginData:r})})}function S1(e){const{type:n,name:o,input:r,inputs:i,output:a,outputs:l,...s}=e;return ln(s)}function x1(e,n){const o=e.name;if(e.input){const{nodeName:r,fieldName:i}=si(e.input);r&&n.push({source:r,sourceField:i,target:o})}if(e.inputs)for(const[r,i]of Object.entries(e.inputs)){if(!i)continue;const{nodeName:a,fieldName:l}=si(i);a&&n.push({source:a,sourceField:l,target:o,targetField:r})}if(e.output){const{nodeName:r,fieldName:i}=si(e.output);r&&n.push({source:o,target:r,targetField:i})}if(e.outputs)for(const[r,i]of Object.entries(e.outputs)){if(!i)continue;const{nodeName:a,fieldName:l}=si(i);a&&n.push({source:o,sourceField:r,target:a,targetField:l})}}function v1({type:e,uiNode:n,configNode:o,pluginData:r}){var s,c,d,f;const i=Co(e),a=i==null?void 0:i.io;if(!a)return;const l={};if((s=a.input)!=null&&s.configurable&&(n?l.input=((c=n.fields)==null?void 0:c.input)??[]:o!=null&&o.inputs&&(l.input=Object.keys(o.inputs))),(d=a.output)!=null&&d.configurable){if(n)l.output=((f=n.fields)==null?void 0:f.output)??[];else{const u=new Set;o!=null&&o.outputs&&Object.keys(o.outputs).forEach(p=>u.add(p)),(o==null?void 0:o.type)==="static"&&o.values&&Object.keys(o.values).forEach(p=>u.add(p)),u.size&&(l.output=Array.from(u))}e==="vault"&&(l.output=C1(r))}return Object.keys(l).length?l:void 0}function A1({type:e,configNode:n,pluginData:o}){return e==="vault"?k1(o):n?S1(n):void 0}function I1(e){const n=t.computed(()=>{const u=new Map;return e.value.nodes.forEach(p=>u.set(p.id,p)),u}),o=t.computed(()=>e.value.edges),r=t.computed(()=>e.value.groups),i=t.computed(()=>Gu(o.value,r.value));function a(u){return di(i.value,u?{source:u.source,target:u.target}:void 0)}function l(u){const p=n.value.get(u.source),m=n.value.get(u.target);if(!p||!m)return u;const y=Uu(p,u.sourceField)&&!_l(p,u.sourceField),_=_l(m,u.targetField);return y&&_?{source:u.target,sourceField:u.targetField,target:u.source,targetField:u.sourceField}:u}function s(u){const p=l(u),m=[],y=n.value.get(p.source),_=n.value.get(p.target);if(y||m.push("source node not found"),_||m.push("target node not found"),!y||!_)return{ok:!1,errors:m};_l(y,p.sourceField)||m.push("source handle is not an output field"),Uu(_,p.targetField)||m.push("target handle is not an input field"),_.name==="request"&&m.push('cannot target "request"'),y.name==="response"&&m.push('cannot source from "response"');const g=o.value.some(b=>b.target===p.target&&!b.targetField),h=o.value.some(b=>b.target===p.target&&!!b.targetField);(g&&p.targetField||h&&!p.targetField)&&m.push("cannot mix whole-node and field-level inputs on same target"),p.targetField&&o.value.some(b=>b.target===p.target&&b.targetField===p.targetField)&&m.push("target field already connected"),!p.targetField&&o.value.some(b=>b.target===p.target&&!b.targetField)&&m.push("target input already taken"),p.source===p.target&&m.push("self-loop not allowed");const w=a({source:p.source,target:p.target});return wl(w)&&m.push("connection introduces a cycle"),m.length?{ok:!1,errors:m}:{ok:!0}}function c(){const u=[];for(const p of bo)[...n.value.values()].some(m=>m.name===p)||u.push(`missing implicit node "${p}"`);for(const p of o.value){const m=n.value.get(p.source);n.value.get(p.target).name==="request"&&u.push(`edge "${p.id}" targets "request"`),m.name==="response"&&u.push(`edge "${p.id}" sources from "response"`)}return wl(a())&&u.push("graph contains cycle"),u.length?{ok:!1,errors:u}:{ok:!0}}function d(u){return s(u).ok}function f(u){return!u.source||!u.target?!1:d({source:u.source,sourceField:u.sourceHandle,target:u.target,targetField:u.targetHandle})}return{canonicalizeConnection:l,validateConnection:s,validateGraph:c,isValidConnection:d,isValidVueFlowConnection:f,buildAdjacency:di}}const[Yu,T1]=Ye.createInjectionState(function(n,o={}){const r=t.ref(qu(n)),i=t.ref(),a=t.ref(!1),l=t.ref(!1),s=w1(r,{capacity:200,clone:ln,onHistoryChange:A=>{var U,$;A!=="clear"&&(($=o.onChange)==null||$.call(o,V(),q(),R(),(U=r.value.cacheConfig)==null?void 0:U.partial_id))}}),c=t.ref(!1),d=t.ref(new Set);function f(){r.value.pendingLayout=!1,s.commit("*")}function u(A=!0){r.value.pendingFitView!==A&&(r.value.pendingFitView=A,s.commit("*"))}const p=t.computed(()=>new Map(r.value.nodes.map(A=>[A.id,A]))),m=t.computed(()=>new Map(r.value.nodes.map(A=>[A.name,A]))),y=t.computed(()=>{const A=new Map,U=new Map;for(const $ of r.value.edges)A.set($.id,$),U.has($.source)||U.set($.source,new Set),U.get($.source).add($.id),U.has($.target)||U.set($.target,new Set),U.get($.target).add($.id);return{edgeMapById:A,edgeIdMapByNodeId:U}}),_=t.computed(()=>y.value.edgeMapById),g=t.computed(()=>y.value.edgeIdMapByNodeId),h=t.computed(()=>new Map(r.value.groups.map(A=>[A.id,A]))),w=t.computed(()=>new Set(r.value.nodes.map(A=>A.name))),b=b1({state:r,groupMapById:h,getNodeById:v,history:s}),{canonicalizeConnection:x,validateConnection:E,validateGraph:C,isValidConnection:N,isValidVueFlowConnection:S}=I1(r);function v(A){return p.value.get(A)}function D(A){return m.value.get(A)}function L(A){return _.value.get(A)}function k(A){if(!g.value.has(A))return[];const U=[];return g.value.get(A).forEach($=>{const oe=L($);oe&&U.push(oe)}),U}function J(A){return k(A).filter(U=>U.target===A)}function I(A){return k(A).filter(U=>U.source===A)}const G=t.computed(()=>i.value?v(i.value):void 0);function j(A){i.value=A}function te(A){if(Vt(A.type))throw new Error("[createNode] implicit nodes are fixed.");return zu({type:A.type,name:A.name||(Vt(A.type)?void 0:Ku(A.type,w.value)),phase:A.phase,position:A.position,fields:A.fields,config:A.config})}function K(A,U=!0){const $=te(A);if($)return r.value.nodes.push($),U&&s.commit(),c.value=!0,$.id}function O(A,U,$=!0){const oe=v(A);if(!oe||Vt(oe.type))return;const ne={...ln(oe),id:ko("node"),name:Ku(oe.name,w.value),position:U??{x:oe.position.x+20,y:oe.position.y+20}},_e=or(ne.type);if(_e.length&&ne.config){for(const ke of _e)delete ne.config[ke];Object.keys(ne.config).length===0&&delete ne.config}return r.value.nodes.push(ne),$&&s.commit(),c.value=!0,ne.id}function P(A,U=!0){if(!v(A))return;r.value.edges=r.value.edges.filter(ne=>ne.source!==A&&ne.target!==A),b.clear(A),r.value.nodes=r.value.nodes.filter(ne=>ne.id!==A),i.value===A&&(i.value=void 0),b.dropTarget(A);const oe=C();oe.ok||console.warn("[removeNode] topology invalid:",oe.errors.join("; ")),U&&s.commit()}function T(A,U,$=!0,oe){const ne=v(A);if(!ne)return;if(hl(ne.name)){console.warn("[renameNode] implicit node name is reserved.");return}ne.name!==U&&(ne.name=U,$&&s.commit(oe))}function M(A,U,$=!0){const oe=v(A);oe&&(oe.position={...U},$&&s.commit())}function Y(A,U,$=!0){const oe=h.value.get(A);if(!oe)return;const ne=oe.position;ne&&ne.x===U.x&&ne.y===U.y||(oe.position={...U},$&&s.commit())}function z(A,U,$=!0){const oe=h.value.get(A);if(!oe)return!1;const ne={...U.position},_e={...U.dimensions},ke=oe.position&&oe.position.x===ne.x&&oe.position.y===ne.y,de=oe.dimensions&&oe.dimensions.width===_e.width&&oe.dimensions.height===_e.height;return ke&&de?!1:(oe.position=ne,oe.dimensions=_e,$&&s.commit(),!0)}function H(A,U,$,oe=!0,ne){const _e=v(A);if(!_e)return;const ke=$??!_e.expanded[U];ke!==!!_e.expanded[U]&&(_e.expanded[U]=ke,oe&&s.commit(ne??`toggle:${A}:${U}`))}function Z(A,U,$=!0,oe){const ne=v(A);ne&&(ne.config=ln(U),$&&s.commit(oe))}function ie(A,U,$,oe=!0){const ne=v(A);if(!ne)return;const _e=ne.fields[U];if(_e.some(ke=>ke.name===$)){console.warn(`[addField] field "${$}" already exists on ${U}.`);return}_e.push({id:ko("field"),name:$}),U==="input"?ne.fields.input=_e:ne.fields.output=_e,oe&&s.commit()}function be(A,U,$,oe=!0){const ne=v(A);if(!ne)return;const _e=ne.fields.input,ke=ne.fields.output,de=_e.find(Ne=>Ne.id===U)??ke.find(Ne=>Ne.id===U);de&&(de.name=$,oe&&s.commit())}function ee(A,U,$=!0,oe=!0){const ne=v(A);if(!ne)return;const _e=ne.fields.input,ke=ne.fields.output,de=_e.findIndex(me=>me.id===U);de>=0&&_e.splice(de,1);const Ne=ke.findIndex(me=>me.id===U);Ne>=0&&ke.splice(Ne,1),ne.fields.input=_e,ne.fields.output=ke,$&&(r.value.edges=r.value.edges.filter(me=>me.sourceField!==U&&me.targetField!==U));const Te=C();Te.ok||console.warn("[removeField] topology invalid:",Te.errors.join("; ")),oe&&s.commit()}function re(A,U=!0){const $=x(A),oe=E($);if(!oe.ok){console.warn("[connectEdge] invalid connection:",oe.errors.join("; "));return}const ne={id:ko("edge"),...$};r.value.edges.push(ne);const _e=C();if(!_e.ok){r.value.edges.pop(),console.warn("[connectEdge] topology invalid:",_e.errors.join("; "));return}return U&&s.commit(),ne.id}function le(A,U,$=!0){ue(A,!1),re(U,!1),$&&s.commit()}function ue(A,U=!0){const $=r.value.edges.findIndex(_e=>_e.id===A);if($<0)return;const oe=r.value.edges[$];r.value.edges.splice($,1);const ne=C();if(!ne.ok){r.value.edges.splice($,0,oe),console.warn("[disconnectEdge] topology invalid:",ne.errors.join("; "));return}U&&s.commit()}function fe(A,U=!0){const $=J(A);for(const oe of $)ue(oe.id,!1);U&&s.commit()}function B(A,U=!0){const $=I(A);for(const oe of $)ue(oe.id,!1);U&&s.commit()}function V(){var U,$,oe,ne,_e;const A=[];for(const ke of r.value.nodes){if(Vt(ke.type))continue;let de;const Ne={};let Te;const me={};for(const st of r.value.edges.filter(He=>He.target===ke.id)){const He=v(st.source);if(!He)continue;const pt=(U=bn(He,"output",st.sourceField))==null?void 0:U.name,kt=pt?`${He.name}.${pt}`:He.name,mt=($=bn(ke,"input",st.targetField))==null?void 0:$.name;mt?Ne[mt]=kt:de===void 0&&(de=kt)}for(const st of r.value.edges.filter(He=>He.source===ke.id)){const He=v(st.target);if(!He)continue;const pt=He.type;if(!Vt(pt)||!((oe=ai[pt].io)!=null&&oe.input))continue;const kt=(ne=bn(He,"input",st.targetField))==null?void 0:ne.name,mt=kt?`${He.name}.${kt}`:He.name,$e=(_e=bn(ke,"output",st.sourceField))==null?void 0:_e.name;$e?me[$e]=mt:Te===void 0&&(Te=mt)}const ge={...ln(ke.config),name:ke.name,type:ke.type},nt=or(ke.type);if(nt.length)for(const st of nt){const He=ge[st];if(!Array.isArray(He))continue;const pt=[];for(const kt of He){const mt=v(kt);mt&&pt.push(mt.name)}pt.length?ge[st]=Array.from(new Set(pt)):delete ge[st]}Object.keys(Ne).length>0?ge.inputs=Ne:de!==void 0&&(ge.input=de),Object.keys(me).length>0?ge.outputs=me:Te!==void 0&&(ge.output=Te),A.push(ge)}return A}function F(){return r.value.nodes.map(A=>ln({name:A.name,phase:A.phase,position:{...A.position},expanded:{...A.expanded},fields:{input:A.fields.input.map(U=>U.name),output:A.fields.output.map(U=>U.name)}}))}function R(){const A={},U=D("vault");if(U){const $=E1(U.config);$&&Object.keys($).length>0&&(A.vault=$)}if(r.value.cacheConfig){const{strategy:$,redis:oe,memory:ne}=r.value.cacheConfig;A.cache={strategy:$,redis:oe,memory:ne}}if(Object.keys(A).length!==0)return A}function Q(){const A=[];for(const U of r.value.groups){const $=v(U.ownerId);if(!$)continue;const oe=U.position;oe&&A.push({name:ci($.name,U.branch),position:{...oe}})}return A}function q(){return{nodes:F(),groups:Q()}}function ae(A,U){U&&s.commit(),r.value=qu(A,U),U||s.clear()}return{state:r,selection:i,modalOpen:a,skipValidation:c,invalidConfigNodeIds:d,propertiesPanelOpen:l,nodeMapById:p,nodeMapByName:m,edgeMapById:_,edgeIdMapByNodeId:g,groupMapById:h,getNodeById:v,getNodeByName:D,getEdgeById:L,getEdgesByNodeId:k,getInEdgesByNodeId:J,getOutEdgesByNodeId:I,selectedNode:G,selectNode:j,createNode:te,addNode:K,duplicateNode:O,removeNode:P,renameNode:T,moveNode:M,moveGroup:Y,setGroupLayout:z,toggleExpanded:H,replaceConfig:Z,branchGroups:b,addField:ie,renameField:be,removeField:ee,connectEdge:re,replaceConnection:le,disconnectEdge:ue,disconnectInEdges:fe,disconnectOutEdges:B,toConfigNodes:V,toUINodes:F,toUIGroups:Q,toUIData:q,load:ae,commit:s.commit,undo:s.undo,redo:s.redo,canUndo:s.canUndo,canRedo:s.canRedo,clear:s.clear,reset:s.reset,revert:s.revert,isValidConnection:N,isValidVueFlowConnection:S,validateGraph:()=>C(),clearPendingLayout:f,setPendingFitView:u}});function at(){const e=T1();if(!e)throw new Error("Editor state is not provided. Ensure you are using provideEditorStore in a parent component.");return e}const Cl=Ye.createGlobalState(()=>{const e=Ye.useLocalStorage("datakit-editor-mode","flow"),n=Ye.useLocalStorage("datakit-editor-sidebar-expanded",!0);return{editorMode:e,sidePanelExpanded:n}});function ui(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function sn(e){return typeof e=="function"?e():t.unref(e)}const P1=typeof window<"u"&&typeof document<"u",O1=e=>typeof e<"u",$1=Object.prototype.toString,B1=e=>$1.call(e)==="[object Object]",V1=()=>{};function R1(e,n){function o(...r){return new Promise((i,a)=>{Promise.resolve(e(()=>n.apply(this,r),{fn:n,thisArg:this,args:r})).then(i).catch(a)})}return o}const Wu=e=>e();function D1(e=Wu){const n=t.ref(!0);function o(){n.value=!1}function r(){n.value=!0}const i=(...a)=>{n.value&&e(...a)};return{isActive:t.readonly(n),pause:o,resume:r,eventFilter:i}}function Xu(e,n=!1,o="Timeout"){return new Promise((r,i)=>{setTimeout(n?()=>i(o):r,e)})}function M1(e,n,o={}){const{eventFilter:r=Wu,...i}=o;return t.watch(e,R1(r,n),i)}function Eo(e,n,o={}){const{eventFilter:r,...i}=o,{eventFilter:a,pause:l,resume:s,isActive:c}=D1(r);return{stop:M1(e,n,{...i,eventFilter:a}),pause:l,resume:s,isActive:c}}function L1(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const r in e.value)o[r]=t.customRef(()=>({get(){return e.value[r]},set(i){var a;if((a=sn(n.replaceRef))!=null?a:!0)if(Array.isArray(e.value)){const s=[...e.value];s[r]=i,e.value=s}else{const s={...e.value,[r]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[r]=i}}));return o}function El(e,n=!1){function o(u,{flush:p="sync",deep:m=!1,timeout:y,throwOnTimeout:_}={}){let g=null;const w=[new Promise(b=>{g=t.watch(e,x=>{u(x)!==n&&(g==null||g(),b(x))},{flush:p,deep:m,immediate:!0})})];return y!=null&&w.push(Xu(y,_).then(()=>sn(e)).finally(()=>g==null?void 0:g())),Promise.race(w)}function r(u,p){if(!t.isRef(u))return o(x=>x===u,p);const{flush:m="sync",deep:y=!1,timeout:_,throwOnTimeout:g}=p??{};let h=null;const b=[new Promise(x=>{h=t.watch([e,u],([E,C])=>{n!==(E===C)&&(h==null||h(),x(E))},{flush:m,deep:y,immediate:!0})})];return _!=null&&b.push(Xu(_,g).then(()=>sn(e)).finally(()=>(h==null||h(),sn(e)))),Promise.race(b)}function i(u){return o(p=>!!p,u)}function a(u){return r(null,u)}function l(u){return r(void 0,u)}function s(u){return o(Number.isNaN,u)}function c(u,p){return o(m=>{const y=Array.from(m);return y.includes(u)||y.includes(sn(u))},p)}function d(u){return f(1,u)}function f(u=1,p){let m=-1;return o(()=>(m+=1,m>=u),p)}return Array.isArray(sn(e))?{toMatch:o,toContains:c,changed:d,changedTimes:f,get not(){return El(e,!n)}}:{toMatch:o,toBe:r,toBeTruthy:i,toBeNull:a,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:f,get not(){return El(e,!n)}}}function Nl(e){return El(e)}function F1(e){var n;const o=sn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Zu=P1?window:void 0;function Ju(...e){let n,o,r,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,r,i]=e,n=Zu):[n,o,r,i]=e,!n)return V1;Array.isArray(o)||(o=[o]),Array.isArray(r)||(r=[r]);const a=[],l=()=>{a.forEach(f=>f()),a.length=0},s=(f,u,p,m)=>(f.addEventListener(u,p,m),()=>f.removeEventListener(u,p,m)),c=t.watch(()=>[F1(n),sn(i)],([f,u])=>{if(l(),!f)return;const p=B1(u)?{...u}:u;a.push(...o.flatMap(m=>r.map(y=>s(f,m,y,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ui(d),d}function U1(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Qu(...e){let n,o,r={};e.length===3?(n=e[0],o=e[1],r=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],r=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:i=Zu,eventName:a="keydown",passive:l=!1,dedupe:s=!1}=r,c=U1(n);return Ju(i,a,f=>{f.repeat&&sn(s)||c(f)&&o(f)},l)}function K1(e){return JSON.parse(JSON.stringify(e))}function Sl(e,n,o,r={}){var i,a,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:f=!1,defaultValue:u,shouldEmit:p}=r,m=t.getCurrentInstance(),y=o||(m==null?void 0:m.emit)||((i=m==null?void 0:m.$emit)==null?void 0:i.bind(m))||((l=(a=m==null?void 0:m.proxy)==null?void 0:a.$emit)==null?void 0:l.bind(m==null?void 0:m.proxy));let _=d;n||(n="modelValue"),_=_||`update:${n.toString()}`;const g=b=>s?typeof s=="function"?s(b):K1(b):b,h=()=>O1(e[n])?g(e[n]):u,w=b=>{p?p(b)&&y(_,b):y(_,b)};if(c){const b=h(),x=t.ref(b);let E=!1;return t.watch(()=>e[n],C=>{E||(E=!0,x.value=g(C),t.nextTick(()=>E=!1))}),t.watch(x,C=>{!E&&(C!==e[n]||f)&&w(C)},{deep:f}),x}else return t.computed({get(){return h()},set(b){w(b)}})}var j1={value:()=>{}};function fi(){for(var e=0,n=arguments.length,o={},r;e<n;++e){if(!(r=arguments[e]+"")||r in o||/[\s.]/.test(r))throw new Error("illegal type: "+r);o[r]=[]}return new pi(o)}function pi(e){this._=e}function G1(e,n){return e.trim().split(/^|\s+/).map(function(o){var r="",i=o.indexOf(".");if(i>=0&&(r=o.slice(i+1),o=o.slice(0,i)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:r}})}pi.prototype=fi.prototype={constructor:pi,on:function(e,n){var o=this._,r=G1(e+"",o),i,a=-1,l=r.length;if(arguments.length<2){for(;++a<l;)if((i=(e=r[a]).type)&&(i=q1(o[i],e.name)))return i;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++a<l;)if(i=(e=r[a]).type)o[i]=ef(o[i],e.name,n);else if(n==null)for(i in o)o[i]=ef(o[i],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new pi(e)},call:function(e,n){if((i=arguments.length-2)>0)for(var o=new Array(i),r=0,i,a;r<i;++r)o[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)}};function q1(e,n){for(var o=0,r=e.length,i;o<r;++o)if((i=e[o]).name===n)return i.value}function ef(e,n,o){for(var r=0,i=e.length;r<i;++r)if(e[r].name===n){e[r]=j1,e=e.slice(0,r).concat(e.slice(r+1));break}return o!=null&&e.push({name:n,value:o}),e}var xl="http://www.w3.org/1999/xhtml";const tf={svg:"http://www.w3.org/2000/svg",xhtml:xl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function mi(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),tf.hasOwnProperty(n)?{space:tf[n],local:e}:e}function z1(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===xl&&n.documentElement.namespaceURI===xl?n.createElement(e):n.createElementNS(o,e)}}function H1(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function nf(e){var n=mi(e);return(n.local?H1:z1)(n)}function Y1(){}function vl(e){return e==null?Y1:function(){return this.querySelector(e)}}function W1(e){typeof e!="function"&&(e=vl(e));for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i)for(var a=n[i],l=a.length,s=r[i]=new Array(l),c,d,f=0;f<l;++f)(c=a[f])&&(d=e.call(c,c.__data__,f,a))&&("__data__"in c&&(d.__data__=c.__data__),s[f]=d);return new Tt(r,this._parents)}function X1(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Z1(){return[]}function of(e){return e==null?Z1:function(){return this.querySelectorAll(e)}}function J1(e){return function(){return X1(e.apply(this,arguments))}}function Q1(e){typeof e=="function"?e=J1(e):e=of(e);for(var n=this._groups,o=n.length,r=[],i=[],a=0;a<o;++a)for(var l=n[a],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(r.push(e.call(c,c.__data__,d,l)),i.push(c));return new Tt(r,i)}function rf(e){return function(){return this.matches(e)}}function af(e){return function(n){return n.matches(e)}}var eS=Array.prototype.find;function tS(e){return function(){return eS.call(this.children,e)}}function nS(){return this.firstElementChild}function oS(e){return this.select(e==null?nS:tS(typeof e=="function"?e:af(e)))}var rS=Array.prototype.filter;function iS(){return Array.from(this.children)}function aS(e){return function(){return rS.call(this.children,e)}}function lS(e){return this.selectAll(e==null?iS:aS(typeof e=="function"?e:af(e)))}function sS(e){typeof e!="function"&&(e=rf(e));for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i)for(var a=n[i],l=a.length,s=r[i]=[],c,d=0;d<l;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new Tt(r,this._parents)}function lf(e){return new Array(e.length)}function cS(){return new Tt(this._enter||this._groups.map(lf),this._parents)}function gi(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}gi.prototype={constructor:gi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function dS(e){return function(){return e}}function uS(e,n,o,r,i,a){for(var l=0,s,c=n.length,d=a.length;l<d;++l)(s=n[l])?(s.__data__=a[l],r[l]=s):o[l]=new gi(e,a[l]);for(;l<c;++l)(s=n[l])&&(i[l]=s)}function fS(e,n,o,r,i,a,l){var s,c,d=new Map,f=n.length,u=a.length,p=new Array(f),m;for(s=0;s<f;++s)(c=n[s])&&(p[s]=m=l.call(c,c.__data__,s,n)+"",d.has(m)?i[s]=c:d.set(m,c));for(s=0;s<u;++s)m=l.call(e,a[s],s,a)+"",(c=d.get(m))?(r[s]=c,c.__data__=a[s],d.delete(m)):o[s]=new gi(e,a[s]);for(s=0;s<f;++s)(c=n[s])&&d.get(p[s])===c&&(i[s]=c)}function pS(e){return e.__data__}function mS(e,n){if(!arguments.length)return Array.from(this,pS);var o=n?fS:uS,r=this._parents,i=this._groups;typeof e!="function"&&(e=dS(e));for(var a=i.length,l=new Array(a),s=new Array(a),c=new Array(a),d=0;d<a;++d){var f=r[d],u=i[d],p=u.length,m=gS(e.call(f,f&&f.__data__,d,r)),y=m.length,_=s[d]=new Array(y),g=l[d]=new Array(y),h=c[d]=new Array(p);o(f,u,_,g,h,m,n);for(var w=0,b=0,x,E;w<y;++w)if(x=_[w]){for(w>=b&&(b=w+1);!(E=g[b])&&++b<y;);x._next=E||null}}return l=new Tt(l,r),l._enter=s,l._exit=c,l}function gS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hS(){return new Tt(this._exit||this._groups.map(lf),this._parents)}function yS(e,n,o){var r=this.enter(),i=this,a=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),n!=null&&(i=n(i),i&&(i=i.selection())),o==null?a.remove():o(a),r&&i?r.merge(i).order():i}function _S(e){for(var n=e.selection?e.selection():e,o=this._groups,r=n._groups,i=o.length,a=r.length,l=Math.min(i,a),s=new Array(i),c=0;c<l;++c)for(var d=o[c],f=r[c],u=d.length,p=s[c]=new Array(u),m,y=0;y<u;++y)(m=d[y]||f[y])&&(p[y]=m);for(;c<i;++c)s[c]=o[c];return new Tt(s,this._parents)}function bS(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var r=e[n],i=r.length-1,a=r[i],l;--i>=0;)(l=r[i])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function wS(e){e||(e=kS);function n(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a){for(var l=o[a],s=l.length,c=i[a]=new Array(s),d,f=0;f<s;++f)(d=l[f])&&(c[f]=d);c.sort(n)}return new Tt(i,this._parents).order()}function kS(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function CS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ES(){return Array.from(this)}function NS(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,a=r.length;i<a;++i){var l=r[i];if(l)return l}return null}function SS(){let e=0;for(const n of this)++e;return e}function xS(){return!this.node()}function vS(e){for(var n=this._groups,o=0,r=n.length;o<r;++o)for(var i=n[o],a=0,l=i.length,s;a<l;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function AS(e){return function(){this.removeAttribute(e)}}function IS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function TS(e,n){return function(){this.setAttribute(e,n)}}function PS(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function OS(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function $S(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function BS(e,n){var o=mi(e);if(arguments.length<2){var r=this.node();return o.local?r.getAttributeNS(o.space,o.local):r.getAttribute(o)}return this.each((n==null?o.local?IS:AS:typeof n=="function"?o.local?$S:OS:o.local?PS:TS)(o,n))}function sf(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function VS(e){return function(){this.style.removeProperty(e)}}function RS(e,n,o){return function(){this.style.setProperty(e,n,o)}}function DS(e,n,o){return function(){var r=n.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,o)}}function MS(e,n,o){return arguments.length>1?this.each((n==null?VS:typeof n=="function"?DS:RS)(e,n,o??"")):No(this.node(),e)}function No(e,n){return e.style.getPropertyValue(n)||sf(e).getComputedStyle(e,null).getPropertyValue(n)}function LS(e){return function(){delete this[e]}}function FS(e,n){return function(){this[e]=n}}function US(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function KS(e,n){return arguments.length>1?this.each((n==null?LS:typeof n=="function"?US:FS)(e,n)):this.node()[e]}function cf(e){return e.trim().split(/^|\s+/)}function Al(e){return e.classList||new df(e)}function df(e){this._node=e,this._names=cf(e.getAttribute("class")||"")}df.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function uf(e,n){for(var o=Al(e),r=-1,i=n.length;++r<i;)o.add(n[r])}function ff(e,n){for(var o=Al(e),r=-1,i=n.length;++r<i;)o.remove(n[r])}function jS(e){return function(){uf(this,e)}}function GS(e){return function(){ff(this,e)}}function qS(e,n){return function(){(n.apply(this,arguments)?uf:ff)(this,e)}}function zS(e,n){var o=cf(e+"");if(arguments.length<2){for(var r=Al(this.node()),i=-1,a=o.length;++i<a;)if(!r.contains(o[i]))return!1;return!0}return this.each((typeof n=="function"?qS:n?jS:GS)(o,n))}function HS(){this.textContent=""}function YS(e){return function(){this.textContent=e}}function WS(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function XS(e){return arguments.length?this.each(e==null?HS:(typeof e=="function"?WS:YS)(e)):this.node().textContent}function ZS(){this.innerHTML=""}function JS(e){return function(){this.innerHTML=e}}function QS(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function ex(e){return arguments.length?this.each(e==null?ZS:(typeof e=="function"?QS:JS)(e)):this.node().innerHTML}function tx(){this.nextSibling&&this.parentNode.appendChild(this)}function nx(){return this.each(tx)}function ox(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rx(){return this.each(ox)}function ix(e){var n=typeof e=="function"?e:nf(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function ax(){return null}function lx(e,n){var o=typeof e=="function"?e:nf(e),r=n==null?ax:typeof n=="function"?n:vl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),r.apply(this,arguments)||null)})}function sx(){var e=this.parentNode;e&&e.removeChild(this)}function cx(){return this.each(sx)}function dx(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function ux(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function fx(e){return this.select(e?ux:dx)}function px(e){return arguments.length?this.property("__data__",e):this.node().__data__}function mx(e){return function(n){e.call(this,n,this.__data__)}}function gx(e){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");return r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),{type:n,name:o}})}function hx(e){return function(){var n=this.__on;if(n){for(var o=0,r=-1,i=n.length,a;o<i;++o)a=n[o],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):n[++r]=a;++r?n.length=r:delete this.__on}}}function yx(e,n,o){return function(){var r=this.__on,i,a=mx(n);if(r){for(var l=0,s=r.length;l<s;++l)if((i=r[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=o),i.value=n;return}}this.addEventListener(e.type,a,o),i={type:e.type,name:e.name,value:n,listener:a,options:o},r?r.push(i):this.__on=[i]}}function _x(e,n,o){var r=gx(e+""),i,a=r.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,f;c<d;++c)for(i=0,f=s[c];i<a;++i)if((l=r[i]).type===f.type&&l.name===f.name)return f.value}return}for(s=n?yx:hx,i=0;i<a;++i)this.each(s(r[i],n,o));return this}function pf(e,n,o){var r=sf(e),i=r.CustomEvent;typeof i=="function"?i=new i(n,o):(i=r.document.createEvent("Event"),o?(i.initEvent(n,o.bubbles,o.cancelable),i.detail=o.detail):i.initEvent(n,!1,!1)),e.dispatchEvent(i)}function bx(e,n){return function(){return pf(this,e,n)}}function wx(e,n){return function(){return pf(this,e,n.apply(this,arguments))}}function kx(e,n){return this.each((typeof n=="function"?wx:bx)(e,n))}function*Cx(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,a=r.length,l;i<a;++i)(l=r[i])&&(yield l)}var mf=[null];function Tt(e,n){this._groups=e,this._parents=n}function rr(){return new Tt([[document.documentElement]],mf)}function Ex(){return this}Tt.prototype=rr.prototype={constructor:Tt,select:W1,selectAll:Q1,selectChild:oS,selectChildren:lS,filter:sS,data:mS,enter:cS,exit:hS,join:yS,merge:_S,selection:Ex,order:bS,sort:wS,call:CS,nodes:ES,node:NS,size:SS,empty:xS,each:vS,attr:BS,style:MS,property:KS,classed:zS,text:XS,html:ex,raise:nx,lower:rx,append:ix,insert:lx,remove:cx,clone:fx,datum:px,on:_x,dispatch:kx,[Symbol.iterator]:Cx};function Ft(e){return typeof e=="string"?new Tt([[document.querySelector(e)]],[document.documentElement]):new Tt([[e]],mf)}function Nx(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Ht(e,n){if(e=Nx(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var r=o.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[e.clientX-i.left-n.clientLeft,e.clientY-i.top-n.clientTop]}}return[e.pageX,e.pageY]}const Sx={passive:!1},ir={capture:!0,passive:!1};function Il(e){e.stopImmediatePropagation()}function So(e){e.preventDefault(),e.stopImmediatePropagation()}function gf(e){var n=e.document.documentElement,o=Ft(e).on("dragstart.drag",So,ir);"onselectstart"in n?o.on("selectstart.drag",So,ir):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function hf(e,n){var o=e.document.documentElement,r=Ft(e).on("dragstart.drag",null);n&&(r.on("click.drag",So,ir),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in o?r.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const hi=e=>()=>e;function Tl(e,{sourceEvent:n,subject:o,target:r,identifier:i,active:a,x:l,y:s,dx:c,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}Tl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xx(e){return!e.ctrlKey&&!e.button}function vx(){return this.parentNode}function Ax(e,n){return n??{x:e.x,y:e.y}}function Ix(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tx(){var e=xx,n=vx,o=Ax,r=Ix,i={},a=fi("start","drag","end"),l=0,s,c,d,f,u=0;function p(x){x.on("mousedown.drag",m).filter(r).on("touchstart.drag",g).on("touchmove.drag",h,Sx).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(x,E){if(!(f||!e.call(this,x,E))){var C=b(this,n.call(this,x,E),x,E,"mouse");C&&(Ft(x.view).on("mousemove.drag",y,ir).on("mouseup.drag",_,ir),gf(x.view),Il(x),d=!1,s=x.clientX,c=x.clientY,C("start",x))}}function y(x){if(So(x),!d){var E=x.clientX-s,C=x.clientY-c;d=E*E+C*C>u}i.mouse("drag",x)}function _(x){Ft(x.view).on("mousemove.drag mouseup.drag",null),hf(x.view,d),So(x),i.mouse("end",x)}function g(x,E){if(e.call(this,x,E)){var C=x.changedTouches,N=n.call(this,x,E),S=C.length,v,D;for(v=0;v<S;++v)(D=b(this,N,x,E,C[v].identifier,C[v]))&&(Il(x),D("start",x,C[v]))}}function h(x){var E=x.changedTouches,C=E.length,N,S;for(N=0;N<C;++N)(S=i[E[N].identifier])&&(So(x),S("drag",x,E[N]))}function w(x){var E=x.changedTouches,C=E.length,N,S;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),N=0;N<C;++N)(S=i[E[N].identifier])&&(Il(x),S("end",x,E[N]))}function b(x,E,C,N,S,v){var D=a.copy(),L=Ht(v||C,E),k,J,I;if((I=o.call(x,new Tl("beforestart",{sourceEvent:C,target:p,identifier:S,active:l,x:L[0],y:L[1],dx:0,dy:0,dispatch:D}),N))!=null)return k=I.x-L[0]||0,J=I.y-L[1]||0,function G(j,te,K){var O=L,P;switch(j){case"start":i[S]=G,P=l++;break;case"end":delete i[S],--l;case"drag":L=Ht(K||te,E),P=l;break}D.call(j,x,new Tl(j,{sourceEvent:te,subject:I,target:p,identifier:S,active:P,x:L[0]+k,y:L[1]+J,dx:L[0]-O[0],dy:L[1]-O[1],dispatch:D}),N)}}return p.filter=function(x){return arguments.length?(e=typeof x=="function"?x:hi(!!x),p):e},p.container=function(x){return arguments.length?(n=typeof x=="function"?x:hi(x),p):n},p.subject=function(x){return arguments.length?(o=typeof x=="function"?x:hi(x),p):o},p.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:hi(!!x),p):r},p.on=function(){var x=a.on.apply(a,arguments);return x===a?p:x},p.clickDistance=function(x){return arguments.length?(u=(x=+x)*x,p):Math.sqrt(u)},p}function Pl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function yf(e,n){var o=Object.create(e.prototype);for(var r in n)o[r]=n[r];return o}function ar(){}var lr=.7,yi=1/lr,xo="\\s*([+-]?\\d+)\\s*",sr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Px=/^#([0-9a-f]{3,8})$/,Ox=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),$x=new RegExp(`^rgb\\(${Yt},${Yt},${Yt}\\)$`),Bx=new RegExp(`^rgba\\(${xo},${xo},${xo},${sr}\\)$`),Vx=new RegExp(`^rgba\\(${Yt},${Yt},${Yt},${sr}\\)$`),Rx=new RegExp(`^hsl\\(${sr},${Yt},${Yt}\\)$`),Dx=new RegExp(`^hsla\\(${sr},${Yt},${Yt},${sr}\\)$`),_f={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Pl(ar,Un,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bf,formatHex:bf,formatHex8:Mx,formatHsl:Lx,formatRgb:wf,toString:wf});function bf(){return this.rgb().formatHex()}function Mx(){return this.rgb().formatHex8()}function Lx(){return Sf(this).formatHsl()}function wf(){return this.rgb().formatRgb()}function Un(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Px.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?kf(n):o===3?new vt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?_i(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?_i(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Ox.exec(e))?new vt(n[1],n[2],n[3],1):(n=$x.exec(e))?new vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Bx.exec(e))?_i(n[1],n[2],n[3],n[4]):(n=Vx.exec(e))?_i(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Rx.exec(e))?Nf(n[1],n[2]/100,n[3]/100,1):(n=Dx.exec(e))?Nf(n[1],n[2]/100,n[3]/100,n[4]):_f.hasOwnProperty(e)?kf(_f[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function kf(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function _i(e,n,o,r){return r<=0&&(e=n=o=NaN),new vt(e,n,o,r)}function Fx(e){return e instanceof ar||(e=Un(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function Ol(e,n,o,r){return arguments.length===1?Fx(e):new vt(e,n,o,r??1)}function vt(e,n,o,r){this.r=+e,this.g=+n,this.b=+o,this.opacity=+r}Pl(vt,Ol,yf(ar,{brighter(e){return e=e==null?yi:Math.pow(yi,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?lr:Math.pow(lr,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(Kn(this.r),Kn(this.g),Kn(this.b),bi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Cf,formatHex:Cf,formatHex8:Ux,formatRgb:Ef,toString:Ef}));function Cf(){return`#${jn(this.r)}${jn(this.g)}${jn(this.b)}`}function Ux(){return`#${jn(this.r)}${jn(this.g)}${jn(this.b)}${jn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ef(){const e=bi(this.opacity);return`${e===1?"rgb(":"rgba("}${Kn(this.r)}, ${Kn(this.g)}, ${Kn(this.b)}${e===1?")":`, ${e})`}`}function bi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jn(e){return e=Kn(e),(e<16?"0":"")+e.toString(16)}function Nf(e,n,o,r){return r<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Ut(e,n,o,r)}function Sf(e){if(e instanceof Ut)return new Ut(e.h,e.s,e.l,e.opacity);if(e instanceof ar||(e=Un(e)),!e)return new Ut;if(e instanceof Ut)return e;e=e.rgb();var n=e.r/255,o=e.g/255,r=e.b/255,i=Math.min(n,o,r),a=Math.max(n,o,r),l=NaN,s=a-i,c=(a+i)/2;return s?(n===a?l=(o-r)/s+(o<r)*6:o===a?l=(r-n)/s+2:l=(n-o)/s+4,s/=c<.5?a+i:2-a-i,l*=60):s=c>0&&c<1?0:l,new Ut(l,s,c,e.opacity)}function Kx(e,n,o,r){return arguments.length===1?Sf(e):new Ut(e,n,o,r??1)}function Ut(e,n,o,r){this.h=+e,this.s=+n,this.l=+o,this.opacity=+r}Pl(Ut,Kx,yf(ar,{brighter(e){return e=e==null?yi:Math.pow(yi,e),new Ut(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?lr:Math.pow(lr,e),new Ut(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,r=o+(o<.5?o:1-o)*n,i=2*o-r;return new vt($l(e>=240?e-240:e+120,i,r),$l(e,i,r),$l(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ut(xf(this.h),wi(this.s),wi(this.l),bi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=bi(this.opacity);return`${e===1?"hsl(":"hsla("}${xf(this.h)}, ${wi(this.s)*100}%, ${wi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xf(e){return e=(e||0)%360,e<0?e+360:e}function wi(e){return Math.max(0,Math.min(1,e||0))}function $l(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Bl=e=>()=>e;function jx(e,n){return function(o){return e+o*n}}function Gx(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(r){return Math.pow(e+r*n,o)}}function qx(e){return(e=+e)==1?vf:function(n,o){return o-n?Gx(n,o,e):Bl(isNaN(n)?o:n)}}function vf(e,n){var o=n-e;return o?jx(e,o):Bl(isNaN(e)?n:e)}const ki=function e(n){var o=qx(n);function r(i,a){var l=o((i=Ol(i)).r,(a=Ol(a)).r),s=o(i.g,a.g),c=o(i.b,a.b),d=vf(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=s(f),i.b=c(f),i.opacity=d(f),i+""}}return r.gamma=e,r}(1);function zx(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,r=n.slice(),i;return function(a){for(i=0;i<o;++i)r[i]=e[i]*(1-a)+n[i]*a;return r}}function Hx(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Yx(e,n){var o=n?n.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),a=new Array(o),l;for(l=0;l<r;++l)i[l]=cr(e[l],n[l]);for(;l<o;++l)a[l]=n[l];return function(s){for(l=0;l<r;++l)a[l]=i[l](s);return a}}function Wx(e,n){var o=new Date;return e=+e,n=+n,function(r){return o.setTime(e*(1-r)+n*r),o}}function Wt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function Xx(e,n){var o={},r={},i;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(i in n)i in e?o[i]=cr(e[i],n[i]):r[i]=n[i];return function(a){for(i in o)r[i]=o[i](a);return r}}var Vl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rl=new RegExp(Vl.source,"g");function Zx(e){return function(){return e}}function Jx(e){return function(n){return e(n)+""}}function Af(e,n){var o=Vl.lastIndex=Rl.lastIndex=0,r,i,a,l=-1,s=[],c=[];for(e=e+"",n=n+"";(r=Vl.exec(e))&&(i=Rl.exec(n));)(a=i.index)>o&&(a=n.slice(o,a),s[l]?s[l]+=a:s[++l]=a),(r=r[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,c.push({i:l,x:Wt(r,i)})),o=Rl.lastIndex;return o<n.length&&(a=n.slice(o),s[l]?s[l]+=a:s[++l]=a),s.length<2?c[0]?Jx(c[0].x):Zx(n):(n=c.length,function(d){for(var f=0,u;f<n;++f)s[(u=c[f]).i]=u.x(d);return s.join("")})}function cr(e,n){var o=typeof n,r;return n==null||o==="boolean"?Bl(n):(o==="number"?Wt:o==="string"?(r=Un(n))?(n=r,ki):Af:n instanceof Un?ki:n instanceof Date?Wx:Hx(n)?zx:Array.isArray(n)?Yx:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?Xx:Wt)(e,n)}var If=180/Math.PI,Dl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Tf(e,n,o,r,i,a){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*r)&&(o-=e*c,r-=n*c),(s=Math.sqrt(o*o+r*r))&&(o/=s,r/=s,c/=s),e*r<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:i,translateY:a,rotate:Math.atan2(n,e)*If,skewX:Math.atan(c)*If,scaleX:l,scaleY:s}}var Ci;function Qx(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Dl:Tf(n.a,n.b,n.c,n.d,n.e,n.f)}function ev(e){return e==null||(Ci||(Ci=document.createElementNS("http://www.w3.org/2000/svg","g")),Ci.setAttribute("transform",e),!(e=Ci.transform.baseVal.consolidate()))?Dl:(e=e.matrix,Tf(e.a,e.b,e.c,e.d,e.e,e.f))}function Pf(e,n,o,r){function i(d){return d.length?d.pop()+" ":""}function a(d,f,u,p,m,y){if(d!==u||f!==p){var _=m.push("translate(",null,n,null,o);y.push({i:_-4,x:Wt(d,u)},{i:_-2,x:Wt(f,p)})}else(u||p)&&m.push("translate("+u+n+p+o)}function l(d,f,u,p){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),p.push({i:u.push(i(u)+"rotate(",null,r)-2,x:Wt(d,f)})):f&&u.push(i(u)+"rotate("+f+r)}function s(d,f,u,p){d!==f?p.push({i:u.push(i(u)+"skewX(",null,r)-2,x:Wt(d,f)}):f&&u.push(i(u)+"skewX("+f+r)}function c(d,f,u,p,m,y){if(d!==u||f!==p){var _=m.push(i(m)+"scale(",null,",",null,")");y.push({i:_-4,x:Wt(d,u)},{i:_-2,x:Wt(f,p)})}else(u!==1||p!==1)&&m.push(i(m)+"scale("+u+","+p+")")}return function(d,f){var u=[],p=[];return d=e(d),f=e(f),a(d.translateX,d.translateY,f.translateX,f.translateY,u,p),l(d.rotate,f.rotate,u,p),s(d.skewX,f.skewX,u,p),c(d.scaleX,d.scaleY,f.scaleX,f.scaleY,u,p),d=f=null,function(m){for(var y=-1,_=p.length,g;++y<_;)u[(g=p[y]).i]=g.x(m);return u.join("")}}}var tv=Pf(Qx,"px, ","px)","deg)"),nv=Pf(ev,", ",")",")"),ov=1e-12;function Of(e){return((e=Math.exp(e))+1/e)/2}function rv(e){return((e=Math.exp(e))-1/e)/2}function iv(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ei=function e(n,o,r){function i(a,l){var s=a[0],c=a[1],d=a[2],f=l[0],u=l[1],p=l[2],m=f-s,y=u-c,_=m*m+y*y,g,h;if(_<ov)h=Math.log(p/d)/n,g=function(N){return[s+N*m,c+N*y,d*Math.exp(n*N*h)]};else{var w=Math.sqrt(_),b=(p*p-d*d+r*_)/(2*d*o*w),x=(p*p-d*d-r*_)/(2*p*o*w),E=Math.log(Math.sqrt(b*b+1)-b),C=Math.log(Math.sqrt(x*x+1)-x);h=(C-E)/n,g=function(N){var S=N*h,v=Of(E),D=d/(o*w)*(v*iv(n*S+E)-rv(E));return[s+D*m,c+D*y,d*v/Of(n*S+E)]}}return g.duration=h*1e3*n/Math.SQRT2,g}return i.rho=function(a){var l=Math.max(.001,+a),s=l*l,c=s*s;return e(l,s,c)},i}(Math.SQRT2,2,4);var vo=0,dr=0,ur=0,$f=1e3,Ni,fr,Si=0,Gn=0,xi=0,pr=typeof performance=="object"&&performance.now?performance:Date,Bf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ml(){return Gn||(Bf(av),Gn=pr.now()+xi)}function av(){Gn=0}function vi(){this._call=this._time=this._next=null}vi.prototype=Vf.prototype={constructor:vi,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ml():+o)+(n==null?0:+n),!this._next&&fr!==this&&(fr?fr._next=this:Ni=this,fr=this),this._call=e,this._time=o,Ll()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ll())}};function Vf(e,n,o){var r=new vi;return r.restart(e,n,o),r}function lv(){Ml(),++vo;for(var e=Ni,n;e;)(n=Gn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--vo}function Rf(){Gn=(Si=pr.now())+xi,vo=dr=0;try{lv()}finally{vo=0,cv(),Gn=0}}function sv(){var e=pr.now(),n=e-Si;n>$f&&(xi-=n,Si=e)}function cv(){for(var e,n=Ni,o,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ni=o);fr=e,Ll(r)}function Ll(e){if(!vo){dr&&(dr=clearTimeout(dr));var n=e-Gn;n>24?(e<1/0&&(dr=setTimeout(Rf,e-pr.now()-xi)),ur&&(ur=clearInterval(ur))):(ur||(Si=pr.now(),ur=setInterval(sv,$f)),vo=1,Bf(Rf))}}function Df(e,n,o){var r=new vi;return n=n==null?0:+n,r.restart(i=>{r.stop(),e(i+n)},n,o),r}var dv=fi("start","end","cancel","interrupt"),uv=[],Mf=0,Lf=1,Fl=2,Ai=3,Ff=4,Ul=5,Ii=6;function Ti(e,n,o,r,i,a){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;fv(e,o,{name:n,index:r,group:i,on:dv,tween:uv,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Mf})}function Kl(e,n){var o=Kt(e,n);if(o.state>Mf)throw new Error("too late; already scheduled");return o}function Xt(e,n){var o=Kt(e,n);if(o.state>Ai)throw new Error("too late; already running");return o}function Kt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function fv(e,n,o){var r=e.__transition,i;r[n]=o,o.timer=Vf(a,0,o.time);function a(d){o.state=Lf,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var f,u,p,m;if(o.state!==Lf)return c();for(f in r)if(m=r[f],m.name===o.name){if(m.state===Ai)return Df(l);m.state===Ff?(m.state=Ii,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[f]):+f<n&&(m.state=Ii,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete r[f])}if(Df(function(){o.state===Ai&&(o.state=Ff,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Fl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Fl){for(o.state=Ai,i=new Array(p=o.tween.length),f=0,u=-1;f<p;++f)(m=o.tween[f].value.call(e,e.__data__,o.index,o.group))&&(i[++u]=m);i.length=u+1}}function s(d){for(var f=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Ul,1),u=-1,p=i.length;++u<p;)i[u].call(e,f);o.state===Ul&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ii,o.timer.stop(),delete r[n];for(var d in r)return;delete e.__transition}}function Pi(e,n){var o=e.__transition,r,i,a=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((r=o[l]).name!==n){a=!1;continue}i=r.state>Fl&&r.state<Ul,r.state=Ii,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete o[l]}a&&delete e.__transition}}function pv(e){return this.each(function(){Pi(this,e)})}function mv(e,n){var o,r;return function(){var i=Xt(this,e),a=i.tween;if(a!==o){r=o=a;for(var l=0,s=r.length;l<s;++l)if(r[l].name===n){r=r.slice(),r.splice(l,1);break}}i.tween=r}}function gv(e,n,o){var r,i;if(typeof o!="function")throw new Error;return function(){var a=Xt(this,e),l=a.tween;if(l!==r){i=(r=l).slice();for(var s={name:n,value:o},c=0,d=i.length;c<d;++c)if(i[c].name===n){i[c]=s;break}c===d&&i.push(s)}a.tween=i}}function hv(e,n){var o=this._id;if(e+="",arguments.length<2){for(var r=Kt(this.node(),o).tween,i=0,a=r.length,l;i<a;++i)if((l=r[i]).name===e)return l.value;return null}return this.each((n==null?mv:gv)(o,e,n))}function jl(e,n,o){var r=e._id;return e.each(function(){var i=Xt(this,r);(i.value||(i.value={}))[n]=o.apply(this,arguments)}),function(i){return Kt(i,r).value[n]}}function Uf(e,n){var o;return(typeof n=="number"?Wt:n instanceof Un?ki:(o=Un(n))?(n=o,ki):Af)(e,n)}function yv(e){return function(){this.removeAttribute(e)}}function _v(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bv(e,n,o){var r,i=o+"",a;return function(){var l=this.getAttribute(e);return l===i?null:l===r?a:a=n(r=l,o)}}function wv(e,n,o){var r,i=o+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===r?a:a=n(r=l,o)}}function kv(e,n,o){var r,i,a;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===r&&c===i?a:(i=c,a=n(r=l,s)))}}function Cv(e,n,o){var r,i,a;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===r&&c===i?a:(i=c,a=n(r=l,s)))}}function Ev(e,n){var o=mi(e),r=o==="transform"?nv:Uf;return this.attrTween(e,typeof n=="function"?(o.local?Cv:kv)(o,r,jl(this,"attr."+e,n)):n==null?(o.local?_v:yv)(o):(o.local?wv:bv)(o,r,n))}function Nv(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function Sv(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function xv(e,n){var o,r;function i(){var a=n.apply(this,arguments);return a!==r&&(o=(r=a)&&Sv(e,a)),o}return i._value=n,i}function vv(e,n){var o,r;function i(){var a=n.apply(this,arguments);return a!==r&&(o=(r=a)&&Nv(e,a)),o}return i._value=n,i}function Av(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var r=mi(e);return this.tween(o,(r.local?xv:vv)(r,n))}function Iv(e,n){return function(){Kl(this,e).delay=+n.apply(this,arguments)}}function Tv(e,n){return n=+n,function(){Kl(this,e).delay=n}}function Pv(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Iv:Tv)(n,e)):Kt(this.node(),n).delay}function Ov(e,n){return function(){Xt(this,e).duration=+n.apply(this,arguments)}}function $v(e,n){return n=+n,function(){Xt(this,e).duration=n}}function Bv(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Ov:$v)(n,e)):Kt(this.node(),n).duration}function Vv(e,n){if(typeof n!="function")throw new Error;return function(){Xt(this,e).ease=n}}function Rv(e){var n=this._id;return arguments.length?this.each(Vv(n,e)):Kt(this.node(),n).ease}function Dv(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Xt(this,e).ease=o}}function Mv(e){if(typeof e!="function")throw new Error;return this.each(Dv(this._id,e))}function Lv(e){typeof e!="function"&&(e=rf(e));for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i)for(var a=n[i],l=a.length,s=r[i]=[],c,d=0;d<l;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new cn(r,this._parents,this._name,this._id)}function Fv(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,r=n.length,i=o.length,a=Math.min(r,i),l=new Array(r),s=0;s<a;++s)for(var c=n[s],d=o[s],f=c.length,u=l[s]=new Array(f),p,m=0;m<f;++m)(p=c[m]||d[m])&&(u[m]=p);for(;s<r;++s)l[s]=n[s];return new cn(l,this._parents,this._name,this._id)}function Uv(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function Kv(e,n,o){var r,i,a=Uv(n)?Kl:Xt;return function(){var l=a(this,e),s=l.on;s!==r&&(i=(r=s).copy()).on(n,o),l.on=i}}function jv(e,n){var o=this._id;return arguments.length<2?Kt(this.node(),o).on.on(e):this.each(Kv(o,e,n))}function Gv(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function qv(){return this.on("end.remove",Gv(this._id))}function zv(e){var n=this._name,o=this._id;typeof e!="function"&&(e=vl(e));for(var r=this._groups,i=r.length,a=new Array(i),l=0;l<i;++l)for(var s=r[l],c=s.length,d=a[l]=new Array(c),f,u,p=0;p<c;++p)(f=s[p])&&(u=e.call(f,f.__data__,p,s))&&("__data__"in f&&(u.__data__=f.__data__),d[p]=u,Ti(d[p],n,o,p,d,Kt(f,o)));return new cn(a,this._parents,n,o)}function Hv(e){var n=this._name,o=this._id;typeof e!="function"&&(e=of(e));for(var r=this._groups,i=r.length,a=[],l=[],s=0;s<i;++s)for(var c=r[s],d=c.length,f,u=0;u<d;++u)if(f=c[u]){for(var p=e.call(f,f.__data__,u,c),m,y=Kt(f,o),_=0,g=p.length;_<g;++_)(m=p[_])&&Ti(m,n,o,_,p,y);a.push(p),l.push(f)}return new cn(a,l,n,o)}var Yv=rr.prototype.constructor;function Wv(){return new Yv(this._groups,this._parents)}function Xv(e,n){var o,r,i;return function(){var a=No(this,e),l=(this.style.removeProperty(e),No(this,e));return a===l?null:a===o&&l===r?i:i=n(o=a,r=l)}}function Kf(e){return function(){this.style.removeProperty(e)}}function Zv(e,n,o){var r,i=o+"",a;return function(){var l=No(this,e);return l===i?null:l===r?a:a=n(r=l,o)}}function Jv(e,n,o){var r,i,a;return function(){var l=No(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),No(this,e))),l===c?null:l===r&&c===i?a:(i=c,a=n(r=l,s))}}function Qv(e,n){var o,r,i,a="style."+n,l="end."+a,s;return function(){var c=Xt(this,e),d=c.on,f=c.value[a]==null?s||(s=Kf(n)):void 0;(d!==o||i!==f)&&(r=(o=d).copy()).on(l,i=f),c.on=r}}function eA(e,n,o){var r=(e+="")=="transform"?tv:Uf;return n==null?this.styleTween(e,Xv(e,r)).on("end.style."+e,Kf(e)):typeof n=="function"?this.styleTween(e,Jv(e,r,jl(this,"style."+e,n))).each(Qv(this._id,e)):this.styleTween(e,Zv(e,r,n),o).on("end.style."+e,null)}function tA(e,n,o){return function(r){this.style.setProperty(e,n.call(this,r),o)}}function nA(e,n,o){var r,i;function a(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&tA(e,l,o)),r}return a._value=n,a}function oA(e,n,o){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;return this.tween(r,nA(e,n,o??""))}function rA(e){return function(){this.textContent=e}}function iA(e){return function(){var n=e(this);this.textContent=n??""}}function aA(e){return this.tween("text",typeof e=="function"?iA(jl(this,"text",e)):rA(e==null?"":e+""))}function lA(e){return function(n){this.textContent=e.call(this,n)}}function sA(e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&lA(i)),n}return r._value=e,r}function cA(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,sA(e))}function dA(){for(var e=this._name,n=this._id,o=jf(),r=this._groups,i=r.length,a=0;a<i;++a)for(var l=r[a],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var f=Kt(c,n);Ti(c,e,o,d,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new cn(r,this._parents,e,o)}function uA(){var e,n,o=this,r=o._id,i=o.size();return new Promise(function(a,l){var s={value:l},c={value:function(){--i===0&&a()}};o.each(function(){var d=Xt(this,r),f=d.on;f!==e&&(n=(e=f).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),i===0&&a()})}var fA=0;function cn(e,n,o,r){this._groups=e,this._parents=n,this._name=o,this._id=r}function jf(){return++fA}var dn=rr.prototype;cn.prototype={constructor:cn,select:zv,selectAll:Hv,selectChild:dn.selectChild,selectChildren:dn.selectChildren,filter:Lv,merge:Fv,selection:Wv,transition:dA,call:dn.call,nodes:dn.nodes,node:dn.node,size:dn.size,empty:dn.empty,each:dn.each,on:jv,attr:Ev,attrTween:Av,style:eA,styleTween:oA,text:aA,textTween:cA,remove:qv,tween:hv,delay:Pv,duration:Bv,ease:Rv,easeVarying:Mv,end:uA,[Symbol.iterator]:dn[Symbol.iterator]};function pA(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mA={time:null,delay:0,duration:250,ease:pA};function gA(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function hA(e){var n,o;e instanceof cn?(n=e._id,e=e._name):(n=jf(),(o=mA).time=Ml(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var l=r[a],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Ti(c,e,n,d,l,o||gA(c,n));return new cn(r,this._parents,e,n)}rr.prototype.interrupt=pv,rr.prototype.transition=hA;const Oi=e=>()=>e;function yA(e,{sourceEvent:n,target:o,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function un(e,n,o){this.k=e,this.x=n,this.y=o}un.prototype={constructor:un,scale:function(e){return e===1?this:new un(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new un(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ao=new un(1,0,0);un.prototype;function Gl(e){e.stopImmediatePropagation()}function mr(e){e.preventDefault(),e.stopImmediatePropagation()}function _A(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bA(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Gf(){return this.__zoom||Ao}function wA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function kA(){return navigator.maxTouchPoints||"ontouchstart"in this}function CA(e,n,o){var r=e.invertX(n[0][0])-o[0][0],i=e.invertX(n[1][0])-o[1][0],a=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function EA(){var e=_A,n=bA,o=CA,r=wA,i=kA,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ei,d=fi("start","zoom","end"),f,u,p,m=500,y=150,_=0,g=10;function h(I){I.property("__zoom",Gf).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",D).filter(i).on("touchstart.zoom",L).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}h.transform=function(I,G,j,te){var K=I.selection?I.selection():I;K.property("__zoom",Gf),I!==K?E(I,G,j,te):K.interrupt().each(function(){C(this,arguments).event(te).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},h.scaleBy=function(I,G,j,te){h.scaleTo(I,function(){var K=this.__zoom.k,O=typeof G=="function"?G.apply(this,arguments):G;return K*O},j,te)},h.scaleTo=function(I,G,j,te){h.transform(I,function(){var K=n.apply(this,arguments),O=this.__zoom,P=j==null?x(K):typeof j=="function"?j.apply(this,arguments):j,T=O.invert(P),M=typeof G=="function"?G.apply(this,arguments):G;return o(b(w(O,M),P,T),K,l)},j,te)},h.translateBy=function(I,G,j,te){h.transform(I,function(){return o(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof j=="function"?j.apply(this,arguments):j),n.apply(this,arguments),l)},null,te)},h.translateTo=function(I,G,j,te,K){h.transform(I,function(){var O=n.apply(this,arguments),P=this.__zoom,T=te==null?x(O):typeof te=="function"?te.apply(this,arguments):te;return o(Ao.translate(T[0],T[1]).scale(P.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof j=="function"?-j.apply(this,arguments):-j),O,l)},te,K)};function w(I,G){return G=Math.max(a[0],Math.min(a[1],G)),G===I.k?I:new un(G,I.x,I.y)}function b(I,G,j){var te=G[0]-j[0]*I.k,K=G[1]-j[1]*I.k;return te===I.x&&K===I.y?I:new un(I.k,te,K)}function x(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function E(I,G,j,te){I.on("start.zoom",function(){C(this,arguments).event(te).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(te).end()}).tween("zoom",function(){var K=this,O=arguments,P=C(K,O).event(te),T=n.apply(K,O),M=j==null?x(T):typeof j=="function"?j.apply(K,O):j,Y=Math.max(T[1][0]-T[0][0],T[1][1]-T[0][1]),z=K.__zoom,H=typeof G=="function"?G.apply(K,O):G,Z=c(z.invert(M).concat(Y/z.k),H.invert(M).concat(Y/H.k));return function(ie){if(ie===1)ie=H;else{var be=Z(ie),ee=Y/be[2];ie=new un(ee,M[0]-be[0]*ee,M[1]-be[1]*ee)}P.zoom(null,ie)}})}function C(I,G,j){return!j&&I.__zooming||new N(I,G)}function N(I,G){this.that=I,this.args=G,this.active=0,this.sourceEvent=null,this.extent=n.apply(I,G),this.taps=0}N.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,G){return this.mouse&&I!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var G=Ft(this.that).datum();d.call(I,this.that,new yA(I,{sourceEvent:this.sourceEvent,target:h,transform:this.that.__zoom,dispatch:d}),G)}};function S(I,...G){if(!e.apply(this,arguments))return;var j=C(this,G).event(I),te=this.__zoom,K=Math.max(a[0],Math.min(a[1],te.k*Math.pow(2,r.apply(this,arguments)))),O=Ht(I);if(j.wheel)(j.mouse[0][0]!==O[0]||j.mouse[0][1]!==O[1])&&(j.mouse[1]=te.invert(j.mouse[0]=O)),clearTimeout(j.wheel);else{if(te.k===K)return;j.mouse=[O,te.invert(O)],Pi(this),j.start()}mr(I),j.wheel=setTimeout(P,y),j.zoom("mouse",o(b(w(te,K),j.mouse[0],j.mouse[1]),j.extent,l));function P(){j.wheel=null,j.end()}}function v(I,...G){if(p||!e.apply(this,arguments))return;var j=I.currentTarget,te=C(this,G,!0).event(I),K=Ft(I.view).on("mousemove.zoom",M,!0).on("mouseup.zoom",Y,!0),O=Ht(I,j),P=I.clientX,T=I.clientY;gf(I.view),Gl(I),te.mouse=[O,this.__zoom.invert(O)],Pi(this),te.start();function M(z){if(mr(z),!te.moved){var H=z.clientX-P,Z=z.clientY-T;te.moved=H*H+Z*Z>_}te.event(z).zoom("mouse",o(b(te.that.__zoom,te.mouse[0]=Ht(z,j),te.mouse[1]),te.extent,l))}function Y(z){K.on("mousemove.zoom mouseup.zoom",null),hf(z.view,te.moved),mr(z),te.event(z).end()}}function D(I,...G){if(e.apply(this,arguments)){var j=this.__zoom,te=Ht(I.changedTouches?I.changedTouches[0]:I,this),K=j.invert(te),O=j.k*(I.shiftKey?.5:2),P=o(b(w(j,O),te,K),n.apply(this,G),l);mr(I),s>0?Ft(this).transition().duration(s).call(E,P,te,I):Ft(this).call(h.transform,P,te,I)}}function L(I,...G){if(e.apply(this,arguments)){var j=I.touches,te=j.length,K=C(this,G,I.changedTouches.length===te).event(I),O,P,T,M;for(Gl(I),P=0;P<te;++P)T=j[P],M=Ht(T,this),M=[M,this.__zoom.invert(M),T.identifier],K.touch0?!K.touch1&&K.touch0[2]!==M[2]&&(K.touch1=M,K.taps=0):(K.touch0=M,O=!0,K.taps=1+!!f);f&&(f=clearTimeout(f)),O&&(K.taps<2&&(u=M[0],f=setTimeout(function(){f=null},m)),Pi(this),K.start())}}function k(I,...G){if(this.__zooming){var j=C(this,G).event(I),te=I.changedTouches,K=te.length,O,P,T,M;for(mr(I),O=0;O<K;++O)P=te[O],T=Ht(P,this),j.touch0&&j.touch0[2]===P.identifier?j.touch0[0]=T:j.touch1&&j.touch1[2]===P.identifier&&(j.touch1[0]=T);if(P=j.that.__zoom,j.touch1){var Y=j.touch0[0],z=j.touch0[1],H=j.touch1[0],Z=j.touch1[1],ie=(ie=H[0]-Y[0])*ie+(ie=H[1]-Y[1])*ie,be=(be=Z[0]-z[0])*be+(be=Z[1]-z[1])*be;P=w(P,Math.sqrt(ie/be)),T=[(Y[0]+H[0])/2,(Y[1]+H[1])/2],M=[(z[0]+Z[0])/2,(z[1]+Z[1])/2]}else if(j.touch0)T=j.touch0[0],M=j.touch0[1];else return;j.zoom("touch",o(b(P,T,M),j.extent,l))}}function J(I,...G){if(this.__zooming){var j=C(this,G).event(I),te=I.changedTouches,K=te.length,O,P;for(Gl(I),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),O=0;O<K;++O)P=te[O],j.touch0&&j.touch0[2]===P.identifier?delete j.touch0:j.touch1&&j.touch1[2]===P.identifier&&delete j.touch1;if(j.touch1&&!j.touch0&&(j.touch0=j.touch1,delete j.touch1),j.touch0)j.touch0[1]=this.__zoom.invert(j.touch0[0]);else if(j.end(),j.taps===2&&(P=Ht(P,this),Math.hypot(u[0]-P[0],u[1]-P[1])<g)){var T=Ft(this).on("dblclick.zoom");T&&T.apply(this,arguments)}}}return h.wheelDelta=function(I){return arguments.length?(r=typeof I=="function"?I:Oi(+I),h):r},h.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Oi(!!I),h):e},h.touchable=function(I){return arguments.length?(i=typeof I=="function"?I:Oi(!!I),h):i},h.extent=function(I){return arguments.length?(n=typeof I=="function"?I:Oi([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),h):n},h.scaleExtent=function(I){return arguments.length?(a[0]=+I[0],a[1]=+I[1],h):[a[0],a[1]]},h.translateExtent=function(I){return arguments.length?(l[0][0]=+I[0][0],l[1][0]=+I[1][0],l[0][1]=+I[0][1],l[1][1]=+I[1][1],h):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},h.constrain=function(I){return arguments.length?(o=I,h):o},h.duration=function(I){return arguments.length?(s=+I,h):s},h.interpolate=function(I){return arguments.length?(c=I,h):c},h.on=function(){var I=d.on.apply(d,arguments);return I===d?h:I},h.clickDistance=function(I){return arguments.length?(_=(I=+I)*I,h):Math.sqrt(_)},h.tapDistance=function(I){return arguments.length?(g=+I,h):g},h}var Ee=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Ee||{}),ql=(e=>(e.Partial="partial",e.Full="full",e))(ql||{}),qn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(qn||{}),wn=(e=>(e.Strict="strict",e.Loose="loose",e))(wn||{}),gr=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(gr||{}),hr=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(hr||{}),qf=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(qf||{});const NA=["INPUT","SELECT","TEXTAREA"],SA=typeof document<"u"?document:null;function zl(e){var n,o;const r=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,i=typeof(r==null?void 0:r.hasAttribute)=="function"?r.hasAttribute("contenteditable"):!1,a=typeof(r==null?void 0:r.closest)=="function"?r.closest(".nokey"):null;return NA.includes(r==null?void 0:r.nodeName)||i||!!a}function xA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function zf(e,n,o,r){const i=n.replace("+",`
|
|
119
|
+
`)[0],b=[{startLineNumber:g+1,startColumn:h+1,endLineNumber:g+1,endColumn:h+2,message:w,severity:Tr.MarkerSeverity.Error,source:fl}];Tr.editor.setModelMarkers(u,fl,b),a("error",w)}})}),t.onBeforeUnmount(()=>{var f;(f=s.value)==null||f.dispose()}),n({setExampleCode:c}),(f,u)=>(t.openBlock(),t.createElementBlock("div",t1,[t.createVNode(t.unref(Pe.KAlert),{class:"examples"},{icon:t.withCtx(()=>[t.createVNode(t.unref(Se.SparklesIcon))]),default:t.withCtx(()=>[t.createElementVNode("div",n1,[t.createTextVNode(t.toDisplayString(t.unref(r)("plugins.free-form.datakit.description_example"))+" ",1),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ul,(p,m)=>t.createVNode(t.unref(Pe.KButton),{key:m,appearance:"secondary",size:"small",onClick:y=>c(m)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(r)(`plugins.free-form.datakit.examples.${m}`)),1)]),_:2},1032,["onClick"])),64))])]),_:1}),t.createElementVNode("div",o1,null,512)]))}}),[["__scopeId","data-v-5f51e876"]]),Pu=["request","service_request","service_response","response","vault"],bo=Pu,Ou=["call","jq","exit","property","static","branch","cache"],$u=["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","TRACE","CONNECT"],xt={call:{icon:Se.NetworkIcon,colors:{foreground:yC,background:iC}},jq:{icon:Se.CodeblockIcon,colors:{foreground:fC,background:tC}},exit:{icon:Se.GatewayIcon,colors:{foreground:Ya,background:cC}},property:{icon:Se.StackIcon,colors:{foreground:gC,background:hC}},static:{icon:Se.VitalsIcon,colors:{foreground:pC,background:mC}},branch:{icon:Se.ArrowSplitIcon,colors:{foreground:dC,background:eC}},cache:{icon:Se.StackIcon,colors:{foreground:uC,background:"#fff0f7"}},vault:{icon:Se.KeyIcon},request:{icon:Se.CloudIcon},service_request:{icon:Se.CloudIcon},service_response:{icon:Se.CloudIcon},response:{icon:Se.CloudIcon}},{t:pl}=Ze.createI18n("en-us",rt);function Bt(e){return pl(`plugins.free-form.datakit.flow_editor.node_types.${e}.description`)}function Fn(e){return pl(`plugins.free-form.datakit.flow_editor.node_types.${e}.summary`)}function a1(e){return pl(`plugins.free-form.datakit.flow_editor.node_types.${e}.name`)}const ml={call:{type:"call",summary:Fn("call"),description:Bt("call"),io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]},output:{fields:[{name:"headers"},{name:"body"},{name:"status"}]}},...xt.call},jq:{type:"jq",summary:Fn("jq"),description:Bt("jq"),io:{input:{fields:[],configurable:!0},output:{fields:[]}},...xt.jq},exit:{type:"exit",summary:Fn("exit"),description:Bt("exit"),io:{input:{fields:[{name:"headers"},{name:"body"}]}},...xt.exit},property:{type:"property",summary:Fn("property"),description:Bt("property"),io:{input:{fields:[],configurable:!0},output:{fields:[]}},...xt.property},static:{type:"static",summary:Fn("static"),description:Bt("static"),io:{output:{fields:[],configurable:!0}},...xt.static},branch:{type:"branch",summary:Fn("branch"),description:Bt("branch"),io:{input:{fields:[]},next:{branches:[{name:"then"},{name:"else"}]}},...xt.branch},cache:{type:"cache",summary:Fn("cache"),description:Bt("cache"),io:{input:{fields:[{name:"data"},{name:"key"},{name:"ttl"}]},output:{fields:[{name:"data"},{name:"hit"},{name:"miss"},{name:"stored"}]}},...xt.cache}},ri={request:{type:"request",description:Bt("request"),io:{output:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...xt.request},service_request:{type:"service_request",description:Bt("service_request"),io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...xt.service_request},service_response:{type:"service_response",description:Bt("service_response"),io:{output:{fields:[{name:"headers"},{name:"body"}]}},...xt.service_response},response:{type:"response",description:Bt("response"),io:{input:{fields:[{name:"headers"},{name:"body"}]}},...xt.response},vault:{type:"vault",io:{output:{fields:[],configurable:!0}},...xt.vault,hidden:!0}},gl=Object.keys(ri),hl=e=>gl.includes(e),l1=e=>[...gl,...Ou].includes(e),Vt=e=>gl.includes(e),Bu=e=>Vt(e.type),Vu=e=>!!(e!=null&&e.startsWith("node:")),ii=e=>Object.prototype.hasOwnProperty.call(e,"ownerId");function ln(e){return lo(e)}function yl(e,n){if(e.length!==n.length)return!1;if(e.length===0)return!0;const o=new Set(n);return e.every(r=>o.has(r))}function wo(e){return`${e}:${Gr()}`}function ai(e){const[n,o]=e.split(".");return{nodeName:n,fieldName:o}}function Ru(e){const[n,o]=e.split(".");return{nodeId:n,fieldId:o}}function ko(e){return Vt(e)?ri[e]:ml[e]}function Du(e){var i,a,l,s;const n=ko(e),o=((a=(i=n.io)==null?void 0:i.input)==null?void 0:a.fields.map(({name:c})=>c))??[],r=((s=(l=n.io)==null?void 0:l.output)==null?void 0:s.fields.map(({name:c})=>c))??[];return{input:o,output:r}}function nr(e){var o,r,i;return((i=(r=(o=ko(e).io)==null?void 0:o.next)==null?void 0:r.branches)==null?void 0:i.map(({name:a})=>a))??[]}function Mu(e){return(e??[]).map(n=>({id:wo("field"),name:n}))}function _n(e,n,o){if(o)return e.fields[n].find(r=>r.name===o)}function bn(e,n,o){if(o)return e.fields[n].find(r=>r.id===o)}function _l(e,n){return n?e.fields.output.some(o=>o.id===n):!0}function Lu(e,n){return n?e.fields.input.some(o=>o.id===n):!0}function s1(e){const n=["request","service_request","vault"].includes(e)?"request":"response",o=ri[e];return{name:e,phase:n,position:{x:0,y:0},fields:Du(o.type),expanded:{},hidden:o.hidden}}function Fu(e,n){const r=(typeof e=="string"&&l1(e)?e.toUpperCase():e).replace(/_\d+$/,"");for(let i=1;;i++){const a=`${r}_${i}`;if(!n.has(a))return a}}function bl(e,n){return`${e}:${n}`}function c1(e){const n=e.lastIndexOf(":");if(n===-1)throw new Error(`Invalid group ID format: ${e}`);const o=e.slice(0,n),r=e.slice(n+1);return{nodeId:o,branch:r}}function li(e,n){return`${e}:${n}`}function Uu(e,n,o,r,i){return{id:bl(e,n),ownerId:e,branch:n,phase:o,memberIds:[...r],position:i!=null&&i.position?{...i.position}:void 0,dimensions:i!=null&&i.dimensions?{...i.dimensions}:void 0}}function d1(e){return e.map(({source:n,target:o})=>({source:n,target:o}))}function u1(e){const n=[];for(const o of e)for(const r of o.memberIds)n.push({source:o.ownerId,target:r});return n}function Ku(e,n){return[...d1(e),...u1(n)]}function si(e,n){const o=new Map;for(const{source:r,target:i}of e)o.has(r)||o.set(r,[]),o.get(r).push(i),o.has(i)||o.set(i,[]);return n&&(o.has(n.source)||o.set(n.source,[]),o.get(n.source).push(n.target),o.has(n.target)||o.set(n.target,[])),o}function wl(e){const n=new Set,o=new Set;function r(i){if(o.has(i))return!0;if(n.has(i))return!1;n.add(i),o.add(i);for(const a of e.get(i)??[])if(r(a))return!0;return o.delete(i),!1}for(const i of e.keys())if(r(i))return!0;return!1}function kl(e,n){const o=e.config;if(!o)return[];const r=o[n];return Array.isArray(r)?r.filter(i=>typeof i=="string"&&Vu(i)):[]}function f1({state:e,groupMapById:n,getNodeById:o,history:r}){const i=t.computed(()=>{const S=new Map;for(const v of e.value.groups)for(const D of v.memberIds)S.set(D,{ownerId:v.ownerId,branch:v.branch});return S}),a=t.computed(()=>{const S=new Map;for(const v of e.value.groups)for(const D of v.memberIds)S.set(D,v);return S}),l=t.computed(()=>{const S=new Map;for(const v of e.value.groups)S.has(v.ownerId)||S.set(v.ownerId,[]),S.get(v.ownerId).push(v);return S}),s=t.computed(()=>Ku(e.value.edges,e.value.groups)),c=t.computed(()=>si(s.value));function d(S,v){return S?nr(S.type).includes(v):!1}function f(S,v){if(v===S.id)return!1;const D=o(v);return!(!D||Vt(D.type)||D.phase!==S.phase)}function u(S,v){const D=[],L=new Set;for(const k of v)L.has(k)||(L.add(k),f(S,k)&&D.push(k));return D}function p(S,v,D){const L=o(S);return d(L,v)?u(L,D):[]}function m(S,v,D){const L=bl(S.id,v),k=n.value.get(L);D.length>0?k?(k.phase!==S.phase&&(k.phase=S.phase),yl(k.memberIds,D)||(k.position=void 0,k.dimensions=void 0,k.memberIds=[...D])):e.value.groups.push(Uu(S.id,v,S.phase,D)):k&&(e.value.groups=e.value.groups.filter(J=>J.id!==L))}function y(S,v,D,L={}){const k=o(S);if(!d(k,v))return!1;const J=u(k,D),I=kl(k,v);if(yl(I,J))return!1;const G=k.config??(k.config={});return J.length>0?G[v]=[...J]:(delete G[v],Object.keys(G).length===0&&delete k.config),m(k,v,J),(L.commit??!0)&&r.commit(L.tag??`branch:set:${v}`),!0}function _(S){e.value.groups=e.value.groups.filter(v=>v.ownerId!==S)}function g(S,v){const D=n.value.get(bl(S,v));if(D)return[...D.memberIds];const L=o(S);return L?kl(L,v):[]}function h(S){return i.value.get(S)}function w(S,v){if(S===v)return!0;const D=new Set,L=[v];for(;L.length>0;){const k=L.pop();if(D.has(k))continue;if(D.add(k),k===S)return!0;const J=c.value.get(k);if(J)for(const I of J)D.has(I)||L.push(I)}return!1}function b(S,v,D,L={}){const k=o(S);if(!k||!d(k,v)||!f(k,D)||w(S,D))return!1;const J=kl(k,v);if(J.includes(D))return!1;x(D);const I=[...J,D];return y(S,v,I,{commit:!1})?((L.commit??!0)&&r.commit(L.tag??`branch:add:${v}`),!0):!1}function x(S){const v=h(S);if(!v)return;const L=g(v.ownerId,v.branch).filter(k=>k!==S);y(v.ownerId,v.branch,L,{commit:!1})}function E(S){let v=0;const D=new Set;let L=a.value.get(S);for(;L&&!D.has(L.id);)v+=1,D.add(L.id),L=a.value.get(L.ownerId);return v}function C(S){const v=n.value.get(S);return v?E(v.ownerId):0}function N(S){return S?n.value.has(S):!1}return{memberGroupMap:a,groupsByOwner:l,findMembership:h,getMembers:g,wouldCreateCycle:w,setMembers:y,prepareMembers:p,addMember:b,dropTarget:x,clear:_,getNodeDepth:E,getGroupDepth:C,isGroupId:N}}function p1(e,n){const{commit:o,undo:r,redo:i,canUndo:a,canRedo:l,clear:s,reset:c,undoStack:d,redoStack:f}=Ye.useManualRefHistory(e,{capacity:n==null?void 0:n.capacity,clone:n==null?void 0:n.clone});let u;function p(b){var x;(x=n==null?void 0:n.onHistoryChange)==null||x.call(n,b,e.value)}function m(b){if(!b){u=void 0,o(),p("commit");return}if(b!=="*"&&u!==b){u=b,o(),p("commit");return}o(),d.value.shift(),p("commit")}function y(){r(),u=void 0,p("undo")}function _(){i(),u=void 0,p("redo")}function g(){s(),u=void 0,p("clear")}function h(){c(),u=void 0,p("reset")}function w(){r(),f.value.shift(),u=void 0,p("revert")}return{canUndo:a,canRedo:l,commit:m,undo:y,redo:_,clear:g,reset:h,revert:w}}function m1(e){var n,o;return((o=(n=e.config)==null?void 0:n.resources)==null?void 0:o.vault)||{}}function g1(e){const{resources:n}=e.config||{};return n!=null&&n.vault?Object.keys(n.vault):[]}function h1(e){const n=Object.entries(e);if(n.length===0)return;const o={};for(const[r,i]of n)o[r]=i;return o}function ju(e,n){var g,h,w,b,x,E,C;const o=((g=e.config)==null?void 0:g.nodes)??[],r=((h=e.__ui_data)==null?void 0:h.nodes)??[],i=((w=e.__ui_data)==null?void 0:w.groups)??[],a=new Map(r.map(N=>[N.name,N])),l=new Map(i.map(N=>[N.name,N])),s=[],c=[],d=new Map,f=[],u=[],p=new Map,m=N=>{const S=new Set,v=[...N];for(;v.length>0;){const D=v.shift();if(!S.has(D)&&(S.add(D),hl(D)||(d.get(D).phase="request"),!!p.has(D)))for(const L of p.get(D))S.has(L)||v.push(L)}};let y=!1;for(const N of o){const S=a.get(N.name);!S&&!y&&(y=!0);const v=qu({type:N.type,configNode:N,uiNode:S,pluginData:e});s.push(v),d.set(v.name,v)}for(const N of s){const S=nr(N.type);if(!S.length)continue;const v=N.config;if(v)for(const D of S){const L=v[D];if(!Array.isArray(L)){l.has(li(N.name,D))&&(y=!0);continue}const k=[];for(const J of L){if(typeof J!="string")continue;const I=d.get(J);I&&!Vt(I.type)&&k.push(I.id)}if(k.length){v[D]=k;const J=li(N.name,D),I=l.get(J),G=I?{position:ln(I.position)}:void 0,j=Uu(N.id,D,N.phase,k,G);f.push(j),!I&&!y&&(y=!0)}else delete v[D],l.has(li(N.name,D))&&(y=!0)}}for(const N of bo)if(!d.has(N)){let S=a.get(N);S||(y||(y=!0),S=s1(N));const v=qu({type:N,uiNode:S,pluginData:e});s.push(v),d.set(v.name,v)}for(const N of o)b1(N,u);for(const N of u){const S=d.get(N.source),v=d.get(N.target);if(!S||!v){S||console.warn(`[initEditorState] skip: source "${N.source}" not found`),v||console.warn(`[initEditorState] skip: target "${N.target}" not found`);continue}p.has(N.source)||p.set(N.source,new Set),p.get(N.source).add(N.target),p.has(N.target)||p.set(N.target,new Set),p.get(N.target).add(N.source),c.push({id:wo("edge"),source:S.id,sourceField:(b=_n(S,"output",N.sourceField))==null?void 0:b.id,target:v.id,targetField:(x=_n(v,"input",N.targetField))==null?void 0:x.id})}m(["request","service_request"]);let _=null;return(C=(E=e.config)==null?void 0:E.resources)!=null&&C.cache&&(_={...e.config.resources.cache},e.partials&&(_.partial_id=e.partials[0].id)),{nodes:s,edges:c,groups:f,pendingLayout:y?n?"keepHistory":"clearHistory":!1,pendingFitView:!0,..._?{cacheConfig:_}:{}}}function Gu(e){const{type:n,name:o,phase:r,position:i,fields:a,config:l}=e,s=Du(n),c=ko(n);return{id:wo("node"),type:n,name:o??n,phase:r??"request",position:i??{x:0,y:0},expanded:{},fields:{input:Mu((a==null?void 0:a.input)??s.input),output:Mu((a==null?void 0:a.output)??s.output)},hidden:e.hidden||c.hidden,config:l?ln(l):{}}}function y1(e){return Vt(e)?e==="request"||e==="service_request"?"request":"response":"request"}function qu({type:e,configNode:n,uiNode:o,pluginData:r}){return Gu({type:e,name:n==null?void 0:n.name,phase:(o==null?void 0:o.phase)??y1(e),position:o==null?void 0:o.position,fields:w1({type:e,uiNode:o,configNode:n,pluginData:r}),hidden:o==null?void 0:o.hidden,config:k1({type:e,configNode:n,pluginData:r})})}function _1(e){const{type:n,name:o,input:r,inputs:i,output:a,outputs:l,...s}=e;return ln(s)}function b1(e,n){const o=e.name;if(e.input){const{nodeName:r,fieldName:i}=ai(e.input);r&&n.push({source:r,sourceField:i,target:o})}if(e.inputs)for(const[r,i]of Object.entries(e.inputs)){if(!i)continue;const{nodeName:a,fieldName:l}=ai(i);a&&n.push({source:a,sourceField:l,target:o,targetField:r})}if(e.output){const{nodeName:r,fieldName:i}=ai(e.output);r&&n.push({source:o,target:r,targetField:i})}if(e.outputs)for(const[r,i]of Object.entries(e.outputs)){if(!i)continue;const{nodeName:a,fieldName:l}=ai(i);a&&n.push({source:o,sourceField:r,target:a,targetField:l})}}function w1({type:e,uiNode:n,configNode:o,pluginData:r}){var s,c,d,f;const i=ko(e),a=i==null?void 0:i.io;if(!a)return;const l={};if((s=a.input)!=null&&s.configurable&&(n?l.input=((c=n.fields)==null?void 0:c.input)??[]:o!=null&&o.inputs&&(l.input=Object.keys(o.inputs))),(d=a.output)!=null&&d.configurable){if(n)l.output=((f=n.fields)==null?void 0:f.output)??[];else{const u=new Set;o!=null&&o.outputs&&Object.keys(o.outputs).forEach(p=>u.add(p)),(o==null?void 0:o.type)==="static"&&o.values&&Object.keys(o.values).forEach(p=>u.add(p)),u.size&&(l.output=Array.from(u))}e==="vault"&&(l.output=g1(r))}return Object.keys(l).length?l:void 0}function k1({type:e,configNode:n,pluginData:o}){return e==="vault"?m1(o):n?_1(n):void 0}function C1(e){const n=t.computed(()=>{const u=new Map;return e.value.nodes.forEach(p=>u.set(p.id,p)),u}),o=t.computed(()=>e.value.edges),r=t.computed(()=>e.value.groups),i=t.computed(()=>Ku(o.value,r.value));function a(u){return si(i.value,u?{source:u.source,target:u.target}:void 0)}function l(u){const p=n.value.get(u.source),m=n.value.get(u.target);if(!p||!m)return u;const y=Lu(p,u.sourceField)&&!_l(p,u.sourceField),_=_l(m,u.targetField);return y&&_?{source:u.target,sourceField:u.targetField,target:u.source,targetField:u.sourceField}:u}function s(u){const p=l(u),m=[],y=n.value.get(p.source),_=n.value.get(p.target);if(y||m.push("source node not found"),_||m.push("target node not found"),!y||!_)return{ok:!1,errors:m};_l(y,p.sourceField)||m.push("source handle is not an output field"),Lu(_,p.targetField)||m.push("target handle is not an input field"),_.name==="request"&&m.push('cannot target "request"'),y.name==="response"&&m.push('cannot source from "response"');const g=o.value.some(b=>b.target===p.target&&!b.targetField),h=o.value.some(b=>b.target===p.target&&!!b.targetField);(g&&p.targetField||h&&!p.targetField)&&m.push("cannot mix whole-node and field-level inputs on same target"),p.targetField&&o.value.some(b=>b.target===p.target&&b.targetField===p.targetField)&&m.push("target field already connected"),!p.targetField&&o.value.some(b=>b.target===p.target&&!b.targetField)&&m.push("target input already taken"),p.source===p.target&&m.push("self-loop not allowed");const w=a({source:p.source,target:p.target});return wl(w)&&m.push("connection introduces a cycle"),m.length?{ok:!1,errors:m}:{ok:!0}}function c(){const u=[];for(const p of bo)[...n.value.values()].some(m=>m.name===p)||u.push(`missing implicit node "${p}"`);for(const p of o.value){const m=n.value.get(p.source);n.value.get(p.target).name==="request"&&u.push(`edge "${p.id}" targets "request"`),m.name==="response"&&u.push(`edge "${p.id}" sources from "response"`)}return wl(a())&&u.push("graph contains cycle"),u.length?{ok:!1,errors:u}:{ok:!0}}function d(u){return s(u).ok}function f(u){return!u.source||!u.target?!1:d({source:u.source,sourceField:u.sourceHandle,target:u.target,targetField:u.targetHandle})}return{canonicalizeConnection:l,validateConnection:s,validateGraph:c,isValidConnection:d,isValidVueFlowConnection:f,buildAdjacency:si}}const[zu,E1]=Ye.createInjectionState(function(n,o={}){const r=t.ref(ju(n)),i=t.ref(),a=t.ref(!1),l=t.ref(!1),s=p1(r,{capacity:200,clone:ln,onHistoryChange:A=>{var U,$;A!=="clear"&&(($=o.onChange)==null||$.call(o,V(),q(),R(),(U=r.value.cacheConfig)==null?void 0:U.partial_id))}}),c=t.ref(!1),d=t.ref(new Set);function f(){r.value.pendingLayout=!1,s.commit("*")}function u(A=!0){r.value.pendingFitView!==A&&(r.value.pendingFitView=A,s.commit("*"))}const p=t.computed(()=>new Map(r.value.nodes.map(A=>[A.id,A]))),m=t.computed(()=>new Map(r.value.nodes.map(A=>[A.name,A]))),y=t.computed(()=>{const A=new Map,U=new Map;for(const $ of r.value.edges)A.set($.id,$),U.has($.source)||U.set($.source,new Set),U.get($.source).add($.id),U.has($.target)||U.set($.target,new Set),U.get($.target).add($.id);return{edgeMapById:A,edgeIdMapByNodeId:U}}),_=t.computed(()=>y.value.edgeMapById),g=t.computed(()=>y.value.edgeIdMapByNodeId),h=t.computed(()=>new Map(r.value.groups.map(A=>[A.id,A]))),w=t.computed(()=>new Set(r.value.nodes.map(A=>A.name))),b=f1({state:r,groupMapById:h,getNodeById:v,history:s}),{canonicalizeConnection:x,validateConnection:E,validateGraph:C,isValidConnection:N,isValidVueFlowConnection:S}=C1(r);function v(A){return p.value.get(A)}function D(A){return m.value.get(A)}function L(A){return _.value.get(A)}function k(A){if(!g.value.has(A))return[];const U=[];return g.value.get(A).forEach($=>{const oe=L($);oe&&U.push(oe)}),U}function J(A){return k(A).filter(U=>U.target===A)}function I(A){return k(A).filter(U=>U.source===A)}const G=t.computed(()=>i.value?v(i.value):void 0);function j(A){i.value=A}function te(A){if(Vt(A.type))throw new Error("[createNode] implicit nodes are fixed.");return Gu({type:A.type,name:A.name||(Vt(A.type)?void 0:Fu(A.type,w.value)),phase:A.phase,position:A.position,fields:A.fields,config:A.config})}function K(A,U=!0){const $=te(A);if($)return r.value.nodes.push($),U&&s.commit(),c.value=!0,$.id}function O(A,U,$=!0){const oe=v(A);if(!oe||Vt(oe.type))return;const ne={...ln(oe),id:wo("node"),name:Fu(oe.name,w.value),position:U??{x:oe.position.x+20,y:oe.position.y+20}},_e=nr(ne.type);if(_e.length&&ne.config){for(const ke of _e)delete ne.config[ke];Object.keys(ne.config).length===0&&delete ne.config}return r.value.nodes.push(ne),$&&s.commit(),c.value=!0,ne.id}function P(A,U=!0){if(!v(A))return;r.value.edges=r.value.edges.filter(ne=>ne.source!==A&&ne.target!==A),b.clear(A),r.value.nodes=r.value.nodes.filter(ne=>ne.id!==A),i.value===A&&(i.value=void 0),b.dropTarget(A);const oe=C();oe.ok||console.warn("[removeNode] topology invalid:",oe.errors.join("; ")),U&&s.commit()}function T(A,U,$=!0,oe){const ne=v(A);if(!ne)return;if(hl(ne.name)){console.warn("[renameNode] implicit node name is reserved.");return}ne.name!==U&&(ne.name=U,$&&s.commit(oe))}function M(A,U,$=!0){const oe=v(A);oe&&(oe.position={...U},$&&s.commit())}function Y(A,U,$=!0){const oe=h.value.get(A);if(!oe)return;const ne=oe.position;ne&&ne.x===U.x&&ne.y===U.y||(oe.position={...U},$&&s.commit())}function z(A,U,$=!0){const oe=h.value.get(A);if(!oe)return!1;const ne={...U.position},_e={...U.dimensions},ke=oe.position&&oe.position.x===ne.x&&oe.position.y===ne.y,de=oe.dimensions&&oe.dimensions.width===_e.width&&oe.dimensions.height===_e.height;return ke&&de?!1:(oe.position=ne,oe.dimensions=_e,$&&s.commit(),!0)}function H(A,U,$,oe=!0,ne){const _e=v(A);if(!_e)return;const ke=$??!_e.expanded[U];ke!==!!_e.expanded[U]&&(_e.expanded[U]=ke,oe&&s.commit(ne??`toggle:${A}:${U}`))}function Z(A,U,$=!0,oe){const ne=v(A);ne&&(ne.config=ln(U),$&&s.commit(oe))}function ie(A,U,$,oe=!0){const ne=v(A);if(!ne)return;const _e=ne.fields[U];if(_e.some(ke=>ke.name===$)){console.warn(`[addField] field "${$}" already exists on ${U}.`);return}_e.push({id:wo("field"),name:$}),U==="input"?ne.fields.input=_e:ne.fields.output=_e,oe&&s.commit()}function be(A,U,$,oe=!0){const ne=v(A);if(!ne)return;const _e=ne.fields.input,ke=ne.fields.output,de=_e.find(Ne=>Ne.id===U)??ke.find(Ne=>Ne.id===U);de&&(de.name=$,oe&&s.commit())}function ee(A,U,$=!0,oe=!0){const ne=v(A);if(!ne)return;const _e=ne.fields.input,ke=ne.fields.output,de=_e.findIndex(me=>me.id===U);de>=0&&_e.splice(de,1);const Ne=ke.findIndex(me=>me.id===U);Ne>=0&&ke.splice(Ne,1),ne.fields.input=_e,ne.fields.output=ke,$&&(r.value.edges=r.value.edges.filter(me=>me.sourceField!==U&&me.targetField!==U));const Te=C();Te.ok||console.warn("[removeField] topology invalid:",Te.errors.join("; ")),oe&&s.commit()}function re(A,U=!0){const $=x(A),oe=E($);if(!oe.ok){console.warn("[connectEdge] invalid connection:",oe.errors.join("; "));return}const ne={id:wo("edge"),...$};r.value.edges.push(ne);const _e=C();if(!_e.ok){r.value.edges.pop(),console.warn("[connectEdge] topology invalid:",_e.errors.join("; "));return}return U&&s.commit(),ne.id}function le(A,U,$=!0){ue(A,!1),re(U,!1),$&&s.commit()}function ue(A,U=!0){const $=r.value.edges.findIndex(_e=>_e.id===A);if($<0)return;const oe=r.value.edges[$];r.value.edges.splice($,1);const ne=C();if(!ne.ok){r.value.edges.splice($,0,oe),console.warn("[disconnectEdge] topology invalid:",ne.errors.join("; "));return}U&&s.commit()}function fe(A,U=!0){const $=J(A);for(const oe of $)ue(oe.id,!1);U&&s.commit()}function B(A,U=!0){const $=I(A);for(const oe of $)ue(oe.id,!1);U&&s.commit()}function V(){var U,$,oe,ne,_e;const A=[];for(const ke of r.value.nodes){if(Vt(ke.type))continue;let de;const Ne={};let Te;const me={};for(const st of r.value.edges.filter(He=>He.target===ke.id)){const He=v(st.source);if(!He)continue;const pt=(U=bn(He,"output",st.sourceField))==null?void 0:U.name,kt=pt?`${He.name}.${pt}`:He.name,mt=($=bn(ke,"input",st.targetField))==null?void 0:$.name;mt?Ne[mt]=kt:de===void 0&&(de=kt)}for(const st of r.value.edges.filter(He=>He.source===ke.id)){const He=v(st.target);if(!He)continue;const pt=He.type;if(!Vt(pt)||!((oe=ri[pt].io)!=null&&oe.input))continue;const kt=(ne=bn(He,"input",st.targetField))==null?void 0:ne.name,mt=kt?`${He.name}.${kt}`:He.name,$e=(_e=bn(ke,"output",st.sourceField))==null?void 0:_e.name;$e?me[$e]=mt:Te===void 0&&(Te=mt)}const ge={...ln(ke.config),name:ke.name,type:ke.type},nt=nr(ke.type);if(nt.length)for(const st of nt){const He=ge[st];if(!Array.isArray(He))continue;const pt=[];for(const kt of He){const mt=v(kt);mt&&pt.push(mt.name)}pt.length?ge[st]=Array.from(new Set(pt)):delete ge[st]}Object.keys(Ne).length>0?ge.inputs=Ne:de!==void 0&&(ge.input=de),Object.keys(me).length>0?ge.outputs=me:Te!==void 0&&(ge.output=Te),A.push(ge)}return A}function F(){return r.value.nodes.map(A=>ln({name:A.name,phase:A.phase,position:{...A.position},expanded:{...A.expanded},fields:{input:A.fields.input.map(U=>U.name),output:A.fields.output.map(U=>U.name)}}))}function R(){const A={},U=D("vault");if(U){const $=h1(U.config);$&&Object.keys($).length>0&&(A.vault=$)}if(r.value.cacheConfig){const{strategy:$,redis:oe,memory:ne}=r.value.cacheConfig;A.cache={strategy:$,redis:oe,memory:ne}}if(Object.keys(A).length!==0)return A}function Q(){const A=[];for(const U of r.value.groups){const $=v(U.ownerId);if(!$)continue;const oe=U.position;oe&&A.push({name:li($.name,U.branch),position:{...oe}})}return A}function q(){return{nodes:F(),groups:Q()}}function ae(A,U){U&&s.commit(),r.value=ju(A,U),U||s.clear()}return{state:r,selection:i,modalOpen:a,skipValidation:c,invalidConfigNodeIds:d,propertiesPanelOpen:l,nodeMapById:p,nodeMapByName:m,edgeMapById:_,edgeIdMapByNodeId:g,groupMapById:h,getNodeById:v,getNodeByName:D,getEdgeById:L,getEdgesByNodeId:k,getInEdgesByNodeId:J,getOutEdgesByNodeId:I,selectedNode:G,selectNode:j,createNode:te,addNode:K,duplicateNode:O,removeNode:P,renameNode:T,moveNode:M,moveGroup:Y,setGroupLayout:z,toggleExpanded:H,replaceConfig:Z,branchGroups:b,addField:ie,renameField:be,removeField:ee,connectEdge:re,replaceConnection:le,disconnectEdge:ue,disconnectInEdges:fe,disconnectOutEdges:B,toConfigNodes:V,toUINodes:F,toUIGroups:Q,toUIData:q,load:ae,commit:s.commit,undo:s.undo,redo:s.redo,canUndo:s.canUndo,canRedo:s.canRedo,clear:s.clear,reset:s.reset,revert:s.revert,isValidConnection:N,isValidVueFlowConnection:S,validateGraph:()=>C(),clearPendingLayout:f,setPendingFitView:u}});function at(){const e=E1();if(!e)throw new Error("Editor state is not provided. Ensure you are using provideEditorStore in a parent component.");return e}const Cl=Ye.createGlobalState(()=>{const e=Ye.useLocalStorage("datakit-editor-mode","flow"),n=Ye.useLocalStorage("datakit-editor-sidebar-expanded",!0);return{editorMode:e,sidePanelExpanded:n}});function ci(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function sn(e){return typeof e=="function"?e():t.unref(e)}const N1=typeof window<"u"&&typeof document<"u",S1=e=>typeof e<"u",x1=Object.prototype.toString,v1=e=>x1.call(e)==="[object Object]",A1=()=>{};function I1(e,n){function o(...r){return new Promise((i,a)=>{Promise.resolve(e(()=>n.apply(this,r),{fn:n,thisArg:this,args:r})).then(i).catch(a)})}return o}const Hu=e=>e();function T1(e=Hu){const n=t.ref(!0);function o(){n.value=!1}function r(){n.value=!0}const i=(...a)=>{n.value&&e(...a)};return{isActive:t.readonly(n),pause:o,resume:r,eventFilter:i}}function Yu(e,n=!1,o="Timeout"){return new Promise((r,i)=>{setTimeout(n?()=>i(o):r,e)})}function P1(e,n,o={}){const{eventFilter:r=Hu,...i}=o;return t.watch(e,I1(r,n),i)}function Co(e,n,o={}){const{eventFilter:r,...i}=o,{eventFilter:a,pause:l,resume:s,isActive:c}=T1(r);return{stop:P1(e,n,{...i,eventFilter:a}),pause:l,resume:s,isActive:c}}function O1(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const r in e.value)o[r]=t.customRef(()=>({get(){return e.value[r]},set(i){var a;if((a=sn(n.replaceRef))!=null?a:!0)if(Array.isArray(e.value)){const s=[...e.value];s[r]=i,e.value=s}else{const s={...e.value,[r]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[r]=i}}));return o}function El(e,n=!1){function o(u,{flush:p="sync",deep:m=!1,timeout:y,throwOnTimeout:_}={}){let g=null;const w=[new Promise(b=>{g=t.watch(e,x=>{u(x)!==n&&(g==null||g(),b(x))},{flush:p,deep:m,immediate:!0})})];return y!=null&&w.push(Yu(y,_).then(()=>sn(e)).finally(()=>g==null?void 0:g())),Promise.race(w)}function r(u,p){if(!t.isRef(u))return o(x=>x===u,p);const{flush:m="sync",deep:y=!1,timeout:_,throwOnTimeout:g}=p??{};let h=null;const b=[new Promise(x=>{h=t.watch([e,u],([E,C])=>{n!==(E===C)&&(h==null||h(),x(E))},{flush:m,deep:y,immediate:!0})})];return _!=null&&b.push(Yu(_,g).then(()=>sn(e)).finally(()=>(h==null||h(),sn(e)))),Promise.race(b)}function i(u){return o(p=>!!p,u)}function a(u){return r(null,u)}function l(u){return r(void 0,u)}function s(u){return o(Number.isNaN,u)}function c(u,p){return o(m=>{const y=Array.from(m);return y.includes(u)||y.includes(sn(u))},p)}function d(u){return f(1,u)}function f(u=1,p){let m=-1;return o(()=>(m+=1,m>=u),p)}return Array.isArray(sn(e))?{toMatch:o,toContains:c,changed:d,changedTimes:f,get not(){return El(e,!n)}}:{toMatch:o,toBe:r,toBeTruthy:i,toBeNull:a,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:f,get not(){return El(e,!n)}}}function Nl(e){return El(e)}function $1(e){var n;const o=sn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Wu=N1?window:void 0;function Xu(...e){let n,o,r,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,r,i]=e,n=Wu):[n,o,r,i]=e,!n)return A1;Array.isArray(o)||(o=[o]),Array.isArray(r)||(r=[r]);const a=[],l=()=>{a.forEach(f=>f()),a.length=0},s=(f,u,p,m)=>(f.addEventListener(u,p,m),()=>f.removeEventListener(u,p,m)),c=t.watch(()=>[$1(n),sn(i)],([f,u])=>{if(l(),!f)return;const p=v1(u)?{...u}:u;a.push(...o.flatMap(m=>r.map(y=>s(f,m,y,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ci(d),d}function B1(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Zu(...e){let n,o,r={};e.length===3?(n=e[0],o=e[1],r=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],r=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:i=Wu,eventName:a="keydown",passive:l=!1,dedupe:s=!1}=r,c=B1(n);return Xu(i,a,f=>{f.repeat&&sn(s)||c(f)&&o(f)},l)}function V1(e){return JSON.parse(JSON.stringify(e))}function Sl(e,n,o,r={}){var i,a,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:f=!1,defaultValue:u,shouldEmit:p}=r,m=t.getCurrentInstance(),y=o||(m==null?void 0:m.emit)||((i=m==null?void 0:m.$emit)==null?void 0:i.bind(m))||((l=(a=m==null?void 0:m.proxy)==null?void 0:a.$emit)==null?void 0:l.bind(m==null?void 0:m.proxy));let _=d;n||(n="modelValue"),_=_||`update:${n.toString()}`;const g=b=>s?typeof s=="function"?s(b):V1(b):b,h=()=>S1(e[n])?g(e[n]):u,w=b=>{p?p(b)&&y(_,b):y(_,b)};if(c){const b=h(),x=t.ref(b);let E=!1;return t.watch(()=>e[n],C=>{E||(E=!0,x.value=g(C),t.nextTick(()=>E=!1))}),t.watch(x,C=>{!E&&(C!==e[n]||f)&&w(C)},{deep:f}),x}else return t.computed({get(){return h()},set(b){w(b)}})}var R1={value:()=>{}};function di(){for(var e=0,n=arguments.length,o={},r;e<n;++e){if(!(r=arguments[e]+"")||r in o||/[\s.]/.test(r))throw new Error("illegal type: "+r);o[r]=[]}return new ui(o)}function ui(e){this._=e}function D1(e,n){return e.trim().split(/^|\s+/).map(function(o){var r="",i=o.indexOf(".");if(i>=0&&(r=o.slice(i+1),o=o.slice(0,i)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:r}})}ui.prototype=di.prototype={constructor:ui,on:function(e,n){var o=this._,r=D1(e+"",o),i,a=-1,l=r.length;if(arguments.length<2){for(;++a<l;)if((i=(e=r[a]).type)&&(i=M1(o[i],e.name)))return i;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++a<l;)if(i=(e=r[a]).type)o[i]=Ju(o[i],e.name,n);else if(n==null)for(i in o)o[i]=Ju(o[i],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new ui(e)},call:function(e,n){if((i=arguments.length-2)>0)for(var o=new Array(i),r=0,i,a;r<i;++r)o[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)}};function M1(e,n){for(var o=0,r=e.length,i;o<r;++o)if((i=e[o]).name===n)return i.value}function Ju(e,n,o){for(var r=0,i=e.length;r<i;++r)if(e[r].name===n){e[r]=R1,e=e.slice(0,r).concat(e.slice(r+1));break}return o!=null&&e.push({name:n,value:o}),e}var xl="http://www.w3.org/1999/xhtml";const Qu={svg:"http://www.w3.org/2000/svg",xhtml:xl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function fi(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Qu.hasOwnProperty(n)?{space:Qu[n],local:e}:e}function L1(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===xl&&n.documentElement.namespaceURI===xl?n.createElement(e):n.createElementNS(o,e)}}function F1(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ef(e){var n=fi(e);return(n.local?F1:L1)(n)}function U1(){}function vl(e){return e==null?U1:function(){return this.querySelector(e)}}function K1(e){typeof e!="function"&&(e=vl(e));for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i)for(var a=n[i],l=a.length,s=r[i]=new Array(l),c,d,f=0;f<l;++f)(c=a[f])&&(d=e.call(c,c.__data__,f,a))&&("__data__"in c&&(d.__data__=c.__data__),s[f]=d);return new Tt(r,this._parents)}function j1(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function G1(){return[]}function tf(e){return e==null?G1:function(){return this.querySelectorAll(e)}}function q1(e){return function(){return j1(e.apply(this,arguments))}}function z1(e){typeof e=="function"?e=q1(e):e=tf(e);for(var n=this._groups,o=n.length,r=[],i=[],a=0;a<o;++a)for(var l=n[a],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(r.push(e.call(c,c.__data__,d,l)),i.push(c));return new Tt(r,i)}function nf(e){return function(){return this.matches(e)}}function of(e){return function(n){return n.matches(e)}}var H1=Array.prototype.find;function Y1(e){return function(){return H1.call(this.children,e)}}function W1(){return this.firstElementChild}function X1(e){return this.select(e==null?W1:Y1(typeof e=="function"?e:of(e)))}var Z1=Array.prototype.filter;function J1(){return Array.from(this.children)}function Q1(e){return function(){return Z1.call(this.children,e)}}function eS(e){return this.selectAll(e==null?J1:Q1(typeof e=="function"?e:of(e)))}function tS(e){typeof e!="function"&&(e=nf(e));for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i)for(var a=n[i],l=a.length,s=r[i]=[],c,d=0;d<l;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new Tt(r,this._parents)}function rf(e){return new Array(e.length)}function nS(){return new Tt(this._enter||this._groups.map(rf),this._parents)}function pi(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}pi.prototype={constructor:pi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function oS(e){return function(){return e}}function rS(e,n,o,r,i,a){for(var l=0,s,c=n.length,d=a.length;l<d;++l)(s=n[l])?(s.__data__=a[l],r[l]=s):o[l]=new pi(e,a[l]);for(;l<c;++l)(s=n[l])&&(i[l]=s)}function iS(e,n,o,r,i,a,l){var s,c,d=new Map,f=n.length,u=a.length,p=new Array(f),m;for(s=0;s<f;++s)(c=n[s])&&(p[s]=m=l.call(c,c.__data__,s,n)+"",d.has(m)?i[s]=c:d.set(m,c));for(s=0;s<u;++s)m=l.call(e,a[s],s,a)+"",(c=d.get(m))?(r[s]=c,c.__data__=a[s],d.delete(m)):o[s]=new pi(e,a[s]);for(s=0;s<f;++s)(c=n[s])&&d.get(p[s])===c&&(i[s]=c)}function aS(e){return e.__data__}function lS(e,n){if(!arguments.length)return Array.from(this,aS);var o=n?iS:rS,r=this._parents,i=this._groups;typeof e!="function"&&(e=oS(e));for(var a=i.length,l=new Array(a),s=new Array(a),c=new Array(a),d=0;d<a;++d){var f=r[d],u=i[d],p=u.length,m=sS(e.call(f,f&&f.__data__,d,r)),y=m.length,_=s[d]=new Array(y),g=l[d]=new Array(y),h=c[d]=new Array(p);o(f,u,_,g,h,m,n);for(var w=0,b=0,x,E;w<y;++w)if(x=_[w]){for(w>=b&&(b=w+1);!(E=g[b])&&++b<y;);x._next=E||null}}return l=new Tt(l,r),l._enter=s,l._exit=c,l}function sS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cS(){return new Tt(this._exit||this._groups.map(rf),this._parents)}function dS(e,n,o){var r=this.enter(),i=this,a=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),n!=null&&(i=n(i),i&&(i=i.selection())),o==null?a.remove():o(a),r&&i?r.merge(i).order():i}function uS(e){for(var n=e.selection?e.selection():e,o=this._groups,r=n._groups,i=o.length,a=r.length,l=Math.min(i,a),s=new Array(i),c=0;c<l;++c)for(var d=o[c],f=r[c],u=d.length,p=s[c]=new Array(u),m,y=0;y<u;++y)(m=d[y]||f[y])&&(p[y]=m);for(;c<i;++c)s[c]=o[c];return new Tt(s,this._parents)}function fS(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var r=e[n],i=r.length-1,a=r[i],l;--i>=0;)(l=r[i])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function pS(e){e||(e=mS);function n(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a){for(var l=o[a],s=l.length,c=i[a]=new Array(s),d,f=0;f<s;++f)(d=l[f])&&(c[f]=d);c.sort(n)}return new Tt(i,this._parents).order()}function mS(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function gS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hS(){return Array.from(this)}function yS(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,a=r.length;i<a;++i){var l=r[i];if(l)return l}return null}function _S(){let e=0;for(const n of this)++e;return e}function bS(){return!this.node()}function wS(e){for(var n=this._groups,o=0,r=n.length;o<r;++o)for(var i=n[o],a=0,l=i.length,s;a<l;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function kS(e){return function(){this.removeAttribute(e)}}function CS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ES(e,n){return function(){this.setAttribute(e,n)}}function NS(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function SS(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function xS(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function vS(e,n){var o=fi(e);if(arguments.length<2){var r=this.node();return o.local?r.getAttributeNS(o.space,o.local):r.getAttribute(o)}return this.each((n==null?o.local?CS:kS:typeof n=="function"?o.local?xS:SS:o.local?NS:ES)(o,n))}function af(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function AS(e){return function(){this.style.removeProperty(e)}}function IS(e,n,o){return function(){this.style.setProperty(e,n,o)}}function TS(e,n,o){return function(){var r=n.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,o)}}function PS(e,n,o){return arguments.length>1?this.each((n==null?AS:typeof n=="function"?TS:IS)(e,n,o??"")):Eo(this.node(),e)}function Eo(e,n){return e.style.getPropertyValue(n)||af(e).getComputedStyle(e,null).getPropertyValue(n)}function OS(e){return function(){delete this[e]}}function $S(e,n){return function(){this[e]=n}}function BS(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function VS(e,n){return arguments.length>1?this.each((n==null?OS:typeof n=="function"?BS:$S)(e,n)):this.node()[e]}function lf(e){return e.trim().split(/^|\s+/)}function Al(e){return e.classList||new sf(e)}function sf(e){this._node=e,this._names=lf(e.getAttribute("class")||"")}sf.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function cf(e,n){for(var o=Al(e),r=-1,i=n.length;++r<i;)o.add(n[r])}function df(e,n){for(var o=Al(e),r=-1,i=n.length;++r<i;)o.remove(n[r])}function RS(e){return function(){cf(this,e)}}function DS(e){return function(){df(this,e)}}function MS(e,n){return function(){(n.apply(this,arguments)?cf:df)(this,e)}}function LS(e,n){var o=lf(e+"");if(arguments.length<2){for(var r=Al(this.node()),i=-1,a=o.length;++i<a;)if(!r.contains(o[i]))return!1;return!0}return this.each((typeof n=="function"?MS:n?RS:DS)(o,n))}function FS(){this.textContent=""}function US(e){return function(){this.textContent=e}}function KS(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function jS(e){return arguments.length?this.each(e==null?FS:(typeof e=="function"?KS:US)(e)):this.node().textContent}function GS(){this.innerHTML=""}function qS(e){return function(){this.innerHTML=e}}function zS(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function HS(e){return arguments.length?this.each(e==null?GS:(typeof e=="function"?zS:qS)(e)):this.node().innerHTML}function YS(){this.nextSibling&&this.parentNode.appendChild(this)}function WS(){return this.each(YS)}function XS(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ZS(){return this.each(XS)}function JS(e){var n=typeof e=="function"?e:ef(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function QS(){return null}function ex(e,n){var o=typeof e=="function"?e:ef(e),r=n==null?QS:typeof n=="function"?n:vl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),r.apply(this,arguments)||null)})}function tx(){var e=this.parentNode;e&&e.removeChild(this)}function nx(){return this.each(tx)}function ox(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function rx(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function ix(e){return this.select(e?rx:ox)}function ax(e){return arguments.length?this.property("__data__",e):this.node().__data__}function lx(e){return function(n){e.call(this,n,this.__data__)}}function sx(e){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");return r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),{type:n,name:o}})}function cx(e){return function(){var n=this.__on;if(n){for(var o=0,r=-1,i=n.length,a;o<i;++o)a=n[o],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):n[++r]=a;++r?n.length=r:delete this.__on}}}function dx(e,n,o){return function(){var r=this.__on,i,a=lx(n);if(r){for(var l=0,s=r.length;l<s;++l)if((i=r[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=o),i.value=n;return}}this.addEventListener(e.type,a,o),i={type:e.type,name:e.name,value:n,listener:a,options:o},r?r.push(i):this.__on=[i]}}function ux(e,n,o){var r=sx(e+""),i,a=r.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,f;c<d;++c)for(i=0,f=s[c];i<a;++i)if((l=r[i]).type===f.type&&l.name===f.name)return f.value}return}for(s=n?dx:cx,i=0;i<a;++i)this.each(s(r[i],n,o));return this}function uf(e,n,o){var r=af(e),i=r.CustomEvent;typeof i=="function"?i=new i(n,o):(i=r.document.createEvent("Event"),o?(i.initEvent(n,o.bubbles,o.cancelable),i.detail=o.detail):i.initEvent(n,!1,!1)),e.dispatchEvent(i)}function fx(e,n){return function(){return uf(this,e,n)}}function px(e,n){return function(){return uf(this,e,n.apply(this,arguments))}}function mx(e,n){return this.each((typeof n=="function"?px:fx)(e,n))}function*gx(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,a=r.length,l;i<a;++i)(l=r[i])&&(yield l)}var ff=[null];function Tt(e,n){this._groups=e,this._parents=n}function or(){return new Tt([[document.documentElement]],ff)}function hx(){return this}Tt.prototype=or.prototype={constructor:Tt,select:K1,selectAll:z1,selectChild:X1,selectChildren:eS,filter:tS,data:lS,enter:nS,exit:cS,join:dS,merge:uS,selection:hx,order:fS,sort:pS,call:gS,nodes:hS,node:yS,size:_S,empty:bS,each:wS,attr:vS,style:PS,property:VS,classed:LS,text:jS,html:HS,raise:WS,lower:ZS,append:JS,insert:ex,remove:nx,clone:ix,datum:ax,on:ux,dispatch:mx,[Symbol.iterator]:gx};function Ft(e){return typeof e=="string"?new Tt([[document.querySelector(e)]],[document.documentElement]):new Tt([[e]],ff)}function yx(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Ht(e,n){if(e=yx(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var r=o.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[e.clientX-i.left-n.clientLeft,e.clientY-i.top-n.clientTop]}}return[e.pageX,e.pageY]}const _x={passive:!1},rr={capture:!0,passive:!1};function Il(e){e.stopImmediatePropagation()}function No(e){e.preventDefault(),e.stopImmediatePropagation()}function pf(e){var n=e.document.documentElement,o=Ft(e).on("dragstart.drag",No,rr);"onselectstart"in n?o.on("selectstart.drag",No,rr):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function mf(e,n){var o=e.document.documentElement,r=Ft(e).on("dragstart.drag",null);n&&(r.on("click.drag",No,rr),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in o?r.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const mi=e=>()=>e;function Tl(e,{sourceEvent:n,subject:o,target:r,identifier:i,active:a,x:l,y:s,dx:c,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}Tl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function bx(e){return!e.ctrlKey&&!e.button}function wx(){return this.parentNode}function kx(e,n){return n??{x:e.x,y:e.y}}function Cx(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ex(){var e=bx,n=wx,o=kx,r=Cx,i={},a=di("start","drag","end"),l=0,s,c,d,f,u=0;function p(x){x.on("mousedown.drag",m).filter(r).on("touchstart.drag",g).on("touchmove.drag",h,_x).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(x,E){if(!(f||!e.call(this,x,E))){var C=b(this,n.call(this,x,E),x,E,"mouse");C&&(Ft(x.view).on("mousemove.drag",y,rr).on("mouseup.drag",_,rr),pf(x.view),Il(x),d=!1,s=x.clientX,c=x.clientY,C("start",x))}}function y(x){if(No(x),!d){var E=x.clientX-s,C=x.clientY-c;d=E*E+C*C>u}i.mouse("drag",x)}function _(x){Ft(x.view).on("mousemove.drag mouseup.drag",null),mf(x.view,d),No(x),i.mouse("end",x)}function g(x,E){if(e.call(this,x,E)){var C=x.changedTouches,N=n.call(this,x,E),S=C.length,v,D;for(v=0;v<S;++v)(D=b(this,N,x,E,C[v].identifier,C[v]))&&(Il(x),D("start",x,C[v]))}}function h(x){var E=x.changedTouches,C=E.length,N,S;for(N=0;N<C;++N)(S=i[E[N].identifier])&&(No(x),S("drag",x,E[N]))}function w(x){var E=x.changedTouches,C=E.length,N,S;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),N=0;N<C;++N)(S=i[E[N].identifier])&&(Il(x),S("end",x,E[N]))}function b(x,E,C,N,S,v){var D=a.copy(),L=Ht(v||C,E),k,J,I;if((I=o.call(x,new Tl("beforestart",{sourceEvent:C,target:p,identifier:S,active:l,x:L[0],y:L[1],dx:0,dy:0,dispatch:D}),N))!=null)return k=I.x-L[0]||0,J=I.y-L[1]||0,function G(j,te,K){var O=L,P;switch(j){case"start":i[S]=G,P=l++;break;case"end":delete i[S],--l;case"drag":L=Ht(K||te,E),P=l;break}D.call(j,x,new Tl(j,{sourceEvent:te,subject:I,target:p,identifier:S,active:P,x:L[0]+k,y:L[1]+J,dx:L[0]-O[0],dy:L[1]-O[1],dispatch:D}),N)}}return p.filter=function(x){return arguments.length?(e=typeof x=="function"?x:mi(!!x),p):e},p.container=function(x){return arguments.length?(n=typeof x=="function"?x:mi(x),p):n},p.subject=function(x){return arguments.length?(o=typeof x=="function"?x:mi(x),p):o},p.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:mi(!!x),p):r},p.on=function(){var x=a.on.apply(a,arguments);return x===a?p:x},p.clickDistance=function(x){return arguments.length?(u=(x=+x)*x,p):Math.sqrt(u)},p}function Pl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function gf(e,n){var o=Object.create(e.prototype);for(var r in n)o[r]=n[r];return o}function ir(){}var ar=.7,gi=1/ar,So="\\s*([+-]?\\d+)\\s*",lr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Nx=/^#([0-9a-f]{3,8})$/,Sx=new RegExp(`^rgb\\(${So},${So},${So}\\)$`),xx=new RegExp(`^rgb\\(${Yt},${Yt},${Yt}\\)$`),vx=new RegExp(`^rgba\\(${So},${So},${So},${lr}\\)$`),Ax=new RegExp(`^rgba\\(${Yt},${Yt},${Yt},${lr}\\)$`),Ix=new RegExp(`^hsl\\(${lr},${Yt},${Yt}\\)$`),Tx=new RegExp(`^hsla\\(${lr},${Yt},${Yt},${lr}\\)$`),hf={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Pl(ir,Un,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yf,formatHex:yf,formatHex8:Px,formatHsl:Ox,formatRgb:_f,toString:_f});function yf(){return this.rgb().formatHex()}function Px(){return this.rgb().formatHex8()}function Ox(){return Ef(this).formatHsl()}function _f(){return this.rgb().formatRgb()}function Un(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Nx.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?bf(n):o===3?new vt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?hi(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?hi(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Sx.exec(e))?new vt(n[1],n[2],n[3],1):(n=xx.exec(e))?new vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=vx.exec(e))?hi(n[1],n[2],n[3],n[4]):(n=Ax.exec(e))?hi(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Ix.exec(e))?Cf(n[1],n[2]/100,n[3]/100,1):(n=Tx.exec(e))?Cf(n[1],n[2]/100,n[3]/100,n[4]):hf.hasOwnProperty(e)?bf(hf[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function bf(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function hi(e,n,o,r){return r<=0&&(e=n=o=NaN),new vt(e,n,o,r)}function $x(e){return e instanceof ir||(e=Un(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function Ol(e,n,o,r){return arguments.length===1?$x(e):new vt(e,n,o,r??1)}function vt(e,n,o,r){this.r=+e,this.g=+n,this.b=+o,this.opacity=+r}Pl(vt,Ol,gf(ir,{brighter(e){return e=e==null?gi:Math.pow(gi,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ar:Math.pow(ar,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(Kn(this.r),Kn(this.g),Kn(this.b),yi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wf,formatHex:wf,formatHex8:Bx,formatRgb:kf,toString:kf}));function wf(){return`#${jn(this.r)}${jn(this.g)}${jn(this.b)}`}function Bx(){return`#${jn(this.r)}${jn(this.g)}${jn(this.b)}${jn((isNaN(this.opacity)?1:this.opacity)*255)}`}function kf(){const e=yi(this.opacity);return`${e===1?"rgb(":"rgba("}${Kn(this.r)}, ${Kn(this.g)}, ${Kn(this.b)}${e===1?")":`, ${e})`}`}function yi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jn(e){return e=Kn(e),(e<16?"0":"")+e.toString(16)}function Cf(e,n,o,r){return r<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Ut(e,n,o,r)}function Ef(e){if(e instanceof Ut)return new Ut(e.h,e.s,e.l,e.opacity);if(e instanceof ir||(e=Un(e)),!e)return new Ut;if(e instanceof Ut)return e;e=e.rgb();var n=e.r/255,o=e.g/255,r=e.b/255,i=Math.min(n,o,r),a=Math.max(n,o,r),l=NaN,s=a-i,c=(a+i)/2;return s?(n===a?l=(o-r)/s+(o<r)*6:o===a?l=(r-n)/s+2:l=(n-o)/s+4,s/=c<.5?a+i:2-a-i,l*=60):s=c>0&&c<1?0:l,new Ut(l,s,c,e.opacity)}function Vx(e,n,o,r){return arguments.length===1?Ef(e):new Ut(e,n,o,r??1)}function Ut(e,n,o,r){this.h=+e,this.s=+n,this.l=+o,this.opacity=+r}Pl(Ut,Vx,gf(ir,{brighter(e){return e=e==null?gi:Math.pow(gi,e),new Ut(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ar:Math.pow(ar,e),new Ut(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,r=o+(o<.5?o:1-o)*n,i=2*o-r;return new vt($l(e>=240?e-240:e+120,i,r),$l(e,i,r),$l(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ut(Nf(this.h),_i(this.s),_i(this.l),yi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=yi(this.opacity);return`${e===1?"hsl(":"hsla("}${Nf(this.h)}, ${_i(this.s)*100}%, ${_i(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Nf(e){return e=(e||0)%360,e<0?e+360:e}function _i(e){return Math.max(0,Math.min(1,e||0))}function $l(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Bl=e=>()=>e;function Rx(e,n){return function(o){return e+o*n}}function Dx(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(r){return Math.pow(e+r*n,o)}}function Mx(e){return(e=+e)==1?Sf:function(n,o){return o-n?Dx(n,o,e):Bl(isNaN(n)?o:n)}}function Sf(e,n){var o=n-e;return o?Rx(e,o):Bl(isNaN(e)?n:e)}const bi=function e(n){var o=Mx(n);function r(i,a){var l=o((i=Ol(i)).r,(a=Ol(a)).r),s=o(i.g,a.g),c=o(i.b,a.b),d=Sf(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=s(f),i.b=c(f),i.opacity=d(f),i+""}}return r.gamma=e,r}(1);function Lx(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,r=n.slice(),i;return function(a){for(i=0;i<o;++i)r[i]=e[i]*(1-a)+n[i]*a;return r}}function Fx(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ux(e,n){var o=n?n.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),a=new Array(o),l;for(l=0;l<r;++l)i[l]=sr(e[l],n[l]);for(;l<o;++l)a[l]=n[l];return function(s){for(l=0;l<r;++l)a[l]=i[l](s);return a}}function Kx(e,n){var o=new Date;return e=+e,n=+n,function(r){return o.setTime(e*(1-r)+n*r),o}}function Wt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function jx(e,n){var o={},r={},i;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(i in n)i in e?o[i]=sr(e[i],n[i]):r[i]=n[i];return function(a){for(i in o)r[i]=o[i](a);return r}}var Vl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rl=new RegExp(Vl.source,"g");function Gx(e){return function(){return e}}function qx(e){return function(n){return e(n)+""}}function xf(e,n){var o=Vl.lastIndex=Rl.lastIndex=0,r,i,a,l=-1,s=[],c=[];for(e=e+"",n=n+"";(r=Vl.exec(e))&&(i=Rl.exec(n));)(a=i.index)>o&&(a=n.slice(o,a),s[l]?s[l]+=a:s[++l]=a),(r=r[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,c.push({i:l,x:Wt(r,i)})),o=Rl.lastIndex;return o<n.length&&(a=n.slice(o),s[l]?s[l]+=a:s[++l]=a),s.length<2?c[0]?qx(c[0].x):Gx(n):(n=c.length,function(d){for(var f=0,u;f<n;++f)s[(u=c[f]).i]=u.x(d);return s.join("")})}function sr(e,n){var o=typeof n,r;return n==null||o==="boolean"?Bl(n):(o==="number"?Wt:o==="string"?(r=Un(n))?(n=r,bi):xf:n instanceof Un?bi:n instanceof Date?Kx:Fx(n)?Lx:Array.isArray(n)?Ux:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?jx:Wt)(e,n)}var vf=180/Math.PI,Dl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Af(e,n,o,r,i,a){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*r)&&(o-=e*c,r-=n*c),(s=Math.sqrt(o*o+r*r))&&(o/=s,r/=s,c/=s),e*r<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:i,translateY:a,rotate:Math.atan2(n,e)*vf,skewX:Math.atan(c)*vf,scaleX:l,scaleY:s}}var wi;function zx(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Dl:Af(n.a,n.b,n.c,n.d,n.e,n.f)}function Hx(e){return e==null||(wi||(wi=document.createElementNS("http://www.w3.org/2000/svg","g")),wi.setAttribute("transform",e),!(e=wi.transform.baseVal.consolidate()))?Dl:(e=e.matrix,Af(e.a,e.b,e.c,e.d,e.e,e.f))}function If(e,n,o,r){function i(d){return d.length?d.pop()+" ":""}function a(d,f,u,p,m,y){if(d!==u||f!==p){var _=m.push("translate(",null,n,null,o);y.push({i:_-4,x:Wt(d,u)},{i:_-2,x:Wt(f,p)})}else(u||p)&&m.push("translate("+u+n+p+o)}function l(d,f,u,p){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),p.push({i:u.push(i(u)+"rotate(",null,r)-2,x:Wt(d,f)})):f&&u.push(i(u)+"rotate("+f+r)}function s(d,f,u,p){d!==f?p.push({i:u.push(i(u)+"skewX(",null,r)-2,x:Wt(d,f)}):f&&u.push(i(u)+"skewX("+f+r)}function c(d,f,u,p,m,y){if(d!==u||f!==p){var _=m.push(i(m)+"scale(",null,",",null,")");y.push({i:_-4,x:Wt(d,u)},{i:_-2,x:Wt(f,p)})}else(u!==1||p!==1)&&m.push(i(m)+"scale("+u+","+p+")")}return function(d,f){var u=[],p=[];return d=e(d),f=e(f),a(d.translateX,d.translateY,f.translateX,f.translateY,u,p),l(d.rotate,f.rotate,u,p),s(d.skewX,f.skewX,u,p),c(d.scaleX,d.scaleY,f.scaleX,f.scaleY,u,p),d=f=null,function(m){for(var y=-1,_=p.length,g;++y<_;)u[(g=p[y]).i]=g.x(m);return u.join("")}}}var Yx=If(zx,"px, ","px)","deg)"),Wx=If(Hx,", ",")",")"),Xx=1e-12;function Tf(e){return((e=Math.exp(e))+1/e)/2}function Zx(e){return((e=Math.exp(e))-1/e)/2}function Jx(e){return((e=Math.exp(2*e))-1)/(e+1)}const ki=function e(n,o,r){function i(a,l){var s=a[0],c=a[1],d=a[2],f=l[0],u=l[1],p=l[2],m=f-s,y=u-c,_=m*m+y*y,g,h;if(_<Xx)h=Math.log(p/d)/n,g=function(N){return[s+N*m,c+N*y,d*Math.exp(n*N*h)]};else{var w=Math.sqrt(_),b=(p*p-d*d+r*_)/(2*d*o*w),x=(p*p-d*d-r*_)/(2*p*o*w),E=Math.log(Math.sqrt(b*b+1)-b),C=Math.log(Math.sqrt(x*x+1)-x);h=(C-E)/n,g=function(N){var S=N*h,v=Tf(E),D=d/(o*w)*(v*Jx(n*S+E)-Zx(E));return[s+D*m,c+D*y,d*v/Tf(n*S+E)]}}return g.duration=h*1e3*n/Math.SQRT2,g}return i.rho=function(a){var l=Math.max(.001,+a),s=l*l,c=s*s;return e(l,s,c)},i}(Math.SQRT2,2,4);var xo=0,cr=0,dr=0,Pf=1e3,Ci,ur,Ei=0,Gn=0,Ni=0,fr=typeof performance=="object"&&performance.now?performance:Date,Of=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ml(){return Gn||(Of(Qx),Gn=fr.now()+Ni)}function Qx(){Gn=0}function Si(){this._call=this._time=this._next=null}Si.prototype=$f.prototype={constructor:Si,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ml():+o)+(n==null?0:+n),!this._next&&ur!==this&&(ur?ur._next=this:Ci=this,ur=this),this._call=e,this._time=o,Ll()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ll())}};function $f(e,n,o){var r=new Si;return r.restart(e,n,o),r}function ev(){Ml(),++xo;for(var e=Ci,n;e;)(n=Gn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--xo}function Bf(){Gn=(Ei=fr.now())+Ni,xo=cr=0;try{ev()}finally{xo=0,nv(),Gn=0}}function tv(){var e=fr.now(),n=e-Ei;n>Pf&&(Ni-=n,Ei=e)}function nv(){for(var e,n=Ci,o,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ci=o);ur=e,Ll(r)}function Ll(e){if(!xo){cr&&(cr=clearTimeout(cr));var n=e-Gn;n>24?(e<1/0&&(cr=setTimeout(Bf,e-fr.now()-Ni)),dr&&(dr=clearInterval(dr))):(dr||(Ei=fr.now(),dr=setInterval(tv,Pf)),xo=1,Of(Bf))}}function Vf(e,n,o){var r=new Si;return n=n==null?0:+n,r.restart(i=>{r.stop(),e(i+n)},n,o),r}var ov=di("start","end","cancel","interrupt"),rv=[],Rf=0,Df=1,Fl=2,xi=3,Mf=4,Ul=5,vi=6;function Ai(e,n,o,r,i,a){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;iv(e,o,{name:n,index:r,group:i,on:ov,tween:rv,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Rf})}function Kl(e,n){var o=Kt(e,n);if(o.state>Rf)throw new Error("too late; already scheduled");return o}function Xt(e,n){var o=Kt(e,n);if(o.state>xi)throw new Error("too late; already running");return o}function Kt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function iv(e,n,o){var r=e.__transition,i;r[n]=o,o.timer=$f(a,0,o.time);function a(d){o.state=Df,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var f,u,p,m;if(o.state!==Df)return c();for(f in r)if(m=r[f],m.name===o.name){if(m.state===xi)return Vf(l);m.state===Mf?(m.state=vi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[f]):+f<n&&(m.state=vi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete r[f])}if(Vf(function(){o.state===xi&&(o.state=Mf,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Fl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Fl){for(o.state=xi,i=new Array(p=o.tween.length),f=0,u=-1;f<p;++f)(m=o.tween[f].value.call(e,e.__data__,o.index,o.group))&&(i[++u]=m);i.length=u+1}}function s(d){for(var f=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Ul,1),u=-1,p=i.length;++u<p;)i[u].call(e,f);o.state===Ul&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=vi,o.timer.stop(),delete r[n];for(var d in r)return;delete e.__transition}}function Ii(e,n){var o=e.__transition,r,i,a=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((r=o[l]).name!==n){a=!1;continue}i=r.state>Fl&&r.state<Ul,r.state=vi,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete o[l]}a&&delete e.__transition}}function av(e){return this.each(function(){Ii(this,e)})}function lv(e,n){var o,r;return function(){var i=Xt(this,e),a=i.tween;if(a!==o){r=o=a;for(var l=0,s=r.length;l<s;++l)if(r[l].name===n){r=r.slice(),r.splice(l,1);break}}i.tween=r}}function sv(e,n,o){var r,i;if(typeof o!="function")throw new Error;return function(){var a=Xt(this,e),l=a.tween;if(l!==r){i=(r=l).slice();for(var s={name:n,value:o},c=0,d=i.length;c<d;++c)if(i[c].name===n){i[c]=s;break}c===d&&i.push(s)}a.tween=i}}function cv(e,n){var o=this._id;if(e+="",arguments.length<2){for(var r=Kt(this.node(),o).tween,i=0,a=r.length,l;i<a;++i)if((l=r[i]).name===e)return l.value;return null}return this.each((n==null?lv:sv)(o,e,n))}function jl(e,n,o){var r=e._id;return e.each(function(){var i=Xt(this,r);(i.value||(i.value={}))[n]=o.apply(this,arguments)}),function(i){return Kt(i,r).value[n]}}function Lf(e,n){var o;return(typeof n=="number"?Wt:n instanceof Un?bi:(o=Un(n))?(n=o,bi):xf)(e,n)}function dv(e){return function(){this.removeAttribute(e)}}function uv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fv(e,n,o){var r,i=o+"",a;return function(){var l=this.getAttribute(e);return l===i?null:l===r?a:a=n(r=l,o)}}function pv(e,n,o){var r,i=o+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===r?a:a=n(r=l,o)}}function mv(e,n,o){var r,i,a;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===r&&c===i?a:(i=c,a=n(r=l,s)))}}function gv(e,n,o){var r,i,a;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===r&&c===i?a:(i=c,a=n(r=l,s)))}}function hv(e,n){var o=fi(e),r=o==="transform"?Wx:Lf;return this.attrTween(e,typeof n=="function"?(o.local?gv:mv)(o,r,jl(this,"attr."+e,n)):n==null?(o.local?uv:dv)(o):(o.local?pv:fv)(o,r,n))}function yv(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function _v(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function bv(e,n){var o,r;function i(){var a=n.apply(this,arguments);return a!==r&&(o=(r=a)&&_v(e,a)),o}return i._value=n,i}function wv(e,n){var o,r;function i(){var a=n.apply(this,arguments);return a!==r&&(o=(r=a)&&yv(e,a)),o}return i._value=n,i}function kv(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var r=fi(e);return this.tween(o,(r.local?bv:wv)(r,n))}function Cv(e,n){return function(){Kl(this,e).delay=+n.apply(this,arguments)}}function Ev(e,n){return n=+n,function(){Kl(this,e).delay=n}}function Nv(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Cv:Ev)(n,e)):Kt(this.node(),n).delay}function Sv(e,n){return function(){Xt(this,e).duration=+n.apply(this,arguments)}}function xv(e,n){return n=+n,function(){Xt(this,e).duration=n}}function vv(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Sv:xv)(n,e)):Kt(this.node(),n).duration}function Av(e,n){if(typeof n!="function")throw new Error;return function(){Xt(this,e).ease=n}}function Iv(e){var n=this._id;return arguments.length?this.each(Av(n,e)):Kt(this.node(),n).ease}function Tv(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Xt(this,e).ease=o}}function Pv(e){if(typeof e!="function")throw new Error;return this.each(Tv(this._id,e))}function Ov(e){typeof e!="function"&&(e=nf(e));for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i)for(var a=n[i],l=a.length,s=r[i]=[],c,d=0;d<l;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new cn(r,this._parents,this._name,this._id)}function $v(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,r=n.length,i=o.length,a=Math.min(r,i),l=new Array(r),s=0;s<a;++s)for(var c=n[s],d=o[s],f=c.length,u=l[s]=new Array(f),p,m=0;m<f;++m)(p=c[m]||d[m])&&(u[m]=p);for(;s<r;++s)l[s]=n[s];return new cn(l,this._parents,this._name,this._id)}function Bv(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function Vv(e,n,o){var r,i,a=Bv(n)?Kl:Xt;return function(){var l=a(this,e),s=l.on;s!==r&&(i=(r=s).copy()).on(n,o),l.on=i}}function Rv(e,n){var o=this._id;return arguments.length<2?Kt(this.node(),o).on.on(e):this.each(Vv(o,e,n))}function Dv(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function Mv(){return this.on("end.remove",Dv(this._id))}function Lv(e){var n=this._name,o=this._id;typeof e!="function"&&(e=vl(e));for(var r=this._groups,i=r.length,a=new Array(i),l=0;l<i;++l)for(var s=r[l],c=s.length,d=a[l]=new Array(c),f,u,p=0;p<c;++p)(f=s[p])&&(u=e.call(f,f.__data__,p,s))&&("__data__"in f&&(u.__data__=f.__data__),d[p]=u,Ai(d[p],n,o,p,d,Kt(f,o)));return new cn(a,this._parents,n,o)}function Fv(e){var n=this._name,o=this._id;typeof e!="function"&&(e=tf(e));for(var r=this._groups,i=r.length,a=[],l=[],s=0;s<i;++s)for(var c=r[s],d=c.length,f,u=0;u<d;++u)if(f=c[u]){for(var p=e.call(f,f.__data__,u,c),m,y=Kt(f,o),_=0,g=p.length;_<g;++_)(m=p[_])&&Ai(m,n,o,_,p,y);a.push(p),l.push(f)}return new cn(a,l,n,o)}var Uv=or.prototype.constructor;function Kv(){return new Uv(this._groups,this._parents)}function jv(e,n){var o,r,i;return function(){var a=Eo(this,e),l=(this.style.removeProperty(e),Eo(this,e));return a===l?null:a===o&&l===r?i:i=n(o=a,r=l)}}function Ff(e){return function(){this.style.removeProperty(e)}}function Gv(e,n,o){var r,i=o+"",a;return function(){var l=Eo(this,e);return l===i?null:l===r?a:a=n(r=l,o)}}function qv(e,n,o){var r,i,a;return function(){var l=Eo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Eo(this,e))),l===c?null:l===r&&c===i?a:(i=c,a=n(r=l,s))}}function zv(e,n){var o,r,i,a="style."+n,l="end."+a,s;return function(){var c=Xt(this,e),d=c.on,f=c.value[a]==null?s||(s=Ff(n)):void 0;(d!==o||i!==f)&&(r=(o=d).copy()).on(l,i=f),c.on=r}}function Hv(e,n,o){var r=(e+="")=="transform"?Yx:Lf;return n==null?this.styleTween(e,jv(e,r)).on("end.style."+e,Ff(e)):typeof n=="function"?this.styleTween(e,qv(e,r,jl(this,"style."+e,n))).each(zv(this._id,e)):this.styleTween(e,Gv(e,r,n),o).on("end.style."+e,null)}function Yv(e,n,o){return function(r){this.style.setProperty(e,n.call(this,r),o)}}function Wv(e,n,o){var r,i;function a(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&Yv(e,l,o)),r}return a._value=n,a}function Xv(e,n,o){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;return this.tween(r,Wv(e,n,o??""))}function Zv(e){return function(){this.textContent=e}}function Jv(e){return function(){var n=e(this);this.textContent=n??""}}function Qv(e){return this.tween("text",typeof e=="function"?Jv(jl(this,"text",e)):Zv(e==null?"":e+""))}function eA(e){return function(n){this.textContent=e.call(this,n)}}function tA(e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&eA(i)),n}return r._value=e,r}function nA(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,tA(e))}function oA(){for(var e=this._name,n=this._id,o=Uf(),r=this._groups,i=r.length,a=0;a<i;++a)for(var l=r[a],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var f=Kt(c,n);Ai(c,e,o,d,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new cn(r,this._parents,e,o)}function rA(){var e,n,o=this,r=o._id,i=o.size();return new Promise(function(a,l){var s={value:l},c={value:function(){--i===0&&a()}};o.each(function(){var d=Xt(this,r),f=d.on;f!==e&&(n=(e=f).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),i===0&&a()})}var iA=0;function cn(e,n,o,r){this._groups=e,this._parents=n,this._name=o,this._id=r}function Uf(){return++iA}var dn=or.prototype;cn.prototype={constructor:cn,select:Lv,selectAll:Fv,selectChild:dn.selectChild,selectChildren:dn.selectChildren,filter:Ov,merge:$v,selection:Kv,transition:oA,call:dn.call,nodes:dn.nodes,node:dn.node,size:dn.size,empty:dn.empty,each:dn.each,on:Rv,attr:hv,attrTween:kv,style:Hv,styleTween:Xv,text:Qv,textTween:nA,remove:Mv,tween:cv,delay:Nv,duration:vv,ease:Iv,easeVarying:Pv,end:rA,[Symbol.iterator]:dn[Symbol.iterator]};function aA(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var lA={time:null,delay:0,duration:250,ease:aA};function sA(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function cA(e){var n,o;e instanceof cn?(n=e._id,e=e._name):(n=Uf(),(o=lA).time=Ml(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var l=r[a],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Ai(c,e,n,d,l,o||sA(c,n));return new cn(r,this._parents,e,n)}or.prototype.interrupt=av,or.prototype.transition=cA;const Ti=e=>()=>e;function dA(e,{sourceEvent:n,target:o,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function un(e,n,o){this.k=e,this.x=n,this.y=o}un.prototype={constructor:un,scale:function(e){return e===1?this:new un(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new un(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vo=new un(1,0,0);un.prototype;function Gl(e){e.stopImmediatePropagation()}function pr(e){e.preventDefault(),e.stopImmediatePropagation()}function uA(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function fA(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Kf(){return this.__zoom||vo}function pA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mA(){return navigator.maxTouchPoints||"ontouchstart"in this}function gA(e,n,o){var r=e.invertX(n[0][0])-o[0][0],i=e.invertX(n[1][0])-o[1][0],a=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function hA(){var e=uA,n=fA,o=gA,r=pA,i=mA,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ki,d=di("start","zoom","end"),f,u,p,m=500,y=150,_=0,g=10;function h(I){I.property("__zoom",Kf).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",D).filter(i).on("touchstart.zoom",L).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}h.transform=function(I,G,j,te){var K=I.selection?I.selection():I;K.property("__zoom",Kf),I!==K?E(I,G,j,te):K.interrupt().each(function(){C(this,arguments).event(te).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},h.scaleBy=function(I,G,j,te){h.scaleTo(I,function(){var K=this.__zoom.k,O=typeof G=="function"?G.apply(this,arguments):G;return K*O},j,te)},h.scaleTo=function(I,G,j,te){h.transform(I,function(){var K=n.apply(this,arguments),O=this.__zoom,P=j==null?x(K):typeof j=="function"?j.apply(this,arguments):j,T=O.invert(P),M=typeof G=="function"?G.apply(this,arguments):G;return o(b(w(O,M),P,T),K,l)},j,te)},h.translateBy=function(I,G,j,te){h.transform(I,function(){return o(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof j=="function"?j.apply(this,arguments):j),n.apply(this,arguments),l)},null,te)},h.translateTo=function(I,G,j,te,K){h.transform(I,function(){var O=n.apply(this,arguments),P=this.__zoom,T=te==null?x(O):typeof te=="function"?te.apply(this,arguments):te;return o(vo.translate(T[0],T[1]).scale(P.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof j=="function"?-j.apply(this,arguments):-j),O,l)},te,K)};function w(I,G){return G=Math.max(a[0],Math.min(a[1],G)),G===I.k?I:new un(G,I.x,I.y)}function b(I,G,j){var te=G[0]-j[0]*I.k,K=G[1]-j[1]*I.k;return te===I.x&&K===I.y?I:new un(I.k,te,K)}function x(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function E(I,G,j,te){I.on("start.zoom",function(){C(this,arguments).event(te).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(te).end()}).tween("zoom",function(){var K=this,O=arguments,P=C(K,O).event(te),T=n.apply(K,O),M=j==null?x(T):typeof j=="function"?j.apply(K,O):j,Y=Math.max(T[1][0]-T[0][0],T[1][1]-T[0][1]),z=K.__zoom,H=typeof G=="function"?G.apply(K,O):G,Z=c(z.invert(M).concat(Y/z.k),H.invert(M).concat(Y/H.k));return function(ie){if(ie===1)ie=H;else{var be=Z(ie),ee=Y/be[2];ie=new un(ee,M[0]-be[0]*ee,M[1]-be[1]*ee)}P.zoom(null,ie)}})}function C(I,G,j){return!j&&I.__zooming||new N(I,G)}function N(I,G){this.that=I,this.args=G,this.active=0,this.sourceEvent=null,this.extent=n.apply(I,G),this.taps=0}N.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,G){return this.mouse&&I!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var G=Ft(this.that).datum();d.call(I,this.that,new dA(I,{sourceEvent:this.sourceEvent,target:h,transform:this.that.__zoom,dispatch:d}),G)}};function S(I,...G){if(!e.apply(this,arguments))return;var j=C(this,G).event(I),te=this.__zoom,K=Math.max(a[0],Math.min(a[1],te.k*Math.pow(2,r.apply(this,arguments)))),O=Ht(I);if(j.wheel)(j.mouse[0][0]!==O[0]||j.mouse[0][1]!==O[1])&&(j.mouse[1]=te.invert(j.mouse[0]=O)),clearTimeout(j.wheel);else{if(te.k===K)return;j.mouse=[O,te.invert(O)],Ii(this),j.start()}pr(I),j.wheel=setTimeout(P,y),j.zoom("mouse",o(b(w(te,K),j.mouse[0],j.mouse[1]),j.extent,l));function P(){j.wheel=null,j.end()}}function v(I,...G){if(p||!e.apply(this,arguments))return;var j=I.currentTarget,te=C(this,G,!0).event(I),K=Ft(I.view).on("mousemove.zoom",M,!0).on("mouseup.zoom",Y,!0),O=Ht(I,j),P=I.clientX,T=I.clientY;pf(I.view),Gl(I),te.mouse=[O,this.__zoom.invert(O)],Ii(this),te.start();function M(z){if(pr(z),!te.moved){var H=z.clientX-P,Z=z.clientY-T;te.moved=H*H+Z*Z>_}te.event(z).zoom("mouse",o(b(te.that.__zoom,te.mouse[0]=Ht(z,j),te.mouse[1]),te.extent,l))}function Y(z){K.on("mousemove.zoom mouseup.zoom",null),mf(z.view,te.moved),pr(z),te.event(z).end()}}function D(I,...G){if(e.apply(this,arguments)){var j=this.__zoom,te=Ht(I.changedTouches?I.changedTouches[0]:I,this),K=j.invert(te),O=j.k*(I.shiftKey?.5:2),P=o(b(w(j,O),te,K),n.apply(this,G),l);pr(I),s>0?Ft(this).transition().duration(s).call(E,P,te,I):Ft(this).call(h.transform,P,te,I)}}function L(I,...G){if(e.apply(this,arguments)){var j=I.touches,te=j.length,K=C(this,G,I.changedTouches.length===te).event(I),O,P,T,M;for(Gl(I),P=0;P<te;++P)T=j[P],M=Ht(T,this),M=[M,this.__zoom.invert(M),T.identifier],K.touch0?!K.touch1&&K.touch0[2]!==M[2]&&(K.touch1=M,K.taps=0):(K.touch0=M,O=!0,K.taps=1+!!f);f&&(f=clearTimeout(f)),O&&(K.taps<2&&(u=M[0],f=setTimeout(function(){f=null},m)),Ii(this),K.start())}}function k(I,...G){if(this.__zooming){var j=C(this,G).event(I),te=I.changedTouches,K=te.length,O,P,T,M;for(pr(I),O=0;O<K;++O)P=te[O],T=Ht(P,this),j.touch0&&j.touch0[2]===P.identifier?j.touch0[0]=T:j.touch1&&j.touch1[2]===P.identifier&&(j.touch1[0]=T);if(P=j.that.__zoom,j.touch1){var Y=j.touch0[0],z=j.touch0[1],H=j.touch1[0],Z=j.touch1[1],ie=(ie=H[0]-Y[0])*ie+(ie=H[1]-Y[1])*ie,be=(be=Z[0]-z[0])*be+(be=Z[1]-z[1])*be;P=w(P,Math.sqrt(ie/be)),T=[(Y[0]+H[0])/2,(Y[1]+H[1])/2],M=[(z[0]+Z[0])/2,(z[1]+Z[1])/2]}else if(j.touch0)T=j.touch0[0],M=j.touch0[1];else return;j.zoom("touch",o(b(P,T,M),j.extent,l))}}function J(I,...G){if(this.__zooming){var j=C(this,G).event(I),te=I.changedTouches,K=te.length,O,P;for(Gl(I),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),O=0;O<K;++O)P=te[O],j.touch0&&j.touch0[2]===P.identifier?delete j.touch0:j.touch1&&j.touch1[2]===P.identifier&&delete j.touch1;if(j.touch1&&!j.touch0&&(j.touch0=j.touch1,delete j.touch1),j.touch0)j.touch0[1]=this.__zoom.invert(j.touch0[0]);else if(j.end(),j.taps===2&&(P=Ht(P,this),Math.hypot(u[0]-P[0],u[1]-P[1])<g)){var T=Ft(this).on("dblclick.zoom");T&&T.apply(this,arguments)}}}return h.wheelDelta=function(I){return arguments.length?(r=typeof I=="function"?I:Ti(+I),h):r},h.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Ti(!!I),h):e},h.touchable=function(I){return arguments.length?(i=typeof I=="function"?I:Ti(!!I),h):i},h.extent=function(I){return arguments.length?(n=typeof I=="function"?I:Ti([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),h):n},h.scaleExtent=function(I){return arguments.length?(a[0]=+I[0],a[1]=+I[1],h):[a[0],a[1]]},h.translateExtent=function(I){return arguments.length?(l[0][0]=+I[0][0],l[1][0]=+I[1][0],l[0][1]=+I[0][1],l[1][1]=+I[1][1],h):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},h.constrain=function(I){return arguments.length?(o=I,h):o},h.duration=function(I){return arguments.length?(s=+I,h):s},h.interpolate=function(I){return arguments.length?(c=I,h):c},h.on=function(){var I=d.on.apply(d,arguments);return I===d?h:I},h.clickDistance=function(I){return arguments.length?(_=(I=+I)*I,h):Math.sqrt(_)},h.tapDistance=function(I){return arguments.length?(g=+I,h):g},h}var Ee=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Ee||{}),ql=(e=>(e.Partial="partial",e.Full="full",e))(ql||{}),qn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(qn||{}),wn=(e=>(e.Strict="strict",e.Loose="loose",e))(wn||{}),mr=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(mr||{}),gr=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(gr||{}),jf=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(jf||{});const yA=["INPUT","SELECT","TEXTAREA"],_A=typeof document<"u"?document:null;function zl(e){var n,o;const r=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,i=typeof(r==null?void 0:r.hasAttribute)=="function"?r.hasAttribute("contenteditable"):!1,a=typeof(r==null?void 0:r.closest)=="function"?r.closest(".nokey"):null;return yA.includes(r==null?void 0:r.nodeName)||i||!!a}function bA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Gf(e,n,o,r){const i=n.replace("+",`
|
|
120
120
|
`).replace(`
|
|
121
121
|
|
|
122
122
|
`,`
|
|
123
123
|
+`).split(`
|
|
124
|
-
`).map(l=>l.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===n.toLowerCase();r||o.add(e.toLowerCase());const a=i.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===i[s]);return r&&o.delete(e.toLowerCase()),a}function vA(e,n){return o=>{if(!o.code&&!o.key)return!1;const r=AA(o.code,e);return Array.isArray(e)?e.some(i=>zf(o[r],i,n,o.type==="keyup")):zf(o[r],e,n,o.type==="keyup")}}function AA(e,n){return n.includes(e)?"code":"key"}function yr(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??SA),r=t.shallowRef(t.toValue(e)===!0);let i=!1;const a=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,f)=>{typeof f=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),Ju(["blur","contextmenu"],s),Qu((...d)=>l(...d),d=>{var f,u;const p=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,m=t.toValue(n==null?void 0:n.preventDefault)??!1;if(i=xA(d),(!i||i&&!p)&&zl(d))return;const _=((u=(f=d.composedPath)==null?void 0:f.call(d))==null?void 0:u[0])||d.target,g=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";!m&&(i||!g)&&d.preventDefault(),r.value=!0},{eventName:"keydown",target:o}),Qu((...d)=>l(...d),d=>{const f=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!f)&&zl(d))return;i=!1,r.value=!1}},{eventName:"keyup",target:o});function s(){i=!1,a.clear(),r.value=t.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),r.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?vA(d,a):d}return r}const Hf="vue-flow__node-desc",Yf="vue-flow__edge-desc",IA="vue-flow__aria-live",Wf=["Enter"," ","Escape"],Io={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function $i(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Bi(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*r)}function Vi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function zn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function Xf(e,n){return{x:zn(e.x,n[0][0],n[1][0]),y:zn(e.y,n[0][1],n[1][1])}}function Zf(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function kn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Hn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!kn(e)}function _r(e){return Hn(e)&&"computedPosition"in e}function Ri(e){return!Number.isNaN(e)&&Number.isFinite(e)}function TA(e){return Ri(e.width)&&Ri(e.height)&&Ri(e.x)&&Ri(e.y)}function PA(e,n,o){const r={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:et(e.data)?e.data:{},events:t.markRaw(et(e.events)?e.events:{})};return Object.assign(n??r,e,{id:e.id.toString(),parentNode:o})}function Jf(e,n,o){var r,i;const a={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(r=e.sourceHandle)==null?void 0:r.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:et(e.data)?e.data:{},events:t.markRaw(et(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??a,e,{id:e.id.toString()})}function Qf(e,n,o,r){const i=typeof e=="string"?e:e.id,a=new Set,l=r==="source"?"target":"source";for(const s of o)s[l]===i&&a.add(s[r]);return n.filter(s=>a.has(s.id))}function OA(...e){if(e.length===3){const[a,l,s]=e;return Qf(a,l,s,"target")}const[n,o]=e,r=typeof n=="string"?n:n.id;return o.filter(a=>kn(a)&&a.source===r).map(a=>o.find(l=>Hn(l)&&l.id===a.target))}function $A(...e){if(e.length===3){const[a,l,s]=e;return Qf(a,l,s,"source")}const[n,o]=e,r=typeof n=="string"?n:n.id;return o.filter(a=>kn(a)&&a.target===r).map(a=>o.find(l=>Hn(l)&&l.id===a.source))}function ep({source:e,sourceHandle:n,target:o,targetHandle:r}){return`vueflow__edge-${e}${n??""}-${o}${r??""}`}function BA(e,n){return n.some(o=>kn(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function Hl({x:e,y:n},{x:o,y:r,zoom:i}){return{x:e*i+o,y:n*i+r}}function br({x:e,y:n},{x:o,y:r,zoom:i},a=!1,l=[1,1]){const s={x:(e-o)/i,y:(n-r)/i};return a?Mi(s,l):s}function VA(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function tp({x:e,y:n,width:o,height:r}){return{x:e,y:n,x2:e+o,y2:n+r}}function RA({x:e,y:n,x2:o,y2:r}){return{x:e,y:n,width:o-e,height:r-n}}function np(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const r=e[o];n=VA(n,tp({...r.computedPosition,...r.dimensions}))}return RA(n)}function op(e,n,o={x:0,y:0,zoom:1},r=!1,i=!1){const a={...br(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:f=!1}=s,u=c.width??s.width??null,p=c.height??s.height??null;if(i&&!d||f)continue;const m=Bi(a,$i(s)),y=u===null||p===null,_=r&&m>0,g=(u??0)*(p??0);(y||_||m>=g||s.dragging)&&l.push(s)}return l}function rp(e,n){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const r of e)o.add(r.id);return n.filter(r=>o.has(r.source)||o.has(r.target))}function ip(e,n,o,r,i,a=.1,l={x:0,y:0}){const s=n/(e.width*(1+a)),c=o/(e.height*(1+a)),d=Math.min(s,c),f=zn(d,r,i),u=e.x+e.width/2,p=e.y+e.height/2,m=n/2-u*f+(l.x??0),y=o/2-p*f+(l.y??0);return{x:m,y,zoom:f}}function DA(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function ap(e,n){if(!e.parentNode)return!1;const o=n(e.parentNode);return o?o.selected?!0:ap(o,n):!1}function wr(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`}function lp(e,n,o){return e<n?zn(Math.abs(e-n),1,n)/n:e>o?-zn(Math.abs(e-o),1,n)/n:0}function sp(e,n,o=15,r=40){const i=lp(e.x,r,n.width-r)*o,a=lp(e.y,r,n.height-r)*o;return[i,a]}function Yl(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,r=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||r>0||e.position.x<0||e.position.y<0){let i={};if(typeof n.style=="function"?i={...n.style(n)}:n.style&&(i={...n.style}),i.width=i.width??`${n.dimensions.width}px`,i.height=i.height??`${n.dimensions.height}px`,o>0)if(typeof i.width=="string"){const a=Number(i.width.replace("px",""));i.width=`${a+o}px`}else i.width+=o;if(r>0)if(typeof i.height=="string"){const a=Number(i.height.replace("px",""));i.height=`${a+r}px`}else i.height+=r;if(e.position.x<0){const a=Math.abs(e.position.x);if(n.position.x=n.position.x-a,typeof i.width=="string"){const l=Number(i.width.replace("px",""));i.width=`${l+a}px`}else i.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(n.position.y=n.position.y-a,typeof i.height=="string"){const l=Number(i.height.replace("px",""));i.height=`${l+a}px`}else i.height+=a;e.position.y=0}n.dimensions.width=Number(i.width.toString().replace("px","")),n.dimensions.height=Number(i.height.toString().replace("px","")),typeof n.style=="function"?n.style=a=>{const l=n.style;return{...l(a),...i}}:n.style={...n.style,...i}}}}function cp(e,n){var o,r;const i=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const a=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(_r(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[a.indexOf(l.parentNode)];c&&_r(c)&&Yl(l,c)}break;case"dimensions":if(_r(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(r=s.dimensions)==null?void 0:r.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[a.indexOf(l.parentNode)];c&&_r(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Yl(l,c):t.nextTick(()=>{Yl(l,c)}))}break}return n}function Cn(e,n){return{id:e,type:"select",selected:n}}function dp(e){return{item:e,type:"add"}}function up(e){return{id:e,type:"remove"}}function fp(e,n,o,r,i){return{id:e,source:n,target:o,sourceHandle:r||null,targetHandle:i||null,type:"remove"}}function En(e,n=new Set,o=!1){const r=[];for(const[i,a]of e){const l=n.has(i);!(a.selected===void 0&&!l)&&a.selected!==l&&(o&&(a.selected=l),r.push(Cn(a.id,l)))}return r}function Ce(e){const n=new Set;let o=!1;const r=()=>n.size>0;e&&(o=!0,n.add(e));const i=s=>{n.delete(s)};return{on:s=>{e&&o&&n.delete(e),n.add(s);const c=()=>{i(s),e&&o&&n.add(e)};return ui(c),{off:c}},off:i,trigger:s=>Promise.all(Array.from(n).map(c=>c(s))),hasListeners:r,fns:n}}function pp(e,n,o){let r=e;do{if(r&&r.matches(n))return!0;if(r===o)return!1;r=r.parentElement}while(r);return!1}function MA(e,n,o,r,i){var a,l;const s=[];for(const c of e)(c.selected||c.id===i)&&(!c.parentNode||!ap(c,r))&&(c.draggable||n&&typeof c.draggable>"u")&&s.push(t.markRaw({id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((l=c.computedPosition)==null?void 0:l.y)||0},from:c.computedPosition,extent:c.extent,parentNode:c.parentNode,dimensions:c.dimensions,expandParent:c.expandParent}));return s}function Wl({id:e,dragItems:n,findNode:o}){const r=[];for(const i of n){const a=o(i.id);a&&r.push(a)}return[e?r.find(i=>i.id===e):r[0],r]}function mp(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function LA(e,n,o){const[r,i,a,l]=typeof e!="string"?mp(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+r],[o.computedPosition.x+o.dimensions.width-i,o.computedPosition.y+o.dimensions.height-a]]:!1}function FA(e,n,o,r){let i=e.extent||o;if((i==="parent"||!Array.isArray(i)&&(i==null?void 0:i.range)==="parent")&&!e.expandParent)if(e.parentNode&&r&&e.dimensions.width&&e.dimensions.height){const a=LA(i,e,r);a&&(i=a)}else n(new lt(Qe.NODE_EXTENT_INVALID,e.id)),i=o;else if(Array.isArray(i)){const a=(r==null?void 0:r.computedPosition.x)||0,l=(r==null?void 0:r.computedPosition.y)||0;i=[[i[0][0]+a,i[0][1]+l],[i[1][0]+a,i[1][1]+l]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[a,l,s,c]=mp(i.padding),d=(r==null?void 0:r.computedPosition.x)||0,f=(r==null?void 0:r.computedPosition.y)||0;i=[[i.range[0][0]+d+c,i.range[0][1]+f+a],[i.range[1][0]+d-l,i.range[1][1]+f-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function UA({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Xl(e,n,o,r,i){const a=UA(e.dimensions,FA(e,o,r,i)),l=Xf(n,a);return{position:{x:l.x-((i==null?void 0:i.computedPosition.x)||0),y:l.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:l}}function To(e,n,o=Ee.Left,r=!1){const i=((n==null?void 0:n.x)??0)+e.computedPosition.x,a=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??qA(e);if(r)return{x:i+l/2,y:a+s/2};switch((n==null?void 0:n.position)??o){case Ee.Top:return{x:i+l/2,y:a};case Ee.Right:return{x:i+l,y:a+s/2};case Ee.Bottom:return{x:i+l/2,y:a+s};case Ee.Left:return{x:i,y:a+s/2}}}function gp(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function KA({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:r,targetWidth:i,targetHeight:a,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+i),y2:Math.max(e.y+r,n.y+a)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const f=tp({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),u=Math.max(0,Math.min(f.x2,d.x2)-Math.max(f.x,d.x)),p=Math.max(0,Math.min(f.y2,d.y2)-Math.max(f.y,d.y));return Math.ceil(u*p)>0}function jA(e,n,o=!1){const r=typeof e.zIndex=="number";let i=r?e.zIndex:0;const a=n(e.source),l=n(e.target);return!a||!l?0:(o&&(i=r?e.zIndex:Math.max(a.computedPosition.z||0,l.computedPosition.z||0)),i)}var Qe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Qe||{});const hp={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
124
|
+
`).map(l=>l.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===n.toLowerCase();r||o.add(e.toLowerCase());const a=i.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===i[s]);return r&&o.delete(e.toLowerCase()),a}function wA(e,n){return o=>{if(!o.code&&!o.key)return!1;const r=kA(o.code,e);return Array.isArray(e)?e.some(i=>Gf(o[r],i,n,o.type==="keyup")):Gf(o[r],e,n,o.type==="keyup")}}function kA(e,n){return n.includes(e)?"code":"key"}function hr(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??_A),r=t.shallowRef(t.toValue(e)===!0);let i=!1;const a=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,f)=>{typeof f=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),Xu(["blur","contextmenu"],s),Zu((...d)=>l(...d),d=>{var f,u;const p=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,m=t.toValue(n==null?void 0:n.preventDefault)??!1;if(i=bA(d),(!i||i&&!p)&&zl(d))return;const _=((u=(f=d.composedPath)==null?void 0:f.call(d))==null?void 0:u[0])||d.target,g=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";!m&&(i||!g)&&d.preventDefault(),r.value=!0},{eventName:"keydown",target:o}),Zu((...d)=>l(...d),d=>{const f=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!f)&&zl(d))return;i=!1,r.value=!1}},{eventName:"keyup",target:o});function s(){i=!1,a.clear(),r.value=t.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),r.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?wA(d,a):d}return r}const qf="vue-flow__node-desc",zf="vue-flow__edge-desc",CA="vue-flow__aria-live",Hf=["Enter"," ","Escape"],Ao={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Pi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Oi(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*r)}function $i(e){return{width:e.offsetWidth,height:e.offsetHeight}}function zn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function Yf(e,n){return{x:zn(e.x,n[0][0],n[1][0]),y:zn(e.y,n[0][1],n[1][1])}}function Wf(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function kn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Hn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!kn(e)}function yr(e){return Hn(e)&&"computedPosition"in e}function Bi(e){return!Number.isNaN(e)&&Number.isFinite(e)}function EA(e){return Bi(e.width)&&Bi(e.height)&&Bi(e.x)&&Bi(e.y)}function NA(e,n,o){const r={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:et(e.data)?e.data:{},events:t.markRaw(et(e.events)?e.events:{})};return Object.assign(n??r,e,{id:e.id.toString(),parentNode:o})}function Xf(e,n,o){var r,i;const a={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(r=e.sourceHandle)==null?void 0:r.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:et(e.data)?e.data:{},events:t.markRaw(et(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??a,e,{id:e.id.toString()})}function Zf(e,n,o,r){const i=typeof e=="string"?e:e.id,a=new Set,l=r==="source"?"target":"source";for(const s of o)s[l]===i&&a.add(s[r]);return n.filter(s=>a.has(s.id))}function SA(...e){if(e.length===3){const[a,l,s]=e;return Zf(a,l,s,"target")}const[n,o]=e,r=typeof n=="string"?n:n.id;return o.filter(a=>kn(a)&&a.source===r).map(a=>o.find(l=>Hn(l)&&l.id===a.target))}function xA(...e){if(e.length===3){const[a,l,s]=e;return Zf(a,l,s,"source")}const[n,o]=e,r=typeof n=="string"?n:n.id;return o.filter(a=>kn(a)&&a.target===r).map(a=>o.find(l=>Hn(l)&&l.id===a.source))}function Jf({source:e,sourceHandle:n,target:o,targetHandle:r}){return`vueflow__edge-${e}${n??""}-${o}${r??""}`}function vA(e,n){return n.some(o=>kn(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function Hl({x:e,y:n},{x:o,y:r,zoom:i}){return{x:e*i+o,y:n*i+r}}function _r({x:e,y:n},{x:o,y:r,zoom:i},a=!1,l=[1,1]){const s={x:(e-o)/i,y:(n-r)/i};return a?Ri(s,l):s}function AA(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function Qf({x:e,y:n,width:o,height:r}){return{x:e,y:n,x2:e+o,y2:n+r}}function IA({x:e,y:n,x2:o,y2:r}){return{x:e,y:n,width:o-e,height:r-n}}function ep(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const r=e[o];n=AA(n,Qf({...r.computedPosition,...r.dimensions}))}return IA(n)}function tp(e,n,o={x:0,y:0,zoom:1},r=!1,i=!1){const a={..._r(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:f=!1}=s,u=c.width??s.width??null,p=c.height??s.height??null;if(i&&!d||f)continue;const m=Oi(a,Pi(s)),y=u===null||p===null,_=r&&m>0,g=(u??0)*(p??0);(y||_||m>=g||s.dragging)&&l.push(s)}return l}function np(e,n){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const r of e)o.add(r.id);return n.filter(r=>o.has(r.source)||o.has(r.target))}function op(e,n,o,r,i,a=.1,l={x:0,y:0}){const s=n/(e.width*(1+a)),c=o/(e.height*(1+a)),d=Math.min(s,c),f=zn(d,r,i),u=e.x+e.width/2,p=e.y+e.height/2,m=n/2-u*f+(l.x??0),y=o/2-p*f+(l.y??0);return{x:m,y,zoom:f}}function TA(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function rp(e,n){if(!e.parentNode)return!1;const o=n(e.parentNode);return o?o.selected?!0:rp(o,n):!1}function br(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`}function ip(e,n,o){return e<n?zn(Math.abs(e-n),1,n)/n:e>o?-zn(Math.abs(e-o),1,n)/n:0}function ap(e,n,o=15,r=40){const i=ip(e.x,r,n.width-r)*o,a=ip(e.y,r,n.height-r)*o;return[i,a]}function Yl(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,r=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||r>0||e.position.x<0||e.position.y<0){let i={};if(typeof n.style=="function"?i={...n.style(n)}:n.style&&(i={...n.style}),i.width=i.width??`${n.dimensions.width}px`,i.height=i.height??`${n.dimensions.height}px`,o>0)if(typeof i.width=="string"){const a=Number(i.width.replace("px",""));i.width=`${a+o}px`}else i.width+=o;if(r>0)if(typeof i.height=="string"){const a=Number(i.height.replace("px",""));i.height=`${a+r}px`}else i.height+=r;if(e.position.x<0){const a=Math.abs(e.position.x);if(n.position.x=n.position.x-a,typeof i.width=="string"){const l=Number(i.width.replace("px",""));i.width=`${l+a}px`}else i.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(n.position.y=n.position.y-a,typeof i.height=="string"){const l=Number(i.height.replace("px",""));i.height=`${l+a}px`}else i.height+=a;e.position.y=0}n.dimensions.width=Number(i.width.toString().replace("px","")),n.dimensions.height=Number(i.height.toString().replace("px","")),typeof n.style=="function"?n.style=a=>{const l=n.style;return{...l(a),...i}}:n.style={...n.style,...i}}}}function lp(e,n){var o,r;const i=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const a=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(yr(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[a.indexOf(l.parentNode)];c&&yr(c)&&Yl(l,c)}break;case"dimensions":if(yr(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(r=s.dimensions)==null?void 0:r.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[a.indexOf(l.parentNode)];c&&yr(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Yl(l,c):t.nextTick(()=>{Yl(l,c)}))}break}return n}function Cn(e,n){return{id:e,type:"select",selected:n}}function sp(e){return{item:e,type:"add"}}function cp(e){return{id:e,type:"remove"}}function dp(e,n,o,r,i){return{id:e,source:n,target:o,sourceHandle:r||null,targetHandle:i||null,type:"remove"}}function En(e,n=new Set,o=!1){const r=[];for(const[i,a]of e){const l=n.has(i);!(a.selected===void 0&&!l)&&a.selected!==l&&(o&&(a.selected=l),r.push(Cn(a.id,l)))}return r}function Ce(e){const n=new Set;let o=!1;const r=()=>n.size>0;e&&(o=!0,n.add(e));const i=s=>{n.delete(s)};return{on:s=>{e&&o&&n.delete(e),n.add(s);const c=()=>{i(s),e&&o&&n.add(e)};return ci(c),{off:c}},off:i,trigger:s=>Promise.all(Array.from(n).map(c=>c(s))),hasListeners:r,fns:n}}function up(e,n,o){let r=e;do{if(r&&r.matches(n))return!0;if(r===o)return!1;r=r.parentElement}while(r);return!1}function PA(e,n,o,r,i){var a,l;const s=[];for(const c of e)(c.selected||c.id===i)&&(!c.parentNode||!rp(c,r))&&(c.draggable||n&&typeof c.draggable>"u")&&s.push(t.markRaw({id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((l=c.computedPosition)==null?void 0:l.y)||0},from:c.computedPosition,extent:c.extent,parentNode:c.parentNode,dimensions:c.dimensions,expandParent:c.expandParent}));return s}function Wl({id:e,dragItems:n,findNode:o}){const r=[];for(const i of n){const a=o(i.id);a&&r.push(a)}return[e?r.find(i=>i.id===e):r[0],r]}function fp(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function OA(e,n,o){const[r,i,a,l]=typeof e!="string"?fp(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+r],[o.computedPosition.x+o.dimensions.width-i,o.computedPosition.y+o.dimensions.height-a]]:!1}function $A(e,n,o,r){let i=e.extent||o;if((i==="parent"||!Array.isArray(i)&&(i==null?void 0:i.range)==="parent")&&!e.expandParent)if(e.parentNode&&r&&e.dimensions.width&&e.dimensions.height){const a=OA(i,e,r);a&&(i=a)}else n(new lt(Qe.NODE_EXTENT_INVALID,e.id)),i=o;else if(Array.isArray(i)){const a=(r==null?void 0:r.computedPosition.x)||0,l=(r==null?void 0:r.computedPosition.y)||0;i=[[i[0][0]+a,i[0][1]+l],[i[1][0]+a,i[1][1]+l]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[a,l,s,c]=fp(i.padding),d=(r==null?void 0:r.computedPosition.x)||0,f=(r==null?void 0:r.computedPosition.y)||0;i=[[i.range[0][0]+d+c,i.range[0][1]+f+a],[i.range[1][0]+d-l,i.range[1][1]+f-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function BA({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Xl(e,n,o,r,i){const a=BA(e.dimensions,$A(e,o,r,i)),l=Yf(n,a);return{position:{x:l.x-((i==null?void 0:i.computedPosition.x)||0),y:l.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:l}}function Io(e,n,o=Ee.Left,r=!1){const i=((n==null?void 0:n.x)??0)+e.computedPosition.x,a=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??MA(e);if(r)return{x:i+l/2,y:a+s/2};switch((n==null?void 0:n.position)??o){case Ee.Top:return{x:i+l/2,y:a};case Ee.Right:return{x:i+l,y:a+s/2};case Ee.Bottom:return{x:i+l/2,y:a+s};case Ee.Left:return{x:i,y:a+s/2}}}function pp(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function VA({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:r,targetWidth:i,targetHeight:a,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+i),y2:Math.max(e.y+r,n.y+a)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const f=Qf({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),u=Math.max(0,Math.min(f.x2,d.x2)-Math.max(f.x,d.x)),p=Math.max(0,Math.min(f.y2,d.y2)-Math.max(f.y,d.y));return Math.ceil(u*p)>0}function RA(e,n,o=!1){const r=typeof e.zIndex=="number";let i=r?e.zIndex:0;const a=n(e.source),l=n(e.target);return!a||!l?0:(o&&(i=r?e.zIndex:Math.max(a.computedPosition.z||0,l.computedPosition.z||0)),i)}var Qe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Qe||{});const mp={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
125
125
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
126
126
|
Node: ${e}`,NODE_MISSING_PARENT:(e,n)=>`Node is missing a parent
|
|
127
127
|
Node: ${e}
|
|
@@ -141,4 +141,4 @@ Edge: ${e}
|
|
|
141
141
|
Source: ${n}
|
|
142
142
|
Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
143
143
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
144
|
-
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class lt extends Error{constructor(n,...o){var r;super((r=hp[n])==null?void 0:r.call(hp,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Zl(e){return"clientX"in e}function GA(e){return"sourceEvent"in e}function Zt(e,n){const o=Zl(e);let r,i;return o?(r=e.clientX,i=e.clientY):"touches"in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-((n==null?void 0:n.left)??0),y:i-((n==null?void 0:n.top)??0)}}const Di=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function qA(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function Mi(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const zA=()=>!0;function Jl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function HA(e,n,o){const r=[],i={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const a of n.values())Bi(i,$i(a))>0&&r.push(a);return r}const YA=250;function WA(e,n,o,r){var i,a;let l=[],s=Number.POSITIVE_INFINITY;const c=HA(e,o,n+YA);for(const d of c){const f=[...((i=d.handleBounds)==null?void 0:i.source)??[],...((a=d.handleBounds)==null?void 0:a.target)??[]];for(const u of f){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:p,y:m}=To(d,u,u.position,!0),y=Math.sqrt((p-e.x)**2+(m-e.y)**2);y>n||(y<s?(l=[{...u,x:p,y:m}],s=y):y===s&&l.push({...u,x:p,y:m}))}}if(!l.length)return null;if(l.length>1){const d=r.type==="source"?"target":"source";return l.find(f=>f.type===d)??l[0]}return l[0]}function yp(e,{handle:n,connectionMode:o,fromNodeId:r,fromHandleId:i,fromType:a,doc:l,lib:s,flowId:c,isValidConnection:d=zA},f,u,p){const m=a==="target",y=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:_,y:g}=Zt(e),h=l.elementFromPoint(_,g),w=h!=null&&h.classList.contains(`${s}-flow__handle`)?h:y,b={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const x=_p(void 0,w),E=w.getAttribute("data-nodeid"),C=w.getAttribute("data-handleid"),N=w.classList.contains("connectable"),S=w.classList.contains("connectableend");if(!E||!x)return b;const v={source:m?E:r,sourceHandle:m?C:i,target:m?r:E,targetHandle:m?i:C};b.connection=v;const L=N&&S&&(o===wn.Strict?m&&x==="source"||!m&&x==="target":E!==r||C!==i);b.isValid=L&&d(v,{nodes:u,edges:f,sourceNode:p(r),targetNode:p(E)}),b.toHandle=n}return b}function _p(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function XA(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function ZA(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function JA(e,n,o,r,i,a=!1){var l,s,c;const d=r.get(e);if(!d)return null;const f=i===wn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],u=(o?f==null?void 0:f.find(p=>p.id===o):f==null?void 0:f[0])??null;return u&&a?{...u,...To(d,u,u.position,!0)}:u}const Ql={[Ee.Left]:Ee.Right,[Ee.Right]:Ee.Left,[Ee.Top]:Ee.Bottom,[Ee.Bottom]:Ee.Top},QA=["production","prod"];function Li(e,...n){bp()&&console.warn(`[Vue Flow]: ${e}`,...n)}function bp(){return!QA.includes(process.env.NODE_ENV||"")}function wp(e,n,o,r,i){const a=n.querySelectorAll(`.vue-flow__handle.${e}`);return a!=null&&a.length?Array.from(a).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:i,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/r,y:(s.top-o.top)/r,...Vi(l)}}):null}function es(e,n,o,r,i,a=!1,l){i.value=!1,e.selected?(a||e.selected&&n)&&(r([e]),t.nextTick(()=>{l.blur()})):o([e])}function et(e){return typeof t.unref(e)<"u"}function eI(e,n,o,r){if(!e||!e.source||!e.target)return o(new lt(Qe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return kn(e)?i=e:i={...e,id:ep(e)},i=Jf(i,void 0,r),BA(i,n)?!1:i}function tI(e,n,o,r,i){if(!n.source||!n.target)return i(new lt(Qe.EDGE_INVALID,e.id)),!1;if(!o)return i(new lt(Qe.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...l}=e;return{...l,id:r?ep(n):a,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function kp(e,n,o){const r={},i=[];for(let a=0;a<e.length;++a){const l=e[a];if(!Hn(l)){o(new lt(Qe.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${a}]`);continue}const s=PA(l,n(l.id),l.parentNode);l.parentNode&&(r[l.parentNode]=!0),i[a]=s}for(const a of i){const l=n(a.parentNode)||i.find(s=>s.id===a.parentNode);a.parentNode&&!l&&o(new lt(Qe.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||r[a.id])&&(r[a.id]&&(a.isParent=!0),l&&(l.isParent=!0))}return i}function Cp(e,n,o,r,i,a){let l=i;const s=r.get(l)||new Map;r.set(l,s.set(o,n)),l=`${i}-${e}`;const c=r.get(l)||new Map;if(r.set(l,c.set(o,n)),a){l=`${i}-${e}-${a}`;const d=r.get(l)||new Map;r.set(l,d.set(o,n))}}function ts(e,n,o){e.clear();for(const r of o){const{source:i,target:a,sourceHandle:l=null,targetHandle:s=null}=r,c={edgeId:r.id,source:i,target:a,sourceHandle:l,targetHandle:s},d=`${i}-${l}--${a}-${s}`,f=`${a}-${s}--${i}-${l}`;Cp("source",c,f,e,i,l),Cp("target",c,d,e,a,s)}}function Ep(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function ns(e,n,o,r,i,a,l,s){const c=[];for(const d of e){const f=kn(d)?d:eI(d,s,i,a);if(!f)continue;const u=o(f.source),p=o(f.target);if(!u||!p){i(new lt(Qe.EDGE_SOURCE_TARGET_MISSING,f.id,f.source,f.target));continue}if(!u){i(new lt(Qe.EDGE_SOURCE_MISSING,f.id,f.source));continue}if(!p){i(new lt(Qe.EDGE_TARGET_MISSING,f.id,f.target));continue}if(n&&!n(f,{edges:s,nodes:l,sourceNode:u,targetNode:p})){i(new lt(Qe.EDGE_INVALID,f.id));continue}const m=r(f.id);c.push({...Jf(f,m,a),sourceNode:u,targetNode:p})}return c}const Np=Symbol("vueFlow"),Sp=Symbol("nodeId"),xp=Symbol("nodeRef"),nI=Symbol("edgeId"),oI=Symbol("edgeRef"),Fi=Symbol("slots");function vp(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:r,noDragClassName:i,nodes:a,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:f,nodesDraggable:u,panBy:p,findNode:m,multiSelectionActive:y,nodesSelectionActive:_,selectNodesOnDrag:g,removeSelectedElements:h,addSelectedNodes:w,updateNodePositions:b,emits:x}=Le(),{onStart:E,onDrag:C,onStop:N,onClick:S,el:v,disabled:D,id:L,selectable:k,dragHandle:J}=e,I=t.shallowRef(!1);let G=[],j,te=null,K={x:void 0,y:void 0},O={x:0,y:0},P=null,T=!1,M=0,Y=!1;const z=aI(),H=({x:le,y:ue})=>{K={x:le,y:ue};let fe=!1;if(G=G.map(B=>{const V={x:le-B.distance.x,y:ue-B.distance.y},{computedPosition:F}=Xl(B,o.value?Mi(V,r.value):V,x.error,l.value,B.parentNode?m(B.parentNode):void 0);return fe=fe||B.position.x!==F.x||B.position.y!==F.y,B.position=F,B}),!!fe&&(b(G,!0,!0),I.value=!0,P)){const[B,V]=Wl({id:L,dragItems:G,findNode:m});C({event:P,node:B,nodes:V})}},Z=()=>{if(!te)return;const[le,ue]=sp(O,te,f.value);if(le!==0||ue!==0){const fe={x:(K.x??0)-le/c.value.zoom,y:(K.y??0)-ue/c.value.zoom};p({x:le,y:ue})&&H(fe)}M=requestAnimationFrame(Z)},ie=(le,ue)=>{T=!0;const fe=m(L);!g.value&&!y.value&&fe&&(fe.selected||h()),fe&&t.toValue(k)&&g.value&&es(fe,y.value,w,h,_,!1,ue);const B=z(le.sourceEvent);if(K=B,G=MA(a.value,u.value,B,m,L),G.length){const[V,F]=Wl({id:L,dragItems:G,findNode:m});E({event:le.sourceEvent,node:V,nodes:F})}},be=(le,ue)=>{var fe;le.sourceEvent.type==="touchmove"&&le.sourceEvent.touches.length>1||(s.value===0&&ie(le,ue),K=z(le.sourceEvent),te=((fe=n.value)==null?void 0:fe.getBoundingClientRect())||null,O=Zt(le.sourceEvent,te))},ee=(le,ue)=>{const fe=z(le.sourceEvent);if(!Y&&T&&d.value&&(Y=!0,Z()),!T){const B=fe.xSnapped-(K.x??0),V=fe.ySnapped-(K.y??0);Math.sqrt(B*B+V*V)>s.value&&ie(le,ue)}(K.x!==fe.xSnapped||K.y!==fe.ySnapped)&&G.length&&T&&(P=le.sourceEvent,O=Zt(le.sourceEvent,te),H(fe))},re=le=>{let ue=!1;if(!T&&!I.value&&!y.value){const fe=le.sourceEvent,B=z(fe),V=B.xSnapped-(K.x??0),F=B.ySnapped-(K.y??0),R=Math.sqrt(V*V+F*F);R!==0&&R<=s.value&&(S==null||S(fe),ue=!0)}if(G.length&&!ue){b(G,!1,!1);const[fe,B]=Wl({id:L,dragItems:G,findNode:m});N({event:le.sourceEvent,node:fe,nodes:B})}G=[],I.value=!1,Y=!1,T=!1,K={x:void 0,y:void 0},cancelAnimationFrame(M)};return t.watch([()=>t.toValue(D),v],([le,ue],fe,B)=>{if(ue){const V=Ft(ue);le||(j=Tx().on("start",F=>be(F,ue)).on("drag",F=>ee(F,ue)).on("end",F=>re(F)).filter(F=>{const R=F.target,Q=t.toValue(J);return!F.button&&(!i.value||!pp(R,`.${i.value}`,ue)&&(!Q||pp(R,Q,ue)))}),V.call(j)),B(()=>{V.on(".drag",null),j&&(j.on("start",null),j.on("drag",null),j.on("end",null))})}}),I}function rI(){return{doubleClick:Ce(),click:Ce(),mouseEnter:Ce(),mouseMove:Ce(),mouseLeave:Ce(),contextMenu:Ce(),updateStart:Ce(),update:Ce(),updateEnd:Ce()}}function iI(e,n){const o=rI();return o.doubleClick.on(r=>{var i,a;n.edgeDoubleClick(r),(a=(i=e.events)==null?void 0:i.doubleClick)==null||a.call(i,r)}),o.click.on(r=>{var i,a;n.edgeClick(r),(a=(i=e.events)==null?void 0:i.click)==null||a.call(i,r)}),o.mouseEnter.on(r=>{var i,a;n.edgeMouseEnter(r),(a=(i=e.events)==null?void 0:i.mouseEnter)==null||a.call(i,r)}),o.mouseMove.on(r=>{var i,a;n.edgeMouseMove(r),(a=(i=e.events)==null?void 0:i.mouseMove)==null||a.call(i,r)}),o.mouseLeave.on(r=>{var i,a;n.edgeMouseLeave(r),(a=(i=e.events)==null?void 0:i.mouseLeave)==null||a.call(i,r)}),o.contextMenu.on(r=>{var i,a;n.edgeContextMenu(r),(a=(i=e.events)==null?void 0:i.contextMenu)==null||a.call(i,r)}),o.updateStart.on(r=>{var i,a;n.edgeUpdateStart(r),(a=(i=e.events)==null?void 0:i.updateStart)==null||a.call(i,r)}),o.update.on(r=>{var i,a;n.edgeUpdate(r),(a=(i=e.events)==null?void 0:i.update)==null||a.call(i,r)}),o.updateEnd.on(r=>{var i,a;n.edgeUpdateEnd(r),(a=(i=e.events)==null?void 0:i.updateEnd)==null||a.call(i,r)}),Object.entries(o).reduce((r,[i,a])=>(r.emit[i]=a.trigger,r.on[i]=a.on,r),{emit:{},on:{}})}function aI(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:r}=Le();return i=>{var a;const l=((a=r.value)==null?void 0:a.getBoundingClientRect())??{left:0,top:0},s=GA(i)?i.sourceEvent:i,{x:c,y:d}=Zt(s,l),f=br({x:c,y:d},e.value),{x:u,y:p}=o.value?Mi(f,n.value):f;return{xSnapped:u,ySnapped:p,...f}}}function Ui(){return!0}function Ap({handleId:e,nodeId:n,type:o,isValidConnection:r,edgeUpdaterType:i,onEdgeUpdate:a,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:f,connectOnClick:u,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:y,autoPanSpeed:_,findNode:g,panBy:h,startConnection:w,updateConnection:b,endConnection:x,emits:E,viewport:C,edges:N,nodes:S,isValidConnection:v,nodeLookup:D}=Le();let L=null,k=!1,J=null;function I(j){var te;const K=t.toValue(o)==="target",O=Zl(j),P=Zf(j.target);if(O&&j.button===0||!O){let T=function(U){B=Zt(U,le),H=WA(br(B,C.value,!1,[1,1]),f.value,D.value,R),V||(F(),V=!0);const $=yp(U,{handle:H,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:K?"target":"source",isValidConnection:z,doc:P,lib:"vue",flowId:s,nodeLookup:D.value},N.value,S.value,g);J=$.handleDomNode,L=$.connection,k=ZA(!!H,$.isValid);const oe={...A,isValid:k,to:$.toHandle&&k?Hl({x:$.toHandle.x,y:$.toHandle.y},C.value):B,toHandle:$.toHandle,toPosition:k&&$.toHandle?$.toHandle.position:Ql[R.position],toNode:$.toHandle?D.value.get($.toHandle.nodeId):null};if(!(k&&H&&(A!=null&&A.toHandle)&&oe.toHandle&&A.toHandle.type===oe.toHandle.type&&A.toHandle.nodeId===oe.toHandle.nodeId&&A.toHandle.id===oe.toHandle.id&&A.to.x===oe.to.x&&A.to.y===oe.to.y)){if(b(H&&k?Hl({x:H.x,y:H.y},C.value):B,$.toHandle,XA(!!H,k)),A=oe,!H&&!k&&!J)return Jl(fe);L&&L.source!==L.target&&J&&(Jl(fe),fe=J,J.classList.add("connecting","vue-flow__handle-connecting"),J.classList.toggle("valid",!!k),J.classList.toggle("vue-flow__handle-valid",!!k))}},M=function(U){(H||J)&&L&&k&&(a?a(U,L):E.connect(L)),E.connectEnd(U),i&&(l==null||l(U)),Jl(fe),cancelAnimationFrame(Z),x(U),V=!1,k=!1,L=null,J=null,P.removeEventListener("mousemove",T),P.removeEventListener("mouseup",M),P.removeEventListener("touchmove",T),P.removeEventListener("touchend",M)};const Y=g(t.toValue(n));let z=t.toValue(r)||v.value||Ui;!z&&Y&&(z=(K?Y.isValidSourcePos:Y.isValidTargetPos)||Ui);let H,Z=0;const{x:ie,y:be}=Zt(j),ee=P==null?void 0:P.elementFromPoint(ie,be),re=_p(t.toValue(i),ee),le=(te=c.value)==null?void 0:te.getBoundingClientRect();if(!le||!re)return;const ue=JA(t.toValue(n),re,t.toValue(e),D.value,d.value);if(!ue)return;let fe,B=Zt(j,le),V=!1;const F=()=>{if(!y.value)return;const[U,$]=sp(B,le,_.value);h({x:U,y:$}),Z=requestAnimationFrame(F)},R={...ue,nodeId:t.toValue(n),type:re,position:ue.position},Q=D.value.get(t.toValue(n)),ae={inProgress:!0,isValid:null,from:To(Q,R,Ee.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:Q,to:B,toHandle:null,toPosition:Ql[R.position],toNode:null};w({nodeId:t.toValue(n),id:t.toValue(e),type:re,position:(ee==null?void 0:ee.getAttribute("data-handlepos"))||Ee.Top,...B},{x:ie-le.left,y:be-le.top}),E.connectStart({event:j,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:re});let A=ae;P.addEventListener("mousemove",T),P.addEventListener("mouseup",M),P.addEventListener("touchmove",T),P.addEventListener("touchend",M)}}function G(j){var te,K;if(!u.value)return;const O=t.toValue(o)==="target";if(!p.value){E.clickConnectStart({event:j,nodeId:t.toValue(n),handleId:t.toValue(e)}),w({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Ee.Top,...Zt(j)},void 0,!0);return}let P=t.toValue(r)||v.value||Ui;const T=g(t.toValue(n));if(!P&&T&&(P=(O?T.isValidSourcePos:T.isValidTargetPos)||Ui),T&&(typeof T.connectable>"u"?m.value:T.connectable)===!1)return;const M=Zf(j.target),Y=yp(j,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Ee.Top,...Zt(j)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:P,doc:M,lib:"vue",flowId:s,nodeLookup:D.value},N.value,S.value,g),z=((te=Y.connection)==null?void 0:te.source)===((K=Y.connection)==null?void 0:K.target);Y.isValid&&Y.connection&&!z&&E.connect(Y.connection),E.clickConnectEnd(j),x(j,!0)}return{handlePointerDown:I,handleClick:G}}function lI(){return t.inject(Sp,"")}function Ip(e){const n=e??lI()??"",o=t.inject(xp,t.ref(null)),{findNode:r,edges:i,emits:a}=Le(),l=r(n);return l||a.error(new lt(Qe.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>r(l.parentNode)),connectedEdges:t.computed(()=>rp([l],i.value))}}function sI(){return{doubleClick:Ce(),click:Ce(),mouseEnter:Ce(),mouseMove:Ce(),mouseLeave:Ce(),contextMenu:Ce(),dragStart:Ce(),drag:Ce(),dragStop:Ce()}}function cI(e,n){const o=sI();return o.doubleClick.on(r=>{var i,a;n.nodeDoubleClick(r),(a=(i=e.events)==null?void 0:i.doubleClick)==null||a.call(i,r)}),o.click.on(r=>{var i,a;n.nodeClick(r),(a=(i=e.events)==null?void 0:i.click)==null||a.call(i,r)}),o.mouseEnter.on(r=>{var i,a;n.nodeMouseEnter(r),(a=(i=e.events)==null?void 0:i.mouseEnter)==null||a.call(i,r)}),o.mouseMove.on(r=>{var i,a;n.nodeMouseMove(r),(a=(i=e.events)==null?void 0:i.mouseMove)==null||a.call(i,r)}),o.mouseLeave.on(r=>{var i,a;n.nodeMouseLeave(r),(a=(i=e.events)==null?void 0:i.mouseLeave)==null||a.call(i,r)}),o.contextMenu.on(r=>{var i,a;n.nodeContextMenu(r),(a=(i=e.events)==null?void 0:i.contextMenu)==null||a.call(i,r)}),o.dragStart.on(r=>{var i,a;n.nodeDragStart(r),(a=(i=e.events)==null?void 0:i.dragStart)==null||a.call(i,r)}),o.drag.on(r=>{var i,a;n.nodeDrag(r),(a=(i=e.events)==null?void 0:i.drag)==null||a.call(i,r)}),o.dragStop.on(r=>{var i,a;n.nodeDragStop(r),(a=(i=e.events)==null?void 0:i.dragStop)==null||a.call(i,r)}),Object.entries(o).reduce((r,[i,a])=>(r.emit[i]=a.trigger,r.on[i]=a.on,r),{emit:{},on:{}})}function Tp(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:r,snapGrid:i,snapToGrid:a,nodesDraggable:l,emits:s}=Le();return(c,d=!1)=>{const f=a.value?i.value[0]:5,u=a.value?i.value[1]:5,p=d?4:1,m=c.x*f*p,y=c.y*u*p,_=[];for(const g of e.value)if(g.draggable||l&&typeof g.draggable>"u"){const h={x:g.computedPosition.x+m,y:g.computedPosition.y+y},{computedPosition:w}=Xl(g,h,s.error,n.value,g.parentNode?r(g.parentNode):void 0);_.push({id:g.id,position:w,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(_,!0,!1)}}const os=.1,dI=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Nn(){return Li("Viewport not initialized yet."),Promise.resolve(!1)}const uI={zoomIn:Nn,zoomOut:Nn,zoomTo:Nn,fitView:Nn,setCenter:Nn,fitBounds:Nn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Nn,setTransform:Nn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function fI(e){function n(r,i){return new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((i==null?void 0:i.interpolate)==="linear"?cr:Ei).scaleBy(rs(e.d3Selection,i==null?void 0:i.duration,i==null?void 0:i.ease,()=>{a(!0)}),r):a(!1)})}function o(r,i,a,l){return new Promise(s=>{var c;const{x:d,y:f}=Xf({x:-r,y:-i},e.translateExtent),u=Ao.translate(-d,-f).scale(a);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?cr:Ei).transform(rs(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),u):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>n(1.2,i),zoomOut:i=>n(1/1.2,i),zoomTo:(i,a)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?cr:Ei).scaleTo(rs(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{l(!0)}),i):l(!1)}),setViewport:(i,a)=>o(i.x,i.y,i.zoom,a),setTransform:(i,a)=>o(i.x,i.y,i.zoom,a),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:os,includeHiddenNodes:!1,duration:0})=>{var a,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!p.hidden)&&(!((a=i.nodes)!=null&&a.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=np(s),{x:d,y:f,zoom:u}=ip(c,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??os,i.offset);return o(d,f,u,i)},setCenter:(i,a,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-i*s,d=e.dimensions.height/2-a*s;return o(c,d,s,l)},fitBounds:(i,a={padding:os})=>{const{x:l,y:s,zoom:c}=ip(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,a.padding);return o(l,s,c,a)},project:i=>br(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:a,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-a,y:i.y-l};return br(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:a,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+a,y:i.y+l};return Hl(s,e.viewport)}return{x:0,y:0}}}:uI)}function rs(e,n=0,o=dI,r=()=>{}){const i=typeof n=="number"&&n>0;return i||r(),i?e.transition().duration(n).ease(o).on("end",r):e}function pI(e,n,o){const r=t.effectScope(!0);return r.run(()=>{const i=()=>{r.run(()=>{let _,g,h=!!(o.nodes.value.length||o.edges.value.length);_=Eo([e.modelValue,()=>{var w,b;return(b=(w=e.modelValue)==null?void 0:w.value)==null?void 0:b.length}],([w])=>{w&&Array.isArray(w)&&(g==null||g.pause(),o.setElements(w),!g&&!h&&w.length?h=!0:g==null||g.resume())}),g=Eo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([w,b])=>{var x;(x=e.modelValue)!=null&&x.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...w,...b],t.nextTick(()=>{_==null||_.resume()}))},{immediate:h}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},a=()=>{r.run(()=>{let _,g,h=!!o.nodes.value.length;_=Eo([e.nodes,()=>{var w,b;return(b=(w=e.nodes)==null?void 0:w.value)==null?void 0:b.length}],([w])=>{w&&Array.isArray(w)&&(g==null||g.pause(),o.setNodes(w),!g&&!h&&w.length?h=!0:g==null||g.resume())}),g=Eo([o.nodes,()=>o.nodes.value.length],([w])=>{var b;(b=e.nodes)!=null&&b.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...w],t.nextTick(()=>{_==null||_.resume()}))},{immediate:h}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},l=()=>{r.run(()=>{let _,g,h=!!o.edges.value.length;_=Eo([e.edges,()=>{var w,b;return(b=(w=e.edges)==null?void 0:w.value)==null?void 0:b.length}],([w])=>{w&&Array.isArray(w)&&(g==null||g.pause(),o.setEdges(w),!g&&!h&&w.length?h=!0:g==null||g.resume())}),g=Eo([o.edges,()=>o.edges.value.length],([w])=>{var b;(b=e.edges)!=null&&b.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...w],t.nextTick(()=>{_==null||_.resume()}))},{immediate:h}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},s=()=>{r.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&et(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{r.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&et(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{r.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&et(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},f=()=>{r.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&et(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},u=()=>{r.run(()=>{t.watch(()=>n.applyDefault,()=>{et(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{r.run(()=>{const _=async g=>{let h=g;typeof n.autoConnect=="function"&&(h=await n.autoConnect(g)),h!==!1&&o.addEdges([h])};t.watch(()=>n.autoConnect,()=>{et(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(g,h,w)=>{g?o.onConnect(_):o.hooks.value.connect.off(_),w(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},m=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(n)){const h=g;if(!_.includes(h)){const w=t.toRef(()=>n[h]),b=o[h];t.isRef(b)&&r.run(()=>{t.watch(w,x=>{et(x)&&(b.value=x)},{immediate:!0})})}}};(()=>{i(),a(),l(),c(),s(),d(),f(),u(),p(),m()})()}),()=>r.stop()}function mI(){return{edgesChange:Ce(),nodesChange:Ce(),nodeDoubleClick:Ce(),nodeClick:Ce(),nodeMouseEnter:Ce(),nodeMouseMove:Ce(),nodeMouseLeave:Ce(),nodeContextMenu:Ce(),nodeDragStart:Ce(),nodeDrag:Ce(),nodeDragStop:Ce(),nodesInitialized:Ce(),miniMapNodeClick:Ce(),miniMapNodeDoubleClick:Ce(),miniMapNodeMouseEnter:Ce(),miniMapNodeMouseMove:Ce(),miniMapNodeMouseLeave:Ce(),connect:Ce(),connectStart:Ce(),connectEnd:Ce(),clickConnectStart:Ce(),clickConnectEnd:Ce(),paneReady:Ce(),init:Ce(),move:Ce(),moveStart:Ce(),moveEnd:Ce(),selectionDragStart:Ce(),selectionDrag:Ce(),selectionDragStop:Ce(),selectionContextMenu:Ce(),selectionStart:Ce(),selectionEnd:Ce(),viewportChangeStart:Ce(),viewportChange:Ce(),viewportChangeEnd:Ce(),paneScroll:Ce(),paneClick:Ce(),paneContextMenu:Ce(),paneMouseEnter:Ce(),paneMouseMove:Ce(),paneMouseLeave:Ce(),edgeContextMenu:Ce(),edgeMouseEnter:Ce(),edgeMouseMove:Ce(),edgeMouseLeave:Ce(),edgeDoubleClick:Ce(),edgeClick:Ce(),edgeUpdateStart:Ce(),edgeUpdate:Ce(),edgeUpdateEnd:Ce(),updateNodeInternals:Ce(),error:Ce(e=>Li(e.message))}}function gI(e,n){t.onBeforeMount(()=>{for(const[o,r]of Object.entries(n.value)){const i=a=>{e(o,a)};r.fns.add(i),ui(()=>{r.off(i)})}})}function Pp(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:ql.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:hr.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:qn.Bezier,style:{}},connectionMode:wn.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Di()?"Meta":"Control",zoomActivationKeyCode:Di()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:mI(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const hI=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function yI(e,n,o){const r=fI(e),i=B=>{const V=B??[];e.hooks.updateNodeInternals.trigger(V)},a=B=>$A(B,e.nodes,e.edges),l=B=>OA(B,e.nodes,e.edges),s=B=>rp(B,e.edges),c=({id:B,type:V,nodeId:F})=>{var R;return Array.from(((R=e.connectionLookup.get(`${F}-${V}-${B??null}`))==null?void 0:R.values())??[])},d=B=>{if(B)return n.value.get(B)},f=B=>{if(B)return o.value.get(B)},u=(B,V,F)=>{var R,Q;const q=[];for(const ae of B){const A={id:ae.id,type:"position",dragging:F,from:ae.from};if(V&&(A.position=ae.position,ae.parentNode)){const U=d(ae.parentNode);A.position={x:A.position.x-(((R=U==null?void 0:U.computedPosition)==null?void 0:R.x)??0),y:A.position.y-(((Q=U==null?void 0:U.computedPosition)==null?void 0:Q.y)??0)}}q.push(A)}q!=null&&q.length&&e.hooks.nodesChange.trigger(q)},p=B=>{if(!e.vueFlowRef)return;const V=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!V)return;const F=window.getComputedStyle(V),{m22:R}=new window.DOMMatrixReadOnly(F.transform),Q=[];for(const q of B){const ae=q,A=d(ae.id);if(A){const U=Vi(ae.nodeElement);if(!!(U.width&&U.height&&(A.dimensions.width!==U.width||A.dimensions.height!==U.height||ae.forceUpdate))){const oe=ae.nodeElement.getBoundingClientRect();A.dimensions=U,A.handleBounds.source=wp("source",ae.nodeElement,oe,R,A.id),A.handleBounds.target=wp("target",ae.nodeElement,oe,R,A.id),Q.push({id:A.id,type:"dimensions",dimensions:U})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&r.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),Q.length&&e.hooks.nodesChange.trigger(Q)},m=(B,V)=>{const F=new Set,R=new Set;for(const ae of B)Hn(ae)?F.add(ae.id):kn(ae)&&R.add(ae.id);const Q=En(n.value,F,!0),q=En(o.value,R);if(e.multiSelectionActive){for(const ae of F)Q.push(Cn(ae,V));for(const ae of R)q.push(Cn(ae,V))}Q.length&&e.hooks.nodesChange.trigger(Q),q.length&&e.hooks.edgesChange.trigger(q)},y=B=>{if(e.multiSelectionActive){const V=B.map(F=>Cn(F.id,!0));e.hooks.nodesChange.trigger(V);return}e.hooks.nodesChange.trigger(En(n.value,new Set(B.map(V=>V.id)),!0)),e.hooks.edgesChange.trigger(En(o.value))},_=B=>{if(e.multiSelectionActive){const V=B.map(F=>Cn(F.id,!0));e.hooks.edgesChange.trigger(V);return}e.hooks.edgesChange.trigger(En(o.value,new Set(B.map(V=>V.id)))),e.hooks.nodesChange.trigger(En(n.value,new Set,!0))},g=B=>{m(B,!0)},h=B=>{const F=(B||e.nodes).map(R=>(R.selected=!1,Cn(R.id,!1)));e.hooks.nodesChange.trigger(F)},w=B=>{const F=(B||e.edges).map(R=>(R.selected=!1,Cn(R.id,!1)));e.hooks.edgesChange.trigger(F)},b=B=>{if(!B||!B.length)return m([],!1);const V=B.reduce((F,R)=>{const Q=Cn(R.id,!1);return Hn(R)?F.nodes.push(Q):F.edges.push(Q),F},{nodes:[],edges:[]});V.nodes.length&&e.hooks.nodesChange.trigger(V.nodes),V.edges.length&&e.hooks.edgesChange.trigger(V.edges)},x=B=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([B,e.maxZoom]),e.minZoom=B},E=B=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([e.minZoom,B]),e.maxZoom=B},C=B=>{var V;(V=e.d3Zoom)==null||V.translateExtent(B),e.translateExtent=B},N=B=>{e.nodeExtent=B,i()},S=B=>{var V;(V=e.d3Zoom)==null||V.clickDistance(B)},v=B=>{e.nodesDraggable=B,e.nodesConnectable=B,e.elementsSelectable=B},D=B=>{const V=B instanceof Function?B(e.nodes):B;!e.initialized&&!V.length||(e.nodes=kp(V,d,e.hooks.error.trigger))},L=B=>{const V=B instanceof Function?B(e.edges):B;if(!e.initialized&&!V.length)return;const F=ns(V,e.isValidConnection,d,f,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ts(e.connectionLookup,o.value,F),e.edges=F},k=B=>{const V=B instanceof Function?B([...e.nodes,...e.edges]):B;!e.initialized&&!V.length||(D(V.filter(Hn)),L(V.filter(kn)))},J=B=>{let V=B instanceof Function?B(e.nodes):B;V=Array.isArray(V)?V:[V];const F=kp(V,d,e.hooks.error.trigger),R=[];for(const Q of F)R.push(dp(Q));R.length&&e.hooks.nodesChange.trigger(R)},I=B=>{let V=B instanceof Function?B(e.edges):B;V=Array.isArray(V)?V:[V];const F=ns(V,e.isValidConnection,d,f,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),R=[];for(const Q of F)R.push(dp(Q));R.length&&e.hooks.edgesChange.trigger(R)},G=(B,V=!0,F=!1)=>{const R=B instanceof Function?B(e.nodes):B,Q=Array.isArray(R)?R:[R],q=[],ae=[];function A($){const oe=s($);for(const ne of oe)(!et(ne.deletable)||ne.deletable)&&ae.push(fp(ne.id,ne.source,ne.target,ne.sourceHandle,ne.targetHandle))}function U($){const oe=[];for(const ne of e.nodes)ne.parentNode===$&&oe.push(ne);if(oe.length){for(const ne of oe)q.push(up(ne.id));V&&A(oe);for(const ne of oe)U(ne.id)}}for(const $ of Q){const oe=typeof $=="string"?d($):$;oe&&(et(oe.deletable)&&!oe.deletable||(q.push(up(oe.id)),V&&A([oe]),F&&U(oe.id)))}ae.length&&e.hooks.edgesChange.trigger(ae),q.length&&e.hooks.nodesChange.trigger(q)},j=B=>{const V=B instanceof Function?B(e.edges):B,F=Array.isArray(V)?V:[V],R=[];for(const Q of F){const q=typeof Q=="string"?f(Q):Q;q&&(et(q.deletable)&&!q.deletable||R.push(fp(typeof Q=="string"?Q:Q.id,q.source,q.target,q.sourceHandle,q.targetHandle)))}e.hooks.edgesChange.trigger(R)},te=(B,V,F=!0)=>{const R=f(B.id);if(!R)return!1;const Q=e.edges.indexOf(R),q=tI(B,V,R,F,e.hooks.error.trigger);if(q){const[ae]=ns([q],e.isValidConnection,d,f,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((A,U)=>U===Q?ae:A),ts(e.connectionLookup,o.value,[ae]),ae}return!1},K=(B,V,F={replace:!1})=>{const R=f(B);if(!R)return;const Q=typeof V=="function"?V(R):V;R.data=F.replace?Q:{...R.data,...Q}},O=B=>cp(B,e.nodes),P=B=>{const V=cp(B,e.edges);return ts(e.connectionLookup,o.value,V),V},T=(B,V,F={replace:!1})=>{const R=d(B);if(!R)return;const Q=typeof V=="function"?V(R):V;F.replace?e.nodes.splice(e.nodes.indexOf(R),1,Q):Object.assign(R,Q)},M=(B,V,F={replace:!1})=>{const R=d(B);if(!R)return;const Q=typeof V=="function"?V(R):V;R.data=F.replace?Q:{...R.data,...Q}},Y=(B,V,F=!1)=>{F?e.connectionClickStartHandle=B:e.connectionStartHandle=B,e.connectionEndHandle=null,e.connectionStatus=null,V&&(e.connectionPosition=V)},z=(B,V=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=B,e.connectionEndHandle=V,e.connectionStatus=F)},H=(B,V)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,V?e.connectionClickStartHandle=null:e.connectionStartHandle=null},Z=B=>{const V=TA(B),F=V?null:_r(B)?B:d(B.id);return!V&&!F?[null,null,V]:[V?B:$i(F),F,V]},ie=(B,V=!0,F=e.nodes)=>{const[R,Q,q]=Z(B);if(!R)return[];const ae=[];for(const A of F||e.nodes){if(!q&&(A.id===Q.id||!A.computedPosition))continue;const U=$i(A),$=Bi(U,R);(V&&$>0||$>=Number(R.width)*Number(R.height))&&ae.push(A)}return ae},be=(B,V,F=!0)=>{const[R]=Z(B);if(!R)return!1;const Q=Bi(R,V);return F&&Q>0||Q>=Number(R.width)*Number(R.height)},ee=B=>{const{viewport:V,dimensions:F,d3Zoom:R,d3Selection:Q,translateExtent:q}=e;if(!R||!Q||!B.x&&!B.y)return!1;const ae=Ao.translate(V.x+B.x,V.y+B.y).scale(V.zoom),A=[[0,0],[F.width,F.height]],U=R.constrain()(ae,A,q),$=e.viewport.x!==U.x||e.viewport.y!==U.y||e.viewport.zoom!==U.k;return R.transform(Q,U),$},re=B=>{const V=B instanceof Function?B(e):B,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];et(V.defaultEdgeOptions)&&(e.defaultEdgeOptions=V.defaultEdgeOptions);const R=V.modelValue||V.nodes||V.edges?[]:void 0;R&&(V.modelValue&&R.push(...V.modelValue),V.nodes&&R.push(...V.nodes),V.edges&&R.push(...V.edges),k(R));const Q=()=>{et(V.maxZoom)&&E(V.maxZoom),et(V.minZoom)&&x(V.minZoom),et(V.translateExtent)&&C(V.translateExtent)};for(const q of Object.keys(V)){const ae=q,A=V[ae];![...hI,...F].includes(ae)&&et(A)&&(e[ae]=A)}Nl(()=>e.d3Zoom).not.toBeNull().then(Q),e.initialized||(e.initialized=!0)};return{updateNodePositions:u,updateNodeDimensions:p,setElements:k,setNodes:D,setEdges:L,addNodes:J,addEdges:I,removeNodes:G,removeEdges:j,findNode:d,findEdge:f,updateEdge:te,updateEdgeData:K,updateNode:T,updateNodeData:M,applyEdgeChanges:P,applyNodeChanges:O,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:_,setMinZoom:x,setMaxZoom:E,setTranslateExtent:C,setNodeExtent:N,setPaneClickDistance:S,removeSelectedElements:b,removeSelectedNodes:h,removeSelectedEdges:w,startConnection:Y,updateConnection:z,endConnection:H,setInteractive:v,setState:re,getIntersectingNodes:ie,getIncomers:a,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:be,panBy:ee,fitView:B=>r.value.fitView(B),zoomIn:B=>r.value.zoomIn(B),zoomOut:B=>r.value.zoomOut(B),zoomTo:(B,V)=>r.value.zoomTo(B,V),setViewport:(B,V)=>r.value.setViewport(B,V),setTransform:(B,V)=>r.value.setTransform(B,V),getViewport:()=>r.value.getViewport(),getTransform:()=>r.value.getTransform(),setCenter:(B,V,F)=>r.value.setCenter(B,V,F),fitBounds:(B,V)=>r.value.fitBounds(B,V),project:B=>r.value.project(B),screenToFlowCoordinate:B=>r.value.screenToFlowCoordinate(B),flowToScreenCoordinate:B=>r.value.flowToScreenCoordinate(B),toObject:()=>{const B=[],V=[];for(const F of e.nodes){const{computedPosition:R,handleBounds:Q,selected:q,dimensions:ae,isParent:A,resizing:U,dragging:$,events:oe,...ne}=F;B.push(ne)}for(const F of e.edges){const{selected:R,sourceNode:Q,targetNode:q,events:ae,...A}=F;V.push(A)}return JSON.parse(JSON.stringify({nodes:B,edges:V,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:B=>new Promise(V=>{const{nodes:F,edges:R,position:Q,zoom:q,viewport:ae}=B;if(F&&D(F),R&&L(R),ae!=null&&ae.x&&(ae!=null&&ae.y)||Q){const A=(ae==null?void 0:ae.x)||Q[0],U=(ae==null?void 0:ae.y)||Q[1],$=(ae==null?void 0:ae.zoom)||q||e.viewport.zoom;return Nl(()=>r.value.viewportInitialized).toBe(!0).then(()=>{r.value.setViewport({x:A,y:U,zoom:$}).then(()=>{V(!0)})})}else V(!0)}),updateNodeInternals:i,viewportHelper:r,$reset:()=>{const B=Pp();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const V=Ao.translate(B.defaultViewport.x??0,B.defaultViewport.y??0).scale(zn(B.defaultViewport.zoom??1,B.minZoom,B.maxZoom)),F=e.viewportRef.getBoundingClientRect(),R=[[0,0],[F.width,F.height]],Q=e.d3Zoom.constrain()(V,R,B.translateExtent);e.d3Zoom.transform(e.d3Selection,Q)}re(B)},$destroy:()=>{}}}const _I=["data-id","data-handleid","data-nodeid","data-handlepos"],bI={name:"Handle",compatConfig:{MODE:3}},Jt=t.defineComponent({...bI,props:{id:{default:null},type:{},position:{default:()=>Ee.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),r=t.toRef(()=>o.type??"source"),i=t.toRef(()=>o.isValidConnection??null),{id:a,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:f,noDragClassName:u,noPanClassName:p}=Le(),{id:m,node:y,nodeEl:_,connectedEdges:g}=Ip(),h=t.ref(),w=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),b=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),x=t.toRef(()=>{var L,k,J,I,G,j;return((L=l.value)==null?void 0:L.nodeId)===m&&((k=l.value)==null?void 0:k.id)===e.id&&((J=l.value)==null?void 0:J.type)===r.value||((I=c.value)==null?void 0:I.nodeId)===m&&((G=c.value)==null?void 0:G.id)===e.id&&((j=c.value)==null?void 0:j.type)===r.value}),E=t.toRef(()=>{var L,k,J;return((L=s.value)==null?void 0:L.nodeId)===m&&((k=s.value)==null?void 0:k.id)===e.id&&((J=s.value)==null?void 0:J.type)===r.value}),{handlePointerDown:C,handleClick:N}=Ap({nodeId:m,handleId:e.id,isValidConnection:i,type:r}),S=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(L=>{const k=L[`${r.value}Handle`];return L[r.value]!==m?!1:k?k===e.id:!0}):typeof e.connectable=="number"?g.value.filter(L=>{const k=L[`${r.value}Handle`];return L[r.value]!==m?!1:k?k===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,g.value):et(e.connectable)?e.connectable:f.value);t.onMounted(()=>{var L;if(!y.dimensions.width||!y.dimensions.height)return;const k=(L=y.handleBounds[r.value])==null?void 0:L.find(O=>O.id===e.id);if(!d.value||k)return;const J=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!h.value||!J||!e.id)return;const I=_.value.getBoundingClientRect(),G=h.value.getBoundingClientRect(),j=window.getComputedStyle(J),{m22:te}=new window.DOMMatrixReadOnly(j.transform),K={id:e.id,position:e.position,x:(G.left-I.left)/te,y:(G.top-I.top)/te,type:r.value,nodeId:m,...Vi(h.value)};y.handleBounds[r.value]=[...y.handleBounds[r.value]??[],K]});function v(L){const k=Zl(L);S.value&&w.value&&(k&&L.button===0||!k)&&C(L)}function D(L){!m||!s.value&&!w.value||S.value&&N(L)}return n({handleClick:N,handlePointerDown:C,onClick:D,onPointerDown:v}),(L,k)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:h,"data-id":`${t.unref(a)}-${t.unref(m)}-${e.id}-${r.value}`,"data-handleid":e.id,"data-nodeid":t.unref(m),"data-handlepos":L.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${L.position}`,`vue-flow__handle-${e.id}`,t.unref(u),t.unref(p),r.value,{connectable:S.value,connecting:E.value,connectablestart:w.value,connectableend:b.value,connectionindicator:S.value&&(w.value&&!x.value||b.value&&x.value)}]]),onMousedown:v,onTouchstartPassive:v,onClick:D},[t.renderSlot(L.$slots,"default",{id:L.id})],42,_I))}}),Ki=function({sourcePosition:e=Ee.Bottom,targetPosition:n=Ee.Top,label:o,connectable:r=!0,isValidTargetPos:i,isValidSourcePos:a,data:l}){const s=l.label??o;return[t.h(Jt,{type:"target",position:n,connectable:r,isValidConnection:i}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Jt,{type:"source",position:e,connectable:r,isValidConnection:a})]};Ki.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ki.inheritAttrs=!1,Ki.compatConfig={MODE:3};const wI=Ki,ji=function({targetPosition:e=Ee.Top,label:n,connectable:o=!0,isValidTargetPos:r,data:i}){const a=i.label??n;return[t.h(Jt,{type:"target",position:e,connectable:o,isValidConnection:r}),typeof a!="string"&&a?t.h(a):t.h(t.Fragment,[a])]};ji.props=["targetPosition","label","isValidTargetPos","connectable","data"],ji.inheritAttrs=!1,ji.compatConfig={MODE:3};const kI=ji,Gi=function({sourcePosition:e=Ee.Bottom,label:n,connectable:o=!0,isValidSourcePos:r,data:i}){const a=i.label??n;return[typeof a!="string"&&a?t.h(a):t.h(t.Fragment,[a]),t.h(Jt,{type:"source",position:e,connectable:o,isValidConnection:r})]};Gi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Gi.inheritAttrs=!1,Gi.compatConfig={MODE:3};const CI=Gi,EI=["transform"],NI=["width","height","x","y","rx","ry"],SI=["y"],xI={name:"EdgeText",compatConfig:{MODE:3}},vI=t.defineComponent({...xI,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),r=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(i),t.watch([()=>e.x,()=>e.y,o,()=>e.label],i);function i(){if(!o.value)return;const a=o.value.getBBox();(a.width!==n.value.width||a.height!==n.value.height)&&(n.value=a)}return(a,l)=>(t.openBlock(),t.createElementBlock("g",{transform:r.value,class:"vue-flow__edge-textwrapper"},[a.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*a.labelBgPadding[0]}px`,height:`${n.value.height+2*a.labelBgPadding[1]}px`,x:-a.labelBgPadding[0],y:-a.labelBgPadding[1],style:t.normalizeStyle(a.labelBgStyle),rx:a.labelBgBorderRadius,ry:a.labelBgBorderRadius},null,12,NI)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(a.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:a.labelStyle}),[t.renderSlot(a.$slots,"default",{},()=>[typeof a.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(a.label),1)],64))])],16,SI)],8,EI))}}),AI=["id","d","marker-end","marker-start"],II=["d","stroke-width"],TI={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},qi=t.defineComponent({...TI,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),r=t.ref(null),i=t.ref(null),a=t.useAttrs();return n({pathEl:o,interactionEl:r,labelEl:i}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(a),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,AI),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:r,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,II)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(vI,{key:1,ref_key:"labelEl",ref:i,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function Op({sourceX:e,sourceY:n,targetX:o,targetY:r}){const i=Math.abs(o-e)/2,a=o<e?o+i:o-i,l=Math.abs(r-n)/2,s=r<n?r+l:r-l;return[a,s,i,l]}function $p({sourceX:e,sourceY:n,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:s}){const c=e*.125+i*.375+l*.375+o*.125,d=n*.125+a*.375+s*.375+r*.125,f=Math.abs(c-e),u=Math.abs(d-n);return[c,d,f,u]}function zi(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Bp({pos:e,x1:n,y1:o,x2:r,y2:i,c:a}){let l,s;switch(e){case Ee.Left:l=n-zi(n-r,a),s=o;break;case Ee.Right:l=n+zi(r-n,a),s=o;break;case Ee.Top:l=n,s=o-zi(o-i,a);break;case Ee.Bottom:l=n,s=o+zi(i-o,a);break}return[l,s]}function Vp(e){const{sourceX:n,sourceY:o,sourcePosition:r=Ee.Bottom,targetX:i,targetY:a,targetPosition:l=Ee.Top,curvature:s=.25}=e,[c,d]=Bp({pos:r,x1:n,y1:o,x2:i,y2:a,c:s}),[f,u]=Bp({pos:l,x1:i,y1:a,x2:n,y2:o,c:s}),[p,m,y,_]=$p({sourceX:n,sourceY:o,targetX:i,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:f,targetControlY:u});return[`M${n},${o} C${c},${d} ${f},${u} ${i},${a}`,p,m,y,_]}function Rp({pos:e,x1:n,y1:o,x2:r,y2:i}){let a,l;switch(e){case Ee.Left:case Ee.Right:a=.5*(n+r),l=o;break;case Ee.Top:case Ee.Bottom:a=n,l=.5*(o+i);break}return[a,l]}function Dp(e){const{sourceX:n,sourceY:o,sourcePosition:r=Ee.Bottom,targetX:i,targetY:a,targetPosition:l=Ee.Top}=e,[s,c]=Rp({pos:r,x1:n,y1:o,x2:i,y2:a}),[d,f]=Rp({pos:l,x1:i,y1:a,x2:n,y2:o}),[u,p,m,y]=$p({sourceX:n,sourceY:o,targetX:i,targetY:a,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${n},${o} C${s},${c} ${d},${f} ${i},${a}`,u,p,m,y]}const Mp={[Ee.Left]:{x:-1,y:0},[Ee.Right]:{x:1,y:0},[Ee.Top]:{x:0,y:-1},[Ee.Bottom]:{x:0,y:1}};function PI({source:e,sourcePosition:n=Ee.Bottom,target:o}){return n===Ee.Left||n===Ee.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function Lp(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function OI({source:e,sourcePosition:n=Ee.Bottom,target:o,targetPosition:r=Ee.Top,center:i,offset:a}){const l=Mp[n],s=Mp[r],c={x:e.x+l.x*a,y:e.y+l.y*a},d={x:o.x+s.x*a,y:o.y+s.y*a},f=PI({source:c,sourcePosition:n,target:d}),u=f.x!==0?"x":"y",p=f[u];let m,y,_;const g={x:0,y:0},h={x:0,y:0},[w,b,x,E]=Op({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[u]*s[u]===-1){y=i.x??w,_=i.y??b;const N=[{x:y,y:c.y},{x:y,y:d.y}],S=[{x:c.x,y:_},{x:d.x,y:_}];l[u]===p?m=u==="x"?N:S:m=u==="x"?S:N}else{const N=[{x:c.x,y:d.y}],S=[{x:d.x,y:c.y}];if(u==="x"?m=l.x===p?S:N:m=l.y===p?N:S,n===r){const J=Math.abs(e[u]-o[u]);if(J<=a){const I=Math.min(a-1,a-J);l[u]===p?g[u]=(c[u]>e[u]?-1:1)*I:h[u]=(d[u]>o[u]?-1:1)*I}}if(n!==r){const J=u==="x"?"y":"x",I=l[u]===s[J],G=c[J]>d[J],j=c[J]<d[J];(l[u]===1&&(!I&&G||I&&j)||l[u]!==1&&(!I&&j||I&&G))&&(m=u==="x"?N:S)}const v={x:c.x+g.x,y:c.y+g.y},D={x:d.x+h.x,y:d.y+h.y},L=Math.max(Math.abs(v.x-m[0].x),Math.abs(D.x-m[0].x)),k=Math.max(Math.abs(v.y-m[0].y),Math.abs(D.y-m[0].y));L>=k?(y=(v.x+D.x)/2,_=m[0].y):(y=m[0].x,_=(v.y+D.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...m,{x:d.x+h.x,y:d.y+h.y},o],y,_,x,E]}function $I(e,n,o,r){const i=Math.min(Lp(e,n)/2,Lp(n,o)/2,r),{x:a,y:l}=n;if(e.x===a&&a===o.x||e.y===l&&l===o.y)return`L${a} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,f=e.y<o.y?1:-1;return`L ${a+i*d},${l}Q ${a},${l} ${a},${l+i*f}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${a},${l+i*c}Q ${a},${l} ${a+i*s},${l}`}function is(e){const{sourceX:n,sourceY:o,sourcePosition:r=Ee.Bottom,targetX:i,targetY:a,targetPosition:l=Ee.Top,borderRadius:s=5,centerX:c,centerY:d,offset:f=20}=e,[u,p,m,y,_]=OI({source:{x:n,y:o},sourcePosition:r,target:{x:i,y:a},targetPosition:l,center:{x:c,y:d},offset:f});return[u.reduce((h,w,b)=>{let x;return b>0&&b<u.length-1?x=$I(u[b-1],w,u[b+1],s):x=`${b===0?"M":"L"}${w.x} ${w.y}`,h+=x,h},""),p,m,y,_]}function BI(e){const{sourceX:n,sourceY:o,targetX:r,targetY:i}=e,[a,l,s,c]=Op({sourceX:n,sourceY:o,targetX:r,targetY:i});return[`M ${n},${o}L ${r},${i}`,a,l,s,c]}const VI=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,r,i]=BI(e);return t.h(qi,{path:o,labelX:r,labelY:i,...n,...e})}}}),Fp=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,r,i]=is({...e,sourcePosition:e.sourcePosition??Ee.Bottom,targetPosition:e.targetPosition??Ee.Top});return t.h(qi,{path:o,labelX:r,labelY:i,...n,...e})}}}),RI=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(Fp,{...e,...n,borderRadius:0})}}),DI=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,r,i]=Vp({...e,sourcePosition:e.sourcePosition??Ee.Bottom,targetPosition:e.targetPosition??Ee.Top});return t.h(qi,{path:o,labelX:r,labelY:i,...n,...e})}}}),MI=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,r,i]=Dp({...e,sourcePosition:e.sourcePosition??Ee.Bottom,targetPosition:e.targetPosition??Ee.Top});return t.h(qi,{path:o,labelX:r,labelY:i,...n,...e})}}}),LI={input:CI,default:wI,output:kI},FI={default:DI,straight:VI,step:RI,smoothstep:Fp,simplebezier:MI};function UI(e,n,o){const r=t.computed(()=>_=>n.value.get(_)),i=t.computed(()=>_=>o.value.get(_)),a=t.computed(()=>{const _={...FI,...e.edgeTypes},g=Object.keys(_);for(const h of e.edges)h.type&&!g.includes(h.type)&&(_[h.type]=h.type);return _}),l=t.computed(()=>{const _={...LI,...e.nodeTypes},g=Object.keys(_);for(const h of e.nodes)h.type&&!g.includes(h.type)&&(_[h.type]=h.type);return _}),s=t.computed(()=>e.onlyRenderVisibleElements?op(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const g of e.edges){const h=n.value.get(g.source),w=n.value.get(g.target);KA({sourcePos:h.computedPosition||{x:0,y:0},targetPos:w.computedPosition||{x:0,y:0},sourceWidth:h.dimensions.width,sourceHeight:h.dimensions.height,targetWidth:w.dimensions.width,targetHeight:w.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(g)}return _}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),f=t.computed(()=>{const _=[];for(const g of e.nodes)g.selected&&_.push(g);return _}),u=t.computed(()=>{const _=[];for(const g of e.edges)g.selected&&_.push(g);return _}),p=t.computed(()=>[...f.value,...u.value]),m=t.computed(()=>{const _=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&_.push(g);return _}),y=t.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:r,getEdge:i,getElements:d,getEdgeTypes:a,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:f,getSelectedEdges:u,getNodesInitialized:m,areNodesInitialized:y}}class Yn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,r=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Yn.instance;return Yn.instance=r??new Yn,o&&(o.config.globalProperties.$vueFlowStorage=Yn.instance),Yn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const r=Pp(),i=t.reactive(r),a={};for(const[p,m]of Object.entries(i.hooks)){const y=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;a[y]=m.on}const l={};for(const[p,m]of Object.entries(i.hooks))l[p]=m.trigger;const s=t.computed(()=>{const p=new Map;for(const m of i.nodes)p.set(m.id,m);return p}),c=t.computed(()=>{const p=new Map;for(const m of i.edges)p.set(m.id,m);return p}),d=UI(i,s,c),f=yI(i,s,c);f.setState({...i,...o});const u={...a,...d,...f,...L1(i),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.45.0",$destroy:()=>{this.remove(n)}};return this.set(n,u),u}getId(){return`vue-flow-${this.currentId++}`}}function Le(e){const n=Yn.getInstance(),o=t.getCurrentScope(),r=typeof e=="object",i=r?e:{id:e},a=i.id,l=a??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Np,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=a??n.getId(),d=n.create(c,i);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(u,p,m)=>{const y=g=>{d.applyNodeChanges(g)},_=g=>{d.applyEdgeChanges(g)};u?(d.onNodesChange(y),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(_)),m(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),ui(()=>{if(s){const u=n.get(s.id);u?u.$destroy():Li(`No store instance found for id ${s.id} in storage.`)}})})}else r&&s.setState(i);if(o&&(t.provide(Np,s),o.vueFlowId=s.id),r){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new lt(Qe.USEVUEFLOW_OPTIONS))}return s}function KI(e){const{emits:n,dimensions:o}=Le();let r;t.onMounted(()=>{const i=e.value,a=()=>{if(!i)return;const l=Vi(i);(l.width===0||l.height===0)&&n.error(new lt(Qe.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:l.width||500,height:l.height||500}};a(),window.addEventListener("resize",a),i&&(r=new ResizeObserver(()=>a()),r.observe(i)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),r&&i&&r.unobserve(i)})})}const jI={name:"UserSelection",compatConfig:{MODE:3}},GI=t.defineComponent({...jI,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),qI=["tabIndex"],zI={name:"NodesSelection",compatConfig:{MODE:3}},HI=t.defineComponent({...zI,setup(e){const{emits:n,viewport:o,getSelectedNodes:r,noPanClassName:i,disableKeyboardA11y:a,userSelectionActive:l}=Le(),s=Tp(),c=t.ref(null),d=vp({el:c,onStart(y){n.selectionDragStart(y)},onDrag(y){n.selectionDrag(y)},onStop(y){n.selectionDragStop(y)}});t.onMounted(()=>{var y;a.value||(y=c.value)==null||y.focus({preventScroll:!0})});const f=t.computed(()=>np(r.value)),u=t.computed(()=>({width:`${f.value.width}px`,height:`${f.value.height}px`,top:`${f.value.y}px`,left:`${f.value.x}px`}));function p(y){n.selectionContextMenu({event:y,nodes:r.value})}function m(y){a||Io[y.key]&&(y.preventDefault(),s({x:Io[y.key].x,y:Io[y.key].y},y.shiftKey))}return(y,_)=>!t.unref(l)&&f.value.width&&f.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(i)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(u.value),tabIndex:t.unref(a)?void 0:-1,onContextmenu:p,onKeydown:m},null,46,qI)],6)):t.createCommentVNode("",!0)}});function YI(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const WI={name:"Pane",compatConfig:{MODE:3}},XI=t.defineComponent({...WI,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:r,emits:i,userSelectionActive:a,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:f,getSelectedNodes:u,removeNodes:p,removeEdges:m,selectionMode:y,deleteKeyCode:_,multiSelectionKeyCode:g,multiSelectionActive:h,edgeLookup:w,nodeLookup:b,connectionLookup:x,defaultEdgeOptions:E,connectionStartHandle:C}=Le(),N=t.ref(null),S=t.ref(new Set),v=t.ref(new Set),D=t.ref(),L=t.toRef(()=>c.value&&(e.isSelecting||a.value)),k=t.toRef(()=>C.value!==null);let J=!1,I=!1;const G=yr(_,{actInsideInputWithModifier:!1}),j=yr(g);t.watch(G,z=>{z&&(p(u.value),m(f.value),d.value=!1)}),t.watch(j,z=>{h.value=z});function te(z,H){return Z=>{Z.target===H&&(z==null||z(Z))}}function K(z){if(J||k.value){J=!1;return}i.paneClick(z),l(),d.value=!1}function O(z){z.preventDefault(),z.stopPropagation(),i.paneContextMenu(z)}function P(z){i.paneScroll(z)}function T(z){var H,Z,ie;if(D.value=(H=n.value)==null?void 0:H.getBoundingClientRect(),!c.value||!e.isSelecting||z.button!==0||z.target!==N.value||!D.value)return;(ie=(Z=z.target)==null?void 0:Z.setPointerCapture)==null||ie.call(Z,z.pointerId);const{x:be,y:ee}=YI(z,D.value);I=!0,J=!1,l(),s.value={width:0,height:0,startX:be,startY:ee,x:be,y:ee},i.selectionStart(z)}function M(z){var H;if(!D.value||!s.value)return;J=!0;const{x:Z,y:ie}=Zt(z,D.value),{startX:be=0,startY:ee=0}=s.value,re={startX:be,startY:ee,x:Z<be?Z:be,y:ie<ee?ie:ee,width:Math.abs(Z-be),height:Math.abs(ie-ee)},le=S.value,ue=v.value;S.value=new Set(op(o.value,re,r.value,y.value===ql.Partial,!0).map(B=>B.id)),v.value=new Set;const fe=((H=E.value)==null?void 0:H.selectable)??!0;for(const B of S.value){const V=x.value.get(B);if(V)for(const{edgeId:F}of V.values()){const R=w.value.get(F);R&&(R.selectable??fe)&&v.value.add(F)}}if(!Ep(le,S.value)){const B=En(b.value,S.value,!0);i.nodesChange(B)}if(!Ep(ue,v.value)){const B=En(w.value,v.value);i.edgesChange(B)}s.value=re,a.value=!0,d.value=!1}function Y(z){var H;z.button!==0||!I||((H=z.target)==null||H.releasePointerCapture(z.pointerId),!a.value&&s.value&&z.target===N.value&&K(z),a.value=!1,s.value=null,d.value=S.value.size>0,i.selectionEnd(z),e.selectionKeyPressed&&(J=!1),I=!1)}return(z,H)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:N,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:z.isSelecting}]),onClick:H[0]||(H[0]=Z=>L.value?void 0:te(K,N.value)(Z)),onContextmenu:H[1]||(H[1]=Z=>te(O,N.value)(Z)),onWheelPassive:H[2]||(H[2]=Z=>te(P,N.value)(Z)),onPointerenter:H[3]||(H[3]=Z=>L.value?void 0:t.unref(i).paneMouseEnter(Z)),onPointerdown:H[4]||(H[4]=Z=>L.value?T(Z):t.unref(i).paneMouseMove(Z)),onPointermove:H[5]||(H[5]=Z=>L.value?M(Z):t.unref(i).paneMouseMove(Z)),onPointerup:H[6]||(H[6]=Z=>L.value?Y(Z):void 0),onPointerleave:H[7]||(H[7]=Z=>t.unref(i).paneMouseLeave(Z))},[t.renderSlot(z.$slots,"default"),t.unref(a)&&t.unref(s)?(t.openBlock(),t.createBlock(GI,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(u).length?(t.openBlock(),t.createBlock(HI,{key:1})):t.createCommentVNode("",!0)],34))}}),ZI={name:"Transform",compatConfig:{MODE:3}},JI=t.defineComponent({...ZI,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:r}=Le(),i=t.computed(()=>o.value?!r.value:!1),a=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:a.value,opacity:i.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),QI={name:"Viewport",compatConfig:{MODE:3}},eT=t.defineComponent({...QI,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:r,translateExtent:i,zoomActivationKeyCode:a,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:f,panOnDrag:u,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:y,preventScrolling:_,noWheelClassName:g,noPanClassName:h,emits:w,connectionStartHandle:b,userSelectionActive:x,paneDragging:E,d3Zoom:C,d3Selection:N,d3ZoomHandler:S,viewport:v,viewportRef:D,paneClickDistance:L}=Le();KI(D);const k=t.shallowRef(!1),J=t.shallowRef(!1);let I=null,G=!1,j=0,te={x:0,y:0,zoom:0};const K=yr(s),O=yr(l),P=yr(a),T=t.toRef(()=>(!O.value||O.value&&l.value===!0)&&(K.value||u.value)),M=t.toRef(()=>K.value||c.value),Y=t.toRef(()=>O.value||l.value===!0&&T.value!==!0);t.onMounted(()=>{if(!D.value){Li("Viewport element is missing");return}const ee=D.value,re=ee.getBoundingClientRect(),le=EA().clickDistance(L.value).scaleExtent([n.value,o.value]).translateExtent(i.value),ue=Ft(ee).call(le),fe=ue.on("wheel.zoom"),B=Ao.translate(r.value.x??0,r.value.y??0).scale(zn(r.value.zoom??1,n.value,o.value)),V=[[0,0],[re.width,re.height]],F=le.constrain()(B,V,i.value);le.transform(ue,F),le.wheelDelta(H),C.value=le,N.value=ue,S.value=fe,v.value={x:F.x,y:F.y,zoom:F.k},le.on("start",R=>{var Q;if(!R.sourceEvent)return null;j=R.sourceEvent.button,k.value=!0;const q=ie(R.transform);((Q=R.sourceEvent)==null?void 0:Q.type)==="mousedown"&&(E.value=!0),te=q,w.viewportChangeStart(q),w.moveStart({event:R,flowTransform:q})}),le.on("end",R=>{if(!R.sourceEvent)return null;if(k.value=!1,E.value=!1,z(T.value,j??0)&&!G&&w.paneContextMenu(R.sourceEvent),G=!1,Z(te,R.transform)){const Q=ie(R.transform);te=Q,w.viewportChangeEnd(Q),w.moveEnd({event:R,flowTransform:Q})}}),le.filter(R=>{var Q;const q=P.value||y.value,ae=m.value&&R.ctrlKey,A=R.button;if(A===1&&R.type==="mousedown"&&(be(R,"vue-flow__node")||be(R,"vue-flow__edge")))return!0;if(!T.value&&!q&&!M.value&&!p.value&&!m.value||x.value||!p.value&&R.type==="dblclick"||be(R,g.value)&&R.type==="wheel"||be(R,h.value)&&(R.type!=="wheel"||M.value&&R.type==="wheel"&&!P.value)||!m.value&&R.ctrlKey&&R.type==="wheel"||!q&&!M.value&&!ae&&R.type==="wheel")return!1;if(!m&&R.type==="touchstart"&&((Q=R.touches)==null?void 0:Q.length)>1)return R.preventDefault(),!1;if(!T.value&&(R.type==="mousedown"||R.type==="touchstart")||l.value===!0&&Array.isArray(u.value)&&u.value.includes(0)&&A===0||Array.isArray(u.value)&&!u.value.includes(A)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const U=Array.isArray(u.value)&&u.value.includes(A)||l.value===!0&&Array.isArray(u.value)&&!u.value.includes(0)||!A||A<=1;return(!R.ctrlKey||K.value||R.type==="wheel")&&U}),t.watch([x,T],()=>{x.value&&!k.value?le.on("zoom",null):x.value||le.on("zoom",R=>{v.value={x:R.transform.x,y:R.transform.y,zoom:R.transform.k};const Q=ie(R.transform);G=z(T.value,j??0),w.viewportChange(Q),w.move({event:R,flowTransform:Q})})},{immediate:!0}),t.watch([x,M,d,P,m,_,g],()=>{M.value&&!P.value&&!x.value?ue.on("wheel.zoom",R=>{if(be(R,g.value))return!1;const Q=P.value||y.value,q=m.value&&R.ctrlKey;if(!(!_.value||M.value||Q||q))return!1;R.preventDefault(),R.stopImmediatePropagation();const A=ue.property("__zoom").k||1,U=Di();if(!K.value&&R.ctrlKey&&m.value&&U){const ke=Ht(R),de=H(R),Ne=A*2**de;le.scaleTo(ue,Ne,ke,R);return}const $=R.deltaMode===1?20:1;let oe=d.value===hr.Vertical?0:R.deltaX*$,ne=d.value===hr.Horizontal?0:R.deltaY*$;!U&&R.shiftKey&&d.value!==hr.Vertical&&!oe&&ne&&(oe=ne,ne=0),le.translateBy(ue,-(oe/A)*f.value,-(ne/A)*f.value);const _e=ie(ue.property("__zoom"));I&&clearTimeout(I),J.value?(w.move({event:R,flowTransform:_e}),w.viewportChange(_e),I=setTimeout(()=>{w.moveEnd({event:R,flowTransform:_e}),w.viewportChangeEnd(_e),J.value=!1},150)):(J.value=!0,w.moveStart({event:R,flowTransform:_e}),w.viewportChangeStart(_e))},{passive:!1}):typeof fe<"u"&&ue.on("wheel.zoom",function(R,Q){const q=!_.value&&R.type==="wheel"&&!R.ctrlKey,ae=P.value||y.value,A=m.value&&R.ctrlKey;if(!ae&&!c.value&&!A&&R.type==="wheel"||q||be(R,g.value))return null;R.preventDefault(),fe.call(this,R,Q)},{passive:!1})},{immediate:!0})});function z(ee,re){return re===2&&Array.isArray(ee)&&ee.includes(2)}function H(ee){const re=ee.ctrlKey&&Di()?10:1;return-ee.deltaY*(ee.deltaMode===1?.05:ee.deltaMode?1:.002)*re}function Z(ee,re){return ee.x!==re.x&&!Number.isNaN(re.x)||ee.y!==re.y&&!Number.isNaN(re.y)||ee.zoom!==re.k&&!Number.isNaN(re.k)}function ie(ee){return{x:ee.x,y:ee.y,zoom:ee.k}}function be(ee,re){return ee.target.closest(`.${re}`)}return(ee,re)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:D,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(XI,{"is-selecting":Y.value,"selection-key-pressed":t.unref(O),class:t.normalizeClass({connecting:!!t.unref(b),dragging:t.unref(E),draggable:t.unref(u)===!0||Array.isArray(t.unref(u))&&t.unref(u).includes(0)})},{default:t.withCtx(()=>[t.createVNode(JI,null,{default:t.withCtx(()=>[t.renderSlot(ee.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),tT=["id"],nT=["id"],oT=["id"],rT={name:"A11yDescriptions",compatConfig:{MODE:3}},iT=t.defineComponent({...rT,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:r}=Le();return(i,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(Hf)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,tT),t.createElementVNode("div",{id:`${t.unref(Yf)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,nT),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(IA)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(r)),9,oT))],64))}});function aT(){const e=Le();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function lT(e,n,o){return o===Ee.Left?e-n:o===Ee.Right?e+n:e}function sT(e,n,o){return o===Ee.Top?e-n:o===Ee.Bottom?e+n:e}const as=function({radius:e=10,centerX:n=0,centerY:o=0,position:r=Ee.Top,type:i}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:lT(n,e,r),cy:sT(o,e,r),r:e,stroke:"transparent",fill:"transparent"})};as.props=["radius","centerX","centerY","position","type"],as.compatConfig={MODE:3};const Up=as,cT=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:r,edgeUpdaterRadius:i,emits:a,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:f,findNode:u,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:y,elementsSelectable:_,edgesUpdatable:g,edgesFocusable:h,hooks:w}=Le(),b=t.computed(()=>f(e.id)),{emit:x,on:E}=iI(b.value,a),C=t.inject(Fi),N=t.getCurrentInstance(),S=t.ref(!1),v=t.ref(!1),D=t.ref(""),L=t.ref(null),k=t.ref("source"),J=t.ref(null),I=t.toRef(()=>typeof b.value.selectable>"u"?_.value:b.value.selectable),G=t.toRef(()=>typeof b.value.updatable>"u"?g.value:b.value.updatable),j=t.toRef(()=>typeof b.value.focusable>"u"?h.value:b.value.focusable);t.provide(nI,e.id),t.provide(oI,J);const te=t.computed(()=>b.value.class instanceof Function?b.value.class(b.value):b.value.class),K=t.computed(()=>b.value.style instanceof Function?b.value.style(b.value):b.value.style),O=t.computed(()=>{const V=b.value.type||"default",F=C==null?void 0:C[`edge-${V}`];if(F)return F;let R=b.value.template??c.value[V];if(typeof R=="string"&&N){const Q=Object.keys(N.appContext.components);Q&&Q.includes(V)&&(R=t.resolveComponent(V,!1))}return R&&typeof R!="string"?R:(a.error(new lt(Qe.EDGE_TYPE_MISSING,R)),!1)}),{handlePointerDown:P}=Ap({nodeId:D,handleId:L,type:k,isValidConnection:p,edgeUpdaterType:k,onEdgeUpdate:Y,onEdgeUpdateEnd:z});return()=>{const V=u(b.value.source),F=u(b.value.target),R="pathOptions"in b.value?b.value.pathOptions:{};if(!V&&!F)return a.error(new lt(Qe.EDGE_SOURCE_TARGET_MISSING,b.value.id,b.value.source,b.value.target)),null;if(!V)return a.error(new lt(Qe.EDGE_SOURCE_MISSING,b.value.id,b.value.source)),null;if(!F)return a.error(new lt(Qe.EDGE_TARGET_MISSING,b.value.id,b.value.target)),null;if(!b.value||b.value.hidden||V.hidden||F.hidden)return null;let Q;r.value===wn.Strict?Q=V.handleBounds.source:Q=[...V.handleBounds.source||[],...V.handleBounds.target||[]];const q=gp(Q,b.value.sourceHandle);let ae;r.value===wn.Strict?ae=F.handleBounds.target:ae=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const A=gp(ae,b.value.targetHandle),U=(q==null?void 0:q.position)||Ee.Bottom,$=(A==null?void 0:A.position)||Ee.Top,{x:oe,y:ne}=To(V,q,U),{x:_e,y:ke}=To(F,A,$);return b.value.sourceX=oe,b.value.sourceY=ne,b.value.targetX=_e,b.value.targetY=ke,t.h("g",{ref:J,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${O.value===!1?"default":b.value.type||"default"}`,s.value,te.value,{updating:S.value,selected:b.value.selected,animated:b.value.animated,inactive:!I.value&&!w.value.edgeClick.hasListeners()}],tabIndex:j.value?0:void 0,"aria-label":b.value.ariaLabel===null?void 0:b.value.ariaLabel??`Edge from ${b.value.source} to ${b.value.target}`,"aria-describedby":j.value?`${Yf}-${n}`:void 0,"aria-roledescription":"edge",role:j.value?"group":"img",...b.value.domAttributes,onClick:Z,onContextmenu:ie,onDblclick:be,onMouseenter:ee,onMousemove:re,onMouseleave:le,onKeyDown:j.value?B:void 0},[v.value?null:t.h(O.value===!1?c.value.default:O.value,{id:e.id,sourceNode:V,targetNode:F,source:b.value.source,target:b.value.target,type:b.value.type,updatable:G.value,selected:b.value.selected,animated:b.value.animated,label:b.value.label,labelStyle:b.value.labelStyle,labelShowBg:b.value.labelShowBg,labelBgStyle:b.value.labelBgStyle,labelBgPadding:b.value.labelBgPadding,labelBgBorderRadius:b.value.labelBgBorderRadius,data:b.value.data,events:{...b.value.events,...E},style:K.value,markerStart:`url('#${wr(b.value.markerStart,n)}')`,markerEnd:`url('#${wr(b.value.markerEnd,n)}')`,sourcePosition:U,targetPosition:$,sourceX:oe,sourceY:ne,targetX:_e,targetY:ke,sourceHandleId:b.value.sourceHandle,targetHandleId:b.value.targetHandle,interactionWidth:b.value.interactionWidth,...R}),[G.value==="source"||G.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:T,onMouseout:M},t.h(Up,{position:U,centerX:oe,centerY:ne,radius:i.value,type:"source","data-type":"source"}))]:null,G.value==="target"||G.value===!0?[t.h("g",{onMousedown:fe,onMouseenter:T,onMouseout:M},t.h(Up,{position:$,centerX:_e,centerY:ke,radius:i.value,type:"target","data-type":"target"}))]:null]])};function T(){S.value=!0}function M(){S.value=!1}function Y(V,F){x.update({event:V,edge:b.value,connection:F})}function z(V){x.updateEnd({event:V,edge:b.value}),v.value=!1}function H(V,F){V.button===0&&(v.value=!0,D.value=F?b.value.target:b.value.source,L.value=(F?b.value.targetHandle:b.value.sourceHandle)??null,k.value=F?"target":"source",x.updateStart({event:V,edge:b.value}),P(V))}function Z(V){var F;const R={event:V,edge:b.value};I.value&&(l.value=!1,b.value.selected&&m.value?(d([b.value]),(F=J.value)==null||F.blur()):o([b.value])),x.click(R)}function ie(V){x.contextMenu({event:V,edge:b.value})}function be(V){x.doubleClick({event:V,edge:b.value})}function ee(V){x.mouseEnter({event:V,edge:b.value})}function re(V){x.mouseMove({event:V,edge:b.value})}function le(V){x.mouseLeave({event:V,edge:b.value})}function ue(V){H(V,!0)}function fe(V){H(V,!1)}function B(V){var F;!y.value&&Wf.includes(V.key)&&I.value&&(V.key==="Escape"?((F=J.value)==null||F.blur(),d([f(e.id)])):o([f(e.id)]))}}}),dT=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:r,connectionEndHandle:i,connectionPosition:a,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:f,findNode:u}=Le(),p=(e=t.inject(Fi))==null?void 0:e["connection-line"],m=t.computed(()=>{var w;return u((w=r.value)==null?void 0:w.nodeId)}),y=t.computed(()=>{var w;return u((w=i.value)==null?void 0:w.nodeId)??null}),_=t.computed(()=>({x:(a.value.x-f.value.x)/f.value.zoom,y:(a.value.y-f.value.y)/f.value.zoom})),g=t.computed(()=>c.value.markerStart?`url(#${wr(c.value.markerStart,n)})`:""),h=t.computed(()=>c.value.markerEnd?`url(#${wr(c.value.markerEnd,n)})`:"");return()=>{var w,b,x;if(!m.value||!r.value)return null;const E=r.value.id,C=r.value.type,N=m.value.handleBounds;let S=(N==null?void 0:N[C])??[];if(o.value===wn.Loose){const K=(N==null?void 0:N[C==="source"?"target":"source"])??[];S=[...S,...K]}if(!S)return null;const v=(E?S.find(K=>K.id===E):S[0])??null,D=(v==null?void 0:v.position)??Ee.Top,{x:L,y:k}=To(m.value,v,D);let J=null;y.value&&(o.value===wn.Strict?J=((w=y.value.handleBounds[C==="source"?"target":"source"])==null?void 0:w.find(K=>{var O;return K.id===((O=i.value)==null?void 0:O.id)}))||null:J=((b=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:b.find(K=>{var O;return K.id===((O=i.value)==null?void 0:O.id)}))||null);const I=((x=i.value)==null?void 0:x.position)??(D?Ql[D]:null);if(!D||!I)return null;const G=l.value??c.value.type??qn.Bezier;let j="";const te={sourceX:L,sourceY:k,sourcePosition:D,targetX:_.value.x,targetY:_.value.y,targetPosition:I};return G===qn.Bezier?[j]=Vp(te):G===qn.Step?[j]=is({...te,borderRadius:0}):G===qn.SmoothStep?[j]=is(te):G===qn.SimpleBezier?[j]=Dp(te):j=`M${L},${k} ${_.value.x},${_.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:L,sourceY:k,sourcePosition:D,targetX:_.value.x,targetY:_.value.y,targetPosition:I,sourceNode:m.value,sourceHandle:v,targetNode:y.value,targetHandle:J,markerEnd:h.value,markerStart:g.value,connectionStatus:d.value}):t.h("path",{d:j,class:[c.value.class,d,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":h.value,"marker-start":g.value})))}}}),uT=["id","markerWidth","markerHeight","markerUnits","orient"],fT={name:"MarkerType",compatConfig:{MODE:3}},pT=t.defineComponent({...fT,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(gr).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref(gr).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,uT))}}),mT={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},gT={name:"MarkerDefinitions",compatConfig:{MODE:3}},hT=t.defineComponent({...gT,setup(e){const{id:n,edges:o,connectionLineOptions:r,defaultMarkerColor:i}=Le(),a=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const f=wr(d,n);l.has(f)||(typeof d=="object"?s.push({...d,id:f,color:d.color||i.value}):s.push({id:f,color:i.value,type:d}),l.add(f))}};for(const d of[r.value.markerEnd,r.value.markerStart])c(d);for(const d of o.value)for(const f of[d.markerStart,d.markerEnd])c(f);return s.sort((d,f)=>d.id.localeCompare(f.id))});return(l,s)=>(t.openBlock(),t.createElementBlock("svg",mT,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,c=>(t.openBlock(),t.createBlock(pT,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),yT={name:"Edges",compatConfig:{MODE:3}},_T=t.defineComponent({...yT,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:r}=Le();return(i,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(hT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(jA)(l,t.unref(n),t.unref(r))})},[t.createVNode(t.unref(cT),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(dT))],64))}}),bT=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:r,nodesSelectionActive:i,multiSelectionActive:a,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:f,getNodeTypes:u,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:y,ariaLiveMessage:_,snapToGrid:g,snapGrid:h,nodeDragThreshold:w,nodesDraggable:b,elementsSelectable:x,nodesConnectable:E,nodesFocusable:C,hooks:N}=Le(),S=t.ref(null);t.provide(xp,S),t.provide(Sp,e.id);const v=t.inject(Fi),D=t.getCurrentInstance(),L=Tp(),{node:k,parentNode:J}=Ip(e.id),{emit:I,on:G}=cI(k,l),j=t.toRef(()=>typeof k.draggable>"u"?b.value:k.draggable),te=t.toRef(()=>typeof k.selectable>"u"?x.value:k.selectable),K=t.toRef(()=>typeof k.connectable>"u"?E.value:k.connectable),O=t.toRef(()=>typeof k.focusable>"u"?C.value:k.focusable),P=t.computed(()=>te.value||j.value||N.value.nodeClick.hasListeners()||N.value.nodeDoubleClick.hasListeners()||N.value.nodeMouseEnter.hasListeners()||N.value.nodeMouseMove.hasListeners()||N.value.nodeMouseLeave.hasListeners()),T=t.toRef(()=>!!k.dimensions.width&&!!k.dimensions.height),M=t.computed(()=>{const F=k.type||"default",R=v==null?void 0:v[`node-${F}`];if(R)return R;let Q=k.template||u.value[F];if(typeof Q=="string"&&D){const q=Object.keys(D.appContext.components);q&&q.includes(F)&&(Q=t.resolveComponent(F,!1))}return Q&&typeof Q!="string"?Q:(l.error(new lt(Qe.NODE_TYPE_MISSING,Q)),!1)}),Y=vp({id:e.id,el:S,disabled:()=>!j.value,selectable:te,dragHandle:()=>k.dragHandle,onStart(F){I.dragStart(F)},onDrag(F){I.drag(F)},onStop(F){I.dragStop(F)},onClick(F){B(F)}}),z=t.computed(()=>k.class instanceof Function?k.class(k):k.class),H=t.computed(()=>{const F=(k.style instanceof Function?k.style(k):k.style)||{},R=k.width instanceof Function?k.width(k):k.width,Q=k.height instanceof Function?k.height(k):k.height;return!F.width&&R&&(F.width=typeof R=="string"?R:`${R}px`),!F.height&&Q&&(F.height=typeof Q=="string"?Q:`${Q}px`),F}),Z=t.toRef(()=>Number(k.zIndex??H.value.zIndex??0));return f(F=>{(F.includes(e.id)||!F.length)&&be()}),t.onMounted(()=>{t.watch(()=>k.hidden,(F=!1,R,Q)=>{!F&&S.value&&(e.resizeObserver.observe(S.value),Q(()=>{S.value&&e.resizeObserver.unobserve(S.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>k.type,()=>k.sourcePosition,()=>k.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:S.value,forceUpdate:!0}])})}),t.watch([()=>k.position.x,()=>k.position.y,()=>{var F;return(F=J.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=J.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=J.value)==null?void 0:F.computedPosition.z},Z,()=>k.selected,()=>k.dimensions.height,()=>k.dimensions.width,()=>{var F;return(F=J.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=J.value)==null?void 0:F.dimensions.width}],([F,R,Q,q,ae,A])=>{const U={x:F,y:R,z:A+(m.value&&k.selected?1e3:0)};typeof Q<"u"&&typeof q<"u"?k.computedPosition=DA({x:Q,y:q,z:ae},U):k.computedPosition=U},{flush:"post",immediate:!0}),t.watch([()=>k.extent,p],([F,R],[Q,q])=>{(F!==Q||R!==q)&&ie()}),k.extent==="parent"||typeof k.extent=="object"&&"range"in k.extent&&k.extent.range==="parent"?Nl(()=>T).toBe(!0).then(ie):ie(),()=>k.hidden?null:t.h("div",{ref:S,"data-id":k.id,class:["vue-flow__node",`vue-flow__node-${M.value===!1?"default":k.type||"default"}`,{[o.value]:j.value,dragging:Y==null?void 0:Y.value,draggable:j.value,selected:k.selected,selectable:te.value,parent:k.isParent},z.value],style:{visibility:T.value?"visible":"hidden",zIndex:k.computedPosition.z??Z.value,transform:`translate(${k.computedPosition.x}px,${k.computedPosition.y}px)`,pointerEvents:P.value?"all":"none",...H.value},tabIndex:O.value?0:void 0,role:O.value?"group":void 0,"aria-describedby":y.value?void 0:`${Hf}-${n}`,"aria-label":k.ariaLabel,"aria-roledescription":"node",...k.domAttributes,onMouseenter:ee,onMousemove:re,onMouseleave:le,onContextmenu:ue,onClick:B,onDblclick:fe,onKeydown:V},[t.h(M.value===!1?u.value.default:M.value,{id:k.id,type:k.type,data:k.data,events:{...k.events,...G},selected:k.selected,resizing:k.resizing,dragging:Y.value,connectable:K.value,position:k.computedPosition,dimensions:k.dimensions,isValidTargetPos:k.isValidTargetPos,isValidSourcePos:k.isValidSourcePos,parent:k.parentNode,parentNodeId:k.parentNode,zIndex:k.computedPosition.z??Z.value,targetPosition:k.targetPosition,sourcePosition:k.sourcePosition,label:k.label,dragHandle:k.dragHandle,onUpdateNodeInternals:be})]);function ie(){const F=k.computedPosition,{computedPosition:R,position:Q}=Xl(k,g.value?Mi(F,h.value):F,l.error,p.value,J.value);(k.computedPosition.x!==R.x||k.computedPosition.y!==R.y)&&(k.computedPosition={...k.computedPosition,...R}),(k.position.x!==Q.x||k.position.y!==Q.y)&&(k.position=Q)}function be(){S.value&&d([{id:e.id,nodeElement:S.value,forceUpdate:!0}])}function ee(F){Y!=null&&Y.value||I.mouseEnter({event:F,node:k})}function re(F){Y!=null&&Y.value||I.mouseMove({event:F,node:k})}function le(F){Y!=null&&Y.value||I.mouseLeave({event:F,node:k})}function ue(F){return I.contextMenu({event:F,node:k})}function fe(F){return I.doubleClick({event:F,node:k})}function B(F){te.value&&(!r.value||!j.value||w.value>0)&&es(k,a.value,c,s,i,!1,S.value),I.click({event:F,node:k})}function V(F){if(!(zl(F)||y.value))if(Wf.includes(F.key)&&te.value){const R=F.key==="Escape";es(k,a.value,c,s,i,R,S.value)}else j.value&&k.selected&&Io[F.key]&&(F.preventDefault(),_.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~k.position.x}, y: ${~~k.position.y}`,L({x:Io[F.key].x,y:Io[F.key].y},F.shiftKey))}}});function wT(e={includeHiddenNodes:!1}){const{nodes:n}=Le();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const kT={class:"vue-flow__nodes vue-flow__container"},CT={name:"Nodes",compatConfig:{MODE:3}},ET=t.defineComponent({...CT,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:r}=Le(),i=wT(),a=t.ref();return t.watch(i,l=>{l&&t.nextTick(()=>{r.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{a.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=a.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",kT,[a.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,f,u)=>{const p=[c.id];if(u&&u.key===c.id&&t.isMemoSame(u,p))return u;const m=(t.openBlock(),t.createBlock(t.unref(bT),{id:c.id,key:c.id,"resize-observer":a.value},null,8,["id","resize-observer"]));return m.memo=p,m},s,0),128)):t.createCommentVNode("",!0)]))}});function NT(){const{emits:e}=Le();t.onMounted(()=>{if(bp()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new lt(Qe.MISSING_STYLES))}})}const ST=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),xT={name:"VueFlow",compatConfig:{MODE:3}},Kp=t.defineComponent({...xT,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const r=e,i=t.useSlots(),a=Sl(r,"modelValue",o),l=Sl(r,"nodes",o),s=Sl(r,"edges",o),c=Le(r),d=pI({modelValue:a,nodes:l,edges:s},r,c);return gI(o,c.hooks),aT(),NT(),t.provide(Fi,i),t.onUnmounted(()=>{d()}),n(c),(f,u)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(eT,null,{default:t.withCtx(()=>[t.createVNode(_T),ST,t.createVNode(ET),t.renderSlot(f.$slots,"zoom-pane")]),_:3}),t.renderSlot(f.$slots,"default"),t.createVNode(iT)],512))}}),vT={name:"Panel",compatConfig:{MODE:3}},AT=t.defineComponent({...vT,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=Le(),r=t.computed(()=>`${n.position}`.split("-"));return(i,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",r.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(i.$slots,"default")],6))}});var fn=(e=>(e.Lines="lines",e.Dots="dots",e))(fn||{});const jp=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Gp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};fn.Lines+"",fn.Dots+"";const IT={[fn.Dots]:"#81818a",[fn.Lines]:"#eee"},TT=["id","x","y","width","height","patternTransform"],PT={key:2,height:"100",width:"100"},OT=["fill"],$T=["x","y","fill"],BT={name:"Background",compatConfig:{MODE:3}},VT=t.defineComponent({...BT,props:{id:{},variant:{default:()=>fn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=Le(),r=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],f=e.size*l,[u,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[u*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:m,size:f}}),i=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),a=t.toRef(()=>e.color||e.patternColor||IT[e.variant||fn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:i.value},()=>[t.createElementVNode("pattern",{id:i.value,x:t.unref(o).x%r.value.scaledGap[0],y:t.unref(o).y%r.value.scaledGap[1],width:r.value.scaledGap[0],height:r.value.scaledGap[1],patternTransform:`translate(-${r.value.offset[0]},-${r.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(fn).Lines?(t.openBlock(),t.createBlock(t.unref(jp),{key:0,size:l.lineWidth,color:a.value,dimensions:r.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(fn).Dots?(t.openBlock(),t.createBlock(t.unref(Gp),{key:1,color:a.value,radius:r.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",PT,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,OT)])):t.createCommentVNode("",!0)])],8,TT)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,$T),t.renderSlot(l.$slots,"default",{id:i.value})],4))}}),RT={name:"ControlButton",compatConfig:{MODE:3}},DT=(e,n)=>{const o=e.__vccOpts||e;for(const[r,i]of n)o[r]=i;return o},MT={class:"vue-flow__controls-button"};function LT(e,n,o,r,i,a){return t.openBlock(),t.createElementBlock("button",MT,[t.renderSlot(e.$slots,"default")])}const kr=DT(RT,[["render",LT]]),FT={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},UT=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function KT(e,n){return t.openBlock(),t.createElementBlock("svg",FT,UT)}const jT={render:KT},GT={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},qT=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function zT(e,n){return t.openBlock(),t.createElementBlock("svg",GT,qT)}const HT={render:zT},YT={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},WT=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function XT(e,n){return t.openBlock(),t.createElementBlock("svg",YT,WT)}const ZT={render:XT},JT={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},QT=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function eP(e,n){return t.openBlock(),t.createElementBlock("svg",JT,QT)}const tP={render:eP},nP={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},oP=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function rP(e,n){return t.openBlock(),t.createElementBlock("svg",nP,oP)}const iP={render:rP},aP={name:"Controls",compatConfig:{MODE:3}},lP=t.defineComponent({...aP,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>qf.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:r,elementsSelectable:i,setInteractive:a,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:f,maxZoom:u}=Le(),p=t.toRef(()=>o.value||r.value||i.value),m=t.toRef(()=>d.value.zoom<=f.value),y=t.toRef(()=>d.value.zoom>=u.value);function _(){l(),n("zoomIn")}function g(){s(),n("zoomOut")}function h(){c(e.fitViewParams),n("fitView")}function w(){a(!p.value),n("interactionChange",!p.value)}return(b,x)=>(t.openBlock(),t.createBlock(t.unref(AT),{class:"vue-flow__controls",position:b.position},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"top"),b.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(b.$slots,"control-zoom-in",{},()=>[t.createVNode(kr,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(jT))))])]),_:3},8,["disabled"])]),t.renderSlot(b.$slots,"control-zoom-out",{},()=>[t.createVNode(kr,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(HT))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),b.showFitView?t.renderSlot(b.$slots,"control-fit-view",{key:1},()=>[t.createVNode(kr,{class:"vue-flow__controls-fitview",onClick:h},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(ZT))))])]),_:3})]):t.createCommentVNode("",!0),b.showInteractive?t.renderSlot(b.$slots,"control-interactive",{key:2},()=>[b.showInteractive?(t.openBlock(),t.createBlock(kr,{key:0,class:"vue-flow__controls-interactive",onClick:w},{default:t.withCtx(()=>[p.value?t.renderSlot(b.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(iP))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(b.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(tP))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(b.$slots,"default")]),_:3},8,["position"]))}}),sP=["undo","redo","duplicate","cut","copy","paste"],qp=()=>{};function cP(e){const n=e;return n?!!n.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'):!1}function dP(e){if(!(e.metaKey||e.ctrlKey))return;switch(e.key.toLowerCase()){case"z":return e.shiftKey?"redo":"undo";case"y":return"redo";case"d":return"duplicate";case"x":return"cut";case"c":return"copy";case"v":return"paste"}}const uP=Ye.createSharedComposable(()=>{const e=new Set;Ye.useEventListener("keydown",o=>{if(cP(o.target))return;const r=dP(o);if(r)for(const i of e){if(!t.toValue(i.enabled))continue;const a=i[r];if(a){if(o.defaultPrevented){t.warn(`[useHotkeys] event for "${r}" was already defaultPrevented. Hotkey ignored.`);return}o.preventDefault(),a();return}}},{passive:!1});function n(o){if(!sP.some(i=>typeof o[i]=="function"))return qp;const r={enabled:o.enabled??!0,...o};return e.add(r),()=>e.delete(r)}return{subscribe:n}});function zp(e={}){if(typeof window>"u")return qp;const n=uP().subscribe(e);return t.onScopeDispose(n),n}const Cr={padding:80,gaps:{nodes:40,edges:80,ranks:40}},fP=1600,pP=1.2,mP=0,gP=200,Hp=Symbol("confirm-modal"),Po="{key}",Wn={"kong.client.consumer":{dataType:"object",writable:!1,readable:!0},"kong.client.consumer_groups":{dataType:"array",writable:!1,readable:!0},"kong.client.credential":{dataType:"object",writable:!1,readable:!0},"kong.client.get_identity_realm_source":{dataType:"object",writable:!1,readable:!0},"kong.client.forwarded_ip":{dataType:"string",writable:!1,readable:!0},"kong.client.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.client.ip":{dataType:"string",writable:!1,readable:!0},"kong.client.port":{dataType:"number",writable:!1,readable:!0},"kong.client.protocol":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_host":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.request.forwarded_scheme":{dataType:"string",writable:!1,readable:!0},"kong.request.port":{dataType:"number",writable:!1,readable:!0},"kong.response.source":{dataType:"string",writable:!1,readable:!0},"kong.router.route":{dataType:"object",writable:!1,readable:!0},"kong.route_id":{dataType:"string",writable:!1,readable:!0},"kong.route_name":{dataType:"string",writable:!1,readable:!0},"kong.router.service":{dataType:"object",writable:!1,readable:!0},"kong.service_name":{dataType:"string",writable:!1,readable:!0},"kong.service_id":{dataType:"string",writable:!1,readable:!0},"kong.service.response.status":{dataType:"number",writable:!1,readable:!0},"kong.version":{dataType:"string",writable:!1,readable:!0},"kong.node.id":{dataType:"string",writable:!1,readable:!0},"kong.configuration.{key}":{dataType:"any",writable:!1,readable:!0},"kong.service.target":{dataType:"string ({host}:{port})",writable:!0,readable:!1},"kong.service.request_scheme":{dataType:"string ({scheme})",writable:!0,readable:!1},"kong.ctx.plugin.{key}":{dataType:"any",writable:!0,readable:!0},"kong.ctx.shared.{key}":{dataType:"any",writable:!0,readable:!0}},Hi=Object.keys(Wn).filter(e=>e.includes(Po)).map(e=>e.replace(Po,""));function ls(e){if(!e||!Nr(e))return;const n=Hi.find(o=>e.startsWith(o));if(n)return e.slice(n.length).replace(Po,"")}function Er(e){if(!e)return null;const n=Hi.find(o=>e.startsWith(o));return n||e}function Nr(e){return e?Hi.some(n=>e.startsWith(n)):!1}function Yp(e){return e?Nr(e)?Er(e)+Po:e:null}function ss(e){var o;if(!e)return!1;const n=Yp(e);return n?((o=Wn[n])==null?void 0:o.readable)??!1:!1}function cs(e){var o;if(!e)return!1;const n=Yp(e);return n?((o=Wn[n])==null?void 0:o.writable)??!1:!1}function hP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yP="\0",Xn="\0",Wp="";let _P=class{constructor(n){ot(this,"_isDirected",!0);ot(this,"_isMultigraph",!1);ot(this,"_isCompound",!1);ot(this,"_label");ot(this,"_defaultNodeLabelFn",()=>{});ot(this,"_defaultEdgeLabelFn",()=>{});ot(this,"_nodes",{});ot(this,"_in",{});ot(this,"_preds",{});ot(this,"_out",{});ot(this,"_sucs",{});ot(this,"_edgeObjs",{});ot(this,"_edgeLabels",{});ot(this,"_nodeCount",0);ot(this,"_edgeCount",0);ot(this,"_parent");ot(this,"_children");n&&(this._isDirected=Object.hasOwn(n,"directed")?n.directed:!0,this._isMultigraph=Object.hasOwn(n,"multigraph")?n.multigraph:!1,this._isCompound=Object.hasOwn(n,"compound")?n.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Xn]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(n){return this._label=n,this}graph(){return this._label}setDefaultNodeLabel(n){return this._defaultNodeLabelFn=n,typeof n!="function"&&(this._defaultNodeLabelFn=()=>n),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var n=this;return this.nodes().filter(o=>Object.keys(n._in[o]).length===0)}sinks(){var n=this;return this.nodes().filter(o=>Object.keys(n._out[o]).length===0)}setNodes(n,o){var r=arguments,i=this;return n.forEach(function(a){r.length>1?i.setNode(a,o):i.setNode(a)}),this}setNode(n,o){return Object.hasOwn(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=o),this):(this._nodes[n]=arguments.length>1?o:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=Xn,this._children[n]={},this._children[Xn][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)}node(n){return this._nodes[n]}hasNode(n){return Object.hasOwn(this._nodes,n)}removeNode(n){var o=this;if(Object.hasOwn(this._nodes,n)){var r=i=>o.removeEdge(o._edgeObjs[i]);delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],this.children(n).forEach(function(i){o.setParent(i)}),delete this._children[n]),Object.keys(this._in[n]).forEach(r),delete this._in[n],delete this._preds[n],Object.keys(this._out[n]).forEach(r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this}setParent(n,o){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(o===void 0)o=Xn;else{o+="";for(var r=o;r!==void 0;r=this.parent(r))if(r===n)throw new Error("Setting "+o+" as parent of "+n+" would create a cycle");this.setNode(o)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=o,this._children[o][n]=!0,this}_removeFromParentsChildList(n){delete this._children[this._parent[n]][n]}parent(n){if(this._isCompound){var o=this._parent[n];if(o!==Xn)return o}}children(n=Xn){if(this._isCompound){var o=this._children[n];if(o)return Object.keys(o)}else{if(n===Xn)return this.nodes();if(this.hasNode(n))return[]}}predecessors(n){var o=this._preds[n];if(o)return Object.keys(o)}successors(n){var o=this._sucs[n];if(o)return Object.keys(o)}neighbors(n){var o=this.predecessors(n);if(o){const i=new Set(o);for(var r of this.successors(n))i.add(r);return Array.from(i.values())}}isLeaf(n){var o;return this.isDirected()?o=this.successors(n):o=this.neighbors(n),o.length===0}filterNodes(n){var o=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});o.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([l,s]){n(l)&&o.setNode(l,s)}),Object.values(this._edgeObjs).forEach(function(l){o.hasNode(l.v)&&o.hasNode(l.w)&&o.setEdge(l,r.edge(l))});var i={};function a(l){var s=r.parent(l);return s===void 0||o.hasNode(s)?(i[l]=s,s):s in i?i[s]:a(s)}return this._isCompound&&o.nodes().forEach(l=>o.setParent(l,a(l))),o}setDefaultEdgeLabel(n){return this._defaultEdgeLabelFn=n,typeof n!="function"&&(this._defaultEdgeLabelFn=()=>n),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(n,o){var r=this,i=arguments;return n.reduce(function(a,l){return i.length>1?r.setEdge(a,l,o):r.setEdge(a,l),l}),this}setEdge(){var n,o,r,i,a=!1,l=arguments[0];typeof l=="object"&&l!==null&&"v"in l?(n=l.v,o=l.w,r=l.name,arguments.length===2&&(i=arguments[1],a=!0)):(n=l,o=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),n=""+n,o=""+o,r!==void 0&&(r=""+r);var s=Sr(this._isDirected,n,o,r);if(Object.hasOwn(this._edgeLabels,s))return a&&(this._edgeLabels[s]=i),this;if(r!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(o),this._edgeLabels[s]=a?i:this._defaultEdgeLabelFn(n,o,r);var c=bP(this._isDirected,n,o,r);return n=c.v,o=c.w,Object.freeze(c),this._edgeObjs[s]=c,Xp(this._preds[o],n),Xp(this._sucs[n],o),this._in[o][s]=c,this._out[n][s]=c,this._edgeCount++,this}edge(n,o,r){var i=arguments.length===1?ds(this._isDirected,arguments[0]):Sr(this._isDirected,n,o,r);return this._edgeLabels[i]}edgeAsObj(){const n=this.edge(...arguments);return typeof n!="object"?{label:n}:n}hasEdge(n,o,r){var i=arguments.length===1?ds(this._isDirected,arguments[0]):Sr(this._isDirected,n,o,r);return Object.hasOwn(this._edgeLabels,i)}removeEdge(n,o,r){var i=arguments.length===1?ds(this._isDirected,arguments[0]):Sr(this._isDirected,n,o,r),a=this._edgeObjs[i];return a&&(n=a.v,o=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],Zp(this._preds[o],n),Zp(this._sucs[n],o),delete this._in[o][i],delete this._out[n][i],this._edgeCount--),this}inEdges(n,o){var r=this._in[n];if(r){var i=Object.values(r);return o?i.filter(a=>a.v===o):i}}outEdges(n,o){var r=this._out[n];if(r){var i=Object.values(r);return o?i.filter(a=>a.w===o):i}}nodeEdges(n,o){var r=this.inEdges(n,o);if(r)return r.concat(this.outEdges(n,o))}};function Xp(e,n){e[n]?e[n]++:e[n]=1}function Zp(e,n){--e[n]||delete e[n]}function Sr(e,n,o,r){var i=""+n,a=""+o;if(!e&&i>a){var l=i;i=a,a=l}return i+Wp+a+Wp+(r===void 0?yP:r)}function bP(e,n,o,r){var i=""+n,a=""+o;if(!e&&i>a){var l=i;i=a,a=l}var s={v:i,w:a};return r&&(s.name=r),s}function ds(e,n){return Sr(e,n.v,n.w,n.name)}var us=_P,wP="2.2.4",kP={Graph:us,version:wP},CP=us,EP={write:NP,read:vP};function NP(e){var n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:SP(e),edges:xP(e)};return e.graph()!==void 0&&(n.value=structuredClone(e.graph())),n}function SP(e){return e.nodes().map(function(n){var o=e.node(n),r=e.parent(n),i={v:n};return o!==void 0&&(i.value=o),r!==void 0&&(i.parent=r),i})}function xP(e){return e.edges().map(function(n){var o=e.edge(n),r={v:n.v,w:n.w};return n.name!==void 0&&(r.name=n.name),o!==void 0&&(r.value=o),r})}function vP(e){var n=new CP(e.options).setGraph(e.value);return e.nodes.forEach(function(o){n.setNode(o.v,o.value),o.parent&&n.setParent(o.v,o.parent)}),e.edges.forEach(function(o){n.setEdge({v:o.v,w:o.w,name:o.name},o.value)}),n}var AP=IP;function IP(e){var n={},o=[],r;function i(a){Object.hasOwn(n,a)||(n[a]=!0,r.push(a),e.successors(a).forEach(i),e.predecessors(a).forEach(i))}return e.nodes().forEach(function(a){r=[],i(a),r.length&&o.push(r)}),o}var Jp=class{constructor(){ot(this,"_arr",[]);ot(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var o=this._keyIndices[n];if(o!==void 0)return this._arr[o].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,o){var r=this._keyIndices;if(n=String(n),!Object.hasOwn(r,n)){var i=this._arr,a=i.length;return r[n]=a,i.push({key:n,priority:o}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,o){var r=this._keyIndices[n];if(o>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[r].priority+" New: "+o);this._arr[r].priority=o,this._decrease(r)}_heapify(n){var o=this._arr,r=2*n,i=r+1,a=n;r<o.length&&(a=o[r].priority<o[a].priority?r:a,i<o.length&&(a=o[i].priority<o[a].priority?i:a),a!==n&&(this._swap(n,a),this._heapify(a)))}_decrease(n){for(var o=this._arr,r=o[n].priority,i;n!==0&&(i=n>>1,!(o[i].priority<r));)this._swap(n,i),n=i}_swap(n,o){var r=this._arr,i=this._keyIndices,a=r[n],l=r[o];r[n]=l,r[o]=a,i[l.key]=n,i[a.key]=o}},TP=Jp,Qp=OP,PP=()=>1;function OP(e,n,o,r){return $P(e,String(n),o||PP,r||function(i){return e.outEdges(i)})}function $P(e,n,o,r){var i={},a=new TP,l,s,c=function(d){var f=d.v!==l?d.v:d.w,u=i[f],p=o(d),m=s.distance+p;if(p<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+d+" Weight: "+p);m<u.distance&&(u.distance=m,u.predecessor=l,a.decrease(f,m))};for(e.nodes().forEach(function(d){var f=d===n?0:Number.POSITIVE_INFINITY;i[d]={distance:f},a.add(d,f)});a.size()>0&&(l=a.removeMin(),s=i[l],s.distance!==Number.POSITIVE_INFINITY);)r(l).forEach(c);return i}var BP=Qp,VP=RP;function RP(e,n,o){return e.nodes().reduce(function(r,i){return r[i]=BP(e,i,n,o),r},{})}var em=DP;function DP(e){var n=0,o=[],r={},i=[];function a(l){var s=r[l]={onStack:!0,lowlink:n,index:n++};if(o.push(l),e.successors(l).forEach(function(f){Object.hasOwn(r,f)?r[f].onStack&&(s.lowlink=Math.min(s.lowlink,r[f].index)):(a(f),s.lowlink=Math.min(s.lowlink,r[f].lowlink))}),s.lowlink===s.index){var c=[],d;do d=o.pop(),r[d].onStack=!1,c.push(d);while(l!==d);i.push(c)}}return e.nodes().forEach(function(l){Object.hasOwn(r,l)||a(l)}),i}var MP=em,LP=FP;function FP(e){return MP(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})}var UP=jP,KP=()=>1;function jP(e,n,o){return GP(e,n||KP,o||function(r){return e.outEdges(r)})}function GP(e,n,o){var r={},i=e.nodes();return i.forEach(function(a){r[a]={},r[a][a]={distance:0},i.forEach(function(l){a!==l&&(r[a][l]={distance:Number.POSITIVE_INFINITY})}),o(a).forEach(function(l){var s=l.v===a?l.w:l.v,c=n(l);r[a][s]={distance:c,predecessor:a}})}),i.forEach(function(a){var l=r[a];i.forEach(function(s){var c=r[s];i.forEach(function(d){var f=c[a],u=l[d],p=c[d],m=f.distance+u.distance;m<p.distance&&(p.distance=m,p.predecessor=u.predecessor)})})}),r}function tm(e){var n={},o={},r=[];function i(a){if(Object.hasOwn(o,a))throw new fs;Object.hasOwn(n,a)||(o[a]=!0,n[a]=!0,e.predecessors(a).forEach(i),delete o[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(n).length!==e.nodeCount())throw new fs;return r}class fs extends Error{constructor(){super(...arguments)}}var nm=tm;tm.CycleException=fs;var om=nm,qP=zP;function zP(e){try{om(e)}catch(n){if(n instanceof om.CycleException)return!1;throw n}return!0}var rm=HP;function HP(e,n,o){Array.isArray(n)||(n=[n]);var r=e.isDirected()?s=>e.successors(s):s=>e.neighbors(s),i=o==="post"?YP:WP,a=[],l={};return n.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,l,a)}),a}function YP(e,n,o,r){for(var i=[[e,!1]];i.length>0;){var a=i.pop();a[1]?r.push(a[0]):Object.hasOwn(o,a[0])||(o[a[0]]=!0,i.push([a[0],!0]),im(n(a[0]),l=>i.push([l,!1])))}}function WP(e,n,o,r){for(var i=[e];i.length>0;){var a=i.pop();Object.hasOwn(o,a)||(o[a]=!0,r.push(a),im(n(a),l=>i.push(l)))}}function im(e,n){for(var o=e.length;o--;)n(e[o],o,e);return e}var XP=rm,ZP=JP;function JP(e,n){return XP(e,n,"post")}var QP=rm,eO=tO;function tO(e,n){return QP(e,n,"pre")}var nO=us,oO=Jp,rO=iO;function iO(e,n){var o=new nO,r={},i=new oO,a;function l(c){var d=c.v===a?c.w:c.v,f=i.priority(d);if(f!==void 0){var u=n(c);u<f&&(r[d]=a,i.decrease(d,u))}}if(e.nodeCount()===0)return o;e.nodes().forEach(function(c){i.add(c,Number.POSITIVE_INFINITY),o.setNode(c)}),i.decrease(e.nodes()[0],0);for(var s=!1;i.size()>0;){if(a=i.removeMin(),Object.hasOwn(r,a))o.setEdge(a,r[a]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(a).forEach(l)}return o}var aO={components:AP,dijkstra:Qp,dijkstraAll:VP,findCycles:LP,floydWarshall:UP,isAcyclic:qP,postorder:ZP,preorder:eO,prim:rO,tarjan:em,topsort:nm},am=kP,jt={Graph:am.Graph,json:EP,alg:aO,version:am.version};let lO=class{constructor(){let n={};n._next=n._prev=n,this._sentinel=n}dequeue(){let n=this._sentinel,o=n._prev;if(o!==n)return lm(o),o}enqueue(n){let o=this._sentinel;n._prev&&n._next&&lm(n),n._next=o._next,o._next._prev=n,o._next=n,n._prev=o}toString(){let n=[],o=this._sentinel,r=o._prev;for(;r!==o;)n.push(JSON.stringify(r,sO)),r=r._prev;return"["+n.join(", ")+"]"}};function lm(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function sO(e,n){if(e!=="_next"&&e!=="_prev")return n}var cO=lO;let dO=jt.Graph,uO=cO;var fO=mO;let pO=()=>1;function mO(e,n){if(e.nodeCount()<=1)return[];let o=hO(e,n||pO);return gO(o.graph,o.buckets,o.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function gO(e,n,o){let r=[],i=n[n.length-1],a=n[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)ps(e,n,o,l);for(;l=i.dequeue();)ps(e,n,o,l);if(e.nodeCount()){for(let s=n.length-2;s>0;--s)if(l=n[s].dequeue(),l){r=r.concat(ps(e,n,o,l,!0));break}}}return r}function ps(e,n,o,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(l=>{let s=e.edge(l),c=e.node(l.v);i&&a.push({v:l.v,w:l.w}),c.out-=s,ms(n,o,c)}),e.outEdges(r.v).forEach(l=>{let s=e.edge(l),c=l.w,d=e.node(c);d.in-=s,ms(n,o,d)}),e.removeNode(r.v),a}function hO(e,n){let o=new dO,r=0,i=0;e.nodes().forEach(s=>{o.setNode(s,{v:s,in:0,out:0})}),e.edges().forEach(s=>{let c=o.edge(s.v,s.w)||0,d=n(s),f=c+d;o.setEdge(s.v,s.w,f),i=Math.max(i,o.node(s.v).out+=d),r=Math.max(r,o.node(s.w).in+=d)});let a=yO(i+r+3).map(()=>new uO),l=r+1;return o.nodes().forEach(s=>{ms(a,l,o.node(s))}),{graph:o,buckets:a,zeroIdx:l}}function ms(e,n,o){o.out?o.in?e[o.out-o.in+n].enqueue(o):e[e.length-1].enqueue(o):e[0].enqueue(o)}function yO(e){const n=[];for(let o=0;o<e;o++)n.push(o);return n}let sm=jt.Graph;var tt={addBorderNode:xO,addDummyNode:cm,applyWithChunking:Yi,asNonCompoundGraph:bO,buildLayerMatrix:EO,intersectRect:CO,mapValues:$O,maxRank:um,normalizeRanks:NO,notime:TO,partition:AO,pick:OO,predecessorWeights:kO,range:pm,removeEmptyRanks:SO,simplify:_O,successorWeights:wO,time:IO,uniqueId:fm,zipObject:gs};function cm(e,n,o,r){for(var i=r;e.hasNode(i);)i=fm(r);return o.dummy=n,e.setNode(i,o),i}function _O(e){let n=new sm().setGraph(e.graph());return e.nodes().forEach(o=>n.setNode(o,e.node(o))),e.edges().forEach(o=>{let r=n.edge(o.v,o.w)||{weight:0,minlen:1},i=e.edge(o);n.setEdge(o.v,o.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),n}function bO(e){let n=new sm({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(o=>{e.children(o).length||n.setNode(o,e.node(o))}),e.edges().forEach(o=>{n.setEdge(o,e.edge(o))}),n}function wO(e){let n=e.nodes().map(o=>{let r={};return e.outEdges(o).forEach(i=>{r[i.w]=(r[i.w]||0)+e.edge(i).weight}),r});return gs(e.nodes(),n)}function kO(e){let n=e.nodes().map(o=>{let r={};return e.inEdges(o).forEach(i=>{r[i.v]=(r[i.v]||0)+e.edge(i).weight}),r});return gs(e.nodes(),n)}function CO(e,n){let o=e.x,r=e.y,i=n.x-o,a=n.y-r,l=e.width/2,s=e.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let c,d;return Math.abs(a)*l>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,d=s):(i<0&&(l=-l),c=l,d=l*a/i),{x:o+c,y:r+d}}function EO(e){let n=pm(um(e)+1).map(()=>[]);return e.nodes().forEach(o=>{let r=e.node(o),i=r.rank;i!==void 0&&(n[i][r.order]=o)}),n}function NO(e){let n=e.nodes().map(r=>{let i=e.node(r).rank;return i===void 0?Number.MAX_VALUE:i}),o=Yi(Math.min,n);e.nodes().forEach(r=>{let i=e.node(r);Object.hasOwn(i,"rank")&&(i.rank-=o)})}function SO(e){let n=e.nodes().map(l=>e.node(l).rank),o=Yi(Math.min,n),r=[];e.nodes().forEach(l=>{let s=e.node(l).rank-o;r[s]||(r[s]=[]),r[s].push(l)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((l,s)=>{l===void 0&&s%a!==0?--i:l!==void 0&&i&&l.forEach(c=>e.node(c).rank+=i)})}function xO(e,n,o,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=o,i.order=r),cm(e,"border",i,n)}function vO(e,n=dm){const o=[];for(let r=0;r<e.length;r+=n){const i=e.slice(r,r+n);o.push(i)}return o}const dm=65535;function Yi(e,n){if(n.length>dm){const o=vO(n);return e.apply(null,o.map(r=>e.apply(null,r)))}else return e.apply(null,n)}function um(e){const o=e.nodes().map(r=>{let i=e.node(r).rank;return i===void 0?Number.MIN_VALUE:i});return Yi(Math.max,o)}function AO(e,n){let o={lhs:[],rhs:[]};return e.forEach(r=>{n(r)?o.lhs.push(r):o.rhs.push(r)}),o}function IO(e,n){let o=Date.now();try{return n()}finally{console.log(e+" time: "+(Date.now()-o)+"ms")}}function TO(e,n){return n()}let PO=0;function fm(e){var n=++PO;return e+(""+n)}function pm(e,n,o=1){n==null&&(n=e,e=0);let r=a=>a<n;o<0&&(r=a=>n<a);const i=[];for(let a=e;r(a);a+=o)i.push(a);return i}function OO(e,n){const o={};for(const r of n)e[r]!==void 0&&(o[r]=e[r]);return o}function $O(e,n){let o=n;return typeof n=="string"&&(o=r=>r[n]),Object.entries(e).reduce((r,[i,a])=>(r[i]=o(a,i),r),{})}function gs(e,n){return e.reduce((o,r,i)=>(o[r]=n[i],o),{})}let BO=fO,VO=tt.uniqueId;var RO={run:DO,undo:LO};function DO(e){(e.graph().acyclicer==="greedy"?BO(e,o(e)):MO(e)).forEach(r=>{let i=e.edge(r);e.removeEdge(r),i.forwardName=r.name,i.reversed=!0,e.setEdge(r.w,r.v,i,VO("rev"))});function o(r){return i=>r.edge(i).weight}}function MO(e){let n=[],o={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,o[a]=!0,e.outEdges(a).forEach(l=>{Object.hasOwn(o,l.w)?n.push(l):i(l.w)}),delete o[a])}return e.nodes().forEach(i),n}function LO(e){e.edges().forEach(n=>{let o=e.edge(n);if(o.reversed){e.removeEdge(n);let r=o.forwardName;delete o.reversed,delete o.forwardName,e.setEdge(n.w,n.v,o,r)}})}let FO=tt;var UO={run:KO,undo:GO};function KO(e){e.graph().dummyChains=[],e.edges().forEach(n=>jO(e,n))}function jO(e,n){let o=n.v,r=e.node(o).rank,i=n.w,a=e.node(i).rank,l=n.name,s=e.edge(n),c=s.labelRank;if(a===r+1)return;e.removeEdge(n);let d,f,u;for(u=0,++r;r<a;++u,++r)s.points=[],f={width:0,height:0,edgeLabel:s,edgeObj:n,rank:r},d=FO.addDummyNode(e,"edge",f,"_d"),r===c&&(f.width=s.width,f.height=s.height,f.dummy="edge-label",f.labelpos=s.labelpos),e.setEdge(o,d,{weight:s.weight},l),u===0&&e.graph().dummyChains.push(d),o=d;e.setEdge(o,i,{weight:s.weight},l)}function GO(e){e.graph().dummyChains.forEach(n=>{let o=e.node(n),r=o.edgeLabel,i;for(e.setEdge(o.edgeObj,r);o.dummy;)i=e.successors(n)[0],e.removeNode(n),r.points.push({x:o.x,y:o.y}),o.dummy==="edge-label"&&(r.x=o.x,r.y=o.y,r.width=o.width,r.height=o.height),n=i,o=e.node(n)})}const{applyWithChunking:qO}=tt;var Wi={longestPath:zO,slack:HO};function zO(e){var n={};function o(r){var i=e.node(r);if(Object.hasOwn(n,r))return i.rank;n[r]=!0;let a=e.outEdges(r).map(s=>s==null?Number.POSITIVE_INFINITY:o(s.w)-e.edge(s).minlen);var l=qO(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(o)}function HO(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}var YO=jt.Graph,Xi=Wi.slack,mm=WO;function WO(e){var n=new YO({directed:!1}),o=e.nodes()[0],r=e.nodeCount();n.setNode(o,{});for(var i,a;XO(n,e)<r;)i=ZO(n,e),a=n.hasNode(i.v)?Xi(e,i):-Xi(e,i),JO(n,e,a);return n}function XO(e,n){function o(r){n.nodeEdges(r).forEach(i=>{var a=i.v,l=r===a?i.w:a;!e.hasNode(l)&&!Xi(n,i)&&(e.setNode(l,{}),e.setEdge(r,l,{}),o(l))})}return e.nodes().forEach(o),e.nodeCount()}function ZO(e,n){return n.edges().reduce((r,i)=>{let a=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=Xi(n,i)),a<r[0]?[a,i]:r},[Number.POSITIVE_INFINITY,null])[1]}function JO(e,n,o){e.nodes().forEach(r=>n.node(r).rank+=o)}var QO=mm,gm=Wi.slack,e$=Wi.longestPath,t$=jt.alg.preorder,n$=jt.alg.postorder,o$=tt.simplify,r$=Zn;Zn.initLowLimValues=ys,Zn.initCutValues=hs,Zn.calcCutValue=hm,Zn.leaveEdge=_m,Zn.enterEdge=bm,Zn.exchangeEdges=wm;function Zn(e){e=o$(e),e$(e);var n=QO(e);ys(n),hs(n,e);for(var o,r;o=_m(n);)r=bm(n,e,o),wm(n,e,o,r)}function hs(e,n){var o=n$(e,e.nodes());o=o.slice(0,o.length-1),o.forEach(r=>i$(e,n,r))}function i$(e,n,o){var r=e.node(o),i=r.parent;e.edge(o,i).cutvalue=hm(e,n,o)}function hm(e,n,o){var r=e.node(o),i=r.parent,a=!0,l=n.edge(o,i),s=0;return l||(a=!1,l=n.edge(i,o)),s=l.weight,n.nodeEdges(o).forEach(c=>{var d=c.v===o,f=d?c.w:c.v;if(f!==i){var u=d===a,p=n.edge(c).weight;if(s+=u?p:-p,l$(e,o,f)){var m=e.edge(o,f).cutvalue;s+=u?-m:m}}}),s}function ys(e,n){arguments.length<2&&(n=e.nodes()[0]),ym(e,{},1,n)}function ym(e,n,o,r,i){var a=o,l=e.node(r);return n[r]=!0,e.neighbors(r).forEach(s=>{Object.hasOwn(n,s)||(o=ym(e,n,o,s,r))}),l.low=a,l.lim=o++,i?l.parent=i:delete l.parent,o}function _m(e){return e.edges().find(n=>e.edge(n).cutvalue<0)}function bm(e,n,o){var r=o.v,i=o.w;n.hasEdge(r,i)||(r=o.w,i=o.v);var a=e.node(r),l=e.node(i),s=a,c=!1;a.lim>l.lim&&(s=l,c=!0);var d=n.edges().filter(f=>c===km(e,e.node(f.v),s)&&c!==km(e,e.node(f.w),s));return d.reduce((f,u)=>gm(n,u)<gm(n,f)?u:f)}function wm(e,n,o,r){var i=o.v,a=o.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),ys(e),hs(e,n),a$(e,n)}function a$(e,n){var o=e.nodes().find(i=>!n.node(i).parent),r=t$(e,o);r=r.slice(1),r.forEach(i=>{var a=e.node(i).parent,l=n.edge(i,a),s=!1;l||(l=n.edge(a,i),s=!0),n.node(i).rank=n.node(a).rank+(s?l.minlen:-l.minlen)})}function l$(e,n,o){return e.hasEdge(n,o)}function km(e,n,o){return o.low<=n.lim&&n.lim<=o.lim}var s$=Wi,Cm=s$.longestPath,c$=mm,d$=r$,u$=f$;function f$(e){var n=e.graph().ranker;if(n instanceof Function)return n(e);switch(e.graph().ranker){case"network-simplex":Em(e);break;case"tight-tree":m$(e);break;case"longest-path":p$(e);break;case"none":break;default:Em(e)}}var p$=Cm;function m$(e){Cm(e),c$(e)}function Em(e){d$(e)}var g$=h$;function h$(e){let n=_$(e);e.graph().dummyChains.forEach(o=>{let r=e.node(o),i=r.edgeObj,a=y$(e,n,i.v,i.w),l=a.path,s=a.lca,c=0,d=l[c],f=!0;for(;o!==i.w;){if(r=e.node(o),f){for(;(d=l[c])!==s&&e.node(d).maxRank<r.rank;)c++;d===s&&(f=!1)}if(!f){for(;c<l.length-1&&e.node(d=l[c+1]).minRank<=r.rank;)c++;d=l[c]}e.setParent(o,d),o=e.successors(o)[0]}})}function y$(e,n,o,r){let i=[],a=[],l=Math.min(n[o].low,n[r].low),s=Math.max(n[o].lim,n[r].lim),c,d;c=o;do c=e.parent(c),i.push(c);while(c&&(n[c].low>l||s>n[c].lim));for(d=c,c=r;(c=e.parent(c))!==d;)a.push(c);return{path:i.concat(a.reverse()),lca:d}}function _$(e){let n={},o=0;function r(i){let a=o;e.children(i).forEach(r),n[i]={low:a,lim:o++}}return e.children().forEach(r),n}let Zi=tt;var b$={run:w$,cleanup:E$};function w$(e){let n=Zi.addDummyNode(e,"root",{},"_root"),o=k$(e),r=Object.values(o),i=Zi.applyWithChunking(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=n,e.edges().forEach(s=>e.edge(s).minlen*=a);let l=C$(e)+1;e.children().forEach(s=>Nm(e,n,a,l,i,o,s)),e.graph().nodeRankFactor=a}function Nm(e,n,o,r,i,a,l){let s=e.children(l);if(!s.length){l!==n&&e.setEdge(n,l,{weight:0,minlen:o});return}let c=Zi.addBorderNode(e,"_bt"),d=Zi.addBorderNode(e,"_bb"),f=e.node(l);e.setParent(c,l),f.borderTop=c,e.setParent(d,l),f.borderBottom=d,s.forEach(u=>{Nm(e,n,o,r,i,a,u);let p=e.node(u),m=p.borderTop?p.borderTop:u,y=p.borderBottom?p.borderBottom:u,_=p.borderTop?r:2*r,g=m!==y?1:i-a[l]+1;e.setEdge(c,m,{weight:_,minlen:g,nestingEdge:!0}),e.setEdge(y,d,{weight:_,minlen:g,nestingEdge:!0})}),e.parent(l)||e.setEdge(n,c,{weight:0,minlen:i+a[l]})}function k$(e){var n={};function o(r,i){var a=e.children(r);a&&a.length&&a.forEach(l=>o(l,i+1)),n[r]=i}return e.children().forEach(r=>o(r,1)),n}function C$(e){return e.edges().reduce((n,o)=>n+e.edge(o).weight,0)}function E$(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,e.edges().forEach(o=>{var r=e.edge(o);r.nestingEdge&&e.removeEdge(o)})}let N$=tt;var S$=x$;function x$(e){function n(o){let r=e.children(o),i=e.node(o);if(r.length&&r.forEach(n),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let a=i.minRank,l=i.maxRank+1;a<l;++a)Sm(e,"borderLeft","_bl",o,i,a),Sm(e,"borderRight","_br",o,i,a)}}e.children().forEach(n)}function Sm(e,n,o,r,i,a){let l={width:0,height:0,rank:a,borderType:n},s=i[n][a-1],c=N$.addDummyNode(e,"border",l,o);i[n][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}var v$={adjust:A$,undo:I$};function A$(e){let n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&xm(e)}function I$(e){let n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&T$(e),(n==="lr"||n==="rl")&&(P$(e),xm(e))}function xm(e){e.nodes().forEach(n=>vm(e.node(n))),e.edges().forEach(n=>vm(e.edge(n)))}function vm(e){let n=e.width;e.width=e.height,e.height=n}function T$(e){e.nodes().forEach(n=>_s(e.node(n))),e.edges().forEach(n=>{let o=e.edge(n);o.points.forEach(_s),Object.hasOwn(o,"y")&&_s(o)})}function _s(e){e.y=-e.y}function P$(e){e.nodes().forEach(n=>bs(e.node(n))),e.edges().forEach(n=>{let o=e.edge(n);o.points.forEach(bs),Object.hasOwn(o,"x")&&bs(o)})}function bs(e){let n=e.x;e.x=e.y,e.y=n}let Am=tt;var O$=$$;function $$(e){let n={},o=e.nodes().filter(c=>!e.children(c).length),r=o.map(c=>e.node(c).rank),i=Am.applyWithChunking(Math.max,r),a=Am.range(i+1).map(()=>[]);function l(c){if(n[c])return;n[c]=!0;let d=e.node(c);a[d.rank].push(c),e.successors(c).forEach(l)}return o.sort((c,d)=>e.node(c).rank-e.node(d).rank).forEach(l),a}let B$=tt.zipObject;var V$=R$;function R$(e,n){let o=0;for(let r=1;r<n.length;++r)o+=D$(e,n[r-1],n[r]);return o}function D$(e,n,o){let r=B$(o,o.map((d,f)=>f)),i=n.flatMap(d=>e.outEdges(d).map(f=>({pos:r[f.w],weight:e.edge(f).weight})).sort((f,u)=>f.pos-u.pos)),a=1;for(;a<o.length;)a<<=1;let l=2*a-1;a-=1;let s=new Array(l).fill(0),c=0;return i.forEach(d=>{let f=d.pos+a;s[f]+=d.weight;let u=0;for(;f>0;)f%2&&(u+=s[f+1]),f=f-1>>1,s[f]+=d.weight;c+=d.weight*u}),c}var M$=L$;function L$(e,n=[]){return n.map(o=>{let r=e.inEdges(o);if(r.length){let i=r.reduce((a,l)=>{let s=e.edge(l),c=e.node(l.v);return{sum:a.sum+s.weight*c.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:o,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:o}})}let F$=tt;var U$=K$;function K$(e,n){let o={};e.forEach((i,a)=>{let l=o[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};i.barycenter!==void 0&&(l.barycenter=i.barycenter,l.weight=i.weight)}),n.edges().forEach(i=>{let a=o[i.v],l=o[i.w];a!==void 0&&l!==void 0&&(l.indegree++,a.out.push(o[i.w]))});let r=Object.values(o).filter(i=>!i.indegree);return j$(r)}function j$(e){let n=[];function o(i){return a=>{a.merged||(a.barycenter===void 0||i.barycenter===void 0||a.barycenter>=i.barycenter)&&G$(i,a)}}function r(i){return a=>{a.in.push(i),--a.indegree===0&&e.push(a)}}for(;e.length;){let i=e.pop();n.push(i),i.in.reverse().forEach(o(i)),i.out.forEach(r(i))}return n.filter(i=>!i.merged).map(i=>F$.pick(i,["vs","i","barycenter","weight"]))}function G$(e,n){let o=0,r=0;e.weight&&(o+=e.barycenter*e.weight,r+=e.weight),n.weight&&(o+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=o/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}let q$=tt;var z$=H$;function H$(e,n){let o=q$.partition(e,f=>Object.hasOwn(f,"barycenter")),r=o.lhs,i=o.rhs.sort((f,u)=>u.i-f.i),a=[],l=0,s=0,c=0;r.sort(Y$(!!n)),c=Im(a,i,c),r.forEach(f=>{c+=f.vs.length,a.push(f.vs),l+=f.barycenter*f.weight,s+=f.weight,c=Im(a,i,c)});let d={vs:a.flat(!0)};return s&&(d.barycenter=l/s,d.weight=s),d}function Im(e,n,o){let r;for(;n.length&&(r=n[n.length-1]).i<=o;)n.pop(),e.push(r.vs),o++;return o}function Y$(e){return(n,o)=>n.barycenter<o.barycenter?-1:n.barycenter>o.barycenter?1:e?o.i-n.i:n.i-o.i}let W$=M$,X$=U$,Z$=z$;var J$=Tm;function Tm(e,n,o,r){let i=e.children(n),a=e.node(n),l=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};l&&(i=i.filter(p=>p!==l&&p!==s));let d=W$(e,i);d.forEach(p=>{if(e.children(p.v).length){let m=Tm(e,p.v,o,r);c[p.v]=m,Object.hasOwn(m,"barycenter")&&eB(p,m)}});let f=X$(d,o);Q$(f,c);let u=Z$(f,r);if(l&&(u.vs=[l,u.vs,s].flat(!0),e.predecessors(l).length)){let p=e.node(e.predecessors(l)[0]),m=e.node(e.predecessors(s)[0]);Object.hasOwn(u,"barycenter")||(u.barycenter=0,u.weight=0),u.barycenter=(u.barycenter*u.weight+p.order+m.order)/(u.weight+2),u.weight+=2}return u}function Q$(e,n){e.forEach(o=>{o.vs=o.vs.flatMap(r=>n[r]?n[r].vs:r)})}function eB(e,n){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight):(e.barycenter=n.barycenter,e.weight=n.weight)}let tB=jt.Graph,nB=tt;var oB=rB;function rB(e,n,o){let r=iB(e),i=new tB({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(a=>e.node(a));return e.nodes().forEach(a=>{let l=e.node(a),s=e.parent(a);(l.rank===n||l.minRank<=n&&n<=l.maxRank)&&(i.setNode(a),i.setParent(a,s||r),e[o](a).forEach(c=>{let d=c.v===a?c.w:c.v,f=i.edge(d,a),u=f!==void 0?f.weight:0;i.setEdge(d,a,{weight:e.edge(c).weight+u})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[n],borderRight:l.borderRight[n]}))}),i}function iB(e){for(var n;e.hasNode(n=nB.uniqueId("_root")););return n}var aB=lB;function lB(e,n,o){let r={},i;o.forEach(a=>{let l=e.parent(a),s,c;for(;l;){if(s=e.parent(l),s?(c=r[s],r[s]=l):(c=i,i=l),c&&c!==l){n.setEdge(c,l);return}l=s}})}let sB=O$,cB=V$,dB=J$,uB=oB,fB=aB,pB=jt.Graph,Ji=tt;var mB=Pm;function Pm(e,n){if(n&&typeof n.customOrder=="function"){n.customOrder(e,Pm);return}let o=Ji.maxRank(e),r=Om(e,Ji.range(1,o+1),"inEdges"),i=Om(e,Ji.range(o-1,-1,-1),"outEdges"),a=sB(e);if($m(e,a),n&&n.disableOptimalOrderHeuristic)return;let l=Number.POSITIVE_INFINITY,s;for(let c=0,d=0;d<4;++c,++d){gB(c%2?r:i,c%4>=2),a=Ji.buildLayerMatrix(e);let f=cB(e,a);f<l&&(d=0,s=Object.assign({},a),l=f)}$m(e,s)}function Om(e,n,o){return n.map(function(r){return uB(e,r,o)})}function gB(e,n){let o=new pB;e.forEach(function(r){let i=r.graph().root,a=dB(r,i,o,n);a.vs.forEach((l,s)=>r.node(l).order=s),fB(r,o,a.vs)})}function $m(e,n){Object.values(n).forEach(o=>o.forEach((r,i)=>e.node(r).order=i))}let hB=jt.Graph,pn=tt;var yB={positionX:AB};function _B(e,n){let o={};function r(i,a){let l=0,s=0,c=i.length,d=a[a.length-1];return a.forEach((f,u)=>{let p=wB(e,f),m=p?e.node(p).order:c;(p||f===d)&&(a.slice(s,u+1).forEach(y=>{e.predecessors(y).forEach(_=>{let g=e.node(_),h=g.order;(h<l||m<h)&&!(g.dummy&&e.node(y).dummy)&&Bm(o,_,y)})}),s=u+1,l=m)}),a}return n.length&&n.reduce(r),o}function bB(e,n){let o={};function r(a,l,s,c,d){let f;pn.range(l,s).forEach(u=>{f=a[u],e.node(f).dummy&&e.predecessors(f).forEach(p=>{let m=e.node(p);m.dummy&&(m.order<c||m.order>d)&&Bm(o,p,f)})})}function i(a,l){let s=-1,c,d=0;return l.forEach((f,u)=>{if(e.node(f).dummy==="border"){let p=e.predecessors(f);p.length&&(c=e.node(p[0]).order,r(l,d,u,s,c),d=u,s=c)}r(l,d,l.length,c,a.length)}),l}return n.length&&n.reduce(i),o}function wB(e,n){if(e.node(n).dummy)return e.predecessors(n).find(o=>e.node(o).dummy)}function Bm(e,n,o){if(n>o){let i=n;n=o,o=i}let r=e[n];r||(e[n]=r={}),r[o]=!0}function kB(e,n,o){if(n>o){let r=n;n=o,o=r}return!!e[n]&&Object.hasOwn(e[n],o)}function CB(e,n,o,r){let i={},a={},l={};return n.forEach(s=>{s.forEach((c,d)=>{i[c]=c,a[c]=c,l[c]=d})}),n.forEach(s=>{let c=-1;s.forEach(d=>{let f=r(d);if(f.length){f=f.sort((p,m)=>l[p]-l[m]);let u=(f.length-1)/2;for(let p=Math.floor(u),m=Math.ceil(u);p<=m;++p){let y=f[p];a[d]===d&&c<l[y]&&!kB(o,d,y)&&(a[y]=d,a[d]=i[d]=i[y],c=l[y])}}})}),{root:i,align:a}}function EB(e,n,o,r,i){let a={},l=NB(e,n,o,i),s=i?"borderLeft":"borderRight";function c(u,p){let m=l.nodes(),y=m.pop(),_={};for(;y;)_[y]?u(y):(_[y]=!0,m.push(y),m=m.concat(p(y))),y=m.pop()}function d(u){a[u]=l.inEdges(u).reduce((p,m)=>Math.max(p,a[m.v]+l.edge(m)),0)}function f(u){let p=l.outEdges(u).reduce((y,_)=>Math.min(y,a[_.w]-l.edge(_)),Number.POSITIVE_INFINITY),m=e.node(u);p!==Number.POSITIVE_INFINITY&&m.borderType!==s&&(a[u]=Math.max(a[u],p))}return c(d,l.predecessors.bind(l)),c(f,l.successors.bind(l)),Object.keys(r).forEach(u=>a[u]=a[o[u]]),a}function NB(e,n,o,r){let i=new hB,a=e.graph(),l=IB(a.nodesep,a.edgesep,r);return n.forEach(s=>{let c;s.forEach(d=>{let f=o[d];if(i.setNode(f),c){var u=o[c],p=i.edge(u,f);i.setEdge(u,f,Math.max(l(e,d,c),p||0))}c=d})}),i}function SB(e,n){return Object.values(n).reduce((o,r)=>{let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([s,c])=>{let d=TB(e,s)/2;i=Math.max(c+d,i),a=Math.min(c-d,a)});const l=i-a;return l<o[0]&&(o=[l,r]),o},[Number.POSITIVE_INFINITY,null])[1]}function xB(e,n){let o=Object.values(n),r=pn.applyWithChunking(Math.min,o),i=pn.applyWithChunking(Math.max,o);["u","d"].forEach(a=>{["l","r"].forEach(l=>{let s=a+l,c=e[s];if(c===n)return;let d=Object.values(c),f=r-pn.applyWithChunking(Math.min,d);l!=="l"&&(f=i-pn.applyWithChunking(Math.max,d)),f&&(e[s]=pn.mapValues(c,u=>u+f))})})}function vB(e,n){return pn.mapValues(e.ul,(o,r)=>{if(n)return e[n.toLowerCase()][r];{let i=Object.values(e).map(a=>a[r]).sort((a,l)=>a-l);return(i[1]+i[2])/2}})}function AB(e){let n=pn.buildLayerMatrix(e),o=Object.assign(_B(e,n),bB(e,n)),r={},i;["u","d"].forEach(l=>{i=l==="u"?n:Object.values(n).reverse(),["l","r"].forEach(s=>{s==="r"&&(i=i.map(u=>Object.values(u).reverse()));let c=(l==="u"?e.predecessors:e.successors).bind(e),d=CB(e,i,o,c),f=EB(e,i,d.root,d.align,s==="r");s==="r"&&(f=pn.mapValues(f,u=>-u)),r[l+s]=f})});let a=SB(e,r);return xB(r,a),vB(r,e.graph().align)}function IB(e,n,o){return(r,i,a)=>{let l=r.node(i),s=r.node(a),c=0,d;if(c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":d=-l.width/2;break;case"r":d=l.width/2;break}if(d&&(c+=o?d:-d),d=0,c+=(l.dummy?n:e)/2,c+=(s.dummy?n:e)/2,c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":d=s.width/2;break;case"r":d=-s.width/2;break}return d&&(c+=o?d:-d),d=0,c}}function TB(e,n){return e.node(n).width}let Vm=tt,PB=yB.positionX;var OB=$B;function $B(e){e=Vm.asNonCompoundGraph(e),BB(e),Object.entries(PB(e)).forEach(([n,o])=>e.node(n).x=o)}function BB(e){let n=Vm.buildLayerMatrix(e),o=e.graph().ranksep,r=0;n.forEach(i=>{const a=i.reduce((l,s)=>{const c=e.node(s).height;return l>c?l:c},0);i.forEach(l=>e.node(l).y=r+a/2),r+=a+o})}let Rm=RO,Dm=UO,VB=u$,RB=tt.normalizeRanks,DB=g$,MB=tt.removeEmptyRanks,Mm=b$,LB=S$,Lm=v$,FB=mB,UB=OB,Rt=tt,KB=jt.Graph;var jB=GB;function GB(e,n){let o=n&&n.debugTiming?Rt.time:Rt.notime;o("layout",()=>{let r=o(" buildLayoutGraph",()=>eV(e));o(" runLayout",()=>qB(r,o,n)),o(" updateInputGraph",()=>zB(e,r))})}function qB(e,n,o){n(" makeSpaceForEdgeLabels",()=>tV(e)),n(" removeSelfEdges",()=>dV(e)),n(" acyclic",()=>Rm.run(e)),n(" nestingGraph.run",()=>Mm.run(e)),n(" rank",()=>VB(Rt.asNonCompoundGraph(e))),n(" injectEdgeLabelProxies",()=>nV(e)),n(" removeEmptyRanks",()=>MB(e)),n(" nestingGraph.cleanup",()=>Mm.cleanup(e)),n(" normalizeRanks",()=>RB(e)),n(" assignRankMinMax",()=>oV(e)),n(" removeEdgeLabelProxies",()=>rV(e)),n(" normalize.run",()=>Dm.run(e)),n(" parentDummyChains",()=>DB(e)),n(" addBorderSegments",()=>LB(e)),n(" order",()=>FB(e,o)),n(" insertSelfEdges",()=>uV(e)),n(" adjustCoordinateSystem",()=>Lm.adjust(e)),n(" position",()=>UB(e)),n(" positionSelfEdges",()=>fV(e)),n(" removeBorderNodes",()=>cV(e)),n(" normalize.undo",()=>Dm.undo(e)),n(" fixupEdgeLabelCoords",()=>lV(e)),n(" undoCoordinateSystem",()=>Lm.undo(e)),n(" translateGraph",()=>iV(e)),n(" assignNodeIntersects",()=>aV(e)),n(" reversePoints",()=>sV(e)),n(" acyclic.undo",()=>Rm.undo(e))}function zB(e,n){e.nodes().forEach(o=>{let r=e.node(o),i=n.node(o);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,n.children(o).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(o=>{let r=e.edge(o),i=n.edge(o);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}let HB=["nodesep","edgesep","ranksep","marginx","marginy"],YB={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},WB=["acyclicer","ranker","rankdir","align"],XB=["width","height","rank"],Fm={width:0,height:0},ZB=["minlen","weight","width","height","labeloffset"],JB={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},QB=["labelpos"];function eV(e){let n=new KB({multigraph:!0,compound:!0}),o=ks(e.graph());return n.setGraph(Object.assign({},YB,ws(o,HB),Rt.pick(o,WB))),e.nodes().forEach(r=>{let i=ks(e.node(r));const a=ws(i,XB);Object.keys(Fm).forEach(l=>{a[l]===void 0&&(a[l]=Fm[l])}),n.setNode(r,a),n.setParent(r,e.parent(r))}),e.edges().forEach(r=>{let i=ks(e.edge(r));n.setEdge(r,Object.assign({},JB,ws(i,ZB),Rt.pick(i,QB)))}),n}function tV(e){let n=e.graph();n.ranksep/=2,e.edges().forEach(o=>{let r=e.edge(o);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function nV(e){e.edges().forEach(n=>{let o=e.edge(n);if(o.width&&o.height){let r=e.node(n.v),a={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};Rt.addDummyNode(e,"edge-proxy",a,"_ep")}})}function oV(e){let n=0;e.nodes().forEach(o=>{let r=e.node(o);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Math.max(n,r.maxRank))}),e.graph().maxRank=n}function rV(e){e.nodes().forEach(n=>{let o=e.node(n);o.dummy==="edge-proxy"&&(e.edge(o.e).labelRank=o.rank,e.removeNode(n))})}function iV(e){let n=Number.POSITIVE_INFINITY,o=0,r=Number.POSITIVE_INFINITY,i=0,a=e.graph(),l=a.marginx||0,s=a.marginy||0;function c(d){let f=d.x,u=d.y,p=d.width,m=d.height;n=Math.min(n,f-p/2),o=Math.max(o,f+p/2),r=Math.min(r,u-m/2),i=Math.max(i,u+m/2)}e.nodes().forEach(d=>c(e.node(d))),e.edges().forEach(d=>{let f=e.edge(d);Object.hasOwn(f,"x")&&c(f)}),n-=l,r-=s,e.nodes().forEach(d=>{let f=e.node(d);f.x-=n,f.y-=r}),e.edges().forEach(d=>{let f=e.edge(d);f.points.forEach(u=>{u.x-=n,u.y-=r}),Object.hasOwn(f,"x")&&(f.x-=n),Object.hasOwn(f,"y")&&(f.y-=r)}),a.width=o-n+l,a.height=i-r+s}function aV(e){e.edges().forEach(n=>{let o=e.edge(n),r=e.node(n.v),i=e.node(n.w),a,l;o.points?(a=o.points[0],l=o.points[o.points.length-1]):(o.points=[],a=i,l=r),o.points.unshift(Rt.intersectRect(r,a)),o.points.push(Rt.intersectRect(i,l))})}function lV(e){e.edges().forEach(n=>{let o=e.edge(n);if(Object.hasOwn(o,"x"))switch((o.labelpos==="l"||o.labelpos==="r")&&(o.width-=o.labeloffset),o.labelpos){case"l":o.x-=o.width/2+o.labeloffset;break;case"r":o.x+=o.width/2+o.labeloffset;break}})}function sV(e){e.edges().forEach(n=>{let o=e.edge(n);o.reversed&&o.points.reverse()})}function cV(e){e.nodes().forEach(n=>{if(e.children(n).length){let o=e.node(n),r=e.node(o.borderTop),i=e.node(o.borderBottom),a=e.node(o.borderLeft[o.borderLeft.length-1]),l=e.node(o.borderRight[o.borderRight.length-1]);o.width=Math.abs(l.x-a.x),o.height=Math.abs(i.y-r.y),o.x=a.x+o.width/2,o.y=r.y+o.height/2}}),e.nodes().forEach(n=>{e.node(n).dummy==="border"&&e.removeNode(n)})}function dV(e){e.edges().forEach(n=>{if(n.v===n.w){var o=e.node(n.v);o.selfEdges||(o.selfEdges=[]),o.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function uV(e){var n=Rt.buildLayerMatrix(e);n.forEach(o=>{var r=0;o.forEach((i,a)=>{var l=e.node(i);l.order=a+r,(l.selfEdges||[]).forEach(s=>{Rt.addDummyNode(e,"selfedge",{width:s.label.width,height:s.label.height,rank:l.rank,order:a+ ++r,e:s.e,label:s.label},"_se")}),delete l.selfEdges})})}function fV(e){e.nodes().forEach(n=>{var o=e.node(n);if(o.dummy==="selfedge"){var r=e.node(o.e.v),i=r.x+r.width/2,a=r.y,l=o.x-i,s=r.height/2;e.setEdge(o.e,o.label),e.removeNode(n),o.label.points=[{x:i+2*l/3,y:a-s},{x:i+5*l/6,y:a-s},{x:i+l,y:a},{x:i+5*l/6,y:a+s},{x:i+2*l/3,y:a+s}],o.label.x=o.x,o.label.y=o.y}})}function ws(e,n){return Rt.mapValues(Rt.pick(e,n),Number)}function ks(e){var n={};return e&&Object.entries(e).forEach(([o,r])=>{typeof o=="string"&&(o=o.toLowerCase()),n[o]=r}),n}let pV=tt,mV=jt.Graph;var gV={debugOrdering:hV};function hV(e){let n=pV.buildLayerMatrix(e),o=new mV({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{o.setNode(r,{label:r}),o.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>o.setEdge(r.v,r.w,{},r.name)),n.forEach((r,i)=>{let a="layer"+i;o.setNode(a,{rank:"same"}),r.reduce((l,s)=>(o.setEdge(l,s,{style:"invis"}),s))}),o}var yV="1.1.5",_V={graphlib:jt,layout:jB,debug:gV,util:{time:tt.time,notime:tt.notime},version:yV};const Um=hP(_V);function Km(){const e=(...o)=>{console.warn("TOASTER_PROVIDER is not provided",...o)},n=t.inject(nd,e);return o=>n(o)}function Qi(e,n,o){const r=n?bn(e,o,n):void 0;return`${e.name}${r?`.${r.name}`:""}`}function xr(e,n){const o=n(e.source),r=n(e.target);return[Qi(o,e.sourceField,"output"),Qi(r,e.targetField,"input")]}function Cs(e,n,o,r,i){const a=i(e),l=i(o);return[Qi(a,n,"output"),Qi(l,r,"input")]}function jm(e){if(e.length===0)throw new Error("getBoundingRect requires at least one rect");let n=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const{x:a,y:l,width:s,height:c}of e){if(![a,l,s,c].every(Number.isFinite))throw new Error("Rect values must be finite numbers");if(s<0||c<0)throw new RangeError("Rect width and height must be non-negative");const d=a+s,f=l+c;if(!Number.isFinite(d)||!Number.isFinite(f))throw new RangeError("Rect boundaries must be finite numbers");a<n&&(n=a),l<o&&(o=l),d>r&&(r=d),f>i&&(i=f)}return{x:n,y:o,width:r-n,height:i-o}}function bV({phase:e,readonly:n,flowId:o}){const{findNode:r}=Le(o),i=at(),{state:a,groupMapById:l,getNodeById:s,moveNode:c,moveGroup:d,setGroupLayout:f,commit:u,branchGroups:p}=i,{memberGroupMap:m,groupsByOwner:y,getNodeDepth:_,getGroupDepth:g}=p,h=t.ref(),w=O=>!!O&&O.startsWith("branch:");function b(O){const P=[];for(const T of O.memberIds){const M=s(T);M&&P.push(M)}return P}const x=t.computed(()=>{const O=new Map;return m.value.forEach((P,T)=>{if(P.phase!==e||!P.position)return;const M=s(T);M&&(M.phase!==e||M.hidden||O.set(T,P))}),O}),E=t.computed(()=>{const O=new Map;return y.value.forEach((P,T)=>{const M=P.filter(Y=>Y.phase===e);M.length>0&&O.set(T,M)}),O}),C=t.computed(()=>{const O=[];for(const P of a.value.groups){const T=s(P.ownerId);if(!T||T.phase!==e)continue;const M=P.position,Y=P.dimensions;if(!M||!Y)continue;const z=b(P).filter(Z=>Z.phase===e&&!Z.hidden),H=g(P.id);O.push({id:P.id,type:"group",position:M,width:Y.width,height:Y.height,data:{...P,memberIds:z.map(Z=>Z.id)},draggable:!n,selectable:!1,zIndex:H*ii+c1})}return O}),N=t.computed(()=>{let O=0;for(const P of a.value.groups){if(P.phase!==e)continue;const T=g(P.id);T>O&&(O=T)}return O}),S=t.computed(()=>{const O=[];for(const P of a.value.groups){if(P.phase!==e||!P.position||!P.dimensions)continue;const T=s(P.ownerId);if(!T||T.phase!==e||T.hidden||!b(P).filter(H=>H.phase===e&&!H.hidden).length)continue;const Y=Math.max(_(T.id),g(P.id))+N.value+1,z={id:`branch:${P.id}`,source:T.id,target:P.id,sourceHandle:`branch@${P.branch}`,targetHandle:"input",markerEnd:gr.ArrowClosed,selectable:!1,focusable:!1,updatable:!1,data:{type:"branch",ownerId:T.id,branch:P.branch,groupId:P.id},zIndex:Y*ii+u1};O.push(z)}return O}),v=new Map,D=new Map;let L;function k(O,P=!0){if(O.phase!==e)return;const T=b(O).filter(Z=>Z.phase===e&&!Z.hidden);if(!T.length)return;const M=[];for(const Z of T){const ie=r(Z.id),be=ie==null?void 0:ie.dimensions,ee=(be==null?void 0:be.width)??0,re=(be==null?void 0:be.height)??0;if(ee<=0||re<=0)return;const le=ie==null?void 0:ie.computedPosition,ue=(le==null?void 0:le.x)??Z.position.x,fe=(le==null?void 0:le.y)??Z.position.y;M.push({x:ue,y:fe,width:ee,height:re});const B=y.value.get(Z.id)??[];for(const V of B){if(V.phase!==e)continue;const F=v.get(V.id),R=(F==null?void 0:F.position)??V.position,Q=(F==null?void 0:F.dimensions)??V.dimensions;!R||!Q||M.push({x:R.x,y:R.y,width:Q.width,height:Q.height})}}const Y=jm(M),z=Y.width+wo*2,H=Y.height+wo*2;return{position:{x:Math.round(Y.x-wo),y:Math.round(Y.y-wo)},dimensions:{width:Math.round(z),height:Math.round(H)},commit:P}}function J(){if(v.size===0){L=void 0;return}const O=[];let P=!1;v.forEach((T,M)=>{const Y=f(M,T,!1);O.push({id:M,changed:Y,commit:T.commit}),T.commit&&Y&&!P&&(P=!0)}),v.clear(),L=void 0;for(const{id:T,changed:M,commit:Y}of O){if(!M)continue;const z=l.value.get(T);if(!z)continue;const H=x.value.get(z.ownerId);H&&D.set(H.id,{commit:Y})}if(D.size>0){const T=Array.from(D);D.clear();for(const[M,{commit:Y}]of T)G(M,Y)}P&&u("*")}function I(){v.size!==0&&(L||(L=t.nextTick().then(J)))}function G(O,P=!0){const T=l.value.get(O);if(!T)return;const M=k(T,P);M&&(v.set(O,M),I())}function j(O,P,T,M){const Y=l.value.get(O);if(!Y)return;if(!Y.position){d(O,P,!1),G(O);return}if(T===0&&M===0){d(O,P,!1);return}d(O,P,!1);const z=[O],H=new Set([O]),Z=new Set;for(;z.length;){const ie=z.shift(),be=l.value.get(ie);if(!be)continue;const ee=b(be).filter(re=>re.phase===e&&!re.hidden);for(const re of ee){Z.has(re.id)||(c(re.id,{x:re.position.x+T,y:re.position.y+M},!1),Z.add(re.id));const le=E.value.get(re.id)??[];for(const ue of le){if(H.has(ue.id))continue;const fe=l.value.get(ue.id);fe!=null&&fe.position&&d(ue.id,{x:fe.position.x+T,y:fe.position.y+M},!1),H.add(ue.id),z.push(ue.id)}}}}function te(O,P){const T=h.value;if(!T)return!1;if(T===O||P.some(M=>T===M))return!0;for(const M of P){const Y=E.value.get(M)??[];if(Y!=null&&Y.some(z=>z.id===T))return!0}return!1}const K=new Map;return t.watch(()=>a.value.groups.filter(P=>P.phase===e).map(P=>{const T=P.memberIds.map(M=>{var Z,ie;const Y=r(M),z=Math.round(((Z=Y==null?void 0:Y.dimensions)==null?void 0:Z.width)??0),H=Math.round(((ie=Y==null?void 0:Y.dimensions)==null?void 0:ie.height)??0);return`${M}:${z}x${H}`});return{id:P.id,memberIds:P.memberIds,signature:T.join(",")}}),O=>{const P=new Set(O.map(T=>T.id));for(const T of K.keys())P.has(T)||K.delete(T);for(const T of O){if(te(T.id,T.memberIds))continue;const Y=K.get(T.id)!==T.signature;Y&&K.set(T.id,T.signature);const z=l.value.get(T.id),H=!!(z!=null&&z.position&&(z!=null&&z.dimensions));Y&&(H||G(T.id))}},{deep:!0,flush:"post"}),{groupsByOwner:E,memberGroupMap:x,groupNodes:C,branchEdges:S,isBranchEdgeId:w,updateGroupLayout:G,translateGroupTree:j,updateDragging:O=>{h.value=O},getNodeDepth:_,maxGroupDepth:N,waitForLayoutFlush:()=>L??Promise.resolve()}}function wV(e){t.provide(Hp,e)}function Gm(){return t.inject(Hp,void 0)}function qm(){const e=Gm();if(!e)throw new Error("Confirm modal not provided");return e}function kV({phase:e,groupMapById:n,getNodeDepth:o}){const r=t.shallowRef(),i=t.shallowRef();function a(d){r.value=d,i.value=void 0}function l(){r.value&&(r.value=void 0,i.value=void 0)}function s(d){let f;return n.value.forEach(u=>{if(u.phase!==e)return;const p=u.position,m=u.dimensions;if(!p||!m||!(d.x>=p.x&&d.x<=p.x+m.width&&d.y>=p.y&&d.y<=p.y+m.height))return;const _=o(u.ownerId);(!f||_>f.depth)&&(f={depth:_,id:u.id})}),f==null?void 0:f.id}function c(d){if(!r.value){i.value=void 0;return}if(!d){i.value=void 0;return}i.value=s(d)}return{activeGroupId:i,start:a,updateActiveGroup:c,end:l}}function zm(e){const n=e.match(/^(input|output)(?:s@(.*))?$/);if(n)return{io:n[1],field:n[2]}}const CV={default:aC,hover:sC,selected:lC};let Hm,Es;function ea(e){const n=e.id===Hm?"selected":e.id===Es?"hover":"default",o=CV[n],{markerEnd:r}=e,i=typeof r=="object"?{...r,color:o}:{type:r,color:o},a=e.zIndex??0,l=n==="selected"?a+2:n==="hover"?a+1:a;return{...e,style:{...e.style,stroke:o,strokeWidth:n==="selected"?1.5:void 0},markerEnd:i,zIndex:l}}const[EV,NV]=Ye.createInjectionState(function(e){const{phase:n,flowId:o,layoutOptions:r,readonly:i}=e,{viewport:a,padding:l=Cr.padding,gaps:s=Cr.gaps}=r,{nodes:c=Cr.gaps.nodes,edges:d=Cr.gaps.edges,ranks:f=Cr.gaps.ranks}=s,u=Le(o),p=at(),m=Gm(),y=Km(),{i18n:{t:_}}=Be(),{findNode:g,fitView:h,deleteKeyCode:w,onNodeDrag:b,onNodeDragStop:x,onConnect:E,onNodesChange:C,onEdgesChange:N,onEdgeUpdate:S,onEdgeMouseEnter:v,onEdgeMouseLeave:D,getNodes:L,setNodes:k,setEdges:J,addSelectedNodes:I,screenToFlowCoordinate:G}=u;w.value=["Delete","Backspace"];const{state:j,commit:te,moveNode:K,selectNode:O,removeNode:P,getNodeById:T,connectEdge:M,disconnectEdge:Y,getInEdgesByNodeId:z,branchGroups:H,commit:Z,reset:ie,groupMapById:be}=p,{isGroupId:ee}=H;function re(se,ye){const ce=T(se.source),pe=T(se.target);return!!(ce&&pe&&ce.phase===ye&&pe.phase===ye)}const{groupsByOwner:le,memberGroupMap:ue,groupNodes:fe,branchEdges:B,isBranchEdgeId:V,updateGroupLayout:F,translateGroupTree:R,updateDragging:Q,getNodeDepth:q,maxGroupDepth:ae,waitForLayoutFlush:A}=bV({phase:n,readonly:i,flowId:o}),{activeGroupId:U,start:$,updateActiveGroup:oe,end:ne}=kV({phase:n,groupMapById:be,getNodeDepth:q}),_e=t.computed(()=>j.value.nodes.filter(se=>se.phase===n&&!se.hidden).map(se=>{const ye=ue.value.get(se.id),ce=ye==null?void 0:ye.position,pe=ye==null?void 0:ye.dimensions,we=ye&&ce&&pe?{x:se.position.x-ce.x,y:se.position.y-ce.y}:se.position,xe=q(se.id),Oe=!!(ye&&ce&&pe),Re=(Oe?xe:0)+ae.value+1;return{id:se.id,type:"flow",position:we,data:se,deletable:!Ru(se),parentNode:Oe?ye.id:void 0,zIndex:Re*ii+f1}})),ke=t.computed(()=>j.value.edges.filter(se=>re(se,n)).filter(se=>{const ye=T(se.source),ce=T(se.target);return!(ye!=null&&ye.hidden)&&!(ce!=null&&ce.hidden)}).map(se=>{const ye=T(se.source),ce=T(se.target);if(ye){if(!ce)throw new Error(`Missing target node "${se.target}" for edge "${se.id}" in phase "${n}"`)}else throw new Error(`Missing source node "${se.source}" for edge "${se.id}" in phase "${n}"`);const pe=Math.max(q(se.source),q(se.target))+ae.value+1;return ea({id:se.id,source:se.source,target:se.target,sourceHandle:se.sourceField?`outputs@${se.sourceField}`:"output",targetHandle:se.targetField?`inputs@${se.targetField}`:"input",markerEnd:gr.ArrowClosed,data:se,updatable:!i,zIndex:pe*ii+d1})})),de=t.computed(()=>[...B.value,...ke.value]);t.watch([_e,fe,de],([se,ye,ce])=>{k([...ye,...se]),J(ce)},{immediate:!0});const Ne=t.computed(()=>({padding:l/Math.max(t.toValue(a==null?void 0:a.width)??0,t.toValue(a==null?void 0:a.height)??0)}));async function Te({source:se,sourceHandle:ye,target:ce,targetHandle:pe}){if(!ye||!pe)return;const we=zm(ye),xe=zm(pe);if((we==null?void 0:we.io)==="input"||(xe==null?void 0:xe.io)==="output"||ye==="output"&&pe==="output")return;const Oe=z(ce);let Re=!1,Me=!1;const At=[],Ge=[],Ue=(xe==null?void 0:xe.io)==="input"?Oe.filter(We=>!We.targetField):Oe.filter(We=>!!We.targetField);Ue.length>0&&(Re=!0,Ue.forEach(We=>{Ge.push(xr(We,T)),Y(We.id,!1)}));const Ke=(xe==null?void 0:xe.io)==="input"?xe!=null&&xe.field?Oe.filter(We=>We.targetField===xe.field):Oe.filter(We=>!!We.targetField):Oe.filter(We=>!We.targetField);if(Ke.length>0){if(Ke.some(gt=>gt.source===se&>.target===ce&>.targetField===(xe==null?void 0:xe.field)&>.sourceField===(we==null?void 0:we.field)))return;Me=!0,Ke.forEach(gt=>{Ge.push(xr(gt,T)),Y(gt.id,!1)})}if(!M({source:se,sourceField:we==null?void 0:we.field,target:ce,targetField:xe==null?void 0:xe.field},!1)){ie(),y({message:_("plugins.free-form.datakit.flow_editor.error.invalid_connection"),appearance:"danger"});return}if(At.push(Cs(se,we==null?void 0:we.field,ce,xe==null?void 0:xe.field,T)),Re||Me){if(!m)throw ie(),new Error("Expected confirm modal to be provided here when reachable");if(!await m(_(Re?"plugins.free-form.datakit.flow_editor.confirm.message.switch":"plugins.free-form.datakit.flow_editor.confirm.message.override"),At,Ge)){ie();return}}Z()}E(Te);let me=!1;const ge=()=>{me&&(me=!1,Z())};C(se=>{se.filter(pe=>pe.type==="select").filter(pe=>!ee(pe.id)).sort((pe,we)=>pe.selected===we.selected?0:pe.selected?1:-1).forEach(pe=>{O(pe.selected?pe.id:void 0)});let ce=!1;se.forEach(pe=>{if(pe.type==="remove"){if(ee(pe.id))return;ce=!0,P(pe.id,!1)}}),ce&&!me&&(me=!0,queueMicrotask(ge))}),b(({node:se,event:ye})=>{var At,Ge,Ue;if(!se)return;if(ee(se.id)){const Ke=se.id;Q(Ke),oe(void 0);const Qt=be.value.get(Ke);if(!Qt)return;const We=Qt.position??{...se.position},gt=se.position.x-We.x,aa=se.position.y-We.y;R(Ke,se.position,gt,aa);const Ar=ue.value.get(Qt.ownerId);Ar&&F(Ar.id,!1);return}const ce=se.id;$("canvas"),Q(ce);const pe=se.parentNode;let we={...se.position};if(pe&&ee(pe)){const Ke=be.value.get(pe);Ke!=null&&Ke.position&&(we={x:Ke.position.x+se.position.x,y:Ke.position.y+se.position.y})}K(ce,we,!1);const xe={x:we.x,y:we.y,width:((At=se.dimensions)==null?void 0:At.width)??0,height:((Ge=se.dimensions)==null?void 0:Ge.height)??0},Oe=ye&&"clientX"in ye?G({x:ye.clientX,y:ye.clientY}):void 0,Re={x:xe.x+xe.width/2,y:xe.y+xe.height/2};oe(Oe??Re);const Me=pe&&ee(pe)?pe:(Ue=ue.value.get(ce))==null?void 0:Ue.id;Me&&F(Me,!1)}),x(({node:se})=>{var xe;if(!se)return;if(Q(void 0),ee(se.id)){te();return}const ye=se.id,ce=se.parentNode;let pe={...se.position};if(ce&&ee(ce)){const Oe=be.value.get(ce);Oe!=null&&Oe.position&&(pe={x:Oe.position.x+se.position.x,y:Oe.position.y+se.position.y})}K(ye,pe,!1);const we=ce&&ee(ce)?ce:(xe=ue.value.get(ye))==null?void 0:xe.id;we&&F(we,!1),mt(ye),ne(),te()}),N(se=>{se.filter(pe=>pe.type==="select").sort((pe,we)=>pe.selected===we.selected?0:pe.selected?1:-1).forEach(pe=>{V(pe.id)||(Hm=pe.selected?pe.id:void 0,J(we=>we.map(xe=>xe.id!==pe.id||!xe.markerEnd?xe:ea({...xe,zIndex:pe.selected?1:void 0}))))});let ce=!1;se.forEach(pe=>{if(pe.type==="remove"){if(V(pe.id))return;ce=!0,Y(pe.id,!1)}}),ce&&!me&&(me=!0,queueMicrotask(ge))}),v(({edge:se})=>{V(se.id)||(Es=se.id,J(ye=>ye.map(ce=>ce.id!==se.id?ce:ea(ce))))}),D(({edge:se})=>{V(se.id)||(Es=void 0,J(ye=>ye.map(ce=>ce.id!==se.id?ce:ea(ce))))}),S(({edge:se,connection:ye})=>{V(se.id)||(Y(se.id,!1),Te(ye))});function nt(se,ye,ce){var gt,aa,Ar,mg,gg;const pe=ye?g(ye.id):void 0,we=ce?g(ce.id):void 0;let xe;if(se.length>0){xe=new Um.graphlib.Graph({multigraph:!0}),xe.setGraph({rankdir:n==="request"?"LR":"RL",nodesep:c,edgesep:d,ranksep:f});const Ct=new Set;for(const It of se){const en=g(It.id);if(!en){console.warn(`Cannot find graph node '${It.id}' in ${n} phase`);continue}Ct.add(It.id),li(It)?xe.setNode(It.id,It.dimensions??en.dimensions):xe.setNode(It.id,en.dimensions)}for(const It of de.value)!Ct.has(It.source)||!Ct.has(It.target)||xe.setEdge(It.source,It.target,{points:[]});Um.layout(xe)}const Oe=[],Re=Ct=>({x:Ct.x-Ct.width/2,y:Ct.y-Ct.height/2,width:Ct.width,height:Ct.height});if(se.length>0){if(!xe)throw new Error("Expected dagreGraph to be initialized");for(const Ct of se){const It=xe.node(Ct.id),en=Re(It);Oe.push(en),li(Ct)?R(Ct.id,en,en.x+wo,en.y+wo):K(Ct.id,{x:en.x,y:en.y},!1)}}const Me=Oe.length>0?jm(Oe):{x:0,y:0,width:0,height:0},At=Me.width,Ge=Me.height,Ue=Me.x,Ke=Me.x+Me.width,Qt=Math.max(0,Math.min(t.toValue(a==null?void 0:a.width)??Number.POSITIVE_INFINITY,fP)-At-2*c-(((gt=pe==null?void 0:pe.dimensions)==null?void 0:gt.width)??0)-(((aa=we==null?void 0:we.dimensions)==null?void 0:aa.width)??0)-2*l),We=Me.y+Ge/2;ye&&K(ye.id,{x:Ue-c-Qt/2-(((Ar=pe==null?void 0:pe.dimensions)==null?void 0:Ar.width)??0),y:We-(((mg=pe==null?void 0:pe.dimensions)==null?void 0:mg.height)??0)/2},!1),ce&&K(ce.id,{x:Ke+c+Qt/2,y:We-(((gg=we==null?void 0:we.dimensions)==null?void 0:gg.height)??0)/2},!1)}function xn(se){let ye,ce;const pe=[];for(const we of se){if(li(we)){pe.push(we);continue}switch(we.name){case"request":{if(n!=="request")throw new Error(`Unexpected request node in ${n} phase`);if(ye)throw new Error("Duplicated request node in request phase");ye=we;break}case"service_request":{if(n!=="request")throw new Error(`Unexpected service_request node in ${n} phase`);if(ce)throw new Error("Duplicated service_request node in request phase");ce=we;break}case"service_response":{if(n!=="response")throw new Error(`Unexpected service_response node in ${n} phase`);if(ce)throw new Error("Duplicated service_response node in response phase");ce=we;break}case"response":{if(n!=="response")throw new Error(`Unexpected response node in ${n} phase`);if(ye)throw new Error("Duplicated response node in response phase");ye=we;break}default:{pe.push(we);break}}}return{autoNodes:pe,leftNode:ye,rightNode:ce}}async function vn(se=!0){const ye=new Map(_e.value.map(Re=>[Re.id,Re.data])),ce=j.value.groups.toSorted((Re,Me)=>q(Me.ownerId)-q(Re.ownerId));for(const Re of ce)nt(Re.memberIds.reduce((Me,At)=>{const Ge=T(At);if(!Ge)return console.warn(`Cannot find node '${At}' of group '${Re.id}' by getNodeById`),Me;if(Ge.phase!==n)return Me;if(Ge.type==="branch"){const Ue=le.value.get(Ge.id);Ue&&Me.push(...Ue)}return ye.delete(Ge.id),Me.push(Ge),Me},[])),await t.nextTick(),F(Re.id,!1),await A();const pe=ye.values().toArray();for(const Re of pe){if(li(Re)||Re.type!=="branch")continue;const Me=le.value.get(Re.id);Me&&pe.push(...Me)}const{autoNodes:we,leftNode:xe,rightNode:Oe}=xn(pe);nt(we,xe,Oe),se&&te()}function st(se){h({...Ne.value,...se})}async function He(se){return O(se),new Promise(ye=>setTimeout(()=>{const ce=g(se);I(ce?[ce]:[]),ye()},0))}function pt(se){const ye=L.value.filter(({type:Ue})=>Ue!=="group"),ce=ye.find(({id:Ue})=>Ue===se);if(!ce)throw new Error(`Node ${se} not found`);const{position:{x:pe,y:we},dimensions:{width:xe,height:Oe}}=ce,Re=we,Me=we+Oe,At=ye.filter(({id:Ue})=>Ue!==se).filter(({position:{y:Ue},dimensions:{height:Ke}})=>Ue<Me&&Ue+Ke>Re).map(({position:{x:Ue},dimensions:{width:Ke}})=>({left:Ue,right:Ue+Ke})).sort((Ue,Ke)=>Ue.left-Ke.left);let Ge=pe+xe+c;for(const{left:Ue,right:Ke}of At)if(!(Ke<=Ge)){if(Ge+xe<=Ue)return{x:Ge,y:Re};Ge=Math.max(Ge,Ke)+c}return{x:Ge,y:Re}}function kt(se){if(!se)return;const ye=g(se);if(!ye)throw new Error(`Node ${se} not found`);const{position:{x:ce},dimensions:{width:pe}}=ye,we=ce+pe,{viewport:xe,dimensions:Oe,setViewport:Re}=u,{x:Me,y:At,zoom:Ge}=xe.value,{width:Ue}=Oe.value,Ke=ce*Ge+Me,Qt=we*Ge+Me,We=Ue-Ou-c;if(Qt<=We)return;let gt=We-Qt;Ke+gt<0&&(gt=-Ke),gt!==0&&Re({x:Me+gt,y:At,zoom:Ge},{duration:gP})}function mt(se){if(!U.value)return!1;const{nodeId:ye,branch:ce}=h1(U.value),pe=H.addMember(ye,ce,se,{commit:!1});return oe(void 0),pe}return{vueFlowStore:u,editorStore:p,readonly:i,nodes:_e,edges:de,selectNode:He,autoLayout:vn,placeToRight:pt,scrollRightToReveal:kt,fitViewParams:Ne,fitView:st,groupDrop:{activeGroupId:U,startPanelDrag:()=>$("panel"),endPanelDrag:ne,updateActiveGroup:oe,attachNodeToActiveGroup:mt}}}),ta=ve(t.defineComponent({__name:"HandleTwig",props:{color:{},position:{default:()=>Ee.Left},size:{default:()=>Number.parseFloat(Nd)},type:{}},setup(e){t.useCssVars(o=>({"753622c4":o.color}));const n=t.computed(()=>({width:`${e.size}px`,minWidth:`${e.size}px`}));return(o,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["handle-twig",[o.type,o.position===t.unref(Ee).Left?"left":"right"]]),style:t.normalizeStyle(n.value)},null,6))}}),[["__scopeId","data-v-eb2bc3f2"]]),Ym=ve(t.defineComponent({__name:"NodeBadge",props:{type:{},size:{},iconOnly:{type:Boolean}},setup(e){t.useCssVars(r=>{var i,a;return{b58c4842:(i=n.value.colors)==null?void 0:i.background,"6ae9eff4":(a=n.value.colors)==null?void 0:a.foreground}});const n=t.computed(()=>xt[e.type]),o=t.computed(()=>p1(e.type));return(r,i)=>{var l;const a=t.resolveComponent("KBadge");return t.openBlock(),t.createBlock(a,{appearance:"neutral",class:t.normalizeClass(["dk-node-badge",{"icon-only":r.iconOnly,"has-colors":!!n.value.colors}]),size:r.size},t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.value),1)]),_:2},[(l=n.value)!=null&&l.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value.icon)))]),key:"0"}:void 0]),1032,["class","size"])}}}),[["__scopeId","data-v-05435e4f"]]);let Oo=null;function SV(){var n;if(Oo)return Oo;if(typeof navigator>"u")return Oo="windows";const e=((n=navigator.userAgentData)==null?void 0:n.platform)||navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(e)?Oo="mac":/Linux/i.test(e)&&!/Android/i.test(e)?Oo="linux":Oo="windows"}const xV={Shift:"⇧",Alt:"⌥",Ctrl:"⌃",Meta:"⌘",Mod:"⌘",Enter:"↩",ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Tab:"⇥",Esc:"⎋",Space:"Space",Delete:"⌫"},vV={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Win",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Spacebar",Delete:"Delete"},AV={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Super",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Space",Delete:"Delete"};function IV(e,n={}){const o=n.platform??SV(),r=n.joiner??(o==="mac"?"":" + "),i=o==="mac"?xV:o==="linux"?AV:vV;return(Array.isArray(e)?e:e[o]).map(l=>l in i?i[l]:l).join(r)}const TV={key:0,class:"label"},PV={class:"keys"},na=ve(t.defineComponent({__name:"HotkeyLabel",props:{label:{},keys:{},reverse:{type:Boolean}},setup(e){const n=IV(e.keys);return(o,r)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass(["dk-hotkey-label",{reverse:o.reverse}])},[o.label?(t.openBlock(),t.createElementBlock("span",TV,t.toDisplayString(o.label),1)):t.createCommentVNode("",!0),t.createElementVNode("kbd",PV,t.toDisplayString(t.unref(n)),1)],2))}}),[["__scopeId","data-v-cc70d56b"]]),OV={class:"indicator-box"},$V={key:1,class:"additional-count"},oa=ve(t.defineComponent({__name:"ValueIndicator",props:{edgeId:{},sourceNode:{},sourceFieldName:{},targetNodes:{},targetFieldNames:{},mode:{},reversed:{type:Boolean,default:!1}},setup(e){const n=t.createPropsRestProxy(e,["reversed"]),o=t.computed(()=>n.mode==="input"&&n.sourceNode?n.sourceFieldName?`${n.sourceNode.name}.${n.sourceFieldName}`:n.sourceNode.name:n.mode==="output"&&n.targetNodes?n.targetNodes.map((s,c)=>{var f;const d=(f=n.targetFieldNames)==null?void 0:f[c];return d?`${s.name}.${d}`:s.name}).join(", "):""),r=t.computed(()=>{var s;let l;if(n.mode==="input"&&n.sourceNode?l=n.sourceNode:n.mode==="output"&&n.targetNodes&&n.targetNodes.length>0&&(l=n.targetNodes[0]),!!l)return(s=xt[l.type])==null?void 0:s.icon}),i=t.computed(()=>n.mode==="output"&&n.targetNodes&&n.targetNodes.length>1?n.targetNodes.length-1:0),a=t.computed(()=>n.mode==="input"?e.reversed:!e.reversed);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["value-indicator",{reversed:a.value}])},[t.createVNode(t.unref(Pe.KTooltip),{placement:"top",text:o.value},{default:t.withCtx(()=>[t.createElementVNode("div",OV,[r.value?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),{key:0,color:t.unref(Wa),size:16},null,8,["color"])):t.createCommentVNode("",!0),i.value>0?(t.openBlock(),t.createElementBlock("span",$V," +"+t.toDisplayString(i.value),1)):t.createCommentVNode("",!0)])]),_:1},8,["text"])],2))}}),[["__scopeId","data-v-d8506ba3"]]),BV={class:"body"},VV={class:"name"},RV={class:"handle"},DV={class:"handle-label-wrapper"},MV={class:"handle-label-wrapper"},LV={class:"handle-label text"},FV={class:"handle"},UV={class:"handle-label-wrapper"},KV={class:"handle-label-wrapper"},jV={class:"handle-label text"},GV={key:2,class:"branch-handles"},qV={class:"handle-label-wrapper"},zV={class:"handle-label text"},Wm=ve(t.defineComponent({__name:"FlowNode",props:{data:{},error:{type:Boolean},readonly:{type:Boolean}},setup(e){const{t:n}=Ze.createI18n("en-us",rt),o=NV(),{getInEdgesByNodeId:r,getOutEdgesByNodeId:i,getNodeById:a,toggleExpanded:l,duplicateNode:s,removeNode:c,propertiesPanelOpen:d}=at(),f=t.computed(()=>Co(e.data.type)),u=t.computed(()=>e.data.fields.input.length>0),p=t.computed(()=>e.data.fields.output.length>0),m=t.computed(()=>u.value&&r(e.data.id).every(K=>K.targetField===void 0)),y=t.computed(()=>p.value&&i(e.data.id).every(K=>K.sourceField===void 0)),_=t.computed(()=>e.data.expanded.input??!1),g=t.computed(()=>e.data.expanded.output??!1),h=t.computed(()=>{var K,O,P;return((P=(O=(K=f.value.io)==null?void 0:K.next)==null?void 0:O.branches)==null?void 0:P.map(({name:T})=>T))??[]}),w=t.computed(()=>h.value.length>0),b=t.computed(()=>{var K,O;if(e.data.type==="property"){const P=(K=e.data.config)==null?void 0:K.property;return cs(P)}return(O=f.value.io)==null?void 0:O.input}),x=t.computed(()=>{var K,O;if(e.data.type==="property"){const P=(K=e.data.config)==null?void 0:K.property;return ss(P)}return(O=f.value.io)==null?void 0:O.output}),E=t.computed(()=>Ru(e.data)),C=t.computed(()=>e.data.phase==="response"),N=t.computed(()=>e.data.phase==="request"?Ee.Left:Ee.Right),S=t.computed(()=>e.data.phase==="request"?Ee.Right:Ee.Left),v=t.computed(()=>e.data.phase==="request"?Ee.Right:Ee.Left),D=t.computed(()=>E.value?n(`plugins.free-form.datakit.flow_editor.node_types.${e.data.type}.name`):e.data.name),L=t.computed(()=>E.value?nC:oC),k=t.computed(()=>{const K=new Map,O=r(e.data.id);for(const P of O){const T=a(P.source);if(!T)continue;const M=T.type==="vault",Y=T.phase!==e.data.phase;if(!M&&!Y)continue;let z;if(P.sourceField){const H=T.fields.output.find(Z=>Z.id===P.sourceField);z=H==null?void 0:H.name}if(P.targetField){const H=e.data.fields.input.find(Z=>Z.id===P.targetField);if(!H)continue;K.set(P.targetField,{fieldId:P.targetField,edgeId:P.id,field:H,sourceNode:T,sourceFieldName:z})}else K.set("input",{fieldId:"input",edgeId:P.id,field:null,sourceNode:T,sourceFieldName:z})}return K}),J=t.computed(()=>{const K=new Map,O=i(e.data.id);for(const P of O){const T=a(P.target);if(!T||!(T.phase!==e.data.phase))continue;let Y;if(P.targetField){const Z=T.fields.input.find(ie=>ie.id===P.targetField);Y=Z==null?void 0:Z.name}const z=P.sourceField||"output";if(!K.has(z)){const Z=P.sourceField&&e.data.fields.output.find(ie=>ie.id===P.sourceField)||null;K.set(z,{fieldId:z,edgeIds:[],field:Z,targetNodes:[],targetFieldNames:[]})}const H=K.get(z);H.edgeIds.push(P.id),H.targetNodes.push(T),H.targetFieldNames.push(Y)}return K});function I(K){return k.value.get(K)}function G(K){return J.value.get(K)}function j(K){!o||o.readonly||K==="input"&&!m.value||K==="output"&&!y.value||l(e.data.id,K)}async function te(){if(!o||o.readonly)return;const K=s(e.data.id,o.placeToRight(e.data.id));await o.selectNode(K),o.scrollRightToReveal(K),d.value=!0}return t.watch(m,K=>{K||l(e.data.id,"input",!0,!0,"*")},{immediate:!0}),t.watch(y,K=>{K||l(e.data.id,"output",!0,!0,"*")},{immediate:!0}),t.watch(()=>e.data.fields.input,(K,O)=>{qo(K,O)||l(e.data.id,"input",K.length>0,!0,"*")},{deep:!0}),t.watch(()=>e.data.fields.output,(K,O)=>{qo(K,O)||l(e.data.id,"output",K.length>0,!0,"*")},{deep:!0}),(K,O)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["dk-flow-node",{reversed:C.value,implicit:E.value,readonly:K.readonly}])},[t.createElementVNode("div",BV,[E.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(Pe.KTooltip),{key:0,class:"badge",placement:"top",text:K.data.type},{default:t.withCtx(()=>[t.createVNode(Ym,{"icon-only":"",size:"small",type:K.data.type},null,8,["type"])]),_:1},8,["text"])),t.createElementVNode("div",VV,t.toDisplayString(D.value),1),K.error?(t.openBlock(),t.createBlock(t.unref(Se.WarningIcon),{key:1,class:"error-icon",color:t.unref(Ya),size:16},null,8,["color"])):t.createCommentVNode("",!0),E.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(Pe.KDropdown),{key:2,class:"menu",disabled:K.readonly,"kpop-attributes":{offset:"4px",target:"body",popoverClasses:"dk-flow-node-menu"},width:"160",onClick:O[1]||(O[1]=t.withModifiers(()=>{},["stop"]))},{items:t.withCtx(()=>[t.createVNode(t.unref(Pe.KDropdownItem),{onClick:te},{default:t.withCtx(()=>[t.createVNode(na,{keys:t.unref(ri).duplicate,label:t.unref(n)("plugins.free-form.datakit.flow_editor.actions.duplicate")},null,8,["keys","label"])]),_:1}),t.createVNode(t.unref(Pe.KDropdownItem),{danger:"",onClick:O[0]||(O[0]=P=>t.unref(c)(K.data.id))},{default:t.withCtx(()=>[t.createVNode(na,{keys:t.unref(ri).delete,label:t.unref(n)("plugins.free-form.datakit.flow_editor.actions.delete")},null,8,["keys","label"])]),_:1})]),default:t.withCtx(()=>[t.createVNode(t.unref(Pe.KButton),{appearance:"tertiary",class:"menu-trigger",icon:"",size:"small"},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.MoreIcon),{color:t.unref(Ha)},null,8,["color"])]),_:1})]),_:1},8,["disabled"]))]),t.createElementVNode("div",{class:t.normalizeClass(["handles",{reversed:C.value}])},[b.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["input-handles",{"has-fields":u.value}])},[t.createElementVNode("div",RV,[t.createVNode(t.unref(Jt),{id:"input",position:N.value,type:"target"},null,8,["position"]),I("input")?(t.openBlock(),t.createBlock(oa,{key:0,"edge-id":I("input").edgeId,mode:"input",reversed:C.value,"source-field-name":I("input").sourceFieldName,"source-node":I("input").sourceNode},null,8,["edge-id","reversed","source-field-name","source-node"])):t.createCommentVNode("",!0),t.createElementVNode("div",DV,[t.createElementVNode("div",{class:t.normalizeClass(["handle-label trigger",{collapsible:m.value}]),onClick:O[2]||(O[2]=t.withModifiers(P=>j("input"),["stop"]))},[O[4]||(O[4]=t.createElementVNode("div",{class:"text"}," inputs ",-1)),u.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[_.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(Se.UnfoldMoreIcon),{key:0,size:t.unref(Xo)},null,8,["size"])),_.value?(t.openBlock(),t.createBlock(t.unref(Se.UnfoldLessIcon),{key:1,color:m.value?void 0:t.unref(Cd),size:t.unref(Xo)},null,8,["color","size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],2),u.value&&_.value?(t.openBlock(),t.createBlock(ta,{key:0,color:L.value,position:N.value,type:"bar"},null,8,["color","position"])):t.createCommentVNode("",!0)])]),u.value&&_.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(K.data.fields.input,(P,T)=>(t.openBlock(),t.createElementBlock("div",{key:`inputs-${P.id}`,class:"handle indented"},[t.createVNode(t.unref(Jt),{id:`inputs@${P.id}`,position:N.value,type:"target"},null,8,["id","position"]),I(P.id)?(t.openBlock(),t.createBlock(oa,{key:0,"edge-id":I(P.id).edgeId,mode:"input",reversed:C.value,"source-field-name":I(P.id).sourceFieldName,"source-node":I(P.id).sourceNode},null,8,["edge-id","reversed","source-field-name","source-node"])):t.createCommentVNode("",!0),t.createElementVNode("div",MV,[t.createElementVNode("div",LV,t.toDisplayString(P.name),1),t.createVNode(ta,{color:L.value,position:N.value,type:T<K.data.fields.input.length-1?"trident":"corner"},null,8,["color","position","type"])])]))),128)):t.createCommentVNode("",!0)],2)):t.createCommentVNode("",!0),x.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["output-handles",{"has-fields":p.value}])},[t.createElementVNode("div",FV,[t.createElementVNode("div",UV,[t.createElementVNode("div",{class:t.normalizeClass(["handle-label trigger",{collapsible:y.value}]),onClick:O[3]||(O[3]=t.withModifiers(P=>j("output"),["stop"]))},[O[5]||(O[5]=t.createElementVNode("div",{class:"text"}," outputs ",-1)),p.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[g.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(Se.UnfoldMoreIcon),{key:0,size:t.unref(Xo)},null,8,["size"])),g.value?(t.openBlock(),t.createBlock(t.unref(Se.UnfoldLessIcon),{key:1,color:y.value?void 0:t.unref(Cd),size:t.unref(Xo)},null,8,["color","size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],2),p.value&&g.value?(t.openBlock(),t.createBlock(ta,{key:0,color:L.value,position:S.value,type:"bar"},null,8,["color","position"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(Jt),{id:"output",position:S.value,type:"source"},null,8,["position"]),G("output")?(t.openBlock(),t.createBlock(oa,{key:0,mode:"output",reversed:C.value,"target-field-names":G("output").targetFieldNames,"target-nodes":G("output").targetNodes},null,8,["reversed","target-field-names","target-nodes"])):t.createCommentVNode("",!0)]),p.value&&g.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(K.data.fields.output,(P,T)=>(t.openBlock(),t.createElementBlock("div",{key:`outputs-${P.id}`,class:"handle indented"},[t.createElementVNode("div",KV,[t.createElementVNode("div",jV,t.toDisplayString(P.name),1),t.createVNode(ta,{color:L.value,position:S.value,type:T<K.data.fields.output.length-1?"trident":"corner"},null,8,["color","position","type"])]),t.createVNode(t.unref(Jt),{id:`outputs@${P.id}`,position:S.value,type:"source"},null,8,["id","position"]),G(P.id)?(t.openBlock(),t.createBlock(oa,{key:0,mode:"output",reversed:C.value,"target-field-names":G(P.id).targetFieldNames,"target-nodes":G(P.id).targetNodes},null,8,["reversed","target-field-names","target-nodes"])):t.createCommentVNode("",!0)]))),128)):t.createCommentVNode("",!0)],2)):t.createCommentVNode("",!0),w.value?(t.openBlock(),t.createElementBlock("div",GV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,P=>(t.openBlock(),t.createElementBlock("div",{key:`branch-${P}`,class:"handle"},[t.createElementVNode("div",qV,[t.createElementVNode("div",zV,t.toDisplayString(P),1)]),t.createVNode(t.unref(Jt),{id:`branch@${P}`,connectable:!1,position:v.value,type:"source"},null,8,["id","position"])]))),128))])):t.createCommentVNode("",!0)],2)],2))}}),[["__scopeId","data-v-2ecee64b"]]),HV=ve(t.defineComponent({__name:"GroupNode",props:{data:{},active:{type:Boolean}},setup(e){const n=e,o=t.computed(()=>n.data.phase==="response"),r=t.computed(()=>o.value?Ee.Right:Ee.Left);return(i,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["dk-branch-group-node",{reversed:o.value,"drop-target":i.active}])},[t.createVNode(t.unref(Jt),{id:"input",connectable:!1,position:r.value,type:"target"},null,8,["position"])],2))}}),[["__scopeId","data-v-61116224"]]),YV={key:0,class:"dk-flow-mask"},Xm=ve(t.defineComponent({__name:"FlowCanvas",props:{flowId:{},phase:{},mode:{}},emits:["initialized","nodes-change"],setup(e,{expose:n,emit:o}){const r=o,i=t.useTemplateRef("flowCanvas"),a=Ye.useElementBounding(i),{i18n:{t:l}}=Be(),{vueFlowStore:s,editorStore:c,autoLayout:d,fitViewParams:f,fitView:u,selectNode:p,placeToRight:m,scrollRightToReveal:y,groupDrop:_}=EV({phase:e.phase,flowId:e.flowId,layoutOptions:{viewport:{width:a.width,height:a.height}},readonly:e.mode!=="edit"}),{addNode:g,propertiesPanelOpen:h,invalidConfigNodeIds:w,selectedNode:b,duplicateNode:x,commit:E}=c,{screenToFlowCoordinate:C,zoomIn:N,zoomOut:S,viewport:v,maxZoom:D,minZoom:L}=s,{activeGroupId:k,startPanelDrag:J,endPanelDrag:I,updateActiveGroup:G,attachNodeToActiveGroup:j}=_,te=t.ref(!1);function K(H){var ie;const Z=(ie=H.dataTransfer)==null?void 0:ie.types.find(be=>be.startsWith(`${nr}/`));if(Z)return Z.replace(`${nr}/`,"")}function O(H){var Z;if(e.mode==="edit"){if(((Z=H==null?void 0:H.node)==null?void 0:Z.type)==="group"){p(void 0);return}h.value=!0}}function P(H){e.mode!=="edit"||te.value||(H.preventDefault(),G(C({x:H.clientX,y:H.clientY})))}function T(H){var fe;if(e.mode!=="edit"||te.value)return;const Z=(fe=H.dataTransfer)==null?void 0:fe.getData(nr);if(!Z)return;H.preventDefault();const ie=JSON.parse(Z);if(ie.action!=="create-node")return;const be=C({x:H.clientX,y:H.clientY}),{type:ee,anchor:re}=ie.data,le={type:ee,phase:e.phase,position:{x:be.x-re.offsetX,y:be.y-re.offsetY}},ue=g(le,!1);if(!ue){I();return}j(ue),E(),p(ue),h.value=!0,I()}async function M(){await d(),setTimeout(()=>u(),0)}const Y=t.computed(()=>{if(e.mode==="preview")return[];const H=[{name:"zoom_in",icon:Se.AddIcon,action:N,disabled:v.value.zoom>=D.value},{name:"zoom_out",icon:Se.RemoveIcon,action:S,disabled:v.value.zoom<=L.value},{name:"fit_view",icon:Se.FullscreenIcon,action:u}];return e.mode==="edit"&&H.push({name:"auto_layout",icon:Se.AutoLayoutIcon,action:M}),H});if(e.phase==="response"&&e.mode==="edit"){Ye.useEventListener("dragstart",Z=>{K(Z)==="call"&&(te.value=!0)});const{start:H}=Ye.useTimeoutFn(()=>{te.value=!1},80);Ye.useEventListener("dragover",()=>{H()}),Ye.useEventListener("dragend",()=>{te.value=!1})}e.mode==="edit"&&(Ye.useEventListener("dragstart",H=>{K(H)&&J()}),Ye.useEventListener("dragend",()=>{I()}));async function z(){const H=b.value;if(e.mode!=="edit"||!H||H.phase!==e.phase)return;const Z=x(H.id,m(H.id));Z&&(await p(Z),h.value=!0,y(Z))}return zp({enabled:t.computed(()=>!!b.value&&e.mode==="edit"&&b.value.phase===e.phase),duplicate:z}),n({autoLayout:d,fitView:u}),(H,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"flowCanvas",ref:i,class:"dk-flow-canvas"},[t.createVNode(t.unref(Kp),{id:H.flowId,class:t.normalizeClass(["flow",{readonly:H.mode!=="edit"}]),"connect-on-click":!1,"elements-selectable":H.mode==="edit","max-zoom":t.unref(pP),"min-zoom":t.unref(mP),"multi-selection-key-code":null,"nodes-connectable":H.mode==="edit","nodes-draggable":H.mode==="edit","pan-on-drag":H.mode==="preview"?!1:void 0,"pan-on-scroll":H.mode!=="edit"?!1:void 0,"zoom-on-double-click":H.mode!=="edit"?!1:void 0,"zoom-on-pinch":H.mode!=="edit"?!1:void 0,"zoom-on-scroll":H.mode!=="edit"?!1:void 0,onDragover:P,onDrop:T,onNodeClick:O,onNodesChange:Z[0]||(Z[0]=ie=>r("nodes-change")),onNodesInitialized:Z[1]||(Z[1]=ie=>r("initialized"))},{"node-flow":t.withCtx(({data:ie})=>[t.createVNode(Wm,{data:ie,error:t.unref(w).has(ie.id),readonly:H.mode!=="edit"},null,8,["data","error","readonly"])]),"node-group":t.withCtx(({data:ie})=>[t.createVNode(HV,{active:t.unref(k)===ie.id,data:ie},null,8,["active","data"])]),default:t.withCtx(()=>[t.createVNode(t.unref(VT)),t.createVNode(t.unref(lP),{"fit-view-params":t.unref(f),position:"bottom-left","show-fit-view":!1,"show-interactive":!1,"show-zoom":!1},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Y.value,ie=>(t.openBlock(),t.createBlock(t.unref(Pe.KTooltip),{key:ie.name,placement:"right",text:t.unref(l)(`plugins.free-form.datakit.flow_editor.actions.${ie.name}`)},{default:t.withCtx(()=>[t.createVNode(t.unref(kr),{disabled:ie.disabled,onClick:t.withModifiers(ie.action,["stop"])},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(ie.icon),{size:18}))]),_:2},1032,["disabled","onClick"])]),_:2},1032,["text"]))),128))]),_:1},8,["fit-view-params"])]),_:1},8,["id","class","elements-selectable","max-zoom","min-zoom","nodes-connectable","nodes-draggable","pan-on-drag","pan-on-scroll","zoom-on-double-click","zoom-on-pinch","zoom-on-scroll"]),te.value?(t.openBlock(),t.createElementBlock("div",YV,t.toDisplayString(t.unref(l)("plugins.free-form.datakit.flow_editor.phase_mask_help")),1)):t.createCommentVNode("",!0)],512))}}),[["__scopeId","data-v-f0850db9"]]),Ns=ve(t.defineComponent({__name:"FlowPanels",props:{inactive:{type:Boolean},mode:{},resizable:{type:Boolean}},setup(e){const n=t.ref(!1),o=t.ref(!1),{state:r,clearPendingLayout:i,setPendingFitView:a,commit:l,clear:s}=at(),c=t.useId(),d=`${c}-request`,f=`${c}-response`,u=Le(d),p=Le(f);function m(M,Y){const{onPaneClick:z,onNodesChange:H,onEdgesChange:Z,getSelectedNodes:ie,getSelectedEdges:be}=M,{removeSelectedElements:ee}=Y;function re(le){if(!le){ee();return}le.some(ue=>ue.type==="select")&&ie.value.length+be.value.length>0&&ee()}H(re),Z(re),z(()=>re())}m(u,p),m(p,u);const y=t.useTemplateRef("flowPanels"),_=t.useTemplateRef("requestLabel"),g=t.useTemplateRef("requestCanvasContainer"),h=t.useTemplateRef("requestFlow"),w=t.useTemplateRef("resizeHandle"),b=t.useTemplateRef("responseLabel"),x=t.useTemplateRef("responseCanvasContainer"),E=t.useTemplateRef("responseFlow"),C=Ye.useElementBounding(y),N=Ye.useElementBounding(_),S=Ye.useElementBounding(g),v=Ye.useElementBounding(w),D=Ye.useElementBounding(b),L=Ye.useElementBounding(x),k=t.computed(()=>Math.max(30,C.height.value*.03)),J=t.computed(()=>S.height.value<k.value),I=t.computed(()=>L.height.value<k.value),G=t.ref("50%"),j=t.ref("50%"),te=()=>{e.resizable&&(J.value?(G.value="50%",j.value="50%"):(G.value="0",j.value="100%"))},K=()=>{e.resizable&&(I.value?(G.value="50%",j.value="50%"):(G.value="100%",j.value="0"))},O=t.computed(()=>C.height.value-N.height.value-v.height.value-D.height.value),{isDragging:P}=Ye.useDraggable(w,{onMove(M){if(!e.resizable)return;const Y=Math.max(0,M.y-S.top.value),z=Math.min(1,Math.max(0,Y/O.value));G.value=`${z*100}%`,j.value=`${(1-z)*100}%`},onEnd(){e.resizable&&(S.height.value<k.value?(G.value="0",j.value="100%"):L.height.value<k.value&&(G.value="100%",j.value="0"))}});function T(){t.nextTick(()=>{var M,Y;(M=h.value)==null||M.fitView(),(Y=E.value)==null||Y.fitView()})}return t.watch([n,o,()=>r.value.pendingLayout,()=>r.value.pendingFitView],([M,Y,z,H])=>{e.inactive||!M||!Y||!z&&!H||(z&&i(),H&&a(!1),setTimeout(async()=>{var Z,ie;z&&(await((Z=h.value)==null?void 0:Z.autoLayout(!1)),await((ie=E.value)==null?void 0:ie.autoLayout(!1)),l("*"),z==="clearHistory"&&s()),H&&setTimeout(()=>T(),0)},0))}),(M,Y)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"flowPanels",ref:y,class:"flow-panels"},[t.createElementVNode("div",{ref_key:"requestLabel",ref:_,class:t.normalizeClass(["label request",{resizable:M.resizable}]),onClick:te},[M.resizable?(t.openBlock(),t.createBlock(t.unref(Se.ChevronDownIcon),{key:0,class:t.normalizeClass(["icon",{collapsed:J.value}])},null,8,["class"])):t.createCommentVNode("",!0),Y[4]||(Y[4]=t.createElementVNode("div",{class:"label-content"}," Request ",-1))],2),t.createElementVNode("div",{ref_key:"requestCanvasContainer",ref:g,class:t.normalizeClass(["canvas",{dragging:t.unref(P)}]),style:t.normalizeStyle({flexBasis:G.value})},[t.createVNode(Xm,{ref_key:"requestFlow",ref:h,"flow-id":d,mode:M.mode,phase:"request",onInitialized:Y[0]||(Y[0]=z=>n.value=!0),onNodesChange:Y[1]||(Y[1]=z=>n.value=!1)},null,8,["mode"])],6),t.createElementVNode("div",{ref_key:"resizeHandle",ref:w,class:t.normalizeClass(["resize-handle",{resizable:M.resizable}])},null,2),t.createElementVNode("div",{ref_key:"responseLabel",ref:b,class:t.normalizeClass(["label response",{dragging:t.unref(P),resizable:M.resizable}]),onClick:K},[M.resizable?(t.openBlock(),t.createBlock(t.unref(Se.ChevronDownIcon),{key:0,class:t.normalizeClass(["icon",{collapsed:I.value}])},null,8,["class"])):t.createCommentVNode("",!0),Y[5]||(Y[5]=t.createElementVNode("div",{class:"label-content"}," Response ",-1))],2),t.createElementVNode("div",{ref_key:"responseCanvasContainer",ref:x,class:t.normalizeClass(["canvas response",{dragging:t.unref(P)}]),style:t.normalizeStyle({flexBasis:j.value})},[t.createVNode(Xm,{ref_key:"responseFlow",ref:E,"flow-id":f,mode:M.mode,phase:"response",onInitialized:Y[2]||(Y[2]=z=>o.value=!0),onNodesChange:Y[3]||(Y[3]=z=>o.value=!1)},null,8,["mode"])],6)],512))}}),[["__scopeId","data-v-f6dd01e7"]]),WV={class:"dk-confirm-modal-body"},XV={class:"connections"},ZV=ve(t.defineComponent({__name:"ConflictModal",props:{title:{},message:{},addedConnections:{},removedConnections:{}},emits:["cancel","confirm"],setup(e,{expose:n,emit:o}){const{i18n:{t:r}}=Be(),i=o,a=t.ref(!1),l=t.ref(e.message),s=t.ref(e.addedConnections??[]),c=t.ref(e.removedConnections??[]);let d=null;function f(){a.value=!1,i("cancel"),d==null||d(!1)}function u(){a.value=!1,i("confirm"),d==null||d(!0)}async function p(m,y,_){return l.value=m,s.value=y??[],c.value=_??[],a.value=!0,await new Promise(g=>{d=g})}return n({open:p}),(m,y)=>{const _=t.resolveComponent("KModal");return t.openBlock(),t.createBlock(_,{"action-button-text":t.unref(r)("plugins.free-form.datakit.flow_editor.confirm.proceed"),"close-on-backdrop-click":"","max-width":"660px",title:m.title??t.unref(r)("plugins.free-form.datakit.flow_editor.confirm.title"),visible:a.value,"z-index":9999,onCancel:f,onProceed:u},{default:t.withCtx(()=>[t.createElementVNode("div",WV,[t.createElementVNode("p",null,t.toDisplayString(l.value),1),t.createElementVNode("p",null,t.toDisplayString(t.unref(r)("plugins.free-form.datakit.flow_editor.confirm.message.confirm")),1),t.createElementVNode("div",XV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value??[],([g,h])=>(t.openBlock(),t.createElementBlock("div",{key:`${g}-${h}`,class:"connection"},[t.createVNode(t.unref(Se.AddIcon),{color:t.unref(rC)},null,8,["color"]),t.createTextVNode(" "+t.toDisplayString(g)+" → "+t.toDisplayString(h),1)]))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value??[],([g,h])=>(t.openBlock(),t.createElementBlock("div",{key:`${g}-${h}`,class:"connection"},[t.createVNode(t.unref(Se.RemoveIcon),{color:t.unref(Ya)},null,8,["color"]),t.createTextVNode(" "+t.toDisplayString(g)+" → "+t.toDisplayString(h),1)]))),128))])])]),_:1},8,["action-button-text","title","visible"])}}}),[["__scopeId","data-v-ac52e1e6"]]),JV={class:"dk-editor-nav"},QV={class:"top"},eR={class:"bottom"},tR=ve(t.defineComponent({__name:"EditorNav",emits:["back"],setup(e,{emit:n}){const{t:o}=Ze.createI18n("en-us",rt),r=n,i=[{label:o("plugins.free-form.datakit.flow_editor.return_to_config"),icon:Se.ArrowLeftIcon,onClick:()=>r("back")}],{sidePanelExpanded:a}=Cl(),l=t.computed(()=>a.value?o("plugins.free-form.datakit.flow_editor.collapse_panel"):o("plugins.free-form.datakit.flow_editor.expand_panel")),s=t.ref(!1);function c(){a.value=!a.value}return(d,f)=>(t.openBlock(),t.createElementBlock("nav",JV,[t.createElementVNode("div",QV,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,({label:u,to:p,icon:m,onClick:y})=>t.createVNode(t.unref(Pe.KTooltip),{key:u,"kpop-attributes":{offset:"10px"},label:u,placement:"right"},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.unref(Pe.KButton),{key:u,appearance:"none",class:"nav-item",icon:"",to:p,onClick:y},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(m),{decorative:"",size:t.unref(Xa)},null,8,["size"]))]),_:2},1032,["to","onClick"]))]),_:2},1032,["label"])),64))]),t.createElementVNode("div",eR,[t.createElementVNode("div",{class:t.normalizeClass(["side-panel-toggle",{expanded:t.unref(a)}]),onTransitionend:f[0]||(f[0]=t.withModifiers(u=>s.value=!1,["self"])),onTransitionstart:f[1]||(f[1]=t.withModifiers(u=>s.value=!0,["self"]))},[t.createVNode(t.unref(Pe.KTooltip),{label:s.value?void 0:l.value,placement:t.unref(a)?"left":"right"},{default:t.withCtx(()=>[t.createVNode(t.unref(Pe.KButton),{appearance:"none",class:"nav-item nav-item-toggle",icon:"",size:"large",onClick:c},{default:t.withCtx(()=>[t.unref(a)?(t.openBlock(),t.createBlock(t.unref(Se.ChevronDoubleLeftIcon),{key:0,decorative:"",size:t.unref(Xa)},null,8,["size"])):(t.openBlock(),t.createBlock(t.unref(Se.ChevronDoubleRightIcon),{key:1,decorative:"",size:t.unref(Xa)},null,8,["size"]))]),_:1})]),_:1},8,["label","placement"])],34)])]))}}),[["__scopeId","data-v-2915b6fa"]]),nR={class:"dk-editor-main"},oR={class:"header"},rR={class:"actions"},iR={class:"settings"},aR={ref:"canvasContainer",class:"body"},lR=ve(t.defineComponent({__name:"EditorMain",setup(e){const{t:n}=Ze.createI18n("en-us",rt),{modalOpen:o,undo:r,redo:i,canUndo:a,canRedo:l,load:s}=at();function c(u){const p=oi.load(u,{schema:ni,json:!0});if(typeof p!="object"||p===null)return;const m=p,y={config:{...m,nodes:m.nodes??[]}};s(y,!0)}function d(){o.value=!1}zp({enabled:o,undo:r,redo:i});const f={maxWidth:"300px",zIndex:1e4};return(u,p)=>(t.openBlock(),t.createElementBlock("div",nR,[t.createElementVNode("header",oR,[t.createElementVNode("div",rR,[t.createVNode(t.unref(Pe.KTooltip),{"z-index":1e4},{content:t.withCtx(()=>[t.createVNode(na,{keys:t.unref(ri).undo,label:t.unref(n)("plugins.free-form.datakit.flow_editor.actions.undo"),reverse:""},null,8,["keys","label"])]),default:t.withCtx(()=>[t.createVNode(t.unref(Pe.KButton),{appearance:"tertiary",disabled:!t.unref(a),icon:"",onClick:t.unref(r)},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.UndoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),t.createVNode(t.unref(Pe.KTooltip),{"z-index":1e4},{content:t.withCtx(()=>[t.createVNode(na,{keys:t.unref(ri).redo,label:t.unref(n)("plugins.free-form.datakit.flow_editor.actions.redo"),reverse:""},null,8,["keys","label"])]),default:t.withCtx(()=>[t.createVNode(t.unref(Pe.KButton),{appearance:"tertiary",disabled:!t.unref(l),icon:"",onClick:t.unref(i)},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.RedoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),p[0]||(p[0]=t.createElementVNode("div",{class:"divider"},null,-1)),t.createElementVNode("div",iR,[t.createVNode(zr,{label:t.unref(n)("plugins.free-form.datakit.flow_editor.debug.label"),"label-attributes":{info:t.unref(n)("plugins.free-form.datakit.flow_editor.debug.description"),tooltipAttributes:f},name:"config.debug"},null,8,["label","label-attributes"])]),p[1]||(p[1]=t.createElementVNode("div",{class:"divider"},null,-1)),t.createVNode(t.unref(Pe.KDropdown),{appearance:"tertiary","kpop-attributes":{placement:"bottom-end",target:"body"},"show-caret":"","trigger-text":t.unref(n)("plugins.free-form.datakit.flow_editor.examples")},{items:t.withCtx(()=>[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ul,(m,y)=>t.createVNode(t.unref(Pe.KDropdownItem),{key:y,onClick:_=>c(m)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)(`plugins.free-form.datakit.examples.${y}`)),1)]),_:2},1032,["onClick"])),64))]),_:1},8,["trigger-text"]),t.createVNode(t.unref(Pe.KButton),{appearance:"tertiary",target:"_blank",to:"https://developer.konghq.com/plugins/datakit/"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.actions.view_docs"))+" ",1),t.createVNode(t.unref(Se.ExternalLinkIcon))]),_:1}),t.createVNode(t.unref(Pe.KButton),{onClick:d},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.actions.done")),1)]),_:1})])]),t.createElementVNode("div",aR,[t.createVNode(Ns,{mode:"edit",resizable:""})],512)]))}}),[["__scopeId","data-v-32006420"]]),sR=["draggable"],cR={class:"icon"},dR={class:"content"},uR={class:"title"},fR={class:"description"},pR=ve(t.defineComponent({__name:"NodePanelItem",props:{type:{},unsupported:{type:Boolean}},emits:["dragstart"],setup(e,{emit:n}){t.useCssVars(c=>({f628e926:t.unref(a),"4a9b9f82":t.unref(l)}));const o=n,{summary:r,icon:i,colors:{background:a,foreground:l}={}}=ml[e.type];function s(c){o("dragstart",c,e.type)}return(c,d)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["dk-node-panel-item",{[`node-type-${c.type}`]:!0,unsupported:c.unsupported}]),draggable:!c.unsupported,onDragstart:s},[t.createElementVNode("div",cR,[t.createVNode(t.unref(i),{size:16})]),t.createElementVNode("div",dR,[t.createElementVNode("div",uR,t.toDisplayString(c.type),1),t.createElementVNode("div",fR,t.toDisplayString(t.unref(r)),1)])],42,sR))}}),[["__scopeId","data-v-38d156c9"]]),mR={class:"dk-node-panel"},gR={key:0,class:"title"},hR={class:"node-list"},yR={"aria-hidden":"true",class:"preview",inert:""},Zm=ve(t.defineComponent({__name:"NodePanel",props:{hideTitle:{type:Boolean}},setup(e){const{t:n}=Ze.createI18n("en-us",rt),{createNode:o}=at(),r=t.inject(so.DATAKIT_M2,!1),i=["branch","cache"],a=`dk-drag-preview-${t.useId()}`,l=t.shallowRef(),s=t.computed(()=>l.value?[{id:"preview",type:"flow",data:l.value,position:{x:0,y:0}}]:[]),c=async(d,f)=>{var D,L,k;const u=d.currentTarget,{left:p,top:m,width:y,height:_}=u.getBoundingClientRect(),g=d.clientX-p,h=d.clientY-m;l.value=o({type:f}),await t.nextTick();const w=document.querySelector(`#${a}`)||u,b=w.cloneNode(!0);b.classList.add("dk-drag-snapshot");const{offsetWidth:x,offsetHeight:E}=w;Object.assign(b.style,{position:"absolute",top:"-9999px",left:"-9999px",width:`${x}px`,height:`${E}px`}),document.body.appendChild(b);const C=g/y,N=h/_,S={ratioX:C,ratioY:N,offsetX:x*C,offsetY:E*N},v={action:"create-node",data:{type:f,anchor:S}};(D=d.dataTransfer)==null||D.setData(nr,JSON.stringify(v)),(L=d.dataTransfer)==null||L.setData(`${nr}/${f}`,f),(k=d.dataTransfer)==null||k.setDragImage(b,S.offsetX,S.offsetY),requestAnimationFrame(()=>{b.remove(),l.value=void 0})};return(d,f)=>{const u=t.resolveComponent("KLabel");return t.openBlock(),t.createElementBlock("div",mR,[d.hideTitle?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("h3",gR,[t.createVNode(u,{class:"label",info:t.unref(n)("plugins.free-form.datakit.flow_editor.node_panel.description")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.node_panel.title")),1)]),_:1},8,["info"])])),t.createElementVNode("div",hR,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Object.keys(t.unref(ml)),p=>(t.openBlock(),t.createBlock(pR,{key:p,type:p,unsupported:!t.unref(r)&&i.includes(p),onDragstart:c},null,8,["type","unsupported"]))),128))]),t.createElementVNode("div",yR,[t.createVNode(t.unref(Kp),{nodes:s.value},{"node-flow":t.withCtx(p=>[t.createVNode(Wm,{id:a,data:p.data},null,8,["data"])]),_:1},8,["nodes"])])])}}}),[["__scopeId","data-v-cfbff8f1"]]);function _R(){const{addField:e,getNodeByName:n,removeField:o,replaceConfig:r,renameField:i,disconnectOutEdges:a,nodeMapByName:l}=at(),s=n("vault");if(!s)throw new Error("no vault node");const c=t.computed(()=>{var y;return((y=l.value.get("vault"))==null?void 0:y.config)||{}});return{formData:t.computed(()=>({vault:{...c.value}})),addVault:(y,_)=>{e(s.id,"output",y,!1);const g={...s.config,[y]:_};r(s.id,g)},removeVault:y=>{const _=_n(s,"output",y);if(!_)return;const g=s.fields.output.length===1;o(s.id,_.id,!0,!1);const h=zo(s.config,y);r(s.id,h,!g),g&&a(s.id)},updateVault:(y,_,g=!0)=>{const h={...s.config,[y]:_};r(s.id,h,g)},renameVault:(y,_,g=!0)=>{var x;const h=_n(s,"output",y);if(!h)return;i(s.id,h.id,_,!1);const w=((x=s.config)==null?void 0:x[y])??"",b={...zo(s.config,y),[_]:w};r(s.id,b,g)}}}const bR=t.defineComponent({__name:"VaultSecretPicker",props:{secretRef:{type:[String,Boolean]},secretName:{},validateName:{type:Function,default:()=>{}},isEditing:{type:Boolean,default:!1}},emits:["proceed","cancel"],setup(e,{emit:n}){const o=n,{i18n:{t:r}}=Fe.useI18n(),i=t.inject(De.FORMS_CONFIG),a=t.ref(e.secretName||""),l=t.ref(""),s=t.computed(()=>a.value.trim()?e.validateName(a.value.trim(),e.isEditing)===void 0:!1),c=t.computed(()=>!s.value),d=()=>{const m=a.value.trim(),y=e.validateName(m,e.isEditing);return l.value=y||"",y===void 0},f=()=>{l.value="",d()},u=m=>{d()&&o("proceed",{secretRef:m,secretName:a.value.trim()})},p=()=>{a.value="",l.value="",o("cancel")};return t.watch(()=>e.secretName,m=>{a.value=m||"",l.value=""}),(m,y)=>{const _=t.resolveComponent("KInput"),g=t.resolveComponent("KEmptyState");return t.unref(i)?(t.openBlock(),t.createBlock(t.unref(Vo.VaultSecretPicker),{key:0,"additional-disabled":c.value,config:t.unref(i),"proceed-button-text":t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.proceed_button_text"),setup:m.secretRef,title:t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.title"),onCancel:p,onProceed:u},{"form-prefix":t.withCtx(()=>[t.createVNode(_,{"model-value":a.value,"onUpdate:modelValue":[y[0]||(y[0]=h=>a.value=h),f],"data-testid":"vault-secret-picker-secret-name-input",error:!!l.value,"error-message":l.value,label:t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.label"),"label-attributes":{info:t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.help")},placeholder:t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.placeholder"),required:""},null,8,["model-value","error","error-message","label","label-attributes","placeholder"])]),_:1},8,["additional-disabled","config","proceed-button-text","setup","title"])):(t.openBlock(),t.createBlock(g,{key:1,"icon-variant":"error",message:t.unref(r)("plugins.free-form.vault_picker.component_error")},null,8,["message"]))}}}),wR={class:"dk-vault-panel"},kR={class:"title"},CR={class:"vault-list"},ER={key:0,class:"vault-list-item"},NR={class:"vault-list-item-key"},SR={class:"vault-list-item-key-text"},xR=ve(t.defineComponent({__name:"VaultField",props:{name:{},initialValue:{},label:{},keyPlaceholder:{},valuePlaceholder:{},defaultKey:{},defaultValue:{},labelAttributes:{},showVaultSecretPicker:{type:Boolean},keyOrder:{}},emits:["update","add","remove","change"],setup(e,{emit:n}){const o=e,r=n,{entries:i,addEntry:a,removeEntry:l}=Hr(o,r),s=t.ref(null),c=t.ref(null),{i18n:{t:d}}=Fe.useI18n(),f=t.computed(()=>new Set(i.value.map(h=>h.key))),u=()=>{const h=a();c.value=h,s.value=h},p=()=>{s.value=null,c.value&&(l(c.value.id),c.value=null)},m=h=>{if(!s.value)throw new Error("no selected entry");const w=s.value.key,b=w!==h.secretName,x=s.value.value!==h.secretRef,E=b||x;s.value.value=h.secretRef,s.value.key=h.secretName,c.value?r("add",h.secretName,h.secretRef):E&&r("update",h.secretName,h.secretRef,b?w:void 0),c.value=null,p()},y=h=>{s.value=h},_=h=>{l(h.id),r("remove",h.key)},g=(h,w)=>{var b;if(!h)return d("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_required_error");if(f.value.has(h)&&!(w&&h===((b=s.value)==null?void 0:b.key)))return d("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_exists_error")};return(h,w)=>{var C,N;const b=t.resolveComponent("KButton"),x=t.resolveComponent("KDropdownItem"),E=t.resolveComponent("KDropdown");return t.openBlock(),t.createElementBlock("div",wR,[t.createElementVNode("h3",kR,t.toDisplayString(t.unref(d)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.title")),1),t.createVNode(b,{appearance:"tertiary",class:"add-button",size:"small",onClick:u},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(d)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.add_button")),1)]),_:1}),t.createElementVNode("div",CR,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i),S=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S.id},[S.key?(t.openBlock(),t.createElementBlock("div",ER,[t.createElementVNode("div",NR,[t.createVNode(t.unref(Se.KeyIcon),{color:t.unref(Wa),size:16},null,8,["color"]),t.createElementVNode("div",SR,t.toDisplayString(S.key),1)]),t.createVNode(E,null,{items:t.withCtx(()=>[t.createVNode(x,{onClick:v=>y(S)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(d)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:2},1032,["onClick"]),t.createVNode(x,{danger:"",onClick:v=>_(S)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(d)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:2},1032,["onClick"])]),default:t.withCtx(()=>[t.createVNode(b,{appearance:"tertiary",icon:""},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.MoreIcon),{color:t.unref(Ha)},null,8,["color"])]),_:1})]),_:2},1024)])):t.createCommentVNode("",!0)],64))),128))]),t.createVNode(bR,{"is-editing":!!s.value&&!c.value,"secret-name":(C=s.value)==null?void 0:C.key,"secret-ref":(N=s.value)==null?void 0:N.value,"validate-name":g,onCancel:p,onProceed:m},null,8,["is-editing","secret-name","secret-ref"])])}}}),[["__scopeId","data-v-c9f18d61"]]);function vR(){const{getSchema:e}=ze();return t.computed(()=>{const n=e("config.resources");if(!n)throw new Error("Failed to get resource schema");const o=ln(n);return o.fields.forEach(r=>{const i=Object.keys(r)[0];if(i==="cache"){const a=r[i];r[i]={...a,fields:[...a.fields,{partial_id:{type:"string"}}]}}}),o})}const AR={class:"dk-cache-panel"},IR={class:"title"},TR={key:0,class:"cache-item"},PR={class:"cache-item-key"},OR={class:"cache-item-key-text"},$R={class:"dk-resource-cache-form"},BR={key:1},VR={key:2,class:"dk-cache-inline-redis"},RR=ve(t.defineComponent({__name:"CacheField",props:{strategy:{}},emits:["update","remove","cancel"],setup(e,{emit:n}){const o=n,{getDefault:r,formData:i}=ze(),a=Et("cache");if(a.error)throw new Error("No cache schema");const l=t.ref(!1),{i18n:{t:s}}=Fe.useI18n(),c=t.computed(()=>!(d.value==="redis"&&!i.cache.partial_id&&!i.cache.redis)),d=t.computed(()=>{var x;return(x=a.value.value)==null?void 0:x.strategy}),f=t.computed(()=>{var x;return(x=a.value.value)!=null&&x.redis?oi.dump(a.value.value.redis,{indent:2,noRefs:!0}):""}),u=()=>{l.value=!0},p=()=>{l.value=!1,o("cancel")},m=()=>{o("remove")},y=()=>{u(),a.value.value||(a.value.value=r("cache"),a.value.value.strategy="memory")},_=()=>{l.value=!1,o("update",i)},g=Bs.createdBundledHighlighter({langs:{yaml:()=>import("@shikijs/langs/yaml")},themes:{"github-dark":()=>import("@shikijs/themes/github-dark")},engine:()=>yg.createJavaScriptRegexEngine()}),{codeToHtml:h}=Bs.createSingletonShorthands(g),w=()=>{var x,E;d.value==="memory"&&((x=i.cache)!=null&&x.partial_id)&&((E=i.cache)==null||delete E.partial_id)};async function b({codeElement:x,language:E,code:C}){x.innerHTML=await h(C,{lang:E,theme:"github-dark",structure:"inline"})}return(x,E)=>{const C=t.resolveComponent("KButton"),N=t.resolveComponent("KDropdownItem"),S=t.resolveComponent("KDropdown"),v=t.resolveComponent("KLabel"),D=t.resolveComponent("KCodeBlock"),L=t.resolveComponent("KModal");return t.openBlock(),t.createElementBlock("div",AR,[t.createElementVNode("h3",IR,t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title")),1),x.strategy?(t.openBlock(),t.createElementBlock("div",TR,[t.createElementVNode("div",PR,[t.createVNode(t.unref(Se.DeployIcon),{color:t.unref(Wa),size:t.unref(Ed)},null,8,["color","size"]),t.createElementVNode("div",OR,t.toDisplayString(x.strategy),1)]),t.createVNode(S,null,{items:t.withCtx(()=>[t.createVNode(N,{onClick:u},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1}),t.createVNode(N,{danger:"",onClick:m},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1})]),default:t.withCtx(()=>[t.createVNode(C,{appearance:"tertiary",icon:""},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.MoreIcon),{color:t.unref(Ha)},null,8,["color"])]),_:1})]),_:1})])):(t.openBlock(),t.createBlock(C,{key:1,appearance:"tertiary",class:"add-button",size:"small",onClick:y},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.add_button")),1)]),_:1})),t.createVNode(L,{"action-button-disabled":!c.value,"action-button-text":t.unref(s)("actions.save"),"max-width":"640px",title:t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title"),visible:l.value,onCancel:p,onProceed:_},{default:t.withCtx(()=>{var k,J;return[t.createElementVNode("div",$R,[t.createVNode(kd,{items:[{label:t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.memory"),value:"memory"},{label:t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.redis"),value:"redis"}],name:"strategy","onUpdate:modelValue":w},null,8,["items"]),d.value==="memory"?(t.openBlock(),t.createBlock(ht,{key:0,name:"memory.dictionary_name"})):t.createCommentVNode("",!0),d.value==="redis"?(t.openBlock(),t.createElementBlock("div",BR,[t.createVNode(v,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.select_redis_configuration")),1)]),_:1}),t.createVNode(t.unref(no.RedisConfigurationSelector),{"model-value":(k=t.unref(i).cache)==null?void 0:k.partial_id,"redis-type":"redis-ee","onUpdate:modelValue":E[0]||(E[0]=I=>t.unref(i).cache.partial_id=I)},null,8,["model-value"])])):t.createCommentVNode("",!0),d.value==="redis"&&!((J=t.unref(i).cache)!=null&&J.partial_id)&&f.value?(t.openBlock(),t.createElementBlock("div",VR,[t.createElementVNode("div",null,t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config_preview")),1),t.createVNode(D,{id:"dk-cache-redis-configuration",code:f.value,language:"yaml",theme:"dark",onCodeBlockRender:b},null,8,["code"])])):t.createCommentVNode("",!0)])]}),_:1},8,["action-button-disabled","action-button-text","title","visible"])])}}}),[["__scopeId","data-v-ad53942e"]]),DR={class:"dk-resources-panel"},MR=ve(t.defineComponent({__name:"ResourcesPanel",setup(e){const n=vR(),o=t.ref(0),{addVault:r,removeVault:i,updateVault:a,renameVault:l,formData:s}=_R();function c(_,g,h){h&&h!==_&&l(h,_,!1),a(_,g)}const{state:d,commit:f}=at(),u=t.computed(()=>({cache:d.value.cacheConfig}));function p(_){d.value.cacheConfig=_.cache,f()}function m(){d.value.cacheConfig=void 0,f()}function y(){o.value++}return(_,g)=>(t.openBlock(),t.createElementBlock("div",DR,[t.createVNode(yt,{data:t.unref(s),schema:t.unref(n)},{default:t.withCtx(()=>[t.createVNode(xR,{name:"vault",onAdd:t.unref(r),onRemove:t.unref(i),onUpdate:c},null,8,["onAdd","onRemove"])]),_:1},8,["data","schema"]),g[0]||(g[0]=t.createElementVNode("hr",{class:"dk-resources-divider"},null,-1)),(t.openBlock(),t.createBlock(yt,{key:`${o.value}`,data:u.value,schema:t.unref(n)},{default:t.withCtx(()=>{var h;return[t.createVNode(RR,{strategy:(h=u.value.cache)==null?void 0:h.strategy,onCancel:y,onRemove:m,onUpdate:p},null,8,["strategy"])]}),_:1},8,["data","schema"]))]))}}),[["__scopeId","data-v-3a9010b8"]]),LR={class:"header"},FR={class:"title"},UR={class:"body"},KR={class:"panel"},jR=ve(t.defineComponent({__name:"SidePanel",setup(e){const{t:n}=Ze.createI18n("en-us",rt),{sidePanelExpanded:o}=Cl(),{propertiesPanelOpen:r,selectedNode:i}=at(),a=t.inject(so.DATAKIT_M2,!1),l=t.ref("nodes");function s(){r.value=!1}t.watch(i,d=>{d||s()});const c=t.ref(!1);return t.onMounted(()=>{c.value=!0}),(d,f)=>{const u=t.resolveComponent("KSegmentedControl");return t.openBlock(),t.createElementBlock("aside",{class:t.normalizeClass(["side-panel",{expanded:t.unref(o),inited:c.value}])},[t.createElementVNode("header",LR,[t.createElementVNode("h2",FR,t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.name")),1)]),t.createElementVNode("div",UR,[t.createElementVNode("div",KR,[t.unref(a)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(u,{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),options:[{label:t.unref(n)("plugins.free-form.datakit.flow_editor.panel_segments.nodes"),value:"nodes"},{label:t.unref(n)("plugins.free-form.datakit.flow_editor.panel_segments.resources.title"),value:"resources"}]},null,8,["modelValue","options"]),l.value==="nodes"?(t.openBlock(),t.createBlock(Zm,{key:0,"hide-title":""})):t.createCommentVNode("",!0),l.value==="resources"?(t.openBlock(),t.createBlock(MR,{key:1})):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createBlock(Zm,{key:1}))])])],2)}}}),[["__scopeId","data-v-ae943268"]]),GR=t.defineComponent({__name:"HttpMethodField",props:{name:{}},setup(e){return(n,o)=>(t.openBlock(),t.createBlock($t,{items:t.unref(Da)([...t.unref(Vu)]),name:n.name},null,8,["items","name"]))}}),qR=t.defineComponent({__name:"InputsRecordField",props:{name:{},items:{}},emits:["change:inputs"],setup(e){const{getSchema:n}=ze(),{i18n:o}=Be(),r=t.computed(()=>{const i=n("inputs");return i?i.fields.map(a=>Object.keys(a)[0]):[]});return(i,a)=>(t.openBlock(),t.createBlock(Nt,{"as-child":"",name:i.name,"reset-label-path":"isolate"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,l=>(t.openBlock(),t.createBlock($t,{key:l,clearable:"","enable-filtering":"",items:i.items,name:l,placeholder:t.unref(o).t("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:s=>i.$emit("change:inputs",l,s?s.value:null)},null,8,["items","name","placeholder","onChange"]))),128))]),_:1},8,["name"]))}}),zR=["data-testid"],HR={class:"dk-inputs-map-field-entry-body"},YR={class:"dk-inputs-map-field-entry-content"},WR=ve(t.defineComponent({__name:"InputsMapField",props:{items:{},fieldNameValidator:{},name:{},initialValue:{},label:{},keyPlaceholder:{},valuePlaceholder:{},defaultKey:{},defaultValue:{},labelAttributes:{},showVaultSecretPicker:{type:Boolean},keyOrder:{}},emits:["change:inputs","add:field","remove:field","rename:field","change"],setup(e,{emit:n}){const o=e,r=n,{entries:i,addEntry:a,removeEntry:l,field:s}=Hr(o,r),{i18n:{t:c}}=Be(),d=t.useTemplateRef("root"),f=t.ref(null),u=t.ref({});let p;async function m(E,C="key"){var N;d.value&&(await t.nextTick(),(N=d.value.querySelector(`[data-${C}-input="${E}"]`))==null||N.focus())}function y(){const{id:E}=a(),C=i.value.findIndex(({key:N})=>!N);m(C===-1?i.value.length-1:C),f.value=E}function _(E){l(E.id),E.id===f.value&&(f.value=null),E.key.trim()!==""&&r("remove:field",E.key)}function g(E){p=E.key}function h(E){if(w(E)){E.key=p,delete u.value[E.id];return}if(E.id===f.value){if(E.key.trim()==="")return;r("add:field",E.key,E.value),f.value=null}else r("rename:field",p,E.key);p=E.key}function w(E){delete u.value[E.id];const C=o.fieldNameValidator("input",p,E.key);if(C)return u.value[E.id]=C,C}function b(E){w(E)}function x(E,C){E.id!==f.value&&r("change:inputs",E.key,C)}return t.watch(()=>i.value,E=>{f.value&&(E.find(({id:C})=>C===f.value)||(f.value=null))}),(E,C)=>{const N=t.resolveComponent("KAlert"),S=t.resolveComponent("KLabel"),v=t.resolveComponent("KInput"),D=t.resolveComponent("KSelect"),L=t.resolveComponent("KButton");return t.unref(s).error?(t.openBlock(),t.createBlock(N,{key:0,appearance:"danger",message:t.unref(s).error.message},null,8,["message"])):(t.openBlock(),t.createElementBlock("div",{key:1,ref_key:"root",ref:d,class:"dk-inputs-map-field"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i),(k,J)=>(t.openBlock(),t.createElementBlock("div",{key:k.id,class:"dk-inputs-map-field-entry","data-testid":`ff-kv-container-${t.unref(s).path.value}.${J}`},[t.createVNode(S,{for:`ff-kv-entry-key-${t.unref(s).path.value}.${J}`},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input_name.label")),1)]),_:2},1032,["for"]),t.createElementVNode("div",HR,[t.createElementVNode("div",YR,[t.createVNode(v,{id:`ff-kv-entry-key-${t.unref(s).path.value}.${J}`,modelValue:k.key,"onUpdate:modelValue":[I=>k.key=I,I=>w(k)],modelModifiers:{trim:!0},class:"ff-kv-field-entry-key","data-key-input":J,"data-testid":`ff-key-${t.unref(s).path.value}.${J}`,error:!!u.value[k.id],"error-message":u.value[k.id],placeholder:t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input_name.placeholder"),onBlur:I=>b(k),onChange:I=>h(k),onFocus:I=>g(k)},null,8,["id","modelValue","onUpdate:modelValue","data-key-input","data-testid","error","error-message","placeholder","onBlur","onChange","onFocus"]),t.createVNode(D,{modelValue:k.value,"onUpdate:modelValue":I=>k.value=I,class:"ff-kv-field-entry-value",clearable:"","data-testid":`ff-value-${t.unref(s).path.value}.${J}`,"enable-filtering":"",items:E.items,label:t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input.source"),placeholder:t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:I=>x(k,(I==null?void 0:I.value)??null)},null,8,["modelValue","onUpdate:modelValue","data-testid","items","label","placeholder","onChange"])]),t.createVNode(L,{appearance:"tertiary",class:"dk-inputs-map-field-remove-btn","data-testid":`ff-kv-remove-btn-${t.unref(s).path.value}.${J}`,icon:"",onClick:I=>_(k)},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.CloseIcon))]),_:2},1032,["data-testid","onClick"])])],8,zR))),128)),t.createVNode(L,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${t.unref(s).path.value}`,disabled:!!f.value,onClick:y},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-b2f89c26"]]),XR={key:1,class:"dk-inputs-field-or"},Sn=ve(t.defineComponent({__name:"InputsField",props:{items:{},fieldNames:{},fieldNameValidator:{}},emits:["change:input","change:inputs","add:field","remove:field","rename:field"],setup(e,{emit:n}){const o=n,{getSchema:r}=ze(),{i18n:{t:i}}=Be(),a=t.computed(()=>r("inputs")),l=t.computed(()=>a.value?a.value.type==="record"?qR:WR:null);function s(p){o("change:input",p?p.value:null)}function c(p,m){o("add:field",p,m)}function d(p,m){o("change:inputs",p,m)}function f(p){o("remove:field",p)}function u(p,m){o("rename:field",p,m)}return(p,m)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(Pe.KLabel),{class:"dk-inputs-field-h1",info:t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.tooltip")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.label")),1)]),_:1},8,["info"]),t.unref(r)("input")?(t.openBlock(),t.createBlock($t,{key:0,class:"dk-inputs-field-h2",clearable:"","enable-filtering":"",items:p.items,label:t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.input"),"label-attributes":{info:void 0},name:"input",placeholder:t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:s},null,8,["items","label","placeholder"])):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createElementBlock("div",XR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.or")),1)])):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(t.unref(Pe.KLabel),{key:2,class:"dk-inputs-field-h2 dk-margin-0"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.fields")),1)]),_:1})):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(t.unref(l),{key:3,"field-name-validator":p.fieldNameValidator,items:p.items,"key-order":p.fieldNames,name:"inputs","onAdd:field":c,"onChange:inputs":d,"onRemove:field":f,"onRename:field":u},null,8,["field-name-validator","items","key-order"])):t.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-58657120"]]),ZR={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{query:{description:"HTTP request query",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"},JR={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"};function QR(e){const n=Number(e);return!isNaN(n)&&isFinite(n)}function Jn(...e){return function(o){for(const r of e){const i=r(o);if(i)return i}}}function $o(e){const{i18n:{t:n}}=Be(),o=()=>e?typeof e=="string"?e:n("plugins.free-form.datakit.flow_editor.node_properties.errors.not_empty",e):"Field is required";return function(i){if(i==null||typeof i=="string"&&i.trim()==="")return o()}}function Jm(e,n){const{i18n:{t:o}}=Be();return function(i){if(i!=null)switch(e){case"identifier":{const a=()=>n?typeof n=="string"?n:o("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_identifier_format",n):"Invalid identifier format";return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(i)?void 0:a()}case"url":{const a=()=>n?typeof n=="string"?n:o("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_url_format"):"Invalid URL format";try{new URL(i);return}catch{return a()}}default:return}}}function eD(e=0,n=1/0,o){const{i18n:{t:r}}=Be();return function(a){if(a!=null&&typeof a=="string"&&(a.length<e||a.length>n))return o?typeof o=="string"?o:r("plugins.free-form.datakit.flow_editor.node_properties.errors.string_len_range",{fieldName:o.fieldName,minLength:e,maxLength:n}):`Value must be between ${e} and ${n} characters`}}function Qm(e){const{i18n:{t:n}}=Be();return function(r){if(!QR(r))return e?typeof e=="string"?e:n("plugins.free-form.datakit.flow_editor.node_properties.errors.not_number",e):"Value must be a number"}}function Ss(e,n){const{i18n:{t:o}}=Be();return function(i){if(i==null)return;const a=Qm(n)(i);if(a)return a;const l=Number(i);switch(e){case"float":{const s=()=>n?typeof n=="string"?n:o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_float",n):"Invalid float format";return Number.isFinite(l)?void 0:s()}case"integer":{const s=()=>n?typeof n=="string"?n:o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_integer",n):"Invalid integer format";return Number.isInteger(l)?void 0:s()}default:return}}}function xs(e=-1/0,n=1/0,o){const{i18n:{t:r}}=Be();return function(a){if(a==null)return;const l=Qm(o)(a);if(l)return l;const s=Number(a);if(s<e||s>n)return o?typeof o=="string"?o:r("plugins.free-form.datakit.flow_editor.node_properties.errors.number_range",{fieldName:o.fieldName,min:e,max:n}):`Value must be between ${e} and ${n}`}}function tD(e,n){const{state:o}=at(),{i18n:{t:r}}=Be();return function(a){if(o.value.nodes.some(l=>l.name===a&&l.id!==e))return n?typeof n=="string"?n:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",n):"Name must be unique."}}function nD(e,n,o){const{i18n:{t:r}}=Be();return function(a){if(!n)return;if(o?n.fields[e].some(s=>s.name===a&&s.id!==o):n.fields[e].some(s=>s.name===a)){const s=r(e==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name");return r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",{fieldName:s})}}}function oD(){const{i18n:{t:e}}=Be();return function(o){if(hl(o))return e("plugins.free-form.datakit.flow_editor.node_properties.errors.reserved_node_name",{nodeName:o})}}function eg(e){const{i18n:{t:n}}=Be(),o={fieldName:n("plugins.free-form.datakit.flow_editor.node_properties.name")};return Jn($o(o),Jm("identifier",o),oD(),tD(e,o))}function rD(e){const{i18n:{t:n}}=Be(),{getNodeById:o}=at();return function(i,a,l){const s={fieldName:n(i==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name")};return Jn($o(s),nD(i,o(e),l))(a)}}function iD(e){const n=t.ref({}),o=t.computed(()=>Object.values(n.value).every(l=>!l)),r={};Object.keys(e).forEach(l=>{const s=e[l],c=u=>{const p=typeof u=="function"?u():u,m=s(p);return n.value[l]=m,m},d=()=>{n.value[l]=void 0},f=u=>(d(),c(u));r[l]={handleChange:f,handleBlur:f,validate:f,isValid:t.computed(()=>n.value[l]===void 0),error:t.computed(()=>n.value[l])}});function i(){n.value={}}function a(l){var s;for(const c of Object.keys(e)){const d=l[c],f=typeof d=="function"?d():d;(s=r[c])==null||s.validate(f)}return n.value}return{isValid:o,errorMap:n,fields:r,clearErrors:i,validate:a}}function vr(e){const{validationConfig:n,getValidationData:o,toggleNodeValid:r}=e,{skipValidation:i}=at(),a=t.computed(()=>typeof n=="function"?n():n),l=t.computed(()=>iD(a.value)),s=t.computed(()=>l.value.fields),c=t.computed(()=>l.value.isValid.value);function d(){const u=o(),p=l.value.validate(u),m={};for(const y in a.value)m[y]=p[y];return m}function f(u,p){return{onBlur:()=>{const m=o(),y=s.value[u];y&&y.handleBlur(m[u])},onUpdate:()=>{const m=o(),y=s.value[u];y&&y.handleChange(m[u]),p==null||p()},error:t.computed(()=>{const m=s.value[u];return m?!m.isValid.value:!1}),errorMessage:t.computed(()=>{const m=s.value[u];return m?m.error.value??"":""})}}return t.onMounted(()=>{i.value?i.value=!1:d()}),t.onBeforeUnmount(async()=>{try{const u=d(),p=Object.values(u).filter(Boolean).length>0;r(!p)}catch{}}),t.watch(()=>c.value,r,{immediate:!0}),{fields:s.value,isValid:c,validateAll:d,createFieldHandler:f}}function mn(e,n){const o=t.inject(so.DATAKIT_M2,!1),{state:r,renameNode:i,getNodeById:a,addField:l,renameField:s,removeField:c,replaceConfig:d,disconnectEdge:f,connectEdge:u,invalidConfigNodeIds:p,commit:m,revert:y}=at(),{i18n:{t:_}}=Be(),g=qm(),h=t.computed(()=>{const O=a(e);if(!O)throw new Error("Node not existed");return O}),w=t.computed(()=>{const P=r.value.edges.filter(T=>T.target===e).reduce((T,M)=>{var ie,be;const Y=a(M.source),z=(ie=bn(Y,"output",M.sourceField))==null?void 0:ie.id,H=(be=bn(h.value,"input",M.targetField))==null?void 0:be.name,Z=Y.id+(z?`.${z}`:"");return H?T.inputs={...T.inputs,[H]:Z}:T.input=Z,T},{});return h.value.fields.input.forEach(T=>{P.inputs||(P.inputs={}),P.inputs[T.name]||(P.inputs[T.name]=null)}),{...h.value.config,...P,name:h.value.name}}),b=O=>{i(e,O??"",!0,`${e}:rename`)},x=(O,P=!0)=>{if(!n)throw new Error("getFormInnerData is not defined");const T=zo(n(),["name","input","inputs"]),M=O?`update:${e}:${O}`:void 0;d(e,T,P,M)},E=(O,P)=>{const T=_n(h.value,O,P);if(!T)throw new Error(`Field with name "${P}" not found in node "${h.value.name}"`);return T},C=(O,P,T)=>{const M=!!T;l(e,O,P,!M),M&&L(P,T)},N=(O,P,T)=>{const M=E(O,P).id;s(e,M,T)},S=(O,P)=>{const T=E(O,P).id;c(e,T)},v=t.computed(()=>r.value.edges.filter(O=>O.target===e&&!O.targetField)[0]),D=t.computed(()=>r.value.edges.filter(O=>O.target===e&&O.targetField)),L=async(O,P)=>{const T=P==null,M=E("input",O).id;if(T){const le=D.value.find(ue=>ue.targetField===M);le&&f(le.id);return}const{nodeId:Y,fieldId:z}=Mu(P),H=E("input",O).id,Z=[];v.value&&(Z.push(xr(v.value,a)),f(v.value.id,!1));const ie=D.value.find(le=>le.targetField===M);ie&&(Z.push(xr(ie,a)),f(ie.id,!1)),u({source:Y,sourceField:z,target:e,targetField:H},!1);const be=Cs(Y,z,e,H,a),ee=Z[0]&&be?Z[0][1]===be[1]:!1;if(m(),ee||Z.length===0)return;await g(_("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[be],Z)||y()},k=async O=>{if(O==null){v.value&&f(v.value.id);return}const T=[];for(const Z of D.value)T.push(xr(Z,a)),f(Z.id,!1);v.value&&f(v.value.id,!1);const{nodeId:M,fieldId:Y}=Mu(O);u({source:M,sourceField:Y,target:e,targetField:void 0},!1);const z=Cs(M,Y,e,void 0,a);if(m(),T.length===0)return;await g(_("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[z],T)||y()},J=O=>{const P=[...r.value.edges,{source:O,target:e}];return wl(di(P))},I=t.computed(()=>{var P,T;const O=[];for(const M of r.value.nodes)if(!(!o&&M.type==="vault"||!((P=Co(M.type).io)!=null&&P.output))&&M.fields.output&&M.id!==e&&!(M.type==="property"&&!ss((T=M.config)==null?void 0:T.property))&&!J(M.id)&&!(h.value.phase==="request"&&M.phase==="response")&&!(M.type==="vault"&&M.fields.output.length===0)){O.push({value:M.id,label:M.name});for(const z of M.fields.output)O.push({value:`${M.id}.${z.id}`,label:`${M.name}.${z.name}`})}return O}),G=t.computed(()=>h.value.fields.input.map(O=>O.name)||[]);function j(O){p.value.delete(e),O||p.value.add(e)}const te=rD(e);function K(O,P,T){const M=a(e);if(!M)throw new Error("Node not found when validating field name");const Y=_n(M,O,P);return te(O,T,Y==null?void 0:Y.id)}return{formData:w,inputOptions:I,inputEdge:v,inputsEdges:D,inputsFieldNames:G,currentNode:h,setName:b,setConfig:x,addField:C,renameFieldByName:N,removeFieldByName:S,setInputs:L,setInput:k,nameValidator:eg(e),fieldNameValidator:K,toggleNodeValid:j}}function gn(e){const{getSchema:n}=ze();return t.computed(()=>{if(Vt(e))switch(e){case"response":return JR;case"service_request":return ZR}try{const l=n().fields[0].config.fields[0].nodes.elements.subschema_definitions[e];if(!l)throw new Error(`Subschema "${e}" not found in the schema.`);return l}catch(o){throw new Error(`Failed to get subschema "${e}": ${o.message}`)}})}const Qn=t.defineComponent({__name:"NameField",props:{name:{},validate:{type:Function}},emits:["update"],setup(e,{emit:n}){const o=e,r=n,{i18n:{t:i}}=Be(),a=t.ref(o.name),l=t.computed(()=>{const f=o.validate(a.value.trim());return f===void 0?"":f});let s=a.value.trim();function c(){if(l.value){a.value=s;return}r("update",a.value.trim())}function d(){s=a.value.trim()}return t.watch(()=>o.name,f=>{f!==a.value&&(a.value=f)}),(f,u)=>{const p=t.resolveComponent("KInput");return t.openBlock(),t.createBlock(p,{"model-value":a.value,"onUpdate:modelValue":u[0]||(u[0]=m=>a.value=m),"data-1p-ignore":"",error:!!l.value,"error-message":l.value,label:t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.name"),required:"",onChange:c,onFocus:d},null,8,["model-value","error","error-message","label"])}}}),aD=t.defineComponent({__name:"NodeFormCall",props:{nodeId:{}},setup(e){const{i18n:{t:n}}=Be(),o=t.useTemplateRef("form"),r=gn("call"),{formData:i,setName:a,setConfig:l,inputOptions:s,setInputs:c,setInput:d,inputsFieldNames:f,nameValidator:u,toggleNodeValid:p,fieldNameValidator:m}=mn(e.nodeId,()=>o.value.getInnerData()),{createFieldHandler:y}=vr({validationConfig:{url:Jn($o({fieldName:"URL"}),Jm("url",{fieldName:"URL"})),timeout:Jn(Ss("integer"),xs(0,2147483646))},getValidationData:()=>({url:i.value.url,timeout:i.value.timeout}),toggleNodeValid:p}),_=y("url",()=>l("url")),g=y("timeout",()=>l("timeout"));return(h,w)=>{const b=t.resolveComponent("KLabel");return t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(i),schema:t.unref(r)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(i).name,validate:t.unref(u),onUpdate:t.unref(a)},null,8,["name","validate","onUpdate"]),t.createVNode(b,{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),t.createVNode(po,{error:t.unref(_).error.value,"error-message":t.unref(_).errorMessage.value,name:"url",onBlur:t.unref(_).onBlur,"onUpdate:modelValue":t.unref(_).onUpdate},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),t.createVNode(GR,{name:"method",onUpdate:w[0]||(w[0]=x=>t.unref(l)())}),t.createVNode(Mn,{error:t.unref(g).error.value,"error-message":t.unref(g).errorMessage.value,name:"timeout",onBlur:t.unref(g).onBlur,"onUpdate:modelValue":t.unref(g).onUpdate},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),t.createVNode(po,{name:"ssl_server_name","onUpdate:modelValue":w[1]||(w[1]=x=>t.unref(l)("ssl_server_name"))}),t.createVNode(Sn,{"field-name-validator":t.unref(m),"field-names":t.unref(f),items:t.unref(s),"onChange:input":t.unref(d),"onChange:inputs":t.unref(c)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),lD=t.defineComponent({__name:"NodeFormServiceRequest",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),o=gn("service_request"),{formData:r,inputOptions:i,setInputs:a,setInput:l,inputsFieldNames:s,fieldNameValidator:c}=mn(e.nodeId,()=>n.value.getInnerData());return(d,f)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(r),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Sn,{"field-name-validator":t.unref(c),"field-names":t.unref(s),items:t.unref(i),"onChange:input":t.unref(l),"onChange:inputs":t.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),sD=t.defineComponent({__name:"NodeFormResponse",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),o=gn("response"),{formData:r,inputOptions:i,setInputs:a,setInput:l,inputsFieldNames:s,fieldNameValidator:c}=mn(e.nodeId,()=>n.value.getInnerData());return(d,f)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(r),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Sn,{"field-name-validator":t.unref(c),"field-names":t.unref(s),items:t.unref(i),"onChange:input":t.unref(l),"onChange:inputs":t.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),tg={jqlang:"https://jqlang.org/manual/"},cD=t.defineComponent({__name:"NodeFormJq",props:{nodeId:{}},setup(e){const{i18n:{t:n},i18nT:o}=Be(),r=t.useTemplateRef("form"),i=gn("jq"),{formData:a,setName:l,setConfig:s,inputOptions:c,setInputs:d,setInput:f,addField:u,removeFieldByName:p,renameFieldByName:m,inputsFieldNames:y,nameValidator:_,toggleNodeValid:g,fieldNameValidator:h}=mn(e.nodeId,()=>r.value.getInnerData());function w(S,v){u("input",S,v)}function b(S){p("input",S)}function x(S,v){m("input",S,v)}const E=n("plugins.free-form.datakit.flow_editor.node_properties.jq.label"),{createFieldHandler:C}=vr({validationConfig:{jq:Jn($o({fieldName:E}),eD(1,10240,{fieldName:E}))},getValidationData:()=>({jq:a.value.jq}),toggleNodeValid:g}),N=C("jq",()=>s("jq"));return(S,v)=>{const D=t.resolveComponent("KLabel"),L=t.resolveComponent("KExternalLink");return t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(a),schema:t.unref(i)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(a).name,validate:t.unref(_),onUpdate:t.unref(l)},null,8,["name","validate","onUpdate"]),t.createVNode(D,{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),t.createVNode(po,{autosize:"",error:t.unref(N).error.value,"error-message":t.unref(N).errorMessage.value,label:t.unref(E),"label-attributes":{},multiline:"",name:"jq",resizable:"",onBlur:t.unref(N).onBlur,"onUpdate:modelValue":t.unref(N).onUpdate},{help:t.withCtx(()=>[t.createVNode(t.unref(o),{keypath:"plugins.free-form.datakit.flow_editor.node_properties.jq.help"},{link:t.withCtx(()=>[t.createVNode(L,{"hide-icon":"",href:t.unref(tg).jqlang},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(tg).jqlang),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["error","error-message","label","onBlur","onUpdate:modelValue"]),t.createVNode(Sn,{"field-name-validator":t.unref(h),"field-names":t.unref(y),items:t.unref(c),"onAdd:field":w,"onChange:input":t.unref(f),"onChange:inputs":t.unref(d),"onRemove:field":b,"onRename:field":x},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),dD=ve(t.defineComponent({__name:"OutputValueField",props:{fieldNameValidator:{},name:{},initialValue:{},label:{},keyPlaceholder:{},valuePlaceholder:{},defaultKey:{},defaultValue:{},labelAttributes:{},showVaultSecretPicker:{type:Boolean},keyOrder:{}},emits:["change:value","add:field","rename:field","remove:field","change"],setup(e,{emit:n}){const o=e,r=n,i=t.ref({}),{entries:a,addEntry:l,removeEntry:s,field:c}=Hr(o,r,!1),{i18n:d}=Be(),f=t.useTemplateRef("root"),u=t.ref(null);let p;async function m(E,C="key"){var N;f.value&&(await t.nextTick(),(N=f.value.querySelector(`[data-${C}-input="${E}"]`))==null||N.focus())}function y(){const E=l(),C=a.value.findIndex(({key:N})=>!N);m(C===-1?a.value.length-1:C),u.value=E}function _(E){var C;E.id===((C=u.value)==null?void 0:C.id)&&(u.value=null),s(E.id),E.key.trim()!==""&&r("remove:field",E.key)}function g(E){p=E.key}function h(E){var C;if(b(E)){E.key=p,delete i.value[E.id];return}if(E.id===((C=u.value)==null?void 0:C.id)){if(E.key.trim()==="")return;u.value=null,r("add:field",E.key,E.value)}else r("rename:field",p,E.key);p=E.key}function w(E,C){var S;if(C.id===((S=u.value)==null?void 0:S.id))return;const N=E.target.value.trim();r("change:value",C.key,N)}function b(E){delete i.value[E.id];const C=o.fieldNameValidator("output",p,E.key);if(C)return i.value[E.id]=C,C}function x(E){b(E)}return t.watchEffect(()=>{u.value&&!a.value.some(E=>E.id===u.value.id)&&a.value.push(u.value)}),(E,C)=>{const N=t.resolveComponent("KAlert"),S=t.resolveComponent("KLabel"),v=t.resolveComponent("KButton"),D=t.resolveComponent("KInput"),L=t.resolveComponent("KCard");return t.unref(c).error?(t.openBlock(),t.createBlock(N,{key:0,appearance:"danger",message:t.unref(c).error.message},null,8,["message"])):(t.openBlock(),t.createElementBlock("div",{key:1,ref_key:"root",ref:f,class:"dk-output-value-field"},[t.createVNode(S,{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(d).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.label")),1)]),_:1}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a),(k,J)=>(t.openBlock(),t.createBlock(L,{key:k.id,class:"dk-output-value-field-entry","data-testid":`ff-kv-container-${t.unref(c).path.value}.${J}`},{actions:t.withCtx(()=>[t.createVNode(v,{appearance:"none","data-testid":`ff-kv-remove-btn-${t.unref(c).path.value}.${J}`,icon:"",onClick:I=>_(k)},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.CloseIcon))]),_:2},1032,["data-testid","onClick"])]),default:t.withCtx(()=>[t.createVNode(D,{id:`ff-kv-entry-key-${t.unref(c).path.value}.${J}`,modelValue:k.key,"onUpdate:modelValue":[I=>k.key=I,I=>b(k)],modelModifiers:{trim:!0},class:"ff-kv-field-entry-key","data-key-input":J,"data-testid":`ff-key-${t.unref(c).path.value}.${J}`,error:!!i.value[k.id],"error-message":i.value[k.id],label:t.unref(d).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name"),required:"",onBlur:I=>x(k),onChange:I=>h(k),onFocus:I=>g(k)},null,8,["id","modelValue","onUpdate:modelValue","data-key-input","data-testid","error","error-message","label","onBlur","onChange","onFocus"]),t.createVNode(D,{modelValue:k.value,"onUpdate:modelValue":I=>k.value=I,modelModifiers:{trim:!0},class:"ff-kv-field-entry-value","data-testid":`ff-value-${t.unref(c).path.value}.${J}`,label:t.unref(d).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value"),onChange:I=>w(I,k)},null,8,["modelValue","onUpdate:modelValue","data-testid","label","onChange"])]),_:2},1032,["data-testid"]))),128)),t.createVNode(v,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${t.unref(c).path.value}`,disabled:!!u.value,onClick:y},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(d).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-5e17f8cb"]]);function uD(e){const n={};for(const[o,r]of Object.entries(e))typeof r=="object"&&r!==null?n[o]=JSON.stringify(r):n[o]=String(r);return n}function ra(e){const n={};for(const[o,r]of Object.entries(e))if(r!=null){n[o]=r;try{r==="null"?n[o]=null:(r==="true"||r==="false"||/^-?\d+(\.\d+)?$/.test(r)||r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))&&(n[o]=JSON.parse(r))}catch{}}return n}function fD(e,n,o){const r={};for(const i of Object.keys(e))i===n?r[o]=e[n]:r[i]=e[i];return r}const pD=t.defineComponent({__name:"NodeFormStatic",props:{nodeId:{}},setup(e){const{renameNode:n,getOutEdgesByNodeId:o,addField:r,renameField:i,removeField:a,replaceConfig:l,getNodeById:s}=at(),{fieldNameValidator:c}=mn(e.nodeId),d=gn("static"),f=eg(e.nodeId),u=t.computed(()=>s(e.nodeId)),p=t.computed(()=>{var b;return((b=u.value)==null?void 0:b.fields.output.map(x=>x.name))||[]});function m(b){if(!u.value)throw new Error("No current node");n(u.value.id,b??"")}const y=t.computed(()=>{var v;if(!u.value)return{};const b=((v=u.value.config)==null?void 0:v.values)??{},x={},E=o(u.value.id).map(D=>D.sourceField).filter(Boolean).map(D=>bn(u.value,"output",D)).map(D=>D==null?void 0:D.name).filter(Boolean),C=u.value.fields.output.map(D=>D.name),N=Object.keys(b);return new Set([...N,...E,...C]).forEach(D=>{if(D in b){x[D]=b[D];return}x[D]=""}),{name:u.value.name,values:uD(x)}});function _(b,x){if(!u.value)throw new Error("No selected node");const E=x!==void 0;if(r(e.nodeId,"output",b,!E),E){const C={values:ra({...y.value.values,[b]:x})};l(e.nodeId,C)}}function g(b,x){if(!u.value)throw new Error("No selected node");const E=_n(u.value,"output",b);if(!E)throw new Error("No field found to rename");const C={values:ra(fD(y.value.values??{},b,x))};l(e.nodeId,C,!1),i(e.nodeId,E.id,x)}function h(b){var C;if(!u.value)throw new Error("No selected node");const x=_n(u.value,"output",b);if(!x)throw new Error("No field found to delete");a((C=u.value)==null?void 0:C.id,x.id,!0,!1);const E={values:ra({...y.value.values})};delete E.values[b],l(e.nodeId,E)}function w(b,x){if(!u.value)throw new Error("No selected node");const E={...y.value.values};E[b]=x;const C={values:ra(E)};l(e.nodeId,C)}return(b,x)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:y.value,schema:t.unref(d)},{default:t.withCtx(()=>{var E;return[t.createVNode(Qn,{name:((E=u.value)==null?void 0:E.name)??"",validate:t.unref(f),onUpdate:m},null,8,["name","validate"]),t.createVNode(dD,{"field-name-validator":t.unref(c),"key-order":p.value,name:"values","onAdd:field":_,"onChange:value":w,"onRemove:field":h,"onRename:field":g},null,8,["field-name-validator","key-order"])]}),_:1},8,["data","schema"]))}}),mD={class:"dk-kong-property-item"},gD={class:"property-type"},hD={class:"property-badges"},yD=ve(t.defineComponent({__name:"PropertiesField",props:{validators:{}},emits:["update:model-value","update:property-key"],setup(e,{emit:n}){const{i18n:{t:o}}=Be(),r=e,i=n,{formData:a}=ze(),l=t.ref(Er(a.property)),s=t.computed(()=>Nr(a.property)),c=t.ref(ls(a.property)),d=t.computed(()=>a.property??""),f=t.computed(()=>Object.entries(Wn).map(([m])=>{var g;const y=Nr(m)?(g=a.property)==null?void 0:g.startsWith(m.replace(Po,"")):a.property===m;return{label:y&&c.value?m.replace(Po,c.value):m,value:m,selected:y}}));function u(m){const y=Hi.find(_=>{var g;return(g=a.property)==null?void 0:g.startsWith(_)});y&&(a.property=y+m,r.validators.key.handleChange(a.property),i("update:property-key",a.property))}function p(m){l.value!==Er(m==null?void 0:m.value)&&(a.property=(m==null?void 0:m.value)||null,l.value=Er(a.property),r.validators.property.handleBlur(()=>a.property),i("update:model-value",a.property))}return t.watch(()=>a.property,m=>{c.value=ls(m),l.value=Er(m)}),(m,y)=>{const _=t.resolveComponent("KBadge"),g=t.resolveComponent("KSelect"),h=t.resolveComponent("KInput");return t.openBlock(),t.createElementBlock(t.Fragment,null,[(t.openBlock(),t.createBlock(g,{key:d.value,"enable-filtering":"",error:!m.validators.property.isValid.value,help:m.validators.property.error.value,items:f.value,label:"Property","label-attributes":{maxWidth:"300px",placement:"top",info:"The property name to get/set"},required:"",onBlur:y[0]||(y[0]=w=>m.validators.property.handleBlur(()=>t.unref(a).property)),onChange:p},{"item-template":t.withCtx(({item:w})=>[t.createElementVNode("div",mD,[t.createElementVNode("div",null,[t.createElementVNode("div",null,t.toDisplayString(w.label),1),t.createElementVNode("div",gD,t.toDisplayString(t.unref(Wn)[w.value].dataType),1)]),t.createElementVNode("div",hD,[t.unref(Wn)[w.value].readable?(t.openBlock(),t.createBlock(_,{key:0,appearance:"info"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.property.get")),1)]),_:1})):t.createCommentVNode("",!0),t.unref(Wn)[w.value].writable?(t.openBlock(),t.createBlock(_,{key:1,appearance:"warning"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.property.set")),1)]),_:1})):t.createCommentVNode("",!0)])])]),_:1},8,["error","help","items"])),s.value?(t.openBlock(),t.createBlock(h,{key:0,"model-value":c.value,"onUpdate:modelValue":[y[1]||(y[1]=w=>c.value=w),u],error:!m.validators.key.isValid.value,"error-message":m.validators.key.error.value,label:"key",required:"",onBlur:y[2]||(y[2]=w=>m.validators.key.handleBlur(()=>t.unref(a).property))},null,8,["model-value","error","error-message"])):t.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-0ab1be87"]]),_D=t.defineComponent({__name:"NodeFormProperty",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),{selectedNode:o,disconnectInEdges:r,disconnectOutEdges:i}=at(),a=gn("property"),{formData:l,setName:s,setConfig:c,inputOptions:d,setInputs:f,setInput:u,inputsFieldNames:p,nameValidator:m,toggleNodeValid:y,fieldNameValidator:_}=mn(e.nodeId,()=>n.value.getInnerData()),g=t.computed(()=>cs(l.value.property));function h(b){var E;const x=(E=o.value)==null?void 0:E.id;if(!x)throw new Error("Expected selectedNode to be defined");ss(b)||i(x,!1),cs(b)||r(x,!1),c()}const{fields:w}=vr({validationConfig:()=>({property:$o({fieldName:"Property"}),key:Nr(l.value.property)?$o({fieldName:"Key"}):()=>{}}),getValidationData:()=>({property:l.value.property,key:ls(l.value.property)}),toggleNodeValid:y});return(b,x)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(l),schema:t.unref(a)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(l).name,validate:t.unref(m),onUpdate:t.unref(s)},null,8,["name","validate","onUpdate"]),t.createVNode($t,{name:"content_type",onUpdate:x[0]||(x[0]=E=>t.unref(c)())}),t.createVNode(yD,{validators:t.unref(w),"onUpdate:modelValue":h,"onUpdate:propertyKey":x[1]||(x[1]=E=>t.unref(c)("property-key"))},null,8,["validators"]),g.value?(t.openBlock(),t.createBlock(Sn,{key:0,"field-name-validator":t.unref(_),"field-names":t.unref(p),items:t.unref(d),"onChange:input":t.unref(u),"onChange:inputs":t.unref(f)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])):t.createCommentVNode("",!0)]),_:1},8,["data","schema"]))}}),bD=t.defineComponent({__name:"NodeFormExit",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),o=gn("exit"),{formData:r,setName:i,setConfig:a,inputOptions:l,setInputs:s,setInput:c,inputsFieldNames:d,nameValidator:f,toggleNodeValid:u,fieldNameValidator:p}=mn(e.nodeId,()=>n.value.getInnerData()),{createFieldHandler:m}=vr({validationConfig:{status:Jn(Ss("integer",{fieldName:"Status"}),xs(200,599,{fieldName:"Status"}))},getValidationData:()=>({status:r.value.status}),toggleNodeValid:u}),y=m("status",()=>a("status"));return(_,g)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(r),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(r).name,validate:t.unref(f),onUpdate:t.unref(i)},null,8,["name","validate","onUpdate"]),t.createVNode(Mn,{error:t.unref(y).error.value,"error-message":t.unref(y).errorMessage.value,name:"status",onBlur:t.unref(y).onBlur,"onUpdate:modelValue":t.unref(y).onUpdate},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),t.createVNode(zr,{name:"warn_headers_sent","onUpdate:modelValue":g[0]||(g[0]=h=>t.unref(a)())}),t.createVNode(Sn,{"field-name-validator":t.unref(p),"field-names":t.unref(d),items:t.unref(l),"onChange:input":t.unref(c),"onChange:inputs":t.unref(s)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}});function wD(e){const n=mn(e),{state:o,getNodeById:r,branchGroups:i,commit:a}=at(),{i18n:{t:l}}=Be(),s=qm(),c=Km(),d=t.computed(()=>{var b;const h={...n.formData.value},w=or(((b=n.currentNode.value)==null?void 0:b.type)||"branch");for(const x of w)(!(x in h)||h[x]==null)&&(h[x]=[]);return h});function f(h,w,b){const x=r(h),E=r(b),C=x?`${x.name}.${w}`:`${h}.${w}`,N=E?E.name:b;return[C,N]}function u(h){return(h==null?[]:Array.isArray(h)?h:[h]).filter(w=>Du(w))}function p(h,w){return i.wouldCreateCycle(h,w)?(c({message:l("plugins.free-form.datakit.flow_editor.error.branch_cycle"),appearance:"danger"}),!0):!1}function m(h,w,b){const x=[],E=[],C=[];for(const N of b){const S=i.findMembership(N);if(!S||S.ownerId===h&&S.branch===w)continue;const v=i.getMembers(S.ownerId,S.branch).filter(D=>D!==N);C.push({ownerId:S.ownerId,branch:S.branch,members:v}),x.push(f(h,w,N)),E.push(f(S.ownerId,S.branch,N))}return{conflictUpdates:C,addedAssignments:x,removedAssignments:E}}function y(h,w,b,x){let E=!1;for(const C of x)E=i.setMembers(C.ownerId,C.branch,C.members,{commit:!1})||E;return E=i.setMembers(h,w,b,{commit:!1})||E,E}async function _(h,w){const b=n.currentNode.value,x=u(w),E=i.prepareMembers(b.id,h,x),C=i.getMembers(b.id,h);if(yl(C,E))return!0;const N=E.filter(k=>!C.includes(k));for(const k of N)if(p(b.id,k))return!1;const{conflictUpdates:S,addedAssignments:v,removedAssignments:D}=m(b.id,h,N);return S.length>0&&!await s(l("plugins.free-form.datakit.flow_editor.confirm.message.branch_replace"),v,D)?!1:(y(b.id,h,E,S)&&a(),!0)}const g=t.computed(()=>{const h=n.currentNode.value;return!h||!i?[]:o.value.nodes.filter(w=>w.id!==e&&!Vt(w.type)&&w.phase===h.phase&&!i.wouldCreateCycle(h.id,w.id)).map(w=>({value:w.id,label:w.name}))});return{...n,formData:d,branchOptions:g,updateBranchMembers:_}}const kD=t.defineComponent({__name:"NodeFormBranch",props:{nodeId:{}},setup(e){const{i18n:{t:n}}=Be(),o=gn("branch"),r=t.ref(0),{formData:i,setName:a,inputOptions:l,branchOptions:s,nameValidator:c,setInput:d,setInputs:f,inputsFieldNames:u,fieldNameValidator:p,updateBranchMembers:m}=wD(e.nodeId);async function y(_,g){await m(_,g)||(r.value+=1)}return(_,g)=>(t.openBlock(),t.createBlock(yt,{key:r.value,data:t.unref(i),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(i).name,validate:t.unref(c),onUpdate:t.unref(a)},null,8,["name","validate","onUpdate"]),t.createVNode(t.unref(Pe.KLabel),{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),t.createVNode($t,{"enable-filtering":"",items:t.unref(s),multiple:"",name:"then",onUpdate:g[0]||(g[0]=h=>y("then",h))},null,8,["items"]),t.createVNode($t,{"enable-filtering":"",items:t.unref(s),multiple:"",name:"else",onUpdate:g[1]||(g[1]=h=>y("else",h))},null,8,["items"]),t.createVNode(Sn,{"field-name-validator":t.unref(p),"field-names":t.unref(u),items:t.unref(l),"onChange:input":t.unref(d),"onChange:inputs":t.unref(f)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),CD=t.defineComponent({__name:"NodeFormCache",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),o=gn("cache"),{i18n:{t:r}}=Be(),{formData:i,setName:a,setConfig:l,inputOptions:s,setInputs:c,setInput:d,inputsFieldNames:f,nameValidator:u,toggleNodeValid:p,fieldNameValidator:m}=mn(e.nodeId,()=>n.value.getInnerData()),{createFieldHandler:y}=vr({validationConfig:()=>({ttl:Jn(Ss("integer",{fieldName:"TTL"}),xs(1,1/0,{fieldName:"TTL"}))}),getValidationData:()=>({ttl:i.value.ttl}),toggleNodeValid:p}),_=y("ttl",()=>l("ttl"));return(g,h)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(i),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(i).name,validate:t.unref(u),onUpdate:t.unref(a)},null,8,["name","validate","onUpdate"]),t.createVNode(t.unref(Pe.KLabel),{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),t.createVNode(zr,{name:"bypass_on_error","onUpdate:modelValue":h[0]||(h[0]=w=>t.unref(l)("bypass_on_error"))}),t.createVNode(Mn,{error:t.unref(_).error.value,"error-message":t.unref(_).errorMessage.value,name:"ttl",onBlur:t.unref(_).onBlur,"onUpdate:modelValue":t.unref(_).onUpdate},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),t.createVNode(Sn,{"field-name-validator":t.unref(m),"field-names":t.unref(f),items:t.unref(s),"onChange:input":t.unref(d),"onChange:inputs":t.unref(c)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),ED=["innerHTML"],ND=t.defineComponent({__name:"NodePropertiesPanel",props:{maxWidth:{default:`${Ou}px`},offsetTop:{default:`${s1}px`},visible:{type:Boolean},nodeId:{}},emits:["close"],setup(e){const{getNodeById:n}=at(),o=t.computed(()=>e.nodeId&&n(e.nodeId)),r=t.computed(()=>{var i;switch((i=o.value)==null?void 0:i.type){case"call":return aD;case"service_request":return lD;case"response":return sD;case"jq":return cD;case"static":return pD;case"property":return _D;case"exit":return bD;case"branch":return kD;case"cache":return CD;default:return null}});return(i,a)=>(t.openBlock(),t.createBlock(t.unref(Pe.KSlideout),{class:"dk-node-properties-panel","close-on-blur":!1,"has-overlay":!1,"max-width":i.maxWidth,"offset-top":i.offsetTop,visible:i.visible,"z-index":t.unref(l1),onClose:a[0]||(a[0]=l=>i.$emit("close"))},t.createSlots({default:t.withCtx(()=>[o.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dk-node-properties-panel-desc",innerHTML:t.unref(Bt)(o.value.type)},null,8,ED)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(t.unref(r),{key:i.nodeId,class:"dk-node-properties-panel-form","node-id":i.nodeId},null,8,["node-id"])):t.createCommentVNode("",!0)]),_:2},[o.value?{name:"title",fn:t.withCtx(()=>[t.createVNode(Ym,{type:o.value.type},null,8,["type"])]),key:"0"}:void 0]),1032,["max-width","offset-top","visible","z-index"]))}}),SD=ve(ND,[["__scopeId","data-v-ecb765d9"]]),xD={class:"dk-editor-content"},vD={class:"main"},AD=ve(t.defineComponent({__name:"EditorContent",setup(e){const{propertiesPanelOpen:n,selectedNode:o}=at();function r(){n.value=!1}t.watch(o,a=>{a||r()});const i=t.ref(!1);return t.onMounted(()=>{i.value=!0}),(a,l)=>{var s;return t.openBlock(),t.createElementBlock("div",xD,[t.createVNode(t.unref(jR)),t.createElementVNode("div",vD,[t.createVNode(lR)]),t.createVNode(SD,{"node-id":(s=t.unref(o))==null?void 0:s.id,visible:t.unref(n),onClose:r},null,8,["node-id","visible"])])}}}),[["__scopeId","data-v-8f04afa6"]]),ID={key:0,class:"dk-editor-modal"},TD=ve(t.defineComponent({__name:"EditorModal",props:{open:{type:Boolean},openModifiers:{}},emits:["update:open"],setup(e){t.useCssVars(s=>({"5fe3dd96":`${t.unref(a1)}px`,"480b2f5d":`${t.unref(Pu)}px`}));const n=t.useModel(e,"open"),o=t.ref(!1),r=t.useTemplateRef("confirm-modal"),{clear:i}=at();wV(async(...s)=>{o.value=!0;const c=await r.value.open(...s);return o.value=!1,c});const a=Ye.useScrollLock(document);t.watch(n,s=>{a.value=!!s,s||i()},{immediate:!0});function l(){n.value=!1}return(s,c)=>n.value?(t.openBlock(),t.createElementBlock("div",ID,[t.createVNode(tR,{class:"nav",onBack:l}),t.createVNode(AD,{ref:"content",class:"content",tabindex:"0"},null,512),t.createVNode(ZV,{ref:"confirm-modal"},null,512)])):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-917708bb"]]),PD={class:"dk-flow-editor"},OD={class:"flow-panels-container"},$D={class:"overlay"},BD=ve(t.defineComponent({__name:"FlowEditor",props:{isEditing:{type:Boolean}},emits:["change","error"],setup(e,{emit:n}){const{t:o}=Ze.createI18n("en-us",rt),{formData:r}=ze(),i=n;function a(c,d,f,u){const p={...r.config,nodes:c};f!==void 0&&(p.resources=f);const m={...r.__ui_data,...d};r.config=p,r.__ui_data=m,u!=null?r.partials=[{id:u}]:r.partials&&(r.partials=null),i("change",p,m)}const{modalOpen:l,setPendingFitView:s}=Yu(r,{onChange:a,isEditing:e.isEditing});return t.watch(l,()=>{s(!0)},{flush:"post"}),(c,d)=>{const f=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",PD,[t.createElementVNode("div",OD,[t.createVNode(Ns,{inactive:t.unref(l),mode:"preview"},null,8,["inactive"]),t.createElementVNode("div",$D,[t.createVNode(f,{appearance:"secondary",class:"button-open-editor",onClick:d[0]||(d[0]=u=>l.value=!0)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(o)("plugins.free-form.datakit.flow_editor.cta"))+" ",1),t.createVNode(t.unref(Se.ExpandIcon))]),_:1})])]),t.createVNode(TD,{open:t.unref(l),"onUpdate:open":d[1]||(d[1]=u=>t.isRef(l)?l.value=u:null)},null,8,["open"])])}}}),[["__scopeId","data-v-5f140817"]]);function VD(e,n){const o=[],r=(i,a)=>{typeof a=="string"&&o.push({nodeName:e.name,path:["nodes",n,...i],value:a})};if("input"in e&&e.input!=null&&r(["input"],e.input),"inputs"in e&&e.inputs&&typeof e.inputs=="object")for(const[i,a]of Object.entries(e.inputs))a!=null&&r(["inputs",i],a);if("output"in e&&e.output!=null&&r(["output"],e.output),"outputs"in e&&e.outputs&&typeof e.outputs=="object")for(const[i,a]of Object.entries(e.outputs))a!=null&&r(["outputs",i],a);return o}function RD(e){const n=e.path[2];return n==="output"||n==="outputs"}function ng(e){if(!e)return!1;for(const n of Object.values(e))if(n!=null)return!0;return!1}function og(e,n){const o=e.input!==void 0&&e.input!==null,r=ng(e.inputs);o&&r&&n.addIssue({code:"custom",message:'A node cannot use both "input" and "inputs". Use one or the other.',path:["inputs"]});const i=e.output!==void 0&&e.output!==null,a=ng(e.outputs);i&&a&&n.addIssue({code:"custom",message:'A node cannot use both "output" and "outputs". Use one or the other.',path:["outputs"]})}function rg(e,n,o){if(!e.nodes)return;const r=e.nodes.map(c=>c.name),i=new Set;r.forEach((c,d)=>{i.has(c)&&o.addIssue({code:"custom",message:`Duplicate node name: "${c}"`,path:["nodes",d,"name"]}),i.add(c)});const a=new Set([...n,...r]),l=new Map,s=new Map;e.nodes.forEach((c,d)=>{for(const f of VD(c,d)){const u=f.value.split(".",1)[0];if(a.has(u)||o.addIssue({code:"custom",message:`Unknown node "${u}" in connection "${f.value}"`,path:f.path}),RD(f)){const p=`${f.nodeName}->${u}`;s.has(p)?o.addIssue({code:"custom",message:`Connection specified on both sides: "${f.nodeName}" outputs to "${u}" and "${u}" inputs from "${f.nodeName}". Specify it on one side only.`,path:f.path}):l.set(p,l.get(p)??f.path)}else{const p=`${u}->${f.nodeName}`;l.has(p)?o.addIssue({code:"custom",message:`Connection specified on both sides: "${u}" outputs to "${f.nodeName}" and "${f.nodeName}" inputs from "${u}". Specify it on one side only.`,path:f.path}):s.set(p,s.get(p)??f.path)}}})}const DD=X.z.enum($u),MD=X.z.enum(bo),ig=e=>bo.includes(e),vs=X.z.enum(Bu),ag=vs.options;X.z.union([vs,DD]);const LD=/^[A-Za-z_][A-Za-z0-9_-]{0,254}$/,lg=X.z.string().min(1).max(255).regex(LD,"Invalid node name (snake_case / kebab-case only)").refine(e=>!ig(e),"Name clashes with reserved implicit node").brand(),ia=X.z.union([MD,lg]),FD=X.z.string().min(1).brand(),UD=["then","else"];X.z.enum(UD);const ut=X.z.string().refine(e=>{if(ia.safeParse(e).success)return!0;const n=e.match(/^([^.]+)\.([^.]+)$/);if(!n)return!1;const[,o,r]=n;return ia.safeParse(o).success&&FD.safeParse(r).success},'Invalid connection, expected "NODE" or "NODE.FIELD"').nullish(),sg=X.z.enum(Vu),eo=X.z.object({type:X.z.string(),name:lg,input:ut,inputs:X.z.record(X.z.string(),ut).nullish(),output:ut,outputs:X.z.record(X.z.string(),ut).nullish()}).loose().superRefine((e,n)=>{og(e,n)}),KD=X.z.object({type:X.z.string(),name:X.z.string()}).loose().superRefine((e,n)=>{const o=e.type,r=e.name;(typeof r!="string"||r.length===0||r.includes("."))&&n.addIssue({code:"custom",path:["name"],message:"invalid node name",fatal:!1}),ag.includes(o)||n.addIssue({code:"custom",path:["type"],message:`unknown node type "${o}", expected one of: ${ag.join(", ")}`})}),jD=eo.safeExtend({type:X.z.literal("call"),method:sg.nullish(),ssl_server_name:X.z.string().min(1).nullish(),timeout:X.z.number().int().min(0).max(2147483646).nullish(),url:X.z.url(),inputs:X.z.object({body:ut,headers:ut,query:ut}).partial().nullish(),outputs:X.z.object({body:ut,headers:ut,status:ut}).partial().nullish()}).strict(),GD=eo.safeExtend({type:X.z.literal("exit"),status:X.z.number().int().min(200).max(599).nullish(),warn_headers_sent:X.z.boolean().nullish(),output:X.z.never().optional(),outputs:X.z.never().optional()}).strict(),qD=eo.safeExtend({type:X.z.literal("jq"),jq:X.z.string().min(1).max(10240),outputs:X.z.never().optional()}).strict(),zD=eo.safeExtend({type:X.z.literal("property"),content_type:X.z.enum(["application/json","text/plain","application/octet-stream"]).nullish(),property:X.z.string().min(1),inputs:X.z.never().optional(),outputs:X.z.never().optional()}).strict(),HD=eo.safeExtend({type:X.z.literal("static"),values:X.z.record(X.z.string(),X.z.unknown()),input:X.z.never().optional(),inputs:X.z.never().optional()}).strict(),YD=eo.safeExtend({type:X.z.literal("cache"),bypass_on_error:X.z.boolean().nullish(),inputs:X.z.object({data:ut,key:ut,ttl:ut}).partial().nullish(),outputs:X.z.object({data:ut,hit:ut,miss:ut,stored:ut}).partial().nullish(),ttl:X.z.number().int().gt(0).nullish()}).strict(),WD=eo.safeExtend({type:X.z.literal("branch"),then:X.z.array(ia).nullish(),else:X.z.array(ia).nullish()}).strict(),XD=KD.pipe(X.z.discriminatedUnion("type",[jD,GD,qD,zD,HD,YD,WD])),ZD=X.z.record(X.z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).min(1).max(255),X.z.string().min(1).max(4095)),JD=X.z.object({dictionary_name:X.z.string().default("kong_db_cache")}),QD=X.z.object({host:X.z.string().default("127.0.0.1"),port:X.z.number().int().min(0).max(65535).default(6379)}),eM=X.z.object({ip:X.z.string().default("127.0.0.1"),port:X.z.number().int().min(0).max(65535).default(6379)}),tM=X.z.object({host:X.z.string().optional().default("127.0.0.1"),port:X.z.number().int().min(0).max(65535).optional().default(6379),connect_timeout:X.z.number().int().min(0).max(2147483646).default(2e3),send_timeout:X.z.number().int().min(0).max(2147483646).default(2e3),read_timeout:X.z.number().int().min(0).max(2147483646).default(2e3),username:X.z.string().optional(),password:X.z.string().optional(),sentinel_username:X.z.string().optional(),sentinel_password:X.z.string().optional(),database:X.z.number().int().optional().default(0),keepalive_pool_size:X.z.number().int().min(1).max(2147483646).default(256),keepalive_backlog:X.z.number().int().min(0).max(2147483646).optional(),sentinel_master:X.z.string().optional(),sentinel_role:X.z.enum(["master","slave","any"]).optional(),sentinel_nodes:X.z.array(QD).min(1,{message:"sentinel_nodes must contain at least 1 item"}).optional(),cluster_nodes:X.z.array(eM).min(1,{message:"cluster_nodes must contain at least 1 item"}).optional(),ssl:X.z.boolean().default(!1).optional(),ssl_verify:X.z.boolean().default(!1).optional(),server_name:X.z.string().optional(),cluster_max_redirections:X.z.number().int().default(5).optional(),connection_is_proxied:X.z.boolean().default(!1).optional(),timeout:X.z.number().int().optional(),sentinel_addresses:X.z.array(X.z.string()).min(1).optional(),cluster_addresses:X.z.array(X.z.string()).min(1).optional()}).superRefine((e,n)=>{var c;const o=e.host!==void 0&&e.host!==null,r=e.port!==void 0&&e.port!==null;(o&&!r||!o&&r)&&n.addIssue({code:"custom",message:"host and port must be specified together",path:o?["port"]:["host"]});const i=!!e.sentinel_master,a=!!e.sentinel_role,l=!!((c=e.sentinel_nodes)!=null&&c.length),s=[i,a,l].filter(Boolean).length;s>0&&s<3&&n.addIssue({code:"custom",message:"sentinel_master, sentinel_role and sentinel_nodes must be provided together"}),e.connection_is_proxied===!0&&!o&&n.addIssue({code:"custom",message:"host is required when connection_is_proxied is true (host/port should point to the proxy)",path:["host"]})}),nM=X.z.object({strategy:X.z.enum(["memory","redis"]).optional(),memory:JD,redis:tM}),oM=X.z.object({vault:ZD.nullish(),cache:nM.nullish()});X.z.array(X.z.object({id:X.z.string()})),X.z.object({nodes:X.z.array(XD).min(1,"At least one node is required"),debug:X.z.boolean().nullish(),resources:oM.nullish()}).strict().superRefine((e,n)=>{rg(e,bo,n)});const cg=vs.options,As=X.z.string().min(1).refine(e=>!e.includes("."),"Invalid node name").refine(e=>!ig(e),"Node name conflicts with reserved implicit node"),ft=X.z.string().refine(e=>{if(!e||/\s/.test(e))return!1;const n=e.indexOf(".");if(n===-1)return!0;const o=e.slice(0,n),r=e.slice(n+1);return o.length>0&&r.length>0},"Invalid connection"),to=X.z.object({type:X.z.string(),name:As,input:ft.nullish(),inputs:X.z.record(X.z.string(),ft.nullish()).nullish(),output:ft.nullish(),outputs:X.z.record(X.z.string(),ft.nullish()).nullish()}).loose().superRefine((e,n)=>{og(e,n)}),rM=X.z.object({type:X.z.string(),name:X.z.string()}).loose().superRefine((e,n)=>{const o=e.type,r=e.name;(typeof r!="string"||r.length===0||r.includes("."))&&n.addIssue({code:"custom",path:["name"],message:"Invalid node name",fatal:!1}),cg.includes(o)||n.addIssue({code:"custom",path:["type"],message:`unknown node type "${o}", expected one of: ${cg.join(", ")}`})}),iM=to.safeExtend({type:X.z.literal("call"),method:sg.nullish(),ssl_server_name:X.z.string().nullish(),timeout:X.z.union([X.z.number(),X.z.string()]).nullish(),url:X.z.string().nullish(),inputs:X.z.object({body:ft.nullish(),headers:ft.nullish(),query:ft.nullish()}).partial().nullish(),outputs:X.z.object({body:ft.nullish(),headers:ft.nullish(),status:ft.nullish()}).partial().nullish()}).strict(),aM=to.safeExtend({type:X.z.literal("exit"),status:X.z.union([X.z.number(),X.z.string()]).nullish(),warn_headers_sent:X.z.boolean().nullish(),output:X.z.never().optional(),outputs:X.z.never().optional()}).strict(),lM=to.safeExtend({type:X.z.literal("jq"),jq:X.z.string().nullish(),outputs:X.z.never().optional()}).strict(),sM=to.safeExtend({type:X.z.literal("property"),content_type:X.z.string().nullish(),property:X.z.string().nullish(),inputs:X.z.never().optional(),outputs:X.z.never().optional()}).strict(),cM=to.safeExtend({type:X.z.literal("static"),values:X.z.record(X.z.string(),X.z.unknown()).nullish(),input:X.z.never().optional(),inputs:X.z.never().optional()}).strict(),dM=to.safeExtend({type:X.z.literal("cache"),bypass_on_error:X.z.boolean().nullish(),inputs:X.z.object({data:ft.nullish(),key:ft.nullish(),ttl:ft.nullish()}).partial().nullish(),outputs:X.z.object({data:ft.nullish(),hit:ft.nullish(),miss:ft.nullish(),stored:ft.nullish()}).partial().nullish(),ttl:X.z.union([X.z.number(),X.z.string()]).nullish()}).strict(),uM=to.safeExtend({type:X.z.literal("branch"),then:X.z.array(As).nullish(),else:X.z.array(As).nullish()}).strict(),fM=rM.pipe(X.z.discriminatedUnion("type",[iM,aM,lM,sM,cM,dM,uM])),pM=X.z.record(X.z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).min(1).max(255),X.z.string().min(1).max(4095)),mM=X.z.object({dictionary_name:X.z.string().default("kong_db_cache")}),gM=X.z.object(),hM=X.z.object({strategy:X.z.enum(["memory","redis"]).optional(),memory:mM.optional(),redis:gM.optional()}),yM=X.z.object({vault:pM.nullish(),cache:hM.nullish()}),_M=X.z.object({nodes:X.z.array(fM).nullish(),debug:X.z.boolean().nullish(),resources:yM.nullish()}).strict().superRefine((e,n)=>{!e||!Array.isArray(e.nodes)||rg(e,bo,n)}).nullish(),bM={class:"option-label"},wM=["innerHTML"],kM=ve(t.defineComponent({__name:"DatakitForm",props:{generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{},schema:{},formSchema:{},model:{},formModel:{},formOptions:{},isEditing:{type:Boolean},onModelUpdated:{type:Function},onFormChange:{type:Function},onValidityChange:{type:Function}},setup(e){const{t:n}=Ze.createI18n("en-us",rt),o=e,r=t.inject(so.DATAKIT_ENABLE_FLOW_EDITOR,!1),i=t.inject(so.DATAKIT_M2,!1),{editorMode:a}=Cl(),l=t.computed(()=>r&&c.value?a.value:"code"),s={flow:Se.DesignIcon,code:Se.CodeblockIcon},c=t.ref(!0),d=t.computed(()=>{const _=[{label:n("plugins.free-form.datakit.flow_editor.mode"),value:"flow"},{label:n("plugins.free-form.datakit.code_editor.mode"),value:"code"}];return _[0].disabled=!c.value,_}),f=t.computed(()=>{switch(l.value){case"code":return n("plugins.free-form.datakit.description_code");case"flow":return n("plugins.free-form.datakit.description_flow");default:return""}});t.watch(l,()=>{var _;(_=o.onValidityChange)==null||_.call(o,{model:"config",valid:!0})});function u(){var _;(_=o.onValidityChange)==null||_.call(o,{model:"config",valid:!0})}function p(){u()}function m(_){var w;u();const{success:g}=_M.safeParse(_);let h=g;if(!i&&h){const b=_;(w=b==null?void 0:b.resources)!=null&&w.vault&&(h=!1)}c.value=h}function y(_){var g;c.value=!1,(g=o.onValidityChange)==null||g.call(o,{model:"config",valid:!1,error:_})}return(_,g)=>{const h=t.resolveComponent("KTooltip");return t.openBlock(),t.createBlock(Ad,t.mergeProps(o,{class:"dk-form"}),t.createSlots({default:t.withCtx(w=>[t.createVNode(yt,t.mergeProps(w,{tag:"div"}),{default:t.withCtx(()=>[l.value==="flow"?(t.openBlock(),t.createBlock(BD,{key:0,"is-editing":o.isEditing,onChange:p},null,8,["is-editing"])):l.value==="code"?(t.openBlock(),t.createBlock(i1,{key:1,class:"code-editor",editing:o.isEditing,onChange:m,onError:y},null,8,["editing"])):t.createCommentVNode("",!0)]),_:2},1040)]),"plugin-config-description":t.withCtx(()=>[t.createElementVNode("span",{innerHTML:f.value},null,8,wM)]),_:2},[t.unref(r)?{name:"plugin-config-extra",fn:t.withCtx(()=>[t.createVNode(t.unref(Pe.KSegmentedControl),{"model-value":l.value,options:d.value,"onUpdate:modelValue":g[0]||(g[0]=w=>a.value=w)},{"option-label":t.withCtx(({option:w})=>[t.createVNode(h,{disabled:c.value||w.value!=="flow",text:t.unref(n)("plugins.free-form.datakit.flow_editor.disabled_tooltip")},{default:t.withCtx(()=>[t.createElementVNode("div",bM,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s[w.value]))),t.createTextVNode(" "+t.toDisplayString(w.label),1)])]),_:2},1032,["disabled","text"])]),_:1},8,["model-value","options"])]),key:"0"}:void 0]),1040)}}}),[["__scopeId","data-v-6b230b53"]]),dg=e=>{if(!(!e||typeof e!="object"))for(const[n,o]of Object.entries(e))typeof o=="string"&&(e[n]=o.split(/\s*,\s*/).filter(Boolean))},ug=e=>{if(!(!e||typeof e!="object"))for(const[n,o]of Object.entries(e))Array.isArray(o)&&(e[n]=o.join(", "))},CM=t.defineComponent({__name:"ConfigForm",props:{schema:{},data:{},onChange:{type:Function}},emits:["change"],setup(e,{emit:n}){const o=n,{i18n:{t:r}}=Fe.useI18n(),l={prepareFormData:c=>{var f,u;const d=lo(c);return(u=(f=d.config)==null?void 0:f.tools)!=null&&u.length&&d.config.tools.forEach(p=>{ug(p.headers),ug(p.query)}),d},hasValue:c=>!!(c!=null&&c.config)},s=c=>{var f,u;const d=lo(c);(u=(f=d.config)==null?void 0:f.tools)!=null&&u.length&&d.config.tools.forEach(p=>{dg(p.headers),dg(p.query)}),o("change",d)};return(c,d)=>(t.openBlock(),t.createBlock(yt,{config:l,data:c.data,schema:c.schema,tag:"div",onChange:s},{default:t.withCtx(()=>[t.createVNode(Nt,{"as-child":"",name:"config","reset-label-path":"reset"},{tools:t.withCtx(({name:f})=>[t.createVNode(Yr,{appearance:"tabs","item-label":(u,p)=>t.unref(r)("plugins.free-form.ai-mcp-proxy.tool_item_label",{index:p+1}),name:f,"sticky-tabs":""},null,8,["item-label","name"])]),_:1}),t.createVNode(Wr)]),_:1},8,["data","schema"]))}}),EM=t.defineComponent({__name:"AIMcpProxyForm",props:{schema:{},formSchema:{},model:{},formModel:{},formOptions:{},isEditing:{type:Boolean},onModelUpdated:{type:Function},onFormChange:{type:Function}},setup(e){const n=e,o=t.useSlots();return t.provide(De.AUTOFILL_SLOT,o==null?void 0:o[De.AUTOFILL_SLOT_NAME]),(r,i)=>(t.openBlock(),t.createBlock(qa,t.normalizeProps(t.guardReactiveProps(n)),{default:t.withCtx(a=>[t.createVNode(CM,t.normalizeProps(t.guardReactiveProps(a)),null,16)]),_:1},16))}}),NM=ve(t.defineComponent({__name:"ConfigForm",props:{schema:{},data:{}},emits:["change"],setup(e,{emit:n}){const o=n,r=t.computed(()=>{const l=e.schema.fields.find(d=>Object.keys(d)[0]==="config").config.fields,s=[],c=[];for(const d of l){const f=Object.keys(d)[0];d[f].required?s.push(f):c.push(f)}return{required:s,nonRequired:c}}),i={hasValue:l=>!!(l!=null&&l.config)};function a(l){o("change",l)}return(l,s)=>(t.openBlock(),t.createBlock(yt,{config:i,data:l.data,schema:l.schema,tag:"div",onChange:a},{default:t.withCtx(()=>[t.createVNode(Nt,{"as-child":"",name:"config",omit:r.value.nonRequired,"reset-label-path":"reset"},null,8,["omit"]),t.createVNode(Wr,{class:"ff-advanced-fields"},{default:t.withCtx(()=>[t.createVNode(Nt,{"as-child":"",name:"config",omit:r.value.required,"reset-label-path":"reset"},null,8,["omit"])]),_:1})]),_:1},8,["data","schema"]))}}),[["__scopeId","data-v-3e5ed51d"]]),fg=Object.freeze(Object.defineProperty({__proto__:null,AIMcpProxyForm:EM,CommonForm:t.defineComponent({__name:"CommonForm",props:{generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{},schema:{},formSchema:{},model:{},formModel:{},formOptions:{},isEditing:{type:Boolean},onModelUpdated:{type:Function},onFormChange:{type:Function},onValidityChange:{type:Function}},setup(e){const n=e,o=t.useSlots();return t.provide(De.AUTOFILL_SLOT,o==null?void 0:o[De.AUTOFILL_SLOT_NAME]),(r,i)=>(t.openBlock(),t.createBlock(Ad,t.normalizeProps(t.guardReactiveProps(n)),{default:t.withCtx(a=>[t.createVNode(NM,t.normalizeProps(t.guardReactiveProps(a)),null,16)]),_:1},16))}}),DatakitForm:kM,RequestCalloutForm:Ak,ServiceProtectionForm:OC},Symbol.toStringTag,{value:"Module"})),SM={class:"kong-ui-entities-plugin-form"},xM={key:1,class:"entity-form"},vM={class:"plugin-config-empty-state"},AM=ve(t.defineComponent({__name:"PluginEntityForm",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||e.app==="konnect"&&!e.controlPlaneId||e.app==="kongManager"&&typeof e.workspace!="string")},entityMap:{type:Object,default:()=>({})},record:{type:Object,default:()=>({})},schema:{type:Object,default:()=>({})},rawSchema:{type:Object,default:()=>({})},editing:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},enableRedisPartial:{type:Boolean,default:!1},engine:{type:String,required:!1}},emits:["loading","model-updated","showNewPartialModal","globalAction","validity-change"],setup(e,{emit:n}){var ie,be;const o=Object.keys(De.sharedForms),r=Object.keys(fg);if(new Set([...o,...r]).size!==o.length+r.length)throw new Error("Duplicate form component names found in `sharedForms` and `freeForm`");const i=n,a=e,{axiosInstance:l}=he.useAxios((ie=a.config)==null?void 0:ie.axiosRequestConfig),{parseSchema:s}=Fe.useSchemas({entityId:((be=a.entityMap.focusedEntity)==null?void 0:be.id)||void 0,credential:a.credential,enableRedisPartial:a.enableRedisPartial,experimentalRenders:a.config.app==="konnect"?a.config.experimentalRenders:void 0}),{convertToDotNotation:c,unFlattenObject:d,dismissField:f,isObjectEmpty:u,unsetNullForeignKey:p}=Fe.usePluginHelpers(),m=Fe.useExperimentalFreeForms(),{objectsAreEqual:y}=he.useHelpers(),{i18n:{t:_}}=Be(),g=ee=>a.config.app==="konnect"?ee.replace(/{controlPlaneId}/gi,a.config.controlPlaneId||""):a.config.app==="kongManager"?ee.replace(/\/{workspace}/gi,a.config.workspace?`/${a.config.workspace}`:""):ee,h=(ee,re)=>{let le=`${a.config.apiBaseUrl}${Xe.form[a.config.app].entityGetOne}`;return le=g(le),le=le.replace(/{entity}/gi,ee),le=le.replace(/{id}/gi,re),le},w=ee=>{let re=`${a.config.apiBaseUrl}${Xe.form[a.config.app].entityGetAll}`;return re=g(re),re=re.replace(/{entity}/gi,ee),re},b=(ee,re)=>{const le=h(ee,re);return l.get(le)},x=(ee,re)=>{const le=w(ee);return a.config.app==="konnect"?l.get(le).then(ue=>{const{data:{data:fe}}=ue;if(delete re.size,delete re.offset,fe.length&&Object.keys(re).length===1){const B=Object.keys(re)[0],V=fe.filter(F=>F[B]?!!F[B].toLowerCase().includes(re[B].toLowerCase()):!1);ue.data.data=V}return ue}):l.get(le,{params:re})},E=(ee,re,le)=>{const ue=w(ee);if(a.config.app==="konnect"){const{size:fe,offset:B,...V}=re;if(ee==="consumer_groups")return l.get(ue,{params:{size:1e3},signal:le}).then(R=>{const{data:{data:Q}}=R;if(Q.length&&Object.keys(V).length===1){const q=Object.keys(V)[0],ae=Q.filter(A=>A[q]?!!A[q].toLowerCase().includes(V[q].toLowerCase()):!1);R.data.data=ae}return R});const F={size:fe,offset:B};for(const R of Object.keys(V))F.filter={[R]:{contains:V[R]}};return l.get(ue,{params:F,signal:le})}return l.get(ue,{params:re,signal:le})},C=(ee,re=50)=>{const le=w(ee);return l.get(le,{params:{size:re}})};t.provide(De.FORMS_API_KEY,{getOne:b,getAll:x,getAllV2:E,peek:C}),t.provide(De.FORMS_CONFIG,a.config);const N=t.ref(""),S=t.ref(""),v=t.ref(null),D=t.ref({}),L=t.reactive({}),k=t.reactive({}),J=t.computed(()=>{var ee;return(ee=v.value)==null?void 0:ee.options}),I=t.ref(!1),G=t.ref(),j=(ee,re)=>{I.value=ee??"",G.value=re},te=ee=>{var re;(re=G.value)==null||re.call(G,ee),I.value=!1},K=()=>{var V,F;const ee={...a.schema},re=k,le=L,ue=Object.keys(re),fe={};if(!u(D.value))for(let R=0;R<((F=(V=D.value)==null?void 0:V.fields)==null?void 0:F.length);R++)ee[D.value.fields[R].model]=D.value.fields[R];De.customFields.forEach(R=>{ee[R]&&(ee[R].fields.forEach(Q=>{Q.fields&&Q.fields.forEach(q=>{ee[q.model]=q}),Q.model&&(ee[Q.model]=Q)}),delete ee[R])}),ue.forEach(R=>{var _e;if(!ee[R]){R==="partials"&&(fe[R]=re[R]);return}const Q=ee[R];let q=re[R];const ae=le[R],A=Array.isArray(q)?"array":typeof q,U=Q?Q.valueType:null,$=Q?Q.valueArrayType:null,oe=Q?Q.transform:null;if(q==null&&ae==null&&!Q.submitWhenNull)return;if(Q){if(U&&A!==U)switch(U){case"array":A==="string"&&q.length&&(q=q.split(",").map(ke=>{if(ke=ke.trim(),$==="string")return String(ke);if($==="number")return Number(ke);if($==="boolean"){if(typeof ke=="string")return ke.toLowerCase()==="true"||ke==="1";if(typeof ke=="number")return ke===1}return ke})),(!q||!q.length)&&(q=Q.submitWhenNull?null:[]);break;case"number":q=Number(q);break;case"boolean":A==="string"&&(q=q.toLowerCase()==="true"||q==="1"),A==="number"&&(q=q===1);break;case"string":q=q==null?"":String(q);break}else U==="array"&&(!q||!q.length?q=Q.submitWhenNull?null:[]:((_e=Q.inputAttributes)==null?void 0:_e.type)==="number"&&(q=q.map(ke=>Number(ke))));if(Q.type==="array"&&Q.nestedFields){const ke=de=>{Object.keys(de).forEach(Ne=>{de[Ne]&&typeof de[Ne]=="object"&&!Array.isArray(de[Ne])&&de[Ne]!==null?ke(de[Ne]):(de[Ne]===void 0||de[Ne]===null||typeof de[Ne]=="number"&&isNaN(de[Ne])||typeof de[Ne]=="string"&&de[Ne].trim().length===0)&&delete de[Ne]})};q&&typeof q=="object"&&ke(q)}Q.type==="object-advanced"&&Q.fields&&q!==null&&(Object.entries(q).length===0?q=null:Object.keys(q).forEach(ke=>{Array.isArray(q[ke])||(q[ke]=q[ke].split(","))}))}let ne=c(R);if(Q.fieldNameHasDashes){const[ke,...de]=ne.split(".").reverse();ne=[ke.replace(/_/g,"-"),...de].reverse().join(".")}if(U==="object-expand"){let ke;[ne,ke]=ne.split(".");let de={};fe[ne]&&(de=fe[ne]),de[ke]=q,q=de}ae!==void 0&&q===""&&q!==ae?fe[ne]=U==="object"?{}:null:Q.type==="checklist"&&q===""?fe[ne]=[]:q!==""&&(fe[ne]=q),fe[ne]=oe?oe(q):fe[ne],p(ne,fe)});const B=d(fe);return S.value&&Object.assign(B,Y.value),B},O=(ee,re={})=>{f(k,re,ee,a.editing),i("model-updated",{model:k,originalModel:L,data:K()})},P=(ee,re)=>{var fe;const le={[re]:ee};typeof((fe=a.schema[re])==null?void 0:fe.modelTransformer)=="function"&&(le[re]=a.schema[re].modelTransformer(ee));const ue=Object.assign({},k,le);Object.assign(k,ue),i("model-updated",{model:k,originalModel:L,data:K()})},T=ee=>{i("validity-change",ee)},M=(ee,re)=>{Object.keys(ee).forEach(le=>{var F,R;let ue=re?`${re}-${le}`:le,fe=a.schema[ue];if(!fe){const Q=re?`${re}-${le.replace(/-/g,"_")}`:le.replace(/-/g,"_");(F=a.schema[Q])!=null&&F.fieldNameHasDashes&&(ue=Q,fe=a.schema[ue]),re&&((R=a.schema[re])==null?void 0:R.keyFromObject)===le&&(ue=re,fe=a.schema[ue])}const B=ee[le],V=typeof B;if(fe&&fe.type==="object-advanced"&&!B){k[ue]={},L[ue]={};return}if(Array.isArray(B)){k[ue]=JSON.parse(JSON.stringify(B)),L[ue]=JSON.parse(JSON.stringify(B));return}if(V==="object"&&B&&!B.length)return M(B,ue);if(V==="object"&&B&&B.length&&fe.type==="input"){k[ue]=B.join(", "),L[ue]=B.join(", ");return}k[ue]=B,L[ue]=B}),i("model-updated",{model:k,originalModel:L,data:K()})},Y=t.shallowRef(a.record),z=ee=>{Y.value=ee,i("model-updated",{model:{...k,...ee},originalModel:L,data:K()})},H=t.ref(!0),Z=()=>{var ee;if(a.record&&a.schema&&(M({enabled:a.record.enabled??!0,...a.record.instance_name&&{instance_name:a.record.instance_name||""},...a.record.protocols&&{protocols:a.record.protocols},...a.record.tags&&{tags:a.record.tags}}),a.credential?((a.record.consumer_id||a.record.consumer)&&M({consumer_id:a.record.consumer_id||a.record.consumer}),M(a.record)):a.record.config&&((a.record.consumer_id||a.record.consumer||a.record.service_id||a.record.service||a.record.route_id||a.record.route||a.record.consumer_group_id||a.record.consumer_group)&&M({service_id:a.record.service_id||a.record.service,route_id:a.record.route_id||a.record.route,consumer_id:a.record.consumer_id||a.record.consumer,consumer_group_id:a.record.consumer_group_id||a.record.consumer_group}),a.record.partials&&O("redis",{partials:a.record.partials}),S.value?z(a.record):M(a.record.config,"config"))),Object.keys(a.entityMap).length&&!a.entityMap.global&&a.schema){const re={};for(const le in a.entityMap){const ue=a.entityMap[le].id,fe=a.entityMap[le].idField,B=fe==="consumer_group_id"?"consumer_group-id":JSON.parse(JSON.stringify(fe).replace("_","-"));Object.prototype.hasOwnProperty.call(k,B)&&(re[B]=ue)}M(re)}if((ee=a.entityMap.consumer)!=null&&ee.id&&a.schema&&a.credential){const re={};Object.prototype.hasOwnProperty.call(k,"consumer")&&(re.consumer=a.entityMap.consumer.id),M(re)}H.value=!1};return t.watch(H,ee=>{i("loading",ee)}),t.watch(()=>a.schema,(ee,re)=>{var ue,fe;if(y(ee||{},re||{}))return;const le=s(ee,void 0,void 0,a.engine);Object.assign(k,le.model),D.value={fields:(fe=(ue=D.value)==null?void 0:ue.fields)==null?void 0:fe.map(B=>({...B,disabled:B.disabled||!1}))},Object.assign(L,JSON.parse(JSON.stringify(le.model))),S.value=a.engine?a.engine==="vfg"?void 0:Va(le.model.name,m)||"CommonForm":Va(le.model.name,m),N.value=De.getSharedFormName(le.model.name),Z()},{immediate:!0,deep:!0}),t.onBeforeMount(()=>{var ee,re;v.value=s(a.schema,void 0,void 0,a.engine),Object.assign(k,((ee=v.value)==null?void 0:ee.model)||{}),D.value=((re=v.value)==null?void 0:re.schema)||{},Z()}),(ee,re)=>{var ue;const le=t.resolveComponent("KSkeleton");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",SM,[H.value?(t.openBlock(),t.createBlock(le,{key:0,type:"form"})):k.id&&e.editing||!e.editing?(t.openBlock(),t.createElementBlock("div",xM,[S.value?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(fg[S.value]),{key:0,"form-model":k,"form-options":J.value,"form-schema":D.value,"is-editing":e.editing,model:e.record,"on-form-change":z,"on-model-updated":P,"on-validity-change":T,schema:e.rawSchema,onGlobalAction:re[0]||(re[0]=(fe,B)=>ee.$emit("globalAction",fe,B))},t.createSlots({_:2},[e.enableVaultSecretPicker?{name:t.unref(De.AUTOFILL_SLOT_NAME),fn:t.withCtx(fe=>[fe.schema.referenceable?(t.openBlock(),t.createBlock(t.unref(Vo.VaultSecretPickerProvider),t.mergeProps({key:0},fe,{onOpen:j}),null,16)):t.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["form-model","form-options","form-schema","is-editing","model","schema"])):N.value?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(De.sharedForms)[N.value]),{key:1,"enable-redis-partial":e.enableRedisPartial,"form-model":k,"form-options":J.value,"form-schema":D.value,"is-editing":e.editing,"on-model-updated":P,"on-partial-toggled":O,"show-new-partial-modal":fe=>ee.$emit("showNewPartialModal",fe)},t.createSlots({_:2},[e.enableVaultSecretPicker?{name:t.unref(De.AUTOFILL_SLOT_NAME),fn:t.withCtx(fe=>[fe.schema.referenceable?(t.openBlock(),t.createBlock(t.unref(Vo.VaultSecretPickerProvider),t.mergeProps({key:0},fe,{onOpen:j}),null,16)):t.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["enable-redis-partial","form-model","form-options","form-schema","is-editing","show-new-partial-modal"])):(t.openBlock(),t.createBlock(t.unref(De.VueFormGenerator),{key:2,"enable-redis-partial":e.enableRedisPartial,"is-editing":e.editing,model:k,options:J.value,schema:D.value,onModelUpdated:P,onPartialToggled:O,onRefreshModel:K,onShowNewPartialModal:re[1]||(re[1]=fe=>ee.$emit("showNewPartialModal",fe))},t.createSlots({"plugin-config-empty-state":t.withCtx(()=>[t.createElementVNode("div",vM,t.toDisplayString(t.unref(_)("plugins.form.grouping.plugin_configuration.empty")),1)]),_:2},[(ue=t.unref(Gt)[k.name])!=null&&ue.fieldRules&&(a.config.isNewOtelSchema||k.name!=="opentelemetry")?{name:"plugin-config-before-content",fn:t.withCtx(()=>[t.createVNode(P0,{rules:t.unref(Gt)[k.name].fieldRules},null,8,["rules"])]),key:"0"}:void 0,e.enableVaultSecretPicker?{name:t.unref(De.AUTOFILL_SLOT_NAME),fn:t.withCtx(fe=>[fe.schema.referenceable?(t.openBlock(),t.createBlock(t.unref(Vo.VaultSecretPickerProvider),t.mergeProps({key:0},fe,{onOpen:j}),null,16)):t.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["enable-redis-partial","is-editing","model","options","schema"]))])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(Vo.VaultSecretPicker),{config:a.config,setup:I.value,onCancel:re[2]||(re[2]=()=>I.value=!1),onProceed:te},null,8,["config","setup"])],64)}}}),[["__scopeId","data-v-3a5319dd"]]),IM={key:1},TM=t.defineComponent({__name:"PluginFormActionsWrapper",props:{teleportTarget:{type:String,default:""}},setup(e){return(n,o)=>e.teleportTarget?(t.openBlock(),t.createBlock(t.Teleport,{key:0,to:e.teleportTarget},[t.renderSlot(n.$slots,"default")],8,["to"])):(t.openBlock(),t.createElementBlock("div",IM,[t.renderSlot(n.$slots,"default")]))}}),PM={class:"kong-ui-entities-plugin-form-container"},OM={key:0},$M={class:"plugin-form-actions"},BM=ve(t.defineComponent({__name:"PluginForm",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||e.app==="konnect"&&!e.controlPlaneId||e.app==="kongManager"&&typeof e.workspace!="string")},pluginType:{type:String,required:!0},pluginId:{type:String,default:""},hideScopeSelection:{type:Boolean,default:!1},disableScopeSelection:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},developer:{type:Boolean,default:!1},isWizardStep:{type:Boolean,default:!1},actionsTeleportTarget:{type:String,default:""},noCardWrapper:{type:Boolean,default:!1},hideViewConfigAction:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},schema:{type:Object,default:null},enableRedisPartial:{type:Boolean,default:!1},scopedEntitiesPermissions:{type:Object,default:null},engine:{type:String,required:!1}},emits:["cancel","error:fetch-schema","error","loading","update","model-updated","showNewPartialModal","globalAction"],setup(e,{emit:n}){var ae;const o=n,r=e,i=Bo.useRouter(),{i18n:{t:a}}=Fe.useI18n(),{customSchemas:l,typedefs:s}=Fe.useSchemas({app:r.config.app,credential:r.credential,experimentalRenders:r.config.app==="konnect"?r.config.experimentalRenders:void 0}),{formatPluginFieldLabel:c}=Fe.usePluginHelpers(),{getMessageFromError:d}=he.useErrors(),{capitalize:f}=he.useStringHelpers(),{objectsAreEqual:u}=he.useHelpers(),{axiosInstance:p}=he.useAxios((ae=r.config)==null?void 0:ae.axiosRequestConfig),m=t.ref(!1),y=t.computed(()=>!!r.pluginId),_=t.computed(()=>r.pluginId?he.EntityBaseFormType.Edit:he.EntityBaseFormType.Create),g=t.ref(void 0),h=t.ref(void 0),w=t.computed(()=>!!(r.credential&&r.config.entityId)),b=t.ref(void 0),x=t.ref({}),E=t.ref(),C=t.ref();t.provide(Sd,{redisType:E,redisPath:C,isEditing:y.value});const N=t.ref(!1),S=t.reactive({enabled:!0,protocols:[],tags:[]}),v=t.reactive({fields:{enabled:!0,protocols:[],tags:[]},isReadonly:!1,clientErrorMessage:"",serverErrorMessage:""}),D=t.ref([{title:a("view_configuration.json"),hash:"#json"},{title:a("view_configuration.yaml"),hash:"#yaml"}]);r.config.app==="konnect"&&D.value.splice(1,0,{title:a("view_configuration.terraform"),hash:"#terraform"});const L=t.ref(""),k=t.computed(()=>{var U;if(w.value){let $=Xe.form[r.config.app].credential[_.value];return $=$.replace(/{resourceEndpoint}/gi,j.value),$}let A;return r.config.entityType&&r.config.entityId?A=Xe.form[r.config.app].edit.forEntity.replace(/{entityType}/gi,r.config.entityType).replace(/{entityId}/gi,r.config.entityId):A=Xe.form[r.config.app].edit.all,r.config.app==="konnect"&&((U=Gt[r.pluginType])!=null&&U.useUIData)?`${A}?__ui_data=true`:A}),J=()=>{m.value=!m.value},I=t.computed(()=>{var _e,ke,de,Ne,Te,me,ge,nt;const A=r.config.entityType==="consumers"&&r.config.entityId||((ke=(_e=b.value)==null?void 0:_e.consumer)==null?void 0:ke.id),U=r.config.entityType==="consumer_groups"&&r.config.entityId||((Ne=(de=b.value)==null?void 0:de.consumer_group)==null?void 0:Ne.id),$=r.config.entityType==="services"&&r.config.entityId||((me=(Te=b.value)==null?void 0:Te.service)==null?void 0:me.id),oe=r.config.entityType==="routes"&&r.config.entityId||((nt=(ge=b.value)==null?void 0:ge.route)==null?void 0:nt.id);if(!(A||U||$||oe))return{global:{entity:W.PluginScope.GLOBAL,entityEndpoint:"plugins"}};const ne={};return $&&(ne.service={entity:W.PluginScope.SERVICE,entityEndpoint:"services",id:$,idField:An.SERVICE}),oe&&(ne.route={entity:W.PluginScope.ROUTE,entityEndpoint:"routes",id:oe,idField:An.ROUTE}),A&&(ne.consumer={entity:W.PluginScope.CONSUMER,entityEndpoint:"consumers",id:A,idField:An.CONSUMER}),U&&(ne.consumer_group={entity:W.PluginScope.CONSUMER_GROUP,entityEndpoint:"consumer_groups",id:U,idField:An.CONSUMER_GROUP}),r.config.entityType&&(ne.focusedEntity={entity:W.PluginScope[r.config.entityType.substring(0,r.config.entityType.length-1).toUpperCase()],entityEndpoint:r.config.entityType,id:r.config.entityId,idField:An[r.config.entityType.substring(0,r.config.entityType.length-1).toUpperCase()]}),ne}),G=t.reactive({name:{default:r.pluginType,type:"input",inputType:"hidden",styleClasses:"d-none hidden-field",pinned:!0},enabled:{type:"switch",model:"enabled",label:a("plugins.form.fields.enabled.label"),textOn:a("plugins.form.fields.enabled.on_text"),textOff:a("plugins.form.fields.enabled.off_text"),styleClasses:"field-switch hide-label",default:!0,pinned:!0},selectionGroup:{type:r.hideScopeSelection&&(r.hideScopeSelection||_.value===he.EntityBaseFormType.Create&&r.config.entityId)?"foreign":"selectionGroup",disabled:r.disableScopeSelection,inputType:"hidden",styleClasses:"hide-label",fields:[{label:a("plugins.form.scoping.global.label"),description:a("plugins.form.scoping.global.help")}],pinned:!0},protocols:{id:"protocols",default:[],help:a("plugins.form.fields.protocols.help"),label:a("plugins.form.fields.protocols.label"),required:!0,styleClasses:"plugin-protocols-select",type:"multiselect",values:[{label:"grpc",value:"grpc"},{label:"grpcs",value:"grpcs"},{label:"http",value:"http"},{label:"https",value:"https"},{label:"tcp",value:"tcp"},{label:"tls",value:"tls"},{label:"tls_passthrough",value:"tls_passthrough"},{label:"udp",value:"udp"},{label:"ws",value:"ws"},{label:"wss",value:"wss"}]},instance_name:{default:"",type:"input",label:a("plugins.form.fields.instance_name.label"),inputType:"text",help:a("plugins.form.fields.instance_name.help")},tags:s.tags}),j=t.computed(()=>{var $;const A=r.developer?"developers":"consumers",U=(($=ro[r.pluginType])==null?void 0:$.endpoint)||"/plugins";return`${A}/${r.config.entityId}${r.developer?"/credentials":""}${U}`}),te=A=>{const U=Array.from(new Set(A.map($=>typeof $)));return U.length>1?"string":U[0]},K=(A,U,$,oe)=>{var de,Ne;let ne=U&&U.fields||[];const _e=l[r.pluginType],ke=(Ne=(de=ro[r.pluginType])==null?void 0:de.schema)==null?void 0:Ne.fields;return Array.isArray(ne)&&(ne=ne.reduce((Te,me)=>{const ge=Object.keys(me)[0];return ge.match(/-/g)?Te[ge.replace(/-/g,"_")]={...me[ge],fieldNameHasDashes:!0}:Te[ge]=me[ge],Te},{})),Object.keys(ne).sort().forEach(Te=>{var xn,vn,st,He,pt,kt,mt;const me=ne[Te];me.type==="set"&&(me.type="array");const ge=A?`${A}-${Te}`:`${Te}`;if((xn=_e==null?void 0:_e.fieldsToDelete)!=null&&xn.includes(ge)){td($,ge);return}if(Object.prototype.hasOwnProperty.call(me,"overwrite")||me.hidden)return;if(me.type==="table")return K(ge,me.schema,$);if(me.fields)return oe&&me.type==="record"?($[ge]={type:"object",model:Te,schema:{fields:Object.values(K(ge,me,{},!0))}},$):K(ge,me,$);if($[ge]={id:ge,model:Te},$[ge].type=me.type==="boolean"?"checkbox":"input",$[ge].required=me.required,$[ge].referenceable=me.referenceable,ge.startsWith("config-"))if(!oe&&me.type==="array"&&(L.value=ge),oe&&L.value&&ge.startsWith(L.value)){const $e=ge.slice(L.value.length+1);$[ge].label=$e.split("-").map(c).join(".")}else $[ge].label=c(ge);if((A==="config"||A.startsWith("config-"))&&(vn=ne[Te])!=null&&vn.description&&($[ge].help=Ir.marked.parse(ne[Te].description,{mangle:!1,headerIds:!1})),me.type==="map"){if($[ge].type="object-advanced",$[ge].values=me.values,me.values.type==="array"){const{type:$e}=me.values.elements||{};$[ge].schema={fields:[{schema:{fields:[{...Ve,model:ge,valueArrayType:$e==="integer"?"number":$e||"string",inputAttributes:{...Ve.inputAttributes,type:$e==="integer"?"number":"text",inputMode:$e==="integer"?"numeric":"text"}}]}}]}}else me.values.fields&&($[ge].schema={fields:[{type:"object",model:"object",schema:{fields:me.values.fields.map($e=>{const se=Object.keys($e)[0];return{model:se,type:"input",label:f(se),placeholder:se,inputType:$e[se].type}})}}]});return $}if(me.enum&&me.type==="array"&&($[ge].type="checklist",$[ge].values=me.enum,$[ge].multi=!0,$[ge].multiSelect=!0),me.one_of&&me.type!=="array"&&($[ge].type="select",$[ge].values=me.one_of,$[ge].selectOptions={noneSelectedText:a("plugins.form.no_selection")}),me.elements&&me.type==="array"){const $e=me.elements;if($[ge].referenceable=$e.referenceable,$[ge].elements=$e,["string","integer","number"].includes($e.type)&&!$e.one_of){const{id:se,help:ye,label:ce,hint:pe,values:we,referenceable:xe,model:Oe}=$[ge],{inputAttributes:Re,...Me}=JSON.parse(JSON.stringify(Ve));Re.type=$e.type==="string"?"text":"number",$[ge]={id:se,help:ye,label:ce,hint:pe,values:we,referenceable:xe,model:Oe,inputAttributes:Re,...Me}}}if(me.hint&&($[ge].hint=me.hint),_e&&!_e.overwriteDefault&&Object.keys(_e).forEach($e=>{if($e===ge){const{help:se,label:ye,hint:ce,values:pe,referenceable:we,elements:xe}=$[ge],{help:Oe,...Re}=_e[$e];$[ge]={help:se,label:ye,hint:ce,values:pe,referenceable:we,elements:xe,...Re},typeof Oe=="string"&&($[ge].help=Ir.marked.parse(Oe,{mangle:!1,headerIds:!1}))}}),me.type==="array"&&((st=me.elements)==null?void 0:st.type)==="record"&&Array.isArray(me.elements.fields)){let $e={};for(const ye of me.elements.fields)$e={...$e,...ye};const se=(kt=(pt=(He=$[ge])==null?void 0:He.items)==null?void 0:pt.schema)==null?void 0:kt.fields;if(Array.isArray(se))for(const ye of $[ge].items.schema.fields){const ce=(mt=$e[ye.model])==null?void 0:mt.description;ye.help===void 0&&typeof ce=="string"&&(ye.help=Ir.marked.parse(ce,{mangle:!1,headerIds:!1}))}if(se||($[ge].type="array",$[ge].newElementButtonLabelClasses="kong-form-new-element-button-label",$[ge].fieldClasses="array-card-container-wrapper",$[ge].itemContainerComponent="FieldArrayCardContainer",$[ge].items={type:"object",schema:{fields:Object.values(K(ge,me.elements,{},!0))}},$[ge].items.schema.fields.forEach(ye=>{var ce,pe;for(const we of me.elements.fields){const xe=Object.keys(we)[0],Oe=((pe=(ce=ye.id)==null?void 0:ce.split)==null?void 0:pe.call(ce,"-"))??[];if(Oe[Oe.length-1]===xe){ye.model=xe,ye.label=c(xe);break}}}),me.elements.type==="record"&&($[ge].nestedFields=!0)),!$[ge].nestedFields)$[ge].items.default=()=>me.elements.fields.reduce((ye,ce)=>{const pe=Object.keys(ce)[0];return ye[pe]=ce[pe].default,ye},{});else{const ye=(ce,pe)=>{if(ce.type==="object"){ce.model&&(pe[ce.model]={});for(const we of ce.schema.fields)ye(we,ce.model?pe[ce.model]:pe)}else ce.model&&(pe[ce.model]=ce.default)};$[ge].items.default=()=>{const ce={};return ye($[ge].items,ce),ce}}}if(w.value&&ke){for(let $e=0;$e<ke.length;$e++)if(ke[$e][ge]){$[ge]={...$[ge],...ke[$e][ge]};break}}if(me.required&&me.type!=="boolean"&&($[ge].required=!0,$[ge].selectOptions={hideNoneSelectedText:!0}),me.required&&me.type==="boolean"&&($[ge].default=me.default??!1),me.default!=null&&typeof me.default!="object"&&me.default!=="function"&&($[ge].default=me.default),$[ge].type==="input"){["string","number"].includes(typeof $[ge].default)&&r.config.app==="konnect"&&($[ge].placeholder=`Default: ${$[ge].default===""?"<empty string>":$[ge].default}`);const{type:$e}=me.elements||{};$e&&($[ge].valueArrayType=$e==="integer"?"number":$e),$[ge].inputType=me.type==="array"||me.type==="string"?me.encrypted?"password":"text":me.type}let nt="string";me.enum?nt=te(me.enum):me.type==="boolean"?nt="boolean":me.type==="number"||me.type==="integer"?(nt="number",$[ge].inputType="number"):me.type==="array"?(nt="array",$[ge].default=me.default,me.len_min>0&&($[ge].submitWhenNull=!0)):me.type==="foreign"?nt="object":me.default&&Array.isArray(me.default)?(nt="array",$[ge].valueArrayType=te(me.default)):me.default&&(nt=typeof me.default),$[ge].valueType=nt,me.fieldNameHasDashes&&($[ge].fieldNameHasDashes=!0)}),$},O=()=>{var ge,nt,xn,vn,st,He,pt,kt,mt,$e,se,ye;const A=((ge=Gt[r.pluginType])==null?void 0:ge.scope.includes(W.PluginScope.SERVICE))??!0,U=((nt=Gt[r.pluginType])==null?void 0:nt.scope.includes(W.PluginScope.ROUTE))??!0,$=((xn=Gt[r.pluginType])==null?void 0:xn.scope.includes(W.PluginScope.CONSUMER))??!0,oe=r.config.disableConsumerGroupScope?!1:((vn=Gt[r.pluginType])==null?void 0:vn.scope.includes(W.PluginScope.CONSUMER_GROUP))??!0,ne=r.config.entityType==="consumers"&&!!r.config.entityId||!!((He=(st=b.value)==null?void 0:st.consumer)!=null&&He.id),_e=r.config.entityType==="consumer_groups"&&!!r.config.entityId||!!((kt=(pt=b.value)==null?void 0:pt.consumer_group)!=null&&kt.id),ke=r.config.entityType==="services"&&!!r.config.entityId||!!(($e=(mt=b.value)==null?void 0:mt.service)!=null&&$e.id),de=r.config.entityType==="routes"&&!!r.config.entityId||!!((ye=(se=b.value)==null?void 0:se.route)!=null&&ye.id),Ne=[],Te=(ce,pe,we)=>ce?a("plugins.form.disable_source_scope_change",{scope:we}):pe?a("plugins.form.disable_data_retrieving",{scope:we}):"",me=ce=>{var pe,we;return((we=(pe=r.scopedEntitiesPermissions)==null?void 0:pe[ce])==null?void 0:we.canRetrieve)===!1};if(A){const ce=me("service"),pe="services",we=ke&&r.disableScopeSelection;Ne.push({id:"service-id",model:"service-id",label:a("plugins.form.scoping.gateway_service.label"),placeholder:a("plugins.form.scoping.placeholder"),type:"AutoSuggest",labelField:"name",entity:pe,inputValues:{fields:["name","id"]},help:a("plugins.form.scoping.gateway_service.help"),disabled:we||ce,disabledTooltip:Te(we,ce,pe)})}if(U){const ce=me("route"),pe="routes",we=de&&r.disableScopeSelection;Ne.push({id:"route-id",model:"route-id",label:a("plugins.form.scoping.route.label"),placeholder:a("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:pe,labelField:"name",inputValues:{fields:["name","id"],primaryField:"id"},help:a("plugins.form.scoping.route.help"),disabled:we||ce,disabledTooltip:Te(we,ce,pe)})}if($){const ce=me("consumer"),pe="consumers",we=ne&&r.disableScopeSelection;Ne.push({model:"consumer-id",label:a("plugins.form.scoping.consumer.label"),placeholder:a("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:pe,labelField:"username",inputValues:{fields:["username","custom_id","id"],primaryField:"username"},help:a("plugins.form.scoping.consumer.help"),disabled:we||ce,disabledTooltip:Te(we,ce,pe)})}if(oe){const ce=me("consumer_group"),pe="consumer_groups",we=_e&&r.disableScopeSelection;Ne.push({model:"consumer_group-id",label:a("plugins.form.scoping.consumer_group.label"),placeholder:a("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:pe,entityDataKey:"consumer_group",labelField:"name",inputValues:{fields:["name","id"],primaryField:"name"},help:a("plugins.form.scoping.consumer_group.help"),disabled:we||ce,disabledTooltip:Te(we,ce,pe)})}if(Ne.length){const ce=[...A?["service"]:[],...U?["route"]:[],...$?["consumer"]:[],...oe?["consumer_group"]:[]],we=ce.splice(ce.length-2,2).map(Oe=>a(Oe==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Oe}.plural`)).join(`${ce.length>0?",":""} and/or `),xe=["Specific",[...ce.length>0?[ce.map(Oe=>a(Oe==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Oe}.plural`)).join(", ")]:[],we].join(", ")].join(" ");G.selectionGroup.fields.push({label:a("plugins.form.scoping.label"),description:xe,fields:[]}),G.selectionGroup.fields[1].fields=Ne}l[r.pluginType]&&l[r.pluginType].overwriteDefault&&Object.hasOwnProperty.call(l[r.pluginType],"formSchema")&&Object.assign(G,l[r.pluginType].formSchema)},P=t.computed(()=>!u(v.fields,S,!0)),T=t.computed(()=>!Q.value&&!N.value&&(_.value===he.EntityBaseFormType.Create||P.value)),M=t.ref(!1),Y=t.ref(),z=A=>{r.credential&&A.password&&(A.password=""),v.fields.id=(A==null?void 0:A.id)||void 0,Y.value=A==null?void 0:A.ordering,Object.assign(S,v.fields),b.value=A,M.value=!0},H=t.ref({}),Z=A=>{var U;v.fields=A.model,v.fields.id=((U=b.value)==null?void 0:U.id)||void 0,Object.assign(S,A.originalModel),H.value=A.data,r.isWizardStep&&o("model-updated",{model:v.fields,data:A.data,resourceEndpoint:j.value})},ie=t.ref(new Map),be=t.computed(()=>[v.clientErrorMessage,v.serverErrorMessage].filter(Boolean).join("; ")),ee=A=>{A.valid?ie.value.delete(A.model):ie.value.set(A.model,A.error),v.clientErrorMessage=[...ie.value.entries()].map(([U,$])=>`${U}: ${typeof $=="string"?$:d($)}`).join("; "),v.clientErrorMessage&&(v.serverErrorMessage="")};t.watch([I,M],(A,U)=>{const $=A[0]!==U[0],oe=A[1],ne=U[1];if(!w.value&&_.value===he.EntityBaseFormType.Edit&&($||oe&&oe!==ne)){const _e=K("config",x.value,G);ue.value&&(_e._isCustomPlugin=!0),E.value&&(_e._supported_redis_partial_type=E.value),h.value=_e}},{deep:!0});const re=()=>{r.config.cancelRoute?i.push(r.config.cancelRoute):o("cancel")},le=t.computed(()=>{const A=r.config.entityType&&r.config.entityId&&!r.developer,U=w.value?Xe.form[r.config.app].credential[_.value]:Xe.form[r.config.app][_.value][A?"forEntity":"all"];let $=`${r.config.apiBaseUrl}${U}`;return r.config.app==="konnect"?$=$.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||""):r.config.app==="kongManager"&&($=$.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")),$=$.replace(/{resourceEndpoint}/gi,j.value),$=$.replace(/{id}/gi,r.pluginId),$=$.replace(/{entityType}/gi,r.config.entityType||""),$=$.replace(/{entityId}/gi,r.config.entityId||""),$}),ue=t.computed(()=>!Object.keys(Gt).includes(r.pluginType)),fe=t.computed(()=>{const A=H.value;if(w.value){for(const U in W.PluginScope){const $=W.PluginScope[U];A[$]&&!A[$].id&&(A[$]={id:r.config.entityId})}delete A.created_at}return H.value.partials&&C.value&&td(A,C.value),A}),B=t.computed(()=>{const{__ui_data:A,...U}={...fe.value};return U}),V=async()=>{if(!v.clientErrorMessage&&!r.isWizardStep)try{v.isReadonly=!0;let A;const U=JSON.parse(JSON.stringify(fe.value)),$=l[r.pluginType];typeof($==null?void 0:$.shamefullyTransformPayload)=="function"&&$.shamefullyTransformPayload({originalModel:S,model:v.fields,payload:U,schema:h.value}),_.value==="create"?A=await p.post(le.value,U):_.value==="edit"&&(A=r.config.app==="konnect"||E.value&&U.partials?await p.put(le.value,Object.assign({ordering:Y.value},U)):await p.patch(le.value,U)),Object.assign(S,v.fields),o("update",A==null?void 0:A.data)}catch(A){v.serverErrorMessage=d(A),o("error",A)}finally{v.isReadonly=!1}},F=t.computed(()=>{var oe;const A=w.value?(oe=ro[r.pluginType])==null?void 0:oe.schemaEndpoint:r.pluginType,U=w.value?Xe.form[r.config.app].credentialSchema:Xe.form[r.config.app].pluginSchema;let $=`${r.config.apiBaseUrl}${U}`;return r.config.app==="konnect"?$=$.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||""):r.config.app==="kongManager"&&($=$.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")),$=$.replace(/{plugin}/gi,A),$}),R=t.ref(""),Q=t.ref(!1),q=t.ref("");return t.onBeforeMount(async()=>{var A,U,$,oe;Q.value=!0;try{if(w.value&&r.config.app==="konnect"){const ne=(A=ro[r.pluginType])==null?void 0:A.schemaEndpoint,_e=Og[ne];R.value=ne,h.value=K("",_e,{}),Q.value=!1}else{const ne=r.schema??(await p.get(F.value)).data;if(g.value=ne,ne)if(w.value)h.value=K("",ne,{}),Q.value=!1;else{const _e=ne.fields.find(de=>de.config);x.value=_e?_e.config:ne,ne.supported_partials&&(E.value=Object.keys(ne.supported_partials).find(de=>[Pr.REDIS_CE,Pr.REDIS_EE].includes(de)),C.value=(U=ne.supported_partials[E.value])==null?void 0:U[0]),O();const ke=($=ne.fields.find(de=>de.protocols))==null?void 0:$.protocols;if(ke){const{default:de=[],elements:Ne={}}=ke;G.protocols.default=de,G.protocols.placeholder=r.config.app==="konnect"?a("plugins.form.fields.protocols.placeholderWithDefaultValues",{protocols:de.join(", ")}):a("plugins.form.fields.protocols.placeholder"),(oe=Ne.one_of)!=null&&oe.length&&(G.protocols.values=Ne.one_of.map(Te=>({label:Te,value:Te})))}if(M.value||_.value===he.EntityBaseFormType.Create){const de=K("config",x.value,G);E.value&&(de._supported_redis_partial_type=E.value),ue.value&&(de._isCustomPlugin=!0),h.value=de}}}}catch(ne){console.error(ne),q.value=d(ne),o("error:fetch-schema",ne)}finally{Q.value=!1}}),(A,U)=>{const $=t.resolveComponent("KSkeleton"),oe=t.resolveComponent("KEmptyState"),ne=t.resolveComponent("KButton"),_e=t.resolveComponent("KTabs"),ke=t.resolveComponent("KSlideout");return t.openBlock(),t.createElementBlock("div",PM,[Q.value?(t.openBlock(),t.createBlock($,{key:0,type:"form"})):q.value?(t.openBlock(),t.createBlock(oe,{key:1,"action-button-visible":!1,"data-testid":"plugin-form-schema-error","icon-variant":"error"},{default:t.withCtx(()=>[t.createElementVNode("h3",null,t.toDisplayString(t.unref(a)("errors.load_schema")),1)]),_:1})):(t.openBlock(),t.createBlock(t.unref(he.EntityBaseForm),{key:2,"can-submit":T.value,config:e.config,"edit-id":e.pluginId,"entity-type":t.unref(he.SupportedEntityType).Plugin,"error-message":be.value,"fetch-url":k.value,"form-fields":fe.value,"is-readonly":v.isReadonly,"no-validate":"","wrapper-component":e.noCardWrapper?"div":void 0,onCancel:re,"onFetch:error":U[4]||(U[4]=de=>A.$emit("error",de)),"onFetch:success":z,onLoading:U[5]||(U[5]=de=>A.$emit("loading",de))},{"form-actions":t.withCtx(()=>[e.isWizardStep?(t.openBlock(),t.createElementBlock("div",OM)):(t.openBlock(),t.createBlock(TM,{key:1,"teleport-target":e.actionsTeleportTarget},{default:t.withCtx(()=>[t.createElementVNode("div",$M,[e.hideViewConfigAction?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(ne,{key:0,appearance:"tertiary","data-testid":`plugin-${y.value?"edit":"create"}-form-view-configuration`,onClick:U[3]||(U[3]=de=>J())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.view_configuration")),1)]),_:1},8,["data-testid"])),t.createVNode(ne,{appearance:"secondary",class:"form-action-button","data-testid":`plugin-${y.value?"edit":"create"}-form-cancel`,disabled:v.isReadonly,onClick:re},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.cancel")),1)]),_:1},8,["data-testid","disabled"]),t.createVNode(ne,{appearance:"primary","data-testid":`plugin-${y.value?"edit":"create"}-form-submit`,disabled:!T.value||v.isReadonly,type:"submit",onClick:V},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.save")),1)]),_:1},8,["data-testid","disabled"])])]),_:1},8,["teleport-target"]))]),default:t.withCtx(()=>[t.createElementVNode("form",{hidden:"",onSubmit:V},null,32),t.createVNode(AM,{config:e.config,credential:w.value,editing:_.value===t.unref(he.EntityBaseFormType).Edit,"enable-redis-partial":e.enableRedisPartial,"enable-vault-secret-picker":r.enableVaultSecretPicker,engine:e.engine,"entity-map":I.value,"raw-schema":g.value,record:b.value,schema:h.value,onGlobalAction:U[0]||(U[0]=(de,Ne)=>A.$emit("globalAction",de,Ne)),onLoading:U[1]||(U[1]=de=>N.value=de),onModelUpdated:Z,onShowNewPartialModal:U[2]||(U[2]=de=>A.$emit("showNewPartialModal",de)),onValidityChange:ee},null,8,["config","credential","editing","enable-redis-partial","enable-vault-secret-picker","engine","entity-map","raw-schema","record","schema"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly","wrapper-component"])),t.createVNode(ke,{"close-on-blur":!1,"data-testid":"form-view-configuration-slideout","has-overlay":!1,"offset-top":60,title:t.unref(a)("view_configuration.title"),visible:m.value,onClose:J},{default:t.withCtx(()=>[t.createElementVNode("div",null,t.toDisplayString(t.unref(a)("view_configuration.message")),1),t.createVNode(_e,{"data-testid":"form-view-configuration-slideout-tabs",tabs:D.value},{json:t.withCtx(()=>[t.createVNode(t.unref(he.JsonCodeBlock),{config:e.config,"entity-record":B.value,"fetcher-url":le.value,"request-method":r.pluginId?"put":"post"},null,8,["config","entity-record","fetcher-url","request-method"])]),yaml:t.withCtx(()=>[t.createVNode(t.unref(he.YamlCodeBlock),{"entity-record":B.value},null,8,["entity-record"])]),terraform:t.withCtx(()=>[t.createVNode(t.unref(he.TerraformCodeBlock),{"credential-type":R.value,"entity-record":B.value,"entity-type":t.unref(he.SupportedEntityType).Plugin},null,8,["credential-type","entity-record","entity-type"])]),_:1},8,["tabs"])]),_:1},8,["title","visible"])])}}}),[["__scopeId","data-v-b9713619"]]),VM={class:"kong-ui-entities-plugins-list"},RM={class:"button-row"},DM={class:"name-cell-wrapper"},MM={class:"info-wrapper"},LM={key:0,class:"info-name"},FM={key:1,class:"info-name"},UM={key:2,class:"info-type"},KM={key:1},jM=ve(t.defineComponent({__name:"PluginList",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.createRoute||!e.getViewRoute||!e.getEditRoute||!e.getConfigureDynamicOrderingRoute||e.app==="kongManager"&&!e.isExactMatch&&!e.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canToggle:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},canRetrieveScopedEntity:{type:Function,required:!1,default:async()=>!0},canConfigureDynamicOrdering:{type:Function,required:!1,default:async()=>!0},title:{type:String,default:""},titleTag:{type:String,default:"h2"},useActionOutside:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success","toggle-enabled"],setup(e,{emit:n}){var R,Q;const o=Fe.usePluginMetaData(),r=n,i=e,{i18n:{t:a}}=Fe.useI18n(),l=Bo.useRouter(),{axiosInstance:s}=he.useAxios((R=i.config)==null?void 0:R.axiosRequestConfig),{hasRecords:c,handleStateChange:d}=he.useTableState(()=>b.value),f=t.computed(()=>c.value&&i.config.app==="konnect"),u=t.computed(()=>!!i.config.entityId),p=t.computed(()=>{var q;return((q=i.config)==null?void 0:q.entityType)==="consumers"}),m=t.computed(()=>{var q;return((q=i.config)==null?void 0:q.entityType)==="consumer_groups"}),y=i.config.app==="konnect"||he.useGatewayFeatureSupported({gatewayInfo:i.config.gatewayInfo,supportedRange:{enterprise:["3.0"]}}),_=t.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),g={name:{label:a("plugins.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1}};(Q=i.config)!=null&&Q.entityId||(g.appliedTo={label:a("plugins.list.table_headers.applied_to"),sortable:!1}),g.enabled={label:a("plugins.list.table_headers.enabled"),searchable:!0,sortable:!0},y&&(g.ordering={label:a("plugins.list.table_headers.ordering"),sortable:!0}),g.tags={label:a("plugins.list.table_headers.tags"),sortable:!1};const h=g,w=t.computed(()=>{var ae,A,U,$;let q=i.config.entityType?`${i.config.apiBaseUrl}${Xe.list[i.config.app].forEntity}`:`${i.config.apiBaseUrl}${Xe.list[i.config.app].all}`;return i.config.app==="konnect"?q=q.replace(/{controlPlaneId}/gi,((ae=i.config)==null?void 0:ae.controlPlaneId)||""):i.config.app==="kongManager"&&(q=q.replace(/\/{workspace}/gi,(A=i.config)!=null&&A.workspace?`/${i.config.workspace}`:"")),q.replace(/{entityType}/gi,((U=i.config)==null?void 0:U.entityType)||"").replace(/{entityId}/gi,(($=i.config)==null?void 0:$.entityId)||"")}),b=t.ref(""),x=t.computed(()=>i.config.app==="konnect"||i.config.isExactMatch?{isExactMatch:!0,fields:{name:g.name,id:{label:a("plugins.list.table_headers.id"),sortable:!0}},placeholder:a(`search.placeholder.${i.config.isExactMatch?"exact":i.config.app}`)}:{isExactMatch:!1,fields:{enabled:{...g.enabled,label:a("search.filter.field.enabled")},name:g.name,instance_name:{label:a("plugins.list.table_headers.instance_name"),searchable:!0}},schema:i.config.filterSchema}),{fetcher:E,fetcherState:C,fetcherCacheKey:N}=he.useFetcher(t.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),w),S=()=>{b.value=""},v=()=>{N.value++},D=t.ref(null),L=q=>{var A,U,$,oe;const ae=[];return((A=q.route)!=null&&A.id||q.route_id)&&ae.push({type:"route",badgeText:a("plugins.list.table_headers.applied_to_badges.route")}),((U=q.service)!=null&&U.id||q.service_id)&&ae.push({type:"service",badgeText:a("plugins.list.table_headers.applied_to_badges.service")}),(($=q.consumer)!=null&&$.id||q.consumer_id)&&ae.push({type:"consumer",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer")}),((oe=q.consumer_group)!=null&&oe.id||q.consumer_group_id)&&ae.push({type:"consumer_group",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer_group")}),ae.length?ae:[{type:null,badgeText:a("plugins.list.table_headers.applied_to_badges.global")}]},k=async(q,ae)=>{var A;return q===null?!1:await((A=i.canRetrieveScopedEntity)==null?void 0:A.call(i,q,ae.id))},J=(q,ae)=>{var U,$,oe,ne,_e;let A=null;switch(q){case"route":A=(U=ae.route)==null?void 0:U.id;break;case"service":A=($=ae.service)==null?void 0:$.id;break;case"consumer":A=(oe=ae.consumer)==null?void 0:oe.id;break;case"consumer_group":A=(ne=ae.consumer_group)==null?void 0:ne.id;break}A&&((_e=i.config)!=null&&_e.getScopedEntityViewRoute)&&l.push(i.config.getScopedEntityViewRoute(q,A))},I=t.ref(!1),G=t.ref(null),j=t.computed(()=>{const q={action:"disable",id:"",name:""};if(G.value){const{enabled:ae,id:A,name:U}=G.value;q.action=ae?"disable":"enable",q.id=A,q.name=o.getDisplayName(U)||A}return q}),te=q=>{I.value=!0,G.value=q},K=()=>{I.value=!1,G.value=null},O=async()=>{var U,$,oe,ne,_e,ke,de,Ne;if(!await((U=i.canEdit)==null?void 0:U.call(i,G.value))||!G.value)return;let ae=`${i.config.apiBaseUrl}${(_e=Xe.item[i.config.app])==null?void 0:_e[($=i.config)!=null&&$.entityType?"forEntity":"all"].replace(/{entityType}/gi,((oe=i.config)==null?void 0:oe.entityType)||"").replace(/{entityId}/gi,((ne=i.config)==null?void 0:ne.entityId)||"")}`.replace(/{id}/gi,G.value.id||"");i.config.app==="konnect"?ae=ae.replace(/{controlPlaneId}/gi,((ke=i.config)==null?void 0:ke.controlPlaneId)||""):i.config.app==="kongManager"&&(ae=ae.replace(/\/{workspace}/gi,(de=i.config)!=null&&de.workspace?`/${i.config.workspace}`:""));const A=!G.value.enabled;try{const{data:Te}=((Ne=i.config)==null?void 0:Ne.app)==="konnect"?await s.put(ae,{...G.value,enabled:A},{timeout:12e4}):await s.patch(ae,{...G.value,enabled:A},{timeout:12e4});r("toggle-enabled",A,Te),G.value.enabled=A}catch(Te){r("error",Te)}},P=async(q,ae)=>{const A=q.id;if(!await ae(A)){r("copy:error",{entity:q,field:"id",message:a("errors.copy")});return}r("copy:success",{entity:q,field:"id",message:a("copy.success",{val:A})})},T=async(q,ae)=>{const A=JSON.stringify(q);if(!await ae(A)){r("copy:error",{entity:q,message:a("errors.copy")});return}r("copy:success",{entity:q,message:a("copy.success_brief")})},M=async q=>{var A;await((A=i.canRetrieve)==null?void 0:A.call(i,q))&&l.push(i.config.getViewRoute(q))},Y=q=>({label:a("actions.view"),to:i.config.getViewRoute(q)}),z=q=>({label:a("actions.edit"),to:i.config.getEditRoute(q)}),H=q=>({label:a("actions.configure_dynamic_ordering"),to:i.config.getConfigureDynamicOrderingRoute(q)}),Z=t.ref(void 0),ie=t.ref(!1),be=t.ref(!1),ee=t.ref(""),re=he.useDeleteUrlBuilder(i.config,w.value),le=q=>{Z.value=q,ie.value=!0},ue=()=>{ie.value=!1},fe=async()=>{var q,ae,A;if((q=Z.value)!=null&&q.id){be.value=!0;try{await s.delete(re(Z.value.id)),be.value=!1,ie.value=!1,N.value++,r("delete:success",Z.value)}catch(U){ee.value=((A=(ae=U.response)==null?void 0:ae.data)==null?void 0:A.message)||U.message||a("errors.delete"),r("error",U)}finally{be.value=!1}}},B=()=>{l.push(i.config.createRoute)};t.watch(C,q=>{var ae,A,U;if(q.status===he.FetcherStatus.Error){D.value={title:a("errors.general")},(U=(A=(ae=q.error)==null?void 0:ae.response)==null?void 0:A.data)!=null&&U.message&&(D.value.message=q.error.response.data.message),r("error",q.error);return}D.value=null});const V=t.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${a("plugins.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:a("plugins.title")}),F=t.ref(!1);return t.onBeforeMount(async()=>{F.value=await i.canCreate(),F.value&&(V.value.title=a("plugins.list.empty_state.title"),V.value.ctaText=a("actions.create"))}),(q,ae)=>{const A=t.resolveComponent("KButton"),U=t.resolveComponent("KEmptyState"),$=t.resolveComponent("KBadge"),oe=t.resolveComponent("KTruncate"),ne=t.resolveComponent("KInputSwitch"),_e=t.resolveComponent("KDropdownItem"),ke=t.resolveComponent("KClipboardProvider");return t.openBlock(),t.createElementBlock("div",VM,[t.createVNode(t.unref(he.EntityBaseTable),{"cache-identifier":e.cacheIdentifier,"disable-sorting":_.value,"empty-state-options":V.value,"enable-entity-actions":"","error-message":D.value,fetcher:t.unref(E),"fetcher-cache-key":t.unref(N),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-plugins-list",query:b.value,"table-headers":t.unref(h),title:e.title,"title-tag":e.titleTag,onClearSearchInput:S,"onClick:row":ae[4]||(ae[4]=de=>M(de)),onSort:v,onState:t.unref(d)},t.createSlots({"toolbar-filter":t.withCtx(()=>[t.createVNode(t.unref(he.EntityFilter),{modelValue:b.value,"onUpdate:modelValue":ae[0]||(ae[0]=de=>b.value=de),config:x.value},null,8,["modelValue","config"])]),"toolbar-button":t.withCtx(()=>[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!e.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[t.createElementVNode("div",RM,[!u.value&&f.value?(t.openBlock(),t.createBlock(A,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"plugins-learn-more-button",icon:"",onClick:ae[1]||(ae[1]=de=>q.$emit("click:learn-more"))},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.BookIcon),{decorative:""})]),_:1})):t.createCommentVNode("",!0),t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":()=>e.canCreate()},{default:t.withCtx(()=>[t.createVNode(A,{appearance:"primary","data-testid":"toolbar-add-plugin",size:e.useActionOutside?"medium":"large",to:e.config.createRoute},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(a)("plugins.list.toolbar_actions.new_plugin")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:t.withCtx(({row:de})=>[t.createElementVNode("div",DM,[t.createVNode(t.unref(Ro.PluginIcon),{class:"plugin-icon",name:de.name,size:24},null,8,["name"]),t.createElementVNode("div",MM,[de.instance_name?(t.openBlock(),t.createElementBlock("span",LM,t.toDisplayString(de.instance_name),1)):(t.openBlock(),t.createElementBlock("span",FM,t.toDisplayString(t.unref(o).getDisplayName(de.name)),1)),de.instance_name?(t.openBlock(),t.createElementBlock("span",UM,t.toDisplayString(t.unref(o).getDisplayName(de.name)),1)):t.createCommentVNode("",!0)])])]),appliedTo:t.withCtx(({row:de})=>[L(de).length>0?(t.openBlock(),t.createBlock(oe,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(L(de),Ne=>(t.openBlock(),t.createBlock(t.unref(he.PermissionsWrapper),{key:Ne.badgeText,"auth-function":()=>k(Ne.type,de),"force-show":""},{default:t.withCtx(({isAllowed:Te})=>[t.createVNode($,{class:t.normalizeClass(Te||"disabled"),onClick:t.withModifiers(me=>Te&&Ne.type&&J(Ne.type,de),["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(Ne.badgeText),1)]),_:2},1032,["class","onClick"])]),_:2},1032,["auth-function"]))),128))]),_:2},1024)):(t.openBlock(),t.createElementBlock("span",KM,"-"))]),enabled:t.withCtx(({row:de})=>[t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":async()=>!!(await e.canEdit(de)&&await e.canToggle(de)),"force-show":""},{default:t.withCtx(({isAllowed:Ne})=>{var Te,me;return[t.createElementVNode("div",{onClick:ae[3]||(ae[3]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(ne,{disabled:!Ne,"disabled-tooltip-text":!Ne&&((me=(Te=e.config).getToggleDisabledTooltip)==null?void 0:me.call(Te,de))||void 0,"model-value":de.enabled,onClick:t.withModifiers(ge=>Ne&&te(de),["stop","prevent"])},null,8,["disabled","disabled-tooltip-text","model-value","onClick"])])]}),_:2},1032,["auth-function"])]),ordering:t.withCtx(({rowValue:de})=>[t.createVNode($,{appearance:t.unref(Jc)(de)?"info":"warning"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(Jc)(de)?t.unref(a)("plugins.list.table_headers.ordering_badge.static"):t.unref(a)("plugins.list.table_headers.ordering_badge.dynamic")),1)]),_:2},1032,["appearance"])]),tags:t.withCtx(({rowValue:de})=>[t.createVNode(t.unref(he.TableTags),{tags:de},null,8,["tags"])]),actions:t.withCtx(({row:de})=>[t.createVNode(ke,null,{default:t.withCtx(({copyToClipboard:Ne})=>[t.createVNode(_e,{"data-testid":"action-entity-copy-id",onClick:Te=>P(de,Ne)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(ke,null,{default:t.withCtx(({copyToClipboard:Ne})=>[t.createVNode(_e,{"data-testid":"action-entity-copy-json",onClick:Te=>T(de,Ne)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":()=>e.canRetrieve(de)},{default:t.withCtx(()=>[t.createVNode(_e,{"data-testid":"action-entity-view","has-divider":"",item:Y(de)},null,8,["item"])]),_:2},1032,["auth-function"]),t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":()=>e.canEdit(de)},{default:t.withCtx(()=>[t.createVNode(_e,{"data-testid":"action-entity-edit",item:z(de)},null,8,["item"])]),_:2},1032,["auth-function"]),!p.value&&!m.value&&t.unref(y)?(t.openBlock(),t.createBlock(t.unref(he.PermissionsWrapper),{key:0,"auth-function":()=>e.canConfigureDynamicOrdering(de)},{default:t.withCtx(()=>[H(de)?(t.openBlock(),t.createBlock(_e,{key:0,"data-testid":"action-entity-config-dyn-order",item:H(de)},null,8,["item"])):t.createCommentVNode("",!0)]),_:2},1032,["auth-function"])):t.createCommentVNode("",!0),t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":()=>e.canDelete(de)},{default:t.withCtx(()=>[t.createVNode(_e,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:Ne=>le(de)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!b.value&&e.config.app==="konnect"?{name:"empty-state",fn:t.withCtx(()=>{var de;return[t.createVNode(U,{"data-testid":e.config.entityId?"nested-plugins-entity-empty-state":"plugins-entity-empty-state","icon-background":"",message:t.unref(a)("plugins.list.empty_state_v2.description"),title:t.unref(a)("plugins.list.empty_state_v2.title")},t.createSlots({icon:t.withCtx(()=>[t.createVNode(t.unref(Se.PlugIcon),{decorative:""})]),action:t.withCtx(()=>[F.value?(t.openBlock(),t.createBlock(A,{key:0,"data-testid":"entity-create-button",onClick:B},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon),{decorative:""}),t.createTextVNode(" "+t.toDisplayString(t.unref(a)("plugins.list.empty_state_v2.create_cta")),1)]),_:1})):t.createCommentVNode("",!0),t.createVNode(A,{appearance:"secondary","data-testid":"entity-learn-more-button",onClick:ae[2]||(ae[2]=Ne=>q.$emit("click:learn-more"))},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.BookIcon),{decorative:""}),t.createTextVNode(" "+t.toDisplayString(t.unref(a)("plugins.list.empty_state_v2.learn_more")),1)]),_:1})]),_:2},[(de=e.config)!=null&&de.isControlPlaneGroup?{name:"default",fn:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("plugins.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["data-testid","message","title"])]}),key:"0"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","title","title-tag","onState"]),t.createVNode(t.unref(he.EntityToggleModal),{action:j.value.action,"entity-id":j.value.id,"entity-name":j.value.name,"entity-type":t.unref(a)("glossary.plugin"),"on-confirm":O,visible:I.value,onCancel:K,onProceed:K},null,8,["action","entity-id","entity-name","entity-type","visible"]),t.createVNode(t.unref(he.EntityDeleteModal),{"action-pending":be.value,description:t.unref(a)("delete.description"),"entity-name":Z.value&&(Z.value.instance_name||Z.value.name||Z.value.id),"entity-type":t.unref(he.EntityTypes).Plugin,error:ee.value,title:t.unref(a)("delete.title"),visible:ie.value,onCancel:ue,onProceed:fe},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-582a936c"]]),GM={class:"plugin-select-card-wrapper"},qM=["data-testid"],zM={class:"plugin-card-header"},HM={class:"plugin-card-title"},YM={key:0,class:"plugin-card-actions"},WM=["data-testid","title"],XM={key:0,class:"plugin-card-text"},ZM={key:0},JM=["title"],Is=ve(t.defineComponent({__name:"PluginSelectCard",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},canDeleteCustomPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},plugin:{type:Object,required:!0},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","custom-plugin-delete"],setup(e,{emit:n}){const o=n,r=e,i=Bo.useRouter(),{i18n:{t:a}}=Fe.useI18n(),l=t.computed(()=>r.config.app==="konnect"?r.config.controlPlaneId:""),s=t.computed(()=>!!(!r.plugin.available||r.plugin.disabledMessage)),c=t.computed(()=>!!(m.value&&!p.value&&r.navigateOnClick&&l.value&&(r.canDeleteCustomPlugin||r.canEditCustomPlugin))),d=()=>{i.push(r.config.getCreateRoute(r.plugin.id))},f=()=>{r.navigateOnClick?d():u()},u=()=>{o("plugin-clicked",r.plugin)},p=t.computed(()=>r.plugin.id==="custom-plugin-create"),m=t.computed(()=>r.config.app==="konnect"&&r.plugin.group===W.PluginGroup.CUSTOM_PLUGINS),y=()=>{r.config.app==="konnect"&&o("custom-plugin-delete")},_=(h,w)=>{const b=r.config;r.config.app==="konnect"&&typeof b.getCustomEditRoute=="function"&&b.getCustomEditRoute&&i.push(b.getCustomEditRoute(h,w))},g=()=>{if(!s.value&&r.config.app==="konnect"){const h=r.config;p.value&&h.createCustomRoute?i.push(h.createCustomRoute):m.value&&d()}};return(h,w)=>{const b=t.resolveComponent("KButton"),x=t.resolveComponent("KDropdownItem"),E=t.resolveComponent("KDropdownMenu"),C=t.resolveComponent("KTooltip");return t.openBlock(),t.createElementBlock("div",GM,[t.createVNode(C,{text:e.plugin.disabledMessage},{default:t.withCtx(()=>[t.createElementVNode("a",{class:t.normalizeClass(["plugin-select-card",{disabled:s.value}]),"data-testid":`${e.plugin.id}-card`,role:"button",onClick:w[1]||(w[1]=N=>s.value||m.value?void 0:f())},[t.createElementVNode("div",zM,[t.createElementVNode("div",HM,[t.createElementVNode("span",{class:t.normalizeClass({"non-custom-title":!m.value})},t.toDisplayString(e.plugin.name),3)]),c.value?(t.openBlock(),t.createElementBlock("div",YM,[t.createVNode(E,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150"},{default:t.withCtx(()=>[t.createVNode(b,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.MoreIcon),{size:t.unref(Ed)},null,8,["size"])]),_:1})]),items:t.withCtx(()=>[e.canDeleteCustomPlugin?(t.openBlock(),t.createBlock(x,{key:0,"data-testid":"edit-plugin-schema",onClick:w[0]||(w[0]=t.withModifiers(N=>_(e.plugin.name,e.plugin.customPluginType),["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.edit")),1)]),_:1})):t.createCommentVNode("",!0),e.canDeleteCustomPlugin?(t.openBlock(),t.createBlock(x,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":"",onClick:t.withModifiers(y,["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.delete")),1)]),_:1})):t.createCommentVNode("",!0)]),_:1})])):t.createCommentVNode("",!0)]),t.createElementVNode("div",{class:t.normalizeClass(["plugin-card-body",{"custom-plugin":m.value}]),"data-testid":e.plugin.name,title:e.plugin.available?e.plugin.name:t.unref(a)("plugins.select.unavailable_tooltip"),onClick:g},[t.createVNode(t.unref(Ro.PluginIcon),{alt:e.plugin.name,class:"plugin-card-icon",name:e.plugin.id,size:55},null,8,["alt","name"]),e.plugin.description||m.value&&!p.value?(t.openBlock(),t.createElementBlock("div",XM,[m.value&&!p.value?(t.openBlock(),t.createElementBlock("p",ZM,t.toDisplayString(t.unref(a)("plugins.select.custom_badge_text")),1)):t.createCommentVNode("",!0),e.plugin.description?(t.openBlock(),t.createElementBlock("p",{key:1,class:"plugin-card-text",title:e.plugin.description},t.toDisplayString(e.plugin.description),9,JM)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],10,WM),t.createElementVNode("div",{class:"plugin-card-footer",onClick:g},t.toDisplayString(p.value?t.unref(a)("actions.create_custom"):e.plugin.exists?t.unref(a)("actions.enabled"):t.unref(a)("actions.enable")),1)],10,qM)]),_:1},8,["text"])])}}}),[["__scopeId","data-v-65d53934"]]),QM=ve(t.defineComponent({__name:"DeleteCustomPluginSchemaModal",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app))},plugin:{type:Object,required:!0}},emits:["closed","proceed"],setup(e,{emit:n}){var y;const o=e,r=n,{i18nT:i,i18n:{t:a}}=Fe.useI18n(),{getMessageFromError:l}=he.useErrors(),{axiosInstance:s}=he.useAxios((y=o.config)==null?void 0:y.axiosRequestConfig),c=t.computed(()=>{var _;return u.value?a("delete.plugin_schema_in_use_title"):a("delete.title",{name:((_=o.plugin)==null?void 0:_.name)||a("delete.custom_plugin")})}),d=t.ref(!1),f=t.ref(""),u=t.ref(!1),p=t.computed(()=>{if(o.config.app==="konnect"){const _=o.plugin.customPluginType==="streaming"?Xe.select[o.config.app].streamingCustomPluginItem:Xe.select[o.config.app].schemaCustomPluginItem;let g=`${o.config.apiBaseUrl}${_}`;return g=g.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||""),g=g.replace(/{pluginId}/gi,o.plugin.id),g}return null}),m=async()=>{var _,g,h,w;if(d.value=!0,f.value="",!(!((_=o.plugin)!=null&&_.name)||((g=o.config)==null?void 0:g.app)!=="konnect"))try{p.value&&await s.delete(p.value),r("proceed")}catch(b){const{response:x}=b;(x==null?void 0:x.status)===400&&((w=(h=x.data)==null?void 0:h.message)!=null&&w.includes("plugin schema is currently in use"))?u.value=!0:f.value=l(b)}finally{d.value=!1}};return(_,g)=>{const h=t.resolveComponent("KButton"),w=t.resolveComponent("KModal");return!u.value&&e.plugin?(t.openBlock(),t.createBlock(t.unref(he.EntityDeleteModal),{key:0,"action-pending":d.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",description:t.unref(a)("delete.description_custom"),"entity-name":e.plugin.name,"entity-type":t.unref(he.EntityTypes).Plugin,error:f.value,"need-confirm":"",title:c.value,visible:"",onCancel:g[0]||(g[0]=b=>_.$emit("closed")),onProceed:m},null,8,["action-pending","description","entity-name","entity-type","error","title"])):e.plugin?(t.openBlock(),t.createBlock(w,{key:1,"action-button-disabled":d.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",title:c.value,visible:"",onCancel:g[2]||(g[2]=b=>_.$emit("closed"))},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createVNode(t.unref(i),{keypath:"delete.plugin_schema_in_use_message",tag:"p"},{name:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(e.plugin.name),1)]),_:1})])]),"footer-actions":t.withCtx(()=>[t.createElementVNode("div",null,[t.createVNode(h,{appearance:"tertiary",class:"cancel-button","data-testid":"delete-custom-plugin-form-cancel",onClick:g[1]||(g[1]=b=>_.$emit("closed"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.cancel")),1)]),_:1})])]),_:1},8,["action-button-disabled","title"])):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9e0dee7f"]]),e2={class:"custom-plugins-grid"},t2={class:"empty-state-title"},n2={class:"empty-state-description"},Ts=310,o2=ve(t.defineComponent({__name:"PluginCustomGrid",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},canCreateCustomPlugin:{type:Boolean,default:!1},canDeleteCustomPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","revalidate","delete:success"],setup(e,{emit:n}){const o=e,r=n,{i18n:{t:i}}=Fe.useI18n(),{getTallestPluginCardHeight:a,getToggleVisibility:l}=Fe.usePluginHelpers(),s=t.ref(!0),c=E=>{r("plugin-clicked",E)},d=t.computed(()=>{if(o.config.app==="kongManager")return[];const E=JSON.parse(JSON.stringify(o.pluginList))[W.PluginGroup.CUSTOM_PLUGINS]||[];return o.canCreateCustomPlugin&&o.navigateOnClick&&o.config.createCustomRoute?[{id:"custom-plugin-create",name:i("plugins.select.tabs.custom.create.name"),available:!0,group:W.PluginGroup.CUSTOM_PLUGINS,description:i("plugins.select.tabs.custom.create.description")}].concat(E):E}),f=t.ref(!1),u=t.ref(null),p=E=>{f.value=!0,u.value={id:E.id,name:E.name,customPluginType:E.customPluginType}},m=E=>{var C;E&&(r("revalidate"),r("delete:success",((C=u.value)==null?void 0:C.name)||"")),f.value=!1,u.value=null},y=t.ref(Ts),_=t.ref(null),g=t.ref(null),h=t.computed(()=>s.value?{overflowY:"hidden",maxHeight:`${y.value}px`}:{}),w=t.ref(!1),b=()=>{y.value=Math.max(a(g.value),Ts),x()},x=()=>{var E,C;(E=g.value)!=null&&E.length&&(w.value=l(_.value,(C=g.value)==null?void 0:C.length))};return t.onMounted(async()=>{await t.nextTick(),y.value=Math.max(a(g.value),Ts),x(),window==null||window.addEventListener("resize",b)}),t.onUnmounted(()=>{window==null||window.removeEventListener("resize",b)}),(E,C)=>{const N=t.resolveComponent("KEmptyState"),S=t.resolveComponent("KCollapse");return t.openBlock(),t.createElementBlock("div",e2,[d.value.length?(t.openBlock(),t.createBlock(S,{key:1,modelValue:s.value,"onUpdate:modelValue":C[0]||(C[0]=v=>s.value=v),class:"custom-plugins-collapse","data-testid":`${t.unref(W.PluginGroup).CUSTOM_PLUGINS}-collapse`,title:t.unref(W.PluginGroup).CUSTOM_PLUGINS,"trigger-label":s.value?t.unref(i)("plugins.select.view_more"):t.unref(i)("plugins.select.view_less")},t.createSlots({"visible-content":t.withCtx(()=>[t.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:_,class:"plugin-card-container",style:t.normalizeStyle(h.value)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(v,D)=>(t.openBlock(),t.createBlock(Is,{key:`plugin-card-${D}`,ref_for:!0,ref_key:"pluginCardRef",ref:g,"can-delete-custom-plugin":e.canDeleteCustomPlugin,"can-edit-custom-plugin":e.canEditCustomPlugin,config:e.config,"navigate-on-click":e.navigateOnClick,plugin:v,onCustomPluginDelete:L=>p(v),onPluginClicked:c},null,8,["can-delete-custom-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete"]))),128))],4)]),_:2},[w.value?void 0:{name:"trigger",fn:t.withCtx(()=>[C[2]||(C[2]=t.createTextVNode(" ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"])):(t.openBlock(),t.createBlock(N,{key:0,"action-button-visible":!1,class:"custom-plugins-empty-state","icon-variant":"kong"},{title:t.withCtx(()=>[t.createElementVNode("span",t2,t.toDisplayString(t.unref(i)("plugins.select.tabs.custom.empty_title")),1)]),default:t.withCtx(()=>[t.createElementVNode("span",n2,t.toDisplayString(t.unref(i)("plugins.select.tabs.custom.empty_description")),1)]),_:1})),f.value&&u.value?(t.openBlock(),t.createBlock(QM,{key:2,config:e.config,plugin:u.value,onClosed:m,onProceed:C[1]||(C[1]=v=>m(!0))},null,8,["config","plugin"])):t.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-f4b90f47"]]),Ps=310,pg=ve(t.defineComponent({__name:"PluginSelectGroup",props:t.mergeModels({config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},name:{type:String,required:!0},plugins:{type:Array,required:!0},navigateOnClick:{type:Boolean,default:!0}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:t.mergeModels(["plugin-clicked"],["update:modelValue"]),setup(e,{emit:n}){const o=t.useModel(e,"modelValue"),r=e,i=n,{i18n:{t:a}}=Fe.useI18n(),{getTallestPluginCardHeight:l,getToggleVisibility:s}=Fe.usePluginHelpers(),c=t.ref(Ps),d=t.ref(null),f=t.ref(null),u=t.computed(()=>o.value?{overflowY:"hidden",maxHeight:`${c.value}px`}:{}),p=t.ref(!1),m=()=>{c.value=Math.max(l(f.value),Ps),y()},y=()=>{var _,g;(_=f.value)!=null&&_.length&&(p.value=s(d.value,(g=f.value)==null?void 0:g.length))};return t.onMounted(async()=>{await t.nextTick(),c.value=Math.max(l(f.value),Ps),y(),window==null||window.addEventListener("resize",m)}),t.onUnmounted(()=>{window==null||window.removeEventListener("resize",m)}),(_,g)=>{const h=t.resolveComponent("KCollapse");return t.openBlock(),t.createBlock(h,{modelValue:o.value,"onUpdate:modelValue":g[0]||(g[0]=w=>o.value=w),class:"plugins-collapse","data-testid":`${r.name}-collapse`,title:r.name,"trigger-label":o.value?t.unref(a)("plugins.select.view_more"):t.unref(a)("plugins.select.view_less")},t.createSlots({"visible-content":t.withCtx(()=>[t.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:d,class:"plugin-card-container",style:t.normalizeStyle(u.value)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.plugins,w=>(t.openBlock(),t.createBlock(Is,{key:`plugin-card-${w.id}`,ref_for:!0,ref_key:"pluginCardRef",ref:f,config:e.config,"navigate-on-click":e.navigateOnClick,plugin:w,onPluginClicked:b=>i("plugin-clicked",w)},null,8,["config","navigate-on-click","plugin","onPluginClicked"]))),128))],4)]),_:2},[p.value?void 0:{name:"trigger",fn:t.withCtx(()=>[g[1]||(g[1]=t.createTextVNode(" ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"])}}}),[["__scopeId","data-v-a1074120"]]),r2={class:"plugin-select-grid"},i2={class:"empty-state-title"},a2={class:"empty-state-description"},Os=t.defineComponent({__name:"PluginSelectGrid",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0},highlightedPlugins:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""},hideHighlightedPlugins:{type:Boolean,default:!1}},emits:["plugin-clicked"],setup(e,{emit:n}){const o=e,r=n,{i18n:{t:i}}=Fe.useI18n(),a=t.ref(!1),l=t.ref(Ds),s=d=>{r("plugin-clicked",d)},c=t.computed(()=>{const d=JSON.parse(JSON.stringify(o.pluginList));return o.config.app==="konnect"&&delete d[W.PluginGroup.CUSTOM_PLUGINS],d});return(d,f)=>{const u=t.resolveComponent("KEmptyState");return t.openBlock(),t.createElementBlock("div",r2,[Object.keys(c.value).length?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(u,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:t.withCtx(()=>[t.createElementVNode("span",i2,t.toDisplayString(t.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:t.withCtx(()=>[t.createElementVNode("span",a2,t.toDisplayString(t.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),!o.hideHighlightedPlugins&&o.highlightedPlugins.length>0?(t.openBlock(),t.createBlock(pg,{key:1,modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=p=>a.value=p),config:e.config,name:o.highlightedPluginsTitle||t.unref(i)("plugins.select.highlighted_plugins.title"),"navigate-on-click":e.navigateOnClick,plugins:o.highlightedPlugins,onPluginClicked:f[1]||(f[1]=p=>s(p))},null,8,["modelValue","config","name","navigate-on-click","plugins"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Rs),p=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[c.value[p]?(t.openBlock(),t.createElementBlock("div",{key:p},[t.createVNode(pg,{modelValue:l.value[p],"onUpdate:modelValue":m=>l.value[p]=m,config:e.config,name:p,"navigate-on-click":e.navigateOnClick,plugins:c.value[p]||[],onPluginClicked:f[2]||(f[2]=m=>s(m))},null,8,["modelValue","onUpdate:modelValue","config","name","navigate-on-click","plugins"])])):t.createCommentVNode("",!0)],64))),256))])}}}),l2={class:"kong-ui-entities-plugin-select-form"},s2={class:"plugins-filter-input-container"},c2={key:0},d2={key:3,"aria-live":"polite",class:"plugins-results-container"},u2={"data-testid":"kong-tab"},f2={class:"tab-description"},p2={"data-testid":"custom-tab"},m2={class:"tab-description"},g2=ve(t.defineComponent({__name:"PluginSelect",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},customPluginSupport:{type:String,default:"none"},canCreateCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteCustomPlugin:{type:Function,required:!1,default:async()=>!0},canEditCustomPlugin:{type:Function,required:!1,default:async()=>!0},navigateOnClick:{type:Boolean,default:!0},availableOnServer:{type:Boolean,default:!0},ignoredPlugins:{type:Array,default:()=>[]},disabledPlugins:{type:Object,default:()=>({})},highlightedPluginIds:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""}},emits:["loading","plugin-clicked","delete-custom:success"],setup(e,{emit:n}){var P;const o=e,r=n,i=Bo.useRoute(),a=Bo.useRouter(),{i18n:{t:l}}=Fe.useI18n(),{pluginMetaData:s}=Fe.usePluginMetaData(),{getMessageFromError:c}=he.useErrors(),{sortAlpha:d,objectsAreEqual:f}=he.useHelpers(),u=t.ref(""),p=t.ref(!0),m=t.ref(!1),y=t.ref(""),_=t.ref([]),g=t.ref([]),h=t.ref({}),w=t.ref([]),{axiosInstance:b}=he.useAxios((P=o.config)==null?void 0:P.axiosRequestConfig),x=t.computed(()=>h.value?Object.entries(h.value).filter(([T])=>T!==W.PluginGroup.CUSTOM_PLUGINS).reduce((T,[,M])=>{for(const Y of M)T[Y.id]=Y;return T},{}):{}),E=t.computed(()=>{var Y;if(!h.value)return{};const T=u.value.toLowerCase(),M=JSON.parse(JSON.stringify(h.value));for(const z in h.value){const H=((Y=h.value[z])==null?void 0:Y.filter(Z=>Z.name.toLowerCase().includes(T)||Z.id.toLowerCase().includes(T)||Z.group.toLowerCase().includes(T)))||[];H.length?M[z]=H:delete M[z]}return M}),C=t.computed(()=>o.highlightedPluginIds.reduce((T,M)=>{const Y=x.value[M];return Y&&T.push(Y),T},[])),N=t.computed(()=>Object.keys(E.value).length>0),S=t.computed(()=>Object.keys(h.value).length>0&&!N.value),v=t.computed(()=>o.config.app==="konnect"?[{hash:"#kong",title:l("plugins.select.tabs.kong.title")},{hash:"#custom",title:l("plugins.select.tabs.custom.title"),disabled:["none","disabled"].includes(o.customPluginSupport)}]:[]),D=t.computed(()=>{var M;let T=v.value.length&&((i==null?void 0:i.hash)||((M=v.value[0])==null?void 0:M.hash))||"";return T==="#custom"&&["none","disabled"].includes(o.customPluginSupport)&&(T="#kong"),T}),L=()=>[...new Set([...Object.keys({...o.availableOnServer?{}:s}),..._.value])].filter(T=>!o.ignoredPlugins.includes(T)).filter(T=>o.config.entityType&&(o.config.entityType==="services"&&s[T]&&!s[T].scope.includes(W.PluginScope.SERVICE)||o.config.entityType==="routes"&&s[T]&&!s[T].scope.includes(W.PluginScope.ROUTE)||o.config.entityType==="consumer_groups"&&s[T]&&!s[T].scope.includes(W.PluginScope.CONSUMER_GROUP)||o.config.entityType==="consumers"&&s[T]&&!s[T].scope.includes(W.PluginScope.CONSUMER))?!1:T).reduce((T,M)=>{var ie;const Y=s[M]&&s[M].name||M,z={...s[M],id:M,name:Y,available:_.value.includes(M),disabledMessage:"",group:((ie=s[M])==null?void 0:ie.group)||W.PluginGroup.CUSTOM_PLUGINS};z.group===W.PluginGroup.CUSTOM_PLUGINS&&(z.customPluginType=g.value.find(be=>be.name===M)?"streaming":"schema"),o.disabledPlugins&&(z.disabledMessage=o.disabledPlugins[M]);const H=z.group||l("plugins.select.misc_plugins");let Z=T[H];return Z||(Z=[]),Z.push(z),Z.sort(d("name")),T[H]=Z,T},{}),k=t.computed(()=>{var M;let T=`${o.config.apiBaseUrl}${Xe.select[o.config.app].availablePlugins}`;return o.config.app==="konnect"?T=T.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||""):o.config.app==="kongManager"&&(T=((M=o.config.gatewayInfo)==null?void 0:M.edition)==="community"?`${o.config.apiBaseUrl}${Xe.select[o.config.app].availablePluginsForOss}`:T.replace(/\/{workspace}/gi,o.config.workspace?`/${o.config.workspace}`:"")),T}),J=t.computed(()=>{if(o.config.app==="konnect"&&o.customPluginSupport==="streaming"){let T=`${o.config.apiBaseUrl}${Xe.select[o.config.app].streamingCustomPlugins}`;return T=T.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||""),T}return null}),I=t.computed(()=>{if(o.config.entityType&&o.config.entityId){let T=`${o.config.apiBaseUrl}${Xe.list[o.config.app].forEntity}`;return o.config.app==="konnect"?T=T.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||""):o.config.app==="kongManager"&&(T=T.replace(/\/{workspace}/gi,o.config.workspace?`/${o.config.workspace}`:"")),T.replace(/{entityType}/gi,o.config.entityType||"").replace(/{entityId}/gi,o.config.entityId||"")}return""}),G=T=>{a.replace({hash:T,query:i.query})};t.watch(()=>o.disabledPlugins,(T,M)=>{!f(T,M)&&!p.value&&(h.value=L())}),t.watch(()=>o.ignoredPlugins,(T,M)=>{!f(T,M)&&!p.value&&(h.value=L())}),t.watch(p,T=>{r("loading",T)});const j=t.ref(!1),te=t.ref(!1),K=t.ref(!1);t.onBeforeMount(async()=>{j.value=await o.canCreateCustomPlugin(),te.value=await o.canEditCustomPlugin(),K.value=await o.canDeleteCustomPlugin()});const O=t.useTemplateRef("filter-input");return t.onMounted(async()=>{var T,M;(M=(T=O.value)==null?void 0:T.input)==null||M.focus();try{const{data:Y}=await b.get(k.value);if(o.config.app==="konnect"){const{names:z}=Y;if(_.value=z||[],J.value){const{data:H}=await b.get(J.value);g.value=H.data||[]}}else if(o.config.app==="kongManager"){const{plugins:{available_on_server:z}}=Y;_.value=z?Object.keys(z):[]}}catch(Y){m.value=!0,y.value=c(Y)}if(I.value)try{const{data:{data:Y}}=await b.get(I.value);if(Y!=null&&Y.length){const z=Y.reduce((H,Z)=>(Z.name&&H.push(Z.name),H),[]);w.value=w.value.concat(z)}}catch{}m.value||(h.value=L()),p.value=!1}),(T,M)=>{const Y=t.resolveComponent("KInput"),z=t.resolveComponent("KSkeletonBox"),H=t.resolveComponent("KSkeleton"),Z=t.resolveComponent("KEmptyState"),ie=t.resolveComponent("KTooltip"),be=t.resolveComponent("KTabs");return t.openBlock(),t.createElementBlock("div",l2,[t.createElementVNode("div",s2,[t.createVNode(Y,{ref:"filter-input",modelValue:u.value,"onUpdate:modelValue":M[0]||(M[0]=ee=>u.value=ee),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter",placeholder:t.unref(l)("search.placeholder.select"),type:"search"},null,8,["modelValue","placeholder"])]),p.value?(t.openBlock(),t.createElementBlock("section",c2,[t.createVNode(z,{class:"plugins-skeleton-title",width:"10"}),t.createVNode(H,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):m.value?(t.openBlock(),t.createBlock(Z,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:t.withCtx(()=>[t.createElementVNode("h3",null,t.toDisplayString(y.value),1)]),_:1})):S.value&&u.value?(t.openBlock(),t.createBlock(Z,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:t.withCtx(()=>[t.createElementVNode("h5",null,t.toDisplayString(t.unref(l)("search.no_results",{filter:u.value})),1)]),_:1})):(t.openBlock(),t.createElementBlock("section",d2,[v.value.length&&e.customPluginSupport!=="none"?(t.openBlock(),t.createBlock(be,{key:0,modelValue:D.value,"onUpdate:modelValue":M[5]||(M[5]=ee=>D.value=ee),"data-testid":"plugins-tabs",tabs:v.value,onChange:G},t.createSlots({kong:t.withCtx(()=>[t.createElementVNode("div",u2,[t.createElementVNode("p",f2,t.toDisplayString(t.unref(l)("plugins.select.tabs.kong.description")),1),t.createVNode(Os,{config:e.config,"hide-highlighted-plugins":u.value.length>0,"highlighted-plugins":C.value,"highlighted-plugins-title":o.highlightedPluginsTitle,"navigate-on-click":e.navigateOnClick,"plugin-list":E.value,onPluginClicked:M[1]||(M[1]=ee=>T.$emit("plugin-clicked",ee))},null,8,["config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])])]),custom:t.withCtx(()=>[t.createElementVNode("div",p2,[t.renderSlot(T.$slots,"before-custom-tab-content",{},void 0,!0),t.createElementVNode("p",m2,t.toDisplayString(t.unref(l)("plugins.select.tabs.custom.description")),1),t.createVNode(o2,{"can-create-custom-plugin":j.value,"can-delete-custom-plugin":K.value,"can-edit-custom-plugin":te.value,config:e.config,"navigate-on-click":e.navigateOnClick,"plugin-list":E.value,"onDelete:success":M[2]||(M[2]=ee=>T.$emit("delete-custom:success",ee)),onPluginClicked:M[3]||(M[3]=ee=>T.$emit("plugin-clicked",ee)),onRevalidate:M[4]||(M[4]=()=>h.value=L())},null,8,["can-create-custom-plugin","can-delete-custom-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin-list"])])]),_:2},[e.customPluginSupport==="disabled"?{name:"custom-anchor",fn:t.withCtx(()=>[t.createVNode(ie,{"max-width":"300",text:t.unref(l)("plugins.select.tabs.custom.disabled_tooltip")},{default:t.withCtx(()=>[t.createElementVNode("div",null,t.toDisplayString(t.unref(l)("plugins.select.tabs.custom.title")),1)]),_:1},8,["text"])]),key:"0"}:void 0]),1032,["modelValue","tabs"])):(t.openBlock(),t.createBlock(Os,{key:1,config:e.config,"hide-highlighted-plugins":u.value.length>0,"highlighted-plugins":C.value,"highlighted-plugins-title":o.highlightedPluginsTitle,"navigate-on-click":e.navigateOnClick,"plugin-list":E.value,onPluginClicked:M[6]||(M[6]=ee=>T.$emit("plugin-clicked",ee))},null,8,["config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"]))]))])}}}),[["__scopeId","data-v-7b1adaaa"]]),h2={class:"datakit-config-card-canvas"},y2={class:"config-card-details-label","data-testid":"datakit-configuration-label"},_2={class:"config-card-details-value datakit-canvas-container","data-testid":"datakit-configuration-canvas"},b2={class:"canvas-wrapper"},w2=ve(t.defineComponent({__name:"DatakitConfigCardCanvas",props:{pluginData:{}},setup(e){return Yu(e.pluginData),(n,o)=>{const r=t.resolveComponent("KLabel");return t.openBlock(),t.createElementBlock("div",h2,[t.createElementVNode("div",y2,[t.createVNode(r,null,{default:t.withCtx(()=>o[0]||(o[0]=[t.createElementVNode("span",{class:"label-content"}," Nodes ",-1)])),_:1,__:[0]})]),t.createElementVNode("div",_2,[t.createElementVNode("div",b2,[t.createVNode(Ns,{class:"datakit-flow-panels",mode:"view",resizable:""})])])])}}}),[["__scopeId","data-v-591ec060"]]),k2={class:"kong-ui-entity-plugin-config-card"},C2={class:"name-cell-wrapper"},E2={class:"info-name"},N2={key:0},S2={key:0},x2={key:0},v2={key:0},A2={key:0},$s="config",I2=ve(t.defineComponent({__name:"PluginConfigCard",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||e.app==="konnect"&&!e.controlPlaneId||e.app==="kongManager"&&typeof e.workspace!="string"||!e.entityId||!e.pluginType)},configCardDoc:{type:String,default:"",required:!1},showIdAsLink:{type:Boolean,default:!1},hideTitle:{type:Boolean,default:!1},scopedEntityType:{type:String,required:!1,default:""},scopedEntityId:{type:String,required:!1,default:""},expandPartial:{type:Boolean,default:!0}},emits:["loading","fetch:error","error:fetch-schema","fetch:success","navigation-click"],setup(e,{emit:n}){var C;const o=n,r=e,{i18n:{t:i}}=Fe.useI18n(),a=Fe.usePluginMetaData(),{setFieldType:l}=Fe.usePluginHelpers(),{getPropValue:s}=he.useHelpers(),c=t.computed(()=>r.config.app==="konnect"),d=t.computed(()=>c.value&&r.config.pluginType==="datakit"),f=t.computed(()=>{var S;let N=(S=Xe.item[r.config.app])==null?void 0:S[r.scopedEntityType?"forEntity":"all"].replace(/{entityType}/gi,r.scopedEntityType).replace(/{entityId}/gi,r.scopedEntityId).concat(r.expandPartial?"?expand_partials=true":"");if(c.value){const v=r.expandPartial?"&":"?";N=N.concat(`${v}__ui_data=true`)}return N}),u=t.computed(()=>{var v,D;const N={},S=((v=b.value)==null?void 0:v.fields)||[];for(let L=0;L<S.length;L++){const k=b.value.fields[L],J=(D=Object.keys(k))==null?void 0:D[0];l(N,J,k[J])}return{...N,instance_name:{section:he.ConfigurationSchemaSection.Basic,order:1.5},consumer:{label:i("plugins.fields.consumer"),section:he.ConfigurationSchemaSection.Basic,order:6},route:{label:i("plugins.fields.route"),section:he.ConfigurationSchemaSection.Basic,order:6},service:{label:i("plugins.fields.service"),section:he.ConfigurationSchemaSection.Basic,order:6},consumer_group:{label:i("plugins.fields.consumer_group"),section:he.ConfigurationSchemaSection.Basic,order:6},protocols:{type:he.ConfigurationSchemaType.BadgeTag,section:he.ConfigurationSchemaSection.Basic,order:7}}}),p=t.computed(()=>{var S,v,D;if(!((S=b.value)!=null&&S.fields))return[];const N=(v=b.value.fields)==null?void 0:v.find(L=>{var J;return((J=Object.keys(L))==null?void 0:J[0])===$s});return((D=N==null?void 0:N[$s])==null?void 0:D.fields)||[]}),m=t.computed(()=>{var S,v;const N={};if(!p.value)return N;for(let D=0;D<((S=p.value)==null?void 0:S.length);D++){const L=p.value[D],k=(v=Object.keys(L))==null?void 0:v[0],J=L[k];J.required&&(N[k]={order:1}),l(N,k,J)}return N}),y=N=>{var v;const S=(v=a.pluginMetaData[r.config.pluginType])==null?void 0:v.scope;return S?Object.fromEntries(Object.entries(N).filter(([D,L])=>L?!0:!(D==="service"&&!S.includes(W.PluginScope.SERVICE)||D==="route"&&!S.includes(W.PluginScope.ROUTE)||D==="consumer"&&!S.includes(W.PluginScope.CONSUMER)||D==="consumer_group"&&!S.includes(W.PluginScope.CONSUMER_GROUP)))):N},_=N=>zo(N,"__ui_data"),{getMessageFromError:g}=he.useErrors(),{axiosInstance:h}=he.useAxios((C=r.config)==null?void 0:C.axiosRequestConfig),w=t.computed(()=>{var S,v;let N=`${r.config.apiBaseUrl}${Xe.form[r.config.app].pluginSchema}`;return r.config.app==="konnect"?N=N.replace(/{controlPlaneId}/gi,((S=r.config)==null?void 0:S.controlPlaneId)||""):r.config.app==="kongManager"&&(N=N.replace(/\/{workspace}/gi,(v=r.config)!=null&&v.workspace?`/${r.config.workspace}`:"")),N=N.replace(/{plugin}/gi,r.config.pluginType),N}),b=t.ref({});he.useSchemaProvider(b);const x=t.ref(!1),E=t.ref("");return t.onBeforeMount(async()=>{x.value=!0;try{const{data:N}=await h.get(w.value);b.value=N}catch(N){E.value=g(N),o("error:fetch-schema",N)}finally{x.value=!1}}),(N,S)=>{const v=t.resolveComponent("KSkeleton"),D=t.resolveComponent("KEmptyState"),L=t.resolveComponent("KCopy");return t.openBlock(),t.createElementBlock("div",k2,[x.value?(t.openBlock(),t.createBlock(v,{key:0,"data-testid":"plugin-config-card-loader","table-columns":2,type:"table"})):E.value?(t.openBlock(),t.createBlock(D,{key:1,"data-testid":"plugin-config-card-schema-error","icon-variant":"error"},{default:t.withCtx(()=>[t.createElementVNode("h3",null,t.toDisplayString(E.value),1)]),_:1})):(t.openBlock(),t.createBlock(t.unref(he.EntityBaseConfigCard),{key:2,"code-block-record-formatter":_,config:e.config,"config-card-doc":e.configCardDoc,"config-schema":u.value,"entity-type":t.unref(he.SupportedEntityType).Plugin,"fetch-url":f.value,"hide-title":e.hideTitle,"plugin-config-key":$s,"plugin-config-schema":m.value,"record-resolver":y,"onFetch:error":S[0]||(S[0]=k=>N.$emit("fetch:error",k)),"onFetch:success":S[1]||(S[1]=k=>N.$emit("fetch:success",k)),onLoading:S[2]||(S[2]=k=>N.$emit("loading",k))},t.createSlots({name:t.withCtx(k=>[t.createElementVNode("div",C2,[t.createVNode(t.unref(Ro.PluginIcon),{class:"plugin-icon",name:t.unref(s)("rowValue",k),size:24},null,8,["name"]),t.createElementVNode("span",E2,t.toDisplayString(t.unref(a).getDisplayName(t.unref(s)("rowValue",k))),1)])]),consumer:t.withCtx(k=>[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:t.unref(s)("rowValue",k).id,value:t.unref(s)("rowValue",k).id,type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>N.$emit("navigation-click",t.unref(s)("rowValue",k).id,"consumer")},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"consumer-copy-uuid",text:t.unref(s)("rowValue",k).id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",N2,"–"))]),route:t.withCtx(k=>[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:t.unref(s)("rowValue",k).id,value:t.unref(s)("rowValue",k).id,type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>N.$emit("navigation-click",t.unref(s)("rowValue",k).id,"route")},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"route-copy-uuid",text:t.unref(s)("rowValue",k).id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",S2,"–"))]),service:t.withCtx(k=>[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:t.unref(s)("rowValue",k).id,value:t.unref(s)("rowValue",k).id,type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>N.$emit("navigation-click",t.unref(s)("rowValue",k).id,"service")},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"service-copy-uuid",text:t.unref(s)("rowValue",k).id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",x2,"–"))]),consumer_group:t.withCtx(k=>[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:t.unref(s)("rowValue",k).id,value:t.unref(s)("rowValue",k).id,type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>N.$emit("navigation-click",t.unref(s)("rowValue",k).id,"consumer_group")},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"consumer-group-copy-uuid",text:t.unref(s)("rowValue",k).id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",v2,"–"))]),partials:t.withCtx(k=>{var J,I,G,j,te,K,O,P,T;return[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:(I=(J=t.unref(s)("rowValue",k))==null?void 0:J[0])==null?void 0:I.id,value:((j=(G=t.unref(s)("rowValue",k))==null?void 0:G[0])==null?void 0:j.id)+((K=(te=t.unref(s)("rowValue",k))==null?void 0:te[0])!=null&&K.name?"/"+((P=(O=t.unref(s)("rowValue",k))==null?void 0:O[0])==null?void 0:P.name):""),type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>{var M,Y;return N.$emit("navigation-click",(Y=(M=t.unref(s)("rowValue",k))==null?void 0:M[0])==null?void 0:Y.id,"partial")}},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"partial-copy-uuid",text:(T=t.unref(s)("rowValue",k))==null?void 0:T[0].id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",A2,"–"))]}),_:2},[d.value?{name:"config-card-item-nodes",fn:t.withCtx(k=>[t.createVNode(w2,{"plugin-data":k.record},null,8,["plugin-data"])]),key:"0"}:void 0]),1032,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title","plugin-config-schema"]))])}}}),[["__scopeId","data-v-a5302acb"]]),{usePluginMetaData:T2,useProvideExperimentalFreeForms:P2}=Fe;Object.defineProperty(Ae,"PluginGroup",{enumerable:!0,get:()=>W.PluginGroup}),Object.defineProperty(Ae,"PluginScope",{enumerable:!0,get:()=>W.PluginScope}),Object.defineProperty(Ae,"PluginIcon",{enumerable:!0,get:()=>Ro.PluginIcon}),Object.defineProperty(Ae,"getPluginIconURL",{enumerable:!0,get:()=>Ro.getPluginIconURL}),Ae.EXPERIMENTAL_FREE_FORM_PROVIDER=Ra,Ae.EntityTypeIdField=An,Ae.FEATURE_FLAGS=so,Ae.PLUGIN_GROUPS_COLLAPSE_STATUS=Ds,Ae.PluginConfigCard=I2,Ae.PluginForm=BM,Ae.PluginGroupArray=Rs,Ae.PluginList=jM,Ae.PluginPartialType=Pr,Ae.PluginSelect=g2,Ae.PluginSelectCard=Is,Ae.PluginSelectGrid=Os,Ae.TOASTER_PROVIDER=nd,Ae.pluginEndpoints=Xe,Ae.usePluginMetaData=T2,Ae.useProvideExperimentalFreeForms=P2,Object.defineProperty(Ae,Symbol.toStringTag,{value:"Module"})});
|
|
144
|
+
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class lt extends Error{constructor(n,...o){var r;super((r=mp[n])==null?void 0:r.call(mp,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Zl(e){return"clientX"in e}function DA(e){return"sourceEvent"in e}function Zt(e,n){const o=Zl(e);let r,i;return o?(r=e.clientX,i=e.clientY):"touches"in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-((n==null?void 0:n.left)??0),y:i-((n==null?void 0:n.top)??0)}}const Vi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function MA(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function Ri(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const LA=()=>!0;function Jl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function FA(e,n,o){const r=[],i={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const a of n.values())Oi(i,Pi(a))>0&&r.push(a);return r}const UA=250;function KA(e,n,o,r){var i,a;let l=[],s=Number.POSITIVE_INFINITY;const c=FA(e,o,n+UA);for(const d of c){const f=[...((i=d.handleBounds)==null?void 0:i.source)??[],...((a=d.handleBounds)==null?void 0:a.target)??[]];for(const u of f){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:p,y:m}=Io(d,u,u.position,!0),y=Math.sqrt((p-e.x)**2+(m-e.y)**2);y>n||(y<s?(l=[{...u,x:p,y:m}],s=y):y===s&&l.push({...u,x:p,y:m}))}}if(!l.length)return null;if(l.length>1){const d=r.type==="source"?"target":"source";return l.find(f=>f.type===d)??l[0]}return l[0]}function gp(e,{handle:n,connectionMode:o,fromNodeId:r,fromHandleId:i,fromType:a,doc:l,lib:s,flowId:c,isValidConnection:d=LA},f,u,p){const m=a==="target",y=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:_,y:g}=Zt(e),h=l.elementFromPoint(_,g),w=h!=null&&h.classList.contains(`${s}-flow__handle`)?h:y,b={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const x=hp(void 0,w),E=w.getAttribute("data-nodeid"),C=w.getAttribute("data-handleid"),N=w.classList.contains("connectable"),S=w.classList.contains("connectableend");if(!E||!x)return b;const v={source:m?E:r,sourceHandle:m?C:i,target:m?r:E,targetHandle:m?i:C};b.connection=v;const L=N&&S&&(o===wn.Strict?m&&x==="source"||!m&&x==="target":E!==r||C!==i);b.isValid=L&&d(v,{nodes:u,edges:f,sourceNode:p(r),targetNode:p(E)}),b.toHandle=n}return b}function hp(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function jA(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function GA(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function qA(e,n,o,r,i,a=!1){var l,s,c;const d=r.get(e);if(!d)return null;const f=i===wn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],u=(o?f==null?void 0:f.find(p=>p.id===o):f==null?void 0:f[0])??null;return u&&a?{...u,...Io(d,u,u.position,!0)}:u}const Ql={[Ee.Left]:Ee.Right,[Ee.Right]:Ee.Left,[Ee.Top]:Ee.Bottom,[Ee.Bottom]:Ee.Top},zA=["production","prod"];function Di(e,...n){yp()&&console.warn(`[Vue Flow]: ${e}`,...n)}function yp(){return!zA.includes(process.env.NODE_ENV||"")}function _p(e,n,o,r,i){const a=n.querySelectorAll(`.vue-flow__handle.${e}`);return a!=null&&a.length?Array.from(a).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:i,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/r,y:(s.top-o.top)/r,...$i(l)}}):null}function es(e,n,o,r,i,a=!1,l){i.value=!1,e.selected?(a||e.selected&&n)&&(r([e]),t.nextTick(()=>{l.blur()})):o([e])}function et(e){return typeof t.unref(e)<"u"}function HA(e,n,o,r){if(!e||!e.source||!e.target)return o(new lt(Qe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return kn(e)?i=e:i={...e,id:Jf(e)},i=Xf(i,void 0,r),vA(i,n)?!1:i}function YA(e,n,o,r,i){if(!n.source||!n.target)return i(new lt(Qe.EDGE_INVALID,e.id)),!1;if(!o)return i(new lt(Qe.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...l}=e;return{...l,id:r?Jf(n):a,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function bp(e,n,o){const r={},i=[];for(let a=0;a<e.length;++a){const l=e[a];if(!Hn(l)){o(new lt(Qe.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${a}]`);continue}const s=NA(l,n(l.id),l.parentNode);l.parentNode&&(r[l.parentNode]=!0),i[a]=s}for(const a of i){const l=n(a.parentNode)||i.find(s=>s.id===a.parentNode);a.parentNode&&!l&&o(new lt(Qe.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||r[a.id])&&(r[a.id]&&(a.isParent=!0),l&&(l.isParent=!0))}return i}function wp(e,n,o,r,i,a){let l=i;const s=r.get(l)||new Map;r.set(l,s.set(o,n)),l=`${i}-${e}`;const c=r.get(l)||new Map;if(r.set(l,c.set(o,n)),a){l=`${i}-${e}-${a}`;const d=r.get(l)||new Map;r.set(l,d.set(o,n))}}function ts(e,n,o){e.clear();for(const r of o){const{source:i,target:a,sourceHandle:l=null,targetHandle:s=null}=r,c={edgeId:r.id,source:i,target:a,sourceHandle:l,targetHandle:s},d=`${i}-${l}--${a}-${s}`,f=`${a}-${s}--${i}-${l}`;wp("source",c,f,e,i,l),wp("target",c,d,e,a,s)}}function kp(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function ns(e,n,o,r,i,a,l,s){const c=[];for(const d of e){const f=kn(d)?d:HA(d,s,i,a);if(!f)continue;const u=o(f.source),p=o(f.target);if(!u||!p){i(new lt(Qe.EDGE_SOURCE_TARGET_MISSING,f.id,f.source,f.target));continue}if(!u){i(new lt(Qe.EDGE_SOURCE_MISSING,f.id,f.source));continue}if(!p){i(new lt(Qe.EDGE_TARGET_MISSING,f.id,f.target));continue}if(n&&!n(f,{edges:s,nodes:l,sourceNode:u,targetNode:p})){i(new lt(Qe.EDGE_INVALID,f.id));continue}const m=r(f.id);c.push({...Xf(f,m,a),sourceNode:u,targetNode:p})}return c}const Cp=Symbol("vueFlow"),Ep=Symbol("nodeId"),Np=Symbol("nodeRef"),WA=Symbol("edgeId"),XA=Symbol("edgeRef"),Mi=Symbol("slots");function Sp(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:r,noDragClassName:i,nodes:a,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:f,nodesDraggable:u,panBy:p,findNode:m,multiSelectionActive:y,nodesSelectionActive:_,selectNodesOnDrag:g,removeSelectedElements:h,addSelectedNodes:w,updateNodePositions:b,emits:x}=Le(),{onStart:E,onDrag:C,onStop:N,onClick:S,el:v,disabled:D,id:L,selectable:k,dragHandle:J}=e,I=t.shallowRef(!1);let G=[],j,te=null,K={x:void 0,y:void 0},O={x:0,y:0},P=null,T=!1,M=0,Y=!1;const z=QA(),H=({x:le,y:ue})=>{K={x:le,y:ue};let fe=!1;if(G=G.map(B=>{const V={x:le-B.distance.x,y:ue-B.distance.y},{computedPosition:F}=Xl(B,o.value?Ri(V,r.value):V,x.error,l.value,B.parentNode?m(B.parentNode):void 0);return fe=fe||B.position.x!==F.x||B.position.y!==F.y,B.position=F,B}),!!fe&&(b(G,!0,!0),I.value=!0,P)){const[B,V]=Wl({id:L,dragItems:G,findNode:m});C({event:P,node:B,nodes:V})}},Z=()=>{if(!te)return;const[le,ue]=ap(O,te,f.value);if(le!==0||ue!==0){const fe={x:(K.x??0)-le/c.value.zoom,y:(K.y??0)-ue/c.value.zoom};p({x:le,y:ue})&&H(fe)}M=requestAnimationFrame(Z)},ie=(le,ue)=>{T=!0;const fe=m(L);!g.value&&!y.value&&fe&&(fe.selected||h()),fe&&t.toValue(k)&&g.value&&es(fe,y.value,w,h,_,!1,ue);const B=z(le.sourceEvent);if(K=B,G=PA(a.value,u.value,B,m,L),G.length){const[V,F]=Wl({id:L,dragItems:G,findNode:m});E({event:le.sourceEvent,node:V,nodes:F})}},be=(le,ue)=>{var fe;le.sourceEvent.type==="touchmove"&&le.sourceEvent.touches.length>1||(s.value===0&&ie(le,ue),K=z(le.sourceEvent),te=((fe=n.value)==null?void 0:fe.getBoundingClientRect())||null,O=Zt(le.sourceEvent,te))},ee=(le,ue)=>{const fe=z(le.sourceEvent);if(!Y&&T&&d.value&&(Y=!0,Z()),!T){const B=fe.xSnapped-(K.x??0),V=fe.ySnapped-(K.y??0);Math.sqrt(B*B+V*V)>s.value&&ie(le,ue)}(K.x!==fe.xSnapped||K.y!==fe.ySnapped)&&G.length&&T&&(P=le.sourceEvent,O=Zt(le.sourceEvent,te),H(fe))},re=le=>{let ue=!1;if(!T&&!I.value&&!y.value){const fe=le.sourceEvent,B=z(fe),V=B.xSnapped-(K.x??0),F=B.ySnapped-(K.y??0),R=Math.sqrt(V*V+F*F);R!==0&&R<=s.value&&(S==null||S(fe),ue=!0)}if(G.length&&!ue){b(G,!1,!1);const[fe,B]=Wl({id:L,dragItems:G,findNode:m});N({event:le.sourceEvent,node:fe,nodes:B})}G=[],I.value=!1,Y=!1,T=!1,K={x:void 0,y:void 0},cancelAnimationFrame(M)};return t.watch([()=>t.toValue(D),v],([le,ue],fe,B)=>{if(ue){const V=Ft(ue);le||(j=Ex().on("start",F=>be(F,ue)).on("drag",F=>ee(F,ue)).on("end",F=>re(F)).filter(F=>{const R=F.target,Q=t.toValue(J);return!F.button&&(!i.value||!up(R,`.${i.value}`,ue)&&(!Q||up(R,Q,ue)))}),V.call(j)),B(()=>{V.on(".drag",null),j&&(j.on("start",null),j.on("drag",null),j.on("end",null))})}}),I}function ZA(){return{doubleClick:Ce(),click:Ce(),mouseEnter:Ce(),mouseMove:Ce(),mouseLeave:Ce(),contextMenu:Ce(),updateStart:Ce(),update:Ce(),updateEnd:Ce()}}function JA(e,n){const o=ZA();return o.doubleClick.on(r=>{var i,a;n.edgeDoubleClick(r),(a=(i=e.events)==null?void 0:i.doubleClick)==null||a.call(i,r)}),o.click.on(r=>{var i,a;n.edgeClick(r),(a=(i=e.events)==null?void 0:i.click)==null||a.call(i,r)}),o.mouseEnter.on(r=>{var i,a;n.edgeMouseEnter(r),(a=(i=e.events)==null?void 0:i.mouseEnter)==null||a.call(i,r)}),o.mouseMove.on(r=>{var i,a;n.edgeMouseMove(r),(a=(i=e.events)==null?void 0:i.mouseMove)==null||a.call(i,r)}),o.mouseLeave.on(r=>{var i,a;n.edgeMouseLeave(r),(a=(i=e.events)==null?void 0:i.mouseLeave)==null||a.call(i,r)}),o.contextMenu.on(r=>{var i,a;n.edgeContextMenu(r),(a=(i=e.events)==null?void 0:i.contextMenu)==null||a.call(i,r)}),o.updateStart.on(r=>{var i,a;n.edgeUpdateStart(r),(a=(i=e.events)==null?void 0:i.updateStart)==null||a.call(i,r)}),o.update.on(r=>{var i,a;n.edgeUpdate(r),(a=(i=e.events)==null?void 0:i.update)==null||a.call(i,r)}),o.updateEnd.on(r=>{var i,a;n.edgeUpdateEnd(r),(a=(i=e.events)==null?void 0:i.updateEnd)==null||a.call(i,r)}),Object.entries(o).reduce((r,[i,a])=>(r.emit[i]=a.trigger,r.on[i]=a.on,r),{emit:{},on:{}})}function QA(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:r}=Le();return i=>{var a;const l=((a=r.value)==null?void 0:a.getBoundingClientRect())??{left:0,top:0},s=DA(i)?i.sourceEvent:i,{x:c,y:d}=Zt(s,l),f=_r({x:c,y:d},e.value),{x:u,y:p}=o.value?Ri(f,n.value):f;return{xSnapped:u,ySnapped:p,...f}}}function Li(){return!0}function xp({handleId:e,nodeId:n,type:o,isValidConnection:r,edgeUpdaterType:i,onEdgeUpdate:a,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:f,connectOnClick:u,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:y,autoPanSpeed:_,findNode:g,panBy:h,startConnection:w,updateConnection:b,endConnection:x,emits:E,viewport:C,edges:N,nodes:S,isValidConnection:v,nodeLookup:D}=Le();let L=null,k=!1,J=null;function I(j){var te;const K=t.toValue(o)==="target",O=Zl(j),P=Wf(j.target);if(O&&j.button===0||!O){let T=function(U){B=Zt(U,le),H=KA(_r(B,C.value,!1,[1,1]),f.value,D.value,R),V||(F(),V=!0);const $=gp(U,{handle:H,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:K?"target":"source",isValidConnection:z,doc:P,lib:"vue",flowId:s,nodeLookup:D.value},N.value,S.value,g);J=$.handleDomNode,L=$.connection,k=GA(!!H,$.isValid);const oe={...A,isValid:k,to:$.toHandle&&k?Hl({x:$.toHandle.x,y:$.toHandle.y},C.value):B,toHandle:$.toHandle,toPosition:k&&$.toHandle?$.toHandle.position:Ql[R.position],toNode:$.toHandle?D.value.get($.toHandle.nodeId):null};if(!(k&&H&&(A!=null&&A.toHandle)&&oe.toHandle&&A.toHandle.type===oe.toHandle.type&&A.toHandle.nodeId===oe.toHandle.nodeId&&A.toHandle.id===oe.toHandle.id&&A.to.x===oe.to.x&&A.to.y===oe.to.y)){if(b(H&&k?Hl({x:H.x,y:H.y},C.value):B,$.toHandle,jA(!!H,k)),A=oe,!H&&!k&&!J)return Jl(fe);L&&L.source!==L.target&&J&&(Jl(fe),fe=J,J.classList.add("connecting","vue-flow__handle-connecting"),J.classList.toggle("valid",!!k),J.classList.toggle("vue-flow__handle-valid",!!k))}},M=function(U){(H||J)&&L&&k&&(a?a(U,L):E.connect(L)),E.connectEnd(U),i&&(l==null||l(U)),Jl(fe),cancelAnimationFrame(Z),x(U),V=!1,k=!1,L=null,J=null,P.removeEventListener("mousemove",T),P.removeEventListener("mouseup",M),P.removeEventListener("touchmove",T),P.removeEventListener("touchend",M)};const Y=g(t.toValue(n));let z=t.toValue(r)||v.value||Li;!z&&Y&&(z=(K?Y.isValidSourcePos:Y.isValidTargetPos)||Li);let H,Z=0;const{x:ie,y:be}=Zt(j),ee=P==null?void 0:P.elementFromPoint(ie,be),re=hp(t.toValue(i),ee),le=(te=c.value)==null?void 0:te.getBoundingClientRect();if(!le||!re)return;const ue=qA(t.toValue(n),re,t.toValue(e),D.value,d.value);if(!ue)return;let fe,B=Zt(j,le),V=!1;const F=()=>{if(!y.value)return;const[U,$]=ap(B,le,_.value);h({x:U,y:$}),Z=requestAnimationFrame(F)},R={...ue,nodeId:t.toValue(n),type:re,position:ue.position},Q=D.value.get(t.toValue(n)),ae={inProgress:!0,isValid:null,from:Io(Q,R,Ee.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:Q,to:B,toHandle:null,toPosition:Ql[R.position],toNode:null};w({nodeId:t.toValue(n),id:t.toValue(e),type:re,position:(ee==null?void 0:ee.getAttribute("data-handlepos"))||Ee.Top,...B},{x:ie-le.left,y:be-le.top}),E.connectStart({event:j,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:re});let A=ae;P.addEventListener("mousemove",T),P.addEventListener("mouseup",M),P.addEventListener("touchmove",T),P.addEventListener("touchend",M)}}function G(j){var te,K;if(!u.value)return;const O=t.toValue(o)==="target";if(!p.value){E.clickConnectStart({event:j,nodeId:t.toValue(n),handleId:t.toValue(e)}),w({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Ee.Top,...Zt(j)},void 0,!0);return}let P=t.toValue(r)||v.value||Li;const T=g(t.toValue(n));if(!P&&T&&(P=(O?T.isValidSourcePos:T.isValidTargetPos)||Li),T&&(typeof T.connectable>"u"?m.value:T.connectable)===!1)return;const M=Wf(j.target),Y=gp(j,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Ee.Top,...Zt(j)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:P,doc:M,lib:"vue",flowId:s,nodeLookup:D.value},N.value,S.value,g),z=((te=Y.connection)==null?void 0:te.source)===((K=Y.connection)==null?void 0:K.target);Y.isValid&&Y.connection&&!z&&E.connect(Y.connection),E.clickConnectEnd(j),x(j,!0)}return{handlePointerDown:I,handleClick:G}}function eI(){return t.inject(Ep,"")}function vp(e){const n=e??eI()??"",o=t.inject(Np,t.ref(null)),{findNode:r,edges:i,emits:a}=Le(),l=r(n);return l||a.error(new lt(Qe.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>r(l.parentNode)),connectedEdges:t.computed(()=>np([l],i.value))}}function tI(){return{doubleClick:Ce(),click:Ce(),mouseEnter:Ce(),mouseMove:Ce(),mouseLeave:Ce(),contextMenu:Ce(),dragStart:Ce(),drag:Ce(),dragStop:Ce()}}function nI(e,n){const o=tI();return o.doubleClick.on(r=>{var i,a;n.nodeDoubleClick(r),(a=(i=e.events)==null?void 0:i.doubleClick)==null||a.call(i,r)}),o.click.on(r=>{var i,a;n.nodeClick(r),(a=(i=e.events)==null?void 0:i.click)==null||a.call(i,r)}),o.mouseEnter.on(r=>{var i,a;n.nodeMouseEnter(r),(a=(i=e.events)==null?void 0:i.mouseEnter)==null||a.call(i,r)}),o.mouseMove.on(r=>{var i,a;n.nodeMouseMove(r),(a=(i=e.events)==null?void 0:i.mouseMove)==null||a.call(i,r)}),o.mouseLeave.on(r=>{var i,a;n.nodeMouseLeave(r),(a=(i=e.events)==null?void 0:i.mouseLeave)==null||a.call(i,r)}),o.contextMenu.on(r=>{var i,a;n.nodeContextMenu(r),(a=(i=e.events)==null?void 0:i.contextMenu)==null||a.call(i,r)}),o.dragStart.on(r=>{var i,a;n.nodeDragStart(r),(a=(i=e.events)==null?void 0:i.dragStart)==null||a.call(i,r)}),o.drag.on(r=>{var i,a;n.nodeDrag(r),(a=(i=e.events)==null?void 0:i.drag)==null||a.call(i,r)}),o.dragStop.on(r=>{var i,a;n.nodeDragStop(r),(a=(i=e.events)==null?void 0:i.dragStop)==null||a.call(i,r)}),Object.entries(o).reduce((r,[i,a])=>(r.emit[i]=a.trigger,r.on[i]=a.on,r),{emit:{},on:{}})}function Ap(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:r,snapGrid:i,snapToGrid:a,nodesDraggable:l,emits:s}=Le();return(c,d=!1)=>{const f=a.value?i.value[0]:5,u=a.value?i.value[1]:5,p=d?4:1,m=c.x*f*p,y=c.y*u*p,_=[];for(const g of e.value)if(g.draggable||l&&typeof g.draggable>"u"){const h={x:g.computedPosition.x+m,y:g.computedPosition.y+y},{computedPosition:w}=Xl(g,h,s.error,n.value,g.parentNode?r(g.parentNode):void 0);_.push({id:g.id,position:w,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(_,!0,!1)}}const os=.1,oI=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Nn(){return Di("Viewport not initialized yet."),Promise.resolve(!1)}const rI={zoomIn:Nn,zoomOut:Nn,zoomTo:Nn,fitView:Nn,setCenter:Nn,fitBounds:Nn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Nn,setTransform:Nn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function iI(e){function n(r,i){return new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((i==null?void 0:i.interpolate)==="linear"?sr:ki).scaleBy(rs(e.d3Selection,i==null?void 0:i.duration,i==null?void 0:i.ease,()=>{a(!0)}),r):a(!1)})}function o(r,i,a,l){return new Promise(s=>{var c;const{x:d,y:f}=Yf({x:-r,y:-i},e.translateExtent),u=vo.translate(-d,-f).scale(a);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?sr:ki).transform(rs(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),u):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>n(1.2,i),zoomOut:i=>n(1/1.2,i),zoomTo:(i,a)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?sr:ki).scaleTo(rs(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{l(!0)}),i):l(!1)}),setViewport:(i,a)=>o(i.x,i.y,i.zoom,a),setTransform:(i,a)=>o(i.x,i.y,i.zoom,a),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:os,includeHiddenNodes:!1,duration:0})=>{var a,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!p.hidden)&&(!((a=i.nodes)!=null&&a.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=ep(s),{x:d,y:f,zoom:u}=op(c,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??os,i.offset);return o(d,f,u,i)},setCenter:(i,a,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-i*s,d=e.dimensions.height/2-a*s;return o(c,d,s,l)},fitBounds:(i,a={padding:os})=>{const{x:l,y:s,zoom:c}=op(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,a.padding);return o(l,s,c,a)},project:i=>_r(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:a,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-a,y:i.y-l};return _r(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:a,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+a,y:i.y+l};return Hl(s,e.viewport)}return{x:0,y:0}}}:rI)}function rs(e,n=0,o=oI,r=()=>{}){const i=typeof n=="number"&&n>0;return i||r(),i?e.transition().duration(n).ease(o).on("end",r):e}function aI(e,n,o){const r=t.effectScope(!0);return r.run(()=>{const i=()=>{r.run(()=>{let _,g,h=!!(o.nodes.value.length||o.edges.value.length);_=Co([e.modelValue,()=>{var w,b;return(b=(w=e.modelValue)==null?void 0:w.value)==null?void 0:b.length}],([w])=>{w&&Array.isArray(w)&&(g==null||g.pause(),o.setElements(w),!g&&!h&&w.length?h=!0:g==null||g.resume())}),g=Co([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([w,b])=>{var x;(x=e.modelValue)!=null&&x.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...w,...b],t.nextTick(()=>{_==null||_.resume()}))},{immediate:h}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},a=()=>{r.run(()=>{let _,g,h=!!o.nodes.value.length;_=Co([e.nodes,()=>{var w,b;return(b=(w=e.nodes)==null?void 0:w.value)==null?void 0:b.length}],([w])=>{w&&Array.isArray(w)&&(g==null||g.pause(),o.setNodes(w),!g&&!h&&w.length?h=!0:g==null||g.resume())}),g=Co([o.nodes,()=>o.nodes.value.length],([w])=>{var b;(b=e.nodes)!=null&&b.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...w],t.nextTick(()=>{_==null||_.resume()}))},{immediate:h}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},l=()=>{r.run(()=>{let _,g,h=!!o.edges.value.length;_=Co([e.edges,()=>{var w,b;return(b=(w=e.edges)==null?void 0:w.value)==null?void 0:b.length}],([w])=>{w&&Array.isArray(w)&&(g==null||g.pause(),o.setEdges(w),!g&&!h&&w.length?h=!0:g==null||g.resume())}),g=Co([o.edges,()=>o.edges.value.length],([w])=>{var b;(b=e.edges)!=null&&b.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...w],t.nextTick(()=>{_==null||_.resume()}))},{immediate:h}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},s=()=>{r.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&et(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{r.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&et(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{r.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&et(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},f=()=>{r.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&et(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},u=()=>{r.run(()=>{t.watch(()=>n.applyDefault,()=>{et(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{r.run(()=>{const _=async g=>{let h=g;typeof n.autoConnect=="function"&&(h=await n.autoConnect(g)),h!==!1&&o.addEdges([h])};t.watch(()=>n.autoConnect,()=>{et(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(g,h,w)=>{g?o.onConnect(_):o.hooks.value.connect.off(_),w(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},m=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(n)){const h=g;if(!_.includes(h)){const w=t.toRef(()=>n[h]),b=o[h];t.isRef(b)&&r.run(()=>{t.watch(w,x=>{et(x)&&(b.value=x)},{immediate:!0})})}}};(()=>{i(),a(),l(),c(),s(),d(),f(),u(),p(),m()})()}),()=>r.stop()}function lI(){return{edgesChange:Ce(),nodesChange:Ce(),nodeDoubleClick:Ce(),nodeClick:Ce(),nodeMouseEnter:Ce(),nodeMouseMove:Ce(),nodeMouseLeave:Ce(),nodeContextMenu:Ce(),nodeDragStart:Ce(),nodeDrag:Ce(),nodeDragStop:Ce(),nodesInitialized:Ce(),miniMapNodeClick:Ce(),miniMapNodeDoubleClick:Ce(),miniMapNodeMouseEnter:Ce(),miniMapNodeMouseMove:Ce(),miniMapNodeMouseLeave:Ce(),connect:Ce(),connectStart:Ce(),connectEnd:Ce(),clickConnectStart:Ce(),clickConnectEnd:Ce(),paneReady:Ce(),init:Ce(),move:Ce(),moveStart:Ce(),moveEnd:Ce(),selectionDragStart:Ce(),selectionDrag:Ce(),selectionDragStop:Ce(),selectionContextMenu:Ce(),selectionStart:Ce(),selectionEnd:Ce(),viewportChangeStart:Ce(),viewportChange:Ce(),viewportChangeEnd:Ce(),paneScroll:Ce(),paneClick:Ce(),paneContextMenu:Ce(),paneMouseEnter:Ce(),paneMouseMove:Ce(),paneMouseLeave:Ce(),edgeContextMenu:Ce(),edgeMouseEnter:Ce(),edgeMouseMove:Ce(),edgeMouseLeave:Ce(),edgeDoubleClick:Ce(),edgeClick:Ce(),edgeUpdateStart:Ce(),edgeUpdate:Ce(),edgeUpdateEnd:Ce(),updateNodeInternals:Ce(),error:Ce(e=>Di(e.message))}}function sI(e,n){t.onBeforeMount(()=>{for(const[o,r]of Object.entries(n.value)){const i=a=>{e(o,a)};r.fns.add(i),ci(()=>{r.off(i)})}})}function Ip(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:ql.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:gr.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:qn.Bezier,style:{}},connectionMode:wn.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Vi()?"Meta":"Control",zoomActivationKeyCode:Vi()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:lI(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const cI=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function dI(e,n,o){const r=iI(e),i=B=>{const V=B??[];e.hooks.updateNodeInternals.trigger(V)},a=B=>xA(B,e.nodes,e.edges),l=B=>SA(B,e.nodes,e.edges),s=B=>np(B,e.edges),c=({id:B,type:V,nodeId:F})=>{var R;return Array.from(((R=e.connectionLookup.get(`${F}-${V}-${B??null}`))==null?void 0:R.values())??[])},d=B=>{if(B)return n.value.get(B)},f=B=>{if(B)return o.value.get(B)},u=(B,V,F)=>{var R,Q;const q=[];for(const ae of B){const A={id:ae.id,type:"position",dragging:F,from:ae.from};if(V&&(A.position=ae.position,ae.parentNode)){const U=d(ae.parentNode);A.position={x:A.position.x-(((R=U==null?void 0:U.computedPosition)==null?void 0:R.x)??0),y:A.position.y-(((Q=U==null?void 0:U.computedPosition)==null?void 0:Q.y)??0)}}q.push(A)}q!=null&&q.length&&e.hooks.nodesChange.trigger(q)},p=B=>{if(!e.vueFlowRef)return;const V=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!V)return;const F=window.getComputedStyle(V),{m22:R}=new window.DOMMatrixReadOnly(F.transform),Q=[];for(const q of B){const ae=q,A=d(ae.id);if(A){const U=$i(ae.nodeElement);if(!!(U.width&&U.height&&(A.dimensions.width!==U.width||A.dimensions.height!==U.height||ae.forceUpdate))){const oe=ae.nodeElement.getBoundingClientRect();A.dimensions=U,A.handleBounds.source=_p("source",ae.nodeElement,oe,R,A.id),A.handleBounds.target=_p("target",ae.nodeElement,oe,R,A.id),Q.push({id:A.id,type:"dimensions",dimensions:U})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&r.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),Q.length&&e.hooks.nodesChange.trigger(Q)},m=(B,V)=>{const F=new Set,R=new Set;for(const ae of B)Hn(ae)?F.add(ae.id):kn(ae)&&R.add(ae.id);const Q=En(n.value,F,!0),q=En(o.value,R);if(e.multiSelectionActive){for(const ae of F)Q.push(Cn(ae,V));for(const ae of R)q.push(Cn(ae,V))}Q.length&&e.hooks.nodesChange.trigger(Q),q.length&&e.hooks.edgesChange.trigger(q)},y=B=>{if(e.multiSelectionActive){const V=B.map(F=>Cn(F.id,!0));e.hooks.nodesChange.trigger(V);return}e.hooks.nodesChange.trigger(En(n.value,new Set(B.map(V=>V.id)),!0)),e.hooks.edgesChange.trigger(En(o.value))},_=B=>{if(e.multiSelectionActive){const V=B.map(F=>Cn(F.id,!0));e.hooks.edgesChange.trigger(V);return}e.hooks.edgesChange.trigger(En(o.value,new Set(B.map(V=>V.id)))),e.hooks.nodesChange.trigger(En(n.value,new Set,!0))},g=B=>{m(B,!0)},h=B=>{const F=(B||e.nodes).map(R=>(R.selected=!1,Cn(R.id,!1)));e.hooks.nodesChange.trigger(F)},w=B=>{const F=(B||e.edges).map(R=>(R.selected=!1,Cn(R.id,!1)));e.hooks.edgesChange.trigger(F)},b=B=>{if(!B||!B.length)return m([],!1);const V=B.reduce((F,R)=>{const Q=Cn(R.id,!1);return Hn(R)?F.nodes.push(Q):F.edges.push(Q),F},{nodes:[],edges:[]});V.nodes.length&&e.hooks.nodesChange.trigger(V.nodes),V.edges.length&&e.hooks.edgesChange.trigger(V.edges)},x=B=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([B,e.maxZoom]),e.minZoom=B},E=B=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([e.minZoom,B]),e.maxZoom=B},C=B=>{var V;(V=e.d3Zoom)==null||V.translateExtent(B),e.translateExtent=B},N=B=>{e.nodeExtent=B,i()},S=B=>{var V;(V=e.d3Zoom)==null||V.clickDistance(B)},v=B=>{e.nodesDraggable=B,e.nodesConnectable=B,e.elementsSelectable=B},D=B=>{const V=B instanceof Function?B(e.nodes):B;!e.initialized&&!V.length||(e.nodes=bp(V,d,e.hooks.error.trigger))},L=B=>{const V=B instanceof Function?B(e.edges):B;if(!e.initialized&&!V.length)return;const F=ns(V,e.isValidConnection,d,f,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ts(e.connectionLookup,o.value,F),e.edges=F},k=B=>{const V=B instanceof Function?B([...e.nodes,...e.edges]):B;!e.initialized&&!V.length||(D(V.filter(Hn)),L(V.filter(kn)))},J=B=>{let V=B instanceof Function?B(e.nodes):B;V=Array.isArray(V)?V:[V];const F=bp(V,d,e.hooks.error.trigger),R=[];for(const Q of F)R.push(sp(Q));R.length&&e.hooks.nodesChange.trigger(R)},I=B=>{let V=B instanceof Function?B(e.edges):B;V=Array.isArray(V)?V:[V];const F=ns(V,e.isValidConnection,d,f,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),R=[];for(const Q of F)R.push(sp(Q));R.length&&e.hooks.edgesChange.trigger(R)},G=(B,V=!0,F=!1)=>{const R=B instanceof Function?B(e.nodes):B,Q=Array.isArray(R)?R:[R],q=[],ae=[];function A($){const oe=s($);for(const ne of oe)(!et(ne.deletable)||ne.deletable)&&ae.push(dp(ne.id,ne.source,ne.target,ne.sourceHandle,ne.targetHandle))}function U($){const oe=[];for(const ne of e.nodes)ne.parentNode===$&&oe.push(ne);if(oe.length){for(const ne of oe)q.push(cp(ne.id));V&&A(oe);for(const ne of oe)U(ne.id)}}for(const $ of Q){const oe=typeof $=="string"?d($):$;oe&&(et(oe.deletable)&&!oe.deletable||(q.push(cp(oe.id)),V&&A([oe]),F&&U(oe.id)))}ae.length&&e.hooks.edgesChange.trigger(ae),q.length&&e.hooks.nodesChange.trigger(q)},j=B=>{const V=B instanceof Function?B(e.edges):B,F=Array.isArray(V)?V:[V],R=[];for(const Q of F){const q=typeof Q=="string"?f(Q):Q;q&&(et(q.deletable)&&!q.deletable||R.push(dp(typeof Q=="string"?Q:Q.id,q.source,q.target,q.sourceHandle,q.targetHandle)))}e.hooks.edgesChange.trigger(R)},te=(B,V,F=!0)=>{const R=f(B.id);if(!R)return!1;const Q=e.edges.indexOf(R),q=YA(B,V,R,F,e.hooks.error.trigger);if(q){const[ae]=ns([q],e.isValidConnection,d,f,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((A,U)=>U===Q?ae:A),ts(e.connectionLookup,o.value,[ae]),ae}return!1},K=(B,V,F={replace:!1})=>{const R=f(B);if(!R)return;const Q=typeof V=="function"?V(R):V;R.data=F.replace?Q:{...R.data,...Q}},O=B=>lp(B,e.nodes),P=B=>{const V=lp(B,e.edges);return ts(e.connectionLookup,o.value,V),V},T=(B,V,F={replace:!1})=>{const R=d(B);if(!R)return;const Q=typeof V=="function"?V(R):V;F.replace?e.nodes.splice(e.nodes.indexOf(R),1,Q):Object.assign(R,Q)},M=(B,V,F={replace:!1})=>{const R=d(B);if(!R)return;const Q=typeof V=="function"?V(R):V;R.data=F.replace?Q:{...R.data,...Q}},Y=(B,V,F=!1)=>{F?e.connectionClickStartHandle=B:e.connectionStartHandle=B,e.connectionEndHandle=null,e.connectionStatus=null,V&&(e.connectionPosition=V)},z=(B,V=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=B,e.connectionEndHandle=V,e.connectionStatus=F)},H=(B,V)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,V?e.connectionClickStartHandle=null:e.connectionStartHandle=null},Z=B=>{const V=EA(B),F=V?null:yr(B)?B:d(B.id);return!V&&!F?[null,null,V]:[V?B:Pi(F),F,V]},ie=(B,V=!0,F=e.nodes)=>{const[R,Q,q]=Z(B);if(!R)return[];const ae=[];for(const A of F||e.nodes){if(!q&&(A.id===Q.id||!A.computedPosition))continue;const U=Pi(A),$=Oi(U,R);(V&&$>0||$>=Number(R.width)*Number(R.height))&&ae.push(A)}return ae},be=(B,V,F=!0)=>{const[R]=Z(B);if(!R)return!1;const Q=Oi(R,V);return F&&Q>0||Q>=Number(R.width)*Number(R.height)},ee=B=>{const{viewport:V,dimensions:F,d3Zoom:R,d3Selection:Q,translateExtent:q}=e;if(!R||!Q||!B.x&&!B.y)return!1;const ae=vo.translate(V.x+B.x,V.y+B.y).scale(V.zoom),A=[[0,0],[F.width,F.height]],U=R.constrain()(ae,A,q),$=e.viewport.x!==U.x||e.viewport.y!==U.y||e.viewport.zoom!==U.k;return R.transform(Q,U),$},re=B=>{const V=B instanceof Function?B(e):B,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];et(V.defaultEdgeOptions)&&(e.defaultEdgeOptions=V.defaultEdgeOptions);const R=V.modelValue||V.nodes||V.edges?[]:void 0;R&&(V.modelValue&&R.push(...V.modelValue),V.nodes&&R.push(...V.nodes),V.edges&&R.push(...V.edges),k(R));const Q=()=>{et(V.maxZoom)&&E(V.maxZoom),et(V.minZoom)&&x(V.minZoom),et(V.translateExtent)&&C(V.translateExtent)};for(const q of Object.keys(V)){const ae=q,A=V[ae];![...cI,...F].includes(ae)&&et(A)&&(e[ae]=A)}Nl(()=>e.d3Zoom).not.toBeNull().then(Q),e.initialized||(e.initialized=!0)};return{updateNodePositions:u,updateNodeDimensions:p,setElements:k,setNodes:D,setEdges:L,addNodes:J,addEdges:I,removeNodes:G,removeEdges:j,findNode:d,findEdge:f,updateEdge:te,updateEdgeData:K,updateNode:T,updateNodeData:M,applyEdgeChanges:P,applyNodeChanges:O,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:_,setMinZoom:x,setMaxZoom:E,setTranslateExtent:C,setNodeExtent:N,setPaneClickDistance:S,removeSelectedElements:b,removeSelectedNodes:h,removeSelectedEdges:w,startConnection:Y,updateConnection:z,endConnection:H,setInteractive:v,setState:re,getIntersectingNodes:ie,getIncomers:a,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:be,panBy:ee,fitView:B=>r.value.fitView(B),zoomIn:B=>r.value.zoomIn(B),zoomOut:B=>r.value.zoomOut(B),zoomTo:(B,V)=>r.value.zoomTo(B,V),setViewport:(B,V)=>r.value.setViewport(B,V),setTransform:(B,V)=>r.value.setTransform(B,V),getViewport:()=>r.value.getViewport(),getTransform:()=>r.value.getTransform(),setCenter:(B,V,F)=>r.value.setCenter(B,V,F),fitBounds:(B,V)=>r.value.fitBounds(B,V),project:B=>r.value.project(B),screenToFlowCoordinate:B=>r.value.screenToFlowCoordinate(B),flowToScreenCoordinate:B=>r.value.flowToScreenCoordinate(B),toObject:()=>{const B=[],V=[];for(const F of e.nodes){const{computedPosition:R,handleBounds:Q,selected:q,dimensions:ae,isParent:A,resizing:U,dragging:$,events:oe,...ne}=F;B.push(ne)}for(const F of e.edges){const{selected:R,sourceNode:Q,targetNode:q,events:ae,...A}=F;V.push(A)}return JSON.parse(JSON.stringify({nodes:B,edges:V,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:B=>new Promise(V=>{const{nodes:F,edges:R,position:Q,zoom:q,viewport:ae}=B;if(F&&D(F),R&&L(R),ae!=null&&ae.x&&(ae!=null&&ae.y)||Q){const A=(ae==null?void 0:ae.x)||Q[0],U=(ae==null?void 0:ae.y)||Q[1],$=(ae==null?void 0:ae.zoom)||q||e.viewport.zoom;return Nl(()=>r.value.viewportInitialized).toBe(!0).then(()=>{r.value.setViewport({x:A,y:U,zoom:$}).then(()=>{V(!0)})})}else V(!0)}),updateNodeInternals:i,viewportHelper:r,$reset:()=>{const B=Ip();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const V=vo.translate(B.defaultViewport.x??0,B.defaultViewport.y??0).scale(zn(B.defaultViewport.zoom??1,B.minZoom,B.maxZoom)),F=e.viewportRef.getBoundingClientRect(),R=[[0,0],[F.width,F.height]],Q=e.d3Zoom.constrain()(V,R,B.translateExtent);e.d3Zoom.transform(e.d3Selection,Q)}re(B)},$destroy:()=>{}}}const uI=["data-id","data-handleid","data-nodeid","data-handlepos"],fI={name:"Handle",compatConfig:{MODE:3}},Jt=t.defineComponent({...fI,props:{id:{default:null},type:{},position:{default:()=>Ee.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),r=t.toRef(()=>o.type??"source"),i=t.toRef(()=>o.isValidConnection??null),{id:a,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:f,noDragClassName:u,noPanClassName:p}=Le(),{id:m,node:y,nodeEl:_,connectedEdges:g}=vp(),h=t.ref(),w=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),b=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),x=t.toRef(()=>{var L,k,J,I,G,j;return((L=l.value)==null?void 0:L.nodeId)===m&&((k=l.value)==null?void 0:k.id)===e.id&&((J=l.value)==null?void 0:J.type)===r.value||((I=c.value)==null?void 0:I.nodeId)===m&&((G=c.value)==null?void 0:G.id)===e.id&&((j=c.value)==null?void 0:j.type)===r.value}),E=t.toRef(()=>{var L,k,J;return((L=s.value)==null?void 0:L.nodeId)===m&&((k=s.value)==null?void 0:k.id)===e.id&&((J=s.value)==null?void 0:J.type)===r.value}),{handlePointerDown:C,handleClick:N}=xp({nodeId:m,handleId:e.id,isValidConnection:i,type:r}),S=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(L=>{const k=L[`${r.value}Handle`];return L[r.value]!==m?!1:k?k===e.id:!0}):typeof e.connectable=="number"?g.value.filter(L=>{const k=L[`${r.value}Handle`];return L[r.value]!==m?!1:k?k===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,g.value):et(e.connectable)?e.connectable:f.value);t.onMounted(()=>{var L;if(!y.dimensions.width||!y.dimensions.height)return;const k=(L=y.handleBounds[r.value])==null?void 0:L.find(O=>O.id===e.id);if(!d.value||k)return;const J=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!h.value||!J||!e.id)return;const I=_.value.getBoundingClientRect(),G=h.value.getBoundingClientRect(),j=window.getComputedStyle(J),{m22:te}=new window.DOMMatrixReadOnly(j.transform),K={id:e.id,position:e.position,x:(G.left-I.left)/te,y:(G.top-I.top)/te,type:r.value,nodeId:m,...$i(h.value)};y.handleBounds[r.value]=[...y.handleBounds[r.value]??[],K]});function v(L){const k=Zl(L);S.value&&w.value&&(k&&L.button===0||!k)&&C(L)}function D(L){!m||!s.value&&!w.value||S.value&&N(L)}return n({handleClick:N,handlePointerDown:C,onClick:D,onPointerDown:v}),(L,k)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:h,"data-id":`${t.unref(a)}-${t.unref(m)}-${e.id}-${r.value}`,"data-handleid":e.id,"data-nodeid":t.unref(m),"data-handlepos":L.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${L.position}`,`vue-flow__handle-${e.id}`,t.unref(u),t.unref(p),r.value,{connectable:S.value,connecting:E.value,connectablestart:w.value,connectableend:b.value,connectionindicator:S.value&&(w.value&&!x.value||b.value&&x.value)}]]),onMousedown:v,onTouchstartPassive:v,onClick:D},[t.renderSlot(L.$slots,"default",{id:L.id})],42,uI))}}),Fi=function({sourcePosition:e=Ee.Bottom,targetPosition:n=Ee.Top,label:o,connectable:r=!0,isValidTargetPos:i,isValidSourcePos:a,data:l}){const s=l.label??o;return[t.h(Jt,{type:"target",position:n,connectable:r,isValidConnection:i}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Jt,{type:"source",position:e,connectable:r,isValidConnection:a})]};Fi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Fi.inheritAttrs=!1,Fi.compatConfig={MODE:3};const pI=Fi,Ui=function({targetPosition:e=Ee.Top,label:n,connectable:o=!0,isValidTargetPos:r,data:i}){const a=i.label??n;return[t.h(Jt,{type:"target",position:e,connectable:o,isValidConnection:r}),typeof a!="string"&&a?t.h(a):t.h(t.Fragment,[a])]};Ui.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ui.inheritAttrs=!1,Ui.compatConfig={MODE:3};const mI=Ui,Ki=function({sourcePosition:e=Ee.Bottom,label:n,connectable:o=!0,isValidSourcePos:r,data:i}){const a=i.label??n;return[typeof a!="string"&&a?t.h(a):t.h(t.Fragment,[a]),t.h(Jt,{type:"source",position:e,connectable:o,isValidConnection:r})]};Ki.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ki.inheritAttrs=!1,Ki.compatConfig={MODE:3};const gI=Ki,hI=["transform"],yI=["width","height","x","y","rx","ry"],_I=["y"],bI={name:"EdgeText",compatConfig:{MODE:3}},wI=t.defineComponent({...bI,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),r=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(i),t.watch([()=>e.x,()=>e.y,o,()=>e.label],i);function i(){if(!o.value)return;const a=o.value.getBBox();(a.width!==n.value.width||a.height!==n.value.height)&&(n.value=a)}return(a,l)=>(t.openBlock(),t.createElementBlock("g",{transform:r.value,class:"vue-flow__edge-textwrapper"},[a.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*a.labelBgPadding[0]}px`,height:`${n.value.height+2*a.labelBgPadding[1]}px`,x:-a.labelBgPadding[0],y:-a.labelBgPadding[1],style:t.normalizeStyle(a.labelBgStyle),rx:a.labelBgBorderRadius,ry:a.labelBgBorderRadius},null,12,yI)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(a.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:a.labelStyle}),[t.renderSlot(a.$slots,"default",{},()=>[typeof a.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(a.label),1)],64))])],16,_I)],8,hI))}}),kI=["id","d","marker-end","marker-start"],CI=["d","stroke-width"],EI={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ji=t.defineComponent({...EI,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),r=t.ref(null),i=t.ref(null),a=t.useAttrs();return n({pathEl:o,interactionEl:r,labelEl:i}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(a),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,kI),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:r,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,CI)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(wI,{key:1,ref_key:"labelEl",ref:i,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function Tp({sourceX:e,sourceY:n,targetX:o,targetY:r}){const i=Math.abs(o-e)/2,a=o<e?o+i:o-i,l=Math.abs(r-n)/2,s=r<n?r+l:r-l;return[a,s,i,l]}function Pp({sourceX:e,sourceY:n,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:s}){const c=e*.125+i*.375+l*.375+o*.125,d=n*.125+a*.375+s*.375+r*.125,f=Math.abs(c-e),u=Math.abs(d-n);return[c,d,f,u]}function Gi(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Op({pos:e,x1:n,y1:o,x2:r,y2:i,c:a}){let l,s;switch(e){case Ee.Left:l=n-Gi(n-r,a),s=o;break;case Ee.Right:l=n+Gi(r-n,a),s=o;break;case Ee.Top:l=n,s=o-Gi(o-i,a);break;case Ee.Bottom:l=n,s=o+Gi(i-o,a);break}return[l,s]}function $p(e){const{sourceX:n,sourceY:o,sourcePosition:r=Ee.Bottom,targetX:i,targetY:a,targetPosition:l=Ee.Top,curvature:s=.25}=e,[c,d]=Op({pos:r,x1:n,y1:o,x2:i,y2:a,c:s}),[f,u]=Op({pos:l,x1:i,y1:a,x2:n,y2:o,c:s}),[p,m,y,_]=Pp({sourceX:n,sourceY:o,targetX:i,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:f,targetControlY:u});return[`M${n},${o} C${c},${d} ${f},${u} ${i},${a}`,p,m,y,_]}function Bp({pos:e,x1:n,y1:o,x2:r,y2:i}){let a,l;switch(e){case Ee.Left:case Ee.Right:a=.5*(n+r),l=o;break;case Ee.Top:case Ee.Bottom:a=n,l=.5*(o+i);break}return[a,l]}function Vp(e){const{sourceX:n,sourceY:o,sourcePosition:r=Ee.Bottom,targetX:i,targetY:a,targetPosition:l=Ee.Top}=e,[s,c]=Bp({pos:r,x1:n,y1:o,x2:i,y2:a}),[d,f]=Bp({pos:l,x1:i,y1:a,x2:n,y2:o}),[u,p,m,y]=Pp({sourceX:n,sourceY:o,targetX:i,targetY:a,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${n},${o} C${s},${c} ${d},${f} ${i},${a}`,u,p,m,y]}const Rp={[Ee.Left]:{x:-1,y:0},[Ee.Right]:{x:1,y:0},[Ee.Top]:{x:0,y:-1},[Ee.Bottom]:{x:0,y:1}};function NI({source:e,sourcePosition:n=Ee.Bottom,target:o}){return n===Ee.Left||n===Ee.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function Dp(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function SI({source:e,sourcePosition:n=Ee.Bottom,target:o,targetPosition:r=Ee.Top,center:i,offset:a}){const l=Rp[n],s=Rp[r],c={x:e.x+l.x*a,y:e.y+l.y*a},d={x:o.x+s.x*a,y:o.y+s.y*a},f=NI({source:c,sourcePosition:n,target:d}),u=f.x!==0?"x":"y",p=f[u];let m,y,_;const g={x:0,y:0},h={x:0,y:0},[w,b,x,E]=Tp({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[u]*s[u]===-1){y=i.x??w,_=i.y??b;const N=[{x:y,y:c.y},{x:y,y:d.y}],S=[{x:c.x,y:_},{x:d.x,y:_}];l[u]===p?m=u==="x"?N:S:m=u==="x"?S:N}else{const N=[{x:c.x,y:d.y}],S=[{x:d.x,y:c.y}];if(u==="x"?m=l.x===p?S:N:m=l.y===p?N:S,n===r){const J=Math.abs(e[u]-o[u]);if(J<=a){const I=Math.min(a-1,a-J);l[u]===p?g[u]=(c[u]>e[u]?-1:1)*I:h[u]=(d[u]>o[u]?-1:1)*I}}if(n!==r){const J=u==="x"?"y":"x",I=l[u]===s[J],G=c[J]>d[J],j=c[J]<d[J];(l[u]===1&&(!I&&G||I&&j)||l[u]!==1&&(!I&&j||I&&G))&&(m=u==="x"?N:S)}const v={x:c.x+g.x,y:c.y+g.y},D={x:d.x+h.x,y:d.y+h.y},L=Math.max(Math.abs(v.x-m[0].x),Math.abs(D.x-m[0].x)),k=Math.max(Math.abs(v.y-m[0].y),Math.abs(D.y-m[0].y));L>=k?(y=(v.x+D.x)/2,_=m[0].y):(y=m[0].x,_=(v.y+D.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...m,{x:d.x+h.x,y:d.y+h.y},o],y,_,x,E]}function xI(e,n,o,r){const i=Math.min(Dp(e,n)/2,Dp(n,o)/2,r),{x:a,y:l}=n;if(e.x===a&&a===o.x||e.y===l&&l===o.y)return`L${a} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,f=e.y<o.y?1:-1;return`L ${a+i*d},${l}Q ${a},${l} ${a},${l+i*f}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${a},${l+i*c}Q ${a},${l} ${a+i*s},${l}`}function is(e){const{sourceX:n,sourceY:o,sourcePosition:r=Ee.Bottom,targetX:i,targetY:a,targetPosition:l=Ee.Top,borderRadius:s=5,centerX:c,centerY:d,offset:f=20}=e,[u,p,m,y,_]=SI({source:{x:n,y:o},sourcePosition:r,target:{x:i,y:a},targetPosition:l,center:{x:c,y:d},offset:f});return[u.reduce((h,w,b)=>{let x;return b>0&&b<u.length-1?x=xI(u[b-1],w,u[b+1],s):x=`${b===0?"M":"L"}${w.x} ${w.y}`,h+=x,h},""),p,m,y,_]}function vI(e){const{sourceX:n,sourceY:o,targetX:r,targetY:i}=e,[a,l,s,c]=Tp({sourceX:n,sourceY:o,targetX:r,targetY:i});return[`M ${n},${o}L ${r},${i}`,a,l,s,c]}const AI=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,r,i]=vI(e);return t.h(ji,{path:o,labelX:r,labelY:i,...n,...e})}}}),Mp=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,r,i]=is({...e,sourcePosition:e.sourcePosition??Ee.Bottom,targetPosition:e.targetPosition??Ee.Top});return t.h(ji,{path:o,labelX:r,labelY:i,...n,...e})}}}),II=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(Mp,{...e,...n,borderRadius:0})}}),TI=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,r,i]=$p({...e,sourcePosition:e.sourcePosition??Ee.Bottom,targetPosition:e.targetPosition??Ee.Top});return t.h(ji,{path:o,labelX:r,labelY:i,...n,...e})}}}),PI=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,r,i]=Vp({...e,sourcePosition:e.sourcePosition??Ee.Bottom,targetPosition:e.targetPosition??Ee.Top});return t.h(ji,{path:o,labelX:r,labelY:i,...n,...e})}}}),OI={input:gI,default:pI,output:mI},$I={default:TI,straight:AI,step:II,smoothstep:Mp,simplebezier:PI};function BI(e,n,o){const r=t.computed(()=>_=>n.value.get(_)),i=t.computed(()=>_=>o.value.get(_)),a=t.computed(()=>{const _={...$I,...e.edgeTypes},g=Object.keys(_);for(const h of e.edges)h.type&&!g.includes(h.type)&&(_[h.type]=h.type);return _}),l=t.computed(()=>{const _={...OI,...e.nodeTypes},g=Object.keys(_);for(const h of e.nodes)h.type&&!g.includes(h.type)&&(_[h.type]=h.type);return _}),s=t.computed(()=>e.onlyRenderVisibleElements?tp(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const g of e.edges){const h=n.value.get(g.source),w=n.value.get(g.target);VA({sourcePos:h.computedPosition||{x:0,y:0},targetPos:w.computedPosition||{x:0,y:0},sourceWidth:h.dimensions.width,sourceHeight:h.dimensions.height,targetWidth:w.dimensions.width,targetHeight:w.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(g)}return _}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),f=t.computed(()=>{const _=[];for(const g of e.nodes)g.selected&&_.push(g);return _}),u=t.computed(()=>{const _=[];for(const g of e.edges)g.selected&&_.push(g);return _}),p=t.computed(()=>[...f.value,...u.value]),m=t.computed(()=>{const _=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&_.push(g);return _}),y=t.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:r,getEdge:i,getElements:d,getEdgeTypes:a,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:f,getSelectedEdges:u,getNodesInitialized:m,areNodesInitialized:y}}class Yn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,r=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Yn.instance;return Yn.instance=r??new Yn,o&&(o.config.globalProperties.$vueFlowStorage=Yn.instance),Yn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const r=Ip(),i=t.reactive(r),a={};for(const[p,m]of Object.entries(i.hooks)){const y=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;a[y]=m.on}const l={};for(const[p,m]of Object.entries(i.hooks))l[p]=m.trigger;const s=t.computed(()=>{const p=new Map;for(const m of i.nodes)p.set(m.id,m);return p}),c=t.computed(()=>{const p=new Map;for(const m of i.edges)p.set(m.id,m);return p}),d=BI(i,s,c),f=dI(i,s,c);f.setState({...i,...o});const u={...a,...d,...f,...O1(i),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.45.0",$destroy:()=>{this.remove(n)}};return this.set(n,u),u}getId(){return`vue-flow-${this.currentId++}`}}function Le(e){const n=Yn.getInstance(),o=t.getCurrentScope(),r=typeof e=="object",i=r?e:{id:e},a=i.id,l=a??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Cp,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=a??n.getId(),d=n.create(c,i);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(u,p,m)=>{const y=g=>{d.applyNodeChanges(g)},_=g=>{d.applyEdgeChanges(g)};u?(d.onNodesChange(y),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(_)),m(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),ci(()=>{if(s){const u=n.get(s.id);u?u.$destroy():Di(`No store instance found for id ${s.id} in storage.`)}})})}else r&&s.setState(i);if(o&&(t.provide(Cp,s),o.vueFlowId=s.id),r){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new lt(Qe.USEVUEFLOW_OPTIONS))}return s}function VI(e){const{emits:n,dimensions:o}=Le();let r;t.onMounted(()=>{const i=e.value,a=()=>{if(!i)return;const l=$i(i);(l.width===0||l.height===0)&&n.error(new lt(Qe.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:l.width||500,height:l.height||500}};a(),window.addEventListener("resize",a),i&&(r=new ResizeObserver(()=>a()),r.observe(i)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),r&&i&&r.unobserve(i)})})}const RI={name:"UserSelection",compatConfig:{MODE:3}},DI=t.defineComponent({...RI,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),MI=["tabIndex"],LI={name:"NodesSelection",compatConfig:{MODE:3}},FI=t.defineComponent({...LI,setup(e){const{emits:n,viewport:o,getSelectedNodes:r,noPanClassName:i,disableKeyboardA11y:a,userSelectionActive:l}=Le(),s=Ap(),c=t.ref(null),d=Sp({el:c,onStart(y){n.selectionDragStart(y)},onDrag(y){n.selectionDrag(y)},onStop(y){n.selectionDragStop(y)}});t.onMounted(()=>{var y;a.value||(y=c.value)==null||y.focus({preventScroll:!0})});const f=t.computed(()=>ep(r.value)),u=t.computed(()=>({width:`${f.value.width}px`,height:`${f.value.height}px`,top:`${f.value.y}px`,left:`${f.value.x}px`}));function p(y){n.selectionContextMenu({event:y,nodes:r.value})}function m(y){a||Ao[y.key]&&(y.preventDefault(),s({x:Ao[y.key].x,y:Ao[y.key].y},y.shiftKey))}return(y,_)=>!t.unref(l)&&f.value.width&&f.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(i)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(u.value),tabIndex:t.unref(a)?void 0:-1,onContextmenu:p,onKeydown:m},null,46,MI)],6)):t.createCommentVNode("",!0)}});function UI(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const KI={name:"Pane",compatConfig:{MODE:3}},jI=t.defineComponent({...KI,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:r,emits:i,userSelectionActive:a,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:f,getSelectedNodes:u,removeNodes:p,removeEdges:m,selectionMode:y,deleteKeyCode:_,multiSelectionKeyCode:g,multiSelectionActive:h,edgeLookup:w,nodeLookup:b,connectionLookup:x,defaultEdgeOptions:E,connectionStartHandle:C}=Le(),N=t.ref(null),S=t.ref(new Set),v=t.ref(new Set),D=t.ref(),L=t.toRef(()=>c.value&&(e.isSelecting||a.value)),k=t.toRef(()=>C.value!==null);let J=!1,I=!1;const G=hr(_,{actInsideInputWithModifier:!1}),j=hr(g);t.watch(G,z=>{z&&(p(u.value),m(f.value),d.value=!1)}),t.watch(j,z=>{h.value=z});function te(z,H){return Z=>{Z.target===H&&(z==null||z(Z))}}function K(z){if(J||k.value){J=!1;return}i.paneClick(z),l(),d.value=!1}function O(z){z.preventDefault(),z.stopPropagation(),i.paneContextMenu(z)}function P(z){i.paneScroll(z)}function T(z){var H,Z,ie;if(D.value=(H=n.value)==null?void 0:H.getBoundingClientRect(),!c.value||!e.isSelecting||z.button!==0||z.target!==N.value||!D.value)return;(ie=(Z=z.target)==null?void 0:Z.setPointerCapture)==null||ie.call(Z,z.pointerId);const{x:be,y:ee}=UI(z,D.value);I=!0,J=!1,l(),s.value={width:0,height:0,startX:be,startY:ee,x:be,y:ee},i.selectionStart(z)}function M(z){var H;if(!D.value||!s.value)return;J=!0;const{x:Z,y:ie}=Zt(z,D.value),{startX:be=0,startY:ee=0}=s.value,re={startX:be,startY:ee,x:Z<be?Z:be,y:ie<ee?ie:ee,width:Math.abs(Z-be),height:Math.abs(ie-ee)},le=S.value,ue=v.value;S.value=new Set(tp(o.value,re,r.value,y.value===ql.Partial,!0).map(B=>B.id)),v.value=new Set;const fe=((H=E.value)==null?void 0:H.selectable)??!0;for(const B of S.value){const V=x.value.get(B);if(V)for(const{edgeId:F}of V.values()){const R=w.value.get(F);R&&(R.selectable??fe)&&v.value.add(F)}}if(!kp(le,S.value)){const B=En(b.value,S.value,!0);i.nodesChange(B)}if(!kp(ue,v.value)){const B=En(w.value,v.value);i.edgesChange(B)}s.value=re,a.value=!0,d.value=!1}function Y(z){var H;z.button!==0||!I||((H=z.target)==null||H.releasePointerCapture(z.pointerId),!a.value&&s.value&&z.target===N.value&&K(z),a.value=!1,s.value=null,d.value=S.value.size>0,i.selectionEnd(z),e.selectionKeyPressed&&(J=!1),I=!1)}return(z,H)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:N,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:z.isSelecting}]),onClick:H[0]||(H[0]=Z=>L.value?void 0:te(K,N.value)(Z)),onContextmenu:H[1]||(H[1]=Z=>te(O,N.value)(Z)),onWheelPassive:H[2]||(H[2]=Z=>te(P,N.value)(Z)),onPointerenter:H[3]||(H[3]=Z=>L.value?void 0:t.unref(i).paneMouseEnter(Z)),onPointerdown:H[4]||(H[4]=Z=>L.value?T(Z):t.unref(i).paneMouseMove(Z)),onPointermove:H[5]||(H[5]=Z=>L.value?M(Z):t.unref(i).paneMouseMove(Z)),onPointerup:H[6]||(H[6]=Z=>L.value?Y(Z):void 0),onPointerleave:H[7]||(H[7]=Z=>t.unref(i).paneMouseLeave(Z))},[t.renderSlot(z.$slots,"default"),t.unref(a)&&t.unref(s)?(t.openBlock(),t.createBlock(DI,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(u).length?(t.openBlock(),t.createBlock(FI,{key:1})):t.createCommentVNode("",!0)],34))}}),GI={name:"Transform",compatConfig:{MODE:3}},qI=t.defineComponent({...GI,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:r}=Le(),i=t.computed(()=>o.value?!r.value:!1),a=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:a.value,opacity:i.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),zI={name:"Viewport",compatConfig:{MODE:3}},HI=t.defineComponent({...zI,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:r,translateExtent:i,zoomActivationKeyCode:a,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:f,panOnDrag:u,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:y,preventScrolling:_,noWheelClassName:g,noPanClassName:h,emits:w,connectionStartHandle:b,userSelectionActive:x,paneDragging:E,d3Zoom:C,d3Selection:N,d3ZoomHandler:S,viewport:v,viewportRef:D,paneClickDistance:L}=Le();VI(D);const k=t.shallowRef(!1),J=t.shallowRef(!1);let I=null,G=!1,j=0,te={x:0,y:0,zoom:0};const K=hr(s),O=hr(l),P=hr(a),T=t.toRef(()=>(!O.value||O.value&&l.value===!0)&&(K.value||u.value)),M=t.toRef(()=>K.value||c.value),Y=t.toRef(()=>O.value||l.value===!0&&T.value!==!0);t.onMounted(()=>{if(!D.value){Di("Viewport element is missing");return}const ee=D.value,re=ee.getBoundingClientRect(),le=hA().clickDistance(L.value).scaleExtent([n.value,o.value]).translateExtent(i.value),ue=Ft(ee).call(le),fe=ue.on("wheel.zoom"),B=vo.translate(r.value.x??0,r.value.y??0).scale(zn(r.value.zoom??1,n.value,o.value)),V=[[0,0],[re.width,re.height]],F=le.constrain()(B,V,i.value);le.transform(ue,F),le.wheelDelta(H),C.value=le,N.value=ue,S.value=fe,v.value={x:F.x,y:F.y,zoom:F.k},le.on("start",R=>{var Q;if(!R.sourceEvent)return null;j=R.sourceEvent.button,k.value=!0;const q=ie(R.transform);((Q=R.sourceEvent)==null?void 0:Q.type)==="mousedown"&&(E.value=!0),te=q,w.viewportChangeStart(q),w.moveStart({event:R,flowTransform:q})}),le.on("end",R=>{if(!R.sourceEvent)return null;if(k.value=!1,E.value=!1,z(T.value,j??0)&&!G&&w.paneContextMenu(R.sourceEvent),G=!1,Z(te,R.transform)){const Q=ie(R.transform);te=Q,w.viewportChangeEnd(Q),w.moveEnd({event:R,flowTransform:Q})}}),le.filter(R=>{var Q;const q=P.value||y.value,ae=m.value&&R.ctrlKey,A=R.button;if(A===1&&R.type==="mousedown"&&(be(R,"vue-flow__node")||be(R,"vue-flow__edge")))return!0;if(!T.value&&!q&&!M.value&&!p.value&&!m.value||x.value||!p.value&&R.type==="dblclick"||be(R,g.value)&&R.type==="wheel"||be(R,h.value)&&(R.type!=="wheel"||M.value&&R.type==="wheel"&&!P.value)||!m.value&&R.ctrlKey&&R.type==="wheel"||!q&&!M.value&&!ae&&R.type==="wheel")return!1;if(!m&&R.type==="touchstart"&&((Q=R.touches)==null?void 0:Q.length)>1)return R.preventDefault(),!1;if(!T.value&&(R.type==="mousedown"||R.type==="touchstart")||l.value===!0&&Array.isArray(u.value)&&u.value.includes(0)&&A===0||Array.isArray(u.value)&&!u.value.includes(A)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const U=Array.isArray(u.value)&&u.value.includes(A)||l.value===!0&&Array.isArray(u.value)&&!u.value.includes(0)||!A||A<=1;return(!R.ctrlKey||K.value||R.type==="wheel")&&U}),t.watch([x,T],()=>{x.value&&!k.value?le.on("zoom",null):x.value||le.on("zoom",R=>{v.value={x:R.transform.x,y:R.transform.y,zoom:R.transform.k};const Q=ie(R.transform);G=z(T.value,j??0),w.viewportChange(Q),w.move({event:R,flowTransform:Q})})},{immediate:!0}),t.watch([x,M,d,P,m,_,g],()=>{M.value&&!P.value&&!x.value?ue.on("wheel.zoom",R=>{if(be(R,g.value))return!1;const Q=P.value||y.value,q=m.value&&R.ctrlKey;if(!(!_.value||M.value||Q||q))return!1;R.preventDefault(),R.stopImmediatePropagation();const A=ue.property("__zoom").k||1,U=Vi();if(!K.value&&R.ctrlKey&&m.value&&U){const ke=Ht(R),de=H(R),Ne=A*2**de;le.scaleTo(ue,Ne,ke,R);return}const $=R.deltaMode===1?20:1;let oe=d.value===gr.Vertical?0:R.deltaX*$,ne=d.value===gr.Horizontal?0:R.deltaY*$;!U&&R.shiftKey&&d.value!==gr.Vertical&&!oe&&ne&&(oe=ne,ne=0),le.translateBy(ue,-(oe/A)*f.value,-(ne/A)*f.value);const _e=ie(ue.property("__zoom"));I&&clearTimeout(I),J.value?(w.move({event:R,flowTransform:_e}),w.viewportChange(_e),I=setTimeout(()=>{w.moveEnd({event:R,flowTransform:_e}),w.viewportChangeEnd(_e),J.value=!1},150)):(J.value=!0,w.moveStart({event:R,flowTransform:_e}),w.viewportChangeStart(_e))},{passive:!1}):typeof fe<"u"&&ue.on("wheel.zoom",function(R,Q){const q=!_.value&&R.type==="wheel"&&!R.ctrlKey,ae=P.value||y.value,A=m.value&&R.ctrlKey;if(!ae&&!c.value&&!A&&R.type==="wheel"||q||be(R,g.value))return null;R.preventDefault(),fe.call(this,R,Q)},{passive:!1})},{immediate:!0})});function z(ee,re){return re===2&&Array.isArray(ee)&&ee.includes(2)}function H(ee){const re=ee.ctrlKey&&Vi()?10:1;return-ee.deltaY*(ee.deltaMode===1?.05:ee.deltaMode?1:.002)*re}function Z(ee,re){return ee.x!==re.x&&!Number.isNaN(re.x)||ee.y!==re.y&&!Number.isNaN(re.y)||ee.zoom!==re.k&&!Number.isNaN(re.k)}function ie(ee){return{x:ee.x,y:ee.y,zoom:ee.k}}function be(ee,re){return ee.target.closest(`.${re}`)}return(ee,re)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:D,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(jI,{"is-selecting":Y.value,"selection-key-pressed":t.unref(O),class:t.normalizeClass({connecting:!!t.unref(b),dragging:t.unref(E),draggable:t.unref(u)===!0||Array.isArray(t.unref(u))&&t.unref(u).includes(0)})},{default:t.withCtx(()=>[t.createVNode(qI,null,{default:t.withCtx(()=>[t.renderSlot(ee.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),YI=["id"],WI=["id"],XI=["id"],ZI={name:"A11yDescriptions",compatConfig:{MODE:3}},JI=t.defineComponent({...ZI,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:r}=Le();return(i,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(qf)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,YI),t.createElementVNode("div",{id:`${t.unref(zf)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,WI),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(CA)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(r)),9,XI))],64))}});function QI(){const e=Le();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function eT(e,n,o){return o===Ee.Left?e-n:o===Ee.Right?e+n:e}function tT(e,n,o){return o===Ee.Top?e-n:o===Ee.Bottom?e+n:e}const as=function({radius:e=10,centerX:n=0,centerY:o=0,position:r=Ee.Top,type:i}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:eT(n,e,r),cy:tT(o,e,r),r:e,stroke:"transparent",fill:"transparent"})};as.props=["radius","centerX","centerY","position","type"],as.compatConfig={MODE:3};const Lp=as,nT=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:r,edgeUpdaterRadius:i,emits:a,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:f,findNode:u,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:y,elementsSelectable:_,edgesUpdatable:g,edgesFocusable:h,hooks:w}=Le(),b=t.computed(()=>f(e.id)),{emit:x,on:E}=JA(b.value,a),C=t.inject(Mi),N=t.getCurrentInstance(),S=t.ref(!1),v=t.ref(!1),D=t.ref(""),L=t.ref(null),k=t.ref("source"),J=t.ref(null),I=t.toRef(()=>typeof b.value.selectable>"u"?_.value:b.value.selectable),G=t.toRef(()=>typeof b.value.updatable>"u"?g.value:b.value.updatable),j=t.toRef(()=>typeof b.value.focusable>"u"?h.value:b.value.focusable);t.provide(WA,e.id),t.provide(XA,J);const te=t.computed(()=>b.value.class instanceof Function?b.value.class(b.value):b.value.class),K=t.computed(()=>b.value.style instanceof Function?b.value.style(b.value):b.value.style),O=t.computed(()=>{const V=b.value.type||"default",F=C==null?void 0:C[`edge-${V}`];if(F)return F;let R=b.value.template??c.value[V];if(typeof R=="string"&&N){const Q=Object.keys(N.appContext.components);Q&&Q.includes(V)&&(R=t.resolveComponent(V,!1))}return R&&typeof R!="string"?R:(a.error(new lt(Qe.EDGE_TYPE_MISSING,R)),!1)}),{handlePointerDown:P}=xp({nodeId:D,handleId:L,type:k,isValidConnection:p,edgeUpdaterType:k,onEdgeUpdate:Y,onEdgeUpdateEnd:z});return()=>{const V=u(b.value.source),F=u(b.value.target),R="pathOptions"in b.value?b.value.pathOptions:{};if(!V&&!F)return a.error(new lt(Qe.EDGE_SOURCE_TARGET_MISSING,b.value.id,b.value.source,b.value.target)),null;if(!V)return a.error(new lt(Qe.EDGE_SOURCE_MISSING,b.value.id,b.value.source)),null;if(!F)return a.error(new lt(Qe.EDGE_TARGET_MISSING,b.value.id,b.value.target)),null;if(!b.value||b.value.hidden||V.hidden||F.hidden)return null;let Q;r.value===wn.Strict?Q=V.handleBounds.source:Q=[...V.handleBounds.source||[],...V.handleBounds.target||[]];const q=pp(Q,b.value.sourceHandle);let ae;r.value===wn.Strict?ae=F.handleBounds.target:ae=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const A=pp(ae,b.value.targetHandle),U=(q==null?void 0:q.position)||Ee.Bottom,$=(A==null?void 0:A.position)||Ee.Top,{x:oe,y:ne}=Io(V,q,U),{x:_e,y:ke}=Io(F,A,$);return b.value.sourceX=oe,b.value.sourceY=ne,b.value.targetX=_e,b.value.targetY=ke,t.h("g",{ref:J,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${O.value===!1?"default":b.value.type||"default"}`,s.value,te.value,{updating:S.value,selected:b.value.selected,animated:b.value.animated,inactive:!I.value&&!w.value.edgeClick.hasListeners()}],tabIndex:j.value?0:void 0,"aria-label":b.value.ariaLabel===null?void 0:b.value.ariaLabel??`Edge from ${b.value.source} to ${b.value.target}`,"aria-describedby":j.value?`${zf}-${n}`:void 0,"aria-roledescription":"edge",role:j.value?"group":"img",...b.value.domAttributes,onClick:Z,onContextmenu:ie,onDblclick:be,onMouseenter:ee,onMousemove:re,onMouseleave:le,onKeyDown:j.value?B:void 0},[v.value?null:t.h(O.value===!1?c.value.default:O.value,{id:e.id,sourceNode:V,targetNode:F,source:b.value.source,target:b.value.target,type:b.value.type,updatable:G.value,selected:b.value.selected,animated:b.value.animated,label:b.value.label,labelStyle:b.value.labelStyle,labelShowBg:b.value.labelShowBg,labelBgStyle:b.value.labelBgStyle,labelBgPadding:b.value.labelBgPadding,labelBgBorderRadius:b.value.labelBgBorderRadius,data:b.value.data,events:{...b.value.events,...E},style:K.value,markerStart:`url('#${br(b.value.markerStart,n)}')`,markerEnd:`url('#${br(b.value.markerEnd,n)}')`,sourcePosition:U,targetPosition:$,sourceX:oe,sourceY:ne,targetX:_e,targetY:ke,sourceHandleId:b.value.sourceHandle,targetHandleId:b.value.targetHandle,interactionWidth:b.value.interactionWidth,...R}),[G.value==="source"||G.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:T,onMouseout:M},t.h(Lp,{position:U,centerX:oe,centerY:ne,radius:i.value,type:"source","data-type":"source"}))]:null,G.value==="target"||G.value===!0?[t.h("g",{onMousedown:fe,onMouseenter:T,onMouseout:M},t.h(Lp,{position:$,centerX:_e,centerY:ke,radius:i.value,type:"target","data-type":"target"}))]:null]])};function T(){S.value=!0}function M(){S.value=!1}function Y(V,F){x.update({event:V,edge:b.value,connection:F})}function z(V){x.updateEnd({event:V,edge:b.value}),v.value=!1}function H(V,F){V.button===0&&(v.value=!0,D.value=F?b.value.target:b.value.source,L.value=(F?b.value.targetHandle:b.value.sourceHandle)??null,k.value=F?"target":"source",x.updateStart({event:V,edge:b.value}),P(V))}function Z(V){var F;const R={event:V,edge:b.value};I.value&&(l.value=!1,b.value.selected&&m.value?(d([b.value]),(F=J.value)==null||F.blur()):o([b.value])),x.click(R)}function ie(V){x.contextMenu({event:V,edge:b.value})}function be(V){x.doubleClick({event:V,edge:b.value})}function ee(V){x.mouseEnter({event:V,edge:b.value})}function re(V){x.mouseMove({event:V,edge:b.value})}function le(V){x.mouseLeave({event:V,edge:b.value})}function ue(V){H(V,!0)}function fe(V){H(V,!1)}function B(V){var F;!y.value&&Hf.includes(V.key)&&I.value&&(V.key==="Escape"?((F=J.value)==null||F.blur(),d([f(e.id)])):o([f(e.id)]))}}}),oT=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:r,connectionEndHandle:i,connectionPosition:a,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:f,findNode:u}=Le(),p=(e=t.inject(Mi))==null?void 0:e["connection-line"],m=t.computed(()=>{var w;return u((w=r.value)==null?void 0:w.nodeId)}),y=t.computed(()=>{var w;return u((w=i.value)==null?void 0:w.nodeId)??null}),_=t.computed(()=>({x:(a.value.x-f.value.x)/f.value.zoom,y:(a.value.y-f.value.y)/f.value.zoom})),g=t.computed(()=>c.value.markerStart?`url(#${br(c.value.markerStart,n)})`:""),h=t.computed(()=>c.value.markerEnd?`url(#${br(c.value.markerEnd,n)})`:"");return()=>{var w,b,x;if(!m.value||!r.value)return null;const E=r.value.id,C=r.value.type,N=m.value.handleBounds;let S=(N==null?void 0:N[C])??[];if(o.value===wn.Loose){const K=(N==null?void 0:N[C==="source"?"target":"source"])??[];S=[...S,...K]}if(!S)return null;const v=(E?S.find(K=>K.id===E):S[0])??null,D=(v==null?void 0:v.position)??Ee.Top,{x:L,y:k}=Io(m.value,v,D);let J=null;y.value&&(o.value===wn.Strict?J=((w=y.value.handleBounds[C==="source"?"target":"source"])==null?void 0:w.find(K=>{var O;return K.id===((O=i.value)==null?void 0:O.id)}))||null:J=((b=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:b.find(K=>{var O;return K.id===((O=i.value)==null?void 0:O.id)}))||null);const I=((x=i.value)==null?void 0:x.position)??(D?Ql[D]:null);if(!D||!I)return null;const G=l.value??c.value.type??qn.Bezier;let j="";const te={sourceX:L,sourceY:k,sourcePosition:D,targetX:_.value.x,targetY:_.value.y,targetPosition:I};return G===qn.Bezier?[j]=$p(te):G===qn.Step?[j]=is({...te,borderRadius:0}):G===qn.SmoothStep?[j]=is(te):G===qn.SimpleBezier?[j]=Vp(te):j=`M${L},${k} ${_.value.x},${_.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:L,sourceY:k,sourcePosition:D,targetX:_.value.x,targetY:_.value.y,targetPosition:I,sourceNode:m.value,sourceHandle:v,targetNode:y.value,targetHandle:J,markerEnd:h.value,markerStart:g.value,connectionStatus:d.value}):t.h("path",{d:j,class:[c.value.class,d,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":h.value,"marker-start":g.value})))}}}),rT=["id","markerWidth","markerHeight","markerUnits","orient"],iT={name:"MarkerType",compatConfig:{MODE:3}},aT=t.defineComponent({...iT,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(mr).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref(mr).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,rT))}}),lT={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},sT={name:"MarkerDefinitions",compatConfig:{MODE:3}},cT=t.defineComponent({...sT,setup(e){const{id:n,edges:o,connectionLineOptions:r,defaultMarkerColor:i}=Le(),a=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const f=br(d,n);l.has(f)||(typeof d=="object"?s.push({...d,id:f,color:d.color||i.value}):s.push({id:f,color:i.value,type:d}),l.add(f))}};for(const d of[r.value.markerEnd,r.value.markerStart])c(d);for(const d of o.value)for(const f of[d.markerStart,d.markerEnd])c(f);return s.sort((d,f)=>d.id.localeCompare(f.id))});return(l,s)=>(t.openBlock(),t.createElementBlock("svg",lT,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,c=>(t.openBlock(),t.createBlock(aT,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),dT={name:"Edges",compatConfig:{MODE:3}},uT=t.defineComponent({...dT,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:r}=Le();return(i,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(cT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(RA)(l,t.unref(n),t.unref(r))})},[t.createVNode(t.unref(nT),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(oT))],64))}}),fT=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:r,nodesSelectionActive:i,multiSelectionActive:a,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:f,getNodeTypes:u,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:y,ariaLiveMessage:_,snapToGrid:g,snapGrid:h,nodeDragThreshold:w,nodesDraggable:b,elementsSelectable:x,nodesConnectable:E,nodesFocusable:C,hooks:N}=Le(),S=t.ref(null);t.provide(Np,S),t.provide(Ep,e.id);const v=t.inject(Mi),D=t.getCurrentInstance(),L=Ap(),{node:k,parentNode:J}=vp(e.id),{emit:I,on:G}=nI(k,l),j=t.toRef(()=>typeof k.draggable>"u"?b.value:k.draggable),te=t.toRef(()=>typeof k.selectable>"u"?x.value:k.selectable),K=t.toRef(()=>typeof k.connectable>"u"?E.value:k.connectable),O=t.toRef(()=>typeof k.focusable>"u"?C.value:k.focusable),P=t.computed(()=>te.value||j.value||N.value.nodeClick.hasListeners()||N.value.nodeDoubleClick.hasListeners()||N.value.nodeMouseEnter.hasListeners()||N.value.nodeMouseMove.hasListeners()||N.value.nodeMouseLeave.hasListeners()),T=t.toRef(()=>!!k.dimensions.width&&!!k.dimensions.height),M=t.computed(()=>{const F=k.type||"default",R=v==null?void 0:v[`node-${F}`];if(R)return R;let Q=k.template||u.value[F];if(typeof Q=="string"&&D){const q=Object.keys(D.appContext.components);q&&q.includes(F)&&(Q=t.resolveComponent(F,!1))}return Q&&typeof Q!="string"?Q:(l.error(new lt(Qe.NODE_TYPE_MISSING,Q)),!1)}),Y=Sp({id:e.id,el:S,disabled:()=>!j.value,selectable:te,dragHandle:()=>k.dragHandle,onStart(F){I.dragStart(F)},onDrag(F){I.drag(F)},onStop(F){I.dragStop(F)},onClick(F){B(F)}}),z=t.computed(()=>k.class instanceof Function?k.class(k):k.class),H=t.computed(()=>{const F=(k.style instanceof Function?k.style(k):k.style)||{},R=k.width instanceof Function?k.width(k):k.width,Q=k.height instanceof Function?k.height(k):k.height;return!F.width&&R&&(F.width=typeof R=="string"?R:`${R}px`),!F.height&&Q&&(F.height=typeof Q=="string"?Q:`${Q}px`),F}),Z=t.toRef(()=>Number(k.zIndex??H.value.zIndex??0));return f(F=>{(F.includes(e.id)||!F.length)&&be()}),t.onMounted(()=>{t.watch(()=>k.hidden,(F=!1,R,Q)=>{!F&&S.value&&(e.resizeObserver.observe(S.value),Q(()=>{S.value&&e.resizeObserver.unobserve(S.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>k.type,()=>k.sourcePosition,()=>k.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:S.value,forceUpdate:!0}])})}),t.watch([()=>k.position.x,()=>k.position.y,()=>{var F;return(F=J.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=J.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=J.value)==null?void 0:F.computedPosition.z},Z,()=>k.selected,()=>k.dimensions.height,()=>k.dimensions.width,()=>{var F;return(F=J.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=J.value)==null?void 0:F.dimensions.width}],([F,R,Q,q,ae,A])=>{const U={x:F,y:R,z:A+(m.value&&k.selected?1e3:0)};typeof Q<"u"&&typeof q<"u"?k.computedPosition=TA({x:Q,y:q,z:ae},U):k.computedPosition=U},{flush:"post",immediate:!0}),t.watch([()=>k.extent,p],([F,R],[Q,q])=>{(F!==Q||R!==q)&&ie()}),k.extent==="parent"||typeof k.extent=="object"&&"range"in k.extent&&k.extent.range==="parent"?Nl(()=>T).toBe(!0).then(ie):ie(),()=>k.hidden?null:t.h("div",{ref:S,"data-id":k.id,class:["vue-flow__node",`vue-flow__node-${M.value===!1?"default":k.type||"default"}`,{[o.value]:j.value,dragging:Y==null?void 0:Y.value,draggable:j.value,selected:k.selected,selectable:te.value,parent:k.isParent},z.value],style:{visibility:T.value?"visible":"hidden",zIndex:k.computedPosition.z??Z.value,transform:`translate(${k.computedPosition.x}px,${k.computedPosition.y}px)`,pointerEvents:P.value?"all":"none",...H.value},tabIndex:O.value?0:void 0,role:O.value?"group":void 0,"aria-describedby":y.value?void 0:`${qf}-${n}`,"aria-label":k.ariaLabel,"aria-roledescription":"node",...k.domAttributes,onMouseenter:ee,onMousemove:re,onMouseleave:le,onContextmenu:ue,onClick:B,onDblclick:fe,onKeydown:V},[t.h(M.value===!1?u.value.default:M.value,{id:k.id,type:k.type,data:k.data,events:{...k.events,...G},selected:k.selected,resizing:k.resizing,dragging:Y.value,connectable:K.value,position:k.computedPosition,dimensions:k.dimensions,isValidTargetPos:k.isValidTargetPos,isValidSourcePos:k.isValidSourcePos,parent:k.parentNode,parentNodeId:k.parentNode,zIndex:k.computedPosition.z??Z.value,targetPosition:k.targetPosition,sourcePosition:k.sourcePosition,label:k.label,dragHandle:k.dragHandle,onUpdateNodeInternals:be})]);function ie(){const F=k.computedPosition,{computedPosition:R,position:Q}=Xl(k,g.value?Ri(F,h.value):F,l.error,p.value,J.value);(k.computedPosition.x!==R.x||k.computedPosition.y!==R.y)&&(k.computedPosition={...k.computedPosition,...R}),(k.position.x!==Q.x||k.position.y!==Q.y)&&(k.position=Q)}function be(){S.value&&d([{id:e.id,nodeElement:S.value,forceUpdate:!0}])}function ee(F){Y!=null&&Y.value||I.mouseEnter({event:F,node:k})}function re(F){Y!=null&&Y.value||I.mouseMove({event:F,node:k})}function le(F){Y!=null&&Y.value||I.mouseLeave({event:F,node:k})}function ue(F){return I.contextMenu({event:F,node:k})}function fe(F){return I.doubleClick({event:F,node:k})}function B(F){te.value&&(!r.value||!j.value||w.value>0)&&es(k,a.value,c,s,i,!1,S.value),I.click({event:F,node:k})}function V(F){if(!(zl(F)||y.value))if(Hf.includes(F.key)&&te.value){const R=F.key==="Escape";es(k,a.value,c,s,i,R,S.value)}else j.value&&k.selected&&Ao[F.key]&&(F.preventDefault(),_.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~k.position.x}, y: ${~~k.position.y}`,L({x:Ao[F.key].x,y:Ao[F.key].y},F.shiftKey))}}});function pT(e={includeHiddenNodes:!1}){const{nodes:n}=Le();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const mT={class:"vue-flow__nodes vue-flow__container"},gT={name:"Nodes",compatConfig:{MODE:3}},hT=t.defineComponent({...gT,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:r}=Le(),i=pT(),a=t.ref();return t.watch(i,l=>{l&&t.nextTick(()=>{r.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{a.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=a.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",mT,[a.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,f,u)=>{const p=[c.id];if(u&&u.key===c.id&&t.isMemoSame(u,p))return u;const m=(t.openBlock(),t.createBlock(t.unref(fT),{id:c.id,key:c.id,"resize-observer":a.value},null,8,["id","resize-observer"]));return m.memo=p,m},s,0),128)):t.createCommentVNode("",!0)]))}});function yT(){const{emits:e}=Le();t.onMounted(()=>{if(yp()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new lt(Qe.MISSING_STYLES))}})}const _T=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),bT={name:"VueFlow",compatConfig:{MODE:3}},Fp=t.defineComponent({...bT,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const r=e,i=t.useSlots(),a=Sl(r,"modelValue",o),l=Sl(r,"nodes",o),s=Sl(r,"edges",o),c=Le(r),d=aI({modelValue:a,nodes:l,edges:s},r,c);return sI(o,c.hooks),QI(),yT(),t.provide(Mi,i),t.onUnmounted(()=>{d()}),n(c),(f,u)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(HI,null,{default:t.withCtx(()=>[t.createVNode(uT),_T,t.createVNode(hT),t.renderSlot(f.$slots,"zoom-pane")]),_:3}),t.renderSlot(f.$slots,"default"),t.createVNode(JI)],512))}}),wT={name:"Panel",compatConfig:{MODE:3}},kT=t.defineComponent({...wT,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=Le(),r=t.computed(()=>`${n.position}`.split("-"));return(i,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",r.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(i.$slots,"default")],6))}});var fn=(e=>(e.Lines="lines",e.Dots="dots",e))(fn||{});const Up=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Kp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};fn.Lines+"",fn.Dots+"";const CT={[fn.Dots]:"#81818a",[fn.Lines]:"#eee"},ET=["id","x","y","width","height","patternTransform"],NT={key:2,height:"100",width:"100"},ST=["fill"],xT=["x","y","fill"],vT={name:"Background",compatConfig:{MODE:3}},AT=t.defineComponent({...vT,props:{id:{},variant:{default:()=>fn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=Le(),r=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],f=e.size*l,[u,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[u*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:m,size:f}}),i=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),a=t.toRef(()=>e.color||e.patternColor||CT[e.variant||fn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:i.value},()=>[t.createElementVNode("pattern",{id:i.value,x:t.unref(o).x%r.value.scaledGap[0],y:t.unref(o).y%r.value.scaledGap[1],width:r.value.scaledGap[0],height:r.value.scaledGap[1],patternTransform:`translate(-${r.value.offset[0]},-${r.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(fn).Lines?(t.openBlock(),t.createBlock(t.unref(Up),{key:0,size:l.lineWidth,color:a.value,dimensions:r.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(fn).Dots?(t.openBlock(),t.createBlock(t.unref(Kp),{key:1,color:a.value,radius:r.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",NT,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,ST)])):t.createCommentVNode("",!0)])],8,ET)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,xT),t.renderSlot(l.$slots,"default",{id:i.value})],4))}}),IT={name:"ControlButton",compatConfig:{MODE:3}},TT=(e,n)=>{const o=e.__vccOpts||e;for(const[r,i]of n)o[r]=i;return o},PT={class:"vue-flow__controls-button"};function OT(e,n,o,r,i,a){return t.openBlock(),t.createElementBlock("button",PT,[t.renderSlot(e.$slots,"default")])}const wr=TT(IT,[["render",OT]]),$T={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},BT=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function VT(e,n){return t.openBlock(),t.createElementBlock("svg",$T,BT)}const RT={render:VT},DT={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},MT=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function LT(e,n){return t.openBlock(),t.createElementBlock("svg",DT,MT)}const FT={render:LT},UT={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},KT=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function jT(e,n){return t.openBlock(),t.createElementBlock("svg",UT,KT)}const GT={render:jT},qT={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},zT=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function HT(e,n){return t.openBlock(),t.createElementBlock("svg",qT,zT)}const YT={render:HT},WT={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},XT=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function ZT(e,n){return t.openBlock(),t.createElementBlock("svg",WT,XT)}const JT={render:ZT},QT={name:"Controls",compatConfig:{MODE:3}},eP=t.defineComponent({...QT,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>jf.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:r,elementsSelectable:i,setInteractive:a,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:f,maxZoom:u}=Le(),p=t.toRef(()=>o.value||r.value||i.value),m=t.toRef(()=>d.value.zoom<=f.value),y=t.toRef(()=>d.value.zoom>=u.value);function _(){l(),n("zoomIn")}function g(){s(),n("zoomOut")}function h(){c(e.fitViewParams),n("fitView")}function w(){a(!p.value),n("interactionChange",!p.value)}return(b,x)=>(t.openBlock(),t.createBlock(t.unref(kT),{class:"vue-flow__controls",position:b.position},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"top"),b.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(b.$slots,"control-zoom-in",{},()=>[t.createVNode(wr,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(RT))))])]),_:3},8,["disabled"])]),t.renderSlot(b.$slots,"control-zoom-out",{},()=>[t.createVNode(wr,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(FT))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),b.showFitView?t.renderSlot(b.$slots,"control-fit-view",{key:1},()=>[t.createVNode(wr,{class:"vue-flow__controls-fitview",onClick:h},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(GT))))])]),_:3})]):t.createCommentVNode("",!0),b.showInteractive?t.renderSlot(b.$slots,"control-interactive",{key:2},()=>[b.showInteractive?(t.openBlock(),t.createBlock(wr,{key:0,class:"vue-flow__controls-interactive",onClick:w},{default:t.withCtx(()=>[p.value?t.renderSlot(b.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(JT))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(b.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(YT))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(b.$slots,"default")]),_:3},8,["position"]))}}),tP=["undo","redo","duplicate","cut","copy","paste"],jp=()=>{};function nP(e){const n=e;return n?!!n.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'):!1}function oP(e){if(!(e.metaKey||e.ctrlKey))return;switch(e.key.toLowerCase()){case"z":return e.shiftKey?"redo":"undo";case"y":return"redo";case"d":return"duplicate";case"x":return"cut";case"c":return"copy";case"v":return"paste"}}const rP=Ye.createSharedComposable(()=>{const e=new Set;Ye.useEventListener("keydown",o=>{if(nP(o.target))return;const r=oP(o);if(r)for(const i of e){if(!t.toValue(i.enabled))continue;const a=i[r];if(a){if(o.defaultPrevented){t.warn(`[useHotkeys] event for "${r}" was already defaultPrevented. Hotkey ignored.`);return}o.preventDefault(),a();return}}},{passive:!1});function n(o){if(!tP.some(i=>typeof o[i]=="function"))return jp;const r={enabled:o.enabled??!0,...o};return e.add(r),()=>e.delete(r)}return{subscribe:n}});function Gp(e={}){if(typeof window>"u")return jp;const n=rP().subscribe(e);return t.onScopeDispose(n),n}const qp=44,iP=220,zp=366,aP=1e3,lP=qp+parseFloat(Nd),qi=1,sP=0,cP=1,dP=2,uP=3,To=parseInt(_C,10),kr="application/x-datakit+json",zi={delete:["Delete"],undo:["Mod","Z"],redo:{mac:["Mod","Shift","Z"],windows:["Mod","Y"],linux:["Mod","Shift","Z"]},copy:["Mod","C"],paste:["Mod","V"],duplicate:["Mod","D"]},Cr={padding:80,gaps:{nodes:40,edges:80,ranks:40}},fP=1600,pP=1.2,mP=0,gP=200,Hp=Symbol("confirm-modal"),Po="{key}",Wn={"kong.client.consumer":{dataType:"object",writable:!1,readable:!0},"kong.client.consumer_groups":{dataType:"array",writable:!1,readable:!0},"kong.client.credential":{dataType:"object",writable:!1,readable:!0},"kong.client.get_identity_realm_source":{dataType:"object",writable:!1,readable:!0},"kong.client.forwarded_ip":{dataType:"string",writable:!1,readable:!0},"kong.client.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.client.ip":{dataType:"string",writable:!1,readable:!0},"kong.client.port":{dataType:"number",writable:!1,readable:!0},"kong.client.protocol":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_host":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.request.forwarded_scheme":{dataType:"string",writable:!1,readable:!0},"kong.request.port":{dataType:"number",writable:!1,readable:!0},"kong.response.source":{dataType:"string",writable:!1,readable:!0},"kong.router.route":{dataType:"object",writable:!1,readable:!0},"kong.route_id":{dataType:"string",writable:!1,readable:!0},"kong.route_name":{dataType:"string",writable:!1,readable:!0},"kong.router.service":{dataType:"object",writable:!1,readable:!0},"kong.service_name":{dataType:"string",writable:!1,readable:!0},"kong.service_id":{dataType:"string",writable:!1,readable:!0},"kong.service.response.status":{dataType:"number",writable:!1,readable:!0},"kong.version":{dataType:"string",writable:!1,readable:!0},"kong.node.id":{dataType:"string",writable:!1,readable:!0},"kong.configuration.{key}":{dataType:"any",writable:!1,readable:!0},"kong.service.target":{dataType:"string ({host}:{port})",writable:!0,readable:!1},"kong.service.request_scheme":{dataType:"string ({scheme})",writable:!0,readable:!1},"kong.ctx.plugin.{key}":{dataType:"any",writable:!0,readable:!0},"kong.ctx.shared.{key}":{dataType:"any",writable:!0,readable:!0}},Hi=Object.keys(Wn).filter(e=>e.includes(Po)).map(e=>e.replace(Po,""));function ls(e){if(!e||!Nr(e))return;const n=Hi.find(o=>e.startsWith(o));if(n)return e.slice(n.length).replace(Po,"")}function Er(e){if(!e)return null;const n=Hi.find(o=>e.startsWith(o));return n||e}function Nr(e){return e?Hi.some(n=>e.startsWith(n)):!1}function Yp(e){return e?Nr(e)?Er(e)+Po:e:null}function ss(e){var o;if(!e)return!1;const n=Yp(e);return n?((o=Wn[n])==null?void 0:o.readable)??!1:!1}function cs(e){var o;if(!e)return!1;const n=Yp(e);return n?((o=Wn[n])==null?void 0:o.writable)??!1:!1}function hP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yP="\0",Xn="\0",Wp="";let _P=class{constructor(n){ot(this,"_isDirected",!0);ot(this,"_isMultigraph",!1);ot(this,"_isCompound",!1);ot(this,"_label");ot(this,"_defaultNodeLabelFn",()=>{});ot(this,"_defaultEdgeLabelFn",()=>{});ot(this,"_nodes",{});ot(this,"_in",{});ot(this,"_preds",{});ot(this,"_out",{});ot(this,"_sucs",{});ot(this,"_edgeObjs",{});ot(this,"_edgeLabels",{});ot(this,"_nodeCount",0);ot(this,"_edgeCount",0);ot(this,"_parent");ot(this,"_children");n&&(this._isDirected=Object.hasOwn(n,"directed")?n.directed:!0,this._isMultigraph=Object.hasOwn(n,"multigraph")?n.multigraph:!1,this._isCompound=Object.hasOwn(n,"compound")?n.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Xn]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(n){return this._label=n,this}graph(){return this._label}setDefaultNodeLabel(n){return this._defaultNodeLabelFn=n,typeof n!="function"&&(this._defaultNodeLabelFn=()=>n),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var n=this;return this.nodes().filter(o=>Object.keys(n._in[o]).length===0)}sinks(){var n=this;return this.nodes().filter(o=>Object.keys(n._out[o]).length===0)}setNodes(n,o){var r=arguments,i=this;return n.forEach(function(a){r.length>1?i.setNode(a,o):i.setNode(a)}),this}setNode(n,o){return Object.hasOwn(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=o),this):(this._nodes[n]=arguments.length>1?o:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=Xn,this._children[n]={},this._children[Xn][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)}node(n){return this._nodes[n]}hasNode(n){return Object.hasOwn(this._nodes,n)}removeNode(n){var o=this;if(Object.hasOwn(this._nodes,n)){var r=i=>o.removeEdge(o._edgeObjs[i]);delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],this.children(n).forEach(function(i){o.setParent(i)}),delete this._children[n]),Object.keys(this._in[n]).forEach(r),delete this._in[n],delete this._preds[n],Object.keys(this._out[n]).forEach(r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this}setParent(n,o){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(o===void 0)o=Xn;else{o+="";for(var r=o;r!==void 0;r=this.parent(r))if(r===n)throw new Error("Setting "+o+" as parent of "+n+" would create a cycle");this.setNode(o)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=o,this._children[o][n]=!0,this}_removeFromParentsChildList(n){delete this._children[this._parent[n]][n]}parent(n){if(this._isCompound){var o=this._parent[n];if(o!==Xn)return o}}children(n=Xn){if(this._isCompound){var o=this._children[n];if(o)return Object.keys(o)}else{if(n===Xn)return this.nodes();if(this.hasNode(n))return[]}}predecessors(n){var o=this._preds[n];if(o)return Object.keys(o)}successors(n){var o=this._sucs[n];if(o)return Object.keys(o)}neighbors(n){var o=this.predecessors(n);if(o){const i=new Set(o);for(var r of this.successors(n))i.add(r);return Array.from(i.values())}}isLeaf(n){var o;return this.isDirected()?o=this.successors(n):o=this.neighbors(n),o.length===0}filterNodes(n){var o=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});o.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([l,s]){n(l)&&o.setNode(l,s)}),Object.values(this._edgeObjs).forEach(function(l){o.hasNode(l.v)&&o.hasNode(l.w)&&o.setEdge(l,r.edge(l))});var i={};function a(l){var s=r.parent(l);return s===void 0||o.hasNode(s)?(i[l]=s,s):s in i?i[s]:a(s)}return this._isCompound&&o.nodes().forEach(l=>o.setParent(l,a(l))),o}setDefaultEdgeLabel(n){return this._defaultEdgeLabelFn=n,typeof n!="function"&&(this._defaultEdgeLabelFn=()=>n),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(n,o){var r=this,i=arguments;return n.reduce(function(a,l){return i.length>1?r.setEdge(a,l,o):r.setEdge(a,l),l}),this}setEdge(){var n,o,r,i,a=!1,l=arguments[0];typeof l=="object"&&l!==null&&"v"in l?(n=l.v,o=l.w,r=l.name,arguments.length===2&&(i=arguments[1],a=!0)):(n=l,o=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),n=""+n,o=""+o,r!==void 0&&(r=""+r);var s=Sr(this._isDirected,n,o,r);if(Object.hasOwn(this._edgeLabels,s))return a&&(this._edgeLabels[s]=i),this;if(r!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(o),this._edgeLabels[s]=a?i:this._defaultEdgeLabelFn(n,o,r);var c=bP(this._isDirected,n,o,r);return n=c.v,o=c.w,Object.freeze(c),this._edgeObjs[s]=c,Xp(this._preds[o],n),Xp(this._sucs[n],o),this._in[o][s]=c,this._out[n][s]=c,this._edgeCount++,this}edge(n,o,r){var i=arguments.length===1?ds(this._isDirected,arguments[0]):Sr(this._isDirected,n,o,r);return this._edgeLabels[i]}edgeAsObj(){const n=this.edge(...arguments);return typeof n!="object"?{label:n}:n}hasEdge(n,o,r){var i=arguments.length===1?ds(this._isDirected,arguments[0]):Sr(this._isDirected,n,o,r);return Object.hasOwn(this._edgeLabels,i)}removeEdge(n,o,r){var i=arguments.length===1?ds(this._isDirected,arguments[0]):Sr(this._isDirected,n,o,r),a=this._edgeObjs[i];return a&&(n=a.v,o=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],Zp(this._preds[o],n),Zp(this._sucs[n],o),delete this._in[o][i],delete this._out[n][i],this._edgeCount--),this}inEdges(n,o){var r=this._in[n];if(r){var i=Object.values(r);return o?i.filter(a=>a.v===o):i}}outEdges(n,o){var r=this._out[n];if(r){var i=Object.values(r);return o?i.filter(a=>a.w===o):i}}nodeEdges(n,o){var r=this.inEdges(n,o);if(r)return r.concat(this.outEdges(n,o))}};function Xp(e,n){e[n]?e[n]++:e[n]=1}function Zp(e,n){--e[n]||delete e[n]}function Sr(e,n,o,r){var i=""+n,a=""+o;if(!e&&i>a){var l=i;i=a,a=l}return i+Wp+a+Wp+(r===void 0?yP:r)}function bP(e,n,o,r){var i=""+n,a=""+o;if(!e&&i>a){var l=i;i=a,a=l}var s={v:i,w:a};return r&&(s.name=r),s}function ds(e,n){return Sr(e,n.v,n.w,n.name)}var us=_P,wP="2.2.4",kP={Graph:us,version:wP},CP=us,EP={write:NP,read:vP};function NP(e){var n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:SP(e),edges:xP(e)};return e.graph()!==void 0&&(n.value=structuredClone(e.graph())),n}function SP(e){return e.nodes().map(function(n){var o=e.node(n),r=e.parent(n),i={v:n};return o!==void 0&&(i.value=o),r!==void 0&&(i.parent=r),i})}function xP(e){return e.edges().map(function(n){var o=e.edge(n),r={v:n.v,w:n.w};return n.name!==void 0&&(r.name=n.name),o!==void 0&&(r.value=o),r})}function vP(e){var n=new CP(e.options).setGraph(e.value);return e.nodes.forEach(function(o){n.setNode(o.v,o.value),o.parent&&n.setParent(o.v,o.parent)}),e.edges.forEach(function(o){n.setEdge({v:o.v,w:o.w,name:o.name},o.value)}),n}var AP=IP;function IP(e){var n={},o=[],r;function i(a){Object.hasOwn(n,a)||(n[a]=!0,r.push(a),e.successors(a).forEach(i),e.predecessors(a).forEach(i))}return e.nodes().forEach(function(a){r=[],i(a),r.length&&o.push(r)}),o}var Jp=class{constructor(){ot(this,"_arr",[]);ot(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var o=this._keyIndices[n];if(o!==void 0)return this._arr[o].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,o){var r=this._keyIndices;if(n=String(n),!Object.hasOwn(r,n)){var i=this._arr,a=i.length;return r[n]=a,i.push({key:n,priority:o}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,o){var r=this._keyIndices[n];if(o>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[r].priority+" New: "+o);this._arr[r].priority=o,this._decrease(r)}_heapify(n){var o=this._arr,r=2*n,i=r+1,a=n;r<o.length&&(a=o[r].priority<o[a].priority?r:a,i<o.length&&(a=o[i].priority<o[a].priority?i:a),a!==n&&(this._swap(n,a),this._heapify(a)))}_decrease(n){for(var o=this._arr,r=o[n].priority,i;n!==0&&(i=n>>1,!(o[i].priority<r));)this._swap(n,i),n=i}_swap(n,o){var r=this._arr,i=this._keyIndices,a=r[n],l=r[o];r[n]=l,r[o]=a,i[l.key]=n,i[a.key]=o}},TP=Jp,Qp=OP,PP=()=>1;function OP(e,n,o,r){return $P(e,String(n),o||PP,r||function(i){return e.outEdges(i)})}function $P(e,n,o,r){var i={},a=new TP,l,s,c=function(d){var f=d.v!==l?d.v:d.w,u=i[f],p=o(d),m=s.distance+p;if(p<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+d+" Weight: "+p);m<u.distance&&(u.distance=m,u.predecessor=l,a.decrease(f,m))};for(e.nodes().forEach(function(d){var f=d===n?0:Number.POSITIVE_INFINITY;i[d]={distance:f},a.add(d,f)});a.size()>0&&(l=a.removeMin(),s=i[l],s.distance!==Number.POSITIVE_INFINITY);)r(l).forEach(c);return i}var BP=Qp,VP=RP;function RP(e,n,o){return e.nodes().reduce(function(r,i){return r[i]=BP(e,i,n,o),r},{})}var em=DP;function DP(e){var n=0,o=[],r={},i=[];function a(l){var s=r[l]={onStack:!0,lowlink:n,index:n++};if(o.push(l),e.successors(l).forEach(function(f){Object.hasOwn(r,f)?r[f].onStack&&(s.lowlink=Math.min(s.lowlink,r[f].index)):(a(f),s.lowlink=Math.min(s.lowlink,r[f].lowlink))}),s.lowlink===s.index){var c=[],d;do d=o.pop(),r[d].onStack=!1,c.push(d);while(l!==d);i.push(c)}}return e.nodes().forEach(function(l){Object.hasOwn(r,l)||a(l)}),i}var MP=em,LP=FP;function FP(e){return MP(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})}var UP=jP,KP=()=>1;function jP(e,n,o){return GP(e,n||KP,o||function(r){return e.outEdges(r)})}function GP(e,n,o){var r={},i=e.nodes();return i.forEach(function(a){r[a]={},r[a][a]={distance:0},i.forEach(function(l){a!==l&&(r[a][l]={distance:Number.POSITIVE_INFINITY})}),o(a).forEach(function(l){var s=l.v===a?l.w:l.v,c=n(l);r[a][s]={distance:c,predecessor:a}})}),i.forEach(function(a){var l=r[a];i.forEach(function(s){var c=r[s];i.forEach(function(d){var f=c[a],u=l[d],p=c[d],m=f.distance+u.distance;m<p.distance&&(p.distance=m,p.predecessor=u.predecessor)})})}),r}function tm(e){var n={},o={},r=[];function i(a){if(Object.hasOwn(o,a))throw new fs;Object.hasOwn(n,a)||(o[a]=!0,n[a]=!0,e.predecessors(a).forEach(i),delete o[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(n).length!==e.nodeCount())throw new fs;return r}class fs extends Error{constructor(){super(...arguments)}}var nm=tm;tm.CycleException=fs;var om=nm,qP=zP;function zP(e){try{om(e)}catch(n){if(n instanceof om.CycleException)return!1;throw n}return!0}var rm=HP;function HP(e,n,o){Array.isArray(n)||(n=[n]);var r=e.isDirected()?s=>e.successors(s):s=>e.neighbors(s),i=o==="post"?YP:WP,a=[],l={};return n.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,l,a)}),a}function YP(e,n,o,r){for(var i=[[e,!1]];i.length>0;){var a=i.pop();a[1]?r.push(a[0]):Object.hasOwn(o,a[0])||(o[a[0]]=!0,i.push([a[0],!0]),im(n(a[0]),l=>i.push([l,!1])))}}function WP(e,n,o,r){for(var i=[e];i.length>0;){var a=i.pop();Object.hasOwn(o,a)||(o[a]=!0,r.push(a),im(n(a),l=>i.push(l)))}}function im(e,n){for(var o=e.length;o--;)n(e[o],o,e);return e}var XP=rm,ZP=JP;function JP(e,n){return XP(e,n,"post")}var QP=rm,eO=tO;function tO(e,n){return QP(e,n,"pre")}var nO=us,oO=Jp,rO=iO;function iO(e,n){var o=new nO,r={},i=new oO,a;function l(c){var d=c.v===a?c.w:c.v,f=i.priority(d);if(f!==void 0){var u=n(c);u<f&&(r[d]=a,i.decrease(d,u))}}if(e.nodeCount()===0)return o;e.nodes().forEach(function(c){i.add(c,Number.POSITIVE_INFINITY),o.setNode(c)}),i.decrease(e.nodes()[0],0);for(var s=!1;i.size()>0;){if(a=i.removeMin(),Object.hasOwn(r,a))o.setEdge(a,r[a]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(a).forEach(l)}return o}var aO={components:AP,dijkstra:Qp,dijkstraAll:VP,findCycles:LP,floydWarshall:UP,isAcyclic:qP,postorder:ZP,preorder:eO,prim:rO,tarjan:em,topsort:nm},am=kP,jt={Graph:am.Graph,json:EP,alg:aO,version:am.version};let lO=class{constructor(){let n={};n._next=n._prev=n,this._sentinel=n}dequeue(){let n=this._sentinel,o=n._prev;if(o!==n)return lm(o),o}enqueue(n){let o=this._sentinel;n._prev&&n._next&&lm(n),n._next=o._next,o._next._prev=n,o._next=n,n._prev=o}toString(){let n=[],o=this._sentinel,r=o._prev;for(;r!==o;)n.push(JSON.stringify(r,sO)),r=r._prev;return"["+n.join(", ")+"]"}};function lm(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function sO(e,n){if(e!=="_next"&&e!=="_prev")return n}var cO=lO;let dO=jt.Graph,uO=cO;var fO=mO;let pO=()=>1;function mO(e,n){if(e.nodeCount()<=1)return[];let o=hO(e,n||pO);return gO(o.graph,o.buckets,o.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function gO(e,n,o){let r=[],i=n[n.length-1],a=n[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)ps(e,n,o,l);for(;l=i.dequeue();)ps(e,n,o,l);if(e.nodeCount()){for(let s=n.length-2;s>0;--s)if(l=n[s].dequeue(),l){r=r.concat(ps(e,n,o,l,!0));break}}}return r}function ps(e,n,o,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(l=>{let s=e.edge(l),c=e.node(l.v);i&&a.push({v:l.v,w:l.w}),c.out-=s,ms(n,o,c)}),e.outEdges(r.v).forEach(l=>{let s=e.edge(l),c=l.w,d=e.node(c);d.in-=s,ms(n,o,d)}),e.removeNode(r.v),a}function hO(e,n){let o=new dO,r=0,i=0;e.nodes().forEach(s=>{o.setNode(s,{v:s,in:0,out:0})}),e.edges().forEach(s=>{let c=o.edge(s.v,s.w)||0,d=n(s),f=c+d;o.setEdge(s.v,s.w,f),i=Math.max(i,o.node(s.v).out+=d),r=Math.max(r,o.node(s.w).in+=d)});let a=yO(i+r+3).map(()=>new uO),l=r+1;return o.nodes().forEach(s=>{ms(a,l,o.node(s))}),{graph:o,buckets:a,zeroIdx:l}}function ms(e,n,o){o.out?o.in?e[o.out-o.in+n].enqueue(o):e[e.length-1].enqueue(o):e[0].enqueue(o)}function yO(e){const n=[];for(let o=0;o<e;o++)n.push(o);return n}let sm=jt.Graph;var tt={addBorderNode:xO,addDummyNode:cm,applyWithChunking:Yi,asNonCompoundGraph:bO,buildLayerMatrix:EO,intersectRect:CO,mapValues:$O,maxRank:um,normalizeRanks:NO,notime:TO,partition:AO,pick:OO,predecessorWeights:kO,range:pm,removeEmptyRanks:SO,simplify:_O,successorWeights:wO,time:IO,uniqueId:fm,zipObject:gs};function cm(e,n,o,r){for(var i=r;e.hasNode(i);)i=fm(r);return o.dummy=n,e.setNode(i,o),i}function _O(e){let n=new sm().setGraph(e.graph());return e.nodes().forEach(o=>n.setNode(o,e.node(o))),e.edges().forEach(o=>{let r=n.edge(o.v,o.w)||{weight:0,minlen:1},i=e.edge(o);n.setEdge(o.v,o.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),n}function bO(e){let n=new sm({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(o=>{e.children(o).length||n.setNode(o,e.node(o))}),e.edges().forEach(o=>{n.setEdge(o,e.edge(o))}),n}function wO(e){let n=e.nodes().map(o=>{let r={};return e.outEdges(o).forEach(i=>{r[i.w]=(r[i.w]||0)+e.edge(i).weight}),r});return gs(e.nodes(),n)}function kO(e){let n=e.nodes().map(o=>{let r={};return e.inEdges(o).forEach(i=>{r[i.v]=(r[i.v]||0)+e.edge(i).weight}),r});return gs(e.nodes(),n)}function CO(e,n){let o=e.x,r=e.y,i=n.x-o,a=n.y-r,l=e.width/2,s=e.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let c,d;return Math.abs(a)*l>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,d=s):(i<0&&(l=-l),c=l,d=l*a/i),{x:o+c,y:r+d}}function EO(e){let n=pm(um(e)+1).map(()=>[]);return e.nodes().forEach(o=>{let r=e.node(o),i=r.rank;i!==void 0&&(n[i][r.order]=o)}),n}function NO(e){let n=e.nodes().map(r=>{let i=e.node(r).rank;return i===void 0?Number.MAX_VALUE:i}),o=Yi(Math.min,n);e.nodes().forEach(r=>{let i=e.node(r);Object.hasOwn(i,"rank")&&(i.rank-=o)})}function SO(e){let n=e.nodes().map(l=>e.node(l).rank),o=Yi(Math.min,n),r=[];e.nodes().forEach(l=>{let s=e.node(l).rank-o;r[s]||(r[s]=[]),r[s].push(l)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((l,s)=>{l===void 0&&s%a!==0?--i:l!==void 0&&i&&l.forEach(c=>e.node(c).rank+=i)})}function xO(e,n,o,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=o,i.order=r),cm(e,"border",i,n)}function vO(e,n=dm){const o=[];for(let r=0;r<e.length;r+=n){const i=e.slice(r,r+n);o.push(i)}return o}const dm=65535;function Yi(e,n){if(n.length>dm){const o=vO(n);return e.apply(null,o.map(r=>e.apply(null,r)))}else return e.apply(null,n)}function um(e){const o=e.nodes().map(r=>{let i=e.node(r).rank;return i===void 0?Number.MIN_VALUE:i});return Yi(Math.max,o)}function AO(e,n){let o={lhs:[],rhs:[]};return e.forEach(r=>{n(r)?o.lhs.push(r):o.rhs.push(r)}),o}function IO(e,n){let o=Date.now();try{return n()}finally{console.log(e+" time: "+(Date.now()-o)+"ms")}}function TO(e,n){return n()}let PO=0;function fm(e){var n=++PO;return e+(""+n)}function pm(e,n,o=1){n==null&&(n=e,e=0);let r=a=>a<n;o<0&&(r=a=>n<a);const i=[];for(let a=e;r(a);a+=o)i.push(a);return i}function OO(e,n){const o={};for(const r of n)e[r]!==void 0&&(o[r]=e[r]);return o}function $O(e,n){let o=n;return typeof n=="string"&&(o=r=>r[n]),Object.entries(e).reduce((r,[i,a])=>(r[i]=o(a,i),r),{})}function gs(e,n){return e.reduce((o,r,i)=>(o[r]=n[i],o),{})}let BO=fO,VO=tt.uniqueId;var RO={run:DO,undo:LO};function DO(e){(e.graph().acyclicer==="greedy"?BO(e,o(e)):MO(e)).forEach(r=>{let i=e.edge(r);e.removeEdge(r),i.forwardName=r.name,i.reversed=!0,e.setEdge(r.w,r.v,i,VO("rev"))});function o(r){return i=>r.edge(i).weight}}function MO(e){let n=[],o={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,o[a]=!0,e.outEdges(a).forEach(l=>{Object.hasOwn(o,l.w)?n.push(l):i(l.w)}),delete o[a])}return e.nodes().forEach(i),n}function LO(e){e.edges().forEach(n=>{let o=e.edge(n);if(o.reversed){e.removeEdge(n);let r=o.forwardName;delete o.reversed,delete o.forwardName,e.setEdge(n.w,n.v,o,r)}})}let FO=tt;var UO={run:KO,undo:GO};function KO(e){e.graph().dummyChains=[],e.edges().forEach(n=>jO(e,n))}function jO(e,n){let o=n.v,r=e.node(o).rank,i=n.w,a=e.node(i).rank,l=n.name,s=e.edge(n),c=s.labelRank;if(a===r+1)return;e.removeEdge(n);let d,f,u;for(u=0,++r;r<a;++u,++r)s.points=[],f={width:0,height:0,edgeLabel:s,edgeObj:n,rank:r},d=FO.addDummyNode(e,"edge",f,"_d"),r===c&&(f.width=s.width,f.height=s.height,f.dummy="edge-label",f.labelpos=s.labelpos),e.setEdge(o,d,{weight:s.weight},l),u===0&&e.graph().dummyChains.push(d),o=d;e.setEdge(o,i,{weight:s.weight},l)}function GO(e){e.graph().dummyChains.forEach(n=>{let o=e.node(n),r=o.edgeLabel,i;for(e.setEdge(o.edgeObj,r);o.dummy;)i=e.successors(n)[0],e.removeNode(n),r.points.push({x:o.x,y:o.y}),o.dummy==="edge-label"&&(r.x=o.x,r.y=o.y,r.width=o.width,r.height=o.height),n=i,o=e.node(n)})}const{applyWithChunking:qO}=tt;var Wi={longestPath:zO,slack:HO};function zO(e){var n={};function o(r){var i=e.node(r);if(Object.hasOwn(n,r))return i.rank;n[r]=!0;let a=e.outEdges(r).map(s=>s==null?Number.POSITIVE_INFINITY:o(s.w)-e.edge(s).minlen);var l=qO(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(o)}function HO(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}var YO=jt.Graph,Xi=Wi.slack,mm=WO;function WO(e){var n=new YO({directed:!1}),o=e.nodes()[0],r=e.nodeCount();n.setNode(o,{});for(var i,a;XO(n,e)<r;)i=ZO(n,e),a=n.hasNode(i.v)?Xi(e,i):-Xi(e,i),JO(n,e,a);return n}function XO(e,n){function o(r){n.nodeEdges(r).forEach(i=>{var a=i.v,l=r===a?i.w:a;!e.hasNode(l)&&!Xi(n,i)&&(e.setNode(l,{}),e.setEdge(r,l,{}),o(l))})}return e.nodes().forEach(o),e.nodeCount()}function ZO(e,n){return n.edges().reduce((r,i)=>{let a=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=Xi(n,i)),a<r[0]?[a,i]:r},[Number.POSITIVE_INFINITY,null])[1]}function JO(e,n,o){e.nodes().forEach(r=>n.node(r).rank+=o)}var QO=mm,gm=Wi.slack,e$=Wi.longestPath,t$=jt.alg.preorder,n$=jt.alg.postorder,o$=tt.simplify,r$=Zn;Zn.initLowLimValues=ys,Zn.initCutValues=hs,Zn.calcCutValue=hm,Zn.leaveEdge=_m,Zn.enterEdge=bm,Zn.exchangeEdges=wm;function Zn(e){e=o$(e),e$(e);var n=QO(e);ys(n),hs(n,e);for(var o,r;o=_m(n);)r=bm(n,e,o),wm(n,e,o,r)}function hs(e,n){var o=n$(e,e.nodes());o=o.slice(0,o.length-1),o.forEach(r=>i$(e,n,r))}function i$(e,n,o){var r=e.node(o),i=r.parent;e.edge(o,i).cutvalue=hm(e,n,o)}function hm(e,n,o){var r=e.node(o),i=r.parent,a=!0,l=n.edge(o,i),s=0;return l||(a=!1,l=n.edge(i,o)),s=l.weight,n.nodeEdges(o).forEach(c=>{var d=c.v===o,f=d?c.w:c.v;if(f!==i){var u=d===a,p=n.edge(c).weight;if(s+=u?p:-p,l$(e,o,f)){var m=e.edge(o,f).cutvalue;s+=u?-m:m}}}),s}function ys(e,n){arguments.length<2&&(n=e.nodes()[0]),ym(e,{},1,n)}function ym(e,n,o,r,i){var a=o,l=e.node(r);return n[r]=!0,e.neighbors(r).forEach(s=>{Object.hasOwn(n,s)||(o=ym(e,n,o,s,r))}),l.low=a,l.lim=o++,i?l.parent=i:delete l.parent,o}function _m(e){return e.edges().find(n=>e.edge(n).cutvalue<0)}function bm(e,n,o){var r=o.v,i=o.w;n.hasEdge(r,i)||(r=o.w,i=o.v);var a=e.node(r),l=e.node(i),s=a,c=!1;a.lim>l.lim&&(s=l,c=!0);var d=n.edges().filter(f=>c===km(e,e.node(f.v),s)&&c!==km(e,e.node(f.w),s));return d.reduce((f,u)=>gm(n,u)<gm(n,f)?u:f)}function wm(e,n,o,r){var i=o.v,a=o.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),ys(e),hs(e,n),a$(e,n)}function a$(e,n){var o=e.nodes().find(i=>!n.node(i).parent),r=t$(e,o);r=r.slice(1),r.forEach(i=>{var a=e.node(i).parent,l=n.edge(i,a),s=!1;l||(l=n.edge(a,i),s=!0),n.node(i).rank=n.node(a).rank+(s?l.minlen:-l.minlen)})}function l$(e,n,o){return e.hasEdge(n,o)}function km(e,n,o){return o.low<=n.lim&&n.lim<=o.lim}var s$=Wi,Cm=s$.longestPath,c$=mm,d$=r$,u$=f$;function f$(e){var n=e.graph().ranker;if(n instanceof Function)return n(e);switch(e.graph().ranker){case"network-simplex":Em(e);break;case"tight-tree":m$(e);break;case"longest-path":p$(e);break;case"none":break;default:Em(e)}}var p$=Cm;function m$(e){Cm(e),c$(e)}function Em(e){d$(e)}var g$=h$;function h$(e){let n=_$(e);e.graph().dummyChains.forEach(o=>{let r=e.node(o),i=r.edgeObj,a=y$(e,n,i.v,i.w),l=a.path,s=a.lca,c=0,d=l[c],f=!0;for(;o!==i.w;){if(r=e.node(o),f){for(;(d=l[c])!==s&&e.node(d).maxRank<r.rank;)c++;d===s&&(f=!1)}if(!f){for(;c<l.length-1&&e.node(d=l[c+1]).minRank<=r.rank;)c++;d=l[c]}e.setParent(o,d),o=e.successors(o)[0]}})}function y$(e,n,o,r){let i=[],a=[],l=Math.min(n[o].low,n[r].low),s=Math.max(n[o].lim,n[r].lim),c,d;c=o;do c=e.parent(c),i.push(c);while(c&&(n[c].low>l||s>n[c].lim));for(d=c,c=r;(c=e.parent(c))!==d;)a.push(c);return{path:i.concat(a.reverse()),lca:d}}function _$(e){let n={},o=0;function r(i){let a=o;e.children(i).forEach(r),n[i]={low:a,lim:o++}}return e.children().forEach(r),n}let Zi=tt;var b$={run:w$,cleanup:E$};function w$(e){let n=Zi.addDummyNode(e,"root",{},"_root"),o=k$(e),r=Object.values(o),i=Zi.applyWithChunking(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=n,e.edges().forEach(s=>e.edge(s).minlen*=a);let l=C$(e)+1;e.children().forEach(s=>Nm(e,n,a,l,i,o,s)),e.graph().nodeRankFactor=a}function Nm(e,n,o,r,i,a,l){let s=e.children(l);if(!s.length){l!==n&&e.setEdge(n,l,{weight:0,minlen:o});return}let c=Zi.addBorderNode(e,"_bt"),d=Zi.addBorderNode(e,"_bb"),f=e.node(l);e.setParent(c,l),f.borderTop=c,e.setParent(d,l),f.borderBottom=d,s.forEach(u=>{Nm(e,n,o,r,i,a,u);let p=e.node(u),m=p.borderTop?p.borderTop:u,y=p.borderBottom?p.borderBottom:u,_=p.borderTop?r:2*r,g=m!==y?1:i-a[l]+1;e.setEdge(c,m,{weight:_,minlen:g,nestingEdge:!0}),e.setEdge(y,d,{weight:_,minlen:g,nestingEdge:!0})}),e.parent(l)||e.setEdge(n,c,{weight:0,minlen:i+a[l]})}function k$(e){var n={};function o(r,i){var a=e.children(r);a&&a.length&&a.forEach(l=>o(l,i+1)),n[r]=i}return e.children().forEach(r=>o(r,1)),n}function C$(e){return e.edges().reduce((n,o)=>n+e.edge(o).weight,0)}function E$(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,e.edges().forEach(o=>{var r=e.edge(o);r.nestingEdge&&e.removeEdge(o)})}let N$=tt;var S$=x$;function x$(e){function n(o){let r=e.children(o),i=e.node(o);if(r.length&&r.forEach(n),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let a=i.minRank,l=i.maxRank+1;a<l;++a)Sm(e,"borderLeft","_bl",o,i,a),Sm(e,"borderRight","_br",o,i,a)}}e.children().forEach(n)}function Sm(e,n,o,r,i,a){let l={width:0,height:0,rank:a,borderType:n},s=i[n][a-1],c=N$.addDummyNode(e,"border",l,o);i[n][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}var v$={adjust:A$,undo:I$};function A$(e){let n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&xm(e)}function I$(e){let n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&T$(e),(n==="lr"||n==="rl")&&(P$(e),xm(e))}function xm(e){e.nodes().forEach(n=>vm(e.node(n))),e.edges().forEach(n=>vm(e.edge(n)))}function vm(e){let n=e.width;e.width=e.height,e.height=n}function T$(e){e.nodes().forEach(n=>_s(e.node(n))),e.edges().forEach(n=>{let o=e.edge(n);o.points.forEach(_s),Object.hasOwn(o,"y")&&_s(o)})}function _s(e){e.y=-e.y}function P$(e){e.nodes().forEach(n=>bs(e.node(n))),e.edges().forEach(n=>{let o=e.edge(n);o.points.forEach(bs),Object.hasOwn(o,"x")&&bs(o)})}function bs(e){let n=e.x;e.x=e.y,e.y=n}let Am=tt;var O$=$$;function $$(e){let n={},o=e.nodes().filter(c=>!e.children(c).length),r=o.map(c=>e.node(c).rank),i=Am.applyWithChunking(Math.max,r),a=Am.range(i+1).map(()=>[]);function l(c){if(n[c])return;n[c]=!0;let d=e.node(c);a[d.rank].push(c),e.successors(c).forEach(l)}return o.sort((c,d)=>e.node(c).rank-e.node(d).rank).forEach(l),a}let B$=tt.zipObject;var V$=R$;function R$(e,n){let o=0;for(let r=1;r<n.length;++r)o+=D$(e,n[r-1],n[r]);return o}function D$(e,n,o){let r=B$(o,o.map((d,f)=>f)),i=n.flatMap(d=>e.outEdges(d).map(f=>({pos:r[f.w],weight:e.edge(f).weight})).sort((f,u)=>f.pos-u.pos)),a=1;for(;a<o.length;)a<<=1;let l=2*a-1;a-=1;let s=new Array(l).fill(0),c=0;return i.forEach(d=>{let f=d.pos+a;s[f]+=d.weight;let u=0;for(;f>0;)f%2&&(u+=s[f+1]),f=f-1>>1,s[f]+=d.weight;c+=d.weight*u}),c}var M$=L$;function L$(e,n=[]){return n.map(o=>{let r=e.inEdges(o);if(r.length){let i=r.reduce((a,l)=>{let s=e.edge(l),c=e.node(l.v);return{sum:a.sum+s.weight*c.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:o,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:o}})}let F$=tt;var U$=K$;function K$(e,n){let o={};e.forEach((i,a)=>{let l=o[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};i.barycenter!==void 0&&(l.barycenter=i.barycenter,l.weight=i.weight)}),n.edges().forEach(i=>{let a=o[i.v],l=o[i.w];a!==void 0&&l!==void 0&&(l.indegree++,a.out.push(o[i.w]))});let r=Object.values(o).filter(i=>!i.indegree);return j$(r)}function j$(e){let n=[];function o(i){return a=>{a.merged||(a.barycenter===void 0||i.barycenter===void 0||a.barycenter>=i.barycenter)&&G$(i,a)}}function r(i){return a=>{a.in.push(i),--a.indegree===0&&e.push(a)}}for(;e.length;){let i=e.pop();n.push(i),i.in.reverse().forEach(o(i)),i.out.forEach(r(i))}return n.filter(i=>!i.merged).map(i=>F$.pick(i,["vs","i","barycenter","weight"]))}function G$(e,n){let o=0,r=0;e.weight&&(o+=e.barycenter*e.weight,r+=e.weight),n.weight&&(o+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=o/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}let q$=tt;var z$=H$;function H$(e,n){let o=q$.partition(e,f=>Object.hasOwn(f,"barycenter")),r=o.lhs,i=o.rhs.sort((f,u)=>u.i-f.i),a=[],l=0,s=0,c=0;r.sort(Y$(!!n)),c=Im(a,i,c),r.forEach(f=>{c+=f.vs.length,a.push(f.vs),l+=f.barycenter*f.weight,s+=f.weight,c=Im(a,i,c)});let d={vs:a.flat(!0)};return s&&(d.barycenter=l/s,d.weight=s),d}function Im(e,n,o){let r;for(;n.length&&(r=n[n.length-1]).i<=o;)n.pop(),e.push(r.vs),o++;return o}function Y$(e){return(n,o)=>n.barycenter<o.barycenter?-1:n.barycenter>o.barycenter?1:e?o.i-n.i:n.i-o.i}let W$=M$,X$=U$,Z$=z$;var J$=Tm;function Tm(e,n,o,r){let i=e.children(n),a=e.node(n),l=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};l&&(i=i.filter(p=>p!==l&&p!==s));let d=W$(e,i);d.forEach(p=>{if(e.children(p.v).length){let m=Tm(e,p.v,o,r);c[p.v]=m,Object.hasOwn(m,"barycenter")&&eB(p,m)}});let f=X$(d,o);Q$(f,c);let u=Z$(f,r);if(l&&(u.vs=[l,u.vs,s].flat(!0),e.predecessors(l).length)){let p=e.node(e.predecessors(l)[0]),m=e.node(e.predecessors(s)[0]);Object.hasOwn(u,"barycenter")||(u.barycenter=0,u.weight=0),u.barycenter=(u.barycenter*u.weight+p.order+m.order)/(u.weight+2),u.weight+=2}return u}function Q$(e,n){e.forEach(o=>{o.vs=o.vs.flatMap(r=>n[r]?n[r].vs:r)})}function eB(e,n){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight):(e.barycenter=n.barycenter,e.weight=n.weight)}let tB=jt.Graph,nB=tt;var oB=rB;function rB(e,n,o){let r=iB(e),i=new tB({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(a=>e.node(a));return e.nodes().forEach(a=>{let l=e.node(a),s=e.parent(a);(l.rank===n||l.minRank<=n&&n<=l.maxRank)&&(i.setNode(a),i.setParent(a,s||r),e[o](a).forEach(c=>{let d=c.v===a?c.w:c.v,f=i.edge(d,a),u=f!==void 0?f.weight:0;i.setEdge(d,a,{weight:e.edge(c).weight+u})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[n],borderRight:l.borderRight[n]}))}),i}function iB(e){for(var n;e.hasNode(n=nB.uniqueId("_root")););return n}var aB=lB;function lB(e,n,o){let r={},i;o.forEach(a=>{let l=e.parent(a),s,c;for(;l;){if(s=e.parent(l),s?(c=r[s],r[s]=l):(c=i,i=l),c&&c!==l){n.setEdge(c,l);return}l=s}})}let sB=O$,cB=V$,dB=J$,uB=oB,fB=aB,pB=jt.Graph,Ji=tt;var mB=Pm;function Pm(e,n){if(n&&typeof n.customOrder=="function"){n.customOrder(e,Pm);return}let o=Ji.maxRank(e),r=Om(e,Ji.range(1,o+1),"inEdges"),i=Om(e,Ji.range(o-1,-1,-1),"outEdges"),a=sB(e);if($m(e,a),n&&n.disableOptimalOrderHeuristic)return;let l=Number.POSITIVE_INFINITY,s;for(let c=0,d=0;d<4;++c,++d){gB(c%2?r:i,c%4>=2),a=Ji.buildLayerMatrix(e);let f=cB(e,a);f<l&&(d=0,s=Object.assign({},a),l=f)}$m(e,s)}function Om(e,n,o){return n.map(function(r){return uB(e,r,o)})}function gB(e,n){let o=new pB;e.forEach(function(r){let i=r.graph().root,a=dB(r,i,o,n);a.vs.forEach((l,s)=>r.node(l).order=s),fB(r,o,a.vs)})}function $m(e,n){Object.values(n).forEach(o=>o.forEach((r,i)=>e.node(r).order=i))}let hB=jt.Graph,pn=tt;var yB={positionX:AB};function _B(e,n){let o={};function r(i,a){let l=0,s=0,c=i.length,d=a[a.length-1];return a.forEach((f,u)=>{let p=wB(e,f),m=p?e.node(p).order:c;(p||f===d)&&(a.slice(s,u+1).forEach(y=>{e.predecessors(y).forEach(_=>{let g=e.node(_),h=g.order;(h<l||m<h)&&!(g.dummy&&e.node(y).dummy)&&Bm(o,_,y)})}),s=u+1,l=m)}),a}return n.length&&n.reduce(r),o}function bB(e,n){let o={};function r(a,l,s,c,d){let f;pn.range(l,s).forEach(u=>{f=a[u],e.node(f).dummy&&e.predecessors(f).forEach(p=>{let m=e.node(p);m.dummy&&(m.order<c||m.order>d)&&Bm(o,p,f)})})}function i(a,l){let s=-1,c,d=0;return l.forEach((f,u)=>{if(e.node(f).dummy==="border"){let p=e.predecessors(f);p.length&&(c=e.node(p[0]).order,r(l,d,u,s,c),d=u,s=c)}r(l,d,l.length,c,a.length)}),l}return n.length&&n.reduce(i),o}function wB(e,n){if(e.node(n).dummy)return e.predecessors(n).find(o=>e.node(o).dummy)}function Bm(e,n,o){if(n>o){let i=n;n=o,o=i}let r=e[n];r||(e[n]=r={}),r[o]=!0}function kB(e,n,o){if(n>o){let r=n;n=o,o=r}return!!e[n]&&Object.hasOwn(e[n],o)}function CB(e,n,o,r){let i={},a={},l={};return n.forEach(s=>{s.forEach((c,d)=>{i[c]=c,a[c]=c,l[c]=d})}),n.forEach(s=>{let c=-1;s.forEach(d=>{let f=r(d);if(f.length){f=f.sort((p,m)=>l[p]-l[m]);let u=(f.length-1)/2;for(let p=Math.floor(u),m=Math.ceil(u);p<=m;++p){let y=f[p];a[d]===d&&c<l[y]&&!kB(o,d,y)&&(a[y]=d,a[d]=i[d]=i[y],c=l[y])}}})}),{root:i,align:a}}function EB(e,n,o,r,i){let a={},l=NB(e,n,o,i),s=i?"borderLeft":"borderRight";function c(u,p){let m=l.nodes(),y=m.pop(),_={};for(;y;)_[y]?u(y):(_[y]=!0,m.push(y),m=m.concat(p(y))),y=m.pop()}function d(u){a[u]=l.inEdges(u).reduce((p,m)=>Math.max(p,a[m.v]+l.edge(m)),0)}function f(u){let p=l.outEdges(u).reduce((y,_)=>Math.min(y,a[_.w]-l.edge(_)),Number.POSITIVE_INFINITY),m=e.node(u);p!==Number.POSITIVE_INFINITY&&m.borderType!==s&&(a[u]=Math.max(a[u],p))}return c(d,l.predecessors.bind(l)),c(f,l.successors.bind(l)),Object.keys(r).forEach(u=>a[u]=a[o[u]]),a}function NB(e,n,o,r){let i=new hB,a=e.graph(),l=IB(a.nodesep,a.edgesep,r);return n.forEach(s=>{let c;s.forEach(d=>{let f=o[d];if(i.setNode(f),c){var u=o[c],p=i.edge(u,f);i.setEdge(u,f,Math.max(l(e,d,c),p||0))}c=d})}),i}function SB(e,n){return Object.values(n).reduce((o,r)=>{let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([s,c])=>{let d=TB(e,s)/2;i=Math.max(c+d,i),a=Math.min(c-d,a)});const l=i-a;return l<o[0]&&(o=[l,r]),o},[Number.POSITIVE_INFINITY,null])[1]}function xB(e,n){let o=Object.values(n),r=pn.applyWithChunking(Math.min,o),i=pn.applyWithChunking(Math.max,o);["u","d"].forEach(a=>{["l","r"].forEach(l=>{let s=a+l,c=e[s];if(c===n)return;let d=Object.values(c),f=r-pn.applyWithChunking(Math.min,d);l!=="l"&&(f=i-pn.applyWithChunking(Math.max,d)),f&&(e[s]=pn.mapValues(c,u=>u+f))})})}function vB(e,n){return pn.mapValues(e.ul,(o,r)=>{if(n)return e[n.toLowerCase()][r];{let i=Object.values(e).map(a=>a[r]).sort((a,l)=>a-l);return(i[1]+i[2])/2}})}function AB(e){let n=pn.buildLayerMatrix(e),o=Object.assign(_B(e,n),bB(e,n)),r={},i;["u","d"].forEach(l=>{i=l==="u"?n:Object.values(n).reverse(),["l","r"].forEach(s=>{s==="r"&&(i=i.map(u=>Object.values(u).reverse()));let c=(l==="u"?e.predecessors:e.successors).bind(e),d=CB(e,i,o,c),f=EB(e,i,d.root,d.align,s==="r");s==="r"&&(f=pn.mapValues(f,u=>-u)),r[l+s]=f})});let a=SB(e,r);return xB(r,a),vB(r,e.graph().align)}function IB(e,n,o){return(r,i,a)=>{let l=r.node(i),s=r.node(a),c=0,d;if(c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":d=-l.width/2;break;case"r":d=l.width/2;break}if(d&&(c+=o?d:-d),d=0,c+=(l.dummy?n:e)/2,c+=(s.dummy?n:e)/2,c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":d=s.width/2;break;case"r":d=-s.width/2;break}return d&&(c+=o?d:-d),d=0,c}}function TB(e,n){return e.node(n).width}let Vm=tt,PB=yB.positionX;var OB=$B;function $B(e){e=Vm.asNonCompoundGraph(e),BB(e),Object.entries(PB(e)).forEach(([n,o])=>e.node(n).x=o)}function BB(e){let n=Vm.buildLayerMatrix(e),o=e.graph().ranksep,r=0;n.forEach(i=>{const a=i.reduce((l,s)=>{const c=e.node(s).height;return l>c?l:c},0);i.forEach(l=>e.node(l).y=r+a/2),r+=a+o})}let Rm=RO,Dm=UO,VB=u$,RB=tt.normalizeRanks,DB=g$,MB=tt.removeEmptyRanks,Mm=b$,LB=S$,Lm=v$,FB=mB,UB=OB,Rt=tt,KB=jt.Graph;var jB=GB;function GB(e,n){let o=n&&n.debugTiming?Rt.time:Rt.notime;o("layout",()=>{let r=o(" buildLayoutGraph",()=>eV(e));o(" runLayout",()=>qB(r,o,n)),o(" updateInputGraph",()=>zB(e,r))})}function qB(e,n,o){n(" makeSpaceForEdgeLabels",()=>tV(e)),n(" removeSelfEdges",()=>dV(e)),n(" acyclic",()=>Rm.run(e)),n(" nestingGraph.run",()=>Mm.run(e)),n(" rank",()=>VB(Rt.asNonCompoundGraph(e))),n(" injectEdgeLabelProxies",()=>nV(e)),n(" removeEmptyRanks",()=>MB(e)),n(" nestingGraph.cleanup",()=>Mm.cleanup(e)),n(" normalizeRanks",()=>RB(e)),n(" assignRankMinMax",()=>oV(e)),n(" removeEdgeLabelProxies",()=>rV(e)),n(" normalize.run",()=>Dm.run(e)),n(" parentDummyChains",()=>DB(e)),n(" addBorderSegments",()=>LB(e)),n(" order",()=>FB(e,o)),n(" insertSelfEdges",()=>uV(e)),n(" adjustCoordinateSystem",()=>Lm.adjust(e)),n(" position",()=>UB(e)),n(" positionSelfEdges",()=>fV(e)),n(" removeBorderNodes",()=>cV(e)),n(" normalize.undo",()=>Dm.undo(e)),n(" fixupEdgeLabelCoords",()=>lV(e)),n(" undoCoordinateSystem",()=>Lm.undo(e)),n(" translateGraph",()=>iV(e)),n(" assignNodeIntersects",()=>aV(e)),n(" reversePoints",()=>sV(e)),n(" acyclic.undo",()=>Rm.undo(e))}function zB(e,n){e.nodes().forEach(o=>{let r=e.node(o),i=n.node(o);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,n.children(o).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(o=>{let r=e.edge(o),i=n.edge(o);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}let HB=["nodesep","edgesep","ranksep","marginx","marginy"],YB={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},WB=["acyclicer","ranker","rankdir","align"],XB=["width","height","rank"],Fm={width:0,height:0},ZB=["minlen","weight","width","height","labeloffset"],JB={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},QB=["labelpos"];function eV(e){let n=new KB({multigraph:!0,compound:!0}),o=ks(e.graph());return n.setGraph(Object.assign({},YB,ws(o,HB),Rt.pick(o,WB))),e.nodes().forEach(r=>{let i=ks(e.node(r));const a=ws(i,XB);Object.keys(Fm).forEach(l=>{a[l]===void 0&&(a[l]=Fm[l])}),n.setNode(r,a),n.setParent(r,e.parent(r))}),e.edges().forEach(r=>{let i=ks(e.edge(r));n.setEdge(r,Object.assign({},JB,ws(i,ZB),Rt.pick(i,QB)))}),n}function tV(e){let n=e.graph();n.ranksep/=2,e.edges().forEach(o=>{let r=e.edge(o);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function nV(e){e.edges().forEach(n=>{let o=e.edge(n);if(o.width&&o.height){let r=e.node(n.v),a={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};Rt.addDummyNode(e,"edge-proxy",a,"_ep")}})}function oV(e){let n=0;e.nodes().forEach(o=>{let r=e.node(o);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Math.max(n,r.maxRank))}),e.graph().maxRank=n}function rV(e){e.nodes().forEach(n=>{let o=e.node(n);o.dummy==="edge-proxy"&&(e.edge(o.e).labelRank=o.rank,e.removeNode(n))})}function iV(e){let n=Number.POSITIVE_INFINITY,o=0,r=Number.POSITIVE_INFINITY,i=0,a=e.graph(),l=a.marginx||0,s=a.marginy||0;function c(d){let f=d.x,u=d.y,p=d.width,m=d.height;n=Math.min(n,f-p/2),o=Math.max(o,f+p/2),r=Math.min(r,u-m/2),i=Math.max(i,u+m/2)}e.nodes().forEach(d=>c(e.node(d))),e.edges().forEach(d=>{let f=e.edge(d);Object.hasOwn(f,"x")&&c(f)}),n-=l,r-=s,e.nodes().forEach(d=>{let f=e.node(d);f.x-=n,f.y-=r}),e.edges().forEach(d=>{let f=e.edge(d);f.points.forEach(u=>{u.x-=n,u.y-=r}),Object.hasOwn(f,"x")&&(f.x-=n),Object.hasOwn(f,"y")&&(f.y-=r)}),a.width=o-n+l,a.height=i-r+s}function aV(e){e.edges().forEach(n=>{let o=e.edge(n),r=e.node(n.v),i=e.node(n.w),a,l;o.points?(a=o.points[0],l=o.points[o.points.length-1]):(o.points=[],a=i,l=r),o.points.unshift(Rt.intersectRect(r,a)),o.points.push(Rt.intersectRect(i,l))})}function lV(e){e.edges().forEach(n=>{let o=e.edge(n);if(Object.hasOwn(o,"x"))switch((o.labelpos==="l"||o.labelpos==="r")&&(o.width-=o.labeloffset),o.labelpos){case"l":o.x-=o.width/2+o.labeloffset;break;case"r":o.x+=o.width/2+o.labeloffset;break}})}function sV(e){e.edges().forEach(n=>{let o=e.edge(n);o.reversed&&o.points.reverse()})}function cV(e){e.nodes().forEach(n=>{if(e.children(n).length){let o=e.node(n),r=e.node(o.borderTop),i=e.node(o.borderBottom),a=e.node(o.borderLeft[o.borderLeft.length-1]),l=e.node(o.borderRight[o.borderRight.length-1]);o.width=Math.abs(l.x-a.x),o.height=Math.abs(i.y-r.y),o.x=a.x+o.width/2,o.y=r.y+o.height/2}}),e.nodes().forEach(n=>{e.node(n).dummy==="border"&&e.removeNode(n)})}function dV(e){e.edges().forEach(n=>{if(n.v===n.w){var o=e.node(n.v);o.selfEdges||(o.selfEdges=[]),o.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function uV(e){var n=Rt.buildLayerMatrix(e);n.forEach(o=>{var r=0;o.forEach((i,a)=>{var l=e.node(i);l.order=a+r,(l.selfEdges||[]).forEach(s=>{Rt.addDummyNode(e,"selfedge",{width:s.label.width,height:s.label.height,rank:l.rank,order:a+ ++r,e:s.e,label:s.label},"_se")}),delete l.selfEdges})})}function fV(e){e.nodes().forEach(n=>{var o=e.node(n);if(o.dummy==="selfedge"){var r=e.node(o.e.v),i=r.x+r.width/2,a=r.y,l=o.x-i,s=r.height/2;e.setEdge(o.e,o.label),e.removeNode(n),o.label.points=[{x:i+2*l/3,y:a-s},{x:i+5*l/6,y:a-s},{x:i+l,y:a},{x:i+5*l/6,y:a+s},{x:i+2*l/3,y:a+s}],o.label.x=o.x,o.label.y=o.y}})}function ws(e,n){return Rt.mapValues(Rt.pick(e,n),Number)}function ks(e){var n={};return e&&Object.entries(e).forEach(([o,r])=>{typeof o=="string"&&(o=o.toLowerCase()),n[o]=r}),n}let pV=tt,mV=jt.Graph;var gV={debugOrdering:hV};function hV(e){let n=pV.buildLayerMatrix(e),o=new mV({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{o.setNode(r,{label:r}),o.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>o.setEdge(r.v,r.w,{},r.name)),n.forEach((r,i)=>{let a="layer"+i;o.setNode(a,{rank:"same"}),r.reduce((l,s)=>(o.setEdge(l,s,{style:"invis"}),s))}),o}var yV="1.1.5",_V={graphlib:jt,layout:jB,debug:gV,util:{time:tt.time,notime:tt.notime},version:yV};const Um=hP(_V);function Km(){const e=(...o)=>{console.warn("TOASTER_PROVIDER is not provided",...o)},n=t.inject(nd,e);return o=>n(o)}function Qi(e,n,o){const r=n?bn(e,o,n):void 0;return`${e.name}${r?`.${r.name}`:""}`}function xr(e,n){const o=n(e.source),r=n(e.target);return[Qi(o,e.sourceField,"output"),Qi(r,e.targetField,"input")]}function Cs(e,n,o,r,i){const a=i(e),l=i(o);return[Qi(a,n,"output"),Qi(l,r,"input")]}function jm(e){if(e.length===0)throw new Error("getBoundingRect requires at least one rect");let n=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const{x:a,y:l,width:s,height:c}of e){if(![a,l,s,c].every(Number.isFinite))throw new Error("Rect values must be finite numbers");if(s<0||c<0)throw new RangeError("Rect width and height must be non-negative");const d=a+s,f=l+c;if(!Number.isFinite(d)||!Number.isFinite(f))throw new RangeError("Rect boundaries must be finite numbers");a<n&&(n=a),l<o&&(o=l),d>r&&(r=d),f>i&&(i=f)}return{x:n,y:o,width:r-n,height:i-o}}function bV({phase:e,readonly:n,flowId:o}){const{findNode:r}=Le(o),i=at(),{state:a,groupMapById:l,getNodeById:s,moveNode:c,moveGroup:d,setGroupLayout:f,commit:u,branchGroups:p}=i,{memberGroupMap:m,groupsByOwner:y,getNodeDepth:_,getGroupDepth:g}=p,h=t.ref(),w=O=>!!O&&O.startsWith("branch:");function b(O){const P=[];for(const T of O.memberIds){const M=s(T);M&&P.push(M)}return P}const x=t.computed(()=>{const O=new Map;return m.value.forEach((P,T)=>{if(P.phase!==e||!P.position)return;const M=s(T);M&&(M.phase!==e||M.hidden||O.set(T,P))}),O}),E=t.computed(()=>{const O=new Map;return y.value.forEach((P,T)=>{const M=P.filter(Y=>Y.phase===e);M.length>0&&O.set(T,M)}),O}),C=t.computed(()=>{const O=[];for(const P of a.value.groups){const T=s(P.ownerId);if(!T||T.phase!==e)continue;const M=P.position,Y=P.dimensions;if(!M||!Y)continue;const z=b(P).filter(Z=>Z.phase===e&&!Z.hidden),H=g(P.id);O.push({id:P.id,type:"group",position:M,width:Y.width,height:Y.height,data:{...P,memberIds:z.map(Z=>Z.id)},draggable:!n,selectable:!1,zIndex:H*qi+sP})}return O}),N=t.computed(()=>{let O=0;for(const P of a.value.groups){if(P.phase!==e)continue;const T=g(P.id);T>O&&(O=T)}return O}),S=t.computed(()=>{const O=[];for(const P of a.value.groups){if(P.phase!==e||!P.position||!P.dimensions)continue;const T=s(P.ownerId);if(!T||T.phase!==e||T.hidden||!b(P).filter(H=>H.phase===e&&!H.hidden).length)continue;const Y=Math.max(_(T.id),g(P.id))+N.value+1,z={id:`branch:${P.id}`,source:T.id,target:P.id,sourceHandle:`branch@${P.branch}`,targetHandle:"input",markerEnd:mr.ArrowClosed,selectable:!1,focusable:!1,updatable:!1,data:{type:"branch",ownerId:T.id,branch:P.branch,groupId:P.id},zIndex:Y*qi+dP};O.push(z)}return O}),v=new Map,D=new Map;let L;function k(O,P=!0){if(O.phase!==e)return;const T=b(O).filter(Z=>Z.phase===e&&!Z.hidden);if(!T.length)return;const M=[];for(const Z of T){const ie=r(Z.id),be=ie==null?void 0:ie.dimensions,ee=(be==null?void 0:be.width)??0,re=(be==null?void 0:be.height)??0;if(ee<=0||re<=0)return;const le=ie==null?void 0:ie.computedPosition,ue=(le==null?void 0:le.x)??Z.position.x,fe=(le==null?void 0:le.y)??Z.position.y;M.push({x:ue,y:fe,width:ee,height:re});const B=y.value.get(Z.id)??[];for(const V of B){if(V.phase!==e)continue;const F=v.get(V.id),R=(F==null?void 0:F.position)??V.position,Q=(F==null?void 0:F.dimensions)??V.dimensions;!R||!Q||M.push({x:R.x,y:R.y,width:Q.width,height:Q.height})}}const Y=jm(M),z=Y.width+To*2,H=Y.height+To*2;return{position:{x:Math.round(Y.x-To),y:Math.round(Y.y-To)},dimensions:{width:Math.round(z),height:Math.round(H)},commit:P}}function J(){if(v.size===0){L=void 0;return}const O=[];let P=!1;v.forEach((T,M)=>{const Y=f(M,T,!1);O.push({id:M,changed:Y,commit:T.commit}),T.commit&&Y&&!P&&(P=!0)}),v.clear(),L=void 0;for(const{id:T,changed:M,commit:Y}of O){if(!M)continue;const z=l.value.get(T);if(!z)continue;const H=x.value.get(z.ownerId);H&&D.set(H.id,{commit:Y})}if(D.size>0){const T=Array.from(D);D.clear();for(const[M,{commit:Y}]of T)G(M,Y)}P&&u("*")}function I(){v.size!==0&&(L||(L=t.nextTick().then(J)))}function G(O,P=!0){const T=l.value.get(O);if(!T)return;const M=k(T,P);M&&(v.set(O,M),I())}function j(O,P,T,M){const Y=l.value.get(O);if(!Y)return;if(!Y.position){d(O,P,!1),G(O);return}if(T===0&&M===0){d(O,P,!1);return}d(O,P,!1);const z=[O],H=new Set([O]),Z=new Set;for(;z.length;){const ie=z.shift(),be=l.value.get(ie);if(!be)continue;const ee=b(be).filter(re=>re.phase===e&&!re.hidden);for(const re of ee){Z.has(re.id)||(c(re.id,{x:re.position.x+T,y:re.position.y+M},!1),Z.add(re.id));const le=E.value.get(re.id)??[];for(const ue of le){if(H.has(ue.id))continue;const fe=l.value.get(ue.id);fe!=null&&fe.position&&d(ue.id,{x:fe.position.x+T,y:fe.position.y+M},!1),H.add(ue.id),z.push(ue.id)}}}}function te(O,P){const T=h.value;if(!T)return!1;if(T===O||P.some(M=>T===M))return!0;for(const M of P){const Y=E.value.get(M)??[];if(Y!=null&&Y.some(z=>z.id===T))return!0}return!1}const K=new Map;return t.watch(()=>a.value.groups.filter(P=>P.phase===e).map(P=>{const T=P.memberIds.map(M=>{var Z,ie;const Y=r(M),z=Math.round(((Z=Y==null?void 0:Y.dimensions)==null?void 0:Z.width)??0),H=Math.round(((ie=Y==null?void 0:Y.dimensions)==null?void 0:ie.height)??0);return`${M}:${z}x${H}`});return{id:P.id,memberIds:P.memberIds,signature:T.join(",")}}),O=>{const P=new Set(O.map(T=>T.id));for(const T of K.keys())P.has(T)||K.delete(T);for(const T of O){if(te(T.id,T.memberIds))continue;const Y=K.get(T.id)!==T.signature;Y&&K.set(T.id,T.signature);const z=l.value.get(T.id),H=!!(z!=null&&z.position&&(z!=null&&z.dimensions));Y&&(H||G(T.id))}},{deep:!0,flush:"post"}),{groupsByOwner:E,memberGroupMap:x,groupNodes:C,branchEdges:S,isBranchEdgeId:w,updateGroupLayout:G,translateGroupTree:j,updateDragging:O=>{h.value=O},getNodeDepth:_,maxGroupDepth:N,waitForLayoutFlush:()=>L??Promise.resolve()}}function wV(e){t.provide(Hp,e)}function Gm(){return t.inject(Hp,void 0)}function qm(){const e=Gm();if(!e)throw new Error("Confirm modal not provided");return e}function kV({phase:e,groupMapById:n,getNodeDepth:o}){const r=t.shallowRef(),i=t.shallowRef();function a(d){r.value=d,i.value=void 0}function l(){r.value&&(r.value=void 0,i.value=void 0)}function s(d){let f;return n.value.forEach(u=>{if(u.phase!==e)return;const p=u.position,m=u.dimensions;if(!p||!m||!(d.x>=p.x&&d.x<=p.x+m.width&&d.y>=p.y&&d.y<=p.y+m.height))return;const _=o(u.ownerId);(!f||_>f.depth)&&(f={depth:_,id:u.id})}),f==null?void 0:f.id}function c(d){if(!r.value){i.value=void 0;return}if(!d){i.value=void 0;return}i.value=s(d)}return{activeGroupId:i,start:a,updateActiveGroup:c,end:l}}function zm(e){const n=e.match(/^(input|output)(?:s@(.*))?$/);if(n)return{io:n[1],field:n[2]}}const CV={default:aC,hover:sC,selected:lC};let Hm,Es;function ea(e){const n=e.id===Hm?"selected":e.id===Es?"hover":"default",o=CV[n],{markerEnd:r}=e,i=typeof r=="object"?{...r,color:o}:{type:r,color:o},a=e.zIndex??0,l=n==="selected"?a+2:n==="hover"?a+1:a;return{...e,style:{...e.style,stroke:o,strokeWidth:n==="selected"?1.5:void 0},markerEnd:i,zIndex:l}}const[EV,NV]=Ye.createInjectionState(function(e){const{phase:n,flowId:o,layoutOptions:r,readonly:i}=e,{viewport:a,padding:l=Cr.padding,gaps:s=Cr.gaps}=r,{nodes:c=Cr.gaps.nodes,edges:d=Cr.gaps.edges,ranks:f=Cr.gaps.ranks}=s,u=Le(o),p=at(),m=Gm(),y=Km(),{i18n:{t:_}}=Be(),{findNode:g,fitView:h,deleteKeyCode:w,onNodeDrag:b,onNodeDragStop:x,onConnect:E,onNodesChange:C,onEdgesChange:N,onEdgeUpdate:S,onEdgeMouseEnter:v,onEdgeMouseLeave:D,getNodes:L,setNodes:k,setEdges:J,addSelectedNodes:I,screenToFlowCoordinate:G}=u;w.value=["Delete","Backspace"];const{state:j,commit:te,moveNode:K,selectNode:O,removeNode:P,getNodeById:T,connectEdge:M,disconnectEdge:Y,getInEdgesByNodeId:z,branchGroups:H,commit:Z,reset:ie,groupMapById:be}=p,{isGroupId:ee}=H;function re(se,ye){const ce=T(se.source),pe=T(se.target);return!!(ce&&pe&&ce.phase===ye&&pe.phase===ye)}const{groupsByOwner:le,memberGroupMap:ue,groupNodes:fe,branchEdges:B,isBranchEdgeId:V,updateGroupLayout:F,translateGroupTree:R,updateDragging:Q,getNodeDepth:q,maxGroupDepth:ae,waitForLayoutFlush:A}=bV({phase:n,readonly:i,flowId:o}),{activeGroupId:U,start:$,updateActiveGroup:oe,end:ne}=kV({phase:n,groupMapById:be,getNodeDepth:q}),_e=t.computed(()=>j.value.nodes.filter(se=>se.phase===n&&!se.hidden).map(se=>{const ye=ue.value.get(se.id),ce=ye==null?void 0:ye.position,pe=ye==null?void 0:ye.dimensions,we=ye&&ce&&pe?{x:se.position.x-ce.x,y:se.position.y-ce.y}:se.position,xe=q(se.id),Oe=!!(ye&&ce&&pe),Re=(Oe?xe:0)+ae.value+1;return{id:se.id,type:"flow",position:we,data:se,deletable:!Bu(se),parentNode:Oe?ye.id:void 0,zIndex:Re*qi+uP}})),ke=t.computed(()=>j.value.edges.filter(se=>re(se,n)).filter(se=>{const ye=T(se.source),ce=T(se.target);return!(ye!=null&&ye.hidden)&&!(ce!=null&&ce.hidden)}).map(se=>{const ye=T(se.source),ce=T(se.target);if(ye){if(!ce)throw new Error(`Missing target node "${se.target}" for edge "${se.id}" in phase "${n}"`)}else throw new Error(`Missing source node "${se.source}" for edge "${se.id}" in phase "${n}"`);const pe=Math.max(q(se.source),q(se.target))+ae.value+1;return ea({id:se.id,source:se.source,target:se.target,sourceHandle:se.sourceField?`outputs@${se.sourceField}`:"output",targetHandle:se.targetField?`inputs@${se.targetField}`:"input",markerEnd:mr.ArrowClosed,data:se,updatable:!i,zIndex:pe*qi+cP})})),de=t.computed(()=>[...B.value,...ke.value]);t.watch([_e,fe,de],([se,ye,ce])=>{k([...ye,...se]),J(ce)},{immediate:!0});const Ne=t.computed(()=>({padding:l/Math.max(t.toValue(a==null?void 0:a.width)??0,t.toValue(a==null?void 0:a.height)??0)}));async function Te({source:se,sourceHandle:ye,target:ce,targetHandle:pe}){if(!ye||!pe)return;const we=zm(ye),xe=zm(pe);if((we==null?void 0:we.io)==="input"||(xe==null?void 0:xe.io)==="output"||ye==="output"&&pe==="output")return;const Oe=z(ce);let Re=!1,Me=!1;const At=[],Ge=[],Ue=(xe==null?void 0:xe.io)==="input"?Oe.filter(We=>!We.targetField):Oe.filter(We=>!!We.targetField);Ue.length>0&&(Re=!0,Ue.forEach(We=>{Ge.push(xr(We,T)),Y(We.id,!1)}));const Ke=(xe==null?void 0:xe.io)==="input"?xe!=null&&xe.field?Oe.filter(We=>We.targetField===xe.field):Oe.filter(We=>!!We.targetField):Oe.filter(We=>!We.targetField);if(Ke.length>0){if(Ke.some(gt=>gt.source===se&>.target===ce&>.targetField===(xe==null?void 0:xe.field)&>.sourceField===(we==null?void 0:we.field)))return;Me=!0,Ke.forEach(gt=>{Ge.push(xr(gt,T)),Y(gt.id,!1)})}if(!M({source:se,sourceField:we==null?void 0:we.field,target:ce,targetField:xe==null?void 0:xe.field},!1)){ie(),y({message:_("plugins.free-form.datakit.flow_editor.error.invalid_connection"),appearance:"danger"});return}if(At.push(Cs(se,we==null?void 0:we.field,ce,xe==null?void 0:xe.field,T)),Re||Me){if(!m)throw ie(),new Error("Expected confirm modal to be provided here when reachable");if(!await m(_(Re?"plugins.free-form.datakit.flow_editor.confirm.message.switch":"plugins.free-form.datakit.flow_editor.confirm.message.override"),At,Ge)){ie();return}}Z()}E(Te);let me=!1;const ge=()=>{me&&(me=!1,Z())};C(se=>{se.filter(pe=>pe.type==="select").filter(pe=>!ee(pe.id)).sort((pe,we)=>pe.selected===we.selected?0:pe.selected?1:-1).forEach(pe=>{O(pe.selected?pe.id:void 0)});let ce=!1;se.forEach(pe=>{if(pe.type==="remove"){if(ee(pe.id))return;ce=!0,P(pe.id,!1)}}),ce&&!me&&(me=!0,queueMicrotask(ge))}),b(({node:se,event:ye})=>{var At,Ge,Ue;if(!se)return;if(ee(se.id)){const Ke=se.id;Q(Ke),oe(void 0);const Qt=be.value.get(Ke);if(!Qt)return;const We=Qt.position??{...se.position},gt=se.position.x-We.x,aa=se.position.y-We.y;R(Ke,se.position,gt,aa);const Ar=ue.value.get(Qt.ownerId);Ar&&F(Ar.id,!1);return}const ce=se.id;$("canvas"),Q(ce);const pe=se.parentNode;let we={...se.position};if(pe&&ee(pe)){const Ke=be.value.get(pe);Ke!=null&&Ke.position&&(we={x:Ke.position.x+se.position.x,y:Ke.position.y+se.position.y})}K(ce,we,!1);const xe={x:we.x,y:we.y,width:((At=se.dimensions)==null?void 0:At.width)??0,height:((Ge=se.dimensions)==null?void 0:Ge.height)??0},Oe=ye&&"clientX"in ye?G({x:ye.clientX,y:ye.clientY}):void 0,Re={x:xe.x+xe.width/2,y:xe.y+xe.height/2};oe(Oe??Re);const Me=pe&&ee(pe)?pe:(Ue=ue.value.get(ce))==null?void 0:Ue.id;Me&&F(Me,!1)}),x(({node:se})=>{var xe;if(!se)return;if(Q(void 0),ee(se.id)){te();return}const ye=se.id,ce=se.parentNode;let pe={...se.position};if(ce&&ee(ce)){const Oe=be.value.get(ce);Oe!=null&&Oe.position&&(pe={x:Oe.position.x+se.position.x,y:Oe.position.y+se.position.y})}K(ye,pe,!1);const we=ce&&ee(ce)?ce:(xe=ue.value.get(ye))==null?void 0:xe.id;we&&F(we,!1),mt(ye),ne(),te()}),N(se=>{se.filter(pe=>pe.type==="select").sort((pe,we)=>pe.selected===we.selected?0:pe.selected?1:-1).forEach(pe=>{V(pe.id)||(Hm=pe.selected?pe.id:void 0,J(we=>we.map(xe=>xe.id!==pe.id||!xe.markerEnd?xe:ea({...xe,zIndex:pe.selected?1:void 0}))))});let ce=!1;se.forEach(pe=>{if(pe.type==="remove"){if(V(pe.id))return;ce=!0,Y(pe.id,!1)}}),ce&&!me&&(me=!0,queueMicrotask(ge))}),v(({edge:se})=>{V(se.id)||(Es=se.id,J(ye=>ye.map(ce=>ce.id!==se.id?ce:ea(ce))))}),D(({edge:se})=>{V(se.id)||(Es=void 0,J(ye=>ye.map(ce=>ce.id!==se.id?ce:ea(ce))))}),S(({edge:se,connection:ye})=>{V(se.id)||(Y(se.id,!1),Te(ye))});function nt(se,ye,ce){var gt,aa,Ar,mg,gg;const pe=ye?g(ye.id):void 0,we=ce?g(ce.id):void 0;let xe;if(se.length>0){xe=new Um.graphlib.Graph({multigraph:!0}),xe.setGraph({rankdir:n==="request"?"LR":"RL",nodesep:c,edgesep:d,ranksep:f});const Ct=new Set;for(const It of se){const en=g(It.id);if(!en){console.warn(`Cannot find graph node '${It.id}' in ${n} phase`);continue}Ct.add(It.id),ii(It)?xe.setNode(It.id,It.dimensions??en.dimensions):xe.setNode(It.id,en.dimensions)}for(const It of de.value)!Ct.has(It.source)||!Ct.has(It.target)||xe.setEdge(It.source,It.target,{points:[]});Um.layout(xe)}const Oe=[],Re=Ct=>({x:Ct.x-Ct.width/2,y:Ct.y-Ct.height/2,width:Ct.width,height:Ct.height});if(se.length>0){if(!xe)throw new Error("Expected dagreGraph to be initialized");for(const Ct of se){const It=xe.node(Ct.id),en=Re(It);Oe.push(en),ii(Ct)?R(Ct.id,en,en.x+To,en.y+To):K(Ct.id,{x:en.x,y:en.y},!1)}}const Me=Oe.length>0?jm(Oe):{x:0,y:0,width:0,height:0},At=Me.width,Ge=Me.height,Ue=Me.x,Ke=Me.x+Me.width,Qt=Math.max(0,Math.min(t.toValue(a==null?void 0:a.width)??Number.POSITIVE_INFINITY,fP)-At-2*c-(((gt=pe==null?void 0:pe.dimensions)==null?void 0:gt.width)??0)-(((aa=we==null?void 0:we.dimensions)==null?void 0:aa.width)??0)-2*l),We=Me.y+Ge/2;ye&&K(ye.id,{x:Ue-c-Qt/2-(((Ar=pe==null?void 0:pe.dimensions)==null?void 0:Ar.width)??0),y:We-(((mg=pe==null?void 0:pe.dimensions)==null?void 0:mg.height)??0)/2},!1),ce&&K(ce.id,{x:Ke+c+Qt/2,y:We-(((gg=we==null?void 0:we.dimensions)==null?void 0:gg.height)??0)/2},!1)}function xn(se){let ye,ce;const pe=[];for(const we of se){if(ii(we)){pe.push(we);continue}switch(we.name){case"request":{if(n!=="request")throw new Error(`Unexpected request node in ${n} phase`);if(ye)throw new Error("Duplicated request node in request phase");ye=we;break}case"service_request":{if(n!=="request")throw new Error(`Unexpected service_request node in ${n} phase`);if(ce)throw new Error("Duplicated service_request node in request phase");ce=we;break}case"service_response":{if(n!=="response")throw new Error(`Unexpected service_response node in ${n} phase`);if(ce)throw new Error("Duplicated service_response node in response phase");ce=we;break}case"response":{if(n!=="response")throw new Error(`Unexpected response node in ${n} phase`);if(ye)throw new Error("Duplicated response node in response phase");ye=we;break}default:{pe.push(we);break}}}return{autoNodes:pe,leftNode:ye,rightNode:ce}}async function vn(se=!0){const ye=new Map(_e.value.map(Re=>[Re.id,Re.data])),ce=j.value.groups.toSorted((Re,Me)=>q(Me.ownerId)-q(Re.ownerId));for(const Re of ce)nt(Re.memberIds.reduce((Me,At)=>{const Ge=T(At);if(!Ge)return console.warn(`Cannot find node '${At}' of group '${Re.id}' by getNodeById`),Me;if(Ge.phase!==n)return Me;if(Ge.type==="branch"){const Ue=le.value.get(Ge.id);Ue&&Me.push(...Ue)}return ye.delete(Ge.id),Me.push(Ge),Me},[])),await t.nextTick(),F(Re.id,!1),await A();const pe=ye.values().toArray();for(const Re of pe){if(ii(Re)||Re.type!=="branch")continue;const Me=le.value.get(Re.id);Me&&pe.push(...Me)}const{autoNodes:we,leftNode:xe,rightNode:Oe}=xn(pe);nt(we,xe,Oe),se&&te()}function st(se){h({...Ne.value,...se})}async function He(se){return O(se),new Promise(ye=>setTimeout(()=>{const ce=g(se);I(ce?[ce]:[]),ye()},0))}function pt(se){const ye=L.value.filter(({type:Ue})=>Ue!=="group"),ce=ye.find(({id:Ue})=>Ue===se);if(!ce)throw new Error(`Node ${se} not found`);const{position:{x:pe,y:we},dimensions:{width:xe,height:Oe}}=ce,Re=we,Me=we+Oe,At=ye.filter(({id:Ue})=>Ue!==se).filter(({position:{y:Ue},dimensions:{height:Ke}})=>Ue<Me&&Ue+Ke>Re).map(({position:{x:Ue},dimensions:{width:Ke}})=>({left:Ue,right:Ue+Ke})).sort((Ue,Ke)=>Ue.left-Ke.left);let Ge=pe+xe+c;for(const{left:Ue,right:Ke}of At)if(!(Ke<=Ge)){if(Ge+xe<=Ue)return{x:Ge,y:Re};Ge=Math.max(Ge,Ke)+c}return{x:Ge,y:Re}}function kt(se){if(!se)return;const ye=g(se);if(!ye)throw new Error(`Node ${se} not found`);const{position:{x:ce},dimensions:{width:pe}}=ye,we=ce+pe,{viewport:xe,dimensions:Oe,setViewport:Re}=u,{x:Me,y:At,zoom:Ge}=xe.value,{width:Ue}=Oe.value,Ke=ce*Ge+Me,Qt=we*Ge+Me,We=Ue-zp-c;if(Qt<=We)return;let gt=We-Qt;Ke+gt<0&&(gt=-Ke),gt!==0&&Re({x:Me+gt,y:At,zoom:Ge},{duration:gP})}function mt(se){if(!U.value)return!1;const{nodeId:ye,branch:ce}=c1(U.value),pe=H.addMember(ye,ce,se,{commit:!1});return oe(void 0),pe}return{vueFlowStore:u,editorStore:p,readonly:i,nodes:_e,edges:de,selectNode:He,autoLayout:vn,placeToRight:pt,scrollRightToReveal:kt,fitViewParams:Ne,fitView:st,groupDrop:{activeGroupId:U,startPanelDrag:()=>$("panel"),endPanelDrag:ne,updateActiveGroup:oe,attachNodeToActiveGroup:mt}}}),ta=ve(t.defineComponent({__name:"HandleTwig",props:{color:{},position:{default:()=>Ee.Left},size:{default:()=>Number.parseFloat(Nd)},type:{}},setup(e){t.useCssVars(o=>({"753622c4":o.color}));const n=t.computed(()=>({width:`${e.size}px`,minWidth:`${e.size}px`}));return(o,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["handle-twig",[o.type,o.position===t.unref(Ee).Left?"left":"right"]]),style:t.normalizeStyle(n.value)},null,6))}}),[["__scopeId","data-v-eb2bc3f2"]]),Ym=ve(t.defineComponent({__name:"NodeBadge",props:{type:{},size:{},iconOnly:{type:Boolean}},setup(e){t.useCssVars(r=>{var i,a;return{b58c4842:(i=n.value.colors)==null?void 0:i.background,"6ae9eff4":(a=n.value.colors)==null?void 0:a.foreground}});const n=t.computed(()=>xt[e.type]),o=t.computed(()=>a1(e.type));return(r,i)=>{var l;const a=t.resolveComponent("KBadge");return t.openBlock(),t.createBlock(a,{appearance:"neutral",class:t.normalizeClass(["dk-node-badge",{"icon-only":r.iconOnly,"has-colors":!!n.value.colors}]),size:r.size},t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.value),1)]),_:2},[(l=n.value)!=null&&l.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value.icon)))]),key:"0"}:void 0]),1032,["class","size"])}}}),[["__scopeId","data-v-05435e4f"]]);let Oo=null;function SV(){var n;if(Oo)return Oo;if(typeof navigator>"u")return Oo="windows";const e=((n=navigator.userAgentData)==null?void 0:n.platform)||navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(e)?Oo="mac":/Linux/i.test(e)&&!/Android/i.test(e)?Oo="linux":Oo="windows"}const xV={Shift:"⇧",Alt:"⌥",Ctrl:"⌃",Meta:"⌘",Mod:"⌘",Enter:"↩",ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Tab:"⇥",Esc:"⎋",Space:"Space",Delete:"⌫"},vV={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Win",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Spacebar",Delete:"Delete"},AV={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Super",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Space",Delete:"Delete"};function IV(e,n={}){const o=n.platform??SV(),r=n.joiner??(o==="mac"?"":" + "),i=o==="mac"?xV:o==="linux"?AV:vV;return(Array.isArray(e)?e:e[o]).map(l=>l in i?i[l]:l).join(r)}const TV={key:0,class:"label"},PV={class:"keys"},na=ve(t.defineComponent({__name:"HotkeyLabel",props:{label:{},keys:{},reverse:{type:Boolean}},setup(e){const n=IV(e.keys);return(o,r)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass(["dk-hotkey-label",{reverse:o.reverse}])},[o.label?(t.openBlock(),t.createElementBlock("span",TV,t.toDisplayString(o.label),1)):t.createCommentVNode("",!0),t.createElementVNode("kbd",PV,t.toDisplayString(t.unref(n)),1)],2))}}),[["__scopeId","data-v-cc70d56b"]]),OV={class:"indicator-box"},$V={key:1,class:"additional-count"},oa=ve(t.defineComponent({__name:"ValueIndicator",props:{edgeId:{},sourceNode:{},sourceFieldName:{},targetNodes:{},targetFieldNames:{},mode:{},reversed:{type:Boolean,default:!1}},setup(e){const n=t.createPropsRestProxy(e,["reversed"]),o=t.computed(()=>n.mode==="input"&&n.sourceNode?n.sourceFieldName?`${n.sourceNode.name}.${n.sourceFieldName}`:n.sourceNode.name:n.mode==="output"&&n.targetNodes?n.targetNodes.map((s,c)=>{var f;const d=(f=n.targetFieldNames)==null?void 0:f[c];return d?`${s.name}.${d}`:s.name}).join(", "):""),r=t.computed(()=>{var s;let l;if(n.mode==="input"&&n.sourceNode?l=n.sourceNode:n.mode==="output"&&n.targetNodes&&n.targetNodes.length>0&&(l=n.targetNodes[0]),!!l)return(s=xt[l.type])==null?void 0:s.icon}),i=t.computed(()=>n.mode==="output"&&n.targetNodes&&n.targetNodes.length>1?n.targetNodes.length-1:0),a=t.computed(()=>n.mode==="input"?e.reversed:!e.reversed);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["value-indicator",{reversed:a.value}])},[t.createVNode(t.unref(Pe.KTooltip),{placement:"top",text:o.value},{default:t.withCtx(()=>[t.createElementVNode("div",OV,[r.value?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),{key:0,color:t.unref(Wa),size:16},null,8,["color"])):t.createCommentVNode("",!0),i.value>0?(t.openBlock(),t.createElementBlock("span",$V," +"+t.toDisplayString(i.value),1)):t.createCommentVNode("",!0)])]),_:1},8,["text"])],2))}}),[["__scopeId","data-v-d8506ba3"]]),BV={class:"body"},VV={class:"name"},RV={class:"handle"},DV={class:"handle-label-wrapper"},MV={class:"handle-label-wrapper"},LV={class:"handle-label text"},FV={class:"handle"},UV={class:"handle-label-wrapper"},KV={class:"handle-label-wrapper"},jV={class:"handle-label text"},GV={key:2,class:"branch-handles"},qV={class:"handle-label-wrapper"},zV={class:"handle-label text"},Wm=ve(t.defineComponent({__name:"FlowNode",props:{data:{},error:{type:Boolean},readonly:{type:Boolean}},setup(e){const{t:n}=Ze.createI18n("en-us",rt),o=NV(),{getInEdgesByNodeId:r,getOutEdgesByNodeId:i,getNodeById:a,toggleExpanded:l,duplicateNode:s,removeNode:c,propertiesPanelOpen:d}=at(),f=t.computed(()=>ko(e.data.type)),u=t.computed(()=>e.data.fields.input.length>0),p=t.computed(()=>e.data.fields.output.length>0),m=t.computed(()=>u.value&&r(e.data.id).every(K=>K.targetField===void 0)),y=t.computed(()=>p.value&&i(e.data.id).every(K=>K.sourceField===void 0)),_=t.computed(()=>e.data.expanded.input??!1),g=t.computed(()=>e.data.expanded.output??!1),h=t.computed(()=>{var K,O,P;return((P=(O=(K=f.value.io)==null?void 0:K.next)==null?void 0:O.branches)==null?void 0:P.map(({name:T})=>T))??[]}),w=t.computed(()=>h.value.length>0),b=t.computed(()=>{var K,O;if(e.data.type==="property"){const P=(K=e.data.config)==null?void 0:K.property;return cs(P)}return(O=f.value.io)==null?void 0:O.input}),x=t.computed(()=>{var K,O;if(e.data.type==="property"){const P=(K=e.data.config)==null?void 0:K.property;return ss(P)}return(O=f.value.io)==null?void 0:O.output}),E=t.computed(()=>Bu(e.data)),C=t.computed(()=>e.data.phase==="response"),N=t.computed(()=>e.data.phase==="request"?Ee.Left:Ee.Right),S=t.computed(()=>e.data.phase==="request"?Ee.Right:Ee.Left),v=t.computed(()=>e.data.phase==="request"?Ee.Right:Ee.Left),D=t.computed(()=>E.value?n(`plugins.free-form.datakit.flow_editor.node_types.${e.data.type}.name`):e.data.name),L=t.computed(()=>E.value?nC:oC),k=t.computed(()=>{const K=new Map,O=r(e.data.id);for(const P of O){const T=a(P.source);if(!T)continue;const M=T.type==="vault",Y=T.phase!==e.data.phase;if(!M&&!Y)continue;let z;if(P.sourceField){const H=T.fields.output.find(Z=>Z.id===P.sourceField);z=H==null?void 0:H.name}if(P.targetField){const H=e.data.fields.input.find(Z=>Z.id===P.targetField);if(!H)continue;K.set(P.targetField,{fieldId:P.targetField,edgeId:P.id,field:H,sourceNode:T,sourceFieldName:z})}else K.set("input",{fieldId:"input",edgeId:P.id,field:null,sourceNode:T,sourceFieldName:z})}return K}),J=t.computed(()=>{const K=new Map,O=i(e.data.id);for(const P of O){const T=a(P.target);if(!T||!(T.phase!==e.data.phase))continue;let Y;if(P.targetField){const Z=T.fields.input.find(ie=>ie.id===P.targetField);Y=Z==null?void 0:Z.name}const z=P.sourceField||"output";if(!K.has(z)){const Z=P.sourceField&&e.data.fields.output.find(ie=>ie.id===P.sourceField)||null;K.set(z,{fieldId:z,edgeIds:[],field:Z,targetNodes:[],targetFieldNames:[]})}const H=K.get(z);H.edgeIds.push(P.id),H.targetNodes.push(T),H.targetFieldNames.push(Y)}return K});function I(K){return k.value.get(K)}function G(K){return J.value.get(K)}function j(K){!o||o.readonly||K==="input"&&!m.value||K==="output"&&!y.value||l(e.data.id,K)}async function te(){if(!o||o.readonly)return;const K=s(e.data.id,o.placeToRight(e.data.id));await o.selectNode(K),o.scrollRightToReveal(K),d.value=!0}return t.watch(m,K=>{K||l(e.data.id,"input",!0,!0,"*")},{immediate:!0}),t.watch(y,K=>{K||l(e.data.id,"output",!0,!0,"*")},{immediate:!0}),t.watch(()=>e.data.fields.input,(K,O)=>{qo(K,O)||l(e.data.id,"input",K.length>0,!0,"*")},{deep:!0}),t.watch(()=>e.data.fields.output,(K,O)=>{qo(K,O)||l(e.data.id,"output",K.length>0,!0,"*")},{deep:!0}),(K,O)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["dk-flow-node",{reversed:C.value,implicit:E.value,readonly:K.readonly}])},[t.createElementVNode("div",BV,[E.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(Pe.KTooltip),{key:0,class:"badge",placement:"top",text:K.data.type},{default:t.withCtx(()=>[t.createVNode(Ym,{"icon-only":"",size:"small",type:K.data.type},null,8,["type"])]),_:1},8,["text"])),t.createElementVNode("div",VV,t.toDisplayString(D.value),1),K.error?(t.openBlock(),t.createBlock(t.unref(Se.WarningIcon),{key:1,class:"error-icon",color:t.unref(Ya),size:16},null,8,["color"])):t.createCommentVNode("",!0),E.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(Pe.KDropdown),{key:2,class:"menu",disabled:K.readonly,"kpop-attributes":{offset:"4px",target:"body",popoverClasses:"dk-flow-node-menu"},width:"160",onClick:O[1]||(O[1]=t.withModifiers(()=>{},["stop"]))},{items:t.withCtx(()=>[t.createVNode(t.unref(Pe.KDropdownItem),{onClick:te},{default:t.withCtx(()=>[t.createVNode(na,{keys:t.unref(zi).duplicate,label:t.unref(n)("plugins.free-form.datakit.flow_editor.actions.duplicate")},null,8,["keys","label"])]),_:1}),t.createVNode(t.unref(Pe.KDropdownItem),{danger:"",onClick:O[0]||(O[0]=P=>t.unref(c)(K.data.id))},{default:t.withCtx(()=>[t.createVNode(na,{keys:t.unref(zi).delete,label:t.unref(n)("plugins.free-form.datakit.flow_editor.actions.delete")},null,8,["keys","label"])]),_:1})]),default:t.withCtx(()=>[t.createVNode(t.unref(Pe.KButton),{appearance:"tertiary",class:"menu-trigger",icon:"",size:"small"},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.MoreIcon),{color:t.unref(Ha)},null,8,["color"])]),_:1})]),_:1},8,["disabled"]))]),t.createElementVNode("div",{class:t.normalizeClass(["handles",{reversed:C.value}])},[b.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["input-handles",{"has-fields":u.value}])},[t.createElementVNode("div",RV,[t.createVNode(t.unref(Jt),{id:"input",position:N.value,type:"target"},null,8,["position"]),I("input")?(t.openBlock(),t.createBlock(oa,{key:0,"edge-id":I("input").edgeId,mode:"input",reversed:C.value,"source-field-name":I("input").sourceFieldName,"source-node":I("input").sourceNode},null,8,["edge-id","reversed","source-field-name","source-node"])):t.createCommentVNode("",!0),t.createElementVNode("div",DV,[t.createElementVNode("div",{class:t.normalizeClass(["handle-label trigger",{collapsible:m.value}]),onClick:O[2]||(O[2]=t.withModifiers(P=>j("input"),["stop"]))},[O[4]||(O[4]=t.createElementVNode("div",{class:"text"}," inputs ",-1)),u.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[_.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(Se.UnfoldMoreIcon),{key:0,size:t.unref(Xo)},null,8,["size"])),_.value?(t.openBlock(),t.createBlock(t.unref(Se.UnfoldLessIcon),{key:1,color:m.value?void 0:t.unref(Cd),size:t.unref(Xo)},null,8,["color","size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],2),u.value&&_.value?(t.openBlock(),t.createBlock(ta,{key:0,color:L.value,position:N.value,type:"bar"},null,8,["color","position"])):t.createCommentVNode("",!0)])]),u.value&&_.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(K.data.fields.input,(P,T)=>(t.openBlock(),t.createElementBlock("div",{key:`inputs-${P.id}`,class:"handle indented"},[t.createVNode(t.unref(Jt),{id:`inputs@${P.id}`,position:N.value,type:"target"},null,8,["id","position"]),I(P.id)?(t.openBlock(),t.createBlock(oa,{key:0,"edge-id":I(P.id).edgeId,mode:"input",reversed:C.value,"source-field-name":I(P.id).sourceFieldName,"source-node":I(P.id).sourceNode},null,8,["edge-id","reversed","source-field-name","source-node"])):t.createCommentVNode("",!0),t.createElementVNode("div",MV,[t.createElementVNode("div",LV,t.toDisplayString(P.name),1),t.createVNode(ta,{color:L.value,position:N.value,type:T<K.data.fields.input.length-1?"trident":"corner"},null,8,["color","position","type"])])]))),128)):t.createCommentVNode("",!0)],2)):t.createCommentVNode("",!0),x.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["output-handles",{"has-fields":p.value}])},[t.createElementVNode("div",FV,[t.createElementVNode("div",UV,[t.createElementVNode("div",{class:t.normalizeClass(["handle-label trigger",{collapsible:y.value}]),onClick:O[3]||(O[3]=t.withModifiers(P=>j("output"),["stop"]))},[O[5]||(O[5]=t.createElementVNode("div",{class:"text"}," outputs ",-1)),p.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[g.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(Se.UnfoldMoreIcon),{key:0,size:t.unref(Xo)},null,8,["size"])),g.value?(t.openBlock(),t.createBlock(t.unref(Se.UnfoldLessIcon),{key:1,color:y.value?void 0:t.unref(Cd),size:t.unref(Xo)},null,8,["color","size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],2),p.value&&g.value?(t.openBlock(),t.createBlock(ta,{key:0,color:L.value,position:S.value,type:"bar"},null,8,["color","position"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(Jt),{id:"output",position:S.value,type:"source"},null,8,["position"]),G("output")?(t.openBlock(),t.createBlock(oa,{key:0,mode:"output",reversed:C.value,"target-field-names":G("output").targetFieldNames,"target-nodes":G("output").targetNodes},null,8,["reversed","target-field-names","target-nodes"])):t.createCommentVNode("",!0)]),p.value&&g.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(K.data.fields.output,(P,T)=>(t.openBlock(),t.createElementBlock("div",{key:`outputs-${P.id}`,class:"handle indented"},[t.createElementVNode("div",KV,[t.createElementVNode("div",jV,t.toDisplayString(P.name),1),t.createVNode(ta,{color:L.value,position:S.value,type:T<K.data.fields.output.length-1?"trident":"corner"},null,8,["color","position","type"])]),t.createVNode(t.unref(Jt),{id:`outputs@${P.id}`,position:S.value,type:"source"},null,8,["id","position"]),G(P.id)?(t.openBlock(),t.createBlock(oa,{key:0,mode:"output",reversed:C.value,"target-field-names":G(P.id).targetFieldNames,"target-nodes":G(P.id).targetNodes},null,8,["reversed","target-field-names","target-nodes"])):t.createCommentVNode("",!0)]))),128)):t.createCommentVNode("",!0)],2)):t.createCommentVNode("",!0),w.value?(t.openBlock(),t.createElementBlock("div",GV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,P=>(t.openBlock(),t.createElementBlock("div",{key:`branch-${P}`,class:"handle"},[t.createElementVNode("div",qV,[t.createElementVNode("div",zV,t.toDisplayString(P),1)]),t.createVNode(t.unref(Jt),{id:`branch@${P}`,connectable:!1,position:v.value,type:"source"},null,8,["id","position"])]))),128))])):t.createCommentVNode("",!0)],2)],2))}}),[["__scopeId","data-v-6d2102ea"]]),HV=ve(t.defineComponent({__name:"GroupNode",props:{data:{},active:{type:Boolean}},setup(e){const n=e,o=t.computed(()=>n.data.phase==="response"),r=t.computed(()=>o.value?Ee.Right:Ee.Left);return(i,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["dk-branch-group-node",{reversed:o.value,"drop-target":i.active}])},[t.createVNode(t.unref(Jt),{id:"input",connectable:!1,position:r.value,type:"target"},null,8,["position"])],2))}}),[["__scopeId","data-v-61116224"]]),YV={key:0,class:"dk-flow-mask"},Xm=ve(t.defineComponent({__name:"FlowCanvas",props:{flowId:{},phase:{},mode:{}},emits:["initialized","nodes-change"],setup(e,{expose:n,emit:o}){const r=o,i=t.useTemplateRef("flowCanvas"),a=Ye.useElementBounding(i),{i18n:{t:l}}=Be(),{vueFlowStore:s,editorStore:c,autoLayout:d,fitViewParams:f,fitView:u,selectNode:p,placeToRight:m,scrollRightToReveal:y,groupDrop:_}=EV({phase:e.phase,flowId:e.flowId,layoutOptions:{viewport:{width:a.width,height:a.height}},readonly:e.mode!=="edit"}),{addNode:g,propertiesPanelOpen:h,invalidConfigNodeIds:w,selectedNode:b,duplicateNode:x,commit:E}=c,{screenToFlowCoordinate:C,zoomIn:N,zoomOut:S,viewport:v,maxZoom:D,minZoom:L}=s,{activeGroupId:k,startPanelDrag:J,endPanelDrag:I,updateActiveGroup:G,attachNodeToActiveGroup:j}=_,te=t.ref(!1);function K(H){var ie;const Z=(ie=H.dataTransfer)==null?void 0:ie.types.find(be=>be.startsWith(`${kr}/`));if(Z)return Z.replace(`${kr}/`,"")}function O(H){var Z;if(e.mode==="edit"){if(((Z=H==null?void 0:H.node)==null?void 0:Z.type)==="group"){p(void 0);return}h.value=!0}}function P(H){e.mode!=="edit"||te.value||(H.preventDefault(),G(C({x:H.clientX,y:H.clientY})))}function T(H){var fe;if(e.mode!=="edit"||te.value)return;const Z=(fe=H.dataTransfer)==null?void 0:fe.getData(kr);if(!Z)return;H.preventDefault();const ie=JSON.parse(Z);if(ie.action!=="create-node")return;const be=C({x:H.clientX,y:H.clientY}),{type:ee,anchor:re}=ie.data,le={type:ee,phase:e.phase,position:{x:be.x-re.offsetX,y:be.y-re.offsetY}},ue=g(le,!1);if(!ue){I();return}j(ue),E(),p(ue),h.value=!0,I()}async function M(){await d(),setTimeout(()=>u(),0)}const Y=t.computed(()=>{if(e.mode==="preview")return[];const H=[{name:"zoom_in",icon:Se.AddIcon,action:N,disabled:v.value.zoom>=D.value},{name:"zoom_out",icon:Se.RemoveIcon,action:S,disabled:v.value.zoom<=L.value},{name:"fit_view",icon:Se.FullscreenIcon,action:u}];return e.mode==="edit"&&H.push({name:"auto_layout",icon:Se.AutoLayoutIcon,action:M}),H});if(e.phase==="response"&&e.mode==="edit"){Ye.useEventListener("dragstart",Z=>{K(Z)==="call"&&(te.value=!0)});const{start:H}=Ye.useTimeoutFn(()=>{te.value=!1},80);Ye.useEventListener("dragover",()=>{H()}),Ye.useEventListener("dragend",()=>{te.value=!1})}e.mode==="edit"&&(Ye.useEventListener("dragstart",H=>{K(H)&&J()}),Ye.useEventListener("dragend",()=>{I()}));async function z(){const H=b.value;if(e.mode!=="edit"||!H||H.phase!==e.phase)return;const Z=x(H.id,m(H.id));Z&&(await p(Z),h.value=!0,y(Z))}return Gp({enabled:t.computed(()=>!!b.value&&e.mode==="edit"&&b.value.phase===e.phase),duplicate:z}),n({autoLayout:d,fitView:u}),(H,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"flowCanvas",ref:i,class:"dk-flow-canvas"},[t.createVNode(t.unref(Fp),{id:H.flowId,class:t.normalizeClass(["flow",{readonly:H.mode!=="edit"}]),"connect-on-click":!1,"elements-selectable":H.mode==="edit","max-zoom":t.unref(pP),"min-zoom":t.unref(mP),"multi-selection-key-code":null,"nodes-connectable":H.mode==="edit","nodes-draggable":H.mode==="edit","pan-on-drag":H.mode==="preview"?!1:void 0,"pan-on-scroll":H.mode!=="edit"?!1:void 0,"zoom-on-double-click":H.mode!=="edit"?!1:void 0,"zoom-on-pinch":H.mode!=="edit"?!1:void 0,"zoom-on-scroll":H.mode!=="edit"?!1:void 0,onDragover:P,onDrop:T,onNodeClick:O,onNodesChange:Z[0]||(Z[0]=ie=>r("nodes-change")),onNodesInitialized:Z[1]||(Z[1]=ie=>r("initialized"))},{"node-flow":t.withCtx(({data:ie})=>[t.createVNode(Wm,{data:ie,error:t.unref(w).has(ie.id),readonly:H.mode!=="edit"},null,8,["data","error","readonly"])]),"node-group":t.withCtx(({data:ie})=>[t.createVNode(HV,{active:t.unref(k)===ie.id,data:ie},null,8,["active","data"])]),default:t.withCtx(()=>[t.createVNode(t.unref(AT)),t.createVNode(t.unref(eP),{"fit-view-params":t.unref(f),position:"bottom-left","show-fit-view":!1,"show-interactive":!1,"show-zoom":!1},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Y.value,ie=>(t.openBlock(),t.createBlock(t.unref(Pe.KTooltip),{key:ie.name,placement:"right",text:t.unref(l)(`plugins.free-form.datakit.flow_editor.actions.${ie.name}`)},{default:t.withCtx(()=>[t.createVNode(t.unref(wr),{disabled:ie.disabled,onClick:t.withModifiers(ie.action,["stop"])},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(ie.icon),{size:18}))]),_:2},1032,["disabled","onClick"])]),_:2},1032,["text"]))),128))]),_:1},8,["fit-view-params"])]),_:1},8,["id","class","elements-selectable","max-zoom","min-zoom","nodes-connectable","nodes-draggable","pan-on-drag","pan-on-scroll","zoom-on-double-click","zoom-on-pinch","zoom-on-scroll"]),te.value?(t.openBlock(),t.createElementBlock("div",YV,t.toDisplayString(t.unref(l)("plugins.free-form.datakit.flow_editor.phase_mask_help")),1)):t.createCommentVNode("",!0)],512))}}),[["__scopeId","data-v-556f8c11"]]),Ns=ve(t.defineComponent({__name:"FlowPanels",props:{inactive:{type:Boolean},mode:{},resizable:{type:Boolean}},setup(e){const n=t.ref(!1),o=t.ref(!1),{state:r,clearPendingLayout:i,setPendingFitView:a,commit:l,clear:s}=at(),c=t.useId(),d=`${c}-request`,f=`${c}-response`,u=Le(d),p=Le(f);function m(M,Y){const{onPaneClick:z,onNodesChange:H,onEdgesChange:Z,getSelectedNodes:ie,getSelectedEdges:be}=M,{removeSelectedElements:ee}=Y;function re(le){if(!le){ee();return}le.some(ue=>ue.type==="select")&&ie.value.length+be.value.length>0&&ee()}H(re),Z(re),z(()=>re())}m(u,p),m(p,u);const y=t.useTemplateRef("flowPanels"),_=t.useTemplateRef("requestLabel"),g=t.useTemplateRef("requestCanvasContainer"),h=t.useTemplateRef("requestFlow"),w=t.useTemplateRef("resizeHandle"),b=t.useTemplateRef("responseLabel"),x=t.useTemplateRef("responseCanvasContainer"),E=t.useTemplateRef("responseFlow"),C=Ye.useElementBounding(y),N=Ye.useElementBounding(_),S=Ye.useElementBounding(g),v=Ye.useElementBounding(w),D=Ye.useElementBounding(b),L=Ye.useElementBounding(x),k=t.computed(()=>Math.max(30,C.height.value*.03)),J=t.computed(()=>S.height.value<k.value),I=t.computed(()=>L.height.value<k.value),G=t.ref("50%"),j=t.ref("50%"),te=()=>{e.resizable&&(J.value?(G.value="50%",j.value="50%"):(G.value="0",j.value="100%"))},K=()=>{e.resizable&&(I.value?(G.value="50%",j.value="50%"):(G.value="100%",j.value="0"))},O=t.computed(()=>C.height.value-N.height.value-v.height.value-D.height.value),{isDragging:P}=Ye.useDraggable(w,{onMove(M){if(!e.resizable)return;const Y=Math.max(0,M.y-S.top.value),z=Math.min(1,Math.max(0,Y/O.value));G.value=`${z*100}%`,j.value=`${(1-z)*100}%`},onEnd(){e.resizable&&(S.height.value<k.value?(G.value="0",j.value="100%"):L.height.value<k.value&&(G.value="100%",j.value="0"))}});function T(){t.nextTick(()=>{var M,Y;(M=h.value)==null||M.fitView(),(Y=E.value)==null||Y.fitView()})}return t.watch([n,o,()=>r.value.pendingLayout,()=>r.value.pendingFitView],([M,Y,z,H])=>{e.inactive||!M||!Y||!z&&!H||(z&&i(),H&&a(!1),setTimeout(async()=>{var Z,ie;z&&(await((Z=h.value)==null?void 0:Z.autoLayout(!1)),await((ie=E.value)==null?void 0:ie.autoLayout(!1)),l("*"),z==="clearHistory"&&s()),H&&setTimeout(()=>T(),0)},0))}),(M,Y)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"flowPanels",ref:y,class:"flow-panels"},[t.createElementVNode("div",{ref_key:"requestLabel",ref:_,class:t.normalizeClass(["label request",{resizable:M.resizable}]),onClick:te},[M.resizable?(t.openBlock(),t.createBlock(t.unref(Se.ChevronDownIcon),{key:0,class:t.normalizeClass(["icon",{collapsed:J.value}])},null,8,["class"])):t.createCommentVNode("",!0),Y[4]||(Y[4]=t.createElementVNode("div",{class:"label-content"}," Request ",-1))],2),t.createElementVNode("div",{ref_key:"requestCanvasContainer",ref:g,class:t.normalizeClass(["canvas",{dragging:t.unref(P)}]),style:t.normalizeStyle({flexBasis:G.value})},[t.createVNode(Xm,{ref_key:"requestFlow",ref:h,"flow-id":d,mode:M.mode,phase:"request",onInitialized:Y[0]||(Y[0]=z=>n.value=!0),onNodesChange:Y[1]||(Y[1]=z=>n.value=!1)},null,8,["mode"])],6),t.createElementVNode("div",{ref_key:"resizeHandle",ref:w,class:t.normalizeClass(["resize-handle",{resizable:M.resizable}])},null,2),t.createElementVNode("div",{ref_key:"responseLabel",ref:b,class:t.normalizeClass(["label response",{dragging:t.unref(P),resizable:M.resizable}]),onClick:K},[M.resizable?(t.openBlock(),t.createBlock(t.unref(Se.ChevronDownIcon),{key:0,class:t.normalizeClass(["icon",{collapsed:I.value}])},null,8,["class"])):t.createCommentVNode("",!0),Y[5]||(Y[5]=t.createElementVNode("div",{class:"label-content"}," Response ",-1))],2),t.createElementVNode("div",{ref_key:"responseCanvasContainer",ref:x,class:t.normalizeClass(["canvas response",{dragging:t.unref(P)}]),style:t.normalizeStyle({flexBasis:j.value})},[t.createVNode(Xm,{ref_key:"responseFlow",ref:E,"flow-id":f,mode:M.mode,phase:"response",onInitialized:Y[2]||(Y[2]=z=>o.value=!0),onNodesChange:Y[3]||(Y[3]=z=>o.value=!1)},null,8,["mode"])],6)],512))}}),[["__scopeId","data-v-f6dd01e7"]]),WV={class:"dk-confirm-modal-body"},XV={class:"connections"},ZV=ve(t.defineComponent({__name:"ConflictModal",props:{title:{},message:{},addedConnections:{},removedConnections:{}},emits:["cancel","confirm"],setup(e,{expose:n,emit:o}){const{i18n:{t:r}}=Be(),i=o,a=t.ref(!1),l=t.ref(e.message),s=t.ref(e.addedConnections??[]),c=t.ref(e.removedConnections??[]);let d=null;function f(){a.value=!1,i("cancel"),d==null||d(!1)}function u(){a.value=!1,i("confirm"),d==null||d(!0)}async function p(m,y,_){return l.value=m,s.value=y??[],c.value=_??[],a.value=!0,await new Promise(g=>{d=g})}return n({open:p}),(m,y)=>{const _=t.resolveComponent("KModal");return t.openBlock(),t.createBlock(_,{"action-button-text":t.unref(r)("plugins.free-form.datakit.flow_editor.confirm.proceed"),"close-on-backdrop-click":"","max-width":"660px",title:m.title??t.unref(r)("plugins.free-form.datakit.flow_editor.confirm.title"),visible:a.value,"z-index":9999,onCancel:f,onProceed:u},{default:t.withCtx(()=>[t.createElementVNode("div",WV,[t.createElementVNode("p",null,t.toDisplayString(l.value),1),t.createElementVNode("p",null,t.toDisplayString(t.unref(r)("plugins.free-form.datakit.flow_editor.confirm.message.confirm")),1),t.createElementVNode("div",XV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value??[],([g,h])=>(t.openBlock(),t.createElementBlock("div",{key:`${g}-${h}`,class:"connection"},[t.createVNode(t.unref(Se.AddIcon),{color:t.unref(rC)},null,8,["color"]),t.createTextVNode(" "+t.toDisplayString(g)+" → "+t.toDisplayString(h),1)]))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value??[],([g,h])=>(t.openBlock(),t.createElementBlock("div",{key:`${g}-${h}`,class:"connection"},[t.createVNode(t.unref(Se.RemoveIcon),{color:t.unref(Ya)},null,8,["color"]),t.createTextVNode(" "+t.toDisplayString(g)+" → "+t.toDisplayString(h),1)]))),128))])])]),_:1},8,["action-button-text","title","visible"])}}}),[["__scopeId","data-v-ac52e1e6"]]),JV={class:"dk-editor-nav"},QV={class:"top"},eR={class:"bottom"},tR=ve(t.defineComponent({__name:"EditorNav",emits:["back"],setup(e,{emit:n}){const{t:o}=Ze.createI18n("en-us",rt),r=n,i=[{label:o("plugins.free-form.datakit.flow_editor.return_to_config"),icon:Se.ArrowLeftIcon,onClick:()=>r("back")}],{sidePanelExpanded:a}=Cl(),l=t.computed(()=>a.value?o("plugins.free-form.datakit.flow_editor.collapse_panel"):o("plugins.free-form.datakit.flow_editor.expand_panel")),s=t.ref(!1);function c(){a.value=!a.value}return(d,f)=>(t.openBlock(),t.createElementBlock("nav",JV,[t.createElementVNode("div",QV,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,({label:u,to:p,icon:m,onClick:y})=>t.createVNode(t.unref(Pe.KTooltip),{key:u,"kpop-attributes":{offset:"10px"},label:u,placement:"right"},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.unref(Pe.KButton),{key:u,appearance:"none",class:"nav-item",icon:"",to:p,onClick:y},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(m),{decorative:"",size:t.unref(Xa)},null,8,["size"]))]),_:2},1032,["to","onClick"]))]),_:2},1032,["label"])),64))]),t.createElementVNode("div",eR,[t.createElementVNode("div",{class:t.normalizeClass(["side-panel-toggle",{expanded:t.unref(a)}]),onTransitionend:f[0]||(f[0]=t.withModifiers(u=>s.value=!1,["self"])),onTransitionstart:f[1]||(f[1]=t.withModifiers(u=>s.value=!0,["self"]))},[t.createVNode(t.unref(Pe.KTooltip),{label:s.value?void 0:l.value,placement:t.unref(a)?"left":"right"},{default:t.withCtx(()=>[t.createVNode(t.unref(Pe.KButton),{appearance:"none",class:"nav-item nav-item-toggle",icon:"",size:"large",onClick:c},{default:t.withCtx(()=>[t.unref(a)?(t.openBlock(),t.createBlock(t.unref(Se.ChevronDoubleLeftIcon),{key:0,decorative:"",size:t.unref(Xa)},null,8,["size"])):(t.openBlock(),t.createBlock(t.unref(Se.ChevronDoubleRightIcon),{key:1,decorative:"",size:t.unref(Xa)},null,8,["size"]))]),_:1})]),_:1},8,["label","placement"])],34)])]))}}),[["__scopeId","data-v-2915b6fa"]]),nR={class:"dk-editor-main"},oR={class:"header"},rR={class:"actions"},iR={class:"settings"},aR={ref:"canvasContainer",class:"body"},lR=ve(t.defineComponent({__name:"EditorMain",setup(e){const{t:n}=Ze.createI18n("en-us",rt),{modalOpen:o,undo:r,redo:i,canUndo:a,canRedo:l,load:s}=at();function c(u){const p=oi.load(u,{schema:ni,json:!0});if(typeof p!="object"||p===null)return;const m=p,y={config:{...m,nodes:m.nodes??[]}};s(y,!0)}function d(){o.value=!1}Gp({enabled:o,undo:r,redo:i});const f={maxWidth:"300px",zIndex:1e4};return(u,p)=>(t.openBlock(),t.createElementBlock("div",nR,[t.createElementVNode("header",oR,[t.createElementVNode("div",rR,[t.createVNode(t.unref(Pe.KTooltip),{"z-index":1e4},{content:t.withCtx(()=>[t.createVNode(na,{keys:t.unref(zi).undo,label:t.unref(n)("plugins.free-form.datakit.flow_editor.actions.undo"),reverse:""},null,8,["keys","label"])]),default:t.withCtx(()=>[t.createVNode(t.unref(Pe.KButton),{appearance:"tertiary",disabled:!t.unref(a),icon:"",onClick:t.unref(r)},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.UndoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),t.createVNode(t.unref(Pe.KTooltip),{"z-index":1e4},{content:t.withCtx(()=>[t.createVNode(na,{keys:t.unref(zi).redo,label:t.unref(n)("plugins.free-form.datakit.flow_editor.actions.redo"),reverse:""},null,8,["keys","label"])]),default:t.withCtx(()=>[t.createVNode(t.unref(Pe.KButton),{appearance:"tertiary",disabled:!t.unref(l),icon:"",onClick:t.unref(i)},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.RedoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),p[0]||(p[0]=t.createElementVNode("div",{class:"divider"},null,-1)),t.createElementVNode("div",iR,[t.createVNode(zr,{label:t.unref(n)("plugins.free-form.datakit.flow_editor.debug.label"),"label-attributes":{info:t.unref(n)("plugins.free-form.datakit.flow_editor.debug.description"),tooltipAttributes:f},name:"config.debug"},null,8,["label","label-attributes"])]),p[1]||(p[1]=t.createElementVNode("div",{class:"divider"},null,-1)),t.createVNode(t.unref(Pe.KDropdown),{appearance:"tertiary","kpop-attributes":{placement:"bottom-end",target:"body"},"show-caret":"","trigger-text":t.unref(n)("plugins.free-form.datakit.flow_editor.examples")},{items:t.withCtx(()=>[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ul,(m,y)=>t.createVNode(t.unref(Pe.KDropdownItem),{key:y,onClick:_=>c(m)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)(`plugins.free-form.datakit.examples.${y}`)),1)]),_:2},1032,["onClick"])),64))]),_:1},8,["trigger-text"]),t.createVNode(t.unref(Pe.KButton),{appearance:"tertiary",target:"_blank",to:"https://developer.konghq.com/plugins/datakit/"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.actions.view_docs"))+" ",1),t.createVNode(t.unref(Se.ExternalLinkIcon))]),_:1}),t.createVNode(t.unref(Pe.KButton),{onClick:d},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.actions.done")),1)]),_:1})])]),t.createElementVNode("div",aR,[t.createVNode(Ns,{mode:"edit",resizable:""})],512)]))}}),[["__scopeId","data-v-ce8026b0"]]),sR=["draggable"],cR={class:"icon"},dR={class:"content"},uR={class:"title"},fR={class:"description"},pR=ve(t.defineComponent({__name:"NodePanelItem",props:{type:{},unsupported:{type:Boolean}},emits:["dragstart"],setup(e,{emit:n}){t.useCssVars(c=>({f628e926:t.unref(a),"4a9b9f82":t.unref(l)}));const o=n,{summary:r,icon:i,colors:{background:a,foreground:l}={}}=ml[e.type];function s(c){o("dragstart",c,e.type)}return(c,d)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["dk-node-panel-item",{[`node-type-${c.type}`]:!0,unsupported:c.unsupported}]),draggable:!c.unsupported,onDragstart:s},[t.createElementVNode("div",cR,[t.createVNode(t.unref(i),{size:16})]),t.createElementVNode("div",dR,[t.createElementVNode("div",uR,t.toDisplayString(c.type),1),t.createElementVNode("div",fR,t.toDisplayString(t.unref(r)),1)])],42,sR))}}),[["__scopeId","data-v-38d156c9"]]),mR={class:"dk-node-panel"},gR={key:0,class:"title"},hR={class:"node-list"},yR={"aria-hidden":"true",class:"preview",inert:""},Zm=ve(t.defineComponent({__name:"NodePanel",props:{hideTitle:{type:Boolean}},setup(e){const{t:n}=Ze.createI18n("en-us",rt),{createNode:o}=at(),r=t.inject(so.DATAKIT_M2,!1),i=["branch","cache"],a=`dk-drag-preview-${t.useId()}`,l=t.shallowRef(),s=t.computed(()=>l.value?[{id:"preview",type:"flow",data:l.value,position:{x:0,y:0}}]:[]),c=async(d,f)=>{var D,L,k;const u=d.currentTarget,{left:p,top:m,width:y,height:_}=u.getBoundingClientRect(),g=d.clientX-p,h=d.clientY-m;l.value=o({type:f}),await t.nextTick();const w=document.querySelector(`#${a}`)||u,b=w.cloneNode(!0);b.classList.add("dk-drag-snapshot");const{offsetWidth:x,offsetHeight:E}=w;Object.assign(b.style,{position:"absolute",top:"-9999px",left:"-9999px",width:`${x}px`,height:`${E}px`}),document.body.appendChild(b);const C=g/y,N=h/_,S={ratioX:C,ratioY:N,offsetX:x*C,offsetY:E*N},v={action:"create-node",data:{type:f,anchor:S}};(D=d.dataTransfer)==null||D.setData(kr,JSON.stringify(v)),(L=d.dataTransfer)==null||L.setData(`${kr}/${f}`,f),(k=d.dataTransfer)==null||k.setDragImage(b,S.offsetX,S.offsetY),requestAnimationFrame(()=>{b.remove(),l.value=void 0})};return(d,f)=>{const u=t.resolveComponent("KLabel");return t.openBlock(),t.createElementBlock("div",mR,[d.hideTitle?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("h3",gR,[t.createVNode(u,{class:"label",info:t.unref(n)("plugins.free-form.datakit.flow_editor.node_panel.description")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.node_panel.title")),1)]),_:1},8,["info"])])),t.createElementVNode("div",hR,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Object.keys(t.unref(ml)),p=>(t.openBlock(),t.createBlock(pR,{key:p,type:p,unsupported:!t.unref(r)&&i.includes(p),onDragstart:c},null,8,["type","unsupported"]))),128))]),t.createElementVNode("div",yR,[t.createVNode(t.unref(Fp),{nodes:s.value},{"node-flow":t.withCtx(p=>[t.createVNode(Wm,{id:a,data:p.data},null,8,["data"])]),_:1},8,["nodes"])])])}}}),[["__scopeId","data-v-03b0fafb"]]);function _R(){const{addField:e,getNodeByName:n,removeField:o,replaceConfig:r,renameField:i,disconnectOutEdges:a,nodeMapByName:l}=at(),s=n("vault");if(!s)throw new Error("no vault node");const c=t.computed(()=>{var y;return((y=l.value.get("vault"))==null?void 0:y.config)||{}});return{formData:t.computed(()=>({vault:{...c.value}})),addVault:(y,_)=>{e(s.id,"output",y,!1);const g={...s.config,[y]:_};r(s.id,g)},removeVault:y=>{const _=_n(s,"output",y);if(!_)return;const g=s.fields.output.length===1;o(s.id,_.id,!0,!1);const h=zo(s.config,y);r(s.id,h,!g),g&&a(s.id)},updateVault:(y,_,g=!0)=>{const h={...s.config,[y]:_};r(s.id,h,g)},renameVault:(y,_,g=!0)=>{var x;const h=_n(s,"output",y);if(!h)return;i(s.id,h.id,_,!1);const w=((x=s.config)==null?void 0:x[y])??"",b={...zo(s.config,y),[_]:w};r(s.id,b,g)}}}const bR=t.defineComponent({__name:"VaultSecretPicker",props:{secretRef:{type:[String,Boolean]},secretName:{},validateName:{type:Function,default:()=>{}},isEditing:{type:Boolean,default:!1}},emits:["proceed","cancel"],setup(e,{emit:n}){const o=n,{i18n:{t:r}}=Fe.useI18n(),i=t.inject(De.FORMS_CONFIG),a=t.ref(e.secretName||""),l=t.ref(""),s=t.computed(()=>a.value.trim()?e.validateName(a.value.trim(),e.isEditing)===void 0:!1),c=t.computed(()=>!s.value),d=()=>{const m=a.value.trim(),y=e.validateName(m,e.isEditing);return l.value=y||"",y===void 0},f=()=>{l.value="",d()},u=m=>{d()&&o("proceed",{secretRef:m,secretName:a.value.trim()})},p=()=>{a.value="",l.value="",o("cancel")};return t.watch(()=>e.secretName,m=>{a.value=m||"",l.value=""}),(m,y)=>{const _=t.resolveComponent("KInput"),g=t.resolveComponent("KEmptyState");return t.unref(i)?(t.openBlock(),t.createBlock(t.unref(Vo.VaultSecretPicker),{key:0,"additional-disabled":c.value,config:t.unref(i),"proceed-button-text":t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.proceed_button_text"),setup:m.secretRef,title:t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.title"),onCancel:p,onProceed:u},{"form-prefix":t.withCtx(()=>[t.createVNode(_,{"model-value":a.value,"onUpdate:modelValue":[y[0]||(y[0]=h=>a.value=h),f],"data-testid":"vault-secret-picker-secret-name-input",error:!!l.value,"error-message":l.value,label:t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.label"),"label-attributes":{info:t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.help")},placeholder:t.unref(r)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.placeholder"),required:""},null,8,["model-value","error","error-message","label","label-attributes","placeholder"])]),_:1},8,["additional-disabled","config","proceed-button-text","setup","title"])):(t.openBlock(),t.createBlock(g,{key:1,"icon-variant":"error",message:t.unref(r)("plugins.free-form.vault_picker.component_error")},null,8,["message"]))}}}),wR={class:"dk-vault-panel"},kR={class:"title"},CR={class:"vault-list"},ER={key:0,class:"vault-list-item"},NR={class:"vault-list-item-key"},SR={class:"vault-list-item-key-text"},xR=ve(t.defineComponent({__name:"VaultField",props:{name:{},initialValue:{},label:{},keyPlaceholder:{},valuePlaceholder:{},defaultKey:{},defaultValue:{},labelAttributes:{},showVaultSecretPicker:{type:Boolean},keyOrder:{}},emits:["update","add","remove","change"],setup(e,{emit:n}){const o=e,r=n,{entries:i,addEntry:a,removeEntry:l}=Hr(o,r),s=t.ref(null),c=t.ref(null),{i18n:{t:d}}=Fe.useI18n(),f=t.computed(()=>new Set(i.value.map(h=>h.key))),u=()=>{const h=a();c.value=h,s.value=h},p=()=>{s.value=null,c.value&&(l(c.value.id),c.value=null)},m=h=>{if(!s.value)throw new Error("no selected entry");const w=s.value.key,b=w!==h.secretName,x=s.value.value!==h.secretRef,E=b||x;s.value.value=h.secretRef,s.value.key=h.secretName,c.value?r("add",h.secretName,h.secretRef):E&&r("update",h.secretName,h.secretRef,b?w:void 0),c.value=null,p()},y=h=>{s.value=h},_=h=>{l(h.id),r("remove",h.key)},g=(h,w)=>{var b;if(!h)return d("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_required_error");if(f.value.has(h)&&!(w&&h===((b=s.value)==null?void 0:b.key)))return d("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_exists_error")};return(h,w)=>{var C,N;const b=t.resolveComponent("KButton"),x=t.resolveComponent("KDropdownItem"),E=t.resolveComponent("KDropdown");return t.openBlock(),t.createElementBlock("div",wR,[t.createElementVNode("h3",kR,t.toDisplayString(t.unref(d)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.title")),1),t.createVNode(b,{appearance:"tertiary",class:"add-button",size:"small",onClick:u},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(d)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.add_button")),1)]),_:1}),t.createElementVNode("div",CR,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i),S=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S.id},[S.key?(t.openBlock(),t.createElementBlock("div",ER,[t.createElementVNode("div",NR,[t.createVNode(t.unref(Se.KeyIcon),{color:t.unref(Wa),size:16},null,8,["color"]),t.createElementVNode("div",SR,t.toDisplayString(S.key),1)]),t.createVNode(E,null,{items:t.withCtx(()=>[t.createVNode(x,{onClick:v=>y(S)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(d)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:2},1032,["onClick"]),t.createVNode(x,{danger:"",onClick:v=>_(S)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(d)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:2},1032,["onClick"])]),default:t.withCtx(()=>[t.createVNode(b,{appearance:"tertiary",icon:""},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.MoreIcon),{color:t.unref(Ha)},null,8,["color"])]),_:1})]),_:2},1024)])):t.createCommentVNode("",!0)],64))),128))]),t.createVNode(bR,{"is-editing":!!s.value&&!c.value,"secret-name":(C=s.value)==null?void 0:C.key,"secret-ref":(N=s.value)==null?void 0:N.value,"validate-name":g,onCancel:p,onProceed:m},null,8,["is-editing","secret-name","secret-ref"])])}}}),[["__scopeId","data-v-c9f18d61"]]);function vR(){const{getSchema:e}=ze();return t.computed(()=>{const n=e("config.resources");if(!n)throw new Error("Failed to get resource schema");const o=ln(n);return o.fields.forEach(r=>{const i=Object.keys(r)[0];if(i==="cache"){const a=r[i];r[i]={...a,fields:[...a.fields,{partial_id:{type:"string"}}]}}}),o})}const AR={class:"dk-cache-panel"},IR={class:"title"},TR={key:0,class:"cache-item"},PR={class:"cache-item-key"},OR={class:"cache-item-key-text"},$R={class:"dk-resource-cache-form"},BR={key:1},VR={key:2,class:"dk-cache-inline-redis"},RR=ve(t.defineComponent({__name:"CacheField",props:{strategy:{}},emits:["update","remove","cancel"],setup(e,{emit:n}){const o=n,{getDefault:r,formData:i}=ze(),a=Et("cache");if(a.error)throw new Error("No cache schema");const l=t.ref(!1),{i18n:{t:s}}=Fe.useI18n(),c=t.computed(()=>!(d.value==="redis"&&!i.cache.partial_id&&!i.cache.redis)),d=t.computed(()=>{var x;return(x=a.value.value)==null?void 0:x.strategy}),f=t.computed(()=>{var x;return(x=a.value.value)!=null&&x.redis?oi.dump(a.value.value.redis,{indent:2,noRefs:!0}):""}),u=()=>{l.value=!0},p=()=>{l.value=!1,o("cancel")},m=()=>{o("remove")},y=()=>{u(),a.value.value||(a.value.value=r("cache"),a.value.value.strategy="memory")},_=()=>{l.value=!1,o("update",i)},g=Bs.createdBundledHighlighter({langs:{yaml:()=>import("@shikijs/langs/yaml")},themes:{"github-dark":()=>import("@shikijs/themes/github-dark")},engine:()=>yg.createJavaScriptRegexEngine()}),{codeToHtml:h}=Bs.createSingletonShorthands(g),w=()=>{var x,E;d.value==="memory"&&((x=i.cache)!=null&&x.partial_id)&&((E=i.cache)==null||delete E.partial_id)};async function b({codeElement:x,language:E,code:C}){x.innerHTML=await h(C,{lang:E,theme:"github-dark",structure:"inline"})}return(x,E)=>{const C=t.resolveComponent("KButton"),N=t.resolveComponent("KDropdownItem"),S=t.resolveComponent("KDropdown"),v=t.resolveComponent("KLabel"),D=t.resolveComponent("KCodeBlock"),L=t.resolveComponent("KModal");return t.openBlock(),t.createElementBlock("div",AR,[t.createElementVNode("h3",IR,t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title")),1),x.strategy?(t.openBlock(),t.createElementBlock("div",TR,[t.createElementVNode("div",PR,[t.createVNode(t.unref(Se.DeployIcon),{color:t.unref(Wa),size:t.unref(Ed)},null,8,["color","size"]),t.createElementVNode("div",OR,t.toDisplayString(x.strategy),1)]),t.createVNode(S,null,{items:t.withCtx(()=>[t.createVNode(N,{onClick:u},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1}),t.createVNode(N,{danger:"",onClick:m},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1})]),default:t.withCtx(()=>[t.createVNode(C,{appearance:"tertiary",icon:""},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.MoreIcon),{color:t.unref(Ha)},null,8,["color"])]),_:1})]),_:1})])):(t.openBlock(),t.createBlock(C,{key:1,appearance:"tertiary",class:"add-button",size:"small",onClick:y},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.add_button")),1)]),_:1})),t.createVNode(L,{"action-button-disabled":!c.value,"action-button-text":t.unref(s)("actions.save"),"max-width":"640px",title:t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title"),visible:l.value,onCancel:p,onProceed:_},{default:t.withCtx(()=>{var k,J;return[t.createElementVNode("div",$R,[t.createVNode(kd,{items:[{label:t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.memory"),value:"memory"},{label:t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.redis"),value:"redis"}],name:"strategy","onUpdate:modelValue":w},null,8,["items"]),d.value==="memory"?(t.openBlock(),t.createBlock(ht,{key:0,name:"memory.dictionary_name"})):t.createCommentVNode("",!0),d.value==="redis"?(t.openBlock(),t.createElementBlock("div",BR,[t.createVNode(v,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.select_redis_configuration")),1)]),_:1}),t.createVNode(t.unref(no.RedisConfigurationSelector),{"model-value":(k=t.unref(i).cache)==null?void 0:k.partial_id,"redis-type":"redis-ee","onUpdate:modelValue":E[0]||(E[0]=I=>t.unref(i).cache.partial_id=I)},null,8,["model-value"])])):t.createCommentVNode("",!0),d.value==="redis"&&!((J=t.unref(i).cache)!=null&&J.partial_id)&&f.value?(t.openBlock(),t.createElementBlock("div",VR,[t.createElementVNode("div",null,t.toDisplayString(t.unref(s)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config_preview")),1),t.createVNode(D,{id:"dk-cache-redis-configuration",code:f.value,language:"yaml",theme:"dark",onCodeBlockRender:b},null,8,["code"])])):t.createCommentVNode("",!0)])]}),_:1},8,["action-button-disabled","action-button-text","title","visible"])])}}}),[["__scopeId","data-v-ad53942e"]]),DR={class:"dk-resources-panel"},MR=ve(t.defineComponent({__name:"ResourcesPanel",setup(e){const n=vR(),o=t.ref(0),{addVault:r,removeVault:i,updateVault:a,renameVault:l,formData:s}=_R();function c(_,g,h){h&&h!==_&&l(h,_,!1),a(_,g)}const{state:d,commit:f}=at(),u=t.computed(()=>({cache:d.value.cacheConfig}));function p(_){d.value.cacheConfig=_.cache,f()}function m(){d.value.cacheConfig=void 0,f()}function y(){o.value++}return(_,g)=>(t.openBlock(),t.createElementBlock("div",DR,[t.createVNode(yt,{data:t.unref(s),schema:t.unref(n)},{default:t.withCtx(()=>[t.createVNode(xR,{name:"vault",onAdd:t.unref(r),onRemove:t.unref(i),onUpdate:c},null,8,["onAdd","onRemove"])]),_:1},8,["data","schema"]),g[0]||(g[0]=t.createElementVNode("hr",{class:"dk-resources-divider"},null,-1)),(t.openBlock(),t.createBlock(yt,{key:`${o.value}`,data:u.value,schema:t.unref(n)},{default:t.withCtx(()=>{var h;return[t.createVNode(RR,{strategy:(h=u.value.cache)==null?void 0:h.strategy,onCancel:y,onRemove:m,onUpdate:p},null,8,["strategy"])]}),_:1},8,["data","schema"]))]))}}),[["__scopeId","data-v-3a9010b8"]]),LR={class:"header"},FR={class:"title"},UR={class:"body"},KR={class:"panel"},jR=ve(t.defineComponent({__name:"SidePanel",setup(e){const{t:n}=Ze.createI18n("en-us",rt),{sidePanelExpanded:o}=Cl(),{propertiesPanelOpen:r,selectedNode:i}=at(),a=t.inject(so.DATAKIT_M2,!1),l=t.ref("nodes");function s(){r.value=!1}t.watch(i,d=>{d||s()});const c=t.ref(!1);return t.onMounted(()=>{c.value=!0}),(d,f)=>{const u=t.resolveComponent("KSegmentedControl");return t.openBlock(),t.createElementBlock("aside",{class:t.normalizeClass(["side-panel",{expanded:t.unref(o),inited:c.value}])},[t.createElementVNode("header",LR,[t.createElementVNode("h2",FR,t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.name")),1)]),t.createElementVNode("div",UR,[t.createElementVNode("div",KR,[t.unref(a)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(u,{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),options:[{label:t.unref(n)("plugins.free-form.datakit.flow_editor.panel_segments.nodes"),value:"nodes"},{label:t.unref(n)("plugins.free-form.datakit.flow_editor.panel_segments.resources.title"),value:"resources"}]},null,8,["modelValue","options"]),l.value==="nodes"?(t.openBlock(),t.createBlock(Zm,{key:0,"hide-title":""})):t.createCommentVNode("",!0),l.value==="resources"?(t.openBlock(),t.createBlock(MR,{key:1})):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createBlock(Zm,{key:1}))])])],2)}}}),[["__scopeId","data-v-ae943268"]]),GR=t.defineComponent({__name:"HttpMethodField",props:{name:{}},setup(e){return(n,o)=>(t.openBlock(),t.createBlock($t,{items:t.unref(Da)([...t.unref($u)]),name:n.name},null,8,["items","name"]))}}),qR=t.defineComponent({__name:"InputsRecordField",props:{name:{},items:{}},emits:["change:inputs"],setup(e){const{getSchema:n}=ze(),{i18n:o}=Be(),r=t.computed(()=>{const i=n("inputs");return i?i.fields.map(a=>Object.keys(a)[0]):[]});return(i,a)=>(t.openBlock(),t.createBlock(Nt,{"as-child":"",name:i.name,"reset-label-path":"isolate"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,l=>(t.openBlock(),t.createBlock($t,{key:l,clearable:"","enable-filtering":"",items:i.items,name:l,placeholder:t.unref(o).t("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:s=>i.$emit("change:inputs",l,s?s.value:null)},null,8,["items","name","placeholder","onChange"]))),128))]),_:1},8,["name"]))}}),zR=["data-testid"],HR={class:"dk-inputs-map-field-entry-body"},YR={class:"dk-inputs-map-field-entry-content"},WR=ve(t.defineComponent({__name:"InputsMapField",props:{items:{},fieldNameValidator:{},name:{},initialValue:{},label:{},keyPlaceholder:{},valuePlaceholder:{},defaultKey:{},defaultValue:{},labelAttributes:{},showVaultSecretPicker:{type:Boolean},keyOrder:{}},emits:["change:inputs","add:field","remove:field","rename:field","change"],setup(e,{emit:n}){const o=e,r=n,{entries:i,addEntry:a,removeEntry:l,field:s}=Hr(o,r),{i18n:{t:c}}=Be(),d=t.useTemplateRef("root"),f=t.ref(null),u=t.ref({});let p;async function m(E,C="key"){var N;d.value&&(await t.nextTick(),(N=d.value.querySelector(`[data-${C}-input="${E}"]`))==null||N.focus())}function y(){const{id:E}=a(),C=i.value.findIndex(({key:N})=>!N);m(C===-1?i.value.length-1:C),f.value=E}function _(E){l(E.id),E.id===f.value&&(f.value=null),E.key.trim()!==""&&r("remove:field",E.key)}function g(E){p=E.key}function h(E){if(w(E)){E.key=p,delete u.value[E.id];return}if(E.id===f.value){if(E.key.trim()==="")return;r("add:field",E.key,E.value),f.value=null}else r("rename:field",p,E.key);p=E.key}function w(E){delete u.value[E.id];const C=o.fieldNameValidator("input",p,E.key);if(C)return u.value[E.id]=C,C}function b(E){w(E)}function x(E,C){E.id!==f.value&&r("change:inputs",E.key,C)}return t.watch(()=>i.value,E=>{f.value&&(E.find(({id:C})=>C===f.value)||(f.value=null))}),(E,C)=>{const N=t.resolveComponent("KAlert"),S=t.resolveComponent("KLabel"),v=t.resolveComponent("KInput"),D=t.resolveComponent("KSelect"),L=t.resolveComponent("KButton");return t.unref(s).error?(t.openBlock(),t.createBlock(N,{key:0,appearance:"danger",message:t.unref(s).error.message},null,8,["message"])):(t.openBlock(),t.createElementBlock("div",{key:1,ref_key:"root",ref:d,class:"dk-inputs-map-field"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i),(k,J)=>(t.openBlock(),t.createElementBlock("div",{key:k.id,class:"dk-inputs-map-field-entry","data-testid":`ff-kv-container-${t.unref(s).path.value}.${J}`},[t.createVNode(S,{for:`ff-kv-entry-key-${t.unref(s).path.value}.${J}`},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input_name.label")),1)]),_:2},1032,["for"]),t.createElementVNode("div",HR,[t.createElementVNode("div",YR,[t.createVNode(v,{id:`ff-kv-entry-key-${t.unref(s).path.value}.${J}`,modelValue:k.key,"onUpdate:modelValue":[I=>k.key=I,I=>w(k)],modelModifiers:{trim:!0},class:"ff-kv-field-entry-key","data-key-input":J,"data-testid":`ff-key-${t.unref(s).path.value}.${J}`,error:!!u.value[k.id],"error-message":u.value[k.id],placeholder:t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input_name.placeholder"),onBlur:I=>b(k),onChange:I=>h(k),onFocus:I=>g(k)},null,8,["id","modelValue","onUpdate:modelValue","data-key-input","data-testid","error","error-message","placeholder","onBlur","onChange","onFocus"]),t.createVNode(D,{modelValue:k.value,"onUpdate:modelValue":I=>k.value=I,class:"ff-kv-field-entry-value",clearable:"","data-testid":`ff-value-${t.unref(s).path.value}.${J}`,"enable-filtering":"",items:E.items,label:t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input.source"),placeholder:t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:I=>x(k,(I==null?void 0:I.value)??null)},null,8,["modelValue","onUpdate:modelValue","data-testid","items","label","placeholder","onChange"])]),t.createVNode(L,{appearance:"tertiary",class:"dk-inputs-map-field-remove-btn","data-testid":`ff-kv-remove-btn-${t.unref(s).path.value}.${J}`,icon:"",onClick:I=>_(k)},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.CloseIcon))]),_:2},1032,["data-testid","onClick"])])],8,zR))),128)),t.createVNode(L,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${t.unref(s).path.value}`,disabled:!!f.value,onClick:y},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(c)("plugins.free-form.datakit.flow_editor.node_properties.input.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-b2f89c26"]]),XR={key:1,class:"dk-inputs-field-or"},Sn=ve(t.defineComponent({__name:"InputsField",props:{items:{},fieldNames:{},fieldNameValidator:{}},emits:["change:input","change:inputs","add:field","remove:field","rename:field"],setup(e,{emit:n}){const o=n,{getSchema:r}=ze(),{i18n:{t:i}}=Be(),a=t.computed(()=>r("inputs")),l=t.computed(()=>a.value?a.value.type==="record"?qR:WR:null);function s(p){o("change:input",p?p.value:null)}function c(p,m){o("add:field",p,m)}function d(p,m){o("change:inputs",p,m)}function f(p){o("remove:field",p)}function u(p,m){o("rename:field",p,m)}return(p,m)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(Pe.KLabel),{class:"dk-inputs-field-h1",info:t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.tooltip")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.label")),1)]),_:1},8,["info"]),t.unref(r)("input")?(t.openBlock(),t.createBlock($t,{key:0,class:"dk-inputs-field-h2",clearable:"","enable-filtering":"",items:p.items,label:t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.input"),"label-attributes":{info:void 0},name:"input",placeholder:t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:s},null,8,["items","label","placeholder"])):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createElementBlock("div",XR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.or")),1)])):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(t.unref(Pe.KLabel),{key:2,class:"dk-inputs-field-h2 dk-margin-0"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.fields")),1)]),_:1})):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(t.unref(l),{key:3,"field-name-validator":p.fieldNameValidator,items:p.items,"key-order":p.fieldNames,name:"inputs","onAdd:field":c,"onChange:inputs":d,"onRemove:field":f,"onRename:field":u},null,8,["field-name-validator","items","key-order"])):t.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-58657120"]]),ZR={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{query:{description:"HTTP request query",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"},JR={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"};function QR(e){const n=Number(e);return!isNaN(n)&&isFinite(n)}function Jn(...e){return function(o){for(const r of e){const i=r(o);if(i)return i}}}function $o(e){const{i18n:{t:n}}=Be(),o=()=>e?typeof e=="string"?e:n("plugins.free-form.datakit.flow_editor.node_properties.errors.not_empty",e):"Field is required";return function(i){if(i==null||typeof i=="string"&&i.trim()==="")return o()}}function Jm(e,n){const{i18n:{t:o}}=Be();return function(i){if(i!=null)switch(e){case"identifier":{const a=()=>n?typeof n=="string"?n:o("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_identifier_format",n):"Invalid identifier format";return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(i)?void 0:a()}case"url":{const a=()=>n?typeof n=="string"?n:o("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_url_format"):"Invalid URL format";try{new URL(i);return}catch{return a()}}default:return}}}function eD(e=0,n=1/0,o){const{i18n:{t:r}}=Be();return function(a){if(a!=null&&typeof a=="string"&&(a.length<e||a.length>n))return o?typeof o=="string"?o:r("plugins.free-form.datakit.flow_editor.node_properties.errors.string_len_range",{fieldName:o.fieldName,minLength:e,maxLength:n}):`Value must be between ${e} and ${n} characters`}}function Qm(e){const{i18n:{t:n}}=Be();return function(r){if(!QR(r))return e?typeof e=="string"?e:n("plugins.free-form.datakit.flow_editor.node_properties.errors.not_number",e):"Value must be a number"}}function Ss(e,n){const{i18n:{t:o}}=Be();return function(i){if(i==null)return;const a=Qm(n)(i);if(a)return a;const l=Number(i);switch(e){case"float":{const s=()=>n?typeof n=="string"?n:o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_float",n):"Invalid float format";return Number.isFinite(l)?void 0:s()}case"integer":{const s=()=>n?typeof n=="string"?n:o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_integer",n):"Invalid integer format";return Number.isInteger(l)?void 0:s()}default:return}}}function xs(e=-1/0,n=1/0,o){const{i18n:{t:r}}=Be();return function(a){if(a==null)return;const l=Qm(o)(a);if(l)return l;const s=Number(a);if(s<e||s>n)return o?typeof o=="string"?o:r("plugins.free-form.datakit.flow_editor.node_properties.errors.number_range",{fieldName:o.fieldName,min:e,max:n}):`Value must be between ${e} and ${n}`}}function tD(e,n){const{state:o}=at(),{i18n:{t:r}}=Be();return function(a){if(o.value.nodes.some(l=>l.name===a&&l.id!==e))return n?typeof n=="string"?n:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",n):"Name must be unique."}}function nD(e,n,o){const{i18n:{t:r}}=Be();return function(a){if(!n)return;if(o?n.fields[e].some(s=>s.name===a&&s.id!==o):n.fields[e].some(s=>s.name===a)){const s=r(e==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name");return r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",{fieldName:s})}}}function oD(){const{i18n:{t:e}}=Be();return function(o){if(hl(o))return e("plugins.free-form.datakit.flow_editor.node_properties.errors.reserved_node_name",{nodeName:o})}}function eg(e){const{i18n:{t:n}}=Be(),o={fieldName:n("plugins.free-form.datakit.flow_editor.node_properties.name")};return Jn($o(o),Jm("identifier",o),oD(),tD(e,o))}function rD(e){const{i18n:{t:n}}=Be(),{getNodeById:o}=at();return function(i,a,l){const s={fieldName:n(i==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name")};return Jn($o(s),nD(i,o(e),l))(a)}}function iD(e){const n=t.ref({}),o=t.computed(()=>Object.values(n.value).every(l=>!l)),r={};Object.keys(e).forEach(l=>{const s=e[l],c=u=>{const p=typeof u=="function"?u():u,m=s(p);return n.value[l]=m,m},d=()=>{n.value[l]=void 0},f=u=>(d(),c(u));r[l]={handleChange:f,handleBlur:f,validate:f,isValid:t.computed(()=>n.value[l]===void 0),error:t.computed(()=>n.value[l])}});function i(){n.value={}}function a(l){var s;for(const c of Object.keys(e)){const d=l[c],f=typeof d=="function"?d():d;(s=r[c])==null||s.validate(f)}return n.value}return{isValid:o,errorMap:n,fields:r,clearErrors:i,validate:a}}function vr(e){const{validationConfig:n,getValidationData:o,toggleNodeValid:r}=e,{skipValidation:i}=at(),a=t.computed(()=>typeof n=="function"?n():n),l=t.computed(()=>iD(a.value)),s=t.computed(()=>l.value.fields),c=t.computed(()=>l.value.isValid.value);function d(){const u=o(),p=l.value.validate(u),m={};for(const y in a.value)m[y]=p[y];return m}function f(u,p){return{onBlur:()=>{const m=o(),y=s.value[u];y&&y.handleBlur(m[u])},onUpdate:()=>{const m=o(),y=s.value[u];y&&y.handleChange(m[u]),p==null||p()},error:t.computed(()=>{const m=s.value[u];return m?!m.isValid.value:!1}),errorMessage:t.computed(()=>{const m=s.value[u];return m?m.error.value??"":""})}}return t.onMounted(()=>{i.value?i.value=!1:d()}),t.onBeforeUnmount(async()=>{try{const u=d(),p=Object.values(u).filter(Boolean).length>0;r(!p)}catch{}}),t.watch(()=>c.value,r,{immediate:!0}),{fields:s.value,isValid:c,validateAll:d,createFieldHandler:f}}function mn(e,n){const o=t.inject(so.DATAKIT_M2,!1),{state:r,renameNode:i,getNodeById:a,addField:l,renameField:s,removeField:c,replaceConfig:d,disconnectEdge:f,connectEdge:u,invalidConfigNodeIds:p,commit:m,revert:y}=at(),{i18n:{t:_}}=Be(),g=qm(),h=t.computed(()=>{const O=a(e);if(!O)throw new Error("Node not existed");return O}),w=t.computed(()=>{const P=r.value.edges.filter(T=>T.target===e).reduce((T,M)=>{var ie,be;const Y=a(M.source),z=(ie=bn(Y,"output",M.sourceField))==null?void 0:ie.id,H=(be=bn(h.value,"input",M.targetField))==null?void 0:be.name,Z=Y.id+(z?`.${z}`:"");return H?T.inputs={...T.inputs,[H]:Z}:T.input=Z,T},{});return h.value.fields.input.forEach(T=>{P.inputs||(P.inputs={}),P.inputs[T.name]||(P.inputs[T.name]=null)}),{...h.value.config,...P,name:h.value.name}}),b=O=>{i(e,O??"",!0,`${e}:rename`)},x=(O,P=!0)=>{if(!n)throw new Error("getFormInnerData is not defined");const T=zo(n(),["name","input","inputs"]),M=O?`update:${e}:${O}`:void 0;d(e,T,P,M)},E=(O,P)=>{const T=_n(h.value,O,P);if(!T)throw new Error(`Field with name "${P}" not found in node "${h.value.name}"`);return T},C=(O,P,T)=>{const M=!!T;l(e,O,P,!M),M&&L(P,T)},N=(O,P,T)=>{const M=E(O,P).id;s(e,M,T)},S=(O,P)=>{const T=E(O,P).id;c(e,T)},v=t.computed(()=>r.value.edges.filter(O=>O.target===e&&!O.targetField)[0]),D=t.computed(()=>r.value.edges.filter(O=>O.target===e&&O.targetField)),L=async(O,P)=>{const T=P==null,M=E("input",O).id;if(T){const le=D.value.find(ue=>ue.targetField===M);le&&f(le.id);return}const{nodeId:Y,fieldId:z}=Ru(P),H=E("input",O).id,Z=[];v.value&&(Z.push(xr(v.value,a)),f(v.value.id,!1));const ie=D.value.find(le=>le.targetField===M);ie&&(Z.push(xr(ie,a)),f(ie.id,!1)),u({source:Y,sourceField:z,target:e,targetField:H},!1);const be=Cs(Y,z,e,H,a),ee=Z[0]&&be?Z[0][1]===be[1]:!1;if(m(),ee||Z.length===0)return;await g(_("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[be],Z)||y()},k=async O=>{if(O==null){v.value&&f(v.value.id);return}const T=[];for(const Z of D.value)T.push(xr(Z,a)),f(Z.id,!1);v.value&&f(v.value.id,!1);const{nodeId:M,fieldId:Y}=Ru(O);u({source:M,sourceField:Y,target:e,targetField:void 0},!1);const z=Cs(M,Y,e,void 0,a);if(m(),T.length===0)return;await g(_("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[z],T)||y()},J=O=>{const P=[...r.value.edges,{source:O,target:e}];return wl(si(P))},I=t.computed(()=>{var P,T;const O=[];for(const M of r.value.nodes)if(!(!o&&M.type==="vault"||!((P=ko(M.type).io)!=null&&P.output))&&M.fields.output&&M.id!==e&&!(M.type==="property"&&!ss((T=M.config)==null?void 0:T.property))&&!J(M.id)&&!(h.value.phase==="request"&&M.phase==="response")&&!(M.type==="vault"&&M.fields.output.length===0)){O.push({value:M.id,label:M.name});for(const z of M.fields.output)O.push({value:`${M.id}.${z.id}`,label:`${M.name}.${z.name}`})}return O}),G=t.computed(()=>h.value.fields.input.map(O=>O.name)||[]);function j(O){p.value.delete(e),O||p.value.add(e)}const te=rD(e);function K(O,P,T){const M=a(e);if(!M)throw new Error("Node not found when validating field name");const Y=_n(M,O,P);return te(O,T,Y==null?void 0:Y.id)}return{formData:w,inputOptions:I,inputEdge:v,inputsEdges:D,inputsFieldNames:G,currentNode:h,setName:b,setConfig:x,addField:C,renameFieldByName:N,removeFieldByName:S,setInputs:L,setInput:k,nameValidator:eg(e),fieldNameValidator:K,toggleNodeValid:j}}function gn(e){const{getSchema:n}=ze();return t.computed(()=>{if(Vt(e))switch(e){case"response":return JR;case"service_request":return ZR}try{const l=n().fields[0].config.fields[0].nodes.elements.subschema_definitions[e];if(!l)throw new Error(`Subschema "${e}" not found in the schema.`);return l}catch(o){throw new Error(`Failed to get subschema "${e}": ${o.message}`)}})}const Qn=t.defineComponent({__name:"NameField",props:{name:{},validate:{type:Function}},emits:["update"],setup(e,{emit:n}){const o=e,r=n,{i18n:{t:i}}=Be(),a=t.ref(o.name),l=t.computed(()=>{const f=o.validate(a.value.trim());return f===void 0?"":f});let s=a.value.trim();function c(){if(l.value){a.value=s;return}r("update",a.value.trim())}function d(){s=a.value.trim()}return t.watch(()=>o.name,f=>{f!==a.value&&(a.value=f)}),(f,u)=>{const p=t.resolveComponent("KInput");return t.openBlock(),t.createBlock(p,{"model-value":a.value,"onUpdate:modelValue":u[0]||(u[0]=m=>a.value=m),"data-1p-ignore":"",error:!!l.value,"error-message":l.value,label:t.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.name"),required:"",onChange:c,onFocus:d},null,8,["model-value","error","error-message","label"])}}}),aD=t.defineComponent({__name:"NodeFormCall",props:{nodeId:{}},setup(e){const{i18n:{t:n}}=Be(),o=t.useTemplateRef("form"),r=gn("call"),{formData:i,setName:a,setConfig:l,inputOptions:s,setInputs:c,setInput:d,inputsFieldNames:f,nameValidator:u,toggleNodeValid:p,fieldNameValidator:m}=mn(e.nodeId,()=>o.value.getInnerData()),{createFieldHandler:y}=vr({validationConfig:{url:Jn($o({fieldName:"URL"}),Jm("url",{fieldName:"URL"})),timeout:Jn(Ss("integer"),xs(0,2147483646))},getValidationData:()=>({url:i.value.url,timeout:i.value.timeout}),toggleNodeValid:p}),_=y("url",()=>l("url")),g=y("timeout",()=>l("timeout"));return(h,w)=>{const b=t.resolveComponent("KLabel");return t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(i),schema:t.unref(r)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(i).name,validate:t.unref(u),onUpdate:t.unref(a)},null,8,["name","validate","onUpdate"]),t.createVNode(b,{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),t.createVNode(po,{error:t.unref(_).error.value,"error-message":t.unref(_).errorMessage.value,name:"url",onBlur:t.unref(_).onBlur,"onUpdate:modelValue":t.unref(_).onUpdate},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),t.createVNode(GR,{name:"method",onUpdate:w[0]||(w[0]=x=>t.unref(l)())}),t.createVNode(Mn,{error:t.unref(g).error.value,"error-message":t.unref(g).errorMessage.value,name:"timeout",onBlur:t.unref(g).onBlur,"onUpdate:modelValue":t.unref(g).onUpdate},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),t.createVNode(po,{name:"ssl_server_name","onUpdate:modelValue":w[1]||(w[1]=x=>t.unref(l)("ssl_server_name"))}),t.createVNode(Sn,{"field-name-validator":t.unref(m),"field-names":t.unref(f),items:t.unref(s),"onChange:input":t.unref(d),"onChange:inputs":t.unref(c)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),lD=t.defineComponent({__name:"NodeFormServiceRequest",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),o=gn("service_request"),{formData:r,inputOptions:i,setInputs:a,setInput:l,inputsFieldNames:s,fieldNameValidator:c}=mn(e.nodeId,()=>n.value.getInnerData());return(d,f)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(r),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Sn,{"field-name-validator":t.unref(c),"field-names":t.unref(s),items:t.unref(i),"onChange:input":t.unref(l),"onChange:inputs":t.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),sD=t.defineComponent({__name:"NodeFormResponse",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),o=gn("response"),{formData:r,inputOptions:i,setInputs:a,setInput:l,inputsFieldNames:s,fieldNameValidator:c}=mn(e.nodeId,()=>n.value.getInnerData());return(d,f)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(r),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Sn,{"field-name-validator":t.unref(c),"field-names":t.unref(s),items:t.unref(i),"onChange:input":t.unref(l),"onChange:inputs":t.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),tg={jqlang:"https://jqlang.org/manual/"},cD=t.defineComponent({__name:"NodeFormJq",props:{nodeId:{}},setup(e){const{i18n:{t:n},i18nT:o}=Be(),r=t.useTemplateRef("form"),i=gn("jq"),{formData:a,setName:l,setConfig:s,inputOptions:c,setInputs:d,setInput:f,addField:u,removeFieldByName:p,renameFieldByName:m,inputsFieldNames:y,nameValidator:_,toggleNodeValid:g,fieldNameValidator:h}=mn(e.nodeId,()=>r.value.getInnerData());function w(S,v){u("input",S,v)}function b(S){p("input",S)}function x(S,v){m("input",S,v)}const E=n("plugins.free-form.datakit.flow_editor.node_properties.jq.label"),{createFieldHandler:C}=vr({validationConfig:{jq:Jn($o({fieldName:E}),eD(1,10240,{fieldName:E}))},getValidationData:()=>({jq:a.value.jq}),toggleNodeValid:g}),N=C("jq",()=>s("jq"));return(S,v)=>{const D=t.resolveComponent("KLabel"),L=t.resolveComponent("KExternalLink");return t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(a),schema:t.unref(i)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(a).name,validate:t.unref(_),onUpdate:t.unref(l)},null,8,["name","validate","onUpdate"]),t.createVNode(D,{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),t.createVNode(po,{autosize:"",error:t.unref(N).error.value,"error-message":t.unref(N).errorMessage.value,label:t.unref(E),"label-attributes":{},multiline:"",name:"jq",resizable:"",onBlur:t.unref(N).onBlur,"onUpdate:modelValue":t.unref(N).onUpdate},{help:t.withCtx(()=>[t.createVNode(t.unref(o),{keypath:"plugins.free-form.datakit.flow_editor.node_properties.jq.help"},{link:t.withCtx(()=>[t.createVNode(L,{"hide-icon":"",href:t.unref(tg).jqlang},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(tg).jqlang),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["error","error-message","label","onBlur","onUpdate:modelValue"]),t.createVNode(Sn,{"field-name-validator":t.unref(h),"field-names":t.unref(y),items:t.unref(c),"onAdd:field":w,"onChange:input":t.unref(f),"onChange:inputs":t.unref(d),"onRemove:field":b,"onRename:field":x},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),dD=ve(t.defineComponent({__name:"OutputValueField",props:{fieldNameValidator:{},name:{},initialValue:{},label:{},keyPlaceholder:{},valuePlaceholder:{},defaultKey:{},defaultValue:{},labelAttributes:{},showVaultSecretPicker:{type:Boolean},keyOrder:{}},emits:["change:value","add:field","rename:field","remove:field","change"],setup(e,{emit:n}){const o=e,r=n,i=t.ref({}),{entries:a,addEntry:l,removeEntry:s,field:c}=Hr(o,r,!1),{i18n:d}=Be(),f=t.useTemplateRef("root"),u=t.ref(null);let p;async function m(E,C="key"){var N;f.value&&(await t.nextTick(),(N=f.value.querySelector(`[data-${C}-input="${E}"]`))==null||N.focus())}function y(){const E=l(),C=a.value.findIndex(({key:N})=>!N);m(C===-1?a.value.length-1:C),u.value=E}function _(E){var C;E.id===((C=u.value)==null?void 0:C.id)&&(u.value=null),s(E.id),E.key.trim()!==""&&r("remove:field",E.key)}function g(E){p=E.key}function h(E){var C;if(b(E)){E.key=p,delete i.value[E.id];return}if(E.id===((C=u.value)==null?void 0:C.id)){if(E.key.trim()==="")return;u.value=null,r("add:field",E.key,E.value)}else r("rename:field",p,E.key);p=E.key}function w(E,C){var S;if(C.id===((S=u.value)==null?void 0:S.id))return;const N=E.target.value.trim();r("change:value",C.key,N)}function b(E){delete i.value[E.id];const C=o.fieldNameValidator("output",p,E.key);if(C)return i.value[E.id]=C,C}function x(E){b(E)}return t.watchEffect(()=>{u.value&&!a.value.some(E=>E.id===u.value.id)&&a.value.push(u.value)}),(E,C)=>{const N=t.resolveComponent("KAlert"),S=t.resolveComponent("KLabel"),v=t.resolveComponent("KButton"),D=t.resolveComponent("KInput"),L=t.resolveComponent("KCard");return t.unref(c).error?(t.openBlock(),t.createBlock(N,{key:0,appearance:"danger",message:t.unref(c).error.message},null,8,["message"])):(t.openBlock(),t.createElementBlock("div",{key:1,ref_key:"root",ref:f,class:"dk-output-value-field"},[t.createVNode(S,{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(d).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.label")),1)]),_:1}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a),(k,J)=>(t.openBlock(),t.createBlock(L,{key:k.id,class:"dk-output-value-field-entry","data-testid":`ff-kv-container-${t.unref(c).path.value}.${J}`},{actions:t.withCtx(()=>[t.createVNode(v,{appearance:"none","data-testid":`ff-kv-remove-btn-${t.unref(c).path.value}.${J}`,icon:"",onClick:I=>_(k)},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.CloseIcon))]),_:2},1032,["data-testid","onClick"])]),default:t.withCtx(()=>[t.createVNode(D,{id:`ff-kv-entry-key-${t.unref(c).path.value}.${J}`,modelValue:k.key,"onUpdate:modelValue":[I=>k.key=I,I=>b(k)],modelModifiers:{trim:!0},class:"ff-kv-field-entry-key","data-key-input":J,"data-testid":`ff-key-${t.unref(c).path.value}.${J}`,error:!!i.value[k.id],"error-message":i.value[k.id],label:t.unref(d).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name"),required:"",onBlur:I=>x(k),onChange:I=>h(k),onFocus:I=>g(k)},null,8,["id","modelValue","onUpdate:modelValue","data-key-input","data-testid","error","error-message","label","onBlur","onChange","onFocus"]),t.createVNode(D,{modelValue:k.value,"onUpdate:modelValue":I=>k.value=I,modelModifiers:{trim:!0},class:"ff-kv-field-entry-value","data-testid":`ff-value-${t.unref(c).path.value}.${J}`,label:t.unref(d).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value"),onChange:I=>w(I,k)},null,8,["modelValue","onUpdate:modelValue","data-testid","label","onChange"])]),_:2},1032,["data-testid"]))),128)),t.createVNode(v,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${t.unref(c).path.value}`,disabled:!!u.value,onClick:y},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(d).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-5e17f8cb"]]);function uD(e){const n={};for(const[o,r]of Object.entries(e))typeof r=="object"&&r!==null?n[o]=JSON.stringify(r):n[o]=String(r);return n}function ra(e){const n={};for(const[o,r]of Object.entries(e))if(r!=null){n[o]=r;try{r==="null"?n[o]=null:(r==="true"||r==="false"||/^-?\d+(\.\d+)?$/.test(r)||r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))&&(n[o]=JSON.parse(r))}catch{}}return n}function fD(e,n,o){const r={};for(const i of Object.keys(e))i===n?r[o]=e[n]:r[i]=e[i];return r}const pD=t.defineComponent({__name:"NodeFormStatic",props:{nodeId:{}},setup(e){const{renameNode:n,getOutEdgesByNodeId:o,addField:r,renameField:i,removeField:a,replaceConfig:l,getNodeById:s}=at(),{fieldNameValidator:c}=mn(e.nodeId),d=gn("static"),f=eg(e.nodeId),u=t.computed(()=>s(e.nodeId)),p=t.computed(()=>{var b;return((b=u.value)==null?void 0:b.fields.output.map(x=>x.name))||[]});function m(b){if(!u.value)throw new Error("No current node");n(u.value.id,b??"")}const y=t.computed(()=>{var v;if(!u.value)return{};const b=((v=u.value.config)==null?void 0:v.values)??{},x={},E=o(u.value.id).map(D=>D.sourceField).filter(Boolean).map(D=>bn(u.value,"output",D)).map(D=>D==null?void 0:D.name).filter(Boolean),C=u.value.fields.output.map(D=>D.name),N=Object.keys(b);return new Set([...N,...E,...C]).forEach(D=>{if(D in b){x[D]=b[D];return}x[D]=""}),{name:u.value.name,values:uD(x)}});function _(b,x){if(!u.value)throw new Error("No selected node");const E=x!==void 0;if(r(e.nodeId,"output",b,!E),E){const C={values:ra({...y.value.values,[b]:x})};l(e.nodeId,C)}}function g(b,x){if(!u.value)throw new Error("No selected node");const E=_n(u.value,"output",b);if(!E)throw new Error("No field found to rename");const C={values:ra(fD(y.value.values??{},b,x))};l(e.nodeId,C,!1),i(e.nodeId,E.id,x)}function h(b){var C;if(!u.value)throw new Error("No selected node");const x=_n(u.value,"output",b);if(!x)throw new Error("No field found to delete");a((C=u.value)==null?void 0:C.id,x.id,!0,!1);const E={values:ra({...y.value.values})};delete E.values[b],l(e.nodeId,E)}function w(b,x){if(!u.value)throw new Error("No selected node");const E={...y.value.values};E[b]=x;const C={values:ra(E)};l(e.nodeId,C)}return(b,x)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:y.value,schema:t.unref(d)},{default:t.withCtx(()=>{var E;return[t.createVNode(Qn,{name:((E=u.value)==null?void 0:E.name)??"",validate:t.unref(f),onUpdate:m},null,8,["name","validate"]),t.createVNode(dD,{"field-name-validator":t.unref(c),"key-order":p.value,name:"values","onAdd:field":_,"onChange:value":w,"onRemove:field":h,"onRename:field":g},null,8,["field-name-validator","key-order"])]}),_:1},8,["data","schema"]))}}),mD={class:"dk-kong-property-item"},gD={class:"property-type"},hD={class:"property-badges"},yD=ve(t.defineComponent({__name:"PropertiesField",props:{validators:{}},emits:["update:model-value","update:property-key"],setup(e,{emit:n}){const{i18n:{t:o}}=Be(),r=e,i=n,{formData:a}=ze(),l=t.ref(Er(a.property)),s=t.computed(()=>Nr(a.property)),c=t.ref(ls(a.property)),d=t.computed(()=>a.property??""),f=t.computed(()=>Object.entries(Wn).map(([m])=>{var g;const y=Nr(m)?(g=a.property)==null?void 0:g.startsWith(m.replace(Po,"")):a.property===m;return{label:y&&c.value?m.replace(Po,c.value):m,value:m,selected:y}}));function u(m){const y=Hi.find(_=>{var g;return(g=a.property)==null?void 0:g.startsWith(_)});y&&(a.property=y+m,r.validators.key.handleChange(a.property),i("update:property-key",a.property))}function p(m){l.value!==Er(m==null?void 0:m.value)&&(a.property=(m==null?void 0:m.value)||null,l.value=Er(a.property),r.validators.property.handleBlur(()=>a.property),i("update:model-value",a.property))}return t.watch(()=>a.property,m=>{c.value=ls(m),l.value=Er(m)}),(m,y)=>{const _=t.resolveComponent("KBadge"),g=t.resolveComponent("KSelect"),h=t.resolveComponent("KInput");return t.openBlock(),t.createElementBlock(t.Fragment,null,[(t.openBlock(),t.createBlock(g,{key:d.value,"enable-filtering":"",error:!m.validators.property.isValid.value,help:m.validators.property.error.value,items:f.value,label:"Property","label-attributes":{maxWidth:"300px",placement:"top",info:"The property name to get/set"},required:"",onBlur:y[0]||(y[0]=w=>m.validators.property.handleBlur(()=>t.unref(a).property)),onChange:p},{"item-template":t.withCtx(({item:w})=>[t.createElementVNode("div",mD,[t.createElementVNode("div",null,[t.createElementVNode("div",null,t.toDisplayString(w.label),1),t.createElementVNode("div",gD,t.toDisplayString(t.unref(Wn)[w.value].dataType),1)]),t.createElementVNode("div",hD,[t.unref(Wn)[w.value].readable?(t.openBlock(),t.createBlock(_,{key:0,appearance:"info"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.property.get")),1)]),_:1})):t.createCommentVNode("",!0),t.unref(Wn)[w.value].writable?(t.openBlock(),t.createBlock(_,{key:1,appearance:"warning"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.property.set")),1)]),_:1})):t.createCommentVNode("",!0)])])]),_:1},8,["error","help","items"])),s.value?(t.openBlock(),t.createBlock(h,{key:0,"model-value":c.value,"onUpdate:modelValue":[y[1]||(y[1]=w=>c.value=w),u],error:!m.validators.key.isValid.value,"error-message":m.validators.key.error.value,label:"key",required:"",onBlur:y[2]||(y[2]=w=>m.validators.key.handleBlur(()=>t.unref(a).property))},null,8,["model-value","error","error-message"])):t.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-0ab1be87"]]),_D=t.defineComponent({__name:"NodeFormProperty",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),{selectedNode:o,disconnectInEdges:r,disconnectOutEdges:i}=at(),a=gn("property"),{formData:l,setName:s,setConfig:c,inputOptions:d,setInputs:f,setInput:u,inputsFieldNames:p,nameValidator:m,toggleNodeValid:y,fieldNameValidator:_}=mn(e.nodeId,()=>n.value.getInnerData()),g=t.computed(()=>cs(l.value.property));function h(b){var E;const x=(E=o.value)==null?void 0:E.id;if(!x)throw new Error("Expected selectedNode to be defined");ss(b)||i(x,!1),cs(b)||r(x,!1),c()}const{fields:w}=vr({validationConfig:()=>({property:$o({fieldName:"Property"}),key:Nr(l.value.property)?$o({fieldName:"Key"}):()=>{}}),getValidationData:()=>({property:l.value.property,key:ls(l.value.property)}),toggleNodeValid:y});return(b,x)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(l),schema:t.unref(a)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(l).name,validate:t.unref(m),onUpdate:t.unref(s)},null,8,["name","validate","onUpdate"]),t.createVNode($t,{name:"content_type",onUpdate:x[0]||(x[0]=E=>t.unref(c)())}),t.createVNode(yD,{validators:t.unref(w),"onUpdate:modelValue":h,"onUpdate:propertyKey":x[1]||(x[1]=E=>t.unref(c)("property-key"))},null,8,["validators"]),g.value?(t.openBlock(),t.createBlock(Sn,{key:0,"field-name-validator":t.unref(_),"field-names":t.unref(p),items:t.unref(d),"onChange:input":t.unref(u),"onChange:inputs":t.unref(f)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])):t.createCommentVNode("",!0)]),_:1},8,["data","schema"]))}}),bD=t.defineComponent({__name:"NodeFormExit",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),o=gn("exit"),{formData:r,setName:i,setConfig:a,inputOptions:l,setInputs:s,setInput:c,inputsFieldNames:d,nameValidator:f,toggleNodeValid:u,fieldNameValidator:p}=mn(e.nodeId,()=>n.value.getInnerData()),{createFieldHandler:m}=vr({validationConfig:{status:Jn(Ss("integer",{fieldName:"Status"}),xs(200,599,{fieldName:"Status"}))},getValidationData:()=>({status:r.value.status}),toggleNodeValid:u}),y=m("status",()=>a("status"));return(_,g)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(r),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(r).name,validate:t.unref(f),onUpdate:t.unref(i)},null,8,["name","validate","onUpdate"]),t.createVNode(Mn,{error:t.unref(y).error.value,"error-message":t.unref(y).errorMessage.value,name:"status",onBlur:t.unref(y).onBlur,"onUpdate:modelValue":t.unref(y).onUpdate},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),t.createVNode(zr,{name:"warn_headers_sent","onUpdate:modelValue":g[0]||(g[0]=h=>t.unref(a)())}),t.createVNode(Sn,{"field-name-validator":t.unref(p),"field-names":t.unref(d),items:t.unref(l),"onChange:input":t.unref(c),"onChange:inputs":t.unref(s)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}});function wD(e){const n=mn(e),{state:o,getNodeById:r,branchGroups:i,commit:a}=at(),{i18n:{t:l}}=Be(),s=qm(),c=Km(),d=t.computed(()=>{var b;const h={...n.formData.value},w=nr(((b=n.currentNode.value)==null?void 0:b.type)||"branch");for(const x of w)(!(x in h)||h[x]==null)&&(h[x]=[]);return h});function f(h,w,b){const x=r(h),E=r(b),C=x?`${x.name}.${w}`:`${h}.${w}`,N=E?E.name:b;return[C,N]}function u(h){return(h==null?[]:Array.isArray(h)?h:[h]).filter(w=>Vu(w))}function p(h,w){return i.wouldCreateCycle(h,w)?(c({message:l("plugins.free-form.datakit.flow_editor.error.branch_cycle"),appearance:"danger"}),!0):!1}function m(h,w,b){const x=[],E=[],C=[];for(const N of b){const S=i.findMembership(N);if(!S||S.ownerId===h&&S.branch===w)continue;const v=i.getMembers(S.ownerId,S.branch).filter(D=>D!==N);C.push({ownerId:S.ownerId,branch:S.branch,members:v}),x.push(f(h,w,N)),E.push(f(S.ownerId,S.branch,N))}return{conflictUpdates:C,addedAssignments:x,removedAssignments:E}}function y(h,w,b,x){let E=!1;for(const C of x)E=i.setMembers(C.ownerId,C.branch,C.members,{commit:!1})||E;return E=i.setMembers(h,w,b,{commit:!1})||E,E}async function _(h,w){const b=n.currentNode.value,x=u(w),E=i.prepareMembers(b.id,h,x),C=i.getMembers(b.id,h);if(yl(C,E))return!0;const N=E.filter(k=>!C.includes(k));for(const k of N)if(p(b.id,k))return!1;const{conflictUpdates:S,addedAssignments:v,removedAssignments:D}=m(b.id,h,N);return S.length>0&&!await s(l("plugins.free-form.datakit.flow_editor.confirm.message.branch_replace"),v,D)?!1:(y(b.id,h,E,S)&&a(),!0)}const g=t.computed(()=>{const h=n.currentNode.value;return!h||!i?[]:o.value.nodes.filter(w=>w.id!==e&&!Vt(w.type)&&w.phase===h.phase&&!i.wouldCreateCycle(h.id,w.id)).map(w=>({value:w.id,label:w.name}))});return{...n,formData:d,branchOptions:g,updateBranchMembers:_}}const kD=t.defineComponent({__name:"NodeFormBranch",props:{nodeId:{}},setup(e){const{i18n:{t:n}}=Be(),o=gn("branch"),r=t.ref(0),{formData:i,setName:a,inputOptions:l,branchOptions:s,nameValidator:c,setInput:d,setInputs:f,inputsFieldNames:u,fieldNameValidator:p,updateBranchMembers:m}=wD(e.nodeId);async function y(_,g){await m(_,g)||(r.value+=1)}return(_,g)=>(t.openBlock(),t.createBlock(yt,{key:r.value,data:t.unref(i),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(i).name,validate:t.unref(c),onUpdate:t.unref(a)},null,8,["name","validate","onUpdate"]),t.createVNode(t.unref(Pe.KLabel),{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(n)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),t.createVNode($t,{"enable-filtering":"",items:t.unref(s),multiple:"",name:"then",onUpdate:g[0]||(g[0]=h=>y("then",h))},null,8,["items"]),t.createVNode($t,{"enable-filtering":"",items:t.unref(s),multiple:"",name:"else",onUpdate:g[1]||(g[1]=h=>y("else",h))},null,8,["items"]),t.createVNode(Sn,{"field-name-validator":t.unref(p),"field-names":t.unref(u),items:t.unref(l),"onChange:input":t.unref(d),"onChange:inputs":t.unref(f)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),CD=t.defineComponent({__name:"NodeFormCache",props:{nodeId:{}},setup(e){const n=t.useTemplateRef("form"),o=gn("cache"),{i18n:{t:r}}=Be(),{formData:i,setName:a,setConfig:l,inputOptions:s,setInputs:c,setInput:d,inputsFieldNames:f,nameValidator:u,toggleNodeValid:p,fieldNameValidator:m}=mn(e.nodeId,()=>n.value.getInnerData()),{createFieldHandler:y}=vr({validationConfig:()=>({ttl:Jn(Ss("integer",{fieldName:"TTL"}),xs(1,1/0,{fieldName:"TTL"}))}),getValidationData:()=>({ttl:i.value.ttl}),toggleNodeValid:p}),_=y("ttl",()=>l("ttl"));return(g,h)=>(t.openBlock(),t.createBlock(yt,{ref:"form",data:t.unref(i),schema:t.unref(o)},{default:t.withCtx(()=>[t.createVNode(Qn,{name:t.unref(i).name,validate:t.unref(u),onUpdate:t.unref(a)},null,8,["name","validate","onUpdate"]),t.createVNode(t.unref(Pe.KLabel),{class:"dk-node-configuration-label"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),t.createVNode(zr,{name:"bypass_on_error","onUpdate:modelValue":h[0]||(h[0]=w=>t.unref(l)("bypass_on_error"))}),t.createVNode(Mn,{error:t.unref(_).error.value,"error-message":t.unref(_).errorMessage.value,name:"ttl",onBlur:t.unref(_).onBlur,"onUpdate:modelValue":t.unref(_).onUpdate},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),t.createVNode(Sn,{"field-name-validator":t.unref(m),"field-names":t.unref(f),items:t.unref(s),"onChange:input":t.unref(d),"onChange:inputs":t.unref(c)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),ED=["innerHTML"],ND=t.defineComponent({__name:"NodePropertiesPanel",props:{maxWidth:{default:`${zp}px`},offsetTop:{default:`${lP}px`},visible:{type:Boolean},nodeId:{}},emits:["close"],setup(e){const{getNodeById:n}=at(),o=t.computed(()=>e.nodeId&&n(e.nodeId)),r=t.computed(()=>{var i;switch((i=o.value)==null?void 0:i.type){case"call":return aD;case"service_request":return lD;case"response":return sD;case"jq":return cD;case"static":return pD;case"property":return _D;case"exit":return bD;case"branch":return kD;case"cache":return CD;default:return null}});return(i,a)=>(t.openBlock(),t.createBlock(t.unref(Pe.KSlideout),{class:"dk-node-properties-panel","close-on-blur":!1,"has-overlay":!1,"max-width":i.maxWidth,"offset-top":i.offsetTop,visible:i.visible,"z-index":t.unref(aP),onClose:a[0]||(a[0]=l=>i.$emit("close"))},t.createSlots({default:t.withCtx(()=>[o.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dk-node-properties-panel-desc",innerHTML:t.unref(Bt)(o.value.type)},null,8,ED)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(t.unref(r),{key:i.nodeId,class:"dk-node-properties-panel-form","node-id":i.nodeId},null,8,["node-id"])):t.createCommentVNode("",!0)]),_:2},[o.value?{name:"title",fn:t.withCtx(()=>[t.createVNode(Ym,{type:o.value.type},null,8,["type"])]),key:"0"}:void 0]),1032,["max-width","offset-top","visible","z-index"]))}}),SD=ve(ND,[["__scopeId","data-v-bad25d77"]]),xD={class:"dk-editor-content"},vD={class:"main"},AD=ve(t.defineComponent({__name:"EditorContent",setup(e){const{propertiesPanelOpen:n,selectedNode:o}=at();function r(){n.value=!1}t.watch(o,a=>{a||r()});const i=t.ref(!1);return t.onMounted(()=>{i.value=!0}),(a,l)=>{var s;return t.openBlock(),t.createElementBlock("div",xD,[t.createVNode(t.unref(jR)),t.createElementVNode("div",vD,[t.createVNode(lR)]),t.createVNode(SD,{"node-id":(s=t.unref(o))==null?void 0:s.id,visible:t.unref(n),onClose:r},null,8,["node-id","visible"])])}}}),[["__scopeId","data-v-8f04afa6"]]),ID={key:0,class:"dk-editor-modal"},TD=ve(t.defineComponent({__name:"EditorModal",props:{open:{type:Boolean},openModifiers:{}},emits:["update:open"],setup(e){t.useCssVars(s=>({"8758bbfe":`${t.unref(iP)}px`,"30e03211":`${t.unref(qp)}px`}));const n=t.useModel(e,"open"),o=t.ref(!1),r=t.useTemplateRef("confirm-modal"),{clear:i}=at();wV(async(...s)=>{o.value=!0;const c=await r.value.open(...s);return o.value=!1,c});const a=Ye.useScrollLock(document);t.watch(n,s=>{a.value=!!s,s||i()},{immediate:!0});function l(){n.value=!1}return(s,c)=>n.value?(t.openBlock(),t.createElementBlock("div",ID,[t.createVNode(tR,{class:"nav",onBack:l}),t.createVNode(AD,{ref:"content",class:"content",tabindex:"0"},null,512),t.createVNode(ZV,{ref:"confirm-modal"},null,512)])):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-abbb8dba"]]),PD={class:"dk-flow-editor"},OD={class:"flow-panels-container"},$D={class:"overlay"},BD=ve(t.defineComponent({__name:"FlowEditor",props:{isEditing:{type:Boolean}},emits:["change","error"],setup(e,{emit:n}){const{t:o}=Ze.createI18n("en-us",rt),{formData:r}=ze(),i=n;function a(c,d,f,u){const p={...r.config,nodes:c};f!==void 0&&(p.resources=f);const m={...r.__ui_data,...d};r.config=p,r.__ui_data=m,u!=null?r.partials=[{id:u}]:r.partials&&(r.partials=null),i("change",p,m)}const{modalOpen:l,setPendingFitView:s}=zu(r,{onChange:a,isEditing:e.isEditing});return t.watch(l,()=>{s(!0)},{flush:"post"}),(c,d)=>{const f=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",PD,[t.createElementVNode("div",OD,[t.createVNode(Ns,{inactive:t.unref(l),mode:"preview"},null,8,["inactive"]),t.createElementVNode("div",$D,[t.createVNode(f,{appearance:"secondary",class:"button-open-editor",onClick:d[0]||(d[0]=u=>l.value=!0)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(o)("plugins.free-form.datakit.flow_editor.cta"))+" ",1),t.createVNode(t.unref(Se.ExpandIcon))]),_:1})])]),t.createVNode(TD,{open:t.unref(l),"onUpdate:open":d[1]||(d[1]=u=>t.isRef(l)?l.value=u:null)},null,8,["open"])])}}}),[["__scopeId","data-v-5f140817"]]);function VD(e,n){const o=[],r=(i,a)=>{typeof a=="string"&&o.push({nodeName:e.name,path:["nodes",n,...i],value:a})};if("input"in e&&e.input!=null&&r(["input"],e.input),"inputs"in e&&e.inputs&&typeof e.inputs=="object")for(const[i,a]of Object.entries(e.inputs))a!=null&&r(["inputs",i],a);if("output"in e&&e.output!=null&&r(["output"],e.output),"outputs"in e&&e.outputs&&typeof e.outputs=="object")for(const[i,a]of Object.entries(e.outputs))a!=null&&r(["outputs",i],a);return o}function RD(e){const n=e.path[2];return n==="output"||n==="outputs"}function ng(e){if(!e)return!1;for(const n of Object.values(e))if(n!=null)return!0;return!1}function og(e,n){const o=e.input!==void 0&&e.input!==null,r=ng(e.inputs);o&&r&&n.addIssue({code:"custom",message:'A node cannot use both "input" and "inputs". Use one or the other.',path:["inputs"]});const i=e.output!==void 0&&e.output!==null,a=ng(e.outputs);i&&a&&n.addIssue({code:"custom",message:'A node cannot use both "output" and "outputs". Use one or the other.',path:["outputs"]})}function rg(e,n,o){if(!e.nodes)return;const r=e.nodes.map(c=>c.name),i=new Set;r.forEach((c,d)=>{i.has(c)&&o.addIssue({code:"custom",message:`Duplicate node name: "${c}"`,path:["nodes",d,"name"]}),i.add(c)});const a=new Set([...n,...r]),l=new Map,s=new Map;e.nodes.forEach((c,d)=>{for(const f of VD(c,d)){const u=f.value.split(".",1)[0];if(a.has(u)||o.addIssue({code:"custom",message:`Unknown node "${u}" in connection "${f.value}"`,path:f.path}),RD(f)){const p=`${f.nodeName}->${u}`;s.has(p)?o.addIssue({code:"custom",message:`Connection specified on both sides: "${f.nodeName}" outputs to "${u}" and "${u}" inputs from "${f.nodeName}". Specify it on one side only.`,path:f.path}):l.set(p,l.get(p)??f.path)}else{const p=`${u}->${f.nodeName}`;l.has(p)?o.addIssue({code:"custom",message:`Connection specified on both sides: "${u}" outputs to "${f.nodeName}" and "${f.nodeName}" inputs from "${u}". Specify it on one side only.`,path:f.path}):s.set(p,s.get(p)??f.path)}}})}const DD=X.z.enum(Pu),MD=X.z.enum(bo),ig=e=>bo.includes(e),vs=X.z.enum(Ou),ag=vs.options;X.z.union([vs,DD]);const LD=/^[A-Za-z_][A-Za-z0-9_-]{0,254}$/,lg=X.z.string().min(1).max(255).regex(LD,"Invalid node name (snake_case / kebab-case only)").refine(e=>!ig(e),"Name clashes with reserved implicit node").brand(),ia=X.z.union([MD,lg]),FD=X.z.string().min(1).brand(),UD=["then","else"];X.z.enum(UD);const ut=X.z.string().refine(e=>{if(ia.safeParse(e).success)return!0;const n=e.match(/^([^.]+)\.([^.]+)$/);if(!n)return!1;const[,o,r]=n;return ia.safeParse(o).success&&FD.safeParse(r).success},'Invalid connection, expected "NODE" or "NODE.FIELD"').nullish(),sg=X.z.enum($u),eo=X.z.object({type:X.z.string(),name:lg,input:ut,inputs:X.z.record(X.z.string(),ut).nullish(),output:ut,outputs:X.z.record(X.z.string(),ut).nullish()}).loose().superRefine((e,n)=>{og(e,n)}),KD=X.z.object({type:X.z.string(),name:X.z.string()}).loose().superRefine((e,n)=>{const o=e.type,r=e.name;(typeof r!="string"||r.length===0||r.includes("."))&&n.addIssue({code:"custom",path:["name"],message:"invalid node name",fatal:!1}),ag.includes(o)||n.addIssue({code:"custom",path:["type"],message:`unknown node type "${o}", expected one of: ${ag.join(", ")}`})}),jD=eo.safeExtend({type:X.z.literal("call"),method:sg.nullish(),ssl_server_name:X.z.string().min(1).nullish(),timeout:X.z.number().int().min(0).max(2147483646).nullish(),url:X.z.url(),inputs:X.z.object({body:ut,headers:ut,query:ut}).partial().nullish(),outputs:X.z.object({body:ut,headers:ut,status:ut}).partial().nullish()}).strict(),GD=eo.safeExtend({type:X.z.literal("exit"),status:X.z.number().int().min(200).max(599).nullish(),warn_headers_sent:X.z.boolean().nullish(),output:X.z.never().optional(),outputs:X.z.never().optional()}).strict(),qD=eo.safeExtend({type:X.z.literal("jq"),jq:X.z.string().min(1).max(10240),outputs:X.z.never().optional()}).strict(),zD=eo.safeExtend({type:X.z.literal("property"),content_type:X.z.enum(["application/json","text/plain","application/octet-stream"]).nullish(),property:X.z.string().min(1),inputs:X.z.never().optional(),outputs:X.z.never().optional()}).strict(),HD=eo.safeExtend({type:X.z.literal("static"),values:X.z.record(X.z.string(),X.z.unknown()),input:X.z.never().optional(),inputs:X.z.never().optional()}).strict(),YD=eo.safeExtend({type:X.z.literal("cache"),bypass_on_error:X.z.boolean().nullish(),inputs:X.z.object({data:ut,key:ut,ttl:ut}).partial().nullish(),outputs:X.z.object({data:ut,hit:ut,miss:ut,stored:ut}).partial().nullish(),ttl:X.z.number().int().gt(0).nullish()}).strict(),WD=eo.safeExtend({type:X.z.literal("branch"),then:X.z.array(ia).nullish(),else:X.z.array(ia).nullish()}).strict(),XD=KD.pipe(X.z.discriminatedUnion("type",[jD,GD,qD,zD,HD,YD,WD])),ZD=X.z.record(X.z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).min(1).max(255),X.z.string().min(1).max(4095)),JD=X.z.object({dictionary_name:X.z.string().default("kong_db_cache")}),QD=X.z.object({host:X.z.string().default("127.0.0.1"),port:X.z.number().int().min(0).max(65535).default(6379)}),eM=X.z.object({ip:X.z.string().default("127.0.0.1"),port:X.z.number().int().min(0).max(65535).default(6379)}),tM=X.z.object({host:X.z.string().optional().default("127.0.0.1"),port:X.z.number().int().min(0).max(65535).optional().default(6379),connect_timeout:X.z.number().int().min(0).max(2147483646).default(2e3),send_timeout:X.z.number().int().min(0).max(2147483646).default(2e3),read_timeout:X.z.number().int().min(0).max(2147483646).default(2e3),username:X.z.string().optional(),password:X.z.string().optional(),sentinel_username:X.z.string().optional(),sentinel_password:X.z.string().optional(),database:X.z.number().int().optional().default(0),keepalive_pool_size:X.z.number().int().min(1).max(2147483646).default(256),keepalive_backlog:X.z.number().int().min(0).max(2147483646).optional(),sentinel_master:X.z.string().optional(),sentinel_role:X.z.enum(["master","slave","any"]).optional(),sentinel_nodes:X.z.array(QD).min(1,{message:"sentinel_nodes must contain at least 1 item"}).optional(),cluster_nodes:X.z.array(eM).min(1,{message:"cluster_nodes must contain at least 1 item"}).optional(),ssl:X.z.boolean().default(!1).optional(),ssl_verify:X.z.boolean().default(!1).optional(),server_name:X.z.string().optional(),cluster_max_redirections:X.z.number().int().default(5).optional(),connection_is_proxied:X.z.boolean().default(!1).optional(),timeout:X.z.number().int().optional(),sentinel_addresses:X.z.array(X.z.string()).min(1).optional(),cluster_addresses:X.z.array(X.z.string()).min(1).optional()}).superRefine((e,n)=>{var c;const o=e.host!==void 0&&e.host!==null,r=e.port!==void 0&&e.port!==null;(o&&!r||!o&&r)&&n.addIssue({code:"custom",message:"host and port must be specified together",path:o?["port"]:["host"]});const i=!!e.sentinel_master,a=!!e.sentinel_role,l=!!((c=e.sentinel_nodes)!=null&&c.length),s=[i,a,l].filter(Boolean).length;s>0&&s<3&&n.addIssue({code:"custom",message:"sentinel_master, sentinel_role and sentinel_nodes must be provided together"}),e.connection_is_proxied===!0&&!o&&n.addIssue({code:"custom",message:"host is required when connection_is_proxied is true (host/port should point to the proxy)",path:["host"]})}),nM=X.z.object({strategy:X.z.enum(["memory","redis"]).optional(),memory:JD,redis:tM}),oM=X.z.object({vault:ZD.nullish(),cache:nM.nullish()});X.z.array(X.z.object({id:X.z.string()})),X.z.object({nodes:X.z.array(XD).min(1,"At least one node is required"),debug:X.z.boolean().nullish(),resources:oM.nullish()}).strict().superRefine((e,n)=>{rg(e,bo,n)});const cg=vs.options,As=X.z.string().min(1).refine(e=>!e.includes("."),"Invalid node name").refine(e=>!ig(e),"Node name conflicts with reserved implicit node"),ft=X.z.string().refine(e=>{if(!e||/\s/.test(e))return!1;const n=e.indexOf(".");if(n===-1)return!0;const o=e.slice(0,n),r=e.slice(n+1);return o.length>0&&r.length>0},"Invalid connection"),to=X.z.object({type:X.z.string(),name:As,input:ft.nullish(),inputs:X.z.record(X.z.string(),ft.nullish()).nullish(),output:ft.nullish(),outputs:X.z.record(X.z.string(),ft.nullish()).nullish()}).loose().superRefine((e,n)=>{og(e,n)}),rM=X.z.object({type:X.z.string(),name:X.z.string()}).loose().superRefine((e,n)=>{const o=e.type,r=e.name;(typeof r!="string"||r.length===0||r.includes("."))&&n.addIssue({code:"custom",path:["name"],message:"Invalid node name",fatal:!1}),cg.includes(o)||n.addIssue({code:"custom",path:["type"],message:`unknown node type "${o}", expected one of: ${cg.join(", ")}`})}),iM=to.safeExtend({type:X.z.literal("call"),method:sg.nullish(),ssl_server_name:X.z.string().nullish(),timeout:X.z.union([X.z.number(),X.z.string()]).nullish(),url:X.z.string().nullish(),inputs:X.z.object({body:ft.nullish(),headers:ft.nullish(),query:ft.nullish()}).partial().nullish(),outputs:X.z.object({body:ft.nullish(),headers:ft.nullish(),status:ft.nullish()}).partial().nullish()}).strict(),aM=to.safeExtend({type:X.z.literal("exit"),status:X.z.union([X.z.number(),X.z.string()]).nullish(),warn_headers_sent:X.z.boolean().nullish(),output:X.z.never().optional(),outputs:X.z.never().optional()}).strict(),lM=to.safeExtend({type:X.z.literal("jq"),jq:X.z.string().nullish(),outputs:X.z.never().optional()}).strict(),sM=to.safeExtend({type:X.z.literal("property"),content_type:X.z.string().nullish(),property:X.z.string().nullish(),inputs:X.z.never().optional(),outputs:X.z.never().optional()}).strict(),cM=to.safeExtend({type:X.z.literal("static"),values:X.z.record(X.z.string(),X.z.unknown()).nullish(),input:X.z.never().optional(),inputs:X.z.never().optional()}).strict(),dM=to.safeExtend({type:X.z.literal("cache"),bypass_on_error:X.z.boolean().nullish(),inputs:X.z.object({data:ft.nullish(),key:ft.nullish(),ttl:ft.nullish()}).partial().nullish(),outputs:X.z.object({data:ft.nullish(),hit:ft.nullish(),miss:ft.nullish(),stored:ft.nullish()}).partial().nullish(),ttl:X.z.union([X.z.number(),X.z.string()]).nullish()}).strict(),uM=to.safeExtend({type:X.z.literal("branch"),then:X.z.array(As).nullish(),else:X.z.array(As).nullish()}).strict(),fM=rM.pipe(X.z.discriminatedUnion("type",[iM,aM,lM,sM,cM,dM,uM])),pM=X.z.record(X.z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).min(1).max(255),X.z.string().min(1).max(4095)),mM=X.z.object({dictionary_name:X.z.string().default("kong_db_cache")}),gM=X.z.object(),hM=X.z.object({strategy:X.z.enum(["memory","redis"]).optional(),memory:mM.optional(),redis:gM.optional()}),yM=X.z.object({vault:pM.nullish(),cache:hM.nullish()}),_M=X.z.object({nodes:X.z.array(fM).nullish(),debug:X.z.boolean().nullish(),resources:yM.nullish()}).strict().superRefine((e,n)=>{!e||!Array.isArray(e.nodes)||rg(e,bo,n)}).nullish(),bM={class:"option-label"},wM=["innerHTML"],kM=ve(t.defineComponent({__name:"DatakitForm",props:{generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{},schema:{},formSchema:{},model:{},formModel:{},formOptions:{},isEditing:{type:Boolean},onModelUpdated:{type:Function},onFormChange:{type:Function},onValidityChange:{type:Function}},setup(e){const{t:n}=Ze.createI18n("en-us",rt),o=e,r=t.inject(so.DATAKIT_ENABLE_FLOW_EDITOR,!1),i=t.inject(so.DATAKIT_M2,!1),{editorMode:a}=Cl(),l=t.computed(()=>r&&c.value?a.value:"code"),s={flow:Se.DesignIcon,code:Se.CodeblockIcon},c=t.ref(!0),d=t.computed(()=>{const _=[{label:n("plugins.free-form.datakit.flow_editor.mode"),value:"flow"},{label:n("plugins.free-form.datakit.code_editor.mode"),value:"code"}];return _[0].disabled=!c.value,_}),f=t.computed(()=>{switch(l.value){case"code":return n("plugins.free-form.datakit.description_code");case"flow":return n("plugins.free-form.datakit.description_flow");default:return""}});t.watch(l,()=>{var _;(_=o.onValidityChange)==null||_.call(o,{model:"config",valid:!0})});function u(){var _;(_=o.onValidityChange)==null||_.call(o,{model:"config",valid:!0})}function p(){u()}function m(_){var w;u();const{success:g}=_M.safeParse(_);let h=g;if(!i&&h){const b=_;(w=b==null?void 0:b.resources)!=null&&w.vault&&(h=!1)}c.value=h}function y(_){var g;c.value=!1,(g=o.onValidityChange)==null||g.call(o,{model:"config",valid:!1,error:_})}return(_,g)=>{const h=t.resolveComponent("KTooltip");return t.openBlock(),t.createBlock(Ad,t.mergeProps(o,{class:"dk-form"}),t.createSlots({default:t.withCtx(w=>[t.createVNode(yt,t.mergeProps(w,{tag:"div"}),{default:t.withCtx(()=>[l.value==="flow"?(t.openBlock(),t.createBlock(BD,{key:0,"is-editing":o.isEditing,onChange:p},null,8,["is-editing"])):l.value==="code"?(t.openBlock(),t.createBlock(i1,{key:1,class:"code-editor",editing:o.isEditing,onChange:m,onError:y},null,8,["editing"])):t.createCommentVNode("",!0)]),_:2},1040)]),"plugin-config-description":t.withCtx(()=>[t.createElementVNode("span",{innerHTML:f.value},null,8,wM)]),_:2},[t.unref(r)?{name:"plugin-config-extra",fn:t.withCtx(()=>[t.createVNode(t.unref(Pe.KSegmentedControl),{"model-value":l.value,options:d.value,"onUpdate:modelValue":g[0]||(g[0]=w=>a.value=w)},{"option-label":t.withCtx(({option:w})=>[t.createVNode(h,{disabled:c.value||w.value!=="flow",text:t.unref(n)("plugins.free-form.datakit.flow_editor.disabled_tooltip")},{default:t.withCtx(()=>[t.createElementVNode("div",bM,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s[w.value]))),t.createTextVNode(" "+t.toDisplayString(w.label),1)])]),_:2},1032,["disabled","text"])]),_:1},8,["model-value","options"])]),key:"0"}:void 0]),1040)}}}),[["__scopeId","data-v-6b230b53"]]),dg=e=>{if(!(!e||typeof e!="object"))for(const[n,o]of Object.entries(e))typeof o=="string"&&(e[n]=o.split(/\s*,\s*/).filter(Boolean))},ug=e=>{if(!(!e||typeof e!="object"))for(const[n,o]of Object.entries(e))Array.isArray(o)&&(e[n]=o.join(", "))},CM=t.defineComponent({__name:"ConfigForm",props:{schema:{},data:{},onChange:{type:Function}},emits:["change"],setup(e,{emit:n}){const o=n,{i18n:{t:r}}=Fe.useI18n(),l={prepareFormData:c=>{var f,u;const d=lo(c);return(u=(f=d.config)==null?void 0:f.tools)!=null&&u.length&&d.config.tools.forEach(p=>{ug(p.headers),ug(p.query)}),d},hasValue:c=>!!(c!=null&&c.config)},s=c=>{var f,u;const d=lo(c);(u=(f=d.config)==null?void 0:f.tools)!=null&&u.length&&d.config.tools.forEach(p=>{dg(p.headers),dg(p.query)}),o("change",d)};return(c,d)=>(t.openBlock(),t.createBlock(yt,{config:l,data:c.data,schema:c.schema,tag:"div",onChange:s},{default:t.withCtx(()=>[t.createVNode(Nt,{"as-child":"",name:"config","reset-label-path":"reset"},{tools:t.withCtx(({name:f})=>[t.createVNode(Yr,{appearance:"tabs","item-label":(u,p)=>t.unref(r)("plugins.free-form.ai-mcp-proxy.tool_item_label",{index:p+1}),name:f,"sticky-tabs":""},null,8,["item-label","name"])]),_:1}),t.createVNode(Wr)]),_:1},8,["data","schema"]))}}),EM=t.defineComponent({__name:"AIMcpProxyForm",props:{schema:{},formSchema:{},model:{},formModel:{},formOptions:{},isEditing:{type:Boolean},onModelUpdated:{type:Function},onFormChange:{type:Function}},setup(e){const n=e,o=t.useSlots();return t.provide(De.AUTOFILL_SLOT,o==null?void 0:o[De.AUTOFILL_SLOT_NAME]),(r,i)=>(t.openBlock(),t.createBlock(qa,t.normalizeProps(t.guardReactiveProps(n)),{default:t.withCtx(a=>[t.createVNode(CM,t.normalizeProps(t.guardReactiveProps(a)),null,16)]),_:1},16))}}),NM=ve(t.defineComponent({__name:"ConfigForm",props:{schema:{},data:{}},emits:["change"],setup(e,{emit:n}){const o=n,r=t.computed(()=>{const l=e.schema.fields.find(d=>Object.keys(d)[0]==="config").config.fields,s=[],c=[];for(const d of l){const f=Object.keys(d)[0];d[f].required?s.push(f):c.push(f)}return{required:s,nonRequired:c}}),i={hasValue:l=>!!(l!=null&&l.config)};function a(l){o("change",l)}return(l,s)=>(t.openBlock(),t.createBlock(yt,{config:i,data:l.data,schema:l.schema,tag:"div",onChange:a},{default:t.withCtx(()=>[t.createVNode(Nt,{"as-child":"",name:"config",omit:r.value.nonRequired,"reset-label-path":"reset"},null,8,["omit"]),t.createVNode(Wr,{class:"ff-advanced-fields"},{default:t.withCtx(()=>[t.createVNode(Nt,{"as-child":"",name:"config",omit:r.value.required,"reset-label-path":"reset"},null,8,["omit"])]),_:1})]),_:1},8,["data","schema"]))}}),[["__scopeId","data-v-3e5ed51d"]]),fg=Object.freeze(Object.defineProperty({__proto__:null,AIMcpProxyForm:EM,CommonForm:t.defineComponent({__name:"CommonForm",props:{generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{},schema:{},formSchema:{},model:{},formModel:{},formOptions:{},isEditing:{type:Boolean},onModelUpdated:{type:Function},onFormChange:{type:Function},onValidityChange:{type:Function}},setup(e){const n=e,o=t.useSlots();return t.provide(De.AUTOFILL_SLOT,o==null?void 0:o[De.AUTOFILL_SLOT_NAME]),(r,i)=>(t.openBlock(),t.createBlock(Ad,t.normalizeProps(t.guardReactiveProps(n)),{default:t.withCtx(a=>[t.createVNode(NM,t.normalizeProps(t.guardReactiveProps(a)),null,16)]),_:1},16))}}),DatakitForm:kM,RequestCalloutForm:Ak,ServiceProtectionForm:OC},Symbol.toStringTag,{value:"Module"})),SM={class:"kong-ui-entities-plugin-form"},xM={key:1,class:"entity-form"},vM={class:"plugin-config-empty-state"},AM=ve(t.defineComponent({__name:"PluginEntityForm",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||e.app==="konnect"&&!e.controlPlaneId||e.app==="kongManager"&&typeof e.workspace!="string")},entityMap:{type:Object,default:()=>({})},record:{type:Object,default:()=>({})},schema:{type:Object,default:()=>({})},rawSchema:{type:Object,default:()=>({})},editing:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},enableRedisPartial:{type:Boolean,default:!1},engine:{type:String,required:!1}},emits:["loading","model-updated","showNewPartialModal","globalAction","validity-change"],setup(e,{emit:n}){var ie,be;const o=Object.keys(De.sharedForms),r=Object.keys(fg);if(new Set([...o,...r]).size!==o.length+r.length)throw new Error("Duplicate form component names found in `sharedForms` and `freeForm`");const i=n,a=e,{axiosInstance:l}=he.useAxios((ie=a.config)==null?void 0:ie.axiosRequestConfig),{parseSchema:s}=Fe.useSchemas({entityId:((be=a.entityMap.focusedEntity)==null?void 0:be.id)||void 0,credential:a.credential,enableRedisPartial:a.enableRedisPartial,experimentalRenders:a.config.app==="konnect"?a.config.experimentalRenders:void 0}),{convertToDotNotation:c,unFlattenObject:d,dismissField:f,isObjectEmpty:u,unsetNullForeignKey:p}=Fe.usePluginHelpers(),m=Fe.useExperimentalFreeForms(),{objectsAreEqual:y}=he.useHelpers(),{i18n:{t:_}}=Be(),g=ee=>a.config.app==="konnect"?ee.replace(/{controlPlaneId}/gi,a.config.controlPlaneId||""):a.config.app==="kongManager"?ee.replace(/\/{workspace}/gi,a.config.workspace?`/${a.config.workspace}`:""):ee,h=(ee,re)=>{let le=`${a.config.apiBaseUrl}${Xe.form[a.config.app].entityGetOne}`;return le=g(le),le=le.replace(/{entity}/gi,ee),le=le.replace(/{id}/gi,re),le},w=ee=>{let re=`${a.config.apiBaseUrl}${Xe.form[a.config.app].entityGetAll}`;return re=g(re),re=re.replace(/{entity}/gi,ee),re},b=(ee,re)=>{const le=h(ee,re);return l.get(le)},x=(ee,re)=>{const le=w(ee);return a.config.app==="konnect"?l.get(le).then(ue=>{const{data:{data:fe}}=ue;if(delete re.size,delete re.offset,fe.length&&Object.keys(re).length===1){const B=Object.keys(re)[0],V=fe.filter(F=>F[B]?!!F[B].toLowerCase().includes(re[B].toLowerCase()):!1);ue.data.data=V}return ue}):l.get(le,{params:re})},E=(ee,re,le)=>{const ue=w(ee);if(a.config.app==="konnect"){const{size:fe,offset:B,...V}=re;if(ee==="consumer_groups")return l.get(ue,{params:{size:1e3},signal:le}).then(R=>{const{data:{data:Q}}=R;if(Q.length&&Object.keys(V).length===1){const q=Object.keys(V)[0],ae=Q.filter(A=>A[q]?!!A[q].toLowerCase().includes(V[q].toLowerCase()):!1);R.data.data=ae}return R});const F={size:fe,offset:B};for(const R of Object.keys(V))F.filter={[R]:{contains:V[R]}};return l.get(ue,{params:F,signal:le})}return l.get(ue,{params:re,signal:le})},C=(ee,re=50)=>{const le=w(ee);return l.get(le,{params:{size:re}})};t.provide(De.FORMS_API_KEY,{getOne:b,getAll:x,getAllV2:E,peek:C}),t.provide(De.FORMS_CONFIG,a.config);const N=t.ref(""),S=t.ref(""),v=t.ref(null),D=t.ref({}),L=t.reactive({}),k=t.reactive({}),J=t.computed(()=>{var ee;return(ee=v.value)==null?void 0:ee.options}),I=t.ref(!1),G=t.ref(),j=(ee,re)=>{I.value=ee??"",G.value=re},te=ee=>{var re;(re=G.value)==null||re.call(G,ee),I.value=!1},K=()=>{var V,F;const ee={...a.schema},re=k,le=L,ue=Object.keys(re),fe={};if(!u(D.value))for(let R=0;R<((F=(V=D.value)==null?void 0:V.fields)==null?void 0:F.length);R++)ee[D.value.fields[R].model]=D.value.fields[R];De.customFields.forEach(R=>{ee[R]&&(ee[R].fields.forEach(Q=>{Q.fields&&Q.fields.forEach(q=>{ee[q.model]=q}),Q.model&&(ee[Q.model]=Q)}),delete ee[R])}),ue.forEach(R=>{var _e;if(!ee[R]){R==="partials"&&(fe[R]=re[R]);return}const Q=ee[R];let q=re[R];const ae=le[R],A=Array.isArray(q)?"array":typeof q,U=Q?Q.valueType:null,$=Q?Q.valueArrayType:null,oe=Q?Q.transform:null;if(q==null&&ae==null&&!Q.submitWhenNull)return;if(Q){if(U&&A!==U)switch(U){case"array":A==="string"&&q.length&&(q=q.split(",").map(ke=>{if(ke=ke.trim(),$==="string")return String(ke);if($==="number")return Number(ke);if($==="boolean"){if(typeof ke=="string")return ke.toLowerCase()==="true"||ke==="1";if(typeof ke=="number")return ke===1}return ke})),(!q||!q.length)&&(q=Q.submitWhenNull?null:[]);break;case"number":q=Number(q);break;case"boolean":A==="string"&&(q=q.toLowerCase()==="true"||q==="1"),A==="number"&&(q=q===1);break;case"string":q=q==null?"":String(q);break}else U==="array"&&(!q||!q.length?q=Q.submitWhenNull?null:[]:((_e=Q.inputAttributes)==null?void 0:_e.type)==="number"&&(q=q.map(ke=>Number(ke))));if(Q.type==="array"&&Q.nestedFields){const ke=de=>{Object.keys(de).forEach(Ne=>{de[Ne]&&typeof de[Ne]=="object"&&!Array.isArray(de[Ne])&&de[Ne]!==null?ke(de[Ne]):(de[Ne]===void 0||de[Ne]===null||typeof de[Ne]=="number"&&isNaN(de[Ne])||typeof de[Ne]=="string"&&de[Ne].trim().length===0)&&delete de[Ne]})};q&&typeof q=="object"&&ke(q)}Q.type==="object-advanced"&&Q.fields&&q!==null&&(Object.entries(q).length===0?q=null:Object.keys(q).forEach(ke=>{Array.isArray(q[ke])||(q[ke]=q[ke].split(","))}))}let ne=c(R);if(Q.fieldNameHasDashes){const[ke,...de]=ne.split(".").reverse();ne=[ke.replace(/_/g,"-"),...de].reverse().join(".")}if(U==="object-expand"){let ke;[ne,ke]=ne.split(".");let de={};fe[ne]&&(de=fe[ne]),de[ke]=q,q=de}ae!==void 0&&q===""&&q!==ae?fe[ne]=U==="object"?{}:null:Q.type==="checklist"&&q===""?fe[ne]=[]:q!==""&&(fe[ne]=q),fe[ne]=oe?oe(q):fe[ne],p(ne,fe)});const B=d(fe);return S.value&&Object.assign(B,Y.value),B},O=(ee,re={})=>{f(k,re,ee,a.editing),i("model-updated",{model:k,originalModel:L,data:K()})},P=(ee,re)=>{var fe;const le={[re]:ee};typeof((fe=a.schema[re])==null?void 0:fe.modelTransformer)=="function"&&(le[re]=a.schema[re].modelTransformer(ee));const ue=Object.assign({},k,le);Object.assign(k,ue),i("model-updated",{model:k,originalModel:L,data:K()})},T=ee=>{i("validity-change",ee)},M=(ee,re)=>{Object.keys(ee).forEach(le=>{var F,R;let ue=re?`${re}-${le}`:le,fe=a.schema[ue];if(!fe){const Q=re?`${re}-${le.replace(/-/g,"_")}`:le.replace(/-/g,"_");(F=a.schema[Q])!=null&&F.fieldNameHasDashes&&(ue=Q,fe=a.schema[ue]),re&&((R=a.schema[re])==null?void 0:R.keyFromObject)===le&&(ue=re,fe=a.schema[ue])}const B=ee[le],V=typeof B;if(fe&&fe.type==="object-advanced"&&!B){k[ue]={},L[ue]={};return}if(Array.isArray(B)){k[ue]=JSON.parse(JSON.stringify(B)),L[ue]=JSON.parse(JSON.stringify(B));return}if(V==="object"&&B&&!B.length)return M(B,ue);if(V==="object"&&B&&B.length&&fe.type==="input"){k[ue]=B.join(", "),L[ue]=B.join(", ");return}k[ue]=B,L[ue]=B}),i("model-updated",{model:k,originalModel:L,data:K()})},Y=t.shallowRef(a.record),z=ee=>{Y.value=ee,i("model-updated",{model:{...k,...ee},originalModel:L,data:K()})},H=t.ref(!0),Z=()=>{var ee;if(a.record&&a.schema&&(M({enabled:a.record.enabled??!0,...a.record.instance_name&&{instance_name:a.record.instance_name||""},...a.record.protocols&&{protocols:a.record.protocols},...a.record.tags&&{tags:a.record.tags}}),a.credential?((a.record.consumer_id||a.record.consumer)&&M({consumer_id:a.record.consumer_id||a.record.consumer}),M(a.record)):a.record.config&&((a.record.consumer_id||a.record.consumer||a.record.service_id||a.record.service||a.record.route_id||a.record.route||a.record.consumer_group_id||a.record.consumer_group)&&M({service_id:a.record.service_id||a.record.service,route_id:a.record.route_id||a.record.route,consumer_id:a.record.consumer_id||a.record.consumer,consumer_group_id:a.record.consumer_group_id||a.record.consumer_group}),a.record.partials&&O("redis",{partials:a.record.partials}),S.value?z(a.record):M(a.record.config,"config"))),Object.keys(a.entityMap).length&&!a.entityMap.global&&a.schema){const re={};for(const le in a.entityMap){const ue=a.entityMap[le].id,fe=a.entityMap[le].idField,B=fe==="consumer_group_id"?"consumer_group-id":JSON.parse(JSON.stringify(fe).replace("_","-"));Object.prototype.hasOwnProperty.call(k,B)&&(re[B]=ue)}M(re)}if((ee=a.entityMap.consumer)!=null&&ee.id&&a.schema&&a.credential){const re={};Object.prototype.hasOwnProperty.call(k,"consumer")&&(re.consumer=a.entityMap.consumer.id),M(re)}H.value=!1};return t.watch(H,ee=>{i("loading",ee)}),t.watch(()=>a.schema,(ee,re)=>{var ue,fe;if(y(ee||{},re||{}))return;const le=s(ee,void 0,void 0,a.engine);Object.assign(k,le.model),D.value={fields:(fe=(ue=D.value)==null?void 0:ue.fields)==null?void 0:fe.map(B=>({...B,disabled:B.disabled||!1}))},Object.assign(L,JSON.parse(JSON.stringify(le.model))),S.value=a.engine?a.engine==="vfg"?void 0:Va(le.model.name,m)||"CommonForm":Va(le.model.name,m),N.value=De.getSharedFormName(le.model.name),Z()},{immediate:!0,deep:!0}),t.onBeforeMount(()=>{var ee,re;v.value=s(a.schema,void 0,void 0,a.engine),Object.assign(k,((ee=v.value)==null?void 0:ee.model)||{}),D.value=((re=v.value)==null?void 0:re.schema)||{},Z()}),(ee,re)=>{var ue;const le=t.resolveComponent("KSkeleton");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",SM,[H.value?(t.openBlock(),t.createBlock(le,{key:0,type:"form"})):k.id&&e.editing||!e.editing?(t.openBlock(),t.createElementBlock("div",xM,[S.value?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(fg[S.value]),{key:0,"form-model":k,"form-options":J.value,"form-schema":D.value,"is-editing":e.editing,model:e.record,"on-form-change":z,"on-model-updated":P,"on-validity-change":T,schema:e.rawSchema,onGlobalAction:re[0]||(re[0]=(fe,B)=>ee.$emit("globalAction",fe,B))},t.createSlots({_:2},[e.enableVaultSecretPicker?{name:t.unref(De.AUTOFILL_SLOT_NAME),fn:t.withCtx(fe=>[fe.schema.referenceable?(t.openBlock(),t.createBlock(t.unref(Vo.VaultSecretPickerProvider),t.mergeProps({key:0},fe,{onOpen:j}),null,16)):t.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["form-model","form-options","form-schema","is-editing","model","schema"])):N.value?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(De.sharedForms)[N.value]),{key:1,"enable-redis-partial":e.enableRedisPartial,"form-model":k,"form-options":J.value,"form-schema":D.value,"is-editing":e.editing,"on-model-updated":P,"on-partial-toggled":O,"show-new-partial-modal":fe=>ee.$emit("showNewPartialModal",fe)},t.createSlots({_:2},[e.enableVaultSecretPicker?{name:t.unref(De.AUTOFILL_SLOT_NAME),fn:t.withCtx(fe=>[fe.schema.referenceable?(t.openBlock(),t.createBlock(t.unref(Vo.VaultSecretPickerProvider),t.mergeProps({key:0},fe,{onOpen:j}),null,16)):t.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["enable-redis-partial","form-model","form-options","form-schema","is-editing","show-new-partial-modal"])):(t.openBlock(),t.createBlock(t.unref(De.VueFormGenerator),{key:2,"enable-redis-partial":e.enableRedisPartial,"is-editing":e.editing,model:k,options:J.value,schema:D.value,onModelUpdated:P,onPartialToggled:O,onRefreshModel:K,onShowNewPartialModal:re[1]||(re[1]=fe=>ee.$emit("showNewPartialModal",fe))},t.createSlots({"plugin-config-empty-state":t.withCtx(()=>[t.createElementVNode("div",vM,t.toDisplayString(t.unref(_)("plugins.form.grouping.plugin_configuration.empty")),1)]),_:2},[(ue=t.unref(Gt)[k.name])!=null&&ue.fieldRules&&(a.config.isNewOtelSchema||k.name!=="opentelemetry")?{name:"plugin-config-before-content",fn:t.withCtx(()=>[t.createVNode(P0,{rules:t.unref(Gt)[k.name].fieldRules},null,8,["rules"])]),key:"0"}:void 0,e.enableVaultSecretPicker?{name:t.unref(De.AUTOFILL_SLOT_NAME),fn:t.withCtx(fe=>[fe.schema.referenceable?(t.openBlock(),t.createBlock(t.unref(Vo.VaultSecretPickerProvider),t.mergeProps({key:0},fe,{onOpen:j}),null,16)):t.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["enable-redis-partial","is-editing","model","options","schema"]))])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(Vo.VaultSecretPicker),{config:a.config,setup:I.value,onCancel:re[2]||(re[2]=()=>I.value=!1),onProceed:te},null,8,["config","setup"])],64)}}}),[["__scopeId","data-v-3a5319dd"]]),IM={key:1},TM=t.defineComponent({__name:"PluginFormActionsWrapper",props:{teleportTarget:{type:String,default:""}},setup(e){return(n,o)=>e.teleportTarget?(t.openBlock(),t.createBlock(t.Teleport,{key:0,to:e.teleportTarget},[t.renderSlot(n.$slots,"default")],8,["to"])):(t.openBlock(),t.createElementBlock("div",IM,[t.renderSlot(n.$slots,"default")]))}}),PM={class:"kong-ui-entities-plugin-form-container"},OM={key:0},$M={class:"plugin-form-actions"},BM=ve(t.defineComponent({__name:"PluginForm",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||e.app==="konnect"&&!e.controlPlaneId||e.app==="kongManager"&&typeof e.workspace!="string")},pluginType:{type:String,required:!0},pluginId:{type:String,default:""},hideScopeSelection:{type:Boolean,default:!1},disableScopeSelection:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},developer:{type:Boolean,default:!1},isWizardStep:{type:Boolean,default:!1},actionsTeleportTarget:{type:String,default:""},noCardWrapper:{type:Boolean,default:!1},hideViewConfigAction:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},schema:{type:Object,default:null},enableRedisPartial:{type:Boolean,default:!1},scopedEntitiesPermissions:{type:Object,default:null},engine:{type:String,required:!1}},emits:["cancel","error:fetch-schema","error","loading","update","model-updated","showNewPartialModal","globalAction"],setup(e,{emit:n}){var ae;const o=n,r=e,i=Bo.useRouter(),{i18n:{t:a}}=Fe.useI18n(),{customSchemas:l,typedefs:s}=Fe.useSchemas({app:r.config.app,credential:r.credential,experimentalRenders:r.config.app==="konnect"?r.config.experimentalRenders:void 0}),{formatPluginFieldLabel:c}=Fe.usePluginHelpers(),{getMessageFromError:d}=he.useErrors(),{capitalize:f}=he.useStringHelpers(),{objectsAreEqual:u}=he.useHelpers(),{axiosInstance:p}=he.useAxios((ae=r.config)==null?void 0:ae.axiosRequestConfig),m=t.ref(!1),y=t.computed(()=>!!r.pluginId),_=t.computed(()=>r.pluginId?he.EntityBaseFormType.Edit:he.EntityBaseFormType.Create),g=t.ref(void 0),h=t.ref(void 0),w=t.computed(()=>!!(r.credential&&r.config.entityId)),b=t.ref(void 0),x=t.ref({}),E=t.ref(),C=t.ref();t.provide(Sd,{redisType:E,redisPath:C,isEditing:y.value});const N=t.ref(!1),S=t.reactive({enabled:!0,protocols:[],tags:[]}),v=t.reactive({fields:{enabled:!0,protocols:[],tags:[]},isReadonly:!1,clientErrorMessage:"",serverErrorMessage:""}),D=t.ref([{title:a("view_configuration.json"),hash:"#json"},{title:a("view_configuration.yaml"),hash:"#yaml"}]);r.config.app==="konnect"&&D.value.splice(1,0,{title:a("view_configuration.terraform"),hash:"#terraform"});const L=t.ref(""),k=t.computed(()=>{var U;if(w.value){let $=Xe.form[r.config.app].credential[_.value];return $=$.replace(/{resourceEndpoint}/gi,j.value),$}let A;return r.config.entityType&&r.config.entityId?A=Xe.form[r.config.app].edit.forEntity.replace(/{entityType}/gi,r.config.entityType).replace(/{entityId}/gi,r.config.entityId):A=Xe.form[r.config.app].edit.all,r.config.app==="konnect"&&((U=Gt[r.pluginType])!=null&&U.useUIData)?`${A}?__ui_data=true`:A}),J=()=>{m.value=!m.value},I=t.computed(()=>{var _e,ke,de,Ne,Te,me,ge,nt;const A=r.config.entityType==="consumers"&&r.config.entityId||((ke=(_e=b.value)==null?void 0:_e.consumer)==null?void 0:ke.id),U=r.config.entityType==="consumer_groups"&&r.config.entityId||((Ne=(de=b.value)==null?void 0:de.consumer_group)==null?void 0:Ne.id),$=r.config.entityType==="services"&&r.config.entityId||((me=(Te=b.value)==null?void 0:Te.service)==null?void 0:me.id),oe=r.config.entityType==="routes"&&r.config.entityId||((nt=(ge=b.value)==null?void 0:ge.route)==null?void 0:nt.id);if(!(A||U||$||oe))return{global:{entity:W.PluginScope.GLOBAL,entityEndpoint:"plugins"}};const ne={};return $&&(ne.service={entity:W.PluginScope.SERVICE,entityEndpoint:"services",id:$,idField:An.SERVICE}),oe&&(ne.route={entity:W.PluginScope.ROUTE,entityEndpoint:"routes",id:oe,idField:An.ROUTE}),A&&(ne.consumer={entity:W.PluginScope.CONSUMER,entityEndpoint:"consumers",id:A,idField:An.CONSUMER}),U&&(ne.consumer_group={entity:W.PluginScope.CONSUMER_GROUP,entityEndpoint:"consumer_groups",id:U,idField:An.CONSUMER_GROUP}),r.config.entityType&&(ne.focusedEntity={entity:W.PluginScope[r.config.entityType.substring(0,r.config.entityType.length-1).toUpperCase()],entityEndpoint:r.config.entityType,id:r.config.entityId,idField:An[r.config.entityType.substring(0,r.config.entityType.length-1).toUpperCase()]}),ne}),G=t.reactive({name:{default:r.pluginType,type:"input",inputType:"hidden",styleClasses:"d-none hidden-field",pinned:!0},enabled:{type:"switch",model:"enabled",label:a("plugins.form.fields.enabled.label"),textOn:a("plugins.form.fields.enabled.on_text"),textOff:a("plugins.form.fields.enabled.off_text"),styleClasses:"field-switch hide-label",default:!0,pinned:!0},selectionGroup:{type:r.hideScopeSelection&&(r.hideScopeSelection||_.value===he.EntityBaseFormType.Create&&r.config.entityId)?"foreign":"selectionGroup",disabled:r.disableScopeSelection,inputType:"hidden",styleClasses:"hide-label",fields:[{label:a("plugins.form.scoping.global.label"),description:a("plugins.form.scoping.global.help")}],pinned:!0},protocols:{id:"protocols",default:[],help:a("plugins.form.fields.protocols.help"),label:a("plugins.form.fields.protocols.label"),required:!0,styleClasses:"plugin-protocols-select",type:"multiselect",values:[{label:"grpc",value:"grpc"},{label:"grpcs",value:"grpcs"},{label:"http",value:"http"},{label:"https",value:"https"},{label:"tcp",value:"tcp"},{label:"tls",value:"tls"},{label:"tls_passthrough",value:"tls_passthrough"},{label:"udp",value:"udp"},{label:"ws",value:"ws"},{label:"wss",value:"wss"}]},instance_name:{default:"",type:"input",label:a("plugins.form.fields.instance_name.label"),inputType:"text",help:a("plugins.form.fields.instance_name.help")},tags:s.tags}),j=t.computed(()=>{var $;const A=r.developer?"developers":"consumers",U=(($=ro[r.pluginType])==null?void 0:$.endpoint)||"/plugins";return`${A}/${r.config.entityId}${r.developer?"/credentials":""}${U}`}),te=A=>{const U=Array.from(new Set(A.map($=>typeof $)));return U.length>1?"string":U[0]},K=(A,U,$,oe)=>{var de,Ne;let ne=U&&U.fields||[];const _e=l[r.pluginType],ke=(Ne=(de=ro[r.pluginType])==null?void 0:de.schema)==null?void 0:Ne.fields;return Array.isArray(ne)&&(ne=ne.reduce((Te,me)=>{const ge=Object.keys(me)[0];return ge.match(/-/g)?Te[ge.replace(/-/g,"_")]={...me[ge],fieldNameHasDashes:!0}:Te[ge]=me[ge],Te},{})),Object.keys(ne).sort().forEach(Te=>{var xn,vn,st,He,pt,kt,mt;const me=ne[Te];me.type==="set"&&(me.type="array");const ge=A?`${A}-${Te}`:`${Te}`;if((xn=_e==null?void 0:_e.fieldsToDelete)!=null&&xn.includes(ge)){td($,ge);return}if(Object.prototype.hasOwnProperty.call(me,"overwrite")||me.hidden)return;if(me.type==="table")return K(ge,me.schema,$);if(me.fields)return oe&&me.type==="record"?($[ge]={type:"object",model:Te,schema:{fields:Object.values(K(ge,me,{},!0))}},$):K(ge,me,$);if($[ge]={id:ge,model:Te},$[ge].type=me.type==="boolean"?"checkbox":"input",$[ge].required=me.required,$[ge].referenceable=me.referenceable,ge.startsWith("config-"))if(!oe&&me.type==="array"&&(L.value=ge),oe&&L.value&&ge.startsWith(L.value)){const $e=ge.slice(L.value.length+1);$[ge].label=$e.split("-").map(c).join(".")}else $[ge].label=c(ge);if((A==="config"||A.startsWith("config-"))&&(vn=ne[Te])!=null&&vn.description&&($[ge].help=Ir.marked.parse(ne[Te].description,{mangle:!1,headerIds:!1})),me.type==="map"){if($[ge].type="object-advanced",$[ge].values=me.values,me.values.type==="array"){const{type:$e}=me.values.elements||{};$[ge].schema={fields:[{schema:{fields:[{...Ve,model:ge,valueArrayType:$e==="integer"?"number":$e||"string",inputAttributes:{...Ve.inputAttributes,type:$e==="integer"?"number":"text",inputMode:$e==="integer"?"numeric":"text"}}]}}]}}else me.values.fields&&($[ge].schema={fields:[{type:"object",model:"object",schema:{fields:me.values.fields.map($e=>{const se=Object.keys($e)[0];return{model:se,type:"input",label:f(se),placeholder:se,inputType:$e[se].type}})}}]});return $}if(me.enum&&me.type==="array"&&($[ge].type="checklist",$[ge].values=me.enum,$[ge].multi=!0,$[ge].multiSelect=!0),me.one_of&&me.type!=="array"&&($[ge].type="select",$[ge].values=me.one_of,$[ge].selectOptions={noneSelectedText:a("plugins.form.no_selection")}),me.elements&&me.type==="array"){const $e=me.elements;if($[ge].referenceable=$e.referenceable,$[ge].elements=$e,["string","integer","number"].includes($e.type)&&!$e.one_of){const{id:se,help:ye,label:ce,hint:pe,values:we,referenceable:xe,model:Oe}=$[ge],{inputAttributes:Re,...Me}=JSON.parse(JSON.stringify(Ve));Re.type=$e.type==="string"?"text":"number",$[ge]={id:se,help:ye,label:ce,hint:pe,values:we,referenceable:xe,model:Oe,inputAttributes:Re,...Me}}}if(me.hint&&($[ge].hint=me.hint),_e&&!_e.overwriteDefault&&Object.keys(_e).forEach($e=>{if($e===ge){const{help:se,label:ye,hint:ce,values:pe,referenceable:we,elements:xe}=$[ge],{help:Oe,...Re}=_e[$e];$[ge]={help:se,label:ye,hint:ce,values:pe,referenceable:we,elements:xe,...Re},typeof Oe=="string"&&($[ge].help=Ir.marked.parse(Oe,{mangle:!1,headerIds:!1}))}}),me.type==="array"&&((st=me.elements)==null?void 0:st.type)==="record"&&Array.isArray(me.elements.fields)){let $e={};for(const ye of me.elements.fields)$e={...$e,...ye};const se=(kt=(pt=(He=$[ge])==null?void 0:He.items)==null?void 0:pt.schema)==null?void 0:kt.fields;if(Array.isArray(se))for(const ye of $[ge].items.schema.fields){const ce=(mt=$e[ye.model])==null?void 0:mt.description;ye.help===void 0&&typeof ce=="string"&&(ye.help=Ir.marked.parse(ce,{mangle:!1,headerIds:!1}))}if(se||($[ge].type="array",$[ge].newElementButtonLabelClasses="kong-form-new-element-button-label",$[ge].fieldClasses="array-card-container-wrapper",$[ge].itemContainerComponent="FieldArrayCardContainer",$[ge].items={type:"object",schema:{fields:Object.values(K(ge,me.elements,{},!0))}},$[ge].items.schema.fields.forEach(ye=>{var ce,pe;for(const we of me.elements.fields){const xe=Object.keys(we)[0],Oe=((pe=(ce=ye.id)==null?void 0:ce.split)==null?void 0:pe.call(ce,"-"))??[];if(Oe[Oe.length-1]===xe){ye.model=xe,ye.label=c(xe);break}}}),me.elements.type==="record"&&($[ge].nestedFields=!0)),!$[ge].nestedFields)$[ge].items.default=()=>me.elements.fields.reduce((ye,ce)=>{const pe=Object.keys(ce)[0];return ye[pe]=ce[pe].default,ye},{});else{const ye=(ce,pe)=>{if(ce.type==="object"){ce.model&&(pe[ce.model]={});for(const we of ce.schema.fields)ye(we,ce.model?pe[ce.model]:pe)}else ce.model&&(pe[ce.model]=ce.default)};$[ge].items.default=()=>{const ce={};return ye($[ge].items,ce),ce}}}if(w.value&&ke){for(let $e=0;$e<ke.length;$e++)if(ke[$e][ge]){$[ge]={...$[ge],...ke[$e][ge]};break}}if(me.required&&me.type!=="boolean"&&($[ge].required=!0,$[ge].selectOptions={hideNoneSelectedText:!0}),me.required&&me.type==="boolean"&&($[ge].default=me.default??!1),me.default!=null&&typeof me.default!="object"&&me.default!=="function"&&($[ge].default=me.default),$[ge].type==="input"){["string","number"].includes(typeof $[ge].default)&&r.config.app==="konnect"&&($[ge].placeholder=`Default: ${$[ge].default===""?"<empty string>":$[ge].default}`);const{type:$e}=me.elements||{};$e&&($[ge].valueArrayType=$e==="integer"?"number":$e),$[ge].inputType=me.type==="array"||me.type==="string"?me.encrypted?"password":"text":me.type}let nt="string";me.enum?nt=te(me.enum):me.type==="boolean"?nt="boolean":me.type==="number"||me.type==="integer"?(nt="number",$[ge].inputType="number"):me.type==="array"?(nt="array",$[ge].default=me.default,me.len_min>0&&($[ge].submitWhenNull=!0)):me.type==="foreign"?nt="object":me.default&&Array.isArray(me.default)?(nt="array",$[ge].valueArrayType=te(me.default)):me.default&&(nt=typeof me.default),$[ge].valueType=nt,me.fieldNameHasDashes&&($[ge].fieldNameHasDashes=!0)}),$},O=()=>{var ge,nt,xn,vn,st,He,pt,kt,mt,$e,se,ye;const A=((ge=Gt[r.pluginType])==null?void 0:ge.scope.includes(W.PluginScope.SERVICE))??!0,U=((nt=Gt[r.pluginType])==null?void 0:nt.scope.includes(W.PluginScope.ROUTE))??!0,$=((xn=Gt[r.pluginType])==null?void 0:xn.scope.includes(W.PluginScope.CONSUMER))??!0,oe=r.config.disableConsumerGroupScope?!1:((vn=Gt[r.pluginType])==null?void 0:vn.scope.includes(W.PluginScope.CONSUMER_GROUP))??!0,ne=r.config.entityType==="consumers"&&!!r.config.entityId||!!((He=(st=b.value)==null?void 0:st.consumer)!=null&&He.id),_e=r.config.entityType==="consumer_groups"&&!!r.config.entityId||!!((kt=(pt=b.value)==null?void 0:pt.consumer_group)!=null&&kt.id),ke=r.config.entityType==="services"&&!!r.config.entityId||!!(($e=(mt=b.value)==null?void 0:mt.service)!=null&&$e.id),de=r.config.entityType==="routes"&&!!r.config.entityId||!!((ye=(se=b.value)==null?void 0:se.route)!=null&&ye.id),Ne=[],Te=(ce,pe,we)=>ce?a("plugins.form.disable_source_scope_change",{scope:we}):pe?a("plugins.form.disable_data_retrieving",{scope:we}):"",me=ce=>{var pe,we;return((we=(pe=r.scopedEntitiesPermissions)==null?void 0:pe[ce])==null?void 0:we.canRetrieve)===!1};if(A){const ce=me("service"),pe="services",we=ke&&r.disableScopeSelection;Ne.push({id:"service-id",model:"service-id",label:a("plugins.form.scoping.gateway_service.label"),placeholder:a("plugins.form.scoping.placeholder"),type:"AutoSuggest",labelField:"name",entity:pe,inputValues:{fields:["name","id"]},help:a("plugins.form.scoping.gateway_service.help"),disabled:we||ce,disabledTooltip:Te(we,ce,pe)})}if(U){const ce=me("route"),pe="routes",we=de&&r.disableScopeSelection;Ne.push({id:"route-id",model:"route-id",label:a("plugins.form.scoping.route.label"),placeholder:a("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:pe,labelField:"name",inputValues:{fields:["name","id"],primaryField:"id"},help:a("plugins.form.scoping.route.help"),disabled:we||ce,disabledTooltip:Te(we,ce,pe)})}if($){const ce=me("consumer"),pe="consumers",we=ne&&r.disableScopeSelection;Ne.push({model:"consumer-id",label:a("plugins.form.scoping.consumer.label"),placeholder:a("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:pe,labelField:"username",inputValues:{fields:["username","custom_id","id"],primaryField:"username"},help:a("plugins.form.scoping.consumer.help"),disabled:we||ce,disabledTooltip:Te(we,ce,pe)})}if(oe){const ce=me("consumer_group"),pe="consumer_groups",we=_e&&r.disableScopeSelection;Ne.push({model:"consumer_group-id",label:a("plugins.form.scoping.consumer_group.label"),placeholder:a("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:pe,entityDataKey:"consumer_group",labelField:"name",inputValues:{fields:["name","id"],primaryField:"name"},help:a("plugins.form.scoping.consumer_group.help"),disabled:we||ce,disabledTooltip:Te(we,ce,pe)})}if(Ne.length){const ce=[...A?["service"]:[],...U?["route"]:[],...$?["consumer"]:[],...oe?["consumer_group"]:[]],we=ce.splice(ce.length-2,2).map(Oe=>a(Oe==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Oe}.plural`)).join(`${ce.length>0?",":""} and/or `),xe=["Specific",[...ce.length>0?[ce.map(Oe=>a(Oe==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Oe}.plural`)).join(", ")]:[],we].join(", ")].join(" ");G.selectionGroup.fields.push({label:a("plugins.form.scoping.label"),description:xe,fields:[]}),G.selectionGroup.fields[1].fields=Ne}l[r.pluginType]&&l[r.pluginType].overwriteDefault&&Object.hasOwnProperty.call(l[r.pluginType],"formSchema")&&Object.assign(G,l[r.pluginType].formSchema)},P=t.computed(()=>!u(v.fields,S,!0)),T=t.computed(()=>!Q.value&&!N.value&&(_.value===he.EntityBaseFormType.Create||P.value)),M=t.ref(!1),Y=t.ref(),z=A=>{r.credential&&A.password&&(A.password=""),v.fields.id=(A==null?void 0:A.id)||void 0,Y.value=A==null?void 0:A.ordering,Object.assign(S,v.fields),b.value=A,M.value=!0},H=t.ref({}),Z=A=>{var U;v.fields=A.model,v.fields.id=((U=b.value)==null?void 0:U.id)||void 0,Object.assign(S,A.originalModel),H.value=A.data,r.isWizardStep&&o("model-updated",{model:v.fields,data:A.data,resourceEndpoint:j.value})},ie=t.ref(new Map),be=t.computed(()=>[v.clientErrorMessage,v.serverErrorMessage].filter(Boolean).join("; ")),ee=A=>{A.valid?ie.value.delete(A.model):ie.value.set(A.model,A.error),v.clientErrorMessage=[...ie.value.entries()].map(([U,$])=>`${U}: ${typeof $=="string"?$:d($)}`).join("; "),v.clientErrorMessage&&(v.serverErrorMessage="")};t.watch([I,M],(A,U)=>{const $=A[0]!==U[0],oe=A[1],ne=U[1];if(!w.value&&_.value===he.EntityBaseFormType.Edit&&($||oe&&oe!==ne)){const _e=K("config",x.value,G);ue.value&&(_e._isCustomPlugin=!0),E.value&&(_e._supported_redis_partial_type=E.value),h.value=_e}},{deep:!0});const re=()=>{r.config.cancelRoute?i.push(r.config.cancelRoute):o("cancel")},le=t.computed(()=>{const A=r.config.entityType&&r.config.entityId&&!r.developer,U=w.value?Xe.form[r.config.app].credential[_.value]:Xe.form[r.config.app][_.value][A?"forEntity":"all"];let $=`${r.config.apiBaseUrl}${U}`;return r.config.app==="konnect"?$=$.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||""):r.config.app==="kongManager"&&($=$.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")),$=$.replace(/{resourceEndpoint}/gi,j.value),$=$.replace(/{id}/gi,r.pluginId),$=$.replace(/{entityType}/gi,r.config.entityType||""),$=$.replace(/{entityId}/gi,r.config.entityId||""),$}),ue=t.computed(()=>!Object.keys(Gt).includes(r.pluginType)),fe=t.computed(()=>{const A=H.value;if(w.value){for(const U in W.PluginScope){const $=W.PluginScope[U];A[$]&&!A[$].id&&(A[$]={id:r.config.entityId})}delete A.created_at}return H.value.partials&&C.value&&td(A,C.value),A}),B=t.computed(()=>{const{__ui_data:A,...U}={...fe.value};return U}),V=async()=>{if(!v.clientErrorMessage&&!r.isWizardStep)try{v.isReadonly=!0;let A;const U=JSON.parse(JSON.stringify(fe.value)),$=l[r.pluginType];typeof($==null?void 0:$.shamefullyTransformPayload)=="function"&&$.shamefullyTransformPayload({originalModel:S,model:v.fields,payload:U,schema:h.value}),_.value==="create"?A=await p.post(le.value,U):_.value==="edit"&&(A=r.config.app==="konnect"||E.value&&U.partials?await p.put(le.value,Object.assign({ordering:Y.value},U)):await p.patch(le.value,U)),Object.assign(S,v.fields),o("update",A==null?void 0:A.data)}catch(A){v.serverErrorMessage=d(A),o("error",A)}finally{v.isReadonly=!1}},F=t.computed(()=>{var oe;const A=w.value?(oe=ro[r.pluginType])==null?void 0:oe.schemaEndpoint:r.pluginType,U=w.value?Xe.form[r.config.app].credentialSchema:Xe.form[r.config.app].pluginSchema;let $=`${r.config.apiBaseUrl}${U}`;return r.config.app==="konnect"?$=$.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||""):r.config.app==="kongManager"&&($=$.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")),$=$.replace(/{plugin}/gi,A),$}),R=t.ref(""),Q=t.ref(!1),q=t.ref("");return t.onBeforeMount(async()=>{var A,U,$,oe;Q.value=!0;try{if(w.value&&r.config.app==="konnect"){const ne=(A=ro[r.pluginType])==null?void 0:A.schemaEndpoint,_e=Og[ne];R.value=ne,h.value=K("",_e,{}),Q.value=!1}else{const ne=r.schema??(await p.get(F.value)).data;if(g.value=ne,ne)if(w.value)h.value=K("",ne,{}),Q.value=!1;else{const _e=ne.fields.find(de=>de.config);x.value=_e?_e.config:ne,ne.supported_partials&&(E.value=Object.keys(ne.supported_partials).find(de=>[Pr.REDIS_CE,Pr.REDIS_EE].includes(de)),C.value=(U=ne.supported_partials[E.value])==null?void 0:U[0]),O();const ke=($=ne.fields.find(de=>de.protocols))==null?void 0:$.protocols;if(ke){const{default:de=[],elements:Ne={}}=ke;G.protocols.default=de,G.protocols.placeholder=r.config.app==="konnect"?a("plugins.form.fields.protocols.placeholderWithDefaultValues",{protocols:de.join(", ")}):a("plugins.form.fields.protocols.placeholder"),(oe=Ne.one_of)!=null&&oe.length&&(G.protocols.values=Ne.one_of.map(Te=>({label:Te,value:Te})))}if(M.value||_.value===he.EntityBaseFormType.Create){const de=K("config",x.value,G);E.value&&(de._supported_redis_partial_type=E.value),ue.value&&(de._isCustomPlugin=!0),h.value=de}}}}catch(ne){console.error(ne),q.value=d(ne),o("error:fetch-schema",ne)}finally{Q.value=!1}}),(A,U)=>{const $=t.resolveComponent("KSkeleton"),oe=t.resolveComponent("KEmptyState"),ne=t.resolveComponent("KButton"),_e=t.resolveComponent("KTabs"),ke=t.resolveComponent("KSlideout");return t.openBlock(),t.createElementBlock("div",PM,[Q.value?(t.openBlock(),t.createBlock($,{key:0,type:"form"})):q.value?(t.openBlock(),t.createBlock(oe,{key:1,"action-button-visible":!1,"data-testid":"plugin-form-schema-error","icon-variant":"error"},{default:t.withCtx(()=>[t.createElementVNode("h3",null,t.toDisplayString(t.unref(a)("errors.load_schema")),1)]),_:1})):(t.openBlock(),t.createBlock(t.unref(he.EntityBaseForm),{key:2,"can-submit":T.value,config:e.config,"edit-id":e.pluginId,"entity-type":t.unref(he.SupportedEntityType).Plugin,"error-message":be.value,"fetch-url":k.value,"form-fields":fe.value,"is-readonly":v.isReadonly,"no-validate":"","wrapper-component":e.noCardWrapper?"div":void 0,onCancel:re,"onFetch:error":U[4]||(U[4]=de=>A.$emit("error",de)),"onFetch:success":z,onLoading:U[5]||(U[5]=de=>A.$emit("loading",de))},{"form-actions":t.withCtx(()=>[e.isWizardStep?(t.openBlock(),t.createElementBlock("div",OM)):(t.openBlock(),t.createBlock(TM,{key:1,"teleport-target":e.actionsTeleportTarget},{default:t.withCtx(()=>[t.createElementVNode("div",$M,[e.hideViewConfigAction?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(ne,{key:0,appearance:"tertiary","data-testid":`plugin-${y.value?"edit":"create"}-form-view-configuration`,onClick:U[3]||(U[3]=de=>J())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.view_configuration")),1)]),_:1},8,["data-testid"])),t.createVNode(ne,{appearance:"secondary",class:"form-action-button","data-testid":`plugin-${y.value?"edit":"create"}-form-cancel`,disabled:v.isReadonly,onClick:re},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.cancel")),1)]),_:1},8,["data-testid","disabled"]),t.createVNode(ne,{appearance:"primary","data-testid":`plugin-${y.value?"edit":"create"}-form-submit`,disabled:!T.value||v.isReadonly,type:"submit",onClick:V},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.save")),1)]),_:1},8,["data-testid","disabled"])])]),_:1},8,["teleport-target"]))]),default:t.withCtx(()=>[t.createElementVNode("form",{hidden:"",onSubmit:V},null,32),t.createVNode(AM,{config:e.config,credential:w.value,editing:_.value===t.unref(he.EntityBaseFormType).Edit,"enable-redis-partial":e.enableRedisPartial,"enable-vault-secret-picker":r.enableVaultSecretPicker,engine:e.engine,"entity-map":I.value,"raw-schema":g.value,record:b.value,schema:h.value,onGlobalAction:U[0]||(U[0]=(de,Ne)=>A.$emit("globalAction",de,Ne)),onLoading:U[1]||(U[1]=de=>N.value=de),onModelUpdated:Z,onShowNewPartialModal:U[2]||(U[2]=de=>A.$emit("showNewPartialModal",de)),onValidityChange:ee},null,8,["config","credential","editing","enable-redis-partial","enable-vault-secret-picker","engine","entity-map","raw-schema","record","schema"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly","wrapper-component"])),t.createVNode(ke,{"close-on-blur":!1,"data-testid":"form-view-configuration-slideout","has-overlay":!1,"offset-top":60,title:t.unref(a)("view_configuration.title"),visible:m.value,onClose:J},{default:t.withCtx(()=>[t.createElementVNode("div",null,t.toDisplayString(t.unref(a)("view_configuration.message")),1),t.createVNode(_e,{"data-testid":"form-view-configuration-slideout-tabs",tabs:D.value},{json:t.withCtx(()=>[t.createVNode(t.unref(he.JsonCodeBlock),{config:e.config,"entity-record":B.value,"fetcher-url":le.value,"request-method":r.pluginId?"put":"post"},null,8,["config","entity-record","fetcher-url","request-method"])]),yaml:t.withCtx(()=>[t.createVNode(t.unref(he.YamlCodeBlock),{"entity-record":B.value},null,8,["entity-record"])]),terraform:t.withCtx(()=>[t.createVNode(t.unref(he.TerraformCodeBlock),{"credential-type":R.value,"entity-record":B.value,"entity-type":t.unref(he.SupportedEntityType).Plugin},null,8,["credential-type","entity-record","entity-type"])]),_:1},8,["tabs"])]),_:1},8,["title","visible"])])}}}),[["__scopeId","data-v-b9713619"]]),VM={class:"kong-ui-entities-plugins-list"},RM={class:"button-row"},DM={class:"name-cell-wrapper"},MM={class:"info-wrapper"},LM={key:0,class:"info-name"},FM={key:1,class:"info-name"},UM={key:2,class:"info-type"},KM={key:1},jM=ve(t.defineComponent({__name:"PluginList",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.createRoute||!e.getViewRoute||!e.getEditRoute||!e.getConfigureDynamicOrderingRoute||e.app==="kongManager"&&!e.isExactMatch&&!e.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canToggle:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},canRetrieveScopedEntity:{type:Function,required:!1,default:async()=>!0},canConfigureDynamicOrdering:{type:Function,required:!1,default:async()=>!0},title:{type:String,default:""},titleTag:{type:String,default:"h2"},useActionOutside:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success","toggle-enabled"],setup(e,{emit:n}){var R,Q;const o=Fe.usePluginMetaData(),r=n,i=e,{i18n:{t:a}}=Fe.useI18n(),l=Bo.useRouter(),{axiosInstance:s}=he.useAxios((R=i.config)==null?void 0:R.axiosRequestConfig),{hasRecords:c,handleStateChange:d}=he.useTableState(()=>b.value),f=t.computed(()=>c.value&&i.config.app==="konnect"),u=t.computed(()=>!!i.config.entityId),p=t.computed(()=>{var q;return((q=i.config)==null?void 0:q.entityType)==="consumers"}),m=t.computed(()=>{var q;return((q=i.config)==null?void 0:q.entityType)==="consumer_groups"}),y=i.config.app==="konnect"||he.useGatewayFeatureSupported({gatewayInfo:i.config.gatewayInfo,supportedRange:{enterprise:["3.0"]}}),_=t.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),g={name:{label:a("plugins.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1}};(Q=i.config)!=null&&Q.entityId||(g.appliedTo={label:a("plugins.list.table_headers.applied_to"),sortable:!1}),g.enabled={label:a("plugins.list.table_headers.enabled"),searchable:!0,sortable:!0},y&&(g.ordering={label:a("plugins.list.table_headers.ordering"),sortable:!0}),g.tags={label:a("plugins.list.table_headers.tags"),sortable:!1};const h=g,w=t.computed(()=>{var ae,A,U,$;let q=i.config.entityType?`${i.config.apiBaseUrl}${Xe.list[i.config.app].forEntity}`:`${i.config.apiBaseUrl}${Xe.list[i.config.app].all}`;return i.config.app==="konnect"?q=q.replace(/{controlPlaneId}/gi,((ae=i.config)==null?void 0:ae.controlPlaneId)||""):i.config.app==="kongManager"&&(q=q.replace(/\/{workspace}/gi,(A=i.config)!=null&&A.workspace?`/${i.config.workspace}`:"")),q.replace(/{entityType}/gi,((U=i.config)==null?void 0:U.entityType)||"").replace(/{entityId}/gi,(($=i.config)==null?void 0:$.entityId)||"")}),b=t.ref(""),x=t.computed(()=>i.config.app==="konnect"||i.config.isExactMatch?{isExactMatch:!0,fields:{name:g.name,id:{label:a("plugins.list.table_headers.id"),sortable:!0}},placeholder:a(`search.placeholder.${i.config.isExactMatch?"exact":i.config.app}`)}:{isExactMatch:!1,fields:{enabled:{...g.enabled,label:a("search.filter.field.enabled")},name:g.name,instance_name:{label:a("plugins.list.table_headers.instance_name"),searchable:!0}},schema:i.config.filterSchema}),{fetcher:E,fetcherState:C,fetcherCacheKey:N}=he.useFetcher(t.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),w),S=()=>{b.value=""},v=()=>{N.value++},D=t.ref(null),L=q=>{var A,U,$,oe;const ae=[];return((A=q.route)!=null&&A.id||q.route_id)&&ae.push({type:"route",badgeText:a("plugins.list.table_headers.applied_to_badges.route")}),((U=q.service)!=null&&U.id||q.service_id)&&ae.push({type:"service",badgeText:a("plugins.list.table_headers.applied_to_badges.service")}),(($=q.consumer)!=null&&$.id||q.consumer_id)&&ae.push({type:"consumer",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer")}),((oe=q.consumer_group)!=null&&oe.id||q.consumer_group_id)&&ae.push({type:"consumer_group",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer_group")}),ae.length?ae:[{type:null,badgeText:a("plugins.list.table_headers.applied_to_badges.global")}]},k=async(q,ae)=>{var A;return q===null?!1:await((A=i.canRetrieveScopedEntity)==null?void 0:A.call(i,q,ae.id))},J=(q,ae)=>{var U,$,oe,ne,_e;let A=null;switch(q){case"route":A=(U=ae.route)==null?void 0:U.id;break;case"service":A=($=ae.service)==null?void 0:$.id;break;case"consumer":A=(oe=ae.consumer)==null?void 0:oe.id;break;case"consumer_group":A=(ne=ae.consumer_group)==null?void 0:ne.id;break}A&&((_e=i.config)!=null&&_e.getScopedEntityViewRoute)&&l.push(i.config.getScopedEntityViewRoute(q,A))},I=t.ref(!1),G=t.ref(null),j=t.computed(()=>{const q={action:"disable",id:"",name:""};if(G.value){const{enabled:ae,id:A,name:U}=G.value;q.action=ae?"disable":"enable",q.id=A,q.name=o.getDisplayName(U)||A}return q}),te=q=>{I.value=!0,G.value=q},K=()=>{I.value=!1,G.value=null},O=async()=>{var U,$,oe,ne,_e,ke,de,Ne;if(!await((U=i.canEdit)==null?void 0:U.call(i,G.value))||!G.value)return;let ae=`${i.config.apiBaseUrl}${(_e=Xe.item[i.config.app])==null?void 0:_e[($=i.config)!=null&&$.entityType?"forEntity":"all"].replace(/{entityType}/gi,((oe=i.config)==null?void 0:oe.entityType)||"").replace(/{entityId}/gi,((ne=i.config)==null?void 0:ne.entityId)||"")}`.replace(/{id}/gi,G.value.id||"");i.config.app==="konnect"?ae=ae.replace(/{controlPlaneId}/gi,((ke=i.config)==null?void 0:ke.controlPlaneId)||""):i.config.app==="kongManager"&&(ae=ae.replace(/\/{workspace}/gi,(de=i.config)!=null&&de.workspace?`/${i.config.workspace}`:""));const A=!G.value.enabled;try{const{data:Te}=((Ne=i.config)==null?void 0:Ne.app)==="konnect"?await s.put(ae,{...G.value,enabled:A},{timeout:12e4}):await s.patch(ae,{...G.value,enabled:A},{timeout:12e4});r("toggle-enabled",A,Te),G.value.enabled=A}catch(Te){r("error",Te)}},P=async(q,ae)=>{const A=q.id;if(!await ae(A)){r("copy:error",{entity:q,field:"id",message:a("errors.copy")});return}r("copy:success",{entity:q,field:"id",message:a("copy.success",{val:A})})},T=async(q,ae)=>{const A=JSON.stringify(q);if(!await ae(A)){r("copy:error",{entity:q,message:a("errors.copy")});return}r("copy:success",{entity:q,message:a("copy.success_brief")})},M=async q=>{var A;await((A=i.canRetrieve)==null?void 0:A.call(i,q))&&l.push(i.config.getViewRoute(q))},Y=q=>({label:a("actions.view"),to:i.config.getViewRoute(q)}),z=q=>({label:a("actions.edit"),to:i.config.getEditRoute(q)}),H=q=>({label:a("actions.configure_dynamic_ordering"),to:i.config.getConfigureDynamicOrderingRoute(q)}),Z=t.ref(void 0),ie=t.ref(!1),be=t.ref(!1),ee=t.ref(""),re=he.useDeleteUrlBuilder(i.config,w.value),le=q=>{Z.value=q,ie.value=!0},ue=()=>{ie.value=!1},fe=async()=>{var q,ae,A;if((q=Z.value)!=null&&q.id){be.value=!0;try{await s.delete(re(Z.value.id)),be.value=!1,ie.value=!1,N.value++,r("delete:success",Z.value)}catch(U){ee.value=((A=(ae=U.response)==null?void 0:ae.data)==null?void 0:A.message)||U.message||a("errors.delete"),r("error",U)}finally{be.value=!1}}},B=()=>{l.push(i.config.createRoute)};t.watch(C,q=>{var ae,A,U;if(q.status===he.FetcherStatus.Error){D.value={title:a("errors.general")},(U=(A=(ae=q.error)==null?void 0:ae.response)==null?void 0:A.data)!=null&&U.message&&(D.value.message=q.error.response.data.message),r("error",q.error);return}D.value=null});const V=t.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${a("plugins.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:a("plugins.title")}),F=t.ref(!1);return t.onBeforeMount(async()=>{F.value=await i.canCreate(),F.value&&(V.value.title=a("plugins.list.empty_state.title"),V.value.ctaText=a("actions.create"))}),(q,ae)=>{const A=t.resolveComponent("KButton"),U=t.resolveComponent("KEmptyState"),$=t.resolveComponent("KBadge"),oe=t.resolveComponent("KTruncate"),ne=t.resolveComponent("KInputSwitch"),_e=t.resolveComponent("KDropdownItem"),ke=t.resolveComponent("KClipboardProvider");return t.openBlock(),t.createElementBlock("div",VM,[t.createVNode(t.unref(he.EntityBaseTable),{"cache-identifier":e.cacheIdentifier,"disable-sorting":_.value,"empty-state-options":V.value,"enable-entity-actions":"","error-message":D.value,fetcher:t.unref(E),"fetcher-cache-key":t.unref(N),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-plugins-list",query:b.value,"table-headers":t.unref(h),title:e.title,"title-tag":e.titleTag,onClearSearchInput:S,"onClick:row":ae[4]||(ae[4]=de=>M(de)),onSort:v,onState:t.unref(d)},t.createSlots({"toolbar-filter":t.withCtx(()=>[t.createVNode(t.unref(he.EntityFilter),{modelValue:b.value,"onUpdate:modelValue":ae[0]||(ae[0]=de=>b.value=de),config:x.value},null,8,["modelValue","config"])]),"toolbar-button":t.withCtx(()=>[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!e.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[t.createElementVNode("div",RM,[!u.value&&f.value?(t.openBlock(),t.createBlock(A,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"plugins-learn-more-button",icon:"",onClick:ae[1]||(ae[1]=de=>q.$emit("click:learn-more"))},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.BookIcon),{decorative:""})]),_:1})):t.createCommentVNode("",!0),t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":()=>e.canCreate()},{default:t.withCtx(()=>[t.createVNode(A,{appearance:"primary","data-testid":"toolbar-add-plugin",size:e.useActionOutside?"medium":"large",to:e.config.createRoute},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon)),t.createTextVNode(" "+t.toDisplayString(t.unref(a)("plugins.list.toolbar_actions.new_plugin")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:t.withCtx(({row:de})=>[t.createElementVNode("div",DM,[t.createVNode(t.unref(Ro.PluginIcon),{class:"plugin-icon",name:de.name,size:24},null,8,["name"]),t.createElementVNode("div",MM,[de.instance_name?(t.openBlock(),t.createElementBlock("span",LM,t.toDisplayString(de.instance_name),1)):(t.openBlock(),t.createElementBlock("span",FM,t.toDisplayString(t.unref(o).getDisplayName(de.name)),1)),de.instance_name?(t.openBlock(),t.createElementBlock("span",UM,t.toDisplayString(t.unref(o).getDisplayName(de.name)),1)):t.createCommentVNode("",!0)])])]),appliedTo:t.withCtx(({row:de})=>[L(de).length>0?(t.openBlock(),t.createBlock(oe,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(L(de),Ne=>(t.openBlock(),t.createBlock(t.unref(he.PermissionsWrapper),{key:Ne.badgeText,"auth-function":()=>k(Ne.type,de),"force-show":""},{default:t.withCtx(({isAllowed:Te})=>[t.createVNode($,{class:t.normalizeClass(Te||"disabled"),onClick:t.withModifiers(me=>Te&&Ne.type&&J(Ne.type,de),["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(Ne.badgeText),1)]),_:2},1032,["class","onClick"])]),_:2},1032,["auth-function"]))),128))]),_:2},1024)):(t.openBlock(),t.createElementBlock("span",KM,"-"))]),enabled:t.withCtx(({row:de})=>[t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":async()=>!!(await e.canEdit(de)&&await e.canToggle(de)),"force-show":""},{default:t.withCtx(({isAllowed:Ne})=>{var Te,me;return[t.createElementVNode("div",{onClick:ae[3]||(ae[3]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(ne,{disabled:!Ne,"disabled-tooltip-text":!Ne&&((me=(Te=e.config).getToggleDisabledTooltip)==null?void 0:me.call(Te,de))||void 0,"model-value":de.enabled,onClick:t.withModifiers(ge=>Ne&&te(de),["stop","prevent"])},null,8,["disabled","disabled-tooltip-text","model-value","onClick"])])]}),_:2},1032,["auth-function"])]),ordering:t.withCtx(({rowValue:de})=>[t.createVNode($,{appearance:t.unref(Jc)(de)?"info":"warning"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(Jc)(de)?t.unref(a)("plugins.list.table_headers.ordering_badge.static"):t.unref(a)("plugins.list.table_headers.ordering_badge.dynamic")),1)]),_:2},1032,["appearance"])]),tags:t.withCtx(({rowValue:de})=>[t.createVNode(t.unref(he.TableTags),{tags:de},null,8,["tags"])]),actions:t.withCtx(({row:de})=>[t.createVNode(ke,null,{default:t.withCtx(({copyToClipboard:Ne})=>[t.createVNode(_e,{"data-testid":"action-entity-copy-id",onClick:Te=>P(de,Ne)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(ke,null,{default:t.withCtx(({copyToClipboard:Ne})=>[t.createVNode(_e,{"data-testid":"action-entity-copy-json",onClick:Te=>T(de,Ne)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":()=>e.canRetrieve(de)},{default:t.withCtx(()=>[t.createVNode(_e,{"data-testid":"action-entity-view","has-divider":"",item:Y(de)},null,8,["item"])]),_:2},1032,["auth-function"]),t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":()=>e.canEdit(de)},{default:t.withCtx(()=>[t.createVNode(_e,{"data-testid":"action-entity-edit",item:z(de)},null,8,["item"])]),_:2},1032,["auth-function"]),!p.value&&!m.value&&t.unref(y)?(t.openBlock(),t.createBlock(t.unref(he.PermissionsWrapper),{key:0,"auth-function":()=>e.canConfigureDynamicOrdering(de)},{default:t.withCtx(()=>[H(de)?(t.openBlock(),t.createBlock(_e,{key:0,"data-testid":"action-entity-config-dyn-order",item:H(de)},null,8,["item"])):t.createCommentVNode("",!0)]),_:2},1032,["auth-function"])):t.createCommentVNode("",!0),t.createVNode(t.unref(he.PermissionsWrapper),{"auth-function":()=>e.canDelete(de)},{default:t.withCtx(()=>[t.createVNode(_e,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:Ne=>le(de)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!b.value&&e.config.app==="konnect"?{name:"empty-state",fn:t.withCtx(()=>{var de;return[t.createVNode(U,{"data-testid":e.config.entityId?"nested-plugins-entity-empty-state":"plugins-entity-empty-state","icon-background":"",message:t.unref(a)("plugins.list.empty_state_v2.description"),title:t.unref(a)("plugins.list.empty_state_v2.title")},t.createSlots({icon:t.withCtx(()=>[t.createVNode(t.unref(Se.PlugIcon),{decorative:""})]),action:t.withCtx(()=>[F.value?(t.openBlock(),t.createBlock(A,{key:0,"data-testid":"entity-create-button",onClick:B},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.AddIcon),{decorative:""}),t.createTextVNode(" "+t.toDisplayString(t.unref(a)("plugins.list.empty_state_v2.create_cta")),1)]),_:1})):t.createCommentVNode("",!0),t.createVNode(A,{appearance:"secondary","data-testid":"entity-learn-more-button",onClick:ae[2]||(ae[2]=Ne=>q.$emit("click:learn-more"))},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.BookIcon),{decorative:""}),t.createTextVNode(" "+t.toDisplayString(t.unref(a)("plugins.list.empty_state_v2.learn_more")),1)]),_:1})]),_:2},[(de=e.config)!=null&&de.isControlPlaneGroup?{name:"default",fn:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("plugins.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["data-testid","message","title"])]}),key:"0"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","title","title-tag","onState"]),t.createVNode(t.unref(he.EntityToggleModal),{action:j.value.action,"entity-id":j.value.id,"entity-name":j.value.name,"entity-type":t.unref(a)("glossary.plugin"),"on-confirm":O,visible:I.value,onCancel:K,onProceed:K},null,8,["action","entity-id","entity-name","entity-type","visible"]),t.createVNode(t.unref(he.EntityDeleteModal),{"action-pending":be.value,description:t.unref(a)("delete.description"),"entity-name":Z.value&&(Z.value.instance_name||Z.value.name||Z.value.id),"entity-type":t.unref(he.EntityTypes).Plugin,error:ee.value,title:t.unref(a)("delete.title"),visible:ie.value,onCancel:ue,onProceed:fe},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-582a936c"]]),GM={class:"plugin-select-card-wrapper"},qM=["data-testid"],zM={class:"plugin-card-header"},HM={class:"plugin-card-title"},YM={key:0,class:"plugin-card-actions"},WM=["data-testid","title"],XM={key:0,class:"plugin-card-text"},ZM={key:0},JM=["title"],Is=ve(t.defineComponent({__name:"PluginSelectCard",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},canDeleteCustomPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},plugin:{type:Object,required:!0},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","custom-plugin-delete"],setup(e,{emit:n}){const o=n,r=e,i=Bo.useRouter(),{i18n:{t:a}}=Fe.useI18n(),l=t.computed(()=>r.config.app==="konnect"?r.config.controlPlaneId:""),s=t.computed(()=>!!(!r.plugin.available||r.plugin.disabledMessage)),c=t.computed(()=>!!(m.value&&!p.value&&r.navigateOnClick&&l.value&&(r.canDeleteCustomPlugin||r.canEditCustomPlugin))),d=()=>{i.push(r.config.getCreateRoute(r.plugin.id))},f=()=>{r.navigateOnClick?d():u()},u=()=>{o("plugin-clicked",r.plugin)},p=t.computed(()=>r.plugin.id==="custom-plugin-create"),m=t.computed(()=>r.config.app==="konnect"&&r.plugin.group===W.PluginGroup.CUSTOM_PLUGINS),y=()=>{r.config.app==="konnect"&&o("custom-plugin-delete")},_=(h,w)=>{const b=r.config;r.config.app==="konnect"&&typeof b.getCustomEditRoute=="function"&&b.getCustomEditRoute&&i.push(b.getCustomEditRoute(h,w))},g=()=>{if(!s.value&&r.config.app==="konnect"){const h=r.config;p.value&&h.createCustomRoute?i.push(h.createCustomRoute):m.value&&d()}};return(h,w)=>{const b=t.resolveComponent("KButton"),x=t.resolveComponent("KDropdownItem"),E=t.resolveComponent("KDropdownMenu"),C=t.resolveComponent("KTooltip");return t.openBlock(),t.createElementBlock("div",GM,[t.createVNode(C,{text:e.plugin.disabledMessage},{default:t.withCtx(()=>[t.createElementVNode("a",{class:t.normalizeClass(["plugin-select-card",{disabled:s.value}]),"data-testid":`${e.plugin.id}-card`,role:"button",onClick:w[1]||(w[1]=N=>s.value||m.value?void 0:f())},[t.createElementVNode("div",zM,[t.createElementVNode("div",HM,[t.createElementVNode("span",{class:t.normalizeClass({"non-custom-title":!m.value})},t.toDisplayString(e.plugin.name),3)]),c.value?(t.openBlock(),t.createElementBlock("div",YM,[t.createVNode(E,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150"},{default:t.withCtx(()=>[t.createVNode(b,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:t.withCtx(()=>[t.createVNode(t.unref(Se.MoreIcon),{size:t.unref(Ed)},null,8,["size"])]),_:1})]),items:t.withCtx(()=>[e.canDeleteCustomPlugin?(t.openBlock(),t.createBlock(x,{key:0,"data-testid":"edit-plugin-schema",onClick:w[0]||(w[0]=t.withModifiers(N=>_(e.plugin.name,e.plugin.customPluginType),["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.edit")),1)]),_:1})):t.createCommentVNode("",!0),e.canDeleteCustomPlugin?(t.openBlock(),t.createBlock(x,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":"",onClick:t.withModifiers(y,["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.delete")),1)]),_:1})):t.createCommentVNode("",!0)]),_:1})])):t.createCommentVNode("",!0)]),t.createElementVNode("div",{class:t.normalizeClass(["plugin-card-body",{"custom-plugin":m.value}]),"data-testid":e.plugin.name,title:e.plugin.available?e.plugin.name:t.unref(a)("plugins.select.unavailable_tooltip"),onClick:g},[t.createVNode(t.unref(Ro.PluginIcon),{alt:e.plugin.name,class:"plugin-card-icon",name:e.plugin.id,size:55},null,8,["alt","name"]),e.plugin.description||m.value&&!p.value?(t.openBlock(),t.createElementBlock("div",XM,[m.value&&!p.value?(t.openBlock(),t.createElementBlock("p",ZM,t.toDisplayString(t.unref(a)("plugins.select.custom_badge_text")),1)):t.createCommentVNode("",!0),e.plugin.description?(t.openBlock(),t.createElementBlock("p",{key:1,class:"plugin-card-text",title:e.plugin.description},t.toDisplayString(e.plugin.description),9,JM)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],10,WM),t.createElementVNode("div",{class:"plugin-card-footer",onClick:g},t.toDisplayString(p.value?t.unref(a)("actions.create_custom"):e.plugin.exists?t.unref(a)("actions.enabled"):t.unref(a)("actions.enable")),1)],10,qM)]),_:1},8,["text"])])}}}),[["__scopeId","data-v-65d53934"]]),QM=ve(t.defineComponent({__name:"DeleteCustomPluginSchemaModal",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app))},plugin:{type:Object,required:!0}},emits:["closed","proceed"],setup(e,{emit:n}){var y;const o=e,r=n,{i18nT:i,i18n:{t:a}}=Fe.useI18n(),{getMessageFromError:l}=he.useErrors(),{axiosInstance:s}=he.useAxios((y=o.config)==null?void 0:y.axiosRequestConfig),c=t.computed(()=>{var _;return u.value?a("delete.plugin_schema_in_use_title"):a("delete.title",{name:((_=o.plugin)==null?void 0:_.name)||a("delete.custom_plugin")})}),d=t.ref(!1),f=t.ref(""),u=t.ref(!1),p=t.computed(()=>{if(o.config.app==="konnect"){const _=o.plugin.customPluginType==="streaming"?Xe.select[o.config.app].streamingCustomPluginItem:Xe.select[o.config.app].schemaCustomPluginItem;let g=`${o.config.apiBaseUrl}${_}`;return g=g.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||""),g=g.replace(/{pluginId}/gi,o.plugin.id),g}return null}),m=async()=>{var _,g,h,w;if(d.value=!0,f.value="",!(!((_=o.plugin)!=null&&_.name)||((g=o.config)==null?void 0:g.app)!=="konnect"))try{p.value&&await s.delete(p.value),r("proceed")}catch(b){const{response:x}=b;(x==null?void 0:x.status)===400&&((w=(h=x.data)==null?void 0:h.message)!=null&&w.includes("plugin schema is currently in use"))?u.value=!0:f.value=l(b)}finally{d.value=!1}};return(_,g)=>{const h=t.resolveComponent("KButton"),w=t.resolveComponent("KModal");return!u.value&&e.plugin?(t.openBlock(),t.createBlock(t.unref(he.EntityDeleteModal),{key:0,"action-pending":d.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",description:t.unref(a)("delete.description_custom"),"entity-name":e.plugin.name,"entity-type":t.unref(he.EntityTypes).Plugin,error:f.value,"need-confirm":"",title:c.value,visible:"",onCancel:g[0]||(g[0]=b=>_.$emit("closed")),onProceed:m},null,8,["action-pending","description","entity-name","entity-type","error","title"])):e.plugin?(t.openBlock(),t.createBlock(w,{key:1,"action-button-disabled":d.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",title:c.value,visible:"",onCancel:g[2]||(g[2]=b=>_.$emit("closed"))},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createVNode(t.unref(i),{keypath:"delete.plugin_schema_in_use_message",tag:"p"},{name:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(e.plugin.name),1)]),_:1})])]),"footer-actions":t.withCtx(()=>[t.createElementVNode("div",null,[t.createVNode(h,{appearance:"tertiary",class:"cancel-button","data-testid":"delete-custom-plugin-form-cancel",onClick:g[1]||(g[1]=b=>_.$emit("closed"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a)("actions.cancel")),1)]),_:1})])]),_:1},8,["action-button-disabled","title"])):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9e0dee7f"]]),e2={class:"custom-plugins-grid"},t2={class:"empty-state-title"},n2={class:"empty-state-description"},Ts=310,o2=ve(t.defineComponent({__name:"PluginCustomGrid",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},canCreateCustomPlugin:{type:Boolean,default:!1},canDeleteCustomPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","revalidate","delete:success"],setup(e,{emit:n}){const o=e,r=n,{i18n:{t:i}}=Fe.useI18n(),{getTallestPluginCardHeight:a,getToggleVisibility:l}=Fe.usePluginHelpers(),s=t.ref(!0),c=E=>{r("plugin-clicked",E)},d=t.computed(()=>{if(o.config.app==="kongManager")return[];const E=JSON.parse(JSON.stringify(o.pluginList))[W.PluginGroup.CUSTOM_PLUGINS]||[];return o.canCreateCustomPlugin&&o.navigateOnClick&&o.config.createCustomRoute?[{id:"custom-plugin-create",name:i("plugins.select.tabs.custom.create.name"),available:!0,group:W.PluginGroup.CUSTOM_PLUGINS,description:i("plugins.select.tabs.custom.create.description")}].concat(E):E}),f=t.ref(!1),u=t.ref(null),p=E=>{f.value=!0,u.value={id:E.id,name:E.name,customPluginType:E.customPluginType}},m=E=>{var C;E&&(r("revalidate"),r("delete:success",((C=u.value)==null?void 0:C.name)||"")),f.value=!1,u.value=null},y=t.ref(Ts),_=t.ref(null),g=t.ref(null),h=t.computed(()=>s.value?{overflowY:"hidden",maxHeight:`${y.value}px`}:{}),w=t.ref(!1),b=()=>{y.value=Math.max(a(g.value),Ts),x()},x=()=>{var E,C;(E=g.value)!=null&&E.length&&(w.value=l(_.value,(C=g.value)==null?void 0:C.length))};return t.onMounted(async()=>{await t.nextTick(),y.value=Math.max(a(g.value),Ts),x(),window==null||window.addEventListener("resize",b)}),t.onUnmounted(()=>{window==null||window.removeEventListener("resize",b)}),(E,C)=>{const N=t.resolveComponent("KEmptyState"),S=t.resolveComponent("KCollapse");return t.openBlock(),t.createElementBlock("div",e2,[d.value.length?(t.openBlock(),t.createBlock(S,{key:1,modelValue:s.value,"onUpdate:modelValue":C[0]||(C[0]=v=>s.value=v),class:"custom-plugins-collapse","data-testid":`${t.unref(W.PluginGroup).CUSTOM_PLUGINS}-collapse`,title:t.unref(W.PluginGroup).CUSTOM_PLUGINS,"trigger-label":s.value?t.unref(i)("plugins.select.view_more"):t.unref(i)("plugins.select.view_less")},t.createSlots({"visible-content":t.withCtx(()=>[t.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:_,class:"plugin-card-container",style:t.normalizeStyle(h.value)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(v,D)=>(t.openBlock(),t.createBlock(Is,{key:`plugin-card-${D}`,ref_for:!0,ref_key:"pluginCardRef",ref:g,"can-delete-custom-plugin":e.canDeleteCustomPlugin,"can-edit-custom-plugin":e.canEditCustomPlugin,config:e.config,"navigate-on-click":e.navigateOnClick,plugin:v,onCustomPluginDelete:L=>p(v),onPluginClicked:c},null,8,["can-delete-custom-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete"]))),128))],4)]),_:2},[w.value?void 0:{name:"trigger",fn:t.withCtx(()=>[C[2]||(C[2]=t.createTextVNode(" ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"])):(t.openBlock(),t.createBlock(N,{key:0,"action-button-visible":!1,class:"custom-plugins-empty-state","icon-variant":"kong"},{title:t.withCtx(()=>[t.createElementVNode("span",t2,t.toDisplayString(t.unref(i)("plugins.select.tabs.custom.empty_title")),1)]),default:t.withCtx(()=>[t.createElementVNode("span",n2,t.toDisplayString(t.unref(i)("plugins.select.tabs.custom.empty_description")),1)]),_:1})),f.value&&u.value?(t.openBlock(),t.createBlock(QM,{key:2,config:e.config,plugin:u.value,onClosed:m,onProceed:C[1]||(C[1]=v=>m(!0))},null,8,["config","plugin"])):t.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-f4b90f47"]]),Ps=310,pg=ve(t.defineComponent({__name:"PluginSelectGroup",props:t.mergeModels({config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},name:{type:String,required:!0},plugins:{type:Array,required:!0},navigateOnClick:{type:Boolean,default:!0}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:t.mergeModels(["plugin-clicked"],["update:modelValue"]),setup(e,{emit:n}){const o=t.useModel(e,"modelValue"),r=e,i=n,{i18n:{t:a}}=Fe.useI18n(),{getTallestPluginCardHeight:l,getToggleVisibility:s}=Fe.usePluginHelpers(),c=t.ref(Ps),d=t.ref(null),f=t.ref(null),u=t.computed(()=>o.value?{overflowY:"hidden",maxHeight:`${c.value}px`}:{}),p=t.ref(!1),m=()=>{c.value=Math.max(l(f.value),Ps),y()},y=()=>{var _,g;(_=f.value)!=null&&_.length&&(p.value=s(d.value,(g=f.value)==null?void 0:g.length))};return t.onMounted(async()=>{await t.nextTick(),c.value=Math.max(l(f.value),Ps),y(),window==null||window.addEventListener("resize",m)}),t.onUnmounted(()=>{window==null||window.removeEventListener("resize",m)}),(_,g)=>{const h=t.resolveComponent("KCollapse");return t.openBlock(),t.createBlock(h,{modelValue:o.value,"onUpdate:modelValue":g[0]||(g[0]=w=>o.value=w),class:"plugins-collapse","data-testid":`${r.name}-collapse`,title:r.name,"trigger-label":o.value?t.unref(a)("plugins.select.view_more"):t.unref(a)("plugins.select.view_less")},t.createSlots({"visible-content":t.withCtx(()=>[t.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:d,class:"plugin-card-container",style:t.normalizeStyle(u.value)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.plugins,w=>(t.openBlock(),t.createBlock(Is,{key:`plugin-card-${w.id}`,ref_for:!0,ref_key:"pluginCardRef",ref:f,config:e.config,"navigate-on-click":e.navigateOnClick,plugin:w,onPluginClicked:b=>i("plugin-clicked",w)},null,8,["config","navigate-on-click","plugin","onPluginClicked"]))),128))],4)]),_:2},[p.value?void 0:{name:"trigger",fn:t.withCtx(()=>[g[1]||(g[1]=t.createTextVNode(" ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"])}}}),[["__scopeId","data-v-a1074120"]]),r2={class:"plugin-select-grid"},i2={class:"empty-state-title"},a2={class:"empty-state-description"},Os=t.defineComponent({__name:"PluginSelectGrid",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0},highlightedPlugins:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""},hideHighlightedPlugins:{type:Boolean,default:!1}},emits:["plugin-clicked"],setup(e,{emit:n}){const o=e,r=n,{i18n:{t:i}}=Fe.useI18n(),a=t.ref(!1),l=t.ref(Ds),s=d=>{r("plugin-clicked",d)},c=t.computed(()=>{const d=JSON.parse(JSON.stringify(o.pluginList));return o.config.app==="konnect"&&delete d[W.PluginGroup.CUSTOM_PLUGINS],d});return(d,f)=>{const u=t.resolveComponent("KEmptyState");return t.openBlock(),t.createElementBlock("div",r2,[Object.keys(c.value).length?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(u,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:t.withCtx(()=>[t.createElementVNode("span",i2,t.toDisplayString(t.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:t.withCtx(()=>[t.createElementVNode("span",a2,t.toDisplayString(t.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),!o.hideHighlightedPlugins&&o.highlightedPlugins.length>0?(t.openBlock(),t.createBlock(pg,{key:1,modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=p=>a.value=p),config:e.config,name:o.highlightedPluginsTitle||t.unref(i)("plugins.select.highlighted_plugins.title"),"navigate-on-click":e.navigateOnClick,plugins:o.highlightedPlugins,onPluginClicked:f[1]||(f[1]=p=>s(p))},null,8,["modelValue","config","name","navigate-on-click","plugins"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Rs),p=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[c.value[p]?(t.openBlock(),t.createElementBlock("div",{key:p},[t.createVNode(pg,{modelValue:l.value[p],"onUpdate:modelValue":m=>l.value[p]=m,config:e.config,name:p,"navigate-on-click":e.navigateOnClick,plugins:c.value[p]||[],onPluginClicked:f[2]||(f[2]=m=>s(m))},null,8,["modelValue","onUpdate:modelValue","config","name","navigate-on-click","plugins"])])):t.createCommentVNode("",!0)],64))),256))])}}}),l2={class:"kong-ui-entities-plugin-select-form"},s2={class:"plugins-filter-input-container"},c2={key:0},d2={key:3,"aria-live":"polite",class:"plugins-results-container"},u2={"data-testid":"kong-tab"},f2={class:"tab-description"},p2={"data-testid":"custom-tab"},m2={class:"tab-description"},g2=ve(t.defineComponent({__name:"PluginSelect",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.getCreateRoute)},customPluginSupport:{type:String,default:"none"},canCreateCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteCustomPlugin:{type:Function,required:!1,default:async()=>!0},canEditCustomPlugin:{type:Function,required:!1,default:async()=>!0},navigateOnClick:{type:Boolean,default:!0},availableOnServer:{type:Boolean,default:!0},ignoredPlugins:{type:Array,default:()=>[]},disabledPlugins:{type:Object,default:()=>({})},highlightedPluginIds:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""}},emits:["loading","plugin-clicked","delete-custom:success"],setup(e,{emit:n}){var P;const o=e,r=n,i=Bo.useRoute(),a=Bo.useRouter(),{i18n:{t:l}}=Fe.useI18n(),{pluginMetaData:s}=Fe.usePluginMetaData(),{getMessageFromError:c}=he.useErrors(),{sortAlpha:d,objectsAreEqual:f}=he.useHelpers(),u=t.ref(""),p=t.ref(!0),m=t.ref(!1),y=t.ref(""),_=t.ref([]),g=t.ref([]),h=t.ref({}),w=t.ref([]),{axiosInstance:b}=he.useAxios((P=o.config)==null?void 0:P.axiosRequestConfig),x=t.computed(()=>h.value?Object.entries(h.value).filter(([T])=>T!==W.PluginGroup.CUSTOM_PLUGINS).reduce((T,[,M])=>{for(const Y of M)T[Y.id]=Y;return T},{}):{}),E=t.computed(()=>{var Y;if(!h.value)return{};const T=u.value.toLowerCase(),M=JSON.parse(JSON.stringify(h.value));for(const z in h.value){const H=((Y=h.value[z])==null?void 0:Y.filter(Z=>Z.name.toLowerCase().includes(T)||Z.id.toLowerCase().includes(T)||Z.group.toLowerCase().includes(T)))||[];H.length?M[z]=H:delete M[z]}return M}),C=t.computed(()=>o.highlightedPluginIds.reduce((T,M)=>{const Y=x.value[M];return Y&&T.push(Y),T},[])),N=t.computed(()=>Object.keys(E.value).length>0),S=t.computed(()=>Object.keys(h.value).length>0&&!N.value),v=t.computed(()=>o.config.app==="konnect"?[{hash:"#kong",title:l("plugins.select.tabs.kong.title")},{hash:"#custom",title:l("plugins.select.tabs.custom.title"),disabled:["none","disabled"].includes(o.customPluginSupport)}]:[]),D=t.computed(()=>{var M;let T=v.value.length&&((i==null?void 0:i.hash)||((M=v.value[0])==null?void 0:M.hash))||"";return T==="#custom"&&["none","disabled"].includes(o.customPluginSupport)&&(T="#kong"),T}),L=()=>[...new Set([...Object.keys({...o.availableOnServer?{}:s}),..._.value])].filter(T=>!o.ignoredPlugins.includes(T)).filter(T=>o.config.entityType&&(o.config.entityType==="services"&&s[T]&&!s[T].scope.includes(W.PluginScope.SERVICE)||o.config.entityType==="routes"&&s[T]&&!s[T].scope.includes(W.PluginScope.ROUTE)||o.config.entityType==="consumer_groups"&&s[T]&&!s[T].scope.includes(W.PluginScope.CONSUMER_GROUP)||o.config.entityType==="consumers"&&s[T]&&!s[T].scope.includes(W.PluginScope.CONSUMER))?!1:T).reduce((T,M)=>{var ie;const Y=s[M]&&s[M].name||M,z={...s[M],id:M,name:Y,available:_.value.includes(M),disabledMessage:"",group:((ie=s[M])==null?void 0:ie.group)||W.PluginGroup.CUSTOM_PLUGINS};z.group===W.PluginGroup.CUSTOM_PLUGINS&&(z.customPluginType=g.value.find(be=>be.name===M)?"streaming":"schema"),o.disabledPlugins&&(z.disabledMessage=o.disabledPlugins[M]);const H=z.group||l("plugins.select.misc_plugins");let Z=T[H];return Z||(Z=[]),Z.push(z),Z.sort(d("name")),T[H]=Z,T},{}),k=t.computed(()=>{var M;let T=`${o.config.apiBaseUrl}${Xe.select[o.config.app].availablePlugins}`;return o.config.app==="konnect"?T=T.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||""):o.config.app==="kongManager"&&(T=((M=o.config.gatewayInfo)==null?void 0:M.edition)==="community"?`${o.config.apiBaseUrl}${Xe.select[o.config.app].availablePluginsForOss}`:T.replace(/\/{workspace}/gi,o.config.workspace?`/${o.config.workspace}`:"")),T}),J=t.computed(()=>{if(o.config.app==="konnect"&&o.customPluginSupport==="streaming"){let T=`${o.config.apiBaseUrl}${Xe.select[o.config.app].streamingCustomPlugins}`;return T=T.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||""),T}return null}),I=t.computed(()=>{if(o.config.entityType&&o.config.entityId){let T=`${o.config.apiBaseUrl}${Xe.list[o.config.app].forEntity}`;return o.config.app==="konnect"?T=T.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||""):o.config.app==="kongManager"&&(T=T.replace(/\/{workspace}/gi,o.config.workspace?`/${o.config.workspace}`:"")),T.replace(/{entityType}/gi,o.config.entityType||"").replace(/{entityId}/gi,o.config.entityId||"")}return""}),G=T=>{a.replace({hash:T,query:i.query})};t.watch(()=>o.disabledPlugins,(T,M)=>{!f(T,M)&&!p.value&&(h.value=L())}),t.watch(()=>o.ignoredPlugins,(T,M)=>{!f(T,M)&&!p.value&&(h.value=L())}),t.watch(p,T=>{r("loading",T)});const j=t.ref(!1),te=t.ref(!1),K=t.ref(!1);t.onBeforeMount(async()=>{j.value=await o.canCreateCustomPlugin(),te.value=await o.canEditCustomPlugin(),K.value=await o.canDeleteCustomPlugin()});const O=t.useTemplateRef("filter-input");return t.onMounted(async()=>{var T,M;(M=(T=O.value)==null?void 0:T.input)==null||M.focus();try{const{data:Y}=await b.get(k.value);if(o.config.app==="konnect"){const{names:z}=Y;if(_.value=z||[],J.value){const{data:H}=await b.get(J.value);g.value=H.data||[]}}else if(o.config.app==="kongManager"){const{plugins:{available_on_server:z}}=Y;_.value=z?Object.keys(z):[]}}catch(Y){m.value=!0,y.value=c(Y)}if(I.value)try{const{data:{data:Y}}=await b.get(I.value);if(Y!=null&&Y.length){const z=Y.reduce((H,Z)=>(Z.name&&H.push(Z.name),H),[]);w.value=w.value.concat(z)}}catch{}m.value||(h.value=L()),p.value=!1}),(T,M)=>{const Y=t.resolveComponent("KInput"),z=t.resolveComponent("KSkeletonBox"),H=t.resolveComponent("KSkeleton"),Z=t.resolveComponent("KEmptyState"),ie=t.resolveComponent("KTooltip"),be=t.resolveComponent("KTabs");return t.openBlock(),t.createElementBlock("div",l2,[t.createElementVNode("div",s2,[t.createVNode(Y,{ref:"filter-input",modelValue:u.value,"onUpdate:modelValue":M[0]||(M[0]=ee=>u.value=ee),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter",placeholder:t.unref(l)("search.placeholder.select"),type:"search"},null,8,["modelValue","placeholder"])]),p.value?(t.openBlock(),t.createElementBlock("section",c2,[t.createVNode(z,{class:"plugins-skeleton-title",width:"10"}),t.createVNode(H,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):m.value?(t.openBlock(),t.createBlock(Z,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:t.withCtx(()=>[t.createElementVNode("h3",null,t.toDisplayString(y.value),1)]),_:1})):S.value&&u.value?(t.openBlock(),t.createBlock(Z,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:t.withCtx(()=>[t.createElementVNode("h5",null,t.toDisplayString(t.unref(l)("search.no_results",{filter:u.value})),1)]),_:1})):(t.openBlock(),t.createElementBlock("section",d2,[v.value.length&&e.customPluginSupport!=="none"?(t.openBlock(),t.createBlock(be,{key:0,modelValue:D.value,"onUpdate:modelValue":M[5]||(M[5]=ee=>D.value=ee),"data-testid":"plugins-tabs",tabs:v.value,onChange:G},t.createSlots({kong:t.withCtx(()=>[t.createElementVNode("div",u2,[t.createElementVNode("p",f2,t.toDisplayString(t.unref(l)("plugins.select.tabs.kong.description")),1),t.createVNode(Os,{config:e.config,"hide-highlighted-plugins":u.value.length>0,"highlighted-plugins":C.value,"highlighted-plugins-title":o.highlightedPluginsTitle,"navigate-on-click":e.navigateOnClick,"plugin-list":E.value,onPluginClicked:M[1]||(M[1]=ee=>T.$emit("plugin-clicked",ee))},null,8,["config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])])]),custom:t.withCtx(()=>[t.createElementVNode("div",p2,[t.renderSlot(T.$slots,"before-custom-tab-content",{},void 0,!0),t.createElementVNode("p",m2,t.toDisplayString(t.unref(l)("plugins.select.tabs.custom.description")),1),t.createVNode(o2,{"can-create-custom-plugin":j.value,"can-delete-custom-plugin":K.value,"can-edit-custom-plugin":te.value,config:e.config,"navigate-on-click":e.navigateOnClick,"plugin-list":E.value,"onDelete:success":M[2]||(M[2]=ee=>T.$emit("delete-custom:success",ee)),onPluginClicked:M[3]||(M[3]=ee=>T.$emit("plugin-clicked",ee)),onRevalidate:M[4]||(M[4]=()=>h.value=L())},null,8,["can-create-custom-plugin","can-delete-custom-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin-list"])])]),_:2},[e.customPluginSupport==="disabled"?{name:"custom-anchor",fn:t.withCtx(()=>[t.createVNode(ie,{"max-width":"300",text:t.unref(l)("plugins.select.tabs.custom.disabled_tooltip")},{default:t.withCtx(()=>[t.createElementVNode("div",null,t.toDisplayString(t.unref(l)("plugins.select.tabs.custom.title")),1)]),_:1},8,["text"])]),key:"0"}:void 0]),1032,["modelValue","tabs"])):(t.openBlock(),t.createBlock(Os,{key:1,config:e.config,"hide-highlighted-plugins":u.value.length>0,"highlighted-plugins":C.value,"highlighted-plugins-title":o.highlightedPluginsTitle,"navigate-on-click":e.navigateOnClick,"plugin-list":E.value,onPluginClicked:M[6]||(M[6]=ee=>T.$emit("plugin-clicked",ee))},null,8,["config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"]))]))])}}}),[["__scopeId","data-v-7b1adaaa"]]),h2={class:"datakit-config-card-canvas"},y2={class:"config-card-details-label","data-testid":"datakit-configuration-label"},_2={class:"config-card-details-value datakit-canvas-container","data-testid":"datakit-configuration-canvas"},b2={class:"canvas-wrapper"},w2=ve(t.defineComponent({__name:"DatakitConfigCardCanvas",props:{pluginData:{}},setup(e){return zu(e.pluginData),(n,o)=>{const r=t.resolveComponent("KLabel");return t.openBlock(),t.createElementBlock("div",h2,[t.createElementVNode("div",y2,[t.createVNode(r,null,{default:t.withCtx(()=>o[0]||(o[0]=[t.createElementVNode("span",{class:"label-content"}," Nodes ",-1)])),_:1,__:[0]})]),t.createElementVNode("div",_2,[t.createElementVNode("div",b2,[t.createVNode(Ns,{class:"datakit-flow-panels",mode:"view",resizable:""})])])])}}}),[["__scopeId","data-v-591ec060"]]),k2={class:"kong-ui-entity-plugin-config-card"},C2={class:"name-cell-wrapper"},E2={class:"info-name"},N2={key:0},S2={key:0},x2={key:0},v2={key:0},A2={key:0},$s="config",I2=ve(t.defineComponent({__name:"PluginConfigCard",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||e.app==="konnect"&&!e.controlPlaneId||e.app==="kongManager"&&typeof e.workspace!="string"||!e.entityId||!e.pluginType)},configCardDoc:{type:String,default:"",required:!1},showIdAsLink:{type:Boolean,default:!1},hideTitle:{type:Boolean,default:!1},scopedEntityType:{type:String,required:!1,default:""},scopedEntityId:{type:String,required:!1,default:""},expandPartial:{type:Boolean,default:!0}},emits:["loading","fetch:error","error:fetch-schema","fetch:success","navigation-click"],setup(e,{emit:n}){var C;const o=n,r=e,{i18n:{t:i}}=Fe.useI18n(),a=Fe.usePluginMetaData(),{setFieldType:l}=Fe.usePluginHelpers(),{getPropValue:s}=he.useHelpers(),c=t.computed(()=>r.config.app==="konnect"),d=t.computed(()=>c.value&&r.config.pluginType==="datakit"),f=t.computed(()=>{var S;let N=(S=Xe.item[r.config.app])==null?void 0:S[r.scopedEntityType?"forEntity":"all"].replace(/{entityType}/gi,r.scopedEntityType).replace(/{entityId}/gi,r.scopedEntityId).concat(r.expandPartial?"?expand_partials=true":"");if(c.value){const v=r.expandPartial?"&":"?";N=N.concat(`${v}__ui_data=true`)}return N}),u=t.computed(()=>{var v,D;const N={},S=((v=b.value)==null?void 0:v.fields)||[];for(let L=0;L<S.length;L++){const k=b.value.fields[L],J=(D=Object.keys(k))==null?void 0:D[0];l(N,J,k[J])}return{...N,instance_name:{section:he.ConfigurationSchemaSection.Basic,order:1.5},consumer:{label:i("plugins.fields.consumer"),section:he.ConfigurationSchemaSection.Basic,order:6},route:{label:i("plugins.fields.route"),section:he.ConfigurationSchemaSection.Basic,order:6},service:{label:i("plugins.fields.service"),section:he.ConfigurationSchemaSection.Basic,order:6},consumer_group:{label:i("plugins.fields.consumer_group"),section:he.ConfigurationSchemaSection.Basic,order:6},protocols:{type:he.ConfigurationSchemaType.BadgeTag,section:he.ConfigurationSchemaSection.Basic,order:7}}}),p=t.computed(()=>{var S,v,D;if(!((S=b.value)!=null&&S.fields))return[];const N=(v=b.value.fields)==null?void 0:v.find(L=>{var J;return((J=Object.keys(L))==null?void 0:J[0])===$s});return((D=N==null?void 0:N[$s])==null?void 0:D.fields)||[]}),m=t.computed(()=>{var S,v;const N={};if(!p.value)return N;for(let D=0;D<((S=p.value)==null?void 0:S.length);D++){const L=p.value[D],k=(v=Object.keys(L))==null?void 0:v[0],J=L[k];J.required&&(N[k]={order:1}),l(N,k,J)}return N}),y=N=>{var v;const S=(v=a.pluginMetaData[r.config.pluginType])==null?void 0:v.scope;return S?Object.fromEntries(Object.entries(N).filter(([D,L])=>L?!0:!(D==="service"&&!S.includes(W.PluginScope.SERVICE)||D==="route"&&!S.includes(W.PluginScope.ROUTE)||D==="consumer"&&!S.includes(W.PluginScope.CONSUMER)||D==="consumer_group"&&!S.includes(W.PluginScope.CONSUMER_GROUP)))):N},_=N=>zo(N,"__ui_data"),{getMessageFromError:g}=he.useErrors(),{axiosInstance:h}=he.useAxios((C=r.config)==null?void 0:C.axiosRequestConfig),w=t.computed(()=>{var S,v;let N=`${r.config.apiBaseUrl}${Xe.form[r.config.app].pluginSchema}`;return r.config.app==="konnect"?N=N.replace(/{controlPlaneId}/gi,((S=r.config)==null?void 0:S.controlPlaneId)||""):r.config.app==="kongManager"&&(N=N.replace(/\/{workspace}/gi,(v=r.config)!=null&&v.workspace?`/${r.config.workspace}`:"")),N=N.replace(/{plugin}/gi,r.config.pluginType),N}),b=t.ref({});he.useSchemaProvider(b);const x=t.ref(!1),E=t.ref("");return t.onBeforeMount(async()=>{x.value=!0;try{const{data:N}=await h.get(w.value);b.value=N}catch(N){E.value=g(N),o("error:fetch-schema",N)}finally{x.value=!1}}),(N,S)=>{const v=t.resolveComponent("KSkeleton"),D=t.resolveComponent("KEmptyState"),L=t.resolveComponent("KCopy");return t.openBlock(),t.createElementBlock("div",k2,[x.value?(t.openBlock(),t.createBlock(v,{key:0,"data-testid":"plugin-config-card-loader","table-columns":2,type:"table"})):E.value?(t.openBlock(),t.createBlock(D,{key:1,"data-testid":"plugin-config-card-schema-error","icon-variant":"error"},{default:t.withCtx(()=>[t.createElementVNode("h3",null,t.toDisplayString(E.value),1)]),_:1})):(t.openBlock(),t.createBlock(t.unref(he.EntityBaseConfigCard),{key:2,"code-block-record-formatter":_,config:e.config,"config-card-doc":e.configCardDoc,"config-schema":u.value,"entity-type":t.unref(he.SupportedEntityType).Plugin,"fetch-url":f.value,"hide-title":e.hideTitle,"plugin-config-key":$s,"plugin-config-schema":m.value,"record-resolver":y,"onFetch:error":S[0]||(S[0]=k=>N.$emit("fetch:error",k)),"onFetch:success":S[1]||(S[1]=k=>N.$emit("fetch:success",k)),onLoading:S[2]||(S[2]=k=>N.$emit("loading",k))},t.createSlots({name:t.withCtx(k=>[t.createElementVNode("div",C2,[t.createVNode(t.unref(Ro.PluginIcon),{class:"plugin-icon",name:t.unref(s)("rowValue",k),size:24},null,8,["name"]),t.createElementVNode("span",E2,t.toDisplayString(t.unref(a).getDisplayName(t.unref(s)("rowValue",k))),1)])]),consumer:t.withCtx(k=>[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:t.unref(s)("rowValue",k).id,value:t.unref(s)("rowValue",k).id,type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>N.$emit("navigation-click",t.unref(s)("rowValue",k).id,"consumer")},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"consumer-copy-uuid",text:t.unref(s)("rowValue",k).id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",N2,"–"))]),route:t.withCtx(k=>[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:t.unref(s)("rowValue",k).id,value:t.unref(s)("rowValue",k).id,type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>N.$emit("navigation-click",t.unref(s)("rowValue",k).id,"route")},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"route-copy-uuid",text:t.unref(s)("rowValue",k).id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",S2,"–"))]),service:t.withCtx(k=>[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:t.unref(s)("rowValue",k).id,value:t.unref(s)("rowValue",k).id,type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>N.$emit("navigation-click",t.unref(s)("rowValue",k).id,"service")},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"service-copy-uuid",text:t.unref(s)("rowValue",k).id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",x2,"–"))]),consumer_group:t.withCtx(k=>[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:t.unref(s)("rowValue",k).id,value:t.unref(s)("rowValue",k).id,type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>N.$emit("navigation-click",t.unref(s)("rowValue",k).id,"consumer_group")},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"consumer-group-copy-uuid",text:t.unref(s)("rowValue",k).id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",v2,"–"))]),partials:t.withCtx(k=>{var J,I,G,j,te,K,O,P,T;return[t.unref(s)("rowValue",k)?e.showIdAsLink?(t.openBlock(),t.createBlock(t.unref(he.InternalLinkItem),{key:1,item:{key:(I=(J=t.unref(s)("rowValue",k))==null?void 0:J[0])==null?void 0:I.id,value:((j=(G=t.unref(s)("rowValue",k))==null?void 0:G[0])==null?void 0:j.id)+((K=(te=t.unref(s)("rowValue",k))==null?void 0:te[0])!=null&&K.name?"/"+((P=(O=t.unref(s)("rowValue",k))==null?void 0:O[0])==null?void 0:P.name):""),type:t.unref(he.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>{var M,Y;return N.$emit("navigation-click",(Y=(M=t.unref(s)("rowValue",k))==null?void 0:M[0])==null?void 0:Y.id,"partial")}},null,8,["item","onNavigationClick"])):(t.openBlock(),t.createBlock(L,{key:2,"copy-tooltip":t.unref(i)("copy.tooltip",{label:t.unref(s)("row",k).label}),"data-testid":"partial-copy-uuid",text:(T=t.unref(s)("rowValue",k))==null?void 0:T[0].id},null,8,["copy-tooltip","text"])):(t.openBlock(),t.createElementBlock("span",A2,"–"))]}),_:2},[d.value?{name:"config-card-item-nodes",fn:t.withCtx(k=>[t.createVNode(w2,{"plugin-data":k.record},null,8,["plugin-data"])]),key:"0"}:void 0]),1032,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title","plugin-config-schema"]))])}}}),[["__scopeId","data-v-a5302acb"]]),{usePluginMetaData:T2,useProvideExperimentalFreeForms:P2}=Fe;Object.defineProperty(Ae,"PluginGroup",{enumerable:!0,get:()=>W.PluginGroup}),Object.defineProperty(Ae,"PluginScope",{enumerable:!0,get:()=>W.PluginScope}),Object.defineProperty(Ae,"PluginIcon",{enumerable:!0,get:()=>Ro.PluginIcon}),Object.defineProperty(Ae,"getPluginIconURL",{enumerable:!0,get:()=>Ro.getPluginIconURL}),Ae.EXPERIMENTAL_FREE_FORM_PROVIDER=Ra,Ae.EntityTypeIdField=An,Ae.FEATURE_FLAGS=so,Ae.PLUGIN_GROUPS_COLLAPSE_STATUS=Ds,Ae.PluginConfigCard=I2,Ae.PluginForm=BM,Ae.PluginGroupArray=Rs,Ae.PluginList=jM,Ae.PluginPartialType=Pr,Ae.PluginSelect=g2,Ae.PluginSelectCard=Is,Ae.PluginSelectGrid=Os,Ae.TOASTER_PROVIDER=nd,Ae.pluginEndpoints=Xe,Ae.usePluginMetaData=T2,Ae.useProvideExperimentalFreeForms=P2,Object.defineProperty(Ae,Symbol.toStringTag,{value:"Module"})});
|