@g1cloud/entity-modeler-next 5.0.0-alpha.18 → 5.0.0-alpha.19

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.
@@ -1,12 +1,12 @@
1
- (function(Ne,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],n):(Ne=typeof globalThis<"u"?globalThis:Ne||self,n(Ne.EntityModeler={},Ne.Vue,Ne.OpenBlueseaCore))})(this,(function(Ne,n,ie){"use strict";var aC=Object.defineProperty;var lC=(Ne,n,ie)=>n in Ne?aC(Ne,n,{enumerable:!0,configurable:!0,writable:!0,value:ie}):Ne[n]=ie;var We=(Ne,n,ie)=>lC(Ne,typeof n!="symbol"?n+"":n,ie);const rf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function sf(e,t){const o=e%t.perRow,i=Math.floor(e/t.perRow);return{location:{x:t.startX+o*t.columnGap,y:t.startY+i*t.rowGap},size:{...t.defaultSize}}}function Jl(e,t,o={}){const i={...rf,...o},a=new Map(e.entities.map(y=>[y.modelId,y])),l=new Map(e.associations.map(y=>[y.modelId,y])),r=new Map(t.entityLayouts.map(y=>[y.entityRef,y])),s=new Map(t.associationLayouts.map(y=>[y.associationRef,y])),c=t.entityLayouts.map(y=>y.entityRef).filter(y=>!a.has(y)),d=t.associationLayouts.map(y=>y.associationRef).filter(y=>!l.has(y)),u=new Map;for(const y of e.groups)for(const v of y.memberEntityRefs)u.set(v,y.modelId);const f=new Map;for(const y of t.groupLayouts)for(const v of y.memberNoteRefs??[])f.set(v,y.groupRef);let h=0;const m=e.entities.map(y=>{const v=u.get(y.modelId),ee=r.get(y.modelId);if(ee){const O={location:{x:ee.geo.location.x,y:ee.geo.location.y},size:{width:ee.geo.size.width,height:ee.geo.size.height}};return{entity:y,geo:O,collapsed:ee.collapsed??!1,locked:ee.locked??!1,groupRef:v,style:ee.style,attributeStyles:ee.attributeStyles,operationStyles:ee.operationStyles}}const x=sf(h++,i);return{entity:y,geo:x,collapsed:!1,locked:!1,groupRef:v}}),p=new Map(t.groupLayouts.map(y=>[y.groupRef,y])),g=e.groups.map(y=>{const v=p.get(y.modelId),ee=v?{location:{x:v.geo.location.x,y:v.geo.location.y},size:{width:v.geo.size.width,height:v.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:y,geo:ee,style:v==null?void 0:v.style,locked:(v==null?void 0:v.locked)??!1}}),b=e.associations.map(y=>{const v=s.get(y.modelId);return{association:y,waypoints:(v==null?void 0:v.waypoints)??[],sourceColumnRef:v==null?void 0:v.sourceColumnRef,targetColumnRef:v==null?void 0:v.targetColumnRef}}),_=t.notes.map(y=>({note:{...y,geo:{location:{x:y.geo.location.x,y:y.geo.location.y},size:{width:y.geo.size.width,height:y.geo.size.height}}},groupRef:f.get(y.modelId)})),V=[];for(const y of t.notes)for(const v of y.connections??[])a.has(v.targetRef)&&V.push({noteRef:y.modelId,targetRef:v.targetRef,waypoints:v.waypoints.map(ee=>({x:ee.x,y:ee.y}))});return{entities:m,associations:b,groups:g,notes:_,noteConnections:V,prunedEntityRefs:c,prunedAssociationRefs:d}}function Yn(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const kn=.5;function Ql(e,t,o,i,a,l){const r=Yn(t),s=Yn(a),c={x:e.x+r.x*l,y:e.y+r.y*l},d={x:i.x+s.x*l,y:i.y+s.y*l},u=[c,...o,d],f=[];let h=e;const m=(b,_)=>{(Math.abs(b.x-h.x)>=kn||Math.abs(b.y-h.y)>=kn)&&(f.push({a:h,b,seg:_}),h=b)};m(c,0);let p=r.x!==0,g=c;for(let b=1;b<u.length;b++){const _=u[b],V=b<=o.length?b-1:o.length,y=Math.abs(_.x-g.x)<kn,v=Math.abs(_.y-g.y)<kn;y&&v||(y?(m(_,V),p=!1):v?(m(_,V),p=!0):p?(m({x:g.x,y:_.y},V),m(_,V),p=!0):(m({x:_.x,y:g.y},V),m(_,V),p=!1),g=_)}return m(i,o.length),f}function ua(e,t,o,i,a,l=20){const r=Ql(e,t,o,i,a,l);let s=`M ${it(e.x)},${it(e.y)}`;for(const c of r)s+=` L ${it(c.b.x)},${it(c.b.y)}`;return s}const cf=14;function fa(e,t,o,i,a,l=20){return Ql(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=cf).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function it(e){return Math.round(e*100)/100}const df=36;function er(e,t,o=df){const i=Math.max(e.x,t.x)+o;return`M ${it(e.x)},${it(e.y)} L ${it(i)},${it(e.y)} L ${it(i)},${it(t.y)} L ${it(t.x)},${it(t.y)}`}function ma(e,t,o){const i=[e,...t,o];let a=`M ${it(i[0].x)},${it(i[0].y)}`;for(let l=1;l<i.length;l++)a+=` L ${it(i[l].x)},${it(i[l].y)}`;return a}function uf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pa(e,t){const o=uf(e),i=e.width/2,a=e.height/2,l=t.x-o.x,r=t.y-o.y;if(Math.abs(l)<kn&&Math.abs(r)<kn)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=l!==0?i/Math.abs(l):1/0,c=r!==0?a/Math.abs(r):1/0,d=Math.min(s,c),u={x:o.x+l*d,y:o.y+r*d},f=s<=c?l>=0?"right":"left":r>=0?"bottom":"top";return{point:u,side:f}}function ha(e,t,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:t},side:i?"right":"left"}}function ya(e,t,o){const i=[e,...t,o],a=[];for(let l=1;l<i.length;l++){const r=i[l-1],s=i[l];a.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return a}const ff={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function tr(e,t,o={}){const i={...ff,...o},a=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),l=[];let r=0;for(const u of e.groups){const f=a.get(u.modelId),h=f?f.location:{x:0,y:0},m=f?f.size.width:800;f&&(r=Math.max(r,f.location.y+f.size.height));const p=Math.max(1,Math.floor((m-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,b)=>{const _=b%p,V=Math.floor(b/p);l.push({id:g,location:{x:h.x+i.pad+_*i.cellWidth,y:h.y+i.pad+i.headerHeight+V*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=r>0?r+40:i.pad;return c.forEach((u,f)=>{const h=f%i.ungroupedCols,m=Math.floor(f/i.ungroupedCols);l.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+m*i.cellHeight}})}),l}const nr={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function or(e,t={}){const o={...nr,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function mf(e,t={}){const o={...nr,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=or(l.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:l.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Fo(e,t,o,i){switch(e){case"CLASS":return t;case"PHYSICAL":return i||t;case"LOGICAL":return o||"(논리명)";default:return i?`${o||"(논리명)"} · ${i}`:o||"(논리명)"}}function ir(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function ar(e){var l,r,s;const t=new Map(e.entities.map(c=>[c.modelId,c.name])),o=new Map;for(const c of e.entities)for(const d of c.attributes)o.set(d.modelId,d.name);const i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((l=c.name)==null?void 0:l.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(r=c.table)!=null&&r.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const f=[...c.attributes].sort((m,p)=>m.order-p.order);for(const m of f){if(m.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${m.name?` ${m.name} ${"─".repeat(8)}`:""}`);continue}const p=m.dbAttrs[0],g=p!=null&&p.length?`(${p.length}${p.scale!=null?`,${p.scale}`:""})`:"",b=p?` → ${p.physicalName} ${p.dataType}${g}`:"",_=[m.identifier?"PK":"",m.notNull?"NOT NULL":"",p!=null&&p.unique?"UNIQUE":"",p!=null&&p.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${m.name}: ${m.type}${b}${_.length?` {${_.join(", ")}}`:""}`)}for(const m of c.indexes??[]){const p=m.columns.map(g=>`${o.get(g.columnRef)??g.columnRef}${g.descending?" DESC":""}`).join(", ");a.push(` index ${m.name}${m.unique?" UNIQUE":""}: ${p}`)}const h=[...c.operations??[]].sort((m,p)=>m.order-p.order);for(const m of h){const p=m.visibility?` {${m.visibility}}`:"",g=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";a.push(` method ${m.name}()${p}${g}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=t.get(c.end1.entityRef)??c.end1.entityRef,u=t.get(c.end2.entityRef)??c.end2.entityRef,f=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${ir(c.end1.multiplicity)} —— ${ir(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
2
- `).trim()}function pf(e){return e==="CLASS"?"class":"er"}function ga(e,t){return t==="class"?_f(e):yf(e)}function Wn(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function ba(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function lr(e,t){const o=new Set,i=new Map;return e.entities.forEach((a,l)=>{const r=Wn(t(a),`Entity_${l+1}`);let s=r,c=2;for(;o.has(s);)s=`${r}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function hf(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function rr(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function sr(e,t){return(t==="left"?{NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"}:{NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"})[e]}function yf(e){var i,a;const t=lr(e,l=>{var r;return((r=l.table)==null?void 0:r.physicalName)||l.name}),o=["erDiagram"];for(const l of e.entities){const r=t.get(l.modelId),s=[...l.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){o.push(` ${r}`);continue}o.push(` ${r} {`);for(const c of s){const d=c.dbAttrs[0],u=Wn((d==null?void 0:d.dataType)||c.type,"unknown"),f=Wn((d==null?void 0:d.physicalName)||c.name,"col"),h=[c.identifier?"PK":"",hf(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),m=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",p=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,g=ba([p,m].filter(Boolean).join(" ")),b=[` ${u} ${f}`];h&&b.push(h);let _=b.join(" ");g&&(_+=` "${g}"`),o.push(_)}o.push(" }")}for(const l of e.associations){const r=t.get(l.end1.entityRef),s=t.get(l.end2.entityRef);if(!r||!s)continue;const c=`${sr(l.end1.multiplicity,"left")}--${sr(l.end2.multiplicity,"right")}`,d=ba(l.description);o.push(` ${r} ${c} ${s} : "${d}"`)}return o.join(`
3
- `)}function gf(e){return e&&e!=="UNDEFINED"?e:null}function bf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function _f(e){const t=lr(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),l=[],r=gf(i.stereotype);r&&l.push(` <<${r}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)l.push(` +${bf(c.type)} ${Wn(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))l.push(` +${Wn(c.name,"op")}()`);l.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...l),o.push(" }"))}for(const i of e.associations){const a=t.get(i.end1.entityRef),l=t.get(i.end2.entityRef);if(!a||!l)continue;const r=kf(i),s=ba(i.description),c=` ${a} "${rr(i.end1.multiplicity)}" ${r} "${rr(i.end2.multiplicity)}" ${l}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
- `)}function kf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const wf=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function dt(e){return e.replace(wf,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ae(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function cr(e){return`<text ${[`x="${Ae(e.x)}"`,`y="${Ae(e.y)}"`,`fill="${dt(e.fill)}"`,`font-size="${Ae(e.fontSize)}"`,e.fontFamily?`font-family="${dt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${dt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${dt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${dt(e.text)}</text>`}function Ef(e){return`<line x1="${Ae(e.x1)}" y1="${Ae(e.y)}" x2="${Ae(e.x2)}" y2="${Ae(e.y)}" stroke="${dt(e.stroke)}" stroke-width="${Ae(e.strokeWidth??1)}" />`}function vf(e){return e==null?{tl:0,tr:0,br:0,bl:0}:typeof e=="number"?{tl:e,tr:e,br:e,bl:e}:e}function Nf(e,t,o,i,a){return[`M${Ae(e+a.tl)},${Ae(t)}`,`L${Ae(e+o-a.tr)},${Ae(t)}`,a.tr?`Q${Ae(e+o)},${Ae(t)} ${Ae(e+o)},${Ae(t+a.tr)}`:"",`L${Ae(e+o)},${Ae(t+i-a.br)}`,a.br?`Q${Ae(e+o)},${Ae(t+i)} ${Ae(e+o-a.br)},${Ae(t+i)}`:"",`L${Ae(e+a.bl)},${Ae(t+i)}`,a.bl?`Q${Ae(e)},${Ae(t+i)} ${Ae(e)},${Ae(t+i-a.bl)}`:"",`L${Ae(e)},${Ae(t+a.tl)}`,a.tl?`Q${Ae(e)},${Ae(t)} ${Ae(e+a.tl)},${Ae(t)}`:"","Z"].filter(Boolean).join(" ")}function _a(e){const t=vf(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${dt(e.fill)}"`,`stroke="${dt(e.stroke)}"`,`stroke-width="${Ae(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Ae(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${Nf(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Ae(e.x)}" y="${Ae(e.y)}" width="${Ae(e.w)}" height="${Ae(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(Ef(r));for(const r of e.texts)l.push(cr(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function $f(e){const o=[`<path ${[`d="${dt(e.d)}"`,'fill="none"',`stroke="${dt(e.stroke)}"`,`stroke-width="${Ae(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(cr(i));return`<g>${o.join("")}</g>`}function dr(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Ae(t)}" y="${Ae(o)}" width="${Ae(i)}" height="${Ae(a)}" fill="${dt(e.background)}" />`);for(const r of e.groups)l.push(_a(r));for(const r of e.edges)l.push($f(r));for(const r of e.entities)l.push(_a(r));for(const r of e.notes)l.push(_a(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Ae(t)} ${Ae(o)} ${Ae(i)} ${Ae(a)}" width="${Ae(i)}" height="${Ae(a)}">`+l.join("")+"</svg>"}const xf=["BIT","TINYINT","SMALLINT","INTEGER","BIGINT","FLOAT","REAL","DOUBLE","NUMERIC","DECIMAL","CHAR","VARCHAR","LONGVARCHAR","DATE","TIME","TIMESTAMP","BINARY","VARBINARY","LONGVARBINARY","NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","BLOB","CLOB","REF","DATALINK","BOOLEAN","ROWID","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","REF_CURSOR","TIME_WITH_TIMEZONE","TIMESTAMP_WITH_TIMEZONE","SERIAL","BIG_SERIAL","JSONB"],If=new Set(["NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","REF","DATALINK","ROWID","REF_CURSOR","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","TIME_WITH_TIMEZONE","BIT","TINYINT","FLOAT"]),Sf=xf.filter(e=>!If.has(e)),Cf={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function ka(e){return Cf[e]??e}const Rf=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Go=new Set(["NUMERIC","DECIMAL"]);function ur(e,t=Sf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ct="CustomType",Kn="GroupCodeEnum",wa="String",Ea=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Kn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Ct,label:"CustomType"}],Vf=new Map(Ea.map(e=>[e.value,e.label]));function wn(e){return Vf.get(e)??e}const Af=new Set([Kn,"CustomMoneyType"]),fr=Ea.filter(e=>!Af.has(e.value)).map(e=>e.value===Ct?{...e,label:"CustomType (사용자정의)"}:e);function mr(e,t=[]){const o=t.map(a=>{var r,s;const l=((r=a.label)==null?void 0:r.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:l?`${a.type} (${l})`:a.type}}),i=[...fr,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:wn(e)},...i]:i}function Tf(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function pr(e,t){var a;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(l=>l.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity!=="EXACTLY_ONE_INSTANCE")return((a=i.jpa)==null?void 0:a.collectionType)??"LIST"}function va(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${wn(t.type)}>`:Tf(t)?wn(t.type):e==="CLASS"?t.type===Ct&&t.customType||wn(t.type):ka(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Yo(e,t){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=t.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var l;return a.attrType==="EMBED_OWN"&&((l=a.embedded)==null?void 0:l.embeddableRef)===e.modelId}));return[e,...o]}function Na(e,t){return Yo(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function qn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Wo(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const $a=63;function Ko(e){if(!e)return null;const t=e.length;return t<=$a?null:`물리명이 ${$a}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function hr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function mt(e){return!e||e.trim()===""}function Xn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Mf(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,a=2,l=new Map,r=[],s=[],c=new Set,d=u=>{l.set(u,i),r.push(u);for(const f of t.get(u)??[]){const h=l.get(f)??o;if(h===o)d(f);else if(h===i){const m=r.slice(r.indexOf(f)),p=[...m].sort().join(" ");c.has(p)||(c.add(p),s.push(m))}}r.pop(),l.set(u,a)};for(const u of e.entities)(l.get(u.modelId)??o)===o&&d(u.modelId);return s}function Bf(e,t,o,i,a){var l,r,s,c,d;if(!mt(t.physicalName))return t.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(r=(l=a==null?void 0:a.embeddableCatalog)==null?void 0:l.find(u=>u.type===e.type))==null?void 0:r.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const f=(d=i.entities.find(h=>h.modelId===u))==null?void 0:d.attributes.flatMap(h=>h.dbAttrs)[o];return(f==null?void 0:f.physicalName)??""}return t.physicalName??""}function xa(e,t){const o=new Map;for(const i of e){const a=t(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=t(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function yr(e,t){var l,r,s;const o=[];for(const c of xa(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(p=>p.attrType!=="DIVIDER");if(mt(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(p=>p.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),mt((l=c.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const p of d.filter(g=>g.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${p.name}"`});for(const p of d.filter(g=>g.identifier&&g.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${p.name}"`});for(const p of d)if(!p.identifier)for(const g of p.dbAttrs)!g.autoIncrement&&mt(g.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`채번(${g.autoIncrement?"auto increment":`시퀀스 "${g.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${p.name}"에 설정되어 있습니다`});for(const p of d.filter(g=>g.naturalId&&g.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${p.name}"`});for(const p of d.filter(g=>g.naturalId&&g.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${p.name}"`});for(const p of d.filter(g=>g.naturalId&&!g.notNull&&!g.identifier&&!g.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${p.name}"`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const p of xa(d,g=>g.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${p.name}"`});for(const p of d)mt(p.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(p=>p.dbAttrs).filter(p=>p.sharedColumnRef==null),f=d.flatMap(p=>p.dbAttrs.map((g,b)=>({col:g,name:Bf(p,g,b,e,t)})).filter(g=>g.col.sharedColumnRef==null));for(const p of xa(f,g=>g.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:p.col.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${p.name}"`});for(const p of u){const g=Ko(p.physicalName);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!mt(p.physicalName)&&t.reservedWords.has(p.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${p.physicalName}"`}),t!=null&&t.selectableDataTypes&&!mt(p.dataType)&&!t.selectableDataTypes.has(p.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${p.dataType}"`}),!mt(p.dataType)&&Rf.has(p.dataType)&&!p.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`${p.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const p=qn(Na(c,e.entities));for(const g of d){if(g.attrType!=="EMBED_PREDEF")continue;const b=t.embeddableCatalog.find(_=>_.type===g.type);b&&g.dbAttrs.forEach((_,V)=>{if(_.sharedColumnRef==null)return;const y=b.fields[V],v=p.get(_.sharedColumnRef);if(!y||!v)return;(v.dataType!==y.dataType||(v.length??null)!==(y.length??null)||(v.scale??null)!==(y.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${hr(v)})이 ${y.name??"컬럼"} 정의(${hr(y)})와 다릅니다`})})}}for(const p of d){const g=p.dbAttrs[0];if(!(g!=null&&g.multiValue))continue;p.type===Kn&&g.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${p.type||"타입 미지정"} / ${g.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const h=(s=c.table)==null?void 0:s.physicalName,m=Ko(h);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!mt(h)&&t.reservedWords.has(h.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${h}"`});for(const p of c.indexes??[]){const g=Ko(p.name);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!mt(p.name)&&t.reservedWords.has(p.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${p.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){Xn(c.end1.multiplicity)&&Xn(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const d of["end1","end2"]){const u=c[d].jpa;if(!u)continue;const f=u.cascadeTypes??[],h=f.includes("ALL"),m=f.includes("REMOVE");h&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||h)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${h?"ALL":"REMOVE"}와 의미가 겹칩니다`}),Xn(c[d].multiplicity)&&u.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),u.orphanRemoval&&Xn(c[d==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!Xn(c[d].multiplicity)&&(u.collectionType||u.collectionTable||u.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),u.collectionType==="SET"&&u.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of Mf(e)){const d=[...c,c[0]].map(u=>a.get(u)??u).join(" → ");for(const u of c)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:u,message:`식별 관계 사이클입니다 (PK 무한 의존): ${d}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const c=new Set;for(const u of e.associations)c.add(u.end1.entityRef),c.add(u.end2.entityRef);const d=new Map(e.entities.map(u=>[u.name,u.modelId]));for(const u of e.entities){for(const f of u.attributes)f.embedded&&(c.add(u.modelId),c.add(f.embedded.embeddableRef));if(!mt(u.superClass)){c.add(u.modelId);const f=d.get(u.superClass);f&&c.add(f)}}for(const u of e.entities)c.has(u.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function Oe(){return crypto.randomUUID()}const Df="CustomMoneyType",Of="Money";function Lf(e){return!(e.type!==Df||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Pf(e){const t=e.dbAttrs[0]??{modelId:Oe(),physicalName:"",dataType:""},o={modelId:Oe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Of,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function zf(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>Lf(r)?(a=!0,t=!0,Pf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function Ia(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function En(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,i)=>En(o,t[i]));if(typeof e=="object"&&typeof t=="object"){const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o)if(!En(e[i],t[i]))return!1;return!0}return!1}function Zt(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const l of a)o.has(l)||En(e[l],t[l])||(i[l]=t[l]===void 0?null:t[l]);return Object.keys(i).length?i:null}function Jt(e,t,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(t.map(d=>[o(d),d])),l=[],r=[],s=[];for(const[d,u]of a){const f=i.get(d);f?s.push({cur:f,tgt:u}):l.push(u)}for(const[d,u]of i)a.has(d)||r.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return l.sort(c),r.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:l,removed:r,common:s}}function Uf(e,t){const o=new Set(e),i=new Set(t),a=t.filter(r=>!o.has(r)).sort(),l=e.filter(r=>!i.has(r)).sort();return{added:a,removed:l}}const Hf=new Set(["attributes","operations","indexes","rev"]),Ff=new Set(["end1","end2","rev"]),Gf=new Set(["memberEntityRefs","rev"]),gr=new Set(["modelId"]),Yf=new Set(["modelId","columns"]),Wf=new Set([]);function Kf(e,t,o,i){const a=Jt(t.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=Zt(s,c,gr);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=Jt(t.operations??[],o.operations??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of l.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){const d=Zt(s,c,gr);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=Jt(t.indexes??[],o.indexes??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of r.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){if(!En(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=Zt(s,c,Yf);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function qf(e,t,o){const i=Jt(e.entities??[],t.entities??[],r=>r.modelId);for(const r of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:r.modelId});for(const r of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:r.modelId,value:Ia(r)});for(const{cur:r,tgt:s}of i.common){const c=Zt(r,s,Hf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),Kf(r.modelId,r,s,o)}const a=Jt(e.associations??[],t.associations??[],r=>r.modelId);for(const r of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:r.modelId});for(const r of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:r.modelId,value:Ia(r)});for(const{cur:r,tgt:s}of a.common){const c=Zt(r,s,Ff);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Zt(r[d]??{},s[d]??{},Wf);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=Jt(e.groups??[],t.groups??[],r=>r.modelId);for(const r of l.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:r.modelId});for(const r of l.added)o.push({kind:"group.add",casUnit:"logical",groupRef:r.modelId,value:Ia(r)});for(const{cur:r,tgt:s}of l.common){const c=Zt(r,s,Gf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=Uf(r.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u})}}function qo(e,t,o,i,a,l,r){const s=Jt(e,t,o);for(const c of s.removed)r.push({kind:a,casUnit:"layout",[l]:o(c),value:void 0});for(const c of s.added)r.push({kind:i,casUnit:"layout",[l]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)En(c,d)||(r.push({kind:a,casUnit:"layout",[l]:o(c),value:void 0}),r.push({kind:i,casUnit:"layout",[l]:o(d),value:d}))}function Xf(e,t,o){qo(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),qo(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),qo(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),qo(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function jf(e,t){const o=[];return qf(e.logical,t.logical,o),Xf(e.layout,t.layout,o),o}function Zf(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const Jf={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class Qf{constructor(t){We(this,"out",[]);We(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...jn(t),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(t,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...jn(t),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...jn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...jn(t),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(t,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...jn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function jn(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function kt(e,t,o,i){if(o==null||typeof o!="object")return;const a=Jf[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function Qt(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function Sa(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Ut(e,t){var l,r,s,c,d,u,f,h;const o=Zf(t),i=new Qf(t.field),a=[...e].sort((m,p)=>m.seq-p.seq);for(const m of a)for(const p of m.ops)switch(o){case"entity":if(p.entityRef!==t.entityRef)break;p.kind==="entity.add"?kt(i,m,p.value,"entity"):p.kind==="entity.update"?Qt(i,m,p.patch):p.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const g=Sa((l=p.value)==null?void 0:l.attributes,t.attributeRef);g&&kt(i,m,g,"attribute")}else p.kind==="attribute.add"&&((r=p.value)==null?void 0:r.modelId)===t.attributeRef?kt(i,m,p.value,"attribute"):p.kind==="attribute.update"&&p.attributeRef===t.attributeRef?Qt(i,m,p.patch):(p.kind==="attribute.remove"&&p.attributeRef===t.attributeRef||p.kind==="entity.remove")&&i.remove(m);break;case"operation":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const g=Sa((s=p.value)==null?void 0:s.operations,t.operationRef);g&&kt(i,m,g,"operation")}else p.kind==="operation.add"&&((c=p.value)==null?void 0:c.modelId)===t.operationRef?kt(i,m,p.value,"operation"):p.kind==="operation.update"&&p.operationRef===t.operationRef?Qt(i,m,p.patch):(p.kind==="operation.remove"&&p.operationRef===t.operationRef||p.kind==="entity.remove")&&i.remove(m);break;case"index":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const g=Sa((d=p.value)==null?void 0:d.indexes,t.indexRef);g&&kt(i,m,g,"index")}else p.kind==="index.add"&&((u=p.value)==null?void 0:u.modelId)===t.indexRef?kt(i,m,p.value,"index"):p.kind==="index.update"&&p.indexRef===t.indexRef?Qt(i,m,p.patch):(p.kind==="index.remove"&&p.indexRef===t.indexRef||p.kind==="entity.remove")&&i.remove(m);break;case"association":if(p.associationRef!==t.associationRef)break;p.kind==="association.add"?kt(i,m,p.value,"association"):p.kind==="association.update"?Qt(i,m,p.patch):p.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(p.associationRef!==t.associationRef)break;if(p.kind==="association.add"){const g=(f=p.value)==null?void 0:f[t.end];kt(i,m,g,"associationEnd")}else p.kind==="associationEnd.update"&&p.end===t.end?Qt(i,m,p.patch):p.kind==="association.remove"&&i.remove(m);break;case"group":if(p.groupRef!==t.groupRef)break;if(p.kind==="group.add"){kt(i,m,p.value,"group");const g=(h=p.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(g))for(const b of g)i.member(m,b,!1)}else p.kind==="group.update"?Qt(i,m,p.patch):p.kind==="group.remove"?i.remove(m):p.kind==="group.addMember"&&p.entityRef!=null?i.member(m,p.entityRef,!1):p.kind==="group.removeMember"&&p.entityRef!=null&&i.member(m,p.entityRef,!0);break}return i.result()}function em(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function vn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function tm(e,t){const o=new Set,i=new Set,a=new Set;for(const l of e)for(const r of l.ops){const s=r;if(r.kind==="entity.add"&&s.entityRef===t){const c=s.value;vn(c==null?void 0:c.attributes,o),vn(c==null?void 0:c.operations,i),vn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?vn([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?vn([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?vn([s.value],a):(r.kind==="index.update"||r.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function Xo(e,t){return e.map(o=>({...o,subject:t}))}function br(e,t){const o=e.filter(s=>s.ops.some(c=>em(c,t))),{attributes:i,operations:a,indexes:l}=tm(o,t),r=[...Xo(Ut(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...Xo(Ut(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...Xo(Ut(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...Xo(Ut(o,{entityRef:t,indexRef:s}),{kind:"index",ref:s}));return r.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function _r(e){return`${e.kind}:${e.ref}:${e.end??""}`}function nm(e){var i,a,l;const t=new Set,o=(r,s)=>{typeof s=="string"&&t.add(`${r}:${s}:`)};for(const r of e)for(const s of r.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const u of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",u.modelId);for(const u of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(l=c.value)==null?void 0:l.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return t}function om(e){const t=new Set,o=new Set,i=new Set;for(const a of e)for(const l of a.ops){const r=l,s=l.kind;if(s.startsWith("entity."))typeof r.entityRef=="string"&&t.add(r.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=r.containerRef??r.entityRef;typeof c=="string"&&t.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof r.associationRef=="string"&&o.add(r.associationRef):s.startsWith("group.")&&typeof r.groupRef=="string"&&i.add(r.groupRef)}return{entities:t,associations:o,groups:i}}function im(e){const{entities:t,associations:o,groups:i}=om(e),a=[];for(const l of t)for(const r of br(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Ut(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Ut(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Ut(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function kr(e){const t=im(e),o=nm(e),i=new Map;for(const r of t){const s=_r(r.subject),c=i.get(s);(c===void 0||r.seq<c)&&i.set(s,r.seq)}const a=new Map;for(const r of t){let s=a.get(r.seq);s||(s={meta:r,subjects:new Map},a.set(r.seq,s));const c=_r(r.subject);let d=s.subjects.get(c);if(!d){const u=r.removed?"remove":i.get(c)===r.seq&&o.has(c)?"add":"update";d={subject:r.subject,verb:u,fields:[]},s.subjects.set(c,d)}r.removed?d.verb="remove":d.fields.push({field:r.field,value:r.value,...r.oldValue!==void 0?{oldValue:r.oldValue}:{}})}const l=[];for(const[r,s]of a){const c=s.meta;l.push({seq:r,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return l.sort((r,s)=>s.seq-r.seq)}class Ca{constructor(t){We(this,"undoStack",[]);We(this,"redoStack",[]);We(this,"savePoint",null);We(this,"listeners",new Set);We(this,"commandListeners",new Set);We(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const a of this.commandListeners)a(t,o,i)}}function wr(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Je(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function pt(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Fe(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function Rt(e,t,o){var i,a;return(a=(i=e.layout.notes.find(l=>l.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(l=>l.targetRef===o)}function Ra(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=wr(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=Je(o,e.modelId);a>=0&&o.layout.entityLayouts.splice(a,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Er(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=wr(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=Je(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,f)=>{s.has(u.associationRef)&&c.push({item:u,index:f})});const d=[];i.logical.groups.forEach(u=>{const f=u.memberEntityRefs.indexOf(e);f>=0&&d.push({groupId:u.modelId,index:f})}),t={entity:{item:i.logical.entities[a],index:a},entityLayout:l>=0?{item:i.layout.entityLayouts[l],index:l}:void 0,assocs:r,assocLayouts:c,groupMemberships:d},[...c].sort((u,f)=>f.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...r].sort((u,f)=>f.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const f=i.logical.groups.find(h=>h.modelId===u.groupId);f==null||f.memberEntityRefs.splice(u.index,1)}l>=0&&i.layout.entityLayouts.splice(l,1),i.logical.entities.splice(a,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((a,l)=>a.index-l.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...t.assocLayouts].sort((a,l)=>a.index-l.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of t.groupMemberships){const l=i.logical.groups.find(r=>r.modelId===a.groupId);l==null||l.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],a=[];for(const l of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:l.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:l.item.modelId,value:l.item});for(const l of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:l.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:l.item.associationRef,value:l.item,incidental:!0});for(const l of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.groupId,groupRef:l.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:l.groupId,groupRef:l.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:a.reverse()}}}}function vr(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Fe(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(Fe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function Nr(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Fe(i,e);o=a.name,a.name=t},invert(i){Fe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function Nn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a].geo;o={...l.location},l.location={...t}},invert(i){const a=Je(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function $r(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a].geo;o={...l.size},l.size={...t}},invert(i){const a=Je(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Zn(e,t){const o={...(e==null?void 0:e.properties)??{}};return t?o.swatch=t:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function xr(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.style,l.style=Zn(l.style,t)},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Je(i,e),l=a>=0?i.layout.entityLayouts[a].style:void 0,r=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[r(l)],invert:[r(o)]}}}}function Ir(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.collapsed,l.collapsed=t},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Sr(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.locked,l.locked=t},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Va(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=t[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((l,r)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:l.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:l.entityRef,value:{collapsed:t[r]}})}),{forward:i,invert:a}}}}function jo(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=Je(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.attributeStyles;const s={...r.attributeStyles},c=Zn(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const l=Je(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=Je(a,e),r=l>=0?a.layout.entityLayouts[l].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function Aa(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);a>=0&&o.layout.groupLayouts.splice(a,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Cr(e,t){const o={},i=a=>{const l=a.logical.groups.find(r=>r.modelId===e);if(!l)throw new Error(`그룹 없음: ${e}`);return l};return{label:"그룹 수정",apply(a){const l=i(a);for(const r of Object.keys(t))o[r]=l[r];Object.assign(l,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Rr(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e);t={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function Vr(e,t){let o=!1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에 편입",apply(a){const l=i(a);l&&!l.memberEntityRefs.includes(t)&&(l.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const l=i(a),r=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1;r>=0&&l.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function Zo(e,t){let o=-1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에서 제외",apply(a){const l=i(a);o=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1,o>=0&&l.memberEntityRefs.splice(o,1)},invert(a){var l;o<0||(l=i(a))==null||l.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function Ar(e,t){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Tr(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Mr(e,t){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Zn(a.style,t)},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e),l=r=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:r}});return{forward:[l(a==null?void 0:a.style)],invert:[l(o)]}}}}function Br(e,t){let o;return{label:t?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=t},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Vt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Fe(o,e).attributes.push(t)},invert(o){const i=Fe(o,e),a=i.attributes.findIndex(l=>l.modelId===t.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function en(e,t,o){const i={},a=l=>{const r=Fe(l,e).attributes.find(s=>s.modelId===t);if(!r)throw new Error(`속성 없음: ${t}`);return r};return{label:"속성 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function $n(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Fe(i,e),l=a.attributes.findIndex(r=>r.modelId===t);if(l<0)throw new Error(`속성 없음: ${t}`);o={item:a.attributes[l],index:l},a.attributes.splice(l,1)},invert(i){o&&Fe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Ta(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=Fe(a,e);i=l.attributes.map(f=>({...f}));const r=new Set(t),s=l.attributes.filter(f=>r.has(f.modelId)),c=l.attributes.filter(f=>!r.has(f.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];l.attributes.splice(0,l.attributes.length,...u),l.attributes.forEach((f,h)=>f.order=h)},invert(a){i&&Fe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=Fe(a,e).attributes.map(r=>({...r}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:l}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Dr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Fe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=Fe(i,e),l=((r=a.operations)==null?void 0:r.findIndex(s=>s.modelId===t.modelId))??-1;l>=0&&a.operations.splice(l,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function Or(e,t,o){const i={},a=l=>{var s;const r=(s=Fe(l,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`메서드 없음: ${t}`);return r};return{label:"메서드 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function Lr(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Fe(i,e),l=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(l<0)throw new Error(`메서드 없음: ${t}`);const r=a.operations.length===1;o={item:a.operations[l],index:l,wasSole:r},a.operations.splice(l,1),r&&(a.operations=void 0)},invert(i){if(!o)return;const a=Fe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Pr(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=Fe(a,e),r=l.operations??[];i=r.map(h=>({...h}));const s=new Set(t),c=r.filter(h=>s.has(h.modelId)),d=r.filter(h=>!s.has(h.modelId)),u=Math.max(0,Math.min(o,d.length)),f=[...d.slice(0,u),...c,...d.slice(u)];r.splice(0,r.length,...f),r.forEach((h,m)=>h.order=m),l.operations=r},invert(a){if(!i)return;const l=Fe(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(Fe(a,e).operations??[]).map(r=>({...r}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:l}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function zr(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=Je(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.operationStyles;const s={...r.operationStyles},c=Zn(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(a){const l=Je(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=Je(a,e),r=l>=0?a.layout.entityLayouts[l].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function Ma(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(l=>l.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:t,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function Ur(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(l=>l.associationRef===e);t={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Jo(e,t){const o={},i=a=>{const l=a.logical.associations.find(r=>r.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l};return{label:"관계 수정",apply(a){const l=i(a);for(const r of Object.keys(t))o[r]=l[r];Object.assign(l,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function xn(e,t,o){const i={},a=l=>{const r=l.logical.associations.find(s=>s.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r[t]};return{label:"관계 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function Hr(e,t){return{label:"인덱스 추가",apply(o){const i=Fe(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=Fe(o,e),a=((l=i.indexes)==null?void 0:l.findIndex(r=>r.modelId===t.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function Fr(e,t,o){const i={},a=l=>{var s;const r=(s=Fe(l,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`인덱스 없음: ${t}`);return r};return{label:"인덱스 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function Gr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=Fe(i,e),l=((r=a.indexes)==null?void 0:r.findIndex(s=>s.modelId===t))??-1;if(l<0)throw new Error(`인덱스 없음: ${t}`);o={item:a.indexes[l],index:l},a.indexes.splice(l,1)},invert(i){o&&Fe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const wt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Jn=(e,t)=>{var o;return((o=pt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Yr(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=pt(a,e);if(!l||!l.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...l.waypoints[t]},l.waypoints.splice(t,1,{...o})},invert(a){const l=pt(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=Jn(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[wt(e,l)],invert:[wt(e,r)]}}}}function Wr(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=pt(i,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...a.waypoints[t]},a.waypoints.splice(t,1)},invert(i){const a=pt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=Jn(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function Kr(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=pt(a,e);if(!l)throw new Error(`관계 레이아웃 없음: ${e}`);i=l.waypoints.map(r=>({...r})),l.waypoints=i.map(r=>({x:r.x+t,y:r.y+o}))},invert(a){const l=pt(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[wt(e,Jn(a,e))],invert:[wt(e,i??[])]}}}}function qr(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=pt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=pt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[wt(e,Jn(o,e))],invert:[wt(e,t??[])]}}}}function Xr(e,t,o){return{label:"waypoint 추가",apply(i){const a=pt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=pt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=Jn(i,e),l=a.slice();return l.splice(t,1),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function jr(e){return{label:"노트 추가",apply(t){t.layout.notes.push(e)},invert(t){const o=t.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&t.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function Zr(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Qn(e,t){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Jr(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Qr(e,t){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=t},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(t)],invert:[i(o)]}}}}function es(e,t){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Zn(a.style,t)},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(r=>r.modelId===e),l=r=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:r}});return{forward:[l(a==null?void 0:a.style)],invert:[l(o)]}}}}function ts(e,t){let o=!1,i=!1;const a=l=>l.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에 노트 편입",apply(l){const r=a(l);r&&(r.memberNoteRefs||(r.memberNoteRefs=[],i=!0),!r.memberNoteRefs.includes(t)&&(r.memberNoteRefs.push(t),o=!0))},invert(l){if(!o)return;const r=a(l);if(!(r!=null&&r.memberNoteRefs))return;const s=r.memberNoteRefs.indexOf(t);s>=0&&r.memberNoteRefs.splice(s,1),i&&delete r.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function ns(e,t){let o=-1;const i=a=>a.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var r;const l=i(a);o=((r=l==null?void 0:l.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&l.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const l=i(a);l&&(l.memberNoteRefs||(l.memberNoteRefs=[]),l.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const Ht=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Qo=(e,t,o)=>{var i;return((i=Rt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function os(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const l=a.layout.notes.find(r=>r.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);if(l.connections||(l.connections=[],i=!0),l.connections.some(r=>r.targetRef===t)){o=!1;return}l.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(a){if(!o)return;const l=a.layout.notes.find(s=>s.modelId===e);if(!(l!=null&&l.connections))return;const r=l.connections.findIndex(s=>s.targetRef===t);r>=0&&l.connections.splice(r,1),i&&delete l.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function is(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var r;const a=i.layout.notes.find(s=>s.modelId===e),l=((r=a==null?void 0:a.connections)==null?void 0:r.findIndex(s=>s.targetRef===t))??-1;if(!(a!=null&&a.connections)||l<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:a.connections[l],index:l},a.connections.splice(l,1)},invert(i){if(!o)return;const a=i.layout.notes.find(l=>l.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function as(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=Rt(l,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(l){const r=Rt(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Qo(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Ht(e,t,r)],invert:[Ht(e,t,s)]}}}}function ls(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=Rt(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=Rt(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Qo(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function rs(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=Rt(a,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...l.waypoints[o]},l.waypoints.splice(o,1)},invert(a){const l=Rt(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Qo(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function ss(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Rt(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=Rt(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Ht(e,t,Qo(i,e,t))],invert:[Ht(e,t,o??[])]}}}}function Ge(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const a of t)a.apply(i)},invert(i){for(let a=t.length-1;a>=0;a--)t[a].invert(i)},emitOps(i){const a=t.map(l=>{if(!l.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${l.label}`);return l.emitOps(i)});return{forward:a.flatMap(l=>l.forward),invert:a.slice().reverse().flatMap(l=>l.invert)}}}}const am=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ma,addAttribute:Vt,addEntity:Ra,addEntityToGroup:Vr,addGroup:Aa,addIndex:Hr,addNote:jr,addNoteConnection:os,addNoteConnectionWaypoint:ls,addNoteToGroup:ts,addOperation:Dr,addWaypoint:Xr,clearNoteConnectionWaypoints:ss,clearWaypoints:qr,composite:Ge,moveEntity:Nn,moveGroup:Ar,moveNote:Qn,moveNoteConnectionWaypoint:as,moveWaypoint:Yr,removeAssociation:Ur,removeAttribute:$n,removeEntity:Er,removeEntityFromGroup:Zo,removeGroup:Rr,removeIndex:Gr,removeNote:Zr,removeNoteConnection:is,removeNoteConnectionWaypoint:rs,removeNoteFromGroup:ns,removeOperation:Lr,removeWaypoint:Wr,renameEntity:Nr,reorderAttributes:Ta,reorderOperations:Pr,resizeEntity:$r,resizeGroup:Tr,resizeNote:Jr,setAllEntitiesCollapsed:Va,setAttributeSwatch:jo,setEntityCollapsed:Ir,setEntityLocked:Sr,setEntitySwatch:xr,setGroupLocked:Br,setGroupSwatch:Mr,setNoteMemo:Qr,setNoteSwatch:es,setOperationSwatch:zr,translateWaypoints:Kr,updateAssociation:Jo,updateAssociationEnd:xn,updateAttribute:en,updateEntity:vr,updateGroup:Cr,updateIndex:Fr,updateOperation:Or},Symbol.toStringTag,{value:"Module"}));class cs{constructor(){We(this,"revs",new Map);We(this,"layoutVersion",0);We(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class ds{constructor(t){We(this,"cache",new cs);We(this,"newClientOpId");We(this,"debounceMs");We(this,"emissions",new WeakMap);We(this,"open",null);We(this,"debounceHandle",null);We(this,"queue",[]);We(this,"sending",!1);We(this,"_frozen",!1);We(this,"stack",null);We(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Oe,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,a,l)=>this.handle(i,a,l));return()=>{o(),this.stack===t&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var r;if(this._frozen)return;let a;if(o==="do"){const s=(r=t.emitOps)==null?void 0:r.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);a=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);a=s}const l=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=l,this.emissions.set(t,{forward:l,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,a),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:l,inv:a.invert},this.startDebounce();return}l.length&&this.enqueue(this.buildBatch(l))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(t){const o={},i=new Set;let a=!1,l=!1;for(const r of t)if(r.casUnit==="logical")if(a=!0,r.containerRef)i.add(r.containerRef);else{const s=r.entityRef??r.associationRef??r.groupRef;s&&(r.kind.endsWith(".add")?this.cache.setRev(s,0):r.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else r.incidental||(l=!0);if(i.size){o.revs={};for(const r of i){const s=this.cache.rev(r);o.revs[r]=s,this.cache.setRev(r,s+1)}}return l&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(l){this.sending=!1,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",l),(a=(i=this.opts).onError)==null||a.call(i,l),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const us=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","group.add"],fs=()=>crypto.randomUUID(),lm=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,rm=e=>e&&e[0].toLowerCase()+e.slice(1),sm=e=>e&&e[0].toUpperCase()+e.slice(1),cm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function dm(e,t){return rm(e)+sm(t)}function um(e,t){const o=e.entities.find(r=>r.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(r=>r.identifier&&(r.attrType==="NORMAL"||r.attrType==="RELATION_OWN")).sort((r,s)=>r.order-s.order).map(r=>{const s=dm(o.name,r.name);return{associationRef:t.modelId,sourceAttributeRef:r.modelId,name:s,type:r.type,identifier:a,notNull:a,dbAttrs:r.dbAttrs.map(c=>({physicalName:cm(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const ei=(e,t)=>`${e}::${t}`,ti=e=>e??void 0;function fm(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((l,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==l.dataType||ti(s.length)!==ti(l.length)||ti(s.scale)!==ti(l.scale)}))&&(i.dbAttrs=t.dbAttrs.map((l,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??l.physicalName,logicalName:(s==null?void 0:s.logicalName)??l.logicalName,dataType:l.dataType,length:l.length,scale:l.scale}})),Object.keys(i).length?i:null}function mm(e,t,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:t,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function eo(e,t,o=fs){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===t);if(!a)return i;const l=e.associations.filter(f=>f.end2.entityRef===t),r=a.stereotype==="JPA_EMBEDDABLE"?[]:l.flatMap(f=>um(e,f)),s=new Map(r.map(f=>[ei(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ei(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=ei(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}let u=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of r){const h=ei(f.associationRef,f.sourceAttributeRef),m=d.get(h);if(!m)i.add.push(mm(f,u++,o));else{const p=fm(m,f,o);p&&i.update.push({attributeId:m.modelId,patch:p})}}return i}function pm(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function hm(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function ym(e,t,o=fs){const i=new Map,a=hm(e),l=new Set,r=[t];for(;r.length;){const s=r.shift();if(l.has(s))continue;l.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=eo(a,d,o);if(lm(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(h=>h.modelId===d);f&&pm(f,u),l.has(d)||r.push(d)}}return i}function ni(e,t,o){var r;const i=e.entities.find(s=>s.modelId===t),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)return;const l=(r=a.derivedFrom)==null?void 0:r.associationRef;if(l){const s=e.associations.find(c=>c.modelId===l);if(s)return s}return e.associations.find(s=>s.end1.entityRef===t&&s.end1.attributeRef===o||s.end2.entityRef===t&&s.end2.attributeRef===o)}function gm(e,t){const o=()=>e.entities.filter(l=>{var r;return((r=l.table)==null?void 0:r.physicalName)===t.ref}),i=()=>e.entities.filter(l=>l.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function bm(e,t){const o=()=>e.attributes.filter(l=>l.name===t.ref),i=()=>e.attributes.filter(l=>l.dbAttrs.some(r=>r.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const a=o();return a.length?a:i()}function ms(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function lt(e,t){const o=gm(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function _m(e,t){const o=bm(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function km(e,t){const o=()=>e.attributes.flatMap(l=>l.dbAttrs).filter(l=>l.physicalName===t.ref),i=()=>e.attributes.filter(l=>l.name===t.ref).flatMap(l=>l.dbAttrs);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function ps(e,t){const o=km(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function wm(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function Em(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function vm(e,t){const o=wm(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Nm(e,t){const o=Em(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function hs(e,t,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:t,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function ys(e,t,o,i,a,l,r,s){const c=s(),d=new Map((e.embeddableOverrides??[]).map(h=>[h.field,h])),u=[];let f=!1;for(const h of t.fields){const m=d.get(h.name);if(m!=null&&m.sharedColumnPhysicalName){const p={ref:m.sharedColumnPhysicalName,by:"physicalName"},g=ps(i,p);if(!g.ok){r.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:a,entity:l,handle:p}:{code:"shared-column-target-ambiguous",opIndex:a,entity:l,handle:p,matches:g.matches}),f=!0;continue}u.push({modelId:s(),physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});continue}u.push({modelId:s(),physicalName:(m==null?void 0:m.physicalName)??"",dataType:"",...m!=null&&m.length?{length:m.length}:{},...m!=null&&m.scale?{scale:m.scale}:{},...(m==null?void 0:m.insertable)!=null?{insertable:m.insertable}:{},...(m==null?void 0:m.updatable)!=null?{updatable:m.updatable}:{}})}return f?null:{modelId:c,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:u}}function gs(e,t,o){return{modelId:o(),name:e.name,order:t,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function bs(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=ps(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}r.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:l(),name:t.name,unique:t.unique??!1,columns:r,...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{}}}function $m(e,t,o={}){const i=o.mkId??Oe,a=o.embeddableCatalog??[],l=f=>a.find(h=>h.type===f),r=[],s=[],c=new Map,d=new Map,u=new Set;for(const f of t)f.kind==="entity.add"&&(u.add(f.spec.name),f.spec.physicalName&&u.add(f.spec.physicalName));return t.forEach((f,h)=>{var m,p,g;switch(f.kind){case"entity.add":{const b=i(),_={modelId:b,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},V={ref:f.spec.name};let y=!1;for(const[x,O]of(f.spec.attributes??[]).entries()){if(O.type==="GroupCodeEnum"&&!O.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:V,handle:{ref:O.name}}),y=!0;continue}const P=l(O.type);if(P){const H=ys(O,P,x,_,h,V,s,i);H?_.attributes.push(H):y=!0}else(m=O.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:h,entity:V,handle:{ref:O.name}}),y=!0):_.attributes.push(hs(O,x,i))}const v=(f.spec.operations??[]).map((x,O)=>gs(x,O,i));v.length&&(_.operations=v);const ee=[];for(const x of f.spec.indexes??[]){const O=bs(_,x,h,V,s,i);O?ee.push(O):y=!0}if(ee.length&&(_.indexes=ee),y)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:_});break}case"entity.update":{const b=lt(e,f.entity);if(!b.ok){s.push(rt(b.reason,h,f.entity,b.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:f.patch});break}case"entity.remove":{const b=lt(e,f.entity);if(!b.ok){s.push(rt(b.reason,h,f.entity,b.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=lt(e,f.entity);if(!b.ok){s.push(rt(b.reason,h,f.entity,b.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}const _=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,_+1);const V=l(f.spec.type);let y;if(V)y=ys(f.spec,V,_,b.value,h,f.entity,s,i);else if((p=f.spec.embeddableOverrides)!=null&&p.length){s.push({code:"embeddable-type-unresolved",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}else y=hs(f.spec,_,i);if(!y)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:y});break}case"attribute.update":case"attribute.remove":{const b=lt(e,f.entity);if(!b.ok){s.push(rt(b.reason,h,f.entity,b.matches,u));break}const _=_m(b.value,f.attribute);if(!_.ok){s.push(_.reason==="not-found"?{code:"attribute-not-found",opIndex:h,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:h,entity:f.entity,handle:f.attribute,matches:_.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:_.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:_.value.modelId});break}case"association.add":{const b=lt(e,f.spec.from),_=lt(e,f.spec.to);if(b.ok||s.push(rt(b.reason,h,f.spec.from,b.matches,u)),_.ok||s.push(rt(_.reason,h,f.spec.to,_.matches,u)),!b.ok||!_.ok)break;if(f.spec.identifying&&b.value.modelId===_.value.modelId){s.push({code:"self-identifying",opIndex:h,handle:{from:f.spec.from,to:f.spec.to}});break}const V=i(),y={modelId:V,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:_.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},v={...e,associations:[...e.associations,y]},ee=eo(v,_.value.modelId,i);ee.add[0]&&(y.end2.attributeRef=ee.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:V,value:y});for(const x of ee.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:x});break}case"association.remove":{const b=lt(e,f.association.from),_=lt(e,f.association.to);if(b.ok||s.push(rt(b.reason,h,f.association.from,b.matches,u)),_.ok||s.push(rt(_.reason,h,f.association.to,_.matches,u)),!b.ok||!_.ok)break;const V=ms(e,b.value.modelId,_.value.modelId);if(V.length!==1){s.push(V.length===0?{code:"association-not-found",opIndex:h,handle:f.association}:{code:"association-ambiguous",opIndex:h,handle:f.association,matches:V.map(y=>y.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:V[0].modelId});break}case"association.update":{const b=_s(e,f.association,h,s,u);if(!b)break;r.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:f.patch});break}case"associationEnd.update":{const b=_s(e,f.association,h,s,u);if(!b)break;const _=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:_,patch:f.patch});break}case"index.add":{const b=lt(e,f.entity);if(!b.ok){s.push(rt(b.reason,h,f.entity,b.matches,u));break}const _=bs(b.value,f.spec,h,f.entity,s,i);if(!_)break;r.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.modelId,value:_});break}case"index.update":case"index.remove":{const b=lt(e,f.entity);if(!b.ok){s.push(rt(b.reason,h,f.entity,b.matches,u));break}const _=vm(b.value,f.index);if(!_.ok){s.push(_.reason==="not-found"?{code:"index-not-found",opIndex:h,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:h,entity:f.entity,handle:f.index,matches:_.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:h,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.value.modelId});break}case"operation.add":{const b=lt(e,f.entity);if(!b.ok){s.push(rt(b.reason,h,f.entity,b.matches,u));break}const _=d.get(b.value.modelId)??((g=b.value.operations)==null?void 0:g.length)??0;d.set(b.value.modelId,_+1);const V=gs(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:V.modelId,value:V});break}case"operation.update":case"operation.remove":{const b=lt(e,f.entity);if(!b.ok){s.push(rt(b.reason,h,f.entity,b.matches,u));break}const _=Nm(b.value,f.operation);if(!_.ok){s.push(_.reason==="not-found"?{code:"operation-not-found",opIndex:h,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:h,entity:f.entity,handle:f.operation,matches:_.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:_.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:_.value.modelId});break}case"group.add":{const b=[];let _=!1;for(const v of f.spec.members){const ee=lt(e,v);if(!ee.ok){s.push(rt(ee.reason,h,v,ee.matches,u)),_=!0;continue}b.push(ee.value.modelId)}if(_)break;const V=i(),y={modelId:V,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};r.push({kind:"group.add",casUnit:"logical",groupRef:V,value:y});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function rt(e,t,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:t,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function _s(e,t,o,i,a){const l=lt(e,t.from),r=lt(e,t.to);if(l.ok||i.push(rt(l.reason,o,t.from,l.matches,a)),r.ok||i.push(rt(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=ms(e,l.value.modelId,r.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:s.map(c=>c.modelId)}),null):s[0]}const ks={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},xm={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Im={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},oi={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Sm={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...oi,description:"속성 설명(다국어)."},columnLogicalName:{...oi,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(type이 카탈로그 엔트리일 때만). field=카탈로그 필드명으로 매칭 (@AttributeOverride 대응). 미설정 서브컬럼은 카탈로그 기본 상속. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}}},required:["name","type"],additionalProperties:!1},ws={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Cm={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...ws,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...ws,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},Rm={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...ks,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},Vm={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...oi,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Am={type:"object",properties:{name:{...oi,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},Tm={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function nt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Mm={"entity.add":nt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":nt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":nt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":nt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":nt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":nt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":nt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":nt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":nt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":nt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":nt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":nt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":nt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":nt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":nt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":nt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":nt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Es={anyOf:us.map(e=>Mm[e])},Bm={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ks,assocHandle:xm,entitySpec:Im,attrSpec:Sm,assocSpec:Cm,indexSpec:Rm,operationSpec:Vm,groupSpec:Am,patch:Tm,symbolicOp:Es}};function Dm(e,t,o,i={}){const a=i.mkClientOpId??Oe,l=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&l.add(s.containerRef);const r={};if(l.size){r.revs={};for(const s of l)r.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:r,origin:i.origin??"agent",clientOpId:a()}}const vs={location:{x:0,y:0},size:{width:220,height:140}};function Ns(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Om=/^[-=_*~\s]{3,}$/;function Lm(e){return e.attrType&&e.attrType!=="NORMAL"||!Om.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Pm(e){return e.type===Ct&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function zm(e,t){if(e.attrType==="DIVIDER"||Lm(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]};const o=Pm(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(Ns)}}function Um(e){const{modelId:t,name:o,visibility:i,sourceCode:a,description:l,order:r,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:a,description:l?{ko:l}:void 0,order:r??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Hm(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(t=>({columnRef:t.targetColumn.refId,descending:t.descending}))}}function Fm(e){var t,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(zm),operations:(t=e.operations)==null?void 0:t.map(Um),indexes:(o=e.indexes)==null?void 0:o.map(Hm),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Gm(e){const t={};for(const i of e.attributes)i.style&&(t[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...vs},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function $s(e){return e.jpaAttribute?{fetchType:e.jpaAttribute.fetchType,cascadeTypes:e.jpaAttribute.cascadeTypes,orphanRemoval:e.jpaAttribute.orphanRemoval,orderBy:e.jpaAttribute.orderBy,collectionType:e.jpaAttribute.collectionType,collectionTable:e.jpaAttribute.collectionTable,orderColumn:e.jpaAttribute.orderColumn}:void 0}function Ba(e){var t;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(t=e.attribute)==null?void 0:t.modelId,jpa:$s(e)}}function Ym(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Ba(e.end1),end2:Ba(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:t,layout:o}}function xs(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Is(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Ss(e){var o;const t=e.attribute;return(t==null?void 0:t.attrType)==="EMBED_OWN"&&(((o=t.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function Cs(e,t){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(Ns)}}function Wm(e,t,o){var b,_;const i=xs(e.end1.attribute),a=xs(e.end2.attribute);if(i===a)return Ym(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(_=(b=s.dbAttrs)==null?void 0:b[0])==null?void 0:_.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((V,y)=>Math.max(V,y.order),-1)+1:s.order??0,h={...Cs(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const m=(V,y)=>({entityRef:V.endModel.refId,multiplicity:V.multiplicity,navigable:V.navigable,composition:V.composition,attributeRef:y?d:h.modelId,legacyNavRaw:y?void 0:V.attribute,jpa:$s(V)}),p={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p.end1.attributeRef,targetColumnRef:p.end2.attributeRef,style:e.style};return{assoc:p,layout:g}}function Km(e,t){const o=e.targetModelId?t.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function qm(e,t,o){var p;const i=((p=e.end1.attribute)==null?void 0:p.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,l=i?e.end2:e.end1,r=a.attribute,s=t.get(l.endModel.refId),c=s?s.attributes.reduce((g,b)=>Math.max(g,b.order),-1)+1:r.order??0,d={...Cs(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(g=>Km(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...Ba(g),legacyEmbedRaw:g.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:f,layout:m}}function Xm(e,t){var i,a,l,r;const o=[];for(const s of t){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(r=(l=s.end2)==null?void 0:l.endModel)==null?void 0:r.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Rs(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:l,connections:r,ownedConnections:s,...c}=e;let d=r;if(!d&&Array.isArray(s)){const u=Xm(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+t.x,y:a.location.y+t.y},size:a.size},style:l,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Vs(e,t,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(r=>[r.modelId,r])),a=new Map(t.map(r=>[r.modelId,r])),l=(r,s)=>{var c;return!!s&&!!((c=i.get(r??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const r of o){const s=a.get(r.associationRef);s&&(r.sourceColumnRef&&!l(s.end1.entityRef,r.sourceColumnRef)&&(r.sourceColumnRef=void 0),r.targetColumnRef&&!l(s.end2.entityRef,r.targetColumnRef)&&(r.targetColumnRef=void 0))}}function As(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function jm(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(As);if(!i.length)continue;const a=o.filter(s=>!As(s));let l=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(l=c+1)});const r=[...a.slice(0,l),...i,...a.slice(l)];r.forEach((s,c)=>s.order=c),t.attributes=r}}function Zm(e){return(e.schemaVersion??1)>=2&&"logical"in e?Jm(e):Qm(e)}function Jm(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:h,...m}=f;return h!=null&&(o[f.modelId]=h),m},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout;Vs(a,l,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:l,groups:r},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Qm(e){var _,V;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(y,v)=>{o.push(Fm(y));const ee=Gm(y);ee.geo={location:{x:ee.geo.location.x+v.x,y:ee.geo.location.y+v.y},size:ee.geo.size},i.push(ee);for(const x of y.ownedAssociations??[])c.push(x)},u={x:0,y:0};for(const y of e.entities??[])d(y,u);const f=[];for(const y of e.groups??[]){const v=y.entities??[];r.push({modelId:y.modelId,name:y.name,description:y.description,packageName:y.packageName,excludeDDLGeneration:y.excludeDDLGeneration??!1,memberEntityRefs:v.map(x=>x.modelId)});const ee=((_=y.geo)==null?void 0:_.location)??u;if(y.geo){const x=(y.notes??[]).map(O=>O.modelId);s.push({groupRef:y.modelId,geo:y.geo,style:y.style,locked:y.locked,memberNoteRefs:x.length?x:void 0})}for(const x of v)d(x,ee);for(const x of y.notes??[])f.push(Rs(x,ee))}const h=new Map(o.map(y=>[y.modelId,y])),m=new Map,p=new Map;for(const y of o)for(const v of y.attributes)for(const ee of v.dbAttrs)m.set(ee.modelId,v.modelId),p.set(ee.modelId,ee);for(const y of c)for(const v of[y.end1,y.end2]){const ee=v.attribute;if(ee&&(((V=ee.dbAttrs)==null?void 0:V.length)??0)>0)for(const x of ee.dbAttrs)x.modelId&&m.set(x.modelId,ee.modelId)}for(const y of c){const v=Is(y.end1.attribute),ee=Is(y.end2.attribute),x=Ss(y.end1)||Ss(y.end2),{assoc:O,layout:P}=v!==ee||x?qm(y,h,p):Wm(y,h,m);a.push(O),l.push(P)}Vs(o,a,l),jm(o);const g={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(y=>Rs(y)),...f]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:b}}function Ts(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function ep(e,t){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(Ts),style:t}}function tp(e,t){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:t}}function np(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function Ft(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function op(e,t){const o=t==null?void 0:t.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var l;return{...Ts(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function ip(e){const t=new Set;for(const o of e.logical.associations){const i=o.end1.legacyNavRaw?o.end1:o.end2.legacyNavRaw?o.end2:void 0;i!=null&&i.attributeRef&&t.add(i.attributeRef)}return t}function ap(e){const t=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&t.add(i.modelId);return t}function lp(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function rp(e,t){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:lp(e.logicalName,t==null?void 0:t.logicalName)?void 0:e.logicalName,dataType:e.dataType===((t==null?void 0:t.dataType)??"")?"":e.dataType,length:o(e.length,t==null?void 0:t.length),scale:o(e.scale,t==null?void 0:t.scale),unique:o(e.unique,t==null?void 0:t.unique),autoIncrement:o(e.autoIncrement,t==null?void 0:t.autoIncrement),updatable:o(e.updatable,t==null?void 0:t.updatable),insertable:o(e.insertable,t==null?void 0:t.insertable)}}function sp(e,t,o){let i;for(const f of t.logical.entities){const h=f.attributes.find(m=>{var p;return((p=m.embedded)==null?void 0:p.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,l=t.logical.entities.find(f=>f.modelId===a);if(!l)return;const r=l.attributes.flatMap(f=>f.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((f,h)=>rp(f,r[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Ft(e.end1,c?s:u),end2:Ft(e.end2,c?u:s)}}function cp(e,t,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:Ft(e.end1,e.end1.legacyEmbedRaw),end2:Ft(e.end2,e.end2.legacyEmbedRaw)};const a=sp(e,t,i);if(a)return a;const l=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(l!==r){const s=l?e.end1:e.end2,c=l?e.end2:e.end1,d=t.logical.entities.find(p=>p.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(p=>p.modelId===s.attributeRef),f=t.logical.entities.find(p=>p.modelId===c.entityRef),h=u?op(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ft(e.end1,l?m:h),end2:Ft(e.end2,r?m:h)}}return{...i,end1:Ft(e.end1),end2:Ft(e.end2)}}function Ms(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(h=>h.entityRef===e.modelId),r=t.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>t.layout.associationLayouts.find(m=>m.associationRef===h),c=(l==null?void 0:l.geo)??{...vs},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var m;return ep(h,(m=l==null?void 0:l.attributeStyles)==null?void 0:m[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var m;return tp(h,(m=l==null?void 0:l.operationStyles)==null?void 0:m[h.modelId])}),ownedAssociations:r.map(h=>cp(h,t,s(h.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(np),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:l==null?void 0:l.style,collapsed:l==null?void 0:l.collapsed,locked:l==null?void 0:l.locked}}function dp(e,t,o,i){const a=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),l=e.memberEntityRefs.map(c=>t.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),r=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Bs(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>Ms(c,t,o,i,r)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function Bs(e,t={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-t.x,y:e.geo.location.y-t.y},size:e.geo.size},style:e.style,connections:e.connections}}function up(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=ip(e),l=ap(e),r=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:t.id,diagramVersion:t.diagramVersion,version:t.version,size:t.size??e.layout.canvasSize,packageName:t.packageName??e.logical.packageName,entities:i.map(s=>Ms(s,e,a,l)),groups:e.logical.groups.map(s=>dp(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>Bs(s))}}function fp(e,t={}){var a,l,r;const o=((a=t.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((l=t.revSeed)==null?void 0:l.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((r=t.revSeed)==null?void 0:r.layoutVersion)??0}}}function to(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function At(e){return typeof e=="function"?e():n.unref(e)}const mp=typeof window<"u"&&typeof document<"u",pp=e=>typeof e<"u",hp=Object.prototype.toString,yp=e=>hp.call(e)==="[object Object]",gp=()=>{};function bp(e,t){function o(...i){return new Promise((a,l)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(a).catch(l)})}return o}const Ds=e=>e();function _p(e=Ds){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const a=(...l)=>{t.value&&e(...l)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:a}}function Os(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function kp(e,t,o={}){const{eventFilter:i=Ds,...a}=o;return n.watch(e,bp(i,t),a)}function In(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=_p(i);return{stop:kp(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function wp(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(a){var l;if((l=At(t.replaceRef))!=null?l:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function Da(e,t=!1){function o(f,{flush:h="sync",deep:m=!1,timeout:p,throwOnTimeout:g}={}){let b=null;const V=[new Promise(y=>{b=n.watch(e,v=>{f(v)!==t&&(b==null||b(),y(v))},{flush:h,deep:m,immediate:!0})})];return p!=null&&V.push(Os(p,g).then(()=>At(e)).finally(()=>b==null?void 0:b())),Promise.race(V)}function i(f,h){if(!n.isRef(f))return o(v=>v===f,h);const{flush:m="sync",deep:p=!1,timeout:g,throwOnTimeout:b}=h??{};let _=null;const y=[new Promise(v=>{_=n.watch([e,f],([ee,x])=>{t!==(ee===x)&&(_==null||_(),v(ee))},{flush:m,deep:p,immediate:!0})})];return g!=null&&y.push(Os(g,b).then(()=>At(e)).finally(()=>(_==null||_(),At(e)))),Promise.race(y)}function a(f){return o(h=>!!h,f)}function l(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,h){return o(m=>{const p=Array.from(m);return p.includes(f)||p.includes(At(f))},h)}function d(f){return u(1,f)}function u(f=1,h){let m=-1;return o(()=>(m+=1,m>=f),h)}return Array.isArray(At(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Da(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Da(e,!t)}}}function Oa(e){return Da(e)}function Ep(e){var t;const o=At(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Ls=mp?window:void 0;function Ps(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Ls):[t,o,i,a]=e,!t)return gp;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,h,m)=>(u.addEventListener(f,h,m),()=>u.removeEventListener(f,h,m)),c=n.watch(()=>[Ep(t),At(a)],([u,f])=>{if(r(),!u)return;const h=yp(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(p=>s(u,m,p,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return to(d),d}function vp(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function zs(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:a=Ls,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=vp(t);return Ps(a,l,u=>{u.repeat&&At(s)||c(u)&&o(u)},r)}function Np(e){return JSON.parse(JSON.stringify(e))}function La(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:h}=i,m=n.getCurrentInstance(),p=o||(m==null?void 0:m.emit)||((a=m==null?void 0:m.$emit)==null?void 0:a.bind(m))||((r=(l=m==null?void 0:m.proxy)==null?void 0:l.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const b=y=>s?typeof s=="function"?s(y):Np(y):y,_=()=>pp(e[t])?b(e[t]):f,V=y=>{h?h(y)&&p(g,y):p(g,y)};if(c){const y=_(),v=n.ref(y);let ee=!1;return n.watch(()=>e[t],x=>{ee||(ee=!0,v.value=b(x),n.nextTick(()=>ee=!1))}),n.watch(v,x=>{!ee&&(x!==e[t]||u)&&V(x)},{deep:u}),v}else return n.computed({get(){return _()},set(y){V(y)}})}var $p={value:()=>{}};function ii(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new ai(o)}function ai(e){this._=e}function xp(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}ai.prototype=ii.prototype={constructor:ai,on:function(e,t){var o=this._,i=xp(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Ip(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<r;)if(a=(e=i[l]).type)o[a]=Us(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Us(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new ai(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function Ip(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Us(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=$p,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Pa="http://www.w3.org/1999/xhtml";const Hs={svg:"http://www.w3.org/2000/svg",xhtml:Pa,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function li(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Hs.hasOwnProperty(t)?{space:Hs[t],local:e}:e}function Sp(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Pa&&t.documentElement.namespaceURI===Pa?t.createElement(e):t.createElementNS(o,e)}}function Cp(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fs(e){var t=li(e);return(t.local?Cp:Sp)(t)}function Rp(){}function za(e){return e==null?Rp:function(){return this.querySelector(e)}}function Vp(e){typeof e!="function"&&(e=za(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=new Array(r),c,d,u=0;u<r;++u)(c=l[u])&&(d=e.call(c,c.__data__,u,l))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new ut(i,this._parents)}function Ap(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Tp(){return[]}function Gs(e){return e==null?Tp:function(){return this.querySelectorAll(e)}}function Mp(e){return function(){return Ap(e.apply(this,arguments))}}function Bp(e){typeof e=="function"?e=Mp(e):e=Gs(e);for(var t=this._groups,o=t.length,i=[],a=[],l=0;l<o;++l)for(var r=t[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),a.push(c));return new ut(i,a)}function Ys(e){return function(){return this.matches(e)}}function Ws(e){return function(t){return t.matches(e)}}var Dp=Array.prototype.find;function Op(e){return function(){return Dp.call(this.children,e)}}function Lp(){return this.firstElementChild}function Pp(e){return this.select(e==null?Lp:Op(typeof e=="function"?e:Ws(e)))}var zp=Array.prototype.filter;function Up(){return Array.from(this.children)}function Hp(e){return function(){return zp.call(this.children,e)}}function Fp(e){return this.selectAll(e==null?Up:Hp(typeof e=="function"?e:Ws(e)))}function Gp(e){typeof e!="function"&&(e=Ys(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new ut(i,this._parents)}function Ks(e){return new Array(e.length)}function Yp(){return new ut(this._enter||this._groups.map(Ks),this._parents)}function ri(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ri.prototype={constructor:ri,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Wp(e){return function(){return e}}function Kp(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new ri(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function qp(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(h[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new ri(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function Xp(e){return e.__data__}function jp(e,t){if(!arguments.length)return Array.from(this,Xp);var o=t?qp:Kp,i=this._parents,a=this._groups;typeof e!="function"&&(e=Wp(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],h=f.length,m=Zp(e.call(u,u&&u.__data__,d,i)),p=m.length,g=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,g,b,_,m,t);for(var V=0,y=0,v,ee;V<p;++V)if(v=g[V]){for(V>=y&&(y=V+1);!(ee=b[y])&&++y<p;);v._next=ee||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function Zp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Jp(){return new ut(this._exit||this._groups.map(Ks),this._parents)}function Qp(e,t,o){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?l.remove():o(l),i&&a?i.merge(a).order():a}function eh(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,h=s[c]=new Array(f),m,p=0;p<f;++p)(m=d[p]||u[p])&&(h[p]=m);for(;c<a;++c)s[c]=o[c];return new ut(s,this._parents)}function th(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function nh(e){e||(e=oh);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var o=this._groups,i=o.length,a=new Array(i),l=0;l<i;++l){for(var r=o[l],s=r.length,c=a[l]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new ut(a,this._parents).order()}function oh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ih(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ah(){return Array.from(this)}function lh(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function rh(){let e=0;for(const t of this)++e;return e}function sh(){return!this.node()}function ch(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],l=0,r=a.length,s;l<r;++l)(s=a[l])&&e.call(s,s.__data__,l,a);return this}function dh(e){return function(){this.removeAttribute(e)}}function uh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fh(e,t){return function(){this.setAttribute(e,t)}}function mh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ph(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function hh(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function yh(e,t){var o=li(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?uh:dh:typeof t=="function"?o.local?hh:ph:o.local?mh:fh)(o,t))}function qs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gh(e){return function(){this.style.removeProperty(e)}}function bh(e,t,o){return function(){this.style.setProperty(e,t,o)}}function _h(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function kh(e,t,o){return arguments.length>1?this.each((t==null?gh:typeof t=="function"?_h:bh)(e,t,o??"")):Sn(this.node(),e)}function Sn(e,t){return e.style.getPropertyValue(t)||qs(e).getComputedStyle(e,null).getPropertyValue(t)}function wh(e){return function(){delete this[e]}}function Eh(e,t){return function(){this[e]=t}}function vh(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Nh(e,t){return arguments.length>1?this.each((t==null?wh:typeof t=="function"?vh:Eh)(e,t)):this.node()[e]}function Xs(e){return e.trim().split(/^|\s+/)}function Ua(e){return e.classList||new js(e)}function js(e){this._node=e,this._names=Xs(e.getAttribute("class")||"")}js.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Zs(e,t){for(var o=Ua(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Js(e,t){for(var o=Ua(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function $h(e){return function(){Zs(this,e)}}function xh(e){return function(){Js(this,e)}}function Ih(e,t){return function(){(t.apply(this,arguments)?Zs:Js)(this,e)}}function Sh(e,t){var o=Xs(e+"");if(arguments.length<2){for(var i=Ua(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Ih:t?$h:xh)(o,t))}function Ch(){this.textContent=""}function Rh(e){return function(){this.textContent=e}}function Vh(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ah(e){return arguments.length?this.each(e==null?Ch:(typeof e=="function"?Vh:Rh)(e)):this.node().textContent}function Th(){this.innerHTML=""}function Mh(e){return function(){this.innerHTML=e}}function Bh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Dh(e){return arguments.length?this.each(e==null?Th:(typeof e=="function"?Bh:Mh)(e)):this.node().innerHTML}function Oh(){this.nextSibling&&this.parentNode.appendChild(this)}function Lh(){return this.each(Oh)}function Ph(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zh(){return this.each(Ph)}function Uh(e){var t=typeof e=="function"?e:Fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Hh(){return null}function Fh(e,t){var o=typeof e=="function"?e:Fs(e),i=t==null?Hh:typeof t=="function"?t:za(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Gh(){var e=this.parentNode;e&&e.removeChild(this)}function Yh(){return this.each(Gh)}function Wh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qh(e){return this.select(e?Kh:Wh)}function Xh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function jh(e){return function(t){e.call(this,t,this.__data__)}}function Zh(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Jh(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function Qh(e,t,o){return function(){var i=this.__on,a,l=jh(t);if(i){for(var r=0,s=i.length;r<s;++r)if((a=i[r]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=o),a.value=t;return}}this.addEventListener(e.type,l,o),a={type:e.type,name:e.name,value:t,listener:l,options:o},i?i.push(a):this.__on=[a]}}function ey(e,t,o){var i=Zh(e+""),a,l=i.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<l;++a)if((r=i[a]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?Qh:Jh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Qs(e,t,o){var i=qs(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function ty(e,t){return function(){return Qs(this,e,t)}}function ny(e,t){return function(){return Qs(this,e,t.apply(this,arguments))}}function oy(e,t){return this.each((typeof t=="function"?ny:ty)(e,t))}function*iy(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length,r;a<l;++a)(r=i[a])&&(yield r)}var ec=[null];function ut(e,t){this._groups=e,this._parents=t}function no(){return new ut([[document.documentElement]],ec)}function ay(){return this}ut.prototype=no.prototype={constructor:ut,select:Vp,selectAll:Bp,selectChild:Pp,selectChildren:Fp,filter:Gp,data:jp,enter:Yp,exit:Jp,join:Qp,merge:eh,selection:ay,order:th,sort:nh,call:ih,nodes:ah,node:lh,size:rh,empty:sh,each:ch,attr:yh,style:kh,property:Nh,classed:Sh,text:Ah,html:Dh,raise:Lh,lower:zh,append:Uh,insert:Fh,remove:Yh,clone:qh,datum:Xh,on:ey,dispatch:oy,[Symbol.iterator]:iy};function ht(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],ec)}function ly(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Et(e,t){if(e=ly(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const ry={passive:!1},oo={capture:!0,passive:!1};function Ha(e){e.stopImmediatePropagation()}function Cn(e){e.preventDefault(),e.stopImmediatePropagation()}function tc(e){var t=e.document.documentElement,o=ht(e).on("dragstart.drag",Cn,oo);"onselectstart"in t?o.on("selectstart.drag",Cn,oo):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function nc(e,t){var o=e.document.documentElement,i=ht(e).on("dragstart.drag",null);t&&(i.on("click.drag",Cn,oo),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const si=e=>()=>e;function Fa(e,{sourceEvent:t,subject:o,target:i,identifier:a,active:l,x:r,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:r,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:u}})}Fa.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function sy(e){return!e.ctrlKey&&!e.button}function cy(){return this.parentNode}function dy(e,t){return t??{x:e.x,y:e.y}}function uy(){return navigator.maxTouchPoints||"ontouchstart"in this}function fy(){var e=sy,t=cy,o=dy,i=uy,a={},l=ii("start","drag","end"),r=0,s,c,d,u,f=0;function h(v){v.on("mousedown.drag",m).filter(i).on("touchstart.drag",b).on("touchmove.drag",_,ry).on("touchend.drag touchcancel.drag",V).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(v,ee){if(!(u||!e.call(this,v,ee))){var x=y(this,t.call(this,v,ee),v,ee,"mouse");x&&(ht(v.view).on("mousemove.drag",p,oo).on("mouseup.drag",g,oo),tc(v.view),Ha(v),d=!1,s=v.clientX,c=v.clientY,x("start",v))}}function p(v){if(Cn(v),!d){var ee=v.clientX-s,x=v.clientY-c;d=ee*ee+x*x>f}a.mouse("drag",v)}function g(v){ht(v.view).on("mousemove.drag mouseup.drag",null),nc(v.view,d),Cn(v),a.mouse("end",v)}function b(v,ee){if(e.call(this,v,ee)){var x=v.changedTouches,O=t.call(this,v,ee),P=x.length,H,ne;for(H=0;H<P;++H)(ne=y(this,O,v,ee,x[H].identifier,x[H]))&&(Ha(v),ne("start",v,x[H]))}}function _(v){var ee=v.changedTouches,x=ee.length,O,P;for(O=0;O<x;++O)(P=a[ee[O].identifier])&&(Cn(v),P("drag",v,ee[O]))}function V(v){var ee=v.changedTouches,x=ee.length,O,P;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),O=0;O<x;++O)(P=a[ee[O].identifier])&&(Ha(v),P("end",v,ee[O]))}function y(v,ee,x,O,P,H){var ne=l.copy(),ce=Et(H||x,ee),L,oe,k;if((k=o.call(v,new Fa("beforestart",{sourceEvent:x,target:h,identifier:P,active:r,x:ce[0],y:ce[1],dx:0,dy:0,dispatch:ne}),O))!=null)return L=k.x-ce[0]||0,oe=k.y-ce[1]||0,function Y(S,F,U){var le=ce,E;switch(S){case"start":a[P]=Y,E=r++;break;case"end":delete a[P],--r;case"drag":ce=Et(U||F,ee),E=r;break}ne.call(S,v,new Fa(S,{sourceEvent:F,subject:k,target:h,identifier:P,active:E,x:ce[0]+L,y:ce[1]+oe,dx:ce[0]-le[0],dy:ce[1]-le[1],dispatch:ne}),O)}}return h.filter=function(v){return arguments.length?(e=typeof v=="function"?v:si(!!v),h):e},h.container=function(v){return arguments.length?(t=typeof v=="function"?v:si(v),h):t},h.subject=function(v){return arguments.length?(o=typeof v=="function"?v:si(v),h):o},h.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:si(!!v),h):i},h.on=function(){var v=l.on.apply(l,arguments);return v===l?h:v},h.clickDistance=function(v){return arguments.length?(f=(v=+v)*v,h):Math.sqrt(f)},h}function Ga(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function oc(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function io(){}var ao=.7,ci=1/ao,Rn="\\s*([+-]?\\d+)\\s*",lo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",my=/^#([0-9a-f]{3,8})$/,py=new RegExp(`^rgb\\(${Rn},${Rn},${Rn}\\)$`),hy=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),yy=new RegExp(`^rgba\\(${Rn},${Rn},${Rn},${lo}\\)$`),gy=new RegExp(`^rgba\\(${vt},${vt},${vt},${lo}\\)$`),by=new RegExp(`^hsl\\(${lo},${vt},${vt}\\)$`),_y=new RegExp(`^hsla\\(${lo},${vt},${vt},${lo}\\)$`),ic={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};Ga(io,tn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ac,formatHex:ac,formatHex8:ky,formatHsl:wy,formatRgb:lc,toString:lc});function ac(){return this.rgb().formatHex()}function ky(){return this.rgb().formatHex8()}function wy(){return uc(this).formatHsl()}function lc(){return this.rgb().formatRgb()}function tn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=my.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?rc(t):o===3?new st(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?di(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?di(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=py.exec(e))?new st(t[1],t[2],t[3],1):(t=hy.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yy.exec(e))?di(t[1],t[2],t[3],t[4]):(t=gy.exec(e))?di(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=by.exec(e))?dc(t[1],t[2]/100,t[3]/100,1):(t=_y.exec(e))?dc(t[1],t[2]/100,t[3]/100,t[4]):ic.hasOwnProperty(e)?rc(ic[e]):e==="transparent"?new st(NaN,NaN,NaN,0):null}function rc(e){return new st(e>>16&255,e>>8&255,e&255,1)}function di(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function Ey(e){return e instanceof io||(e=tn(e)),e?(e=e.rgb(),new st(e.r,e.g,e.b,e.opacity)):new st}function Ya(e,t,o,i){return arguments.length===1?Ey(e):new st(e,t,o,i??1)}function st(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Ga(st,Ya,oc(io,{brighter(e){return e=e==null?ci:Math.pow(ci,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ao:Math.pow(ao,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new st(nn(this.r),nn(this.g),nn(this.b),ui(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:sc,formatHex:sc,formatHex8:vy,formatRgb:cc,toString:cc}));function sc(){return`#${on(this.r)}${on(this.g)}${on(this.b)}`}function vy(){return`#${on(this.r)}${on(this.g)}${on(this.b)}${on((isNaN(this.opacity)?1:this.opacity)*255)}`}function cc(){const e=ui(this.opacity);return`${e===1?"rgb(":"rgba("}${nn(this.r)}, ${nn(this.g)}, ${nn(this.b)}${e===1?")":`, ${e})`}`}function ui(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function on(e){return e=nn(e),(e<16?"0":"")+e.toString(16)}function dc(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new yt(e,t,o,i)}function uc(e){if(e instanceof yt)return new yt(e.h,e.s,e.l,e.opacity);if(e instanceof io||(e=tn(e)),!e)return new yt;if(e instanceof yt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),l=Math.max(t,o,i),r=NaN,s=l-a,c=(l+a)/2;return s?(t===l?r=(o-i)/s+(o<i)*6:o===l?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?l+a:2-l-a,r*=60):s=c>0&&c<1?0:r,new yt(r,s,c,e.opacity)}function Ny(e,t,o,i){return arguments.length===1?uc(e):new yt(e,t,o,i??1)}function yt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Ga(yt,Ny,oc(io,{brighter(e){return e=e==null?ci:Math.pow(ci,e),new yt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ao:Math.pow(ao,e),new yt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new st(Wa(e>=240?e-240:e+120,a,i),Wa(e,a,i),Wa(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new yt(fc(this.h),fi(this.s),fi(this.l),ui(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=ui(this.opacity);return`${e===1?"hsl(":"hsla("}${fc(this.h)}, ${fi(this.s)*100}%, ${fi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fc(e){return e=(e||0)%360,e<0?e+360:e}function fi(e){return Math.max(0,Math.min(1,e||0))}function Wa(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Ka=e=>()=>e;function $y(e,t){return function(o){return e+o*t}}function xy(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function Iy(e){return(e=+e)==1?mc:function(t,o){return o-t?xy(t,o,e):Ka(isNaN(t)?o:t)}}function mc(e,t){var o=t-e;return o?$y(e,o):Ka(isNaN(e)?t:e)}const mi=(function e(t){var o=Iy(t);function i(a,l){var r=o((a=Ya(a)).r,(l=Ya(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=mc(a.opacity,l.opacity);return function(u){return a.r=r(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Sy(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),a;return function(l){for(a=0;a<o;++a)i[a]=e[a]*(1-l)+t[a]*l;return i}}function Cy(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ry(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),l=new Array(o),r;for(r=0;r<i;++r)a[r]=ro(e[r],t[r]);for(;r<o;++r)l[r]=t[r];return function(s){for(r=0;r<i;++r)l[r]=a[r](s);return l}}function Vy(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function Nt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Ay(e,t){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?o[a]=ro(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var qa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xa=new RegExp(qa.source,"g");function Ty(e){return function(){return e}}function My(e){return function(t){return e(t)+""}}function pc(e,t){var o=qa.lastIndex=Xa.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=qa.exec(e))&&(a=Xa.exec(t));)(l=a.index)>o&&(l=t.slice(o,l),s[r]?s[r]+=l:s[++r]=l),(i=i[0])===(a=a[0])?s[r]?s[r]+=a:s[++r]=a:(s[++r]=null,c.push({i:r,x:Nt(i,a)})),o=Xa.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?My(c[0].x):Ty(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}function ro(e,t){var o=typeof t,i;return t==null||o==="boolean"?Ka(t):(o==="number"?Nt:o==="string"?(i=tn(t))?(t=i,mi):pc:t instanceof tn?mi:t instanceof Date?Vy:Cy(t)?Sy:Array.isArray(t)?Ry:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ay:Nt)(e,t)}var hc=180/Math.PI,ja={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function yc(e,t,o,i,a,l){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*hc,skewX:Math.atan(c)*hc,scaleX:r,scaleY:s}}var pi;function By(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ja:yc(t.a,t.b,t.c,t.d,t.e,t.f)}function Dy(e){return e==null||(pi||(pi=document.createElementNS("http://www.w3.org/2000/svg","g")),pi.setAttribute("transform",e),!(e=pi.transform.baseVal.consolidate()))?ja:(e=e.matrix,yc(e.a,e.b,e.c,e.d,e.e,e.f))}function gc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,m,p){if(d!==f||u!==h){var g=m.push("translate(",null,t,null,o);p.push({i:g-4,x:Nt(d,f)},{i:g-2,x:Nt(u,h)})}else(f||h)&&m.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:Nt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:Nt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var g=m.push(a(m)+"scale(",null,",",null,")");p.push({i:g-4,x:Nt(d,f)},{i:g-2,x:Nt(u,h)})}else(f!==1||h!==1)&&m.push(a(m)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(m){for(var p=-1,g=h.length,b;++p<g;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var Oy=gc(By,"px, ","px)","deg)"),Ly=gc(Dy,", ",")",")"),Py=1e-12;function bc(e){return((e=Math.exp(e))+1/e)/2}function zy(e){return((e=Math.exp(e))-1/e)/2}function Uy(e){return((e=Math.exp(2*e))-1)/(e+1)}const hi=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],h=r[2],m=u-s,p=f-c,g=m*m+p*p,b,_;if(g<Py)_=Math.log(h/d)/t,b=function(O){return[s+O*m,c+O*p,d*Math.exp(t*O*_)]};else{var V=Math.sqrt(g),y=(h*h-d*d+i*g)/(2*d*o*V),v=(h*h-d*d-i*g)/(2*h*o*V),ee=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(v*v+1)-v);_=(x-ee)/t,b=function(O){var P=O*_,H=bc(ee),ne=d/(o*V)*(H*Uy(t*P+ee)-zy(ee));return[s+ne*m,c+ne*p,d*H/bc(t*P+ee)]}}return b.duration=_*1e3*t/Math.SQRT2,b}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Vn=0,so=0,co=0,_c=1e3,yi,uo,gi=0,an=0,bi=0,fo=typeof performance=="object"&&performance.now?performance:Date,kc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Za(){return an||(kc(Hy),an=fo.now()+bi)}function Hy(){an=0}function _i(){this._call=this._time=this._next=null}_i.prototype=wc.prototype={constructor:_i,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Za():+o)+(t==null?0:+t),!this._next&&uo!==this&&(uo?uo._next=this:yi=this,uo=this),this._call=e,this._time=o,Ja()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ja())}};function wc(e,t,o){var i=new _i;return i.restart(e,t,o),i}function Fy(){Za(),++Vn;for(var e=yi,t;e;)(t=an-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Vn}function Ec(){an=(gi=fo.now())+bi,Vn=so=0;try{Fy()}finally{Vn=0,Yy(),an=0}}function Gy(){var e=fo.now(),t=e-gi;t>_c&&(bi-=t,gi=e)}function Yy(){for(var e,t=yi,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:yi=o);uo=e,Ja(i)}function Ja(e){if(!Vn){so&&(so=clearTimeout(so));var t=e-an;t>24?(e<1/0&&(so=setTimeout(Ec,e-fo.now()-bi)),co&&(co=clearInterval(co))):(co||(gi=fo.now(),co=setInterval(Gy,_c)),Vn=1,kc(Ec))}}function vc(e,t,o){var i=new _i;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Wy=ii("start","end","cancel","interrupt"),Ky=[],Nc=0,$c=1,Qa=2,ki=3,xc=4,el=5,wi=6;function Ei(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;qy(e,o,{name:t,index:i,group:a,on:Wy,tween:Ky,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Nc})}function tl(e,t){var o=gt(e,t);if(o.state>Nc)throw new Error("too late; already scheduled");return o}function $t(e,t){var o=gt(e,t);if(o.state>ki)throw new Error("too late; already running");return o}function gt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function qy(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=wc(l,0,o.time);function l(d){o.state=$c,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,m;if(o.state!==$c)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===ki)return vc(r);m.state===xc?(m.state=wi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=wi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(vc(function(){o.state===ki&&(o.state=xc,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Qa,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Qa){for(o.state=ki,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=el,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===el&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=wi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function vi(e,t){var o=e.__transition,i,a,l=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){l=!1;continue}a=i.state>Qa&&i.state<el,i.state=wi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function Xy(e){return this.each(function(){vi(this,e)})}function jy(e,t){var o,i;return function(){var a=$t(this,e),l=a.tween;if(l!==o){i=o=l;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}a.tween=i}}function Zy(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=$t(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function Jy(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=gt(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?jy:Zy)(o,e,t))}function nl(e,t,o){var i=e._id;return e.each(function(){var a=$t(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return gt(a,i).value[t]}}function Ic(e,t){var o;return(typeof t=="number"?Nt:t instanceof tn?mi:(o=tn(t))?(t=o,mi):pc)(e,t)}function Qy(e){return function(){this.removeAttribute(e)}}function eg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tg(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttribute(e);return r===a?null:r===i?l:l=t(i=r,o)}}function ng(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?l:l=t(i=r,o)}}function og(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function ig(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function ag(e,t){var o=li(e),i=o==="transform"?Ly:Ic;return this.attrTween(e,typeof t=="function"?(o.local?ig:og)(o,i,nl(this,"attr."+e,t)):t==null?(o.local?eg:Qy)(o):(o.local?ng:tg)(o,i,t))}function lg(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function rg(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function sg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&rg(e,l)),o}return a._value=t,a}function cg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&lg(e,l)),o}return a._value=t,a}function dg(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=li(e);return this.tween(o,(i.local?sg:cg)(i,t))}function ug(e,t){return function(){tl(this,e).delay=+t.apply(this,arguments)}}function fg(e,t){return t=+t,function(){tl(this,e).delay=t}}function mg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ug:fg)(t,e)):gt(this.node(),t).delay}function pg(e,t){return function(){$t(this,e).duration=+t.apply(this,arguments)}}function hg(e,t){return t=+t,function(){$t(this,e).duration=t}}function yg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pg:hg)(t,e)):gt(this.node(),t).duration}function gg(e,t){if(typeof t!="function")throw new Error;return function(){$t(this,e).ease=t}}function bg(e){var t=this._id;return arguments.length?this.each(gg(t,e)):gt(this.node(),t).ease}function _g(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;$t(this,e).ease=o}}function kg(e){if(typeof e!="function")throw new Error;return this.each(_g(this._id,e))}function wg(e){typeof e!="function"&&(e=Ys(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Tt(i,this._parents,this._name,this._id)}function Eg(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),h,m=0;m<u;++m)(h=c[m]||d[m])&&(f[m]=h);for(;s<i;++s)r[s]=t[s];return new Tt(r,this._parents,this._name,this._id)}function vg(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function Ng(e,t,o){var i,a,l=vg(t)?tl:$t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function $g(e,t){var o=this._id;return arguments.length<2?gt(this.node(),o).on.on(e):this.each(Ng(o,e,t))}function xg(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Ig(){return this.on("end.remove",xg(this._id))}function Sg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=za(e));for(var i=this._groups,a=i.length,l=new Array(a),r=0;r<a;++r)for(var s=i[r],c=s.length,d=l[r]=new Array(c),u,f,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),d[h]=f,Ei(d[h],t,o,h,d,gt(u,o)));return new Tt(l,this._parents,t,o)}function Cg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Gs(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),m,p=gt(u,o),g=0,b=h.length;g<b;++g)(m=h[g])&&Ei(m,t,o,g,h,p);l.push(h),r.push(u)}return new Tt(l,r,t,o)}var Rg=no.prototype.constructor;function Vg(){return new Rg(this._groups,this._parents)}function Ag(e,t){var o,i,a;return function(){var l=Sn(this,e),r=(this.style.removeProperty(e),Sn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Sc(e){return function(){this.style.removeProperty(e)}}function Tg(e,t,o){var i,a=o+"",l;return function(){var r=Sn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Mg(e,t,o){var i,a,l;return function(){var r=Sn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Sn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Bg(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=$t(this,e),d=c.on,u=c.value[l]==null?s||(s=Sc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Dg(e,t,o){var i=(e+="")=="transform"?Oy:Ic;return t==null?this.styleTween(e,Ag(e,i)).on("end.style."+e,Sc(e)):typeof t=="function"?this.styleTween(e,Mg(e,i,nl(this,"style."+e,t))).each(Bg(this._id,e)):this.styleTween(e,Tg(e,i,t),o).on("end.style."+e,null)}function Og(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Lg(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Og(e,r,o)),i}return l._value=t,l}function Pg(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,Lg(e,t,o??""))}function zg(e){return function(){this.textContent=e}}function Ug(e){return function(){var t=e(this);this.textContent=t??""}}function Hg(e){return this.tween("text",typeof e=="function"?Ug(nl(this,"text",e)):zg(e==null?"":e+""))}function Fg(e){return function(t){this.textContent=e.call(this,t)}}function Gg(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Fg(a)),t}return i._value=e,i}function Yg(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Gg(e))}function Wg(){for(var e=this._name,t=this._id,o=Cc(),i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=gt(c,t);Ei(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Tt(i,this._parents,e,o)}function Kg(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(l,r){var s={value:r},c={value:function(){--a===0&&l()}};o.each(function(){var d=$t(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&l()})}var qg=0;function Tt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Cc(){return++qg}var Mt=no.prototype;Tt.prototype={constructor:Tt,select:Sg,selectAll:Cg,selectChild:Mt.selectChild,selectChildren:Mt.selectChildren,filter:wg,merge:Eg,selection:Vg,transition:Wg,call:Mt.call,nodes:Mt.nodes,node:Mt.node,size:Mt.size,empty:Mt.empty,each:Mt.each,on:$g,attr:ag,attrTween:dg,style:Dg,styleTween:Pg,text:Hg,textTween:Yg,remove:Ig,tween:Jy,delay:mg,duration:yg,ease:bg,easeVarying:kg,end:Kg,[Symbol.iterator]:Mt[Symbol.iterator]};function Xg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var jg={time:null,delay:0,duration:250,ease:Xg};function Zg(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function Jg(e){var t,o;e instanceof Tt?(t=e._id,e=e._name):(t=Cc(),(o=jg).time=Za(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&Ei(c,e,t,d,r,o||Zg(c,t));return new Tt(i,this._parents,e,t)}no.prototype.interrupt=Xy,no.prototype.transition=Jg;const Ni=e=>()=>e;function Qg(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Bt(e,t,o){this.k=e,this.x=t,this.y=o}Bt.prototype={constructor:Bt,scale:function(e){return e===1?this:new Bt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Bt(this.k,this.x+this.k*e,this.y+this.k*t)},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 An=new Bt(1,0,0);Bt.prototype;function ol(e){e.stopImmediatePropagation()}function mo(e){e.preventDefault(),e.stopImmediatePropagation()}function eb(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tb(){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 Rc(){return this.__zoom||An}function nb(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ob(){return navigator.maxTouchPoints||"ontouchstart"in this}function ib(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],l=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),r>l?(l+r)/2:Math.min(0,l)||Math.max(0,r))}function ab(){var e=eb,t=tb,o=ib,i=nb,a=ob,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=hi,d=ii("start","zoom","end"),u,f,h,m=500,p=150,g=0,b=10;function _(k){k.property("__zoom",Rc).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",ce).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,Y,S,F){var U=k.selection?k.selection():k;U.property("__zoom",Rc),k!==U?ee(k,Y,S,F):U.interrupt().each(function(){x(this,arguments).event(F).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},_.scaleBy=function(k,Y,S,F){_.scaleTo(k,function(){var U=this.__zoom.k,le=typeof Y=="function"?Y.apply(this,arguments):Y;return U*le},S,F)},_.scaleTo=function(k,Y,S,F){_.transform(k,function(){var U=t.apply(this,arguments),le=this.__zoom,E=S==null?v(U):typeof S=="function"?S.apply(this,arguments):S,K=le.invert(E),re=typeof Y=="function"?Y.apply(this,arguments):Y;return o(y(V(le,re),E,K),U,r)},S,F)},_.translateBy=function(k,Y,S,F){_.transform(k,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),r)},null,F)},_.translateTo=function(k,Y,S,F,U){_.transform(k,function(){var le=t.apply(this,arguments),E=this.__zoom,K=F==null?v(le):typeof F=="function"?F.apply(this,arguments):F;return o(An.translate(K[0],K[1]).scale(E.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),le,r)},F,U)};function V(k,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===k.k?k:new Bt(Y,k.x,k.y)}function y(k,Y,S){var F=Y[0]-S[0]*k.k,U=Y[1]-S[1]*k.k;return F===k.x&&U===k.y?k:new Bt(k.k,F,U)}function v(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function ee(k,Y,S,F){k.on("start.zoom",function(){x(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(F).end()}).tween("zoom",function(){var U=this,le=arguments,E=x(U,le).event(F),K=t.apply(U,le),re=S==null?v(K):typeof S=="function"?S.apply(U,le):S,pe=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),ye=U.__zoom,ue=typeof Y=="function"?Y.apply(U,le):Y,fe=c(ye.invert(re).concat(pe/ye.k),ue.invert(re).concat(pe/ue.k));return function(ge){if(ge===1)ge=ue;else{var Ee=fe(ge),Re=pe/Ee[2];ge=new Bt(Re,re[0]-Ee[0]*Re,re[1]-Ee[1]*Re)}E.zoom(null,ge)}})}function x(k,Y,S){return!S&&k.__zooming||new O(k,Y)}function O(k,Y){this.that=k,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,Y),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,Y){return this.mouse&&k!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var Y=ht(this.that).datum();d.call(k,this.that,new Qg(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),Y)}};function P(k,...Y){if(!e.apply(this,arguments))return;var S=x(this,Y).event(k),F=this.__zoom,U=Math.max(l[0],Math.min(l[1],F.k*Math.pow(2,i.apply(this,arguments)))),le=Et(k);if(S.wheel)(S.mouse[0][0]!==le[0]||S.mouse[0][1]!==le[1])&&(S.mouse[1]=F.invert(S.mouse[0]=le)),clearTimeout(S.wheel);else{if(F.k===U)return;S.mouse=[le,F.invert(le)],vi(this),S.start()}mo(k),S.wheel=setTimeout(E,p),S.zoom("mouse",o(y(V(F,U),S.mouse[0],S.mouse[1]),S.extent,r));function E(){S.wheel=null,S.end()}}function H(k,...Y){if(h||!e.apply(this,arguments))return;var S=k.currentTarget,F=x(this,Y,!0).event(k),U=ht(k.view).on("mousemove.zoom",re,!0).on("mouseup.zoom",pe,!0),le=Et(k,S),E=k.clientX,K=k.clientY;tc(k.view),ol(k),F.mouse=[le,this.__zoom.invert(le)],vi(this),F.start();function re(ye){if(mo(ye),!F.moved){var ue=ye.clientX-E,fe=ye.clientY-K;F.moved=ue*ue+fe*fe>g}F.event(ye).zoom("mouse",o(y(F.that.__zoom,F.mouse[0]=Et(ye,S),F.mouse[1]),F.extent,r))}function pe(ye){U.on("mousemove.zoom mouseup.zoom",null),nc(ye.view,F.moved),mo(ye),F.event(ye).end()}}function ne(k,...Y){if(e.apply(this,arguments)){var S=this.__zoom,F=Et(k.changedTouches?k.changedTouches[0]:k,this),U=S.invert(F),le=S.k*(k.shiftKey?.5:2),E=o(y(V(S,le),F,U),t.apply(this,Y),r);mo(k),s>0?ht(this).transition().duration(s).call(ee,E,F,k):ht(this).call(_.transform,E,F,k)}}function ce(k,...Y){if(e.apply(this,arguments)){var S=k.touches,F=S.length,U=x(this,Y,k.changedTouches.length===F).event(k),le,E,K,re;for(ol(k),E=0;E<F;++E)K=S[E],re=Et(K,this),re=[re,this.__zoom.invert(re),K.identifier],U.touch0?!U.touch1&&U.touch0[2]!==re[2]&&(U.touch1=re,U.taps=0):(U.touch0=re,le=!0,U.taps=1+!!u);u&&(u=clearTimeout(u)),le&&(U.taps<2&&(f=re[0],u=setTimeout(function(){u=null},m)),vi(this),U.start())}}function L(k,...Y){if(this.__zooming){var S=x(this,Y).event(k),F=k.changedTouches,U=F.length,le,E,K,re;for(mo(k),le=0;le<U;++le)E=F[le],K=Et(E,this),S.touch0&&S.touch0[2]===E.identifier?S.touch0[0]=K:S.touch1&&S.touch1[2]===E.identifier&&(S.touch1[0]=K);if(E=S.that.__zoom,S.touch1){var pe=S.touch0[0],ye=S.touch0[1],ue=S.touch1[0],fe=S.touch1[1],ge=(ge=ue[0]-pe[0])*ge+(ge=ue[1]-pe[1])*ge,Ee=(Ee=fe[0]-ye[0])*Ee+(Ee=fe[1]-ye[1])*Ee;E=V(E,Math.sqrt(ge/Ee)),K=[(pe[0]+ue[0])/2,(pe[1]+ue[1])/2],re=[(ye[0]+fe[0])/2,(ye[1]+fe[1])/2]}else if(S.touch0)K=S.touch0[0],re=S.touch0[1];else return;S.zoom("touch",o(y(E,K,re),S.extent,r))}}function oe(k,...Y){if(this.__zooming){var S=x(this,Y).event(k),F=k.changedTouches,U=F.length,le,E;for(ol(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),le=0;le<U;++le)E=F[le],S.touch0&&S.touch0[2]===E.identifier?delete S.touch0:S.touch1&&S.touch1[2]===E.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(E=Et(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<b)){var K=ht(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ni(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ni(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Ni(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:Ni([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),_):t},_.scaleExtent=function(k){return arguments.length?(l[0]=+k[0],l[1]=+k[1],_):[l[0],l[1]]},_.translateExtent=function(k){return arguments.length?(r[0][0]=+k[0][0],r[1][0]=+k[1][0],r[0][1]=+k[0][1],r[1][1]=+k[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(k){return arguments.length?(o=k,_):o},_.duration=function(k){return arguments.length?(s=+k,_):s},_.interpolate=function(k){return arguments.length?(c=k,_):c},_.on=function(){var k=d.on.apply(d,arguments);return k===d?_:k},_.clickDistance=function(k){return arguments.length?(g=(k=+k)*k,_):Math.sqrt(g)},_.tapDistance=function(k){return arguments.length?(b=+k,_):b},_}var Se=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Se||{}),il=(e=>(e.Partial="partial",e.Full="full",e))(il||{}),ln=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ln||{}),Dt=(e=>(e.Strict="strict",e.Loose="loose",e))(Dt||{}),al=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(al||{}),po=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(po||{}),Vc=(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))(Vc||{});const lb=["INPUT","SELECT","TEXTAREA"],rb=typeof document<"u"?document:null;function ll(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,l=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return lb.includes(i==null?void 0:i.nodeName)||a||!!l}function sb(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ac(e,t,o,i){const a=t.replace("+",`
1
+ (function(Ne,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],n):(Ne=typeof globalThis<"u"?globalThis:Ne||self,n(Ne.EntityModeler={},Ne.Vue,Ne.OpenBlueseaCore))})(this,(function(Ne,n,ie){"use strict";var lC=Object.defineProperty;var rC=(Ne,n,ie)=>n in Ne?lC(Ne,n,{enumerable:!0,configurable:!0,writable:!0,value:ie}):Ne[n]=ie;var We=(Ne,n,ie)=>rC(Ne,typeof n!="symbol"?n+"":n,ie);const lf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function rf(e,t){const o=e%t.perRow,i=Math.floor(e/t.perRow);return{location:{x:t.startX+o*t.columnGap,y:t.startY+i*t.rowGap},size:{...t.defaultSize}}}function Jl(e,t,o={}){const i={...lf,...o},a=new Map(e.entities.map(g=>[g.modelId,g])),l=new Map(e.associations.map(g=>[g.modelId,g])),r=new Map(t.entityLayouts.map(g=>[g.entityRef,g])),s=new Map(t.associationLayouts.map(g=>[g.associationRef,g])),c=t.entityLayouts.map(g=>g.entityRef).filter(g=>!a.has(g)),d=t.associationLayouts.map(g=>g.associationRef).filter(g=>!l.has(g)),u=new Map;for(const g of e.groups)for(const v of g.memberEntityRefs)u.set(v,g.modelId);const f=new Map;for(const g of t.groupLayouts)for(const v of g.memberNoteRefs??[])f.set(v,g.groupRef);let h=0;const p=e.entities.map(g=>{const v=u.get(g.modelId),ee=r.get(g.modelId);if(ee){const O={location:{x:ee.geo.location.x,y:ee.geo.location.y},size:{width:ee.geo.size.width,height:ee.geo.size.height}};return{entity:g,geo:O,collapsed:ee.collapsed??!1,locked:ee.locked??!1,groupRef:v,style:ee.style,attributeStyles:ee.attributeStyles,operationStyles:ee.operationStyles}}const x=rf(h++,i);return{entity:g,geo:x,collapsed:!1,locked:!1,groupRef:v}}),m=new Map(t.groupLayouts.map(g=>[g.groupRef,g])),b=e.groups.map(g=>{const v=m.get(g.modelId),ee=v?{location:{x:v.geo.location.x,y:v.geo.location.y},size:{width:v.geo.size.width,height:v.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:ee,style:v==null?void 0:v.style,locked:(v==null?void 0:v.locked)??!1}}),y=e.associations.map(g=>{const v=s.get(g.modelId);return{association:g,waypoints:(v==null?void 0:v.waypoints)??[],sourceColumnRef:v==null?void 0:v.sourceColumnRef,targetColumnRef:v==null?void 0:v.targetColumnRef}}),_=t.notes.map(g=>({note:{...g,geo:{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}},groupRef:f.get(g.modelId)})),V=[];for(const g of t.notes)for(const v of g.connections??[])a.has(v.targetRef)&&V.push({noteRef:g.modelId,targetRef:v.targetRef,waypoints:v.waypoints.map(ee=>({x:ee.x,y:ee.y}))});return{entities:p,associations:y,groups:b,notes:_,noteConnections:V,prunedEntityRefs:c,prunedAssociationRefs:d}}function Yn(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const kn=.5;function Ql(e,t,o,i,a,l){const r=Yn(t),s=Yn(a),c={x:e.x+r.x*l,y:e.y+r.y*l},d={x:i.x+s.x*l,y:i.y+s.y*l},u=[c,...o,d],f=[];let h=e;const p=(y,_)=>{(Math.abs(y.x-h.x)>=kn||Math.abs(y.y-h.y)>=kn)&&(f.push({a:h,b:y,seg:_}),h=y)};p(c,0);let m=r.x!==0,b=c;for(let y=1;y<u.length;y++){const _=u[y],V=y<=o.length?y-1:o.length,g=Math.abs(_.x-b.x)<kn,v=Math.abs(_.y-b.y)<kn;g&&v||(g?(p(_,V),m=!1):v?(p(_,V),m=!0):m?(p({x:b.x,y:_.y},V),p(_,V),m=!0):(p({x:_.x,y:b.y},V),p(_,V),m=!1),b=_)}return p(i,o.length),f}function fa(e,t,o,i,a,l=20){const r=Ql(e,t,o,i,a,l);let s=`M ${it(e.x)},${it(e.y)}`;for(const c of r)s+=` L ${it(c.b.x)},${it(c.b.y)}`;return s}const sf=14;function ma(e,t,o,i,a,l=20){return Ql(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=sf).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function it(e){return Math.round(e*100)/100}const cf=36;function er(e,t,o=cf){const i=Math.max(e.x,t.x)+o;return`M ${it(e.x)},${it(e.y)} L ${it(i)},${it(e.y)} L ${it(i)},${it(t.y)} L ${it(t.x)},${it(t.y)}`}function pa(e,t,o){const i=[e,...t,o];let a=`M ${it(i[0].x)},${it(i[0].y)}`;for(let l=1;l<i.length;l++)a+=` L ${it(i[l].x)},${it(i[l].y)}`;return a}function df(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ha(e,t){const o=df(e),i=e.width/2,a=e.height/2,l=t.x-o.x,r=t.y-o.y;if(Math.abs(l)<kn&&Math.abs(r)<kn)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=l!==0?i/Math.abs(l):1/0,c=r!==0?a/Math.abs(r):1/0,d=Math.min(s,c),u={x:o.x+l*d,y:o.y+r*d},f=s<=c?l>=0?"right":"left":r>=0?"bottom":"top";return{point:u,side:f}}function ya(e,t,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:t},side:i?"right":"left"}}function ga(e,t,o){const i=[e,...t,o],a=[];for(let l=1;l<i.length;l++){const r=i[l-1],s=i[l];a.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return a}const uf={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function tr(e,t,o={}){const i={...uf,...o},a=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),l=[];let r=0;for(const u of e.groups){const f=a.get(u.modelId),h=f?f.location:{x:0,y:0},p=f?f.size.width:800;f&&(r=Math.max(r,f.location.y+f.size.height));const m=Math.max(1,Math.floor((p-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((b,y)=>{const _=y%m,V=Math.floor(y/m);l.push({id:b,location:{x:h.x+i.pad+_*i.cellWidth,y:h.y+i.pad+i.headerHeight+V*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=r>0?r+40:i.pad;return c.forEach((u,f)=>{const h=f%i.ungroupedCols,p=Math.floor(f/i.ungroupedCols);l.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+p*i.cellHeight}})}),l}const nr={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function or(e,t={}){const o={...nr,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function ff(e,t={}){const o={...nr,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=or(l.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:l.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Fo(e,t,o,i){switch(e){case"CLASS":return t;case"PHYSICAL":return i||t;case"LOGICAL":return o||"(논리명)";default:return i?`${o||"(논리명)"} · ${i}`:o||"(논리명)"}}function ir(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function ar(e){var l,r,s;const t=new Map(e.entities.map(c=>[c.modelId,c.name])),o=new Map;for(const c of e.entities)for(const d of c.attributes)o.set(d.modelId,d.name);const i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((l=c.name)==null?void 0:l.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(r=c.table)!=null&&r.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const f=[...c.attributes].sort((p,m)=>p.order-m.order);for(const p of f){if(p.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${p.name?` ${p.name} ${"─".repeat(8)}`:""}`);continue}const m=p.dbAttrs[0],b=m!=null&&m.length?`(${m.length}${m.scale!=null?`,${m.scale}`:""})`:"",y=m?` → ${m.physicalName} ${m.dataType}${b}`:"",_=[p.identifier?"PK":"",p.notNull?"NOT NULL":"",m!=null&&m.unique?"UNIQUE":"",m!=null&&m.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${p.name}: ${p.type}${y}${_.length?` {${_.join(", ")}}`:""}`)}for(const p of c.indexes??[]){const m=p.columns.map(b=>`${o.get(b.columnRef)??b.columnRef}${b.descending?" DESC":""}`).join(", ");a.push(` index ${p.name}${p.unique?" UNIQUE":""}: ${m}`)}const h=[...c.operations??[]].sort((p,m)=>p.order-m.order);for(const p of h){const m=p.visibility?` {${p.visibility}}`:"",b=(s=p.description)!=null&&s.ko?` — ${p.description.ko}`:"";a.push(` method ${p.name}()${m}${b}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=t.get(c.end1.entityRef)??c.end1.entityRef,u=t.get(c.end2.entityRef)??c.end2.entityRef,f=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${ir(c.end1.multiplicity)} —— ${ir(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
2
+ `).trim()}function mf(e){return e==="CLASS"?"class":"er"}function ba(e,t){return t==="class"?bf(e):hf(e)}function Wn(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function _a(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function lr(e,t){const o=new Set,i=new Map;return e.entities.forEach((a,l)=>{const r=Wn(t(a),`Entity_${l+1}`);let s=r,c=2;for(;o.has(s);)s=`${r}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function pf(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function rr(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function sr(e,t){return(t==="left"?{NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"}:{NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"})[e]}function hf(e){var i,a;const t=lr(e,l=>{var r;return((r=l.table)==null?void 0:r.physicalName)||l.name}),o=["erDiagram"];for(const l of e.entities){const r=t.get(l.modelId),s=[...l.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){o.push(` ${r}`);continue}o.push(` ${r} {`);for(const c of s){const d=c.dbAttrs[0],u=Wn((d==null?void 0:d.dataType)||c.type,"unknown"),f=Wn((d==null?void 0:d.physicalName)||c.name,"col"),h=[c.identifier?"PK":"",pf(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),p=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",m=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,b=_a([m,p].filter(Boolean).join(" ")),y=[` ${u} ${f}`];h&&y.push(h);let _=y.join(" ");b&&(_+=` "${b}"`),o.push(_)}o.push(" }")}for(const l of e.associations){const r=t.get(l.end1.entityRef),s=t.get(l.end2.entityRef);if(!r||!s)continue;const c=`${sr(l.end1.multiplicity,"left")}--${sr(l.end2.multiplicity,"right")}`,d=_a(l.description);o.push(` ${r} ${c} ${s} : "${d}"`)}return o.join(`
3
+ `)}function yf(e){return e&&e!=="UNDEFINED"?e:null}function gf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function bf(e){const t=lr(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),l=[],r=yf(i.stereotype);r&&l.push(` <<${r}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)l.push(` +${gf(c.type)} ${Wn(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))l.push(` +${Wn(c.name,"op")}()`);l.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...l),o.push(" }"))}for(const i of e.associations){const a=t.get(i.end1.entityRef),l=t.get(i.end2.entityRef);if(!a||!l)continue;const r=_f(i),s=_a(i.description),c=` ${a} "${rr(i.end1.multiplicity)}" ${r} "${rr(i.end2.multiplicity)}" ${l}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
+ `)}function _f(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const kf=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function dt(e){return e.replace(kf,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ae(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function cr(e){return`<text ${[`x="${Ae(e.x)}"`,`y="${Ae(e.y)}"`,`fill="${dt(e.fill)}"`,`font-size="${Ae(e.fontSize)}"`,e.fontFamily?`font-family="${dt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${dt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${dt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${dt(e.text)}</text>`}function wf(e){return`<line x1="${Ae(e.x1)}" y1="${Ae(e.y)}" x2="${Ae(e.x2)}" y2="${Ae(e.y)}" stroke="${dt(e.stroke)}" stroke-width="${Ae(e.strokeWidth??1)}" />`}function Ef(e){return e==null?{tl:0,tr:0,br:0,bl:0}:typeof e=="number"?{tl:e,tr:e,br:e,bl:e}:e}function vf(e,t,o,i,a){return[`M${Ae(e+a.tl)},${Ae(t)}`,`L${Ae(e+o-a.tr)},${Ae(t)}`,a.tr?`Q${Ae(e+o)},${Ae(t)} ${Ae(e+o)},${Ae(t+a.tr)}`:"",`L${Ae(e+o)},${Ae(t+i-a.br)}`,a.br?`Q${Ae(e+o)},${Ae(t+i)} ${Ae(e+o-a.br)},${Ae(t+i)}`:"",`L${Ae(e+a.bl)},${Ae(t+i)}`,a.bl?`Q${Ae(e)},${Ae(t+i)} ${Ae(e)},${Ae(t+i-a.bl)}`:"",`L${Ae(e)},${Ae(t+a.tl)}`,a.tl?`Q${Ae(e)},${Ae(t)} ${Ae(e+a.tl)},${Ae(t)}`:"","Z"].filter(Boolean).join(" ")}function ka(e){const t=Ef(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${dt(e.fill)}"`,`stroke="${dt(e.stroke)}"`,`stroke-width="${Ae(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Ae(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${vf(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Ae(e.x)}" y="${Ae(e.y)}" width="${Ae(e.w)}" height="${Ae(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(wf(r));for(const r of e.texts)l.push(cr(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Nf(e){const o=[`<path ${[`d="${dt(e.d)}"`,'fill="none"',`stroke="${dt(e.stroke)}"`,`stroke-width="${Ae(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(cr(i));return`<g>${o.join("")}</g>`}function dr(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Ae(t)}" y="${Ae(o)}" width="${Ae(i)}" height="${Ae(a)}" fill="${dt(e.background)}" />`);for(const r of e.groups)l.push(ka(r));for(const r of e.edges)l.push(Nf(r));for(const r of e.entities)l.push(ka(r));for(const r of e.notes)l.push(ka(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Ae(t)} ${Ae(o)} ${Ae(i)} ${Ae(a)}" width="${Ae(i)}" height="${Ae(a)}">`+l.join("")+"</svg>"}const $f=["BIT","TINYINT","SMALLINT","INTEGER","BIGINT","FLOAT","REAL","DOUBLE","NUMERIC","DECIMAL","CHAR","VARCHAR","LONGVARCHAR","DATE","TIME","TIMESTAMP","BINARY","VARBINARY","LONGVARBINARY","NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","BLOB","CLOB","REF","DATALINK","BOOLEAN","ROWID","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","REF_CURSOR","TIME_WITH_TIMEZONE","TIMESTAMP_WITH_TIMEZONE","SERIAL","BIG_SERIAL","JSONB"],xf=new Set(["NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","REF","DATALINK","ROWID","REF_CURSOR","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","TIME_WITH_TIMEZONE","BIT","TINYINT","FLOAT"]),If=$f.filter(e=>!xf.has(e)),Sf={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function wa(e){return Sf[e]??e}const Cf=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Go=new Set(["NUMERIC","DECIMAL"]);function ur(e,t=If){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ct="CustomType",Kn="GroupCodeEnum",Ea="String",va=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Kn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Ct,label:"CustomType"}],Rf=new Map(va.map(e=>[e.value,e.label]));function wn(e){return Rf.get(e)??e}const Vf=new Set([Kn,"CustomMoneyType"]),fr=va.filter(e=>!Vf.has(e.value)).map(e=>e.value===Ct?{...e,label:"CustomType (사용자정의)"}:e);function mr(e,t=[]){const o=t.map(a=>{var r,s;const l=((r=a.label)==null?void 0:r.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:l?`${a.type} (${l})`:a.type}}),i=[...fr,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:wn(e)},...i]:i}function Af(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function pr(e,t){var a;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(l=>l.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity!=="EXACTLY_ONE_INSTANCE")return((a=i.jpa)==null?void 0:a.collectionType)??"LIST"}function Na(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${wn(t.type)}>`:Af(t)?wn(t.type):e==="CLASS"?t.type===Ct&&t.customType||wn(t.type):wa(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Yo(e,t){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=t.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var l;return a.attrType==="EMBED_OWN"&&((l=a.embedded)==null?void 0:l.embeddableRef)===e.modelId}));return[e,...o]}function Wo(e,t){return Yo(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function qn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Ko(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const $a=63;function qo(e){if(!e)return null;const t=e.length;return t<=$a?null:`물리명이 ${$a}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function hr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function mt(e){return!e||e.trim()===""}function Xn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Tf(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,a=2,l=new Map,r=[],s=[],c=new Set,d=u=>{l.set(u,i),r.push(u);for(const f of t.get(u)??[]){const h=l.get(f)??o;if(h===o)d(f);else if(h===i){const p=r.slice(r.indexOf(f)),m=[...p].sort().join(" ");c.has(m)||(c.add(m),s.push(p))}}r.pop(),l.set(u,a)};for(const u of e.entities)(l.get(u.modelId)??o)===o&&d(u.modelId);return s}function Mf(e,t,o,i,a){var l,r,s,c,d;if(!mt(t.physicalName))return t.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(r=(l=a==null?void 0:a.embeddableCatalog)==null?void 0:l.find(u=>u.type===e.type))==null?void 0:r.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const f=(d=i.entities.find(h=>h.modelId===u))==null?void 0:d.attributes.flatMap(h=>h.dbAttrs)[o];return(f==null?void 0:f.physicalName)??""}return t.physicalName??""}function xa(e,t){const o=new Map;for(const i of e){const a=t(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=t(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function yr(e,t){var l,r,s;const o=[];for(const c of xa(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(m=>m.attrType!=="DIVIDER");if(mt(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(m=>m.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),mt((l=c.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const m of d.filter(b=>b.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${m.name}"`});for(const m of d.filter(b=>b.identifier&&b.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${m.name}"`});for(const m of d)if(!m.identifier)for(const b of m.dbAttrs)!b.autoIncrement&&mt(b.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:b.modelId,contextRef:c.modelId,message:`채번(${b.autoIncrement?"auto increment":`시퀀스 "${b.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${m.name}"에 설정되어 있습니다`});for(const m of d.filter(b=>b.naturalId&&b.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${m.name}"`});for(const m of d.filter(b=>b.naturalId&&b.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${m.name}"`});for(const m of d.filter(b=>b.naturalId&&!b.notNull&&!b.identifier&&!b.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${m.name}"`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const m of xa(d,b=>b.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${m.name}"`});for(const m of d)mt(m.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(m=>m.dbAttrs).filter(m=>m.sharedColumnRef==null),f=d.flatMap(m=>m.dbAttrs.map((b,y)=>({col:b,name:Mf(m,b,y,e,t)})).filter(b=>b.col.sharedColumnRef==null));for(const m of xa(f,b=>b.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:m.col.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${m.name}"`});for(const m of u){const b=qo(m.physicalName);b&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:b}),t!=null&&t.reservedWords&&!mt(m.physicalName)&&t.reservedWords.has(m.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${m.physicalName}"`}),t!=null&&t.selectableDataTypes&&!mt(m.dataType)&&!t.selectableDataTypes.has(m.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${m.dataType}"`}),!mt(m.dataType)&&Cf.has(m.dataType)&&!m.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`${m.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const m=qn(Wo(c,e.entities));for(const b of d){if(b.attrType!=="EMBED_PREDEF")continue;const y=t.embeddableCatalog.find(_=>_.type===b.type);y&&b.dbAttrs.forEach((_,V)=>{if(_.sharedColumnRef==null)return;const g=y.fields[V],v=m.get(_.sharedColumnRef);if(!g||!v)return;(v.dataType!==g.dataType||(v.length??null)!==(g.length??null)||(v.scale??null)!==(g.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${hr(v)})이 ${g.name??"컬럼"} 정의(${hr(g)})와 다릅니다`})})}}for(const m of d){const b=m.dbAttrs[0];if(!(b!=null&&b.multiValue))continue;m.type===Kn&&b.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:b.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${m.type||"타입 미지정"} / ${b.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const h=(s=c.table)==null?void 0:s.physicalName,p=qo(h);p&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:p}),t!=null&&t.reservedWords&&!mt(h)&&t.reservedWords.has(h.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${h}"`});for(const m of c.indexes??[]){const b=qo(m.name);b&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:b}),t!=null&&t.reservedWords&&!mt(m.name)&&t.reservedWords.has(m.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${m.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){Xn(c.end1.multiplicity)&&Xn(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const d of["end1","end2"]){const u=c[d].jpa;if(!u)continue;const f=u.cascadeTypes??[],h=f.includes("ALL"),p=f.includes("REMOVE");h&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(p||h)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${h?"ALL":"REMOVE"}와 의미가 겹칩니다`}),Xn(c[d].multiplicity)&&u.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),u.orphanRemoval&&Xn(c[d==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!Xn(c[d].multiplicity)&&(u.collectionType||u.collectionTable||u.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),u.collectionType==="SET"&&u.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of Tf(e)){const d=[...c,c[0]].map(u=>a.get(u)??u).join(" → ");for(const u of c)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:u,message:`식별 관계 사이클입니다 (PK 무한 의존): ${d}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const c=new Set;for(const u of e.associations)c.add(u.end1.entityRef),c.add(u.end2.entityRef);const d=new Map(e.entities.map(u=>[u.name,u.modelId]));for(const u of e.entities){for(const f of u.attributes)f.embedded&&(c.add(u.modelId),c.add(f.embedded.embeddableRef));if(!mt(u.superClass)){c.add(u.modelId);const f=d.get(u.superClass);f&&c.add(f)}}for(const u of e.entities)c.has(u.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function Oe(){return crypto.randomUUID()}const Bf="CustomMoneyType",Df="Money";function Of(e){return!(e.type!==Bf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Lf(e){const t=e.dbAttrs[0]??{modelId:Oe(),physicalName:"",dataType:""},o={modelId:Oe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Df,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Pf(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>Of(r)?(a=!0,t=!0,Lf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function Ia(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function En(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,i)=>En(o,t[i]));if(typeof e=="object"&&typeof t=="object"){const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o)if(!En(e[i],t[i]))return!1;return!0}return!1}function Zt(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const l of a)o.has(l)||En(e[l],t[l])||(i[l]=t[l]===void 0?null:t[l]);return Object.keys(i).length?i:null}function Jt(e,t,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(t.map(d=>[o(d),d])),l=[],r=[],s=[];for(const[d,u]of a){const f=i.get(d);f?s.push({cur:f,tgt:u}):l.push(u)}for(const[d,u]of i)a.has(d)||r.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return l.sort(c),r.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:l,removed:r,common:s}}function zf(e,t){const o=new Set(e),i=new Set(t),a=t.filter(r=>!o.has(r)).sort(),l=e.filter(r=>!i.has(r)).sort();return{added:a,removed:l}}const Uf=new Set(["attributes","operations","indexes","rev"]),Hf=new Set(["end1","end2","rev"]),Ff=new Set(["memberEntityRefs","rev"]),gr=new Set(["modelId"]),Gf=new Set(["modelId","columns"]),Yf=new Set([]);function Wf(e,t,o,i){const a=Jt(t.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=Zt(s,c,gr);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=Jt(t.operations??[],o.operations??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of l.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){const d=Zt(s,c,gr);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=Jt(t.indexes??[],o.indexes??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of r.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){if(!En(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=Zt(s,c,Gf);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Kf(e,t,o){const i=Jt(e.entities??[],t.entities??[],r=>r.modelId);for(const r of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:r.modelId});for(const r of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:r.modelId,value:Ia(r)});for(const{cur:r,tgt:s}of i.common){const c=Zt(r,s,Uf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),Wf(r.modelId,r,s,o)}const a=Jt(e.associations??[],t.associations??[],r=>r.modelId);for(const r of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:r.modelId});for(const r of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:r.modelId,value:Ia(r)});for(const{cur:r,tgt:s}of a.common){const c=Zt(r,s,Hf);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Zt(r[d]??{},s[d]??{},Yf);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=Jt(e.groups??[],t.groups??[],r=>r.modelId);for(const r of l.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:r.modelId});for(const r of l.added)o.push({kind:"group.add",casUnit:"logical",groupRef:r.modelId,value:Ia(r)});for(const{cur:r,tgt:s}of l.common){const c=Zt(r,s,Ff);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=zf(r.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u})}}function Xo(e,t,o,i,a,l,r){const s=Jt(e,t,o);for(const c of s.removed)r.push({kind:a,casUnit:"layout",[l]:o(c),value:void 0});for(const c of s.added)r.push({kind:i,casUnit:"layout",[l]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)En(c,d)||(r.push({kind:a,casUnit:"layout",[l]:o(c),value:void 0}),r.push({kind:i,casUnit:"layout",[l]:o(d),value:d}))}function qf(e,t,o){Xo(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Xo(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Xo(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Xo(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Xf(e,t){const o=[];return Kf(e.logical,t.logical,o),qf(e.layout,t.layout,o),o}function jf(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const Zf={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class Jf{constructor(t){We(this,"out",[]);We(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...jn(t),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(t,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...jn(t),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...jn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...jn(t),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(t,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...jn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function jn(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function kt(e,t,o,i){if(o==null||typeof o!="object")return;const a=Zf[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function Qt(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function Sa(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Ut(e,t){var l,r,s,c,d,u,f,h;const o=jf(t),i=new Jf(t.field),a=[...e].sort((p,m)=>p.seq-m.seq);for(const p of a)for(const m of p.ops)switch(o){case"entity":if(m.entityRef!==t.entityRef)break;m.kind==="entity.add"?kt(i,p,m.value,"entity"):m.kind==="entity.update"?Qt(i,p,m.patch):m.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(m.entityRef!==t.entityRef)break;if(m.kind==="entity.add"){const b=Sa((l=m.value)==null?void 0:l.attributes,t.attributeRef);b&&kt(i,p,b,"attribute")}else m.kind==="attribute.add"&&((r=m.value)==null?void 0:r.modelId)===t.attributeRef?kt(i,p,m.value,"attribute"):m.kind==="attribute.update"&&m.attributeRef===t.attributeRef?Qt(i,p,m.patch):(m.kind==="attribute.remove"&&m.attributeRef===t.attributeRef||m.kind==="entity.remove")&&i.remove(p);break;case"operation":if(m.entityRef!==t.entityRef)break;if(m.kind==="entity.add"){const b=Sa((s=m.value)==null?void 0:s.operations,t.operationRef);b&&kt(i,p,b,"operation")}else m.kind==="operation.add"&&((c=m.value)==null?void 0:c.modelId)===t.operationRef?kt(i,p,m.value,"operation"):m.kind==="operation.update"&&m.operationRef===t.operationRef?Qt(i,p,m.patch):(m.kind==="operation.remove"&&m.operationRef===t.operationRef||m.kind==="entity.remove")&&i.remove(p);break;case"index":if(m.entityRef!==t.entityRef)break;if(m.kind==="entity.add"){const b=Sa((d=m.value)==null?void 0:d.indexes,t.indexRef);b&&kt(i,p,b,"index")}else m.kind==="index.add"&&((u=m.value)==null?void 0:u.modelId)===t.indexRef?kt(i,p,m.value,"index"):m.kind==="index.update"&&m.indexRef===t.indexRef?Qt(i,p,m.patch):(m.kind==="index.remove"&&m.indexRef===t.indexRef||m.kind==="entity.remove")&&i.remove(p);break;case"association":if(m.associationRef!==t.associationRef)break;m.kind==="association.add"?kt(i,p,m.value,"association"):m.kind==="association.update"?Qt(i,p,m.patch):m.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(m.associationRef!==t.associationRef)break;if(m.kind==="association.add"){const b=(f=m.value)==null?void 0:f[t.end];kt(i,p,b,"associationEnd")}else m.kind==="associationEnd.update"&&m.end===t.end?Qt(i,p,m.patch):m.kind==="association.remove"&&i.remove(p);break;case"group":if(m.groupRef!==t.groupRef)break;if(m.kind==="group.add"){kt(i,p,m.value,"group");const b=(h=m.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(b))for(const y of b)i.member(p,y,!1)}else m.kind==="group.update"?Qt(i,p,m.patch):m.kind==="group.remove"?i.remove(p):m.kind==="group.addMember"&&m.entityRef!=null?i.member(p,m.entityRef,!1):m.kind==="group.removeMember"&&m.entityRef!=null&&i.member(p,m.entityRef,!0);break}return i.result()}function Qf(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function vn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function em(e,t){const o=new Set,i=new Set,a=new Set;for(const l of e)for(const r of l.ops){const s=r;if(r.kind==="entity.add"&&s.entityRef===t){const c=s.value;vn(c==null?void 0:c.attributes,o),vn(c==null?void 0:c.operations,i),vn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?vn([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?vn([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?vn([s.value],a):(r.kind==="index.update"||r.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function jo(e,t){return e.map(o=>({...o,subject:t}))}function br(e,t){const o=e.filter(s=>s.ops.some(c=>Qf(c,t))),{attributes:i,operations:a,indexes:l}=em(o,t),r=[...jo(Ut(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...jo(Ut(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...jo(Ut(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...jo(Ut(o,{entityRef:t,indexRef:s}),{kind:"index",ref:s}));return r.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function _r(e){return`${e.kind}:${e.ref}:${e.end??""}`}function tm(e){var i,a,l;const t=new Set,o=(r,s)=>{typeof s=="string"&&t.add(`${r}:${s}:`)};for(const r of e)for(const s of r.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const u of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",u.modelId);for(const u of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(l=c.value)==null?void 0:l.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return t}function nm(e){const t=new Set,o=new Set,i=new Set;for(const a of e)for(const l of a.ops){const r=l,s=l.kind;if(s.startsWith("entity."))typeof r.entityRef=="string"&&t.add(r.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=r.containerRef??r.entityRef;typeof c=="string"&&t.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof r.associationRef=="string"&&o.add(r.associationRef):s.startsWith("group.")&&typeof r.groupRef=="string"&&i.add(r.groupRef)}return{entities:t,associations:o,groups:i}}function om(e){const{entities:t,associations:o,groups:i}=nm(e),a=[];for(const l of t)for(const r of br(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Ut(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Ut(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Ut(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function kr(e){const t=om(e),o=tm(e),i=new Map;for(const r of t){const s=_r(r.subject),c=i.get(s);(c===void 0||r.seq<c)&&i.set(s,r.seq)}const a=new Map;for(const r of t){let s=a.get(r.seq);s||(s={meta:r,subjects:new Map},a.set(r.seq,s));const c=_r(r.subject);let d=s.subjects.get(c);if(!d){const u=r.removed?"remove":i.get(c)===r.seq&&o.has(c)?"add":"update";d={subject:r.subject,verb:u,fields:[]},s.subjects.set(c,d)}r.removed?d.verb="remove":d.fields.push({field:r.field,value:r.value,...r.oldValue!==void 0?{oldValue:r.oldValue}:{}})}const l=[];for(const[r,s]of a){const c=s.meta;l.push({seq:r,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return l.sort((r,s)=>s.seq-r.seq)}class Ca{constructor(t){We(this,"undoStack",[]);We(this,"redoStack",[]);We(this,"savePoint",null);We(this,"listeners",new Set);We(this,"commandListeners",new Set);We(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const a of this.commandListeners)a(t,o,i)}}function wr(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Je(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function pt(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Fe(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function Rt(e,t,o){var i,a;return(a=(i=e.layout.notes.find(l=>l.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(l=>l.targetRef===o)}function Ra(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=wr(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=Je(o,e.modelId);a>=0&&o.layout.entityLayouts.splice(a,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Er(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=wr(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=Je(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,f)=>{s.has(u.associationRef)&&c.push({item:u,index:f})});const d=[];i.logical.groups.forEach(u=>{const f=u.memberEntityRefs.indexOf(e);f>=0&&d.push({groupId:u.modelId,index:f})}),t={entity:{item:i.logical.entities[a],index:a},entityLayout:l>=0?{item:i.layout.entityLayouts[l],index:l}:void 0,assocs:r,assocLayouts:c,groupMemberships:d},[...c].sort((u,f)=>f.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...r].sort((u,f)=>f.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const f=i.logical.groups.find(h=>h.modelId===u.groupId);f==null||f.memberEntityRefs.splice(u.index,1)}l>=0&&i.layout.entityLayouts.splice(l,1),i.logical.entities.splice(a,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((a,l)=>a.index-l.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...t.assocLayouts].sort((a,l)=>a.index-l.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of t.groupMemberships){const l=i.logical.groups.find(r=>r.modelId===a.groupId);l==null||l.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],a=[];for(const l of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:l.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:l.item.modelId,value:l.item});for(const l of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:l.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:l.item.associationRef,value:l.item,incidental:!0});for(const l of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.groupId,groupRef:l.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:l.groupId,groupRef:l.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:a.reverse()}}}}function vr(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Fe(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(Fe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function Nr(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Fe(i,e);o=a.name,a.name=t},invert(i){Fe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function Nn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a].geo;o={...l.location},l.location={...t}},invert(i){const a=Je(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function $r(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a].geo;o={...l.size},l.size={...t}},invert(i){const a=Je(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Zn(e,t){const o={...(e==null?void 0:e.properties)??{}};return t?o.swatch=t:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function xr(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.style,l.style=Zn(l.style,t)},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Je(i,e),l=a>=0?i.layout.entityLayouts[a].style:void 0,r=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[r(l)],invert:[r(o)]}}}}function Ir(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.collapsed,l.collapsed=t},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Sr(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.locked,l.locked=t},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Va(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=t[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((l,r)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:l.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:l.entityRef,value:{collapsed:t[r]}})}),{forward:i,invert:a}}}}function Zo(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=Je(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.attributeStyles;const s={...r.attributeStyles},c=Zn(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const l=Je(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=Je(a,e),r=l>=0?a.layout.entityLayouts[l].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function Aa(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);a>=0&&o.layout.groupLayouts.splice(a,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Cr(e,t){const o={},i=a=>{const l=a.logical.groups.find(r=>r.modelId===e);if(!l)throw new Error(`그룹 없음: ${e}`);return l};return{label:"그룹 수정",apply(a){const l=i(a);for(const r of Object.keys(t))o[r]=l[r];Object.assign(l,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Rr(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e);t={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function Vr(e,t){let o=!1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에 편입",apply(a){const l=i(a);l&&!l.memberEntityRefs.includes(t)&&(l.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const l=i(a),r=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1;r>=0&&l.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function Jo(e,t){let o=-1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에서 제외",apply(a){const l=i(a);o=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1,o>=0&&l.memberEntityRefs.splice(o,1)},invert(a){var l;o<0||(l=i(a))==null||l.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function Ar(e,t){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Tr(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Mr(e,t){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Zn(a.style,t)},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e),l=r=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:r}});return{forward:[l(a==null?void 0:a.style)],invert:[l(o)]}}}}function Br(e,t){let o;return{label:t?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=t},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Vt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Fe(o,e).attributes.push(t)},invert(o){const i=Fe(o,e),a=i.attributes.findIndex(l=>l.modelId===t.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function en(e,t,o){const i={},a=l=>{const r=Fe(l,e).attributes.find(s=>s.modelId===t);if(!r)throw new Error(`속성 없음: ${t}`);return r};return{label:"속성 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function $n(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Fe(i,e),l=a.attributes.findIndex(r=>r.modelId===t);if(l<0)throw new Error(`속성 없음: ${t}`);o={item:a.attributes[l],index:l},a.attributes.splice(l,1)},invert(i){o&&Fe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Ta(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=Fe(a,e);i=l.attributes.map(f=>({...f}));const r=new Set(t),s=l.attributes.filter(f=>r.has(f.modelId)),c=l.attributes.filter(f=>!r.has(f.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];l.attributes.splice(0,l.attributes.length,...u),l.attributes.forEach((f,h)=>f.order=h)},invert(a){i&&Fe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=Fe(a,e).attributes.map(r=>({...r}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:l}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Dr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Fe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=Fe(i,e),l=((r=a.operations)==null?void 0:r.findIndex(s=>s.modelId===t.modelId))??-1;l>=0&&a.operations.splice(l,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function Or(e,t,o){const i={},a=l=>{var s;const r=(s=Fe(l,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`메서드 없음: ${t}`);return r};return{label:"메서드 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function Lr(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Fe(i,e),l=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(l<0)throw new Error(`메서드 없음: ${t}`);const r=a.operations.length===1;o={item:a.operations[l],index:l,wasSole:r},a.operations.splice(l,1),r&&(a.operations=void 0)},invert(i){if(!o)return;const a=Fe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Pr(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=Fe(a,e),r=l.operations??[];i=r.map(h=>({...h}));const s=new Set(t),c=r.filter(h=>s.has(h.modelId)),d=r.filter(h=>!s.has(h.modelId)),u=Math.max(0,Math.min(o,d.length)),f=[...d.slice(0,u),...c,...d.slice(u)];r.splice(0,r.length,...f),r.forEach((h,p)=>h.order=p),l.operations=r},invert(a){if(!i)return;const l=Fe(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(Fe(a,e).operations??[]).map(r=>({...r}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:l}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function zr(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=Je(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.operationStyles;const s={...r.operationStyles},c=Zn(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(a){const l=Je(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=Je(a,e),r=l>=0?a.layout.entityLayouts[l].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function Ma(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(l=>l.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:t,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function Ur(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(l=>l.associationRef===e);t={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Qo(e,t){const o={},i=a=>{const l=a.logical.associations.find(r=>r.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l};return{label:"관계 수정",apply(a){const l=i(a);for(const r of Object.keys(t))o[r]=l[r];Object.assign(l,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function xn(e,t,o){const i={},a=l=>{const r=l.logical.associations.find(s=>s.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r[t]};return{label:"관계 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function Hr(e,t){return{label:"인덱스 추가",apply(o){const i=Fe(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=Fe(o,e),a=((l=i.indexes)==null?void 0:l.findIndex(r=>r.modelId===t.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function Fr(e,t,o){const i={},a=l=>{var s;const r=(s=Fe(l,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`인덱스 없음: ${t}`);return r};return{label:"인덱스 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function Gr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=Fe(i,e),l=((r=a.indexes)==null?void 0:r.findIndex(s=>s.modelId===t))??-1;if(l<0)throw new Error(`인덱스 없음: ${t}`);o={item:a.indexes[l],index:l},a.indexes.splice(l,1)},invert(i){o&&Fe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const wt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Jn=(e,t)=>{var o;return((o=pt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Yr(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=pt(a,e);if(!l||!l.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...l.waypoints[t]},l.waypoints.splice(t,1,{...o})},invert(a){const l=pt(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=Jn(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[wt(e,l)],invert:[wt(e,r)]}}}}function Wr(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=pt(i,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...a.waypoints[t]},a.waypoints.splice(t,1)},invert(i){const a=pt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=Jn(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function Kr(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=pt(a,e);if(!l)throw new Error(`관계 레이아웃 없음: ${e}`);i=l.waypoints.map(r=>({...r})),l.waypoints=i.map(r=>({x:r.x+t,y:r.y+o}))},invert(a){const l=pt(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[wt(e,Jn(a,e))],invert:[wt(e,i??[])]}}}}function qr(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=pt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=pt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[wt(e,Jn(o,e))],invert:[wt(e,t??[])]}}}}function Xr(e,t,o){return{label:"waypoint 추가",apply(i){const a=pt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=pt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=Jn(i,e),l=a.slice();return l.splice(t,1),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function jr(e){return{label:"노트 추가",apply(t){t.layout.notes.push(e)},invert(t){const o=t.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&t.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function Zr(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Qn(e,t){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Jr(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Qr(e,t){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=t},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(t)],invert:[i(o)]}}}}function es(e,t){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Zn(a.style,t)},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(r=>r.modelId===e),l=r=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:r}});return{forward:[l(a==null?void 0:a.style)],invert:[l(o)]}}}}function ts(e,t){let o=!1,i=!1;const a=l=>l.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에 노트 편입",apply(l){const r=a(l);r&&(r.memberNoteRefs||(r.memberNoteRefs=[],i=!0),!r.memberNoteRefs.includes(t)&&(r.memberNoteRefs.push(t),o=!0))},invert(l){if(!o)return;const r=a(l);if(!(r!=null&&r.memberNoteRefs))return;const s=r.memberNoteRefs.indexOf(t);s>=0&&r.memberNoteRefs.splice(s,1),i&&delete r.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function ns(e,t){let o=-1;const i=a=>a.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var r;const l=i(a);o=((r=l==null?void 0:l.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&l.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const l=i(a);l&&(l.memberNoteRefs||(l.memberNoteRefs=[]),l.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const Ht=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),ei=(e,t,o)=>{var i;return((i=Rt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function os(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const l=a.layout.notes.find(r=>r.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);if(l.connections||(l.connections=[],i=!0),l.connections.some(r=>r.targetRef===t)){o=!1;return}l.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(a){if(!o)return;const l=a.layout.notes.find(s=>s.modelId===e);if(!(l!=null&&l.connections))return;const r=l.connections.findIndex(s=>s.targetRef===t);r>=0&&l.connections.splice(r,1),i&&delete l.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function is(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var r;const a=i.layout.notes.find(s=>s.modelId===e),l=((r=a==null?void 0:a.connections)==null?void 0:r.findIndex(s=>s.targetRef===t))??-1;if(!(a!=null&&a.connections)||l<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:a.connections[l],index:l},a.connections.splice(l,1)},invert(i){if(!o)return;const a=i.layout.notes.find(l=>l.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function as(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=Rt(l,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(l){const r=Rt(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=ei(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Ht(e,t,r)],invert:[Ht(e,t,s)]}}}}function ls(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=Rt(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=Rt(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=ei(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function rs(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=Rt(a,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...l.waypoints[o]},l.waypoints.splice(o,1)},invert(a){const l=Rt(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=ei(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function ss(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Rt(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=Rt(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Ht(e,t,ei(i,e,t))],invert:[Ht(e,t,o??[])]}}}}function Ge(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const a of t)a.apply(i)},invert(i){for(let a=t.length-1;a>=0;a--)t[a].invert(i)},emitOps(i){const a=t.map(l=>{if(!l.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${l.label}`);return l.emitOps(i)});return{forward:a.flatMap(l=>l.forward),invert:a.slice().reverse().flatMap(l=>l.invert)}}}}const im=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ma,addAttribute:Vt,addEntity:Ra,addEntityToGroup:Vr,addGroup:Aa,addIndex:Hr,addNote:jr,addNoteConnection:os,addNoteConnectionWaypoint:ls,addNoteToGroup:ts,addOperation:Dr,addWaypoint:Xr,clearNoteConnectionWaypoints:ss,clearWaypoints:qr,composite:Ge,moveEntity:Nn,moveGroup:Ar,moveNote:Qn,moveNoteConnectionWaypoint:as,moveWaypoint:Yr,removeAssociation:Ur,removeAttribute:$n,removeEntity:Er,removeEntityFromGroup:Jo,removeGroup:Rr,removeIndex:Gr,removeNote:Zr,removeNoteConnection:is,removeNoteConnectionWaypoint:rs,removeNoteFromGroup:ns,removeOperation:Lr,removeWaypoint:Wr,renameEntity:Nr,reorderAttributes:Ta,reorderOperations:Pr,resizeEntity:$r,resizeGroup:Tr,resizeNote:Jr,setAllEntitiesCollapsed:Va,setAttributeSwatch:Zo,setEntityCollapsed:Ir,setEntityLocked:Sr,setEntitySwatch:xr,setGroupLocked:Br,setGroupSwatch:Mr,setNoteMemo:Qr,setNoteSwatch:es,setOperationSwatch:zr,translateWaypoints:Kr,updateAssociation:Qo,updateAssociationEnd:xn,updateAttribute:en,updateEntity:vr,updateGroup:Cr,updateIndex:Fr,updateOperation:Or},Symbol.toStringTag,{value:"Module"}));class cs{constructor(){We(this,"revs",new Map);We(this,"layoutVersion",0);We(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class ds{constructor(t){We(this,"cache",new cs);We(this,"newClientOpId");We(this,"debounceMs");We(this,"emissions",new WeakMap);We(this,"open",null);We(this,"debounceHandle",null);We(this,"queue",[]);We(this,"sending",!1);We(this,"_frozen",!1);We(this,"stack",null);We(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Oe,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,a,l)=>this.handle(i,a,l));return()=>{o(),this.stack===t&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var r;if(this._frozen)return;let a;if(o==="do"){const s=(r=t.emitOps)==null?void 0:r.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);a=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);a=s}const l=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=l,this.emissions.set(t,{forward:l,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,a),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:l,inv:a.invert},this.startDebounce();return}l.length&&this.enqueue(this.buildBatch(l))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(t){const o={},i=new Set;let a=!1,l=!1;for(const r of t)if(r.casUnit==="logical")if(a=!0,r.containerRef)i.add(r.containerRef);else{const s=r.entityRef??r.associationRef??r.groupRef;s&&(r.kind.endsWith(".add")?this.cache.setRev(s,0):r.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else r.incidental||(l=!0);if(i.size){o.revs={};for(const r of i){const s=this.cache.rev(r);o.revs[r]=s,this.cache.setRev(r,s+1)}}return l&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(l){this.sending=!1,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",l),(a=(i=this.opts).onError)==null||a.call(i,l),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const us=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","group.add"],fs=()=>crypto.randomUUID(),am=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,lm=e=>e&&e[0].toLowerCase()+e.slice(1),rm=e=>e&&e[0].toUpperCase()+e.slice(1),sm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function cm(e,t){return lm(e)+rm(t)}function dm(e,t){const o=e.entities.find(r=>r.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(r=>r.identifier&&(r.attrType==="NORMAL"||r.attrType==="RELATION_OWN")).sort((r,s)=>r.order-s.order).map(r=>{const s=cm(o.name,r.name);return{associationRef:t.modelId,sourceAttributeRef:r.modelId,name:s,type:r.type,identifier:a,notNull:a,dbAttrs:r.dbAttrs.map(c=>({physicalName:sm(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const ti=(e,t)=>`${e}::${t}`,ni=e=>e??void 0;function um(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((l,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==l.dataType||ni(s.length)!==ni(l.length)||ni(s.scale)!==ni(l.scale)}))&&(i.dbAttrs=t.dbAttrs.map((l,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??l.physicalName,logicalName:(s==null?void 0:s.logicalName)??l.logicalName,dataType:l.dataType,length:l.length,scale:l.scale}})),Object.keys(i).length?i:null}function fm(e,t,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:t,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function eo(e,t,o=fs){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===t);if(!a)return i;const l=e.associations.filter(f=>f.end2.entityRef===t),r=a.stereotype==="JPA_EMBEDDABLE"?[]:l.flatMap(f=>dm(e,f)),s=new Map(r.map(f=>[ti(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ti(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=ti(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}let u=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of r){const h=ti(f.associationRef,f.sourceAttributeRef),p=d.get(h);if(!p)i.add.push(fm(f,u++,o));else{const m=um(p,f,o);m&&i.update.push({attributeId:p.modelId,patch:m})}}return i}function mm(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function pm(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function hm(e,t,o=fs){const i=new Map,a=pm(e),l=new Set,r=[t];for(;r.length;){const s=r.shift();if(l.has(s))continue;l.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=eo(a,d,o);if(am(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(h=>h.modelId===d);f&&mm(f,u),l.has(d)||r.push(d)}}return i}function oi(e,t,o){var r;const i=e.entities.find(s=>s.modelId===t),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)return;const l=(r=a.derivedFrom)==null?void 0:r.associationRef;if(l){const s=e.associations.find(c=>c.modelId===l);if(s)return s}return e.associations.find(s=>s.end1.entityRef===t&&s.end1.attributeRef===o||s.end2.entityRef===t&&s.end2.attributeRef===o)}function ym(e,t){const o=()=>e.entities.filter(l=>{var r;return((r=l.table)==null?void 0:r.physicalName)===t.ref}),i=()=>e.entities.filter(l=>l.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function gm(e,t){const o=()=>e.attributes.filter(l=>l.name===t.ref),i=()=>e.attributes.filter(l=>l.dbAttrs.some(r=>r.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const a=o();return a.length?a:i()}function ms(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function lt(e,t){const o=ym(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function bm(e,t){const o=gm(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function _m(e,t){const o=()=>e.attributes.flatMap(l=>l.dbAttrs).filter(l=>l.physicalName===t.ref),i=()=>e.attributes.filter(l=>l.name===t.ref).flatMap(l=>l.dbAttrs);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function km(e,t){const o=_m(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function wm(e,t){const o=e.filter(i=>i.physicalName===t.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Em(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function vm(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Nm(e,t){const o=Em(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function $m(e,t){const o=vm(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function ps(e,t,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:t,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function hs(e,t,o,i,a,l,r,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),f=[];let h=!1;for(const p of t.fields){const m=u.get(p.name);if(m!=null&&m.sharedColumnPhysicalName){const b={ref:m.sharedColumnPhysicalName,by:"physicalName"},y=wm(Wo(i,a),b);if(!y.ok){s.push(y.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:l,entity:r,handle:b}:{code:"shared-column-target-ambiguous",opIndex:l,entity:r,handle:b,matches:y.matches}),h=!0;continue}f.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:y.value.modelId});continue}f.push({modelId:c(),physicalName:(m==null?void 0:m.physicalName)??"",dataType:"",...m!=null&&m.length?{length:m.length}:{},...m!=null&&m.scale?{scale:m.scale}:{},...(m==null?void 0:m.insertable)!=null?{insertable:m.insertable}:{},...(m==null?void 0:m.updatable)!=null?{updatable:m.updatable}:{}})}return h?null:{modelId:d,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:f}}function ys(e,t,o){return{modelId:o(),name:e.name,order:t,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function gs(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=km(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}r.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:l(),name:t.name,unique:t.unique??!1,columns:r,...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{}}}function xm(e,t,o={}){const i=o.mkId??Oe,a=o.embeddableCatalog??[],l=f=>a.find(h=>h.type===f),r=[],s=[],c=new Map,d=new Map,u=new Set;for(const f of t)f.kind==="entity.add"&&(u.add(f.spec.name),f.spec.physicalName&&u.add(f.spec.physicalName));return t.forEach((f,h)=>{var p,m,b;switch(f.kind){case"entity.add":{const y=i(),_={modelId:y,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},V={ref:f.spec.name};let g=!1;for(const[x,O]of(f.spec.attributes??[]).entries()){if(O.type==="GroupCodeEnum"&&!O.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:V,handle:{ref:O.name}}),g=!0;continue}const P=l(O.type);if(P){const H=hs(O,P,x,_,e.entities,h,V,s,i);H?_.attributes.push(H):g=!0}else(p=O.embeddableOverrides)!=null&&p.length?(s.push({code:"embeddable-type-unresolved",opIndex:h,entity:V,handle:{ref:O.name}}),g=!0):_.attributes.push(ps(O,x,i))}const v=(f.spec.operations??[]).map((x,O)=>ys(x,O,i));v.length&&(_.operations=v);const ee=[];for(const x of f.spec.indexes??[]){const O=gs(_,x,h,V,s,i);O?ee.push(O):g=!0}if(ee.length&&(_.indexes=ee),g)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:y,value:_});break}case"entity.update":{const y=lt(e,f.entity);if(!y.ok){s.push(rt(y.reason,h,f.entity,y.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,patch:f.patch});break}case"entity.remove":{const y=lt(e,f.entity);if(!y.ok){s.push(rt(y.reason,h,f.entity,y.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:y.value.modelId});break}case"attribute.add":{const y=lt(e,f.entity);if(!y.ok){s.push(rt(y.reason,h,f.entity,y.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}const _=c.get(y.value.modelId)??y.value.attributes.length;c.set(y.value.modelId,_+1);const V=l(f.spec.type);let g;if(V)g=hs(f.spec,V,_,y.value,e.entities,h,f.entity,s,i);else if((m=f.spec.embeddableOverrides)!=null&&m.length){s.push({code:"embeddable-type-unresolved",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}else g=ps(f.spec,_,i);if(!g)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,value:g});break}case"attribute.update":case"attribute.remove":{const y=lt(e,f.entity);if(!y.ok){s.push(rt(y.reason,h,f.entity,y.matches,u));break}const _=bm(y.value,f.attribute);if(!_.ok){s.push(_.reason==="not-found"?{code:"attribute-not-found",opIndex:h,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:h,entity:f.entity,handle:f.attribute,matches:_.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,attributeRef:_.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,attributeRef:_.value.modelId});break}case"association.add":{const y=lt(e,f.spec.from),_=lt(e,f.spec.to);if(y.ok||s.push(rt(y.reason,h,f.spec.from,y.matches,u)),_.ok||s.push(rt(_.reason,h,f.spec.to,_.matches,u)),!y.ok||!_.ok)break;if(f.spec.identifying&&y.value.modelId===_.value.modelId){s.push({code:"self-identifying",opIndex:h,handle:{from:f.spec.from,to:f.spec.to}});break}const V=i(),g={modelId:V,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:y.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:_.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},v={...e,associations:[...e.associations,g]},ee=eo(v,_.value.modelId,i);ee.add[0]&&(g.end2.attributeRef=ee.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:V,value:g});for(const x of ee.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:x});break}case"association.remove":{const y=lt(e,f.association.from),_=lt(e,f.association.to);if(y.ok||s.push(rt(y.reason,h,f.association.from,y.matches,u)),_.ok||s.push(rt(_.reason,h,f.association.to,_.matches,u)),!y.ok||!_.ok)break;const V=ms(e,y.value.modelId,_.value.modelId);if(V.length!==1){s.push(V.length===0?{code:"association-not-found",opIndex:h,handle:f.association}:{code:"association-ambiguous",opIndex:h,handle:f.association,matches:V.map(g=>g.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:V[0].modelId});break}case"association.update":{const y=bs(e,f.association,h,s,u);if(!y)break;r.push({kind:"association.update",casUnit:"logical",containerRef:y.modelId,associationRef:y.modelId,patch:f.patch});break}case"associationEnd.update":{const y=bs(e,f.association,h,s,u);if(!y)break;const _=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:y.modelId,associationRef:y.modelId,end:_,patch:f.patch});break}case"index.add":{const y=lt(e,f.entity);if(!y.ok){s.push(rt(y.reason,h,f.entity,y.matches,u));break}const _=gs(y.value,f.spec,h,f.entity,s,i);if(!_)break;r.push({kind:"index.add",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,indexRef:_.modelId,value:_});break}case"index.update":case"index.remove":{const y=lt(e,f.entity);if(!y.ok){s.push(rt(y.reason,h,f.entity,y.matches,u));break}const _=Nm(y.value,f.index);if(!_.ok){s.push(_.reason==="not-found"?{code:"index-not-found",opIndex:h,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:h,entity:f.entity,handle:f.index,matches:_.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:h,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,indexRef:_.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,indexRef:_.value.modelId});break}case"operation.add":{const y=lt(e,f.entity);if(!y.ok){s.push(rt(y.reason,h,f.entity,y.matches,u));break}const _=d.get(y.value.modelId)??((b=y.value.operations)==null?void 0:b.length)??0;d.set(y.value.modelId,_+1);const V=ys(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,operationRef:V.modelId,value:V});break}case"operation.update":case"operation.remove":{const y=lt(e,f.entity);if(!y.ok){s.push(rt(y.reason,h,f.entity,y.matches,u));break}const _=$m(y.value,f.operation);if(!_.ok){s.push(_.reason==="not-found"?{code:"operation-not-found",opIndex:h,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:h,entity:f.entity,handle:f.operation,matches:_.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,operationRef:_.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,operationRef:_.value.modelId});break}case"group.add":{const y=[];let _=!1;for(const v of f.spec.members){const ee=lt(e,v);if(!ee.ok){s.push(rt(ee.reason,h,v,ee.matches,u)),_=!0;continue}y.push(ee.value.modelId)}if(_)break;const V=i(),g={modelId:V,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:y,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};r.push({kind:"group.add",casUnit:"logical",groupRef:V,value:g});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function rt(e,t,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:t,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function bs(e,t,o,i,a){const l=lt(e,t.from),r=lt(e,t.to);if(l.ok||i.push(rt(l.reason,o,t.from,l.matches,a)),r.ok||i.push(rt(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=ms(e,l.value.modelId,r.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:s.map(c=>c.modelId)}),null):s[0]}const _s={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Im={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Sm={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},ii={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Cm={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...ii,description:"속성 설명(다국어)."},columnLogicalName:{...ii,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(type이 카탈로그 엔트리일 때만). field=카탈로그 필드명으로 매칭 (@AttributeOverride 대응). 미설정 서브컬럼은 카탈로그 기본 상속. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}}},required:["name","type"],additionalProperties:!1},ks={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Rm={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...ks,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...ks,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},Vm={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{..._s,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},Am={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...ii,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Tm={type:"object",properties:{name:{...ii,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},Mm={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function nt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Bm={"entity.add":nt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":nt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":nt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":nt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":nt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":nt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":nt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":nt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":nt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":nt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":nt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":nt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":nt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":nt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":nt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":nt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":nt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},ws={anyOf:us.map(e=>Bm[e])},Dm={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:_s,assocHandle:Im,entitySpec:Sm,attrSpec:Cm,assocSpec:Rm,indexSpec:Vm,operationSpec:Am,groupSpec:Tm,patch:Mm,symbolicOp:ws}};function Om(e,t,o,i={}){const a=i.mkClientOpId??Oe,l=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&l.add(s.containerRef);const r={};if(l.size){r.revs={};for(const s of l)r.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:r,origin:i.origin??"agent",clientOpId:a()}}const Es={location:{x:0,y:0},size:{width:220,height:140}};function vs(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Lm=/^[-=_*~\s]{3,}$/;function Pm(e){return e.attrType&&e.attrType!=="NORMAL"||!Lm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function zm(e){return e.type===Ct&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Um(e,t){if(e.attrType==="DIVIDER"||Pm(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]};const o=zm(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(vs)}}function Hm(e){const{modelId:t,name:o,visibility:i,sourceCode:a,description:l,order:r,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:a,description:l?{ko:l}:void 0,order:r??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Fm(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(t=>({columnRef:t.targetColumn.refId,descending:t.descending}))}}function Gm(e){var t,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(Um),operations:(t=e.operations)==null?void 0:t.map(Hm),indexes:(o=e.indexes)==null?void 0:o.map(Fm),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Ym(e){const t={};for(const i of e.attributes)i.style&&(t[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...Es},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function Ns(e){return e.jpaAttribute?{fetchType:e.jpaAttribute.fetchType,cascadeTypes:e.jpaAttribute.cascadeTypes,orphanRemoval:e.jpaAttribute.orphanRemoval,orderBy:e.jpaAttribute.orderBy,collectionType:e.jpaAttribute.collectionType,collectionTable:e.jpaAttribute.collectionTable,orderColumn:e.jpaAttribute.orderColumn}:void 0}function Ba(e){var t;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(t=e.attribute)==null?void 0:t.modelId,jpa:Ns(e)}}function Wm(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Ba(e.end1),end2:Ba(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:t,layout:o}}function $s(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function xs(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Is(e){var o;const t=e.attribute;return(t==null?void 0:t.attrType)==="EMBED_OWN"&&(((o=t.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function Ss(e,t){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(vs)}}function Km(e,t,o){var y,_;const i=$s(e.end1.attribute),a=$s(e.end2.attribute);if(i===a)return Wm(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(_=(y=s.dbAttrs)==null?void 0:y[0])==null?void 0:_.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((V,g)=>Math.max(V,g.order),-1)+1:s.order??0,h={...Ss(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const p=(V,g)=>({entityRef:V.endModel.refId,multiplicity:V.multiplicity,navigable:V.navigable,composition:V.composition,attributeRef:g?d:h.modelId,legacyNavRaw:g?void 0:V.attribute,jpa:Ns(V)}),m={modelId:e.modelId,description:e.description,end1:p(e.end1,i),end2:p(e.end2,a)},b={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:m.end1.attributeRef,targetColumnRef:m.end2.attributeRef,style:e.style};return{assoc:m,layout:b}}function qm(e,t){const o=e.targetModelId?t.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function Xm(e,t,o){var m;const i=((m=e.end1.attribute)==null?void 0:m.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,l=i?e.end2:e.end1,r=a.attribute,s=t.get(l.endModel.refId),c=s?s.attributes.reduce((b,y)=>Math.max(b,y.order),-1)+1:r.order??0,d={...Ss(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(b=>qm(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...Ba(b),legacyEmbedRaw:b.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:f,layout:p}}function jm(e,t){var i,a,l,r;const o=[];for(const s of t){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(r=(l=s.end2)==null?void 0:l.endModel)==null?void 0:r.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Cs(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:l,connections:r,ownedConnections:s,...c}=e;let d=r;if(!d&&Array.isArray(s)){const u=jm(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+t.x,y:a.location.y+t.y},size:a.size},style:l,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Rs(e,t,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(r=>[r.modelId,r])),a=new Map(t.map(r=>[r.modelId,r])),l=(r,s)=>{var c;return!!s&&!!((c=i.get(r??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const r of o){const s=a.get(r.associationRef);s&&(r.sourceColumnRef&&!l(s.end1.entityRef,r.sourceColumnRef)&&(r.sourceColumnRef=void 0),r.targetColumnRef&&!l(s.end2.entityRef,r.targetColumnRef)&&(r.targetColumnRef=void 0))}}function Vs(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Zm(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Vs);if(!i.length)continue;const a=o.filter(s=>!Vs(s));let l=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(l=c+1)});const r=[...a.slice(0,l),...i,...a.slice(l)];r.forEach((s,c)=>s.order=c),t.attributes=r}}function Jm(e){return(e.schemaVersion??1)>=2&&"logical"in e?Qm(e):ep(e)}function Qm(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:h,...p}=f;return h!=null&&(o[f.modelId]=h),p},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout;Rs(a,l,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:l,groups:r},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function ep(e){var _,V;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(g,v)=>{o.push(Gm(g));const ee=Ym(g);ee.geo={location:{x:ee.geo.location.x+v.x,y:ee.geo.location.y+v.y},size:ee.geo.size},i.push(ee);for(const x of g.ownedAssociations??[])c.push(x)},u={x:0,y:0};for(const g of e.entities??[])d(g,u);const f=[];for(const g of e.groups??[]){const v=g.entities??[];r.push({modelId:g.modelId,name:g.name,description:g.description,packageName:g.packageName,excludeDDLGeneration:g.excludeDDLGeneration??!1,memberEntityRefs:v.map(x=>x.modelId)});const ee=((_=g.geo)==null?void 0:_.location)??u;if(g.geo){const x=(g.notes??[]).map(O=>O.modelId);s.push({groupRef:g.modelId,geo:g.geo,style:g.style,locked:g.locked,memberNoteRefs:x.length?x:void 0})}for(const x of v)d(x,ee);for(const x of g.notes??[])f.push(Cs(x,ee))}const h=new Map(o.map(g=>[g.modelId,g])),p=new Map,m=new Map;for(const g of o)for(const v of g.attributes)for(const ee of v.dbAttrs)p.set(ee.modelId,v.modelId),m.set(ee.modelId,ee);for(const g of c)for(const v of[g.end1,g.end2]){const ee=v.attribute;if(ee&&(((V=ee.dbAttrs)==null?void 0:V.length)??0)>0)for(const x of ee.dbAttrs)x.modelId&&p.set(x.modelId,ee.modelId)}for(const g of c){const v=xs(g.end1.attribute),ee=xs(g.end2.attribute),x=Is(g.end1)||Is(g.end2),{assoc:O,layout:P}=v!==ee||x?Xm(g,h,m):Km(g,h,p);a.push(O),l.push(P)}Rs(o,a,l),Zm(o);const b={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(g=>Cs(g)),...f]}},y={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:y}}function As(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function tp(e,t){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(As),style:t}}function np(e,t){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:t}}function op(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function Ft(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function ip(e,t){const o=t==null?void 0:t.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var l;return{...As(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function ap(e){const t=new Set;for(const o of e.logical.associations){const i=o.end1.legacyNavRaw?o.end1:o.end2.legacyNavRaw?o.end2:void 0;i!=null&&i.attributeRef&&t.add(i.attributeRef)}return t}function lp(e){const t=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&t.add(i.modelId);return t}function rp(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function sp(e,t){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:rp(e.logicalName,t==null?void 0:t.logicalName)?void 0:e.logicalName,dataType:e.dataType===((t==null?void 0:t.dataType)??"")?"":e.dataType,length:o(e.length,t==null?void 0:t.length),scale:o(e.scale,t==null?void 0:t.scale),unique:o(e.unique,t==null?void 0:t.unique),autoIncrement:o(e.autoIncrement,t==null?void 0:t.autoIncrement),updatable:o(e.updatable,t==null?void 0:t.updatable),insertable:o(e.insertable,t==null?void 0:t.insertable)}}function cp(e,t,o){let i;for(const f of t.logical.entities){const h=f.attributes.find(p=>{var m;return((m=p.embedded)==null?void 0:m.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,l=t.logical.entities.find(f=>f.modelId===a);if(!l)return;const r=l.attributes.flatMap(f=>f.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((f,h)=>sp(f,r[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Ft(e.end1,c?s:u),end2:Ft(e.end2,c?u:s)}}function dp(e,t,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:Ft(e.end1,e.end1.legacyEmbedRaw),end2:Ft(e.end2,e.end2.legacyEmbedRaw)};const a=cp(e,t,i);if(a)return a;const l=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(l!==r){const s=l?e.end1:e.end2,c=l?e.end2:e.end1,d=t.logical.entities.find(m=>m.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(m=>m.modelId===s.attributeRef),f=t.logical.entities.find(m=>m.modelId===c.entityRef),h=u?ip(u,f):void 0,p=s.legacyNavRaw;return{...i,end1:Ft(e.end1,l?p:h),end2:Ft(e.end2,r?p:h)}}return{...i,end1:Ft(e.end1),end2:Ft(e.end2)}}function Ts(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(h=>h.entityRef===e.modelId),r=t.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>t.layout.associationLayouts.find(p=>p.associationRef===h),c=(l==null?void 0:l.geo)??{...Es},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var p;return tp(h,(p=l==null?void 0:l.attributeStyles)==null?void 0:p[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var p;return np(h,(p=l==null?void 0:l.operationStyles)==null?void 0:p[h.modelId])}),ownedAssociations:r.map(h=>dp(h,t,s(h.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(op),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:l==null?void 0:l.style,collapsed:l==null?void 0:l.collapsed,locked:l==null?void 0:l.locked}}function up(e,t,o,i){const a=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),l=e.memberEntityRefs.map(c=>t.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),r=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Ms(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>Ts(c,t,o,i,r)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function Ms(e,t={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-t.x,y:e.geo.location.y-t.y},size:e.geo.size},style:e.style,connections:e.connections}}function fp(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=ap(e),l=lp(e),r=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:t.id,diagramVersion:t.diagramVersion,version:t.version,size:t.size??e.layout.canvasSize,packageName:t.packageName??e.logical.packageName,entities:i.map(s=>Ts(s,e,a,l)),groups:e.logical.groups.map(s=>up(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>Ms(s))}}function mp(e,t={}){var a,l,r;const o=((a=t.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((l=t.revSeed)==null?void 0:l.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((r=t.revSeed)==null?void 0:r.layoutVersion)??0}}}function to(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function At(e){return typeof e=="function"?e():n.unref(e)}const pp=typeof window<"u"&&typeof document<"u",hp=e=>typeof e<"u",yp=Object.prototype.toString,gp=e=>yp.call(e)==="[object Object]",bp=()=>{};function _p(e,t){function o(...i){return new Promise((a,l)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(a).catch(l)})}return o}const Bs=e=>e();function kp(e=Bs){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const a=(...l)=>{t.value&&e(...l)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:a}}function Ds(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function wp(e,t,o={}){const{eventFilter:i=Bs,...a}=o;return n.watch(e,_p(i,t),a)}function In(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=kp(i);return{stop:wp(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function Ep(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(a){var l;if((l=At(t.replaceRef))!=null?l:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function Da(e,t=!1){function o(f,{flush:h="sync",deep:p=!1,timeout:m,throwOnTimeout:b}={}){let y=null;const V=[new Promise(g=>{y=n.watch(e,v=>{f(v)!==t&&(y==null||y(),g(v))},{flush:h,deep:p,immediate:!0})})];return m!=null&&V.push(Ds(m,b).then(()=>At(e)).finally(()=>y==null?void 0:y())),Promise.race(V)}function i(f,h){if(!n.isRef(f))return o(v=>v===f,h);const{flush:p="sync",deep:m=!1,timeout:b,throwOnTimeout:y}=h??{};let _=null;const g=[new Promise(v=>{_=n.watch([e,f],([ee,x])=>{t!==(ee===x)&&(_==null||_(),v(ee))},{flush:p,deep:m,immediate:!0})})];return b!=null&&g.push(Ds(b,y).then(()=>At(e)).finally(()=>(_==null||_(),At(e)))),Promise.race(g)}function a(f){return o(h=>!!h,f)}function l(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,h){return o(p=>{const m=Array.from(p);return m.includes(f)||m.includes(At(f))},h)}function d(f){return u(1,f)}function u(f=1,h){let p=-1;return o(()=>(p+=1,p>=f),h)}return Array.isArray(At(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Da(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Da(e,!t)}}}function Oa(e){return Da(e)}function vp(e){var t;const o=At(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Os=pp?window:void 0;function Ls(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Os):[t,o,i,a]=e,!t)return bp;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,h,p)=>(u.addEventListener(f,h,p),()=>u.removeEventListener(f,h,p)),c=n.watch(()=>[vp(t),At(a)],([u,f])=>{if(r(),!u)return;const h=gp(f)?{...f}:f;l.push(...o.flatMap(p=>i.map(m=>s(u,p,m,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return to(d),d}function Np(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Ps(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:a=Os,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=Np(t);return Ls(a,l,u=>{u.repeat&&At(s)||c(u)&&o(u)},r)}function $p(e){return JSON.parse(JSON.stringify(e))}function La(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:h}=i,p=n.getCurrentInstance(),m=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((r=(l=p==null?void 0:p.proxy)==null?void 0:l.$emit)==null?void 0:r.bind(p==null?void 0:p.proxy));let b=d;t||(t="modelValue"),b=b||`update:${t.toString()}`;const y=g=>s?typeof s=="function"?s(g):$p(g):g,_=()=>hp(e[t])?y(e[t]):f,V=g=>{h?h(g)&&m(b,g):m(b,g)};if(c){const g=_(),v=n.ref(g);let ee=!1;return n.watch(()=>e[t],x=>{ee||(ee=!0,v.value=y(x),n.nextTick(()=>ee=!1))}),n.watch(v,x=>{!ee&&(x!==e[t]||u)&&V(x)},{deep:u}),v}else return n.computed({get(){return _()},set(g){V(g)}})}var xp={value:()=>{}};function ai(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new li(o)}function li(e){this._=e}function Ip(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}li.prototype=ai.prototype={constructor:li,on:function(e,t){var o=this._,i=Ip(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Sp(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<r;)if(a=(e=i[l]).type)o[a]=zs(o[a],e.name,t);else if(t==null)for(a in o)o[a]=zs(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new li(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function Sp(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function zs(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=xp,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Pa="http://www.w3.org/1999/xhtml";const Us={svg:"http://www.w3.org/2000/svg",xhtml:Pa,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ri(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Us.hasOwnProperty(t)?{space:Us[t],local:e}:e}function Cp(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Pa&&t.documentElement.namespaceURI===Pa?t.createElement(e):t.createElementNS(o,e)}}function Rp(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hs(e){var t=ri(e);return(t.local?Rp:Cp)(t)}function Vp(){}function za(e){return e==null?Vp:function(){return this.querySelector(e)}}function Ap(e){typeof e!="function"&&(e=za(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=new Array(r),c,d,u=0;u<r;++u)(c=l[u])&&(d=e.call(c,c.__data__,u,l))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new ut(i,this._parents)}function Tp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Mp(){return[]}function Fs(e){return e==null?Mp:function(){return this.querySelectorAll(e)}}function Bp(e){return function(){return Tp(e.apply(this,arguments))}}function Dp(e){typeof e=="function"?e=Bp(e):e=Fs(e);for(var t=this._groups,o=t.length,i=[],a=[],l=0;l<o;++l)for(var r=t[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),a.push(c));return new ut(i,a)}function Gs(e){return function(){return this.matches(e)}}function Ys(e){return function(t){return t.matches(e)}}var Op=Array.prototype.find;function Lp(e){return function(){return Op.call(this.children,e)}}function Pp(){return this.firstElementChild}function zp(e){return this.select(e==null?Pp:Lp(typeof e=="function"?e:Ys(e)))}var Up=Array.prototype.filter;function Hp(){return Array.from(this.children)}function Fp(e){return function(){return Up.call(this.children,e)}}function Gp(e){return this.selectAll(e==null?Hp:Fp(typeof e=="function"?e:Ys(e)))}function Yp(e){typeof e!="function"&&(e=Gs(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new ut(i,this._parents)}function Ws(e){return new Array(e.length)}function Wp(){return new ut(this._enter||this._groups.map(Ws),this._parents)}function si(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}si.prototype={constructor:si,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Kp(e){return function(){return e}}function qp(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new si(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Xp(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(h[s]=p=r.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<f;++s)p=r.call(e,l[s],s,l)+"",(c=d.get(p))?(i[s]=c,c.__data__=l[s],d.delete(p)):o[s]=new si(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function jp(e){return e.__data__}function Zp(e,t){if(!arguments.length)return Array.from(this,jp);var o=t?Xp:qp,i=this._parents,a=this._groups;typeof e!="function"&&(e=Kp(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],h=f.length,p=Jp(e.call(u,u&&u.__data__,d,i)),m=p.length,b=s[d]=new Array(m),y=r[d]=new Array(m),_=c[d]=new Array(h);o(u,f,b,y,_,p,t);for(var V=0,g=0,v,ee;V<m;++V)if(v=b[V]){for(V>=g&&(g=V+1);!(ee=y[g])&&++g<m;);v._next=ee||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function Jp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Qp(){return new ut(this._exit||this._groups.map(Ws),this._parents)}function eh(e,t,o){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?l.remove():o(l),i&&a?i.merge(a).order():a}function th(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,h=s[c]=new Array(f),p,m=0;m<f;++m)(p=d[m]||u[m])&&(h[m]=p);for(;c<a;++c)s[c]=o[c];return new ut(s,this._parents)}function nh(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function oh(e){e||(e=ih);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var o=this._groups,i=o.length,a=new Array(i),l=0;l<i;++l){for(var r=o[l],s=r.length,c=a[l]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new ut(a,this._parents).order()}function ih(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ah(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function lh(){return Array.from(this)}function rh(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function sh(){let e=0;for(const t of this)++e;return e}function ch(){return!this.node()}function dh(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],l=0,r=a.length,s;l<r;++l)(s=a[l])&&e.call(s,s.__data__,l,a);return this}function uh(e){return function(){this.removeAttribute(e)}}function fh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mh(e,t){return function(){this.setAttribute(e,t)}}function ph(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function hh(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function yh(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function gh(e,t){var o=ri(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?fh:uh:typeof t=="function"?o.local?yh:hh:o.local?ph:mh)(o,t))}function Ks(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function bh(e){return function(){this.style.removeProperty(e)}}function _h(e,t,o){return function(){this.style.setProperty(e,t,o)}}function kh(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function wh(e,t,o){return arguments.length>1?this.each((t==null?bh:typeof t=="function"?kh:_h)(e,t,o??"")):Sn(this.node(),e)}function Sn(e,t){return e.style.getPropertyValue(t)||Ks(e).getComputedStyle(e,null).getPropertyValue(t)}function Eh(e){return function(){delete this[e]}}function vh(e,t){return function(){this[e]=t}}function Nh(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function $h(e,t){return arguments.length>1?this.each((t==null?Eh:typeof t=="function"?Nh:vh)(e,t)):this.node()[e]}function qs(e){return e.trim().split(/^|\s+/)}function Ua(e){return e.classList||new Xs(e)}function Xs(e){this._node=e,this._names=qs(e.getAttribute("class")||"")}Xs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function js(e,t){for(var o=Ua(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Zs(e,t){for(var o=Ua(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function xh(e){return function(){js(this,e)}}function Ih(e){return function(){Zs(this,e)}}function Sh(e,t){return function(){(t.apply(this,arguments)?js:Zs)(this,e)}}function Ch(e,t){var o=qs(e+"");if(arguments.length<2){for(var i=Ua(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Sh:t?xh:Ih)(o,t))}function Rh(){this.textContent=""}function Vh(e){return function(){this.textContent=e}}function Ah(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Th(e){return arguments.length?this.each(e==null?Rh:(typeof e=="function"?Ah:Vh)(e)):this.node().textContent}function Mh(){this.innerHTML=""}function Bh(e){return function(){this.innerHTML=e}}function Dh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Oh(e){return arguments.length?this.each(e==null?Mh:(typeof e=="function"?Dh:Bh)(e)):this.node().innerHTML}function Lh(){this.nextSibling&&this.parentNode.appendChild(this)}function Ph(){return this.each(Lh)}function zh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Uh(){return this.each(zh)}function Hh(e){var t=typeof e=="function"?e:Hs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Fh(){return null}function Gh(e,t){var o=typeof e=="function"?e:Hs(e),i=t==null?Fh:typeof t=="function"?t:za(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Yh(){var e=this.parentNode;e&&e.removeChild(this)}function Wh(){return this.each(Yh)}function Kh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Xh(e){return this.select(e?qh:Kh)}function jh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Zh(e){return function(t){e.call(this,t,this.__data__)}}function Jh(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Qh(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function ey(e,t,o){return function(){var i=this.__on,a,l=Zh(t);if(i){for(var r=0,s=i.length;r<s;++r)if((a=i[r]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=o),a.value=t;return}}this.addEventListener(e.type,l,o),a={type:e.type,name:e.name,value:t,listener:l,options:o},i?i.push(a):this.__on=[a]}}function ty(e,t,o){var i=Jh(e+""),a,l=i.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<l;++a)if((r=i[a]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?ey:Qh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Js(e,t,o){var i=Ks(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function ny(e,t){return function(){return Js(this,e,t)}}function oy(e,t){return function(){return Js(this,e,t.apply(this,arguments))}}function iy(e,t){return this.each((typeof t=="function"?oy:ny)(e,t))}function*ay(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length,r;a<l;++a)(r=i[a])&&(yield r)}var Qs=[null];function ut(e,t){this._groups=e,this._parents=t}function no(){return new ut([[document.documentElement]],Qs)}function ly(){return this}ut.prototype=no.prototype={constructor:ut,select:Ap,selectAll:Dp,selectChild:zp,selectChildren:Gp,filter:Yp,data:Zp,enter:Wp,exit:Qp,join:eh,merge:th,selection:ly,order:nh,sort:oh,call:ah,nodes:lh,node:rh,size:sh,empty:ch,each:dh,attr:gh,style:wh,property:$h,classed:Ch,text:Th,html:Oh,raise:Ph,lower:Uh,append:Hh,insert:Gh,remove:Wh,clone:Xh,datum:jh,on:ty,dispatch:iy,[Symbol.iterator]:ay};function ht(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],Qs)}function ry(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Et(e,t){if(e=ry(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const sy={passive:!1},oo={capture:!0,passive:!1};function Ha(e){e.stopImmediatePropagation()}function Cn(e){e.preventDefault(),e.stopImmediatePropagation()}function ec(e){var t=e.document.documentElement,o=ht(e).on("dragstart.drag",Cn,oo);"onselectstart"in t?o.on("selectstart.drag",Cn,oo):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function tc(e,t){var o=e.document.documentElement,i=ht(e).on("dragstart.drag",null);t&&(i.on("click.drag",Cn,oo),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const ci=e=>()=>e;function Fa(e,{sourceEvent:t,subject:o,target:i,identifier:a,active:l,x:r,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:r,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:u}})}Fa.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function cy(e){return!e.ctrlKey&&!e.button}function dy(){return this.parentNode}function uy(e,t){return t??{x:e.x,y:e.y}}function fy(){return navigator.maxTouchPoints||"ontouchstart"in this}function my(){var e=cy,t=dy,o=uy,i=fy,a={},l=ai("start","drag","end"),r=0,s,c,d,u,f=0;function h(v){v.on("mousedown.drag",p).filter(i).on("touchstart.drag",y).on("touchmove.drag",_,sy).on("touchend.drag touchcancel.drag",V).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(v,ee){if(!(u||!e.call(this,v,ee))){var x=g(this,t.call(this,v,ee),v,ee,"mouse");x&&(ht(v.view).on("mousemove.drag",m,oo).on("mouseup.drag",b,oo),ec(v.view),Ha(v),d=!1,s=v.clientX,c=v.clientY,x("start",v))}}function m(v){if(Cn(v),!d){var ee=v.clientX-s,x=v.clientY-c;d=ee*ee+x*x>f}a.mouse("drag",v)}function b(v){ht(v.view).on("mousemove.drag mouseup.drag",null),tc(v.view,d),Cn(v),a.mouse("end",v)}function y(v,ee){if(e.call(this,v,ee)){var x=v.changedTouches,O=t.call(this,v,ee),P=x.length,H,ne;for(H=0;H<P;++H)(ne=g(this,O,v,ee,x[H].identifier,x[H]))&&(Ha(v),ne("start",v,x[H]))}}function _(v){var ee=v.changedTouches,x=ee.length,O,P;for(O=0;O<x;++O)(P=a[ee[O].identifier])&&(Cn(v),P("drag",v,ee[O]))}function V(v){var ee=v.changedTouches,x=ee.length,O,P;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),O=0;O<x;++O)(P=a[ee[O].identifier])&&(Ha(v),P("end",v,ee[O]))}function g(v,ee,x,O,P,H){var ne=l.copy(),ce=Et(H||x,ee),L,oe,k;if((k=o.call(v,new Fa("beforestart",{sourceEvent:x,target:h,identifier:P,active:r,x:ce[0],y:ce[1],dx:0,dy:0,dispatch:ne}),O))!=null)return L=k.x-ce[0]||0,oe=k.y-ce[1]||0,function Y(S,F,U){var le=ce,E;switch(S){case"start":a[P]=Y,E=r++;break;case"end":delete a[P],--r;case"drag":ce=Et(U||F,ee),E=r;break}ne.call(S,v,new Fa(S,{sourceEvent:F,subject:k,target:h,identifier:P,active:E,x:ce[0]+L,y:ce[1]+oe,dx:ce[0]-le[0],dy:ce[1]-le[1],dispatch:ne}),O)}}return h.filter=function(v){return arguments.length?(e=typeof v=="function"?v:ci(!!v),h):e},h.container=function(v){return arguments.length?(t=typeof v=="function"?v:ci(v),h):t},h.subject=function(v){return arguments.length?(o=typeof v=="function"?v:ci(v),h):o},h.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:ci(!!v),h):i},h.on=function(){var v=l.on.apply(l,arguments);return v===l?h:v},h.clickDistance=function(v){return arguments.length?(f=(v=+v)*v,h):Math.sqrt(f)},h}function Ga(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function nc(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function io(){}var ao=.7,di=1/ao,Rn="\\s*([+-]?\\d+)\\s*",lo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",py=/^#([0-9a-f]{3,8})$/,hy=new RegExp(`^rgb\\(${Rn},${Rn},${Rn}\\)$`),yy=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),gy=new RegExp(`^rgba\\(${Rn},${Rn},${Rn},${lo}\\)$`),by=new RegExp(`^rgba\\(${vt},${vt},${vt},${lo}\\)$`),_y=new RegExp(`^hsl\\(${lo},${vt},${vt}\\)$`),ky=new RegExp(`^hsla\\(${lo},${vt},${vt},${lo}\\)$`),oc={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};Ga(io,tn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ic,formatHex:ic,formatHex8:wy,formatHsl:Ey,formatRgb:ac,toString:ac});function ic(){return this.rgb().formatHex()}function wy(){return this.rgb().formatHex8()}function Ey(){return dc(this).formatHsl()}function ac(){return this.rgb().formatRgb()}function tn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=py.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?lc(t):o===3?new st(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?ui(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ui(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=hy.exec(e))?new st(t[1],t[2],t[3],1):(t=yy.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=gy.exec(e))?ui(t[1],t[2],t[3],t[4]):(t=by.exec(e))?ui(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_y.exec(e))?cc(t[1],t[2]/100,t[3]/100,1):(t=ky.exec(e))?cc(t[1],t[2]/100,t[3]/100,t[4]):oc.hasOwnProperty(e)?lc(oc[e]):e==="transparent"?new st(NaN,NaN,NaN,0):null}function lc(e){return new st(e>>16&255,e>>8&255,e&255,1)}function ui(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function vy(e){return e instanceof io||(e=tn(e)),e?(e=e.rgb(),new st(e.r,e.g,e.b,e.opacity)):new st}function Ya(e,t,o,i){return arguments.length===1?vy(e):new st(e,t,o,i??1)}function st(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Ga(st,Ya,nc(io,{brighter(e){return e=e==null?di:Math.pow(di,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ao:Math.pow(ao,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new st(nn(this.r),nn(this.g),nn(this.b),fi(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:rc,formatHex:rc,formatHex8:Ny,formatRgb:sc,toString:sc}));function rc(){return`#${on(this.r)}${on(this.g)}${on(this.b)}`}function Ny(){return`#${on(this.r)}${on(this.g)}${on(this.b)}${on((isNaN(this.opacity)?1:this.opacity)*255)}`}function sc(){const e=fi(this.opacity);return`${e===1?"rgb(":"rgba("}${nn(this.r)}, ${nn(this.g)}, ${nn(this.b)}${e===1?")":`, ${e})`}`}function fi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function on(e){return e=nn(e),(e<16?"0":"")+e.toString(16)}function cc(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new yt(e,t,o,i)}function dc(e){if(e instanceof yt)return new yt(e.h,e.s,e.l,e.opacity);if(e instanceof io||(e=tn(e)),!e)return new yt;if(e instanceof yt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),l=Math.max(t,o,i),r=NaN,s=l-a,c=(l+a)/2;return s?(t===l?r=(o-i)/s+(o<i)*6:o===l?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?l+a:2-l-a,r*=60):s=c>0&&c<1?0:r,new yt(r,s,c,e.opacity)}function $y(e,t,o,i){return arguments.length===1?dc(e):new yt(e,t,o,i??1)}function yt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Ga(yt,$y,nc(io,{brighter(e){return e=e==null?di:Math.pow(di,e),new yt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ao:Math.pow(ao,e),new yt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new st(Wa(e>=240?e-240:e+120,a,i),Wa(e,a,i),Wa(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new yt(uc(this.h),mi(this.s),mi(this.l),fi(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=fi(this.opacity);return`${e===1?"hsl(":"hsla("}${uc(this.h)}, ${mi(this.s)*100}%, ${mi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function uc(e){return e=(e||0)%360,e<0?e+360:e}function mi(e){return Math.max(0,Math.min(1,e||0))}function Wa(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Ka=e=>()=>e;function xy(e,t){return function(o){return e+o*t}}function Iy(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function Sy(e){return(e=+e)==1?fc:function(t,o){return o-t?Iy(t,o,e):Ka(isNaN(t)?o:t)}}function fc(e,t){var o=t-e;return o?xy(e,o):Ka(isNaN(e)?t:e)}const pi=(function e(t){var o=Sy(t);function i(a,l){var r=o((a=Ya(a)).r,(l=Ya(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=fc(a.opacity,l.opacity);return function(u){return a.r=r(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Cy(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),a;return function(l){for(a=0;a<o;++a)i[a]=e[a]*(1-l)+t[a]*l;return i}}function Ry(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Vy(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),l=new Array(o),r;for(r=0;r<i;++r)a[r]=ro(e[r],t[r]);for(;r<o;++r)l[r]=t[r];return function(s){for(r=0;r<i;++r)l[r]=a[r](s);return l}}function Ay(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function Nt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Ty(e,t){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?o[a]=ro(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var qa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xa=new RegExp(qa.source,"g");function My(e){return function(){return e}}function By(e){return function(t){return e(t)+""}}function mc(e,t){var o=qa.lastIndex=Xa.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=qa.exec(e))&&(a=Xa.exec(t));)(l=a.index)>o&&(l=t.slice(o,l),s[r]?s[r]+=l:s[++r]=l),(i=i[0])===(a=a[0])?s[r]?s[r]+=a:s[++r]=a:(s[++r]=null,c.push({i:r,x:Nt(i,a)})),o=Xa.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?By(c[0].x):My(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}function ro(e,t){var o=typeof t,i;return t==null||o==="boolean"?Ka(t):(o==="number"?Nt:o==="string"?(i=tn(t))?(t=i,pi):mc:t instanceof tn?pi:t instanceof Date?Ay:Ry(t)?Cy:Array.isArray(t)?Vy:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ty:Nt)(e,t)}var pc=180/Math.PI,ja={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hc(e,t,o,i,a,l){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*pc,skewX:Math.atan(c)*pc,scaleX:r,scaleY:s}}var hi;function Dy(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ja:hc(t.a,t.b,t.c,t.d,t.e,t.f)}function Oy(e){return e==null||(hi||(hi=document.createElementNS("http://www.w3.org/2000/svg","g")),hi.setAttribute("transform",e),!(e=hi.transform.baseVal.consolidate()))?ja:(e=e.matrix,hc(e.a,e.b,e.c,e.d,e.e,e.f))}function yc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,p,m){if(d!==f||u!==h){var b=p.push("translate(",null,t,null,o);m.push({i:b-4,x:Nt(d,f)},{i:b-2,x:Nt(u,h)})}else(f||h)&&p.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:Nt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:Nt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,p,m){if(d!==f||u!==h){var b=p.push(a(p)+"scale(",null,",",null,")");m.push({i:b-4,x:Nt(d,f)},{i:b-2,x:Nt(u,h)})}else(f!==1||h!==1)&&p.push(a(p)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(p){for(var m=-1,b=h.length,y;++m<b;)f[(y=h[m]).i]=y.x(p);return f.join("")}}}var Ly=yc(Dy,"px, ","px)","deg)"),Py=yc(Oy,", ",")",")"),zy=1e-12;function gc(e){return((e=Math.exp(e))+1/e)/2}function Uy(e){return((e=Math.exp(e))-1/e)/2}function Hy(e){return((e=Math.exp(2*e))-1)/(e+1)}const yi=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],h=r[2],p=u-s,m=f-c,b=p*p+m*m,y,_;if(b<zy)_=Math.log(h/d)/t,y=function(O){return[s+O*p,c+O*m,d*Math.exp(t*O*_)]};else{var V=Math.sqrt(b),g=(h*h-d*d+i*b)/(2*d*o*V),v=(h*h-d*d-i*b)/(2*h*o*V),ee=Math.log(Math.sqrt(g*g+1)-g),x=Math.log(Math.sqrt(v*v+1)-v);_=(x-ee)/t,y=function(O){var P=O*_,H=gc(ee),ne=d/(o*V)*(H*Hy(t*P+ee)-Uy(ee));return[s+ne*p,c+ne*m,d*H/gc(t*P+ee)]}}return y.duration=_*1e3*t/Math.SQRT2,y}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Vn=0,so=0,co=0,bc=1e3,gi,uo,bi=0,an=0,_i=0,fo=typeof performance=="object"&&performance.now?performance:Date,_c=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Za(){return an||(_c(Fy),an=fo.now()+_i)}function Fy(){an=0}function ki(){this._call=this._time=this._next=null}ki.prototype=kc.prototype={constructor:ki,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Za():+o)+(t==null?0:+t),!this._next&&uo!==this&&(uo?uo._next=this:gi=this,uo=this),this._call=e,this._time=o,Ja()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ja())}};function kc(e,t,o){var i=new ki;return i.restart(e,t,o),i}function Gy(){Za(),++Vn;for(var e=gi,t;e;)(t=an-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Vn}function wc(){an=(bi=fo.now())+_i,Vn=so=0;try{Gy()}finally{Vn=0,Wy(),an=0}}function Yy(){var e=fo.now(),t=e-bi;t>bc&&(_i-=t,bi=e)}function Wy(){for(var e,t=gi,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:gi=o);uo=e,Ja(i)}function Ja(e){if(!Vn){so&&(so=clearTimeout(so));var t=e-an;t>24?(e<1/0&&(so=setTimeout(wc,e-fo.now()-_i)),co&&(co=clearInterval(co))):(co||(bi=fo.now(),co=setInterval(Yy,bc)),Vn=1,_c(wc))}}function Ec(e,t,o){var i=new ki;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Ky=ai("start","end","cancel","interrupt"),qy=[],vc=0,Nc=1,Qa=2,wi=3,$c=4,el=5,Ei=6;function vi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Xy(e,o,{name:t,index:i,group:a,on:Ky,tween:qy,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:vc})}function tl(e,t){var o=gt(e,t);if(o.state>vc)throw new Error("too late; already scheduled");return o}function $t(e,t){var o=gt(e,t);if(o.state>wi)throw new Error("too late; already running");return o}function gt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Xy(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=kc(l,0,o.time);function l(d){o.state=Nc,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,p;if(o.state!==Nc)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===wi)return Ec(r);p.state===$c?(p.state=Ei,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=Ei,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Ec(function(){o.state===wi&&(o.state=$c,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Qa,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Qa){for(o.state=wi,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=p);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=el,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===el&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ei,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ni(e,t){var o=e.__transition,i,a,l=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){l=!1;continue}a=i.state>Qa&&i.state<el,i.state=Ei,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function jy(e){return this.each(function(){Ni(this,e)})}function Zy(e,t){var o,i;return function(){var a=$t(this,e),l=a.tween;if(l!==o){i=o=l;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}a.tween=i}}function Jy(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=$t(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function Qy(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=gt(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?Zy:Jy)(o,e,t))}function nl(e,t,o){var i=e._id;return e.each(function(){var a=$t(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return gt(a,i).value[t]}}function xc(e,t){var o;return(typeof t=="number"?Nt:t instanceof tn?pi:(o=tn(t))?(t=o,pi):mc)(e,t)}function eg(e){return function(){this.removeAttribute(e)}}function tg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ng(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttribute(e);return r===a?null:r===i?l:l=t(i=r,o)}}function og(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?l:l=t(i=r,o)}}function ig(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function ag(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function lg(e,t){var o=ri(e),i=o==="transform"?Py:xc;return this.attrTween(e,typeof t=="function"?(o.local?ag:ig)(o,i,nl(this,"attr."+e,t)):t==null?(o.local?tg:eg)(o):(o.local?og:ng)(o,i,t))}function rg(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function sg(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function cg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&sg(e,l)),o}return a._value=t,a}function dg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&rg(e,l)),o}return a._value=t,a}function ug(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=ri(e);return this.tween(o,(i.local?cg:dg)(i,t))}function fg(e,t){return function(){tl(this,e).delay=+t.apply(this,arguments)}}function mg(e,t){return t=+t,function(){tl(this,e).delay=t}}function pg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fg:mg)(t,e)):gt(this.node(),t).delay}function hg(e,t){return function(){$t(this,e).duration=+t.apply(this,arguments)}}function yg(e,t){return t=+t,function(){$t(this,e).duration=t}}function gg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hg:yg)(t,e)):gt(this.node(),t).duration}function bg(e,t){if(typeof t!="function")throw new Error;return function(){$t(this,e).ease=t}}function _g(e){var t=this._id;return arguments.length?this.each(bg(t,e)):gt(this.node(),t).ease}function kg(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;$t(this,e).ease=o}}function wg(e){if(typeof e!="function")throw new Error;return this.each(kg(this._id,e))}function Eg(e){typeof e!="function"&&(e=Gs(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Tt(i,this._parents,this._name,this._id)}function vg(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||d[p])&&(f[p]=h);for(;s<i;++s)r[s]=t[s];return new Tt(r,this._parents,this._name,this._id)}function Ng(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function $g(e,t,o){var i,a,l=Ng(t)?tl:$t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function xg(e,t){var o=this._id;return arguments.length<2?gt(this.node(),o).on.on(e):this.each($g(o,e,t))}function Ig(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Sg(){return this.on("end.remove",Ig(this._id))}function Cg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=za(e));for(var i=this._groups,a=i.length,l=new Array(a),r=0;r<a;++r)for(var s=i[r],c=s.length,d=l[r]=new Array(c),u,f,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),d[h]=f,vi(d[h],t,o,h,d,gt(u,o)));return new Tt(l,this._parents,t,o)}function Rg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Fs(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),p,m=gt(u,o),b=0,y=h.length;b<y;++b)(p=h[b])&&vi(p,t,o,b,h,m);l.push(h),r.push(u)}return new Tt(l,r,t,o)}var Vg=no.prototype.constructor;function Ag(){return new Vg(this._groups,this._parents)}function Tg(e,t){var o,i,a;return function(){var l=Sn(this,e),r=(this.style.removeProperty(e),Sn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Ic(e){return function(){this.style.removeProperty(e)}}function Mg(e,t,o){var i,a=o+"",l;return function(){var r=Sn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Bg(e,t,o){var i,a,l;return function(){var r=Sn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Sn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Dg(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=$t(this,e),d=c.on,u=c.value[l]==null?s||(s=Ic(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Og(e,t,o){var i=(e+="")=="transform"?Ly:xc;return t==null?this.styleTween(e,Tg(e,i)).on("end.style."+e,Ic(e)):typeof t=="function"?this.styleTween(e,Bg(e,i,nl(this,"style."+e,t))).each(Dg(this._id,e)):this.styleTween(e,Mg(e,i,t),o).on("end.style."+e,null)}function Lg(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Pg(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Lg(e,r,o)),i}return l._value=t,l}function zg(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,Pg(e,t,o??""))}function Ug(e){return function(){this.textContent=e}}function Hg(e){return function(){var t=e(this);this.textContent=t??""}}function Fg(e){return this.tween("text",typeof e=="function"?Hg(nl(this,"text",e)):Ug(e==null?"":e+""))}function Gg(e){return function(t){this.textContent=e.call(this,t)}}function Yg(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Gg(a)),t}return i._value=e,i}function Wg(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Yg(e))}function Kg(){for(var e=this._name,t=this._id,o=Sc(),i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=gt(c,t);vi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Tt(i,this._parents,e,o)}function qg(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(l,r){var s={value:r},c={value:function(){--a===0&&l()}};o.each(function(){var d=$t(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&l()})}var Xg=0;function Tt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Sc(){return++Xg}var Mt=no.prototype;Tt.prototype={constructor:Tt,select:Cg,selectAll:Rg,selectChild:Mt.selectChild,selectChildren:Mt.selectChildren,filter:Eg,merge:vg,selection:Ag,transition:Kg,call:Mt.call,nodes:Mt.nodes,node:Mt.node,size:Mt.size,empty:Mt.empty,each:Mt.each,on:xg,attr:lg,attrTween:ug,style:Og,styleTween:zg,text:Fg,textTween:Wg,remove:Sg,tween:Qy,delay:pg,duration:gg,ease:_g,easeVarying:wg,end:qg,[Symbol.iterator]:Mt[Symbol.iterator]};function jg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Zg={time:null,delay:0,duration:250,ease:jg};function Jg(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function Qg(e){var t,o;e instanceof Tt?(t=e._id,e=e._name):(t=Sc(),(o=Zg).time=Za(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&vi(c,e,t,d,r,o||Jg(c,t));return new Tt(i,this._parents,e,t)}no.prototype.interrupt=jy,no.prototype.transition=Qg;const $i=e=>()=>e;function eb(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Bt(e,t,o){this.k=e,this.x=t,this.y=o}Bt.prototype={constructor:Bt,scale:function(e){return e===1?this:new Bt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Bt(this.k,this.x+this.k*e,this.y+this.k*t)},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 An=new Bt(1,0,0);Bt.prototype;function ol(e){e.stopImmediatePropagation()}function mo(e){e.preventDefault(),e.stopImmediatePropagation()}function tb(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function nb(){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 Cc(){return this.__zoom||An}function ob(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ib(){return navigator.maxTouchPoints||"ontouchstart"in this}function ab(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],l=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),r>l?(l+r)/2:Math.min(0,l)||Math.max(0,r))}function lb(){var e=tb,t=nb,o=ab,i=ob,a=ib,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=yi,d=ai("start","zoom","end"),u,f,h,p=500,m=150,b=0,y=10;function _(k){k.property("__zoom",Cc).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",ce).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,Y,S,F){var U=k.selection?k.selection():k;U.property("__zoom",Cc),k!==U?ee(k,Y,S,F):U.interrupt().each(function(){x(this,arguments).event(F).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},_.scaleBy=function(k,Y,S,F){_.scaleTo(k,function(){var U=this.__zoom.k,le=typeof Y=="function"?Y.apply(this,arguments):Y;return U*le},S,F)},_.scaleTo=function(k,Y,S,F){_.transform(k,function(){var U=t.apply(this,arguments),le=this.__zoom,E=S==null?v(U):typeof S=="function"?S.apply(this,arguments):S,K=le.invert(E),re=typeof Y=="function"?Y.apply(this,arguments):Y;return o(g(V(le,re),E,K),U,r)},S,F)},_.translateBy=function(k,Y,S,F){_.transform(k,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),r)},null,F)},_.translateTo=function(k,Y,S,F,U){_.transform(k,function(){var le=t.apply(this,arguments),E=this.__zoom,K=F==null?v(le):typeof F=="function"?F.apply(this,arguments):F;return o(An.translate(K[0],K[1]).scale(E.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),le,r)},F,U)};function V(k,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===k.k?k:new Bt(Y,k.x,k.y)}function g(k,Y,S){var F=Y[0]-S[0]*k.k,U=Y[1]-S[1]*k.k;return F===k.x&&U===k.y?k:new Bt(k.k,F,U)}function v(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function ee(k,Y,S,F){k.on("start.zoom",function(){x(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(F).end()}).tween("zoom",function(){var U=this,le=arguments,E=x(U,le).event(F),K=t.apply(U,le),re=S==null?v(K):typeof S=="function"?S.apply(U,le):S,pe=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),ye=U.__zoom,ue=typeof Y=="function"?Y.apply(U,le):Y,fe=c(ye.invert(re).concat(pe/ye.k),ue.invert(re).concat(pe/ue.k));return function(ge){if(ge===1)ge=ue;else{var Ee=fe(ge),Re=pe/Ee[2];ge=new Bt(Re,re[0]-Ee[0]*Re,re[1]-Ee[1]*Re)}E.zoom(null,ge)}})}function x(k,Y,S){return!S&&k.__zooming||new O(k,Y)}function O(k,Y){this.that=k,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,Y),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,Y){return this.mouse&&k!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var Y=ht(this.that).datum();d.call(k,this.that,new eb(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),Y)}};function P(k,...Y){if(!e.apply(this,arguments))return;var S=x(this,Y).event(k),F=this.__zoom,U=Math.max(l[0],Math.min(l[1],F.k*Math.pow(2,i.apply(this,arguments)))),le=Et(k);if(S.wheel)(S.mouse[0][0]!==le[0]||S.mouse[0][1]!==le[1])&&(S.mouse[1]=F.invert(S.mouse[0]=le)),clearTimeout(S.wheel);else{if(F.k===U)return;S.mouse=[le,F.invert(le)],Ni(this),S.start()}mo(k),S.wheel=setTimeout(E,m),S.zoom("mouse",o(g(V(F,U),S.mouse[0],S.mouse[1]),S.extent,r));function E(){S.wheel=null,S.end()}}function H(k,...Y){if(h||!e.apply(this,arguments))return;var S=k.currentTarget,F=x(this,Y,!0).event(k),U=ht(k.view).on("mousemove.zoom",re,!0).on("mouseup.zoom",pe,!0),le=Et(k,S),E=k.clientX,K=k.clientY;ec(k.view),ol(k),F.mouse=[le,this.__zoom.invert(le)],Ni(this),F.start();function re(ye){if(mo(ye),!F.moved){var ue=ye.clientX-E,fe=ye.clientY-K;F.moved=ue*ue+fe*fe>b}F.event(ye).zoom("mouse",o(g(F.that.__zoom,F.mouse[0]=Et(ye,S),F.mouse[1]),F.extent,r))}function pe(ye){U.on("mousemove.zoom mouseup.zoom",null),tc(ye.view,F.moved),mo(ye),F.event(ye).end()}}function ne(k,...Y){if(e.apply(this,arguments)){var S=this.__zoom,F=Et(k.changedTouches?k.changedTouches[0]:k,this),U=S.invert(F),le=S.k*(k.shiftKey?.5:2),E=o(g(V(S,le),F,U),t.apply(this,Y),r);mo(k),s>0?ht(this).transition().duration(s).call(ee,E,F,k):ht(this).call(_.transform,E,F,k)}}function ce(k,...Y){if(e.apply(this,arguments)){var S=k.touches,F=S.length,U=x(this,Y,k.changedTouches.length===F).event(k),le,E,K,re;for(ol(k),E=0;E<F;++E)K=S[E],re=Et(K,this),re=[re,this.__zoom.invert(re),K.identifier],U.touch0?!U.touch1&&U.touch0[2]!==re[2]&&(U.touch1=re,U.taps=0):(U.touch0=re,le=!0,U.taps=1+!!u);u&&(u=clearTimeout(u)),le&&(U.taps<2&&(f=re[0],u=setTimeout(function(){u=null},p)),Ni(this),U.start())}}function L(k,...Y){if(this.__zooming){var S=x(this,Y).event(k),F=k.changedTouches,U=F.length,le,E,K,re;for(mo(k),le=0;le<U;++le)E=F[le],K=Et(E,this),S.touch0&&S.touch0[2]===E.identifier?S.touch0[0]=K:S.touch1&&S.touch1[2]===E.identifier&&(S.touch1[0]=K);if(E=S.that.__zoom,S.touch1){var pe=S.touch0[0],ye=S.touch0[1],ue=S.touch1[0],fe=S.touch1[1],ge=(ge=ue[0]-pe[0])*ge+(ge=ue[1]-pe[1])*ge,Ee=(Ee=fe[0]-ye[0])*Ee+(Ee=fe[1]-ye[1])*Ee;E=V(E,Math.sqrt(ge/Ee)),K=[(pe[0]+ue[0])/2,(pe[1]+ue[1])/2],re=[(ye[0]+fe[0])/2,(ye[1]+fe[1])/2]}else if(S.touch0)K=S.touch0[0],re=S.touch0[1];else return;S.zoom("touch",o(g(E,K,re),S.extent,r))}}function oe(k,...Y){if(this.__zooming){var S=x(this,Y).event(k),F=k.changedTouches,U=F.length,le,E;for(ol(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),le=0;le<U;++le)E=F[le],S.touch0&&S.touch0[2]===E.identifier?delete S.touch0:S.touch1&&S.touch1[2]===E.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(E=Et(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<y)){var K=ht(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:$i(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:$i(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:$i(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:$i([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),_):t},_.scaleExtent=function(k){return arguments.length?(l[0]=+k[0],l[1]=+k[1],_):[l[0],l[1]]},_.translateExtent=function(k){return arguments.length?(r[0][0]=+k[0][0],r[1][0]=+k[1][0],r[0][1]=+k[0][1],r[1][1]=+k[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(k){return arguments.length?(o=k,_):o},_.duration=function(k){return arguments.length?(s=+k,_):s},_.interpolate=function(k){return arguments.length?(c=k,_):c},_.on=function(){var k=d.on.apply(d,arguments);return k===d?_:k},_.clickDistance=function(k){return arguments.length?(b=(k=+k)*k,_):Math.sqrt(b)},_.tapDistance=function(k){return arguments.length?(y=+k,_):y},_}var Se=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Se||{}),il=(e=>(e.Partial="partial",e.Full="full",e))(il||{}),ln=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ln||{}),Dt=(e=>(e.Strict="strict",e.Loose="loose",e))(Dt||{}),al=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(al||{}),po=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(po||{}),Rc=(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))(Rc||{});const rb=["INPUT","SELECT","TEXTAREA"],sb=typeof document<"u"?document:null;function ll(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,l=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return rb.includes(i==null?void 0:i.nodeName)||a||!!l}function cb(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Vc(e,t,o,i){const a=t.replace("+",`
5
5
  `).replace(`
6
6
 
7
7
  `,`
8
8
  +`).split(`
9
- `).map(r=>r.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const l=a.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),l}function cb(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=db(o.code,e);return Array.isArray(e)?e.some(a=>Ac(o[i],a,t,o.type==="keyup")):Ac(o[i],e,t,o.type==="keyup")}}function db(e,t){return t.includes(e)?"code":"key"}function ho(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??rb),i=n.shallowRef(n.toValue(e)===!0);let a=!1;const l=new Set;let r=c(n.toValue(e));n.watch(()=>n.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),r=c(d)},{immediate:!0}),Ps(["blur","contextmenu"],s),zs((...d)=>r(...d),d=>{var u,f;const h=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=sb(d),(!a||a&&!h)&&ll(d))return;const g=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,b=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!m&&(a||!b)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),zs((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&ll(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,l.clear(),i.value=n.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?cb(d,l):d}return i}const Tc="vue-flow__node-desc",Mc="vue-flow__edge-desc",ub="vue-flow__aria-live",Bc=["Enter"," ","Escape"],Tn={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 xi(e,t){const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(o*i)}function Ii(e){return{width:e.offsetWidth,height:e.offsetHeight}}function rn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Dc(e,t){return{x:rn(e.x,t[0][0],t[1][0]),y:rn(e.y,t[0][1],t[1][1])}}function Oc(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Gt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function sn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Gt(e)}function yo(e){return sn(e)&&"computedPosition"in e}function Si(e){return!Number.isNaN(e)&&Number.isFinite(e)}function fb(e){return Si(e.width)&&Si(e.height)&&Si(e.x)&&Si(e.y)}function mb(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.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:Xe(e.data)?e.data:{},events:n.markRaw(Xe(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function Lc(e,t,o){var i,a;const l={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.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:Xe(e.data)?e.data:{},events:n.markRaw(Xe(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??l,e,{id:e.id.toString()})}function Pc(e,t,o,i){const a=typeof e=="string"?e:e.id,l=new Set,r=i==="source"?"target":"source";for(const s of o)s[r]===a&&l.add(s[i]);return t.filter(s=>l.has(s.id))}function pb(...e){if(e.length===3){const[l,r,s]=e;return Pc(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Gt(l)&&l.source===i).map(l=>o.find(r=>sn(r)&&r.id===l.target))}function hb(...e){if(e.length===3){const[l,r,s]=e;return Pc(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Gt(l)&&l.target===i).map(l=>o.find(r=>sn(r)&&r.id===l.source))}function zc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function yb(e,t){return t.some(o=>Gt(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 go({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function bo({x:e,y:t},{x:o,y:i,zoom:a},l=!1,r=[1,1]){const s={x:(e-o)/a,y:(t-i)/a};return l?Ri(s,r):s}function Uc(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function Ci({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function Hc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function gb(e,t){return Hc(Uc(Ci(e),Ci(t)))}function rl(e){let t={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 i=e[o];t=Uc(t,Ci({...i.computedPosition,...i.dimensions}))}return Hc(t)}function Fc(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...bo(t,o),width:t.width/o.zoom,height:t.height/o.zoom},r=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,f=c.width??s.width??null,h=c.height??s.height??null;if(a&&!d||u)continue;const m=xi(l,$i(s)),p=f===null||h===null,g=i&&m>0,b=(f??0)*(h??0);(p||g||m>=b||s.dragging)&&r.push(s)}return r}function cn(e,t){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return t.filter(i=>o.has(i.source)||o.has(i.target))}function Mn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(t*o*.01)}return wo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function bb(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Mn(e,o),a=Mn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Mn(e.top??e.y??0,o),a=Mn(e.bottom??e.y??0,o),l=Mn(e.left??e.x??0,t),r=Mn(e.right??e.x??0,t);return{top:i,right:r,bottom:a,left:l,x:l+r,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function _b(e,t,o,i,a,l){const{x:r,y:s}=go(e,{x:t,y:o,zoom:i}),{x:c,y:d}=go({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=a-c,f=l-d;return{left:Math.floor(r),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(f)}}function Gc(e,t,o,i,a,l=.1){const r=bb(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=rn(d,i,a),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*u,p=o/2-h*u,g=_b(e,m,p,u,t,o),b={left:Math.min(g.left-r.left,0),top:Math.min(g.top-r.top,0),right:Math.min(g.right-r.right,0),bottom:Math.min(g.bottom-r.bottom,0)};return{x:m-b.left+b.right,y:p-b.top+b.bottom,zoom:u}}function kb(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Yc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Yc(o,t):!1}function _o(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function sl(e){const t=e.ctrlKey&&ko()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Wc(e,t,o){return e<t?rn(Math.abs(e-t),1,t)/t:e>o?-rn(Math.abs(e-o),1,t)/t:0}function Kc(e,t,o=15,i=40){const a=Wc(e.x,i,t.width-i)*o,l=Wc(e.y,i,t.height-i)*o;return[a,l]}function cl(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof t.style=="function"?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.dimensions.height}px`,o>0)if(typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+i}px`}else a.height+=i;if(e.position.x<0){const l=Math.abs(e.position.x);if(t.position.x=t.position.x-l,typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+l}px`}else a.width+=l;e.position.x=0}if(e.position.y<0){const l=Math.abs(e.position.y);if(t.position.y=t.position.y-l,typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+l}px`}else a.height+=l;e.position.y=0}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),typeof t.style=="function"?t.style=l=>{const r=t.style;return{...r(l),...a}}:t.style={...t.style,...a}}}}function qc(e,t){var o,i;const a=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of a)if(r.type==="add")t.findIndex(c=>c.id===r.item.id)===-1&&t.push(r.item);else if(r.type==="remove"){const s=t.findIndex(c=>c.id===r.id);s!==-1&&t.splice(s,1)}const l=t.map(r=>r.id);for(const r of t)for(const s of e)if(s.id===r.id)switch(s.type){case"select":r.selected=s.selected;break;case"position":if(yo(r)&&(typeof s.position<"u"&&(r.position=s.position),typeof s.dragging<"u"&&(r.dragging=s.dragging),r.expandParent&&r.parentNode)){const c=t[l.indexOf(r.parentNode)];c&&yo(c)&&cl(r,c)}break;case"dimensions":if(yo(r)&&(typeof s.dimensions<"u"&&(r.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(r.style={...r.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(r.resizing=s.resizing),r.expandParent&&r.parentNode)){const c=t[l.indexOf(r.parentNode)];c&&yo(c)&&(!!c.dimensions.width&&!!c.dimensions.height?cl(r,c):n.nextTick(()=>{cl(r,c)}))}break}return t}function Yt(e,t){return{id:e,type:"select",selected:t}}function Xc(e){return{item:e,type:"add"}}function jc(e){return{id:e,type:"remove"}}function Zc(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Wt(e,t=new Set,o=!1){const i=[];for(const[a,l]of e){const r=t.has(a);!(l.selected===void 0&&!r)&&l.selected!==r&&(o&&(l.selected=r),i.push(Yt(l.id,r)))}return i}const Jc=()=>{};function xe(e){const t=new Set;let o=Jc,i=()=>!1;const a=()=>t.size>0||i(),l=h=>{o=h},r=()=>{o=Jc},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{t.delete(h)};return{on:h=>{t.add(h);const m=()=>d(h);return to(m),{off:m}},off:d,trigger:h=>{const m=[o];return a()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(p=>p(h)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function Qc(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function wb(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Yc(c,e))&&(c.draggable||t&&typeof c.draggable>"u")&&e.get(s)&&r.set(s,{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:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(r.values())}function dl({id:e,dragItems:t,findNode:o}){const i=[];for(const a of t){const l=o(a.id);l&&i.push(l)}return[e?i.find(a=>a.id===e):i[0],i]}function ed(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 Eb(e,t,o){const[i,a,l,r]=typeof e!="string"?ed(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+r,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-l]]:!1}function vb(e,t,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const l=Eb(a,e,i);l&&(a=l)}else t(new Qe(qe.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const l=(i==null?void 0:i.computedPosition.x)||0,r=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+l,a[0][1]+r],[a[1][0]+l,a[1][1]+r]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[l,r,s,c]=ed(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+l],[a.range[1][0]+d-r,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function Nb({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function ul(e,t,o,i,a){const l=Nb(e.dimensions,vb(e,o,i,a)),r=Dc(t,l);return{position:{x:r.x-((a==null?void 0:a.computedPosition.x)||0),y:r.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:r}}function Bn(e,t,o=Se.Left,i=!1){const a=((t==null?void 0:t.x)??0)+e.computedPosition.x,l=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:s}=t??Sb(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case Se.Top:return{x:a+r/2,y:l};case Se.Right:return{x:a+r,y:l+s/2};case Se.Bottom:return{x:a+r/2,y:l+s};case Se.Left:return{x:a,y:l+s/2}}}function td(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function $b({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:l,width:r,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.y+l)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=Ci({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:r/c.zoom,height:s/c.zoom}),f=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),h=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*h)>0}function xb(e,t,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const l=t(e.source),r=t(e.target);return!l||!r?0:(o&&(a=i?e.zIndex:Math.max(l.computedPosition.z||0,r.computedPosition.z||0)),a)}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 nd={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
9
+ `).map(r=>r.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const l=a.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),l}function db(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=ub(o.code,e);return Array.isArray(e)?e.some(a=>Vc(o[i],a,t,o.type==="keyup")):Vc(o[i],e,t,o.type==="keyup")}}function ub(e,t){return t.includes(e)?"code":"key"}function ho(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??sb),i=n.shallowRef(n.toValue(e)===!0);let a=!1;const l=new Set;let r=c(n.toValue(e));n.watch(()=>n.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),r=c(d)},{immediate:!0}),Ls(["blur","contextmenu"],s),Ps((...d)=>r(...d),d=>{var u,f;const h=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,p=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=cb(d),(!a||a&&!h)&&ll(d))return;const b=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,y=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!p&&(a||!y)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Ps((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&ll(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,l.clear(),i.value=n.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?db(d,l):d}return i}const Ac="vue-flow__node-desc",Tc="vue-flow__edge-desc",fb="vue-flow__aria-live",Mc=["Enter"," ","Escape"],Tn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function xi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ii(e,t){const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(o*i)}function Si(e){return{width:e.offsetWidth,height:e.offsetHeight}}function rn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Bc(e,t){return{x:rn(e.x,t[0][0],t[1][0]),y:rn(e.y,t[0][1],t[1][1])}}function Dc(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Gt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function sn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Gt(e)}function yo(e){return sn(e)&&"computedPosition"in e}function Ci(e){return!Number.isNaN(e)&&Number.isFinite(e)}function mb(e){return Ci(e.width)&&Ci(e.height)&&Ci(e.x)&&Ci(e.y)}function pb(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.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:Xe(e.data)?e.data:{},events:n.markRaw(Xe(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function Oc(e,t,o){var i,a;const l={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.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:Xe(e.data)?e.data:{},events:n.markRaw(Xe(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??l,e,{id:e.id.toString()})}function Lc(e,t,o,i){const a=typeof e=="string"?e:e.id,l=new Set,r=i==="source"?"target":"source";for(const s of o)s[r]===a&&l.add(s[i]);return t.filter(s=>l.has(s.id))}function hb(...e){if(e.length===3){const[l,r,s]=e;return Lc(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Gt(l)&&l.source===i).map(l=>o.find(r=>sn(r)&&r.id===l.target))}function yb(...e){if(e.length===3){const[l,r,s]=e;return Lc(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Gt(l)&&l.target===i).map(l=>o.find(r=>sn(r)&&r.id===l.source))}function Pc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function gb(e,t){return t.some(o=>Gt(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 go({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function bo({x:e,y:t},{x:o,y:i,zoom:a},l=!1,r=[1,1]){const s={x:(e-o)/a,y:(t-i)/a};return l?Vi(s,r):s}function zc(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function Ri({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function Uc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function bb(e,t){return Uc(zc(Ri(e),Ri(t)))}function rl(e){let t={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 i=e[o];t=zc(t,Ri({...i.computedPosition,...i.dimensions}))}return Uc(t)}function Hc(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...bo(t,o),width:t.width/o.zoom,height:t.height/o.zoom},r=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,f=c.width??s.width??null,h=c.height??s.height??null;if(a&&!d||u)continue;const p=Ii(l,xi(s)),m=f===null||h===null,b=i&&p>0,y=(f??0)*(h??0);(m||b||p>=y||s.dragging)&&r.push(s)}return r}function cn(e,t){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return t.filter(i=>o.has(i.source)||o.has(i.target))}function Mn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(t*o*.01)}return wo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function _b(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Mn(e,o),a=Mn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Mn(e.top??e.y??0,o),a=Mn(e.bottom??e.y??0,o),l=Mn(e.left??e.x??0,t),r=Mn(e.right??e.x??0,t);return{top:i,right:r,bottom:a,left:l,x:l+r,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function kb(e,t,o,i,a,l){const{x:r,y:s}=go(e,{x:t,y:o,zoom:i}),{x:c,y:d}=go({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=a-c,f=l-d;return{left:Math.floor(r),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(f)}}function Fc(e,t,o,i,a,l=.1){const r=_b(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=rn(d,i,a),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*u,m=o/2-h*u,b=kb(e,p,m,u,t,o),y={left:Math.min(b.left-r.left,0),top:Math.min(b.top-r.top,0),right:Math.min(b.right-r.right,0),bottom:Math.min(b.bottom-r.bottom,0)};return{x:p-y.left+y.right,y:m-y.top+y.bottom,zoom:u}}function wb(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Gc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Gc(o,t):!1}function _o(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function sl(e){const t=e.ctrlKey&&ko()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Yc(e,t,o){return e<t?rn(Math.abs(e-t),1,t)/t:e>o?-rn(Math.abs(e-o),1,t)/t:0}function Wc(e,t,o=15,i=40){const a=Yc(e.x,i,t.width-i)*o,l=Yc(e.y,i,t.height-i)*o;return[a,l]}function cl(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof t.style=="function"?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.dimensions.height}px`,o>0)if(typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+i}px`}else a.height+=i;if(e.position.x<0){const l=Math.abs(e.position.x);if(t.position.x=t.position.x-l,typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+l}px`}else a.width+=l;e.position.x=0}if(e.position.y<0){const l=Math.abs(e.position.y);if(t.position.y=t.position.y-l,typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+l}px`}else a.height+=l;e.position.y=0}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),typeof t.style=="function"?t.style=l=>{const r=t.style;return{...r(l),...a}}:t.style={...t.style,...a}}}}function Kc(e,t){var o,i;const a=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of a)if(r.type==="add")t.findIndex(c=>c.id===r.item.id)===-1&&t.push(r.item);else if(r.type==="remove"){const s=t.findIndex(c=>c.id===r.id);s!==-1&&t.splice(s,1)}const l=t.map(r=>r.id);for(const r of t)for(const s of e)if(s.id===r.id)switch(s.type){case"select":r.selected=s.selected;break;case"position":if(yo(r)&&(typeof s.position<"u"&&(r.position=s.position),typeof s.dragging<"u"&&(r.dragging=s.dragging),r.expandParent&&r.parentNode)){const c=t[l.indexOf(r.parentNode)];c&&yo(c)&&cl(r,c)}break;case"dimensions":if(yo(r)&&(typeof s.dimensions<"u"&&(r.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(r.style={...r.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(r.resizing=s.resizing),r.expandParent&&r.parentNode)){const c=t[l.indexOf(r.parentNode)];c&&yo(c)&&(!!c.dimensions.width&&!!c.dimensions.height?cl(r,c):n.nextTick(()=>{cl(r,c)}))}break}return t}function Yt(e,t){return{id:e,type:"select",selected:t}}function qc(e){return{item:e,type:"add"}}function Xc(e){return{id:e,type:"remove"}}function jc(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Wt(e,t=new Set,o=!1){const i=[];for(const[a,l]of e){const r=t.has(a);!(l.selected===void 0&&!r)&&l.selected!==r&&(o&&(l.selected=r),i.push(Yt(l.id,r)))}return i}const Zc=()=>{};function xe(e){const t=new Set;let o=Zc,i=()=>!1;const a=()=>t.size>0||i(),l=h=>{o=h},r=()=>{o=Zc},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{t.delete(h)};return{on:h=>{t.add(h);const p=()=>d(h);return to(p),{off:p}},off:d,trigger:h=>{const p=[o];return a()?p.push(...t):e&&p.push(e),Promise.allSettled(p.map(m=>m(h)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function Jc(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function Eb(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Gc(c,e))&&(c.draggable||t&&typeof c.draggable>"u")&&e.get(s)&&r.set(s,{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:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(r.values())}function dl({id:e,dragItems:t,findNode:o}){const i=[];for(const a of t){const l=o(a.id);l&&i.push(l)}return[e?i.find(a=>a.id===e):i[0],i]}function Qc(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 vb(e,t,o){const[i,a,l,r]=typeof e!="string"?Qc(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+r,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-l]]:!1}function Nb(e,t,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const l=vb(a,e,i);l&&(a=l)}else t(new Qe(qe.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const l=(i==null?void 0:i.computedPosition.x)||0,r=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+l,a[0][1]+r],[a[1][0]+l,a[1][1]+r]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[l,r,s,c]=Qc(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+l],[a.range[1][0]+d-r,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function $b({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function ul(e,t,o,i,a){const l=$b(e.dimensions,Nb(e,o,i,a)),r=Bc(t,l);return{position:{x:r.x-((a==null?void 0:a.computedPosition.x)||0),y:r.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:r}}function Bn(e,t,o=Se.Left,i=!1){const a=((t==null?void 0:t.x)??0)+e.computedPosition.x,l=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:s}=t??Cb(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case Se.Top:return{x:a+r/2,y:l};case Se.Right:return{x:a+r,y:l+s/2};case Se.Bottom:return{x:a+r/2,y:l+s};case Se.Left:return{x:a,y:l+s/2}}}function ed(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function xb({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:l,width:r,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.y+l)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=Ri({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:r/c.zoom,height:s/c.zoom}),f=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),h=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*h)>0}function Ib(e,t,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const l=t(e.source),r=t(e.target);return!l||!r?0:(o&&(a=i?e.zIndex:Math.max(l.computedPosition.z||0,r.computedPosition.z||0)),a)}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 td={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
10
10
  Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
11
11
  Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
12
12
  Node: ${e}
@@ -26,7 +26,7 @@ Edge: ${e}
26
26
  Source: ${t}
27
27
  Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
28
28
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
29
- 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 Qe extends Error{constructor(t,...o){var i;super((i=nd[t])==null?void 0:i.call(nd,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function fl(e){return"clientX"in e}function Ib(e){return"sourceEvent"in e}function xt(e,t){const o=fl(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const ko=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Sb(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function Ri(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Cb=()=>!0;function ml(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Rb(e,t,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const l of t.values())xi(a,$i(l))>0&&i.push(l);return i}const Vb=250;function Ab(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Rb(e,o,t+Vb);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((l=d.handleBounds)==null?void 0:l.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:m}=Bn(d,f,f.position,!0),p=Math.sqrt((h-e.x)**2+(m-e.y)**2);p>t||(p<s?(r=[{...f,x:h,y:m}],s=p):p===s&&r.push({...f,x:h,y:m}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function od(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=Cb},u,f,h,m){const p=l==="target",g=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:b,y:_}=xt(e),V=r.elementFromPoint(b,_),y=V!=null&&V.classList.contains(`${s}-flow__handle`)?V:g,v={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const ee=id(void 0,y),x=y.getAttribute("data-nodeid"),O=y.getAttribute("data-handleid"),P=y.classList.contains("connectable"),H=y.classList.contains("connectableend");if(!x||!ee)return v;const ne={source:p?x:i,sourceHandle:p?O:a,target:p?i:x,targetHandle:p?a:O};v.connection=ne;const L=P&&H&&(o===Dt.Strict?p&&ee==="source"||!p&&ee==="target":x!==i||O!==a);v.isValid=L&&d(ne,{nodes:f,edges:u,sourceNode:h(ne.source),targetNode:h(ne.target)}),v.toHandle=ad(x,ee,O,m,o,!0)}return v}function id(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Tb(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Mb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function ad(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===Dt.Strict?(r=d.handleBounds)==null?void 0:r[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],f=(o?u==null?void 0:u.find(h=>h.id===o):u==null?void 0:u[0])??null;return f&&l?{...f,...Bn(d,f,f.position,!0)}:f}const pl={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top},Bb=["production","prod"];function wo(e,...t){ld()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ld(){return!Bb.includes(process.env.NODE_ENV||"")}function rd(e,t,o,i,a){const l=t.querySelectorAll(`.vue-flow__handle.${e}`);return l!=null&&l.length?Array.from(l).map(r=>{const s=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:e,nodeId:a,position:r.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Ii(r)}}):null}function hl(e,t,o,i,a,l=!1,r){a.value=!1,e.selected?(l||e.selected&&t)&&(i([e]),n.nextTick(()=>{r.blur()})):o([e])}function Xe(e){return typeof n.unref(e)<"u"}function Db(e,t,o,i){if(!e||!e.source||!e.target)return o(new Qe(qe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Gt(e)?a=e:a={...e,id:zc(e)},a=Lc(a,void 0,i),yb(a,t)?!1:a}function Ob(e,t,o,i,a){if(!t.source||!t.target)return a(new Qe(qe.EDGE_INVALID,e.id)),!1;if(!o)return a(new Qe(qe.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?zc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function sd(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!sn(r)){o(new Qe(qe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=mb(r,t(r.id),r.parentNode);r.parentNode&&(i[r.parentNode]=!0),a[l]=s}for(const l of a){const r=t(l.parentNode)||a.find(s=>s.id===l.parentNode);l.parentNode&&!r&&o(new Qe(qe.NODE_MISSING_PARENT,l.id,l.parentNode)),(l.parentNode||i[l.id])&&(i[l.id]&&(l.isParent=!0),r&&(r.isParent=!0))}return a}function cd(e,t,o,i,a,l){let r=a;const s=i.get(r)||new Map;i.set(r,s.set(o,t)),r=`${a}-${e}`;const c=i.get(r)||new Map;if(i.set(r,c.set(o,t)),l){r=`${a}-${e}-${l}`;const d=i.get(r)||new Map;i.set(r,d.set(o,t))}}function yl(e,t,o){e.clear();for(const i of o){const{source:a,target:l,sourceHandle:r=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:l,sourceHandle:r,targetHandle:s},d=`${a}-${r}--${l}-${s}`,u=`${l}-${s}--${a}-${r}`;cd("source",c,u,e,a,r),cd("target",c,d,e,l,s)}}function dd(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function gl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Gt(d)?d:Db(d,s,a,l);if(!u)continue;const f=o(u.source),h=o(u.target);if(!f||!h){a(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Qe(qe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new Qe(qe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:h})){a(new Qe(qe.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...Lc(u,m,l),sourceNode:f,targetNode:h})}return c}const ud=Symbol("vueFlow"),fd=Symbol("nodeId"),md=Symbol("nodeRef"),Lb=Symbol("edgeId"),Pb=Symbol("edgeRef"),Vi=Symbol("slots");function pd(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:l,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:h,findNode:m,multiSelectionActive:p,nodesSelectionActive:g,selectNodesOnDrag:b,removeSelectedElements:_,addSelectedNodes:V,updateNodePositions:y,emits:v}=ze(),{onStart:ee,onDrag:x,onStop:O,onClick:P,el:H,disabled:ne,id:ce,selectable:L,dragHandle:oe}=e,k=n.shallowRef(!1);let Y=[],S,F=null,U={x:void 0,y:void 0},le={x:0,y:0},E=null,K=!1,re=!1,pe=0,ye=!1;const ue=Hb(),fe=({x:j,y:W})=>{U={x:j,y:W};let w=!1;if(Y=Y.map(I=>{const C={x:j-I.distance.x,y:W-I.distance.y},{computedPosition:G}=ul(I,o.value?Ri(C,i.value):C,v.error,r.value,I.parentNode?m(I.parentNode):void 0);return w=w||I.position.x!==G.x||I.position.y!==G.y,I.position=G,I}),re=re||w,!!w&&(y(Y,!0,!0),k.value=!0,E)){const[I,C]=dl({id:ce,dragItems:Y,findNode:m});x({event:E,node:I,nodes:C})}},ge=()=>{if(!F)return;const[j,W]=Kc(le,F,u.value);if(j!==0||W!==0){const w={x:(U.x??0)-j/c.value.zoom,y:(U.y??0)-W/c.value.zoom};h({x:j,y:W})&&fe(w)}pe=requestAnimationFrame(ge)},Ee=(j,W)=>{K=!0;const w=m(ce);!b.value&&!p.value&&w&&(w.selected||_()),w&&n.toValue(L)&&b.value&&hl(w,p.value,V,_,g,!1,W);const I=ue(j.sourceEvent);if(U=I,Y=wb(l.value,f.value,I,ce),Y.length){const[C,G]=dl({id:ce,dragItems:Y,findNode:m});ee({event:j.sourceEvent,node:C,nodes:G})}},Re=(j,W)=>{var w;j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||(re=!1,s.value===0&&Ee(j,W),U=ue(j.sourceEvent),F=((w=t.value)==null?void 0:w.getBoundingClientRect())||null,le=xt(j.sourceEvent,F))},Ie=(j,W)=>{const w=ue(j.sourceEvent);if(!ye&&K&&d.value&&(ye=!0,ge()),!K){const I=w.xSnapped-(U.x??0),C=w.ySnapped-(U.y??0);Math.sqrt(I*I+C*C)>s.value&&Ee(j,W)}(U.x!==w.xSnapped||U.y!==w.ySnapped)&&Y.length&&K&&(E=j.sourceEvent,le=xt(j.sourceEvent,F),fe(w))},he=j=>{let W=!1;if(!K&&!k.value&&!p.value){const w=j.sourceEvent,I=ue(w),C=I.xSnapped-(U.x??0),G=I.ySnapped-(U.y??0),J=Math.sqrt(C*C+G*G);J!==0&&J<=s.value&&(P==null||P(w),W=!0)}if(Y.length&&!W){re&&(y(Y,!1,!1),re=!1);const[w,I]=dl({id:ce,dragItems:Y,findNode:m});O({event:j.sourceEvent,node:w,nodes:I})}Y=[],k.value=!1,ye=!1,K=!1,U={x:void 0,y:void 0},cancelAnimationFrame(pe)};return n.watch([()=>n.toValue(ne),H],([j,W],w,I)=>{if(W){const C=ht(W);j||(S=fy().on("start",G=>Re(G,W)).on("drag",G=>Ie(G,W)).on("end",G=>he(G)).filter(G=>{const J=G.target,be=n.toValue(oe);return!G.button&&(!a.value||!Qc(J,`.${a.value}`,W)&&(!be||Qc(J,be,W)))}),C.call(S)),I(()=>{C.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),k}function zb(){return{doubleClick:xe(),click:xe(),mouseEnter:xe(),mouseMove:xe(),mouseLeave:xe(),contextMenu:xe(),updateStart:xe(),update:xe(),updateEnd:xe()}}function Ub(e,t){const o=zb();return o.doubleClick.on(i=>{var a,l;t.edgeDoubleClick(i),(l=(a=e.events)==null?void 0:a.doubleClick)==null||l.call(a,i)}),o.click.on(i=>{var a,l;t.edgeClick(i),(l=(a=e.events)==null?void 0:a.click)==null||l.call(a,i)}),o.mouseEnter.on(i=>{var a,l;t.edgeMouseEnter(i),(l=(a=e.events)==null?void 0:a.mouseEnter)==null||l.call(a,i)}),o.mouseMove.on(i=>{var a,l;t.edgeMouseMove(i),(l=(a=e.events)==null?void 0:a.mouseMove)==null||l.call(a,i)}),o.mouseLeave.on(i=>{var a,l;t.edgeMouseLeave(i),(l=(a=e.events)==null?void 0:a.mouseLeave)==null||l.call(a,i)}),o.contextMenu.on(i=>{var a,l;t.edgeContextMenu(i),(l=(a=e.events)==null?void 0:a.contextMenu)==null||l.call(a,i)}),o.updateStart.on(i=>{var a,l;t.edgeUpdateStart(i),(l=(a=e.events)==null?void 0:a.updateStart)==null||l.call(a,i)}),o.update.on(i=>{var a,l;t.edgeUpdate(i),(l=(a=e.events)==null?void 0:a.update)==null||l.call(a,i)}),o.updateEnd.on(i=>{var a,l;t.edgeUpdateEnd(i),(l=(a=e.events)==null?void 0:a.updateEnd)==null||l.call(a,i)}),Object.entries(o).reduce((i,[a,l])=>(i.emit[a]=l.trigger,i.on[a]=l.on,i),{emit:{},on:{}})}function Hb(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=ze();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=Ib(a)?a.sourceEvent:a,{x:c,y:d}=xt(s,r),u=bo({x:c,y:d},e.value),{x:f,y:h}=o.value?Ri(u,t.value):u;return{xSnapped:f,ySnapped:h,...u}}}function Ai(){return!0}function hd({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:l,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:m,autoPanOnConnect:p,autoPanSpeed:g,findNode:b,panBy:_,startConnection:V,updateConnection:y,endConnection:v,emits:ee,viewport:x,edges:O,nodes:P,isValidConnection:H,nodeLookup:ne}=ze();let ce=null,L=!1,oe=null;function k(S){var F;const U=n.toValue(o)==="target",le=fl(S),E=Oc(S.target),K=S.currentTarget;if(K&&(le&&S.button===0||!le)){let re=function(_e){w=xt(_e,he),fe=Ab(bo(w,x.value,!1,[1,1]),u.value,ne.value,G),I||(C(),I=!0);const Ce=od(_e,{handle:fe,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:U?"target":"source",isValidConnection:ue,doc:E,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,P.value,b,ne.value);oe=Ce.handleDomNode,ce=Ce.connection,L=Mb(!!fe,Ce.isValid);const Te={...$e,isValid:L,to:Ce.toHandle&&L?go({x:Ce.toHandle.x,y:Ce.toHandle.y},x.value):w,toHandle:Ce.toHandle,toPosition:L&&Ce.toHandle?Ce.toHandle.position:pl[G.position],toNode:Ce.toHandle?ne.value.get(Ce.toHandle.nodeId):null};if(L&&fe&&($e!=null&&$e.toHandle)&&Te.toHandle&&$e.toHandle.type===Te.toHandle.type&&$e.toHandle.nodeId===Te.toHandle.nodeId&&$e.toHandle.id===Te.toHandle.id&&$e.to.x===Te.to.x&&$e.to.y===Te.to.y)return;const Be=fe??Ce.toHandle;if(y(Be&&L?go({x:Be.x,y:Be.y},x.value):w,Be,Tb(!!Be,L)),$e=Te,!fe&&!L&&!oe)return ml(W);ce&&ce.source!==ce.target&&oe&&(ml(W),W=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!L),oe.classList.toggle("vue-flow__handle-valid",!!L))},pe=function(_e){"touches"in _e&&_e.touches.length>0||((fe||oe)&&ce&&L&&(l?l(_e,ce):ee.connect(ce)),ee.connectEnd(_e),a&&(r==null||r(_e)),ml(W),cancelAnimationFrame(ge),v(_e),I=!1,L=!1,ce=null,oe=null,E.removeEventListener("mousemove",re),E.removeEventListener("mouseup",pe),E.removeEventListener("touchmove",re),E.removeEventListener("touchend",pe))};const ye=b(n.toValue(t));let ue=n.toValue(i)||H.value||Ai;!ue&&ye&&(ue=(U?ye.isValidSourcePos:ye.isValidTargetPos)||Ai);let fe,ge=0;const{x:Ee,y:Re}=xt(S),Ie=id(n.toValue(a),K),he=(F=c.value)==null?void 0:F.getBoundingClientRect();if(!he||!Ie)return;const j=ad(n.toValue(t),Ie,n.toValue(e),ne.value,d.value);if(!j)return;let W,w=xt(S,he),I=!1;const C=()=>{if(!p.value)return;const[_e,Ce]=Kc(w,he,g.value);_({x:_e,y:Ce}),ge=requestAnimationFrame(C)},G={...j,nodeId:n.toValue(t),type:Ie,position:j.position},J=ne.value.get(n.toValue(t)),we={inProgress:!0,isValid:null,from:Bn(J,G,Se.Left,!0),fromHandle:G,fromPosition:G.position,fromNode:J,to:w,toHandle:null,toPosition:pl[G.position],toNode:null};V({nodeId:n.toValue(t),id:n.toValue(e),type:Ie,position:(K==null?void 0:K.getAttribute("data-handlepos"))||Se.Top,...w},{x:Ee-he.left,y:Re-he.top}),ee.connectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ie});let $e=we;E.addEventListener("mousemove",re),E.addEventListener("mouseup",pe),E.addEventListener("touchmove",re),E.addEventListener("touchend",pe)}}function Y(S){var F,U;if(!f.value)return;const le=n.toValue(o)==="target";if(!h.value){ee.clickConnectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e)}),V({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Se.Top,...xt(S)},void 0,!0);return}let E=n.toValue(i)||H.value||Ai;const K=b(n.toValue(t));if(!E&&K&&(E=(le?K.isValidSourcePos:K.isValidTargetPos)||Ai),K&&(typeof K.connectable>"u"?m.value:K.connectable)===!1)return;const re=Oc(S.target),pe=od(S,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Se.Top,...xt(S)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:E,doc:re,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,P.value,b,ne.value),ye=((F=pe.connection)==null?void 0:F.source)===((U=pe.connection)==null?void 0:U.target);pe.isValid&&pe.connection&&!ye&&ee.connect(pe.connection),ee.clickConnectEnd(S),v(S,!0)}return{handlePointerDown:k,handleClick:Y}}function Fb(){return n.inject(fd,"")}function yd(e){const t=e??Fb()??"",o=n.inject(md,n.ref(null)),{findNode:i,edges:a,emits:l}=ze(),r=i(t);return r||l.error(new Qe(qe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>cn([r],a.value))}}function Gb(){return{doubleClick:xe(),click:xe(),mouseEnter:xe(),mouseMove:xe(),mouseLeave:xe(),contextMenu:xe(),dragStart:xe(),drag:xe(),dragStop:xe()}}function Yb(e,t){const o=Gb();return o.doubleClick.on(i=>{var a,l;t.nodeDoubleClick(i),(l=(a=e.events)==null?void 0:a.doubleClick)==null||l.call(a,i)}),o.click.on(i=>{var a,l;t.nodeClick(i),(l=(a=e.events)==null?void 0:a.click)==null||l.call(a,i)}),o.mouseEnter.on(i=>{var a,l;t.nodeMouseEnter(i),(l=(a=e.events)==null?void 0:a.mouseEnter)==null||l.call(a,i)}),o.mouseMove.on(i=>{var a,l;t.nodeMouseMove(i),(l=(a=e.events)==null?void 0:a.mouseMove)==null||l.call(a,i)}),o.mouseLeave.on(i=>{var a,l;t.nodeMouseLeave(i),(l=(a=e.events)==null?void 0:a.mouseLeave)==null||l.call(a,i)}),o.contextMenu.on(i=>{var a,l;t.nodeContextMenu(i),(l=(a=e.events)==null?void 0:a.contextMenu)==null||l.call(a,i)}),o.dragStart.on(i=>{var a,l;t.nodeDragStart(i),(l=(a=e.events)==null?void 0:a.dragStart)==null||l.call(a,i)}),o.drag.on(i=>{var a,l;t.nodeDrag(i),(l=(a=e.events)==null?void 0:a.drag)==null||l.call(a,i)}),o.dragStop.on(i=>{var a,l;t.nodeDragStop(i),(l=(a=e.events)==null?void 0:a.dragStop)==null||l.call(a,i)}),Object.entries(o).reduce((i,[a,l])=>(i.emit[a]=l.trigger,i.on[a]=l.on,i),{emit:{},on:{}})}function gd(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=ze();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,h=d?4:1,m=c.x*u*h,p=c.y*f*h,g=[];for(const b of e.value)if(b.draggable||r&&typeof b.draggable>"u"){const _={x:b.computedPosition.x+m,y:b.computedPosition.y+p},{position:V}=ul(b,_,s.error,t.value,b.parentNode?i(b.parentNode):void 0);g.push({id:b.id,position:V,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(g,!0,!1)}}const Ti=.1,Wb=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kt(){return wo("Viewport not initialized yet."),Promise.resolve(!1)}const Kb={zoomIn:Kt,zoomOut:Kt,zoomTo:Kt,fitView:Kt,setCenter:Kt,fitBounds:Kt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Kt,setTransform:Kt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function qb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ro:hi).scaleBy(bl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{l(!0)}),i):l(!1)})}function o(i,a,l,r){return new Promise(s=>{var c;const{x:d,y:u}=Dc({x:-i,y:-a},e.translateExtent),f=An.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?ro:hi).transform(bl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{s(!0)}),f):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>t(1.2,a),zoomOut:a=>t(1/1.2,a),zoomTo:(a,l)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((l==null?void 0:l.interpolate)==="linear"?ro:hi).scaleTo(bl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{r(!0)}),a):r(!1)}),setViewport:(a,l)=>o(a.x,a.y,a.zoom,l),setTransform:(a,l)=>o(a.x,a.y,a.zoom,l),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:(a={padding:Ti,includeHiddenNodes:!1,duration:0})=>{var l,r;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!h.hidden)&&(!((l=a.nodes)!=null&&l.length)||(r=a.nodes)!=null&&r.length&&a.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const c=rl(s),{x:d,y:u,zoom:f}=Gc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ti);return o(d,u,f,a)},setCenter:(a,l,r)=>{const s=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-l*s;return o(c,d,s,r)},fitBounds:(a,l={padding:Ti})=>{const{x:r,y:s,zoom:c}=Gc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Ti);return o(r,s,c,l)},project:a=>bo(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:l,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-l,y:a.y-r};return bo(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:l,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+l,y:a.y+r};return go(s,e.viewport)}return{x:0,y:0}}}:Kb)}function bl(e,t=0,o=Wb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function Xb(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,b,_=!!(o.nodes.value.length||o.edges.value.length);g=In([e.modelValue,()=>{var V,y;return(y=(V=e.modelValue)==null?void 0:V.value)==null?void 0:y.length}],([V])=>{V&&Array.isArray(V)&&(b==null||b.pause(),o.setElements(V),!b&&!_&&V.length?_=!0:b==null||b.resume())}),b=In([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([V,y])=>{var v;(v=e.modelValue)!=null&&v.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...V,...y],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let g,b,_=!!o.nodes.value.length;g=In([e.nodes,()=>{var V,y;return(y=(V=e.nodes)==null?void 0:V.value)==null?void 0:y.length}],([V])=>{V&&Array.isArray(V)&&(b==null||b.pause(),o.setNodes(V),!b&&!_&&V.length?_=!0:b==null||b.resume())}),b=In([o.nodes,()=>o.nodes.value.length],([V])=>{var y;(y=e.nodes)!=null&&y.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...V],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let g,b,_=!!o.edges.value.length;g=In([e.edges,()=>{var V,y;return(y=(V=e.edges)==null?void 0:V.value)==null?void 0:y.length}],([V])=>{V&&Array.isArray(V)&&(b==null||b.pause(),o.setEdges(V),!b&&!_&&V.length?_=!0:b==null||b.resume())}),b=In([o.edges,()=>o.edges.value.length],([V])=>{var y;(y=e.edges)!=null&&y.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...V],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&Xe(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&Xe(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&Xe(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&Xe(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{Xe(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const g=async b=>{let _=b;typeof t.autoConnect=="function"&&(_=await t.autoConnect(b)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{Xe(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(b,_,V)=>{b?o.onConnect(g):o.hooks.value.connect.off(g),V(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},m=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(t)){const _=b;if(!g.includes(_)){const V=n.toRef(()=>t[_]),y=o[_];n.isRef(y)&&i.run(()=>{n.watch(V,v=>{Xe(v)&&(y.value=v)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),h(),m()})()}),()=>i.stop()}function jb(){return{edgesChange:xe(),nodesChange:xe(),nodeDoubleClick:xe(),nodeClick:xe(),nodeMouseEnter:xe(),nodeMouseMove:xe(),nodeMouseLeave:xe(),nodeContextMenu:xe(),nodeDragStart:xe(),nodeDrag:xe(),nodeDragStop:xe(),nodesInitialized:xe(),miniMapNodeClick:xe(),miniMapNodeDoubleClick:xe(),miniMapNodeMouseEnter:xe(),miniMapNodeMouseMove:xe(),miniMapNodeMouseLeave:xe(),connect:xe(),connectStart:xe(),connectEnd:xe(),clickConnectStart:xe(),clickConnectEnd:xe(),paneReady:xe(),init:xe(),move:xe(),moveStart:xe(),moveEnd:xe(),selectionDragStart:xe(),selectionDrag:xe(),selectionDragStop:xe(),selectionContextMenu:xe(),selectionStart:xe(),selectionEnd:xe(),viewportChangeStart:xe(),viewportChange:xe(),viewportChangeEnd:xe(),paneScroll:xe(),paneClick:xe(),paneContextMenu:xe(),paneMouseEnter:xe(),paneMouseMove:xe(),paneMouseLeave:xe(),edgeContextMenu:xe(),edgeMouseEnter:xe(),edgeMouseMove:xe(),edgeMouseLeave:xe(),edgeDoubleClick:xe(),edgeClick:xe(),edgeUpdateStart:xe(),edgeUpdate:xe(),edgeUpdateEnd:xe(),updateNodeInternals:xe(),error:xe(e=>wo(e.message))}}function Zb(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[a,l]of Object.entries(t.value)){const r=s=>{e(a,s)};l.setEmitter(r),to(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),to(l.removeHasEmitListeners)}});function i(a){var l;const r=Jb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function Jb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function bd(){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:il.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:po.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:ln.Bezier,style:{}},connectionMode:Dt.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:ko()?"Meta":"Control",zoomActivationKeyCode:ko()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:jb(),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 Qb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function e0(e,t,o){const i=qb(e),a=w=>{const I=w??[];e.hooks.updateNodeInternals.trigger(I)},l=w=>hb(w,e.nodes,e.edges),r=w=>pb(w,e.nodes,e.edges),s=w=>cn(w,e.edges),c=({id:w,type:I,nodeId:C})=>{var G;const J=w?`-${I}-${w}`:`-${I}`;return Array.from(((G=e.connectionLookup.get(`${C}${J}`))==null?void 0:G.values())??[])},d=w=>{if(w)return t.value.get(w)},u=w=>{if(w)return o.value.get(w)},f=(w,I,C)=>{var G,J;const be=[];for(const we of w){const $e={id:we.id,type:"position",dragging:C,from:we.from};if(I&&($e.position=we.position,we.parentNode)){const _e=d(we.parentNode);$e.position={x:$e.position.x-(((G=_e==null?void 0:_e.computedPosition)==null?void 0:G.x)??0),y:$e.position.y-(((J=_e==null?void 0:_e.computedPosition)==null?void 0:J.y)??0)}}be.push($e)}be!=null&&be.length&&e.hooks.nodesChange.trigger(be)},h=w=>{if(!e.vueFlowRef)return;const I=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!I)return;const C=window.getComputedStyle(I),{m22:G}=new window.DOMMatrixReadOnly(C.transform),J=[];for(const be of w){const we=be,$e=d(we.id);if($e){const _e=Ii(we.nodeElement);if(!!(_e.width&&_e.height&&($e.dimensions.width!==_e.width||$e.dimensions.height!==_e.height||we.forceUpdate))){const Te=we.nodeElement.getBoundingClientRect();$e.dimensions=_e,$e.handleBounds.source=rd("source",we.nodeElement,Te,G,$e.id),$e.handleBounds.target=rd("target",we.nodeElement,Te,G,$e.id),J.push({id:$e.id,type:"dimensions",dimensions:_e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),J.length&&e.hooks.nodesChange.trigger(J)},m=(w,I)=>{const C=new Set,G=new Set;for(const we of w)sn(we)?C.add(we.id):Gt(we)&&G.add(we.id);const J=Wt(t.value,C,!0),be=Wt(o.value,G);if(e.multiSelectionActive){for(const we of C)J.push(Yt(we,I));for(const we of G)be.push(Yt(we,I))}J.length&&e.hooks.nodesChange.trigger(J),be.length&&e.hooks.edgesChange.trigger(be)},p=w=>{if(e.multiSelectionActive){const I=w.map(C=>Yt(C.id,!0));e.hooks.nodesChange.trigger(I);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(w.map(I=>I.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},g=w=>{if(e.multiSelectionActive){const I=w.map(C=>Yt(C.id,!0));e.hooks.edgesChange.trigger(I);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(w.map(I=>I.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},b=w=>{m(w,!0)},_=w=>{const C=(w||e.nodes).map(G=>(G.selected=!1,Yt(G.id,!1)));e.hooks.nodesChange.trigger(C)},V=w=>{const C=(w||e.edges).map(G=>(G.selected=!1,Yt(G.id,!1)));e.hooks.edgesChange.trigger(C)},y=w=>{if(!w||!w.length)return m([],!1);const I=w.reduce((C,G)=>{const J=Yt(G.id,!1);return sn(G)?C.nodes.push(J):C.edges.push(J),C},{nodes:[],edges:[]});I.nodes.length&&e.hooks.nodesChange.trigger(I.nodes),I.edges.length&&e.hooks.edgesChange.trigger(I.edges)},v=w=>{var I;(I=e.d3Zoom)==null||I.scaleExtent([w,e.maxZoom]),e.minZoom=w},ee=w=>{var I;(I=e.d3Zoom)==null||I.scaleExtent([e.minZoom,w]),e.maxZoom=w},x=w=>{var I;(I=e.d3Zoom)==null||I.translateExtent(w),e.translateExtent=w},O=w=>{e.nodeExtent=w,a()},P=w=>{var I;(I=e.d3Zoom)==null||I.clickDistance(w)},H=w=>{e.nodesDraggable=w,e.nodesConnectable=w,e.elementsSelectable=w},ne=w=>{const I=w instanceof Function?w(e.nodes):w;!e.initialized&&!I.length||(e.nodes=sd(I,d,e.hooks.error.trigger))},ce=w=>{const I=w instanceof Function?w(e.edges):w;if(!e.initialized&&!I.length)return;const C=gl(I,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);yl(e.connectionLookup,o.value,C),e.edges=C},L=w=>{const I=w instanceof Function?w([...e.nodes,...e.edges]):w;!e.initialized&&!I.length||(ne(I.filter(sn)),ce(I.filter(Gt)))},oe=w=>{let I=w instanceof Function?w(e.nodes):w;I=Array.isArray(I)?I:[I];const C=sd(I,d,e.hooks.error.trigger),G=[];for(const J of C)G.push(Xc(J));G.length&&e.hooks.nodesChange.trigger(G)},k=w=>{let I=w instanceof Function?w(e.edges):w;I=Array.isArray(I)?I:[I];const C=gl(I,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),G=[];for(const J of C)G.push(Xc(J));G.length&&e.hooks.edgesChange.trigger(G)},Y=(w,I=!0,C=!1)=>{const G=w instanceof Function?w(e.nodes):w,J=Array.isArray(G)?G:[G],be=[],we=[];function $e(Ce){const Te=s(Ce);for(const Be of Te)(!Xe(Be.deletable)||Be.deletable)&&we.push(Zc(Be.id,Be.source,Be.target,Be.sourceHandle,Be.targetHandle))}function _e(Ce){const Te=[];for(const Be of e.nodes)Be.parentNode===Ce&&Te.push(Be);if(Te.length){for(const Be of Te)be.push(jc(Be.id));I&&$e(Te);for(const Be of Te)_e(Be.id)}}for(const Ce of J){const Te=typeof Ce=="string"?d(Ce):Ce;Te&&(Xe(Te.deletable)&&!Te.deletable||(be.push(jc(Te.id)),I&&$e([Te]),C&&_e(Te.id)))}we.length&&e.hooks.edgesChange.trigger(we),be.length&&e.hooks.nodesChange.trigger(be)},S=w=>{const I=w instanceof Function?w(e.edges):w,C=Array.isArray(I)?I:[I],G=[];for(const J of C){const be=typeof J=="string"?u(J):J;be&&(Xe(be.deletable)&&!be.deletable||G.push(Zc(typeof J=="string"?J:J.id,be.source,be.target,be.sourceHandle,be.targetHandle)))}e.hooks.edgesChange.trigger(G)},F=(w,I,C=!0)=>{const G=u(w.id);if(!G)return!1;const J=e.edges.indexOf(G),be=Ob(w,I,G,C,e.hooks.error.trigger);if(be){const[we]=gl([be],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map(($e,_e)=>_e===J?we:$e),yl(e.connectionLookup,o.value,[we]),we}return!1},U=(w,I,C={replace:!1})=>{const G=u(w);if(!G)return;const J=typeof I=="function"?I(G):I;G.data=C.replace?J:{...G.data,...J}},le=w=>qc(w,e.nodes),E=w=>{const I=qc(w,e.edges);return yl(e.connectionLookup,o.value,I),I},K=(w,I,C={replace:!1})=>{const G=d(w);if(!G)return;const J=typeof I=="function"?I(G):I;C.replace?e.nodes.splice(e.nodes.indexOf(G),1,J):Object.assign(G,J)},re=(w,I,C={replace:!1})=>{const G=d(w);if(!G)return;const J=typeof I=="function"?I(G):I;G.data=C.replace?J:{...G.data,...J}},pe=(w,I,C=!1)=>{C?e.connectionClickStartHandle=w:e.connectionStartHandle=w,e.connectionEndHandle=null,e.connectionStatus=null,I&&(e.connectionPosition=I)},ye=(w,I=null,C=null)=>{e.connectionStartHandle&&(e.connectionPosition=w,e.connectionEndHandle=I,e.connectionStatus=C)},ue=(w,I)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,I?e.connectionClickStartHandle=null:e.connectionStartHandle=null},fe=w=>{const I=fb(w),C=I?null:yo(w)?w:d(w.id);return!I&&!C?[null,null,I]:[I?w:$i(C),C,I]},ge=(w,I=!0,C=e.nodes)=>{const[G,J,be]=fe(w);if(!G)return[];const we=[];for(const $e of C||e.nodes){if(!be&&($e.id===J.id||!$e.computedPosition))continue;const _e=$i($e),Ce=xi(_e,G);(I&&Ce>0||Ce>=_e.width*_e.height||Ce>=Number(G.width)*Number(G.height))&&we.push($e)}return we},Ee=(w,I,C=!0)=>{const[G]=fe(w);if(!G)return!1;const J=xi(G,I);return C&&J>0||J>=Number(G.width)*Number(G.height)},Re=w=>{const{viewport:I,dimensions:C,d3Zoom:G,d3Selection:J,translateExtent:be}=e;if(!G||!J||!w.x&&!w.y)return!1;const we=An.translate(I.x+w.x,I.y+w.y).scale(I.zoom),$e=[[0,0],[C.width,C.height]],_e=G.constrain()(we,$e,be),Ce=e.viewport.x!==_e.x||e.viewport.y!==_e.y||e.viewport.zoom!==_e.k;return G.transform(J,_e),Ce},Ie=w=>{const I=w instanceof Function?w(e):w,C=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(I.defaultEdgeOptions)&&(e.defaultEdgeOptions=I.defaultEdgeOptions);const G=I.modelValue||I.nodes||I.edges?[]:void 0;G&&(I.modelValue&&G.push(...I.modelValue),I.nodes&&G.push(...I.nodes),I.edges&&G.push(...I.edges),L(G));const J=()=>{Xe(I.maxZoom)&&ee(I.maxZoom),Xe(I.minZoom)&&v(I.minZoom),Xe(I.translateExtent)&&x(I.translateExtent)};for(const be of Object.keys(I)){const we=be,$e=I[we];![...Qb,...C].includes(we)&&Xe($e)&&(e[we]=$e)}Oa(()=>e.d3Zoom).not.toBeNull().then(J),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:L,setNodes:ne,setEdges:ce,addNodes:oe,addEdges:k,removeNodes:Y,removeEdges:S,findNode:d,findEdge:u,updateEdge:F,updateEdgeData:U,updateNode:K,updateNodeData:re,applyEdgeChanges:E,applyNodeChanges:le,addSelectedElements:b,addSelectedNodes:p,addSelectedEdges:g,setMinZoom:v,setMaxZoom:ee,setTranslateExtent:x,setNodeExtent:O,setPaneClickDistance:P,removeSelectedElements:y,removeSelectedNodes:_,removeSelectedEdges:V,startConnection:pe,updateConnection:ye,endConnection:ue,setInteractive:H,setState:Ie,getIntersectingNodes:ge,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ee,panBy:Re,fitView:w=>i.value.fitView(w),zoomIn:w=>i.value.zoomIn(w),zoomOut:w=>i.value.zoomOut(w),zoomTo:(w,I)=>i.value.zoomTo(w,I),setViewport:(w,I)=>i.value.setViewport(w,I),setTransform:(w,I)=>i.value.setTransform(w,I),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(w,I,C)=>i.value.setCenter(w,I,C),fitBounds:(w,I)=>i.value.fitBounds(w,I),project:w=>i.value.project(w),screenToFlowCoordinate:w=>i.value.screenToFlowCoordinate(w),flowToScreenCoordinate:w=>i.value.flowToScreenCoordinate(w),toObject:()=>{const w=[],I=[];for(const C of e.nodes){const{computedPosition:G,handleBounds:J,selected:be,dimensions:we,isParent:$e,resizing:_e,dragging:Ce,events:Te,...Be}=C;w.push(Be)}for(const C of e.edges){const{selected:G,sourceNode:J,targetNode:be,events:we,...$e}=C;I.push($e)}return JSON.parse(JSON.stringify({nodes:w,edges:I,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:w=>new Promise(I=>{const{nodes:C,edges:G,position:J,zoom:be,viewport:we}=w;C&&ne(C),G&&ce(G);const[$e,_e]=we!=null&&we.x&&(we!=null&&we.y)?[we.x,we.y]:J??[null,null];if($e&&_e){const Ce=(we==null?void 0:we.zoom)||be||e.viewport.zoom;return Oa(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:$e,y:_e,zoom:Ce}).then(()=>{I(!0)})})}else I(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const w=bd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const I=An.translate(w.defaultViewport.x??0,w.defaultViewport.y??0).scale(rn(w.defaultViewport.zoom??1,w.minZoom,w.maxZoom)),C=e.viewportRef.getBoundingClientRect(),G=[[0,0],[C.width,C.height]],J=e.d3Zoom.constrain()(I,G,w.translateExtent);e.d3Zoom.transform(e.d3Selection,J)}Ie(w)},$destroy:()=>{}}}const t0=["data-id","data-handleid","data-nodeid","data-handlepos"],n0={name:"Handle",compatConfig:{MODE:3}},dn=n.defineComponent({...n0,props:{id:{default:null},type:{},position:{default:()=>Se.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:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),a=n.toRef(()=>o.isValidConnection??null),{id:l,connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:f,noPanClassName:h}=ze(),{id:m,node:p,nodeEl:g,connectedEdges:b}=yd(),_=n.ref(),V=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),y=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),v=n.toRef(()=>{var ce,L,oe,k,Y,S;return((ce=r.value)==null?void 0:ce.nodeId)===m&&((L=r.value)==null?void 0:L.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===m&&((Y=c.value)==null?void 0:Y.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),ee=n.toRef(()=>{var ce,L,oe;return((ce=s.value)==null?void 0:ce.nodeId)===m&&((L=s.value)==null?void 0:L.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:x,handleClick:O}=hd({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),P=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(ce=>{const L=ce[`${i.value}Handle`];return ce[i.value]!==m?!1:L?L===e.id:!0}):typeof e.connectable=="number"?b.value.filter(ce=>{const L=ce[`${i.value}Handle`];return ce[i.value]!==m?!1:L?L===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(p,b.value):Xe(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var ce;if(!p.dimensions.width||!p.dimensions.height)return;const L=(ce=p.handleBounds[i.value])==null?void 0:ce.find(le=>le.id===e.id);if(!d.value||L)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!_.value||!oe||!e.id)return;const k=g.value.getBoundingClientRect(),Y=_.value.getBoundingClientRect(),S=window.getComputedStyle(oe),{m22:F}=new window.DOMMatrixReadOnly(S.transform),U={id:e.id,position:e.position,x:(Y.left-k.left)/F,y:(Y.top-k.top)/F,type:i.value,nodeId:m,...Ii(_.value)};p.handleBounds[i.value]=[...p.handleBounds[i.value]??[],U]});function H(ce){const L=fl(ce);P.value&&V.value&&(L&&ce.button===0||!L)&&x(ce)}function ne(ce){!m||!s.value&&!V.value||P.value&&O(ce)}return t({handleClick:O,handlePointerDown:x,onClick:ne,onPointerDown:H}),(ce,L)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${n.unref(l)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":ce.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${ce.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(h),i.value,{connectable:P.value,connecting:ee.value,connectablestart:V.value,connectableend:y.value,connectionindicator:P.value&&(V.value&&!v.value||y.value&&v.value)}]]),onMousedown:H,onTouchstartPassive:H,onClick:ne},[n.renderSlot(ce.$slots,"default",{id:ce.id})],42,t0))}}),Mi=function({sourcePosition:e=Se.Bottom,targetPosition:t=Se.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(dn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(dn,{type:"source",position:e,connectable:i,isValidConnection:l})]};Mi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Mi.inheritAttrs=!1,Mi.compatConfig={MODE:3};const o0=Mi,Bi=function({targetPosition:e=Se.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(dn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Bi.props=["targetPosition","label","isValidTargetPos","connectable","data"],Bi.inheritAttrs=!1,Bi.compatConfig={MODE:3};const i0=Bi,Di=function({sourcePosition:e=Se.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:a}){const l=a.label??t;return[typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l]),n.h(dn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Di.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Di.inheritAttrs=!1,Di.compatConfig={MODE:3};const a0=Di,l0=["transform"],r0=["width","height","x","y","rx","ry"],s0=["y"],c0={name:"EdgeText",compatConfig:{MODE:3}},d0=n.defineComponent({...c0,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(a),n.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const l=o.value.getBBox();(l.width!==t.value.width||l.height!==t.value.height)&&(t.value=l)}return(l,r)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[l.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*l.labelBgPadding[0]}px`,height:`${t.value.height+2*l.labelBgPadding[1]}px`,x:-l.labelBgPadding[0],y:-l.labelBgPadding[1],style:n.normalizeStyle(l.labelBgStyle),rx:l.labelBgBorderRadius,ry:l.labelBgBorderRadius},null,12,r0)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(l.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:l.labelStyle}),[n.renderSlot(l.$slots,"default",{},()=>[typeof l.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(l.label),1)],64))])],16,s0)],8,l0))}}),u0=["id","d","marker-end","marker-start"],f0=["d","stroke-width"],m0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Oi=n.defineComponent({...m0,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),a=n.ref(null),l=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:a}),(r,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(l),{id:r.id,ref_key:"pathEl",ref:o,d:r.path,class:"vue-flow__edge-path","marker-end":r.markerEnd,"marker-start":r.markerStart}),null,16,u0),r.interactionWidth?(n.openBlock(),n.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:r.path,"stroke-width":r.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,f0)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(d0,{key:1,ref_key:"labelEl",ref:a,x:r.labelX,y:r.labelY,label:r.label,"label-show-bg":r.labelShowBg,"label-bg-style":r.labelBgStyle,"label-bg-padding":r.labelBgPadding,"label-bg-border-radius":r.labelBgBorderRadius,"label-style":r.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):n.createCommentVNode("",!0)],64))}});function _d({sourceX:e,sourceY:t,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,l=o<e?o+a:o-a,r=Math.abs(i-t)/2,s=i<t?i+r:i-r;return[l,s,a,r]}function kd({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:r,targetControlY:s}){const c=e*.125+a*.375+r*.375+o*.125,d=t*.125+l*.375+s*.375+i*.125,u=Math.abs(c-e),f=Math.abs(d-t);return[c,d,u,f]}function Li(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wd({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Se.Left:r=t-Li(t-i,l),s=o;break;case Se.Right:r=t+Li(i-t,l),s=o;break;case Se.Top:r=t,s=o-Li(o-a,l);break;case Se.Bottom:r=t,s=o+Li(a-o,l);break}return[r,s]}function Ed(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,curvature:s=.25}=e,[c,d]=wd({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=wd({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[h,m,p,g]=kd({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${a},${l}`,h,m,p,g]}function vd({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case Se.Left:case Se.Right:l=.5*(t+i),r=o;break;case Se.Top:case Se.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function Nd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top}=e,[s,c]=vd({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=vd({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,h,m,p]=kd({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${l}`,f,h,m,p]}const $d={[Se.Left]:{x:-1,y:0},[Se.Right]:{x:1,y:0},[Se.Top]:{x:0,y:-1},[Se.Bottom]:{x:0,y:1}};function p0({source:e,sourcePosition:t=Se.Bottom,target:o}){return t===Se.Left||t===Se.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 xd(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function h0({source:e,sourcePosition:t=Se.Bottom,target:o,targetPosition:i=Se.Top,center:a,offset:l}){const r=$d[t],s=$d[i],c={x:e.x+r.x*l,y:e.y+r.y*l},d={x:o.x+s.x*l,y:o.y+s.y*l},u=p0({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let m,p,g;const b={x:0,y:0},_={x:0,y:0},[V,y,v,ee]=_d({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){p=a.x??V,g=a.y??y;const O=[{x:p,y:c.y},{x:p,y:d.y}],P=[{x:c.x,y:g},{x:d.x,y:g}];r[f]===h?m=f==="x"?O:P:m=f==="x"?P:O}else{const O=[{x:c.x,y:d.y}],P=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===h?P:O:m=r.y===h?O:P,t===i){const oe=Math.abs(e[f]-o[f]);if(oe<=l){const k=Math.min(l-1,l-oe);r[f]===h?b[f]=(c[f]>e[f]?-1:1)*k:_[f]=(d[f]>o[f]?-1:1)*k}}if(t!==i){const oe=f==="x"?"y":"x",k=r[f]===s[oe],Y=c[oe]>d[oe],S=c[oe]<d[oe];(r[f]===1&&(!k&&Y||k&&S)||r[f]!==1&&(!k&&S||k&&Y))&&(m=f==="x"?O:P)}const H={x:c.x+b.x,y:c.y+b.y},ne={x:d.x+_.x,y:d.y+_.y},ce=Math.max(Math.abs(H.x-m[0].x),Math.abs(ne.x-m[0].x)),L=Math.max(Math.abs(H.y-m[0].y),Math.abs(ne.y-m[0].y));ce>=L?(p=(H.x+ne.x)/2,g=m[0].y):(p=m[0].x,g=(H.y+ne.y)/2)}return[[e,{x:c.x+b.x,y:c.y+b.y},...m,{x:d.x+_.x,y:d.y+_.y},o],p,g,v,ee]}function y0(e,t,o,i){const a=Math.min(xd(e,t)/2,xd(t,o)/2,i),{x:l,y:r}=t;if(e.x===l&&l===o.x||e.y===r&&r===o.y)return`L${l} ${r}`;if(e.y===r){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${l+a*d},${r}Q ${l},${r} ${l},${r+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${l},${r+a*c}Q ${l},${r} ${l+a*s},${r}`}function _l(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,h,m,p,g]=h0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((_,V,y)=>{let v;return y>0&&y<f.length-1?v=y0(f[y-1],V,f[y+1],s):v=`${y===0?"M":"L"}${V.x} ${V.y}`,_+=v,_},""),h,m,p,g]}function g0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=_d({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const b0=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=g0(e);return n.h(Oi,{path:o,labelX:i,labelY:a,...t,...e})}}}),Id=n.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:t}){return()=>{const[o,i,a]=_l({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Oi,{path:o,labelX:i,labelY:a,...t,...e})}}}),_0=n.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>n.h(Id,{...e,...t,borderRadius:0})}}),k0=n.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:t}){return()=>{const[o,i,a]=Ed({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Oi,{path:o,labelX:i,labelY:a,...t,...e})}}}),w0=n.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:t}){return()=>{const[o,i,a]=Nd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Oi,{path:o,labelX:i,labelY:a,...t,...e})}}}),E0={input:a0,default:o0,output:i0},v0={default:k0,straight:b0,step:_0,smoothstep:Id,simplebezier:w0};function N0(e,t,o){const i=n.computed(()=>g=>t.value.get(g)),a=n.computed(()=>g=>o.value.get(g)),l=n.computed(()=>{const g={...v0,...e.edgeTypes},b=Object.keys(g);for(const _ of e.edges)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),r=n.computed(()=>{const g={...E0,...e.nodeTypes},b=Object.keys(g);for(const _ of e.nodes)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?Fc(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const b of e.edges){const _=t.value.get(b.source),V=t.value.get(b.target);$b({sourcePos:_.computedPosition||{x:0,y:0},targetPos:V.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:V.dimensions.width,targetHeight:V.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(b)}return g}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const g=[];for(const b of e.nodes)b.selected&&g.push(b);return g}),f=n.computed(()=>{const g=[];for(const b of e.edges)b.selected&&g.push(b);return g}),h=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const g=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&g.push(b);return g}),p=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:l,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:p}}class un{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??un.instance;return un.instance=i??new un,o&&(o.config.globalProperties.$vueFlowStorage=un.instance),un.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=bd(),a=n.reactive(i),l={};for(const[h,m]of Object.entries(a.hooks)){const p=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;l[p]=m.on}const r={};for(const[h,m]of Object.entries(a.hooks))r[h]=m.trigger;const s=n.computed(()=>{const h=new Map;for(const m of a.nodes)h.set(m.id,m);return h}),c=n.computed(()=>{const h=new Map;for(const m of a.edges)h.set(m.id,m);return h}),d=N0(a,s,c),u=e0(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...wp(a),nodeLookup:s,edgeLookup:c,emits:r,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function ze(e){const t=un.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},l=a.id,r=l??(o==null?void 0:o.vueFlowId);let s;if(o){const c=n.inject(ud,null);typeof c<"u"&&c!==null&&(!r||c.id===r)&&(s=c)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const c=l??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,h,m)=>{const p=b=>{d.applyNodeChanges(b)},g=b=>{d.applyEdgeChanges(b)};f?(d.onNodesChange(p),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(g)),m(()=>{d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),to(()=>{if(s){const f=t.get(s.id);f?f.$destroy():wo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(ud,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Qe(qe.USEVUEFLOW_OPTIONS))}return s}function $0(e){const{emits:t,dimensions:o}=ze();let i;n.onMounted(()=>{const a=()=>{var l,r;if(!e.value||!(((r=(l=e.value).checkVisibility)==null?void 0:r.call(l))??!0))return;const s=Ii(e.value);(s.width===0||s.height===0)&&t.error(new Qe(qe.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const x0={name:"UserSelection",compatConfig:{MODE:3}},I0=n.defineComponent({...x0,props:{userSelectionRect:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:n.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),S0=["tabIndex"],C0={name:"NodesSelection",compatConfig:{MODE:3}},R0=n.defineComponent({...C0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=ze(),s=gd(),c=n.ref(null),d=pd({el:c,onStart(p){t.selectionDragStart(p),t.nodeDragStart(p)},onDrag(p){t.selectionDrag(p),t.nodeDrag(p)},onStop(p){t.selectionDragStop(p),t.nodeDragStop(p)}});n.onMounted(()=>{var p;l.value||(p=c.value)==null||p.focus({preventScroll:!0})});const u=n.computed(()=>rl(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(p){t.selectionContextMenu({event:p,nodes:i.value})}function m(p){l.value||Tn[p.key]&&(p.preventDefault(),s({x:Tn[p.key].x,y:Tn[p.key].y},p.shiftKey))}return(p,g)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(l)?void 0:-1,onContextmenu:h,onKeydown:m},null,46,S0)],6)):n.createCommentVNode("",!0)}});function V0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const A0={name:"Pane",compatConfig:{MODE:3}},T0=n.defineComponent({...A0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:l,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:h,removeEdges:m,selectionMode:p,deleteKeyCode:g,multiSelectionKeyCode:b,multiSelectionActive:_,edgeLookup:V,nodeLookup:y,connectionLookup:v,defaultEdgeOptions:ee,connectionStartHandle:x,panOnDrag:O}=ze(),P=n.shallowRef(null),H=n.shallowRef(new Set),ne=n.shallowRef(new Set),ce=n.shallowRef(null),L=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>x.value!==null);let k=!1,Y=!1;const S=ho(g,{actInsideInputWithModifier:!1}),F=ho(b);n.watch(S,ue=>{ue&&(h(f.value),m(u.value),d.value=!1)}),n.watch(F,ue=>{_.value=ue});function U(ue,fe){return ge=>{ge.target===fe&&(ue==null||ue(ge))}}function le(ue){if(k||oe.value){k=!1;return}a.paneClick(ue),r(),d.value=!1}function E(ue){var fe;if(Array.isArray(O.value)&&((fe=O.value)!=null&&fe.includes(2))){ue.preventDefault();return}a.paneContextMenu(ue)}function K(ue){a.paneScroll(ue)}function re(ue){var fe,ge,Ee;if(ce.value=((fe=t.value)==null?void 0:fe.getBoundingClientRect())??null,!c.value||!e.isSelecting||ue.button!==0||ue.target!==P.value||!ce.value)return;(Ee=(ge=ue.target)==null?void 0:ge.setPointerCapture)==null||Ee.call(ge,ue.pointerId);const{x:Re,y:Ie}=V0(ue,ce.value);Y=!0,k=!1,r(),s.value={width:0,height:0,startX:Re,startY:Ie,x:Re,y:Ie},a.selectionStart(ue)}function pe(ue){var fe;if(!ce.value||!s.value)return;k=!0;const{x:ge,y:Ee}=xt(ue,ce.value),{startX:Re=0,startY:Ie=0}=s.value,he={startX:Re,startY:Ie,x:ge<Re?ge:Re,y:Ee<Ie?Ee:Ie,width:Math.abs(ge-Re),height:Math.abs(Ee-Ie)},j=H.value,W=ne.value;H.value=new Set(Fc(o.value,he,i.value,p.value===il.Partial,!0).map(I=>I.id)),ne.value=new Set;const w=((fe=ee.value)==null?void 0:fe.selectable)??!0;for(const I of H.value){const C=v.value.get(I);if(C)for(const{edgeId:G}of C.values()){const J=V.value.get(G);J&&(J.selectable??w)&&ne.value.add(G)}}if(!dd(j,H.value)){const I=Wt(y.value,H.value,!0);a.nodesChange(I)}if(!dd(W,ne.value)){const I=Wt(V.value,ne.value);a.edgesChange(I)}s.value=he,l.value=!0,d.value=!1}function ye(ue){var fe;ue.button!==0||!Y||((fe=ue.target)==null||fe.releasePointerCapture(ue.pointerId),!l.value&&s.value&&ue.target===P.value&&le(ue),l.value=!1,s.value=null,d.value=H.value.size>0,a.selectionEnd(ue),e.selectionKeyPressed&&(k=!1),Y=!1)}return(ue,fe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:P,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:ue.isSelecting}]),onClick:fe[0]||(fe[0]=ge=>L.value?void 0:U(le,P.value)(ge)),onContextmenu:fe[1]||(fe[1]=ge=>U(E,P.value)(ge)),onWheelPassive:fe[2]||(fe[2]=ge=>U(K,P.value)(ge)),onPointerenter:fe[3]||(fe[3]=ge=>L.value?void 0:n.unref(a).paneMouseEnter(ge)),onPointerdown:fe[4]||(fe[4]=ge=>L.value?re(ge):n.unref(a).paneMouseMove(ge)),onPointermove:fe[5]||(fe[5]=ge=>L.value?pe(ge):n.unref(a).paneMouseMove(ge)),onPointerup:fe[6]||(fe[6]=ge=>L.value?ye(ge):void 0),onPointerleave:fe[7]||(fe[7]=ge=>n.unref(a).paneMouseLeave(ge))},[n.renderSlot(ue.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(I0,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(d)&&n.unref(f).length?(n.openBlock(),n.createBlock(R0,{key:1})):n.createCommentVNode("",!0)],34))}}),M0={name:"Transform",compatConfig:{MODE:3}},B0=n.defineComponent({...M0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=ze(),a=n.computed(()=>o.value?!i.value:!1),l=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(r,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:l.value,opacity:a.value?0:void 0})},[n.renderSlot(r.$slots,"default")],4))}}),D0={name:"Viewport",compatConfig:{MODE:3}},O0=n.defineComponent({...D0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:l,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:m,zoomOnScroll:p,preventScrolling:g,noWheelClassName:b,noPanClassName:_,emits:V,connectionStartHandle:y,userSelectionActive:v,paneDragging:ee,d3Zoom:x,d3Selection:O,d3ZoomHandler:P,viewport:H,viewportRef:ne,paneClickDistance:ce}=ze();$0(ne);const L=n.shallowRef(!1),oe=n.shallowRef(!1);let k=null,Y=!1,S=0,F={x:0,y:0,zoom:0};const U=ho(s),le=ho(r),E=ho(l),K=n.toRef(()=>(!le.value||le.value&&r.value===!0)&&(U.value||f.value)),re=n.toRef(()=>U.value||c.value),pe=n.toRef(()=>r.value===!0&&K.value!==!0),ye=n.toRef(()=>le.value&&r.value!==!0||v.value||pe.value),ue=n.toRef(()=>y.value!==null);n.onMounted(()=>{if(!ne.value){wo("Viewport element is missing");return}const Ie=ne.value,he=Ie.getBoundingClientRect(),j=ab().clickDistance(ce.value).scaleExtent([t.value,o.value]).translateExtent(a.value),W=ht(Ie).call(j),w=W.on("wheel.zoom"),I=An.translate(i.value.x??0,i.value.y??0).scale(rn(i.value.zoom??1,t.value,o.value)),C=[[0,0],[he.width,he.height]],G=j.constrain()(I,C,a.value);j.transform(W,G),j.wheelDelta(sl),x.value=j,O.value=W,P.value=w,H.value={x:G.x,y:G.y,zoom:G.k},j.on("start",J=>{var be;if(!J.sourceEvent)return null;S=J.sourceEvent.button,L.value=!0;const we=Ee(J.transform);((be=J.sourceEvent)==null?void 0:be.type)==="mousedown"&&(ee.value=!0),F=we,V.viewportChangeStart(we),V.moveStart({event:J,flowTransform:we})}),j.on("end",J=>{if(!J.sourceEvent)return null;if(L.value=!1,ee.value=!1,fe(K.value,S??0)&&!Y&&V.paneContextMenu(J.sourceEvent),Y=!1,ge(F,J.transform)){const be=Ee(J.transform);F=be,V.viewportChangeEnd(be),V.moveEnd({event:J,flowTransform:be})}}),j.filter(J=>{var be;const we=E.value||p.value,$e=m.value&&J.ctrlKey,_e=J.button,Ce=J.type==="wheel";if(_e===1&&J.type==="mousedown"&&(Re(J,"vue-flow__node")||Re(J,"vue-flow__edge")))return!0;if(!K.value&&!we&&!re.value&&!h.value&&!m.value||v.value||ue.value&&!Ce||!h.value&&J.type==="dblclick"||Re(J,b.value)&&Ce||Re(J,_.value)&&(!Ce||re.value&&Ce&&!E.value)||!m.value&&J.ctrlKey&&Ce||!we&&!re.value&&!$e&&Ce)return!1;if(!m&&J.type==="touchstart"&&((be=J.touches)==null?void 0:be.length)>1)return J.preventDefault(),!1;if(!K.value&&(J.type==="mousedown"||J.type==="touchstart")||pe.value&&Array.isArray(f.value)&&f.value.includes(0)&&_e===0||Array.isArray(f.value)&&!f.value.includes(_e)&&(J.type==="mousedown"||J.type==="touchstart"))return!1;const Te=Array.isArray(f.value)&&f.value.includes(_e)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!_e||_e<=1;return(!J.ctrlKey||U.value||Ce)&&Te}),n.watch([v,K],()=>{v.value&&!L.value?j.on("zoom",null):v.value||j.on("zoom",J=>{H.value={x:J.transform.x,y:J.transform.y,zoom:J.transform.k};const be=Ee(J.transform);Y=fe(K.value,S??0),V.viewportChange(be),V.move({event:J,flowTransform:be})})},{immediate:!0}),n.watch([v,re,d,E,m,g,b],()=>{re.value&&!E.value&&!v.value?W.on("wheel.zoom",J=>{if(Re(J,b.value))return!1;const be=E.value||p.value,we=m.value&&J.ctrlKey;if(!(!g.value||re.value||be||we))return!1;J.preventDefault(),J.stopImmediatePropagation();const _e=W.property("__zoom").k||1,Ce=ko();if(!U.value&&J.ctrlKey&&m.value&&Ce){const ae=Et(J),T=sl(J),z=_e*2**T;j.scaleTo(W,z,ae,J);return}const Te=J.deltaMode===1?20:1;let Be=d.value===po.Vertical?0:J.deltaX*Te,N=d.value===po.Horizontal?0:J.deltaY*Te;!Ce&&J.shiftKey&&d.value!==po.Vertical&&!Be&&N&&(Be=N,N=0),j.translateBy(W,-(Be/_e)*u.value,-(N/_e)*u.value);const A=Ee(W.property("__zoom"));k&&clearTimeout(k),oe.value?(V.move({event:J,flowTransform:A}),V.viewportChange(A),k=setTimeout(()=>{V.moveEnd({event:J,flowTransform:A}),V.viewportChangeEnd(A),oe.value=!1},150)):(oe.value=!0,V.moveStart({event:J,flowTransform:A}),V.viewportChangeStart(A))},{passive:!1}):typeof w<"u"&&W.on("wheel.zoom",function(J,be){const we=!g.value&&J.type==="wheel"&&!J.ctrlKey,$e=E.value||p.value,_e=m.value&&J.ctrlKey;if(!$e&&!c.value&&!_e&&J.type==="wheel"||we||Re(J,b.value))return null;J.preventDefault(),w.call(this,J,be)},{passive:!1})},{immediate:!0})});function fe(Ie,he){return he===2&&Array.isArray(Ie)&&Ie.includes(2)}function ge(Ie,he){return Ie.x!==he.x&&!Number.isNaN(he.x)||Ie.y!==he.y&&!Number.isNaN(he.y)||Ie.zoom!==he.k&&!Number.isNaN(he.k)}function Ee(Ie){return{x:Ie.x,y:Ie.y,zoom:Ie.k}}function Re(Ie,he){return Ie.target.closest(`.${he}`)}return(Ie,he)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:ne,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(T0,{"is-selecting":ye.value,"selection-key-pressed":n.unref(le),class:n.normalizeClass({connecting:ue.value,dragging:n.unref(ee),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(B0,null,{default:n.withCtx(()=>[n.renderSlot(Ie.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),L0=["id"],P0=["id"],z0=["id"],U0={name:"A11yDescriptions",compatConfig:{MODE:3}},H0=n.defineComponent({...U0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=ze();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Tc)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.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,L0),n.createElementVNode("div",{id:`${n.unref(Mc)}-${n.unref(t)}`,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,P0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(ub)}-${n.unref(t)}`,"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%)"}},n.toDisplayString(n.unref(i)),9,z0))],64))}});function F0(){const e=ze();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function G0(e,t,o){return o===Se.Left?e-t:o===Se.Right?e+t:e}function Y0(e,t,o){return o===Se.Top?e-t:o===Se.Bottom?e+t:e}const kl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Se.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:G0(t,e,i),cy:Y0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};kl.props=["radius","centerX","centerY","position","type"],kl.compatConfig={MODE:3};const Sd=kl,W0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:l,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:h,multiSelectionActive:m,disableKeyboardA11y:p,elementsSelectable:g,edgesUpdatable:b,edgesFocusable:_,hooks:V}=ze(),y=n.computed(()=>u(e.id)),{emit:v,on:ee}=Ub(y.value,l),x=n.inject(Vi),O=n.getCurrentInstance(),P=n.ref(!1),H=n.ref(!1),ne=n.ref(""),ce=n.ref(null),L=n.ref("source"),oe=n.ref(null),k=n.toRef(()=>typeof y.value.selectable>"u"?g.value:y.value.selectable),Y=n.toRef(()=>typeof y.value.updatable>"u"?b.value:y.value.updatable),S=n.toRef(()=>typeof y.value.focusable>"u"?_.value:y.value.focusable);n.provide(Lb,e.id),n.provide(Pb,oe);const F=n.computed(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),U=n.computed(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),le=n.computed(()=>{const I=y.value.type||"default",C=x==null?void 0:x[`edge-${I}`];if(C)return C;let G=y.value.template??c.value[I];if(typeof G=="string"&&O){const J=Object.keys(O.appContext.components);J&&J.includes(I)&&(G=n.resolveComponent(I,!1))}return G&&typeof G!="string"?G:(l.error(new Qe(qe.EDGE_TYPE_MISSING,G)),!1)}),{handlePointerDown:E}=hd({nodeId:ne,handleId:ce,type:L,isValidConnection:h,edgeUpdaterType:L,onEdgeUpdate:pe,onEdgeUpdateEnd:ye});return()=>{const I=f(y.value.source),C=f(y.value.target),G="pathOptions"in y.value?y.value.pathOptions:{};if(!I&&!C)return l.error(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!I)return l.error(new Qe(qe.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!C)return l.error(new Qe(qe.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||I.hidden||C.hidden)return null;let J;i.value===Dt.Strict?J=I.handleBounds.source:J=[...I.handleBounds.source||[],...I.handleBounds.target||[]];const be=td(J,y.value.sourceHandle);let we;i.value===Dt.Strict?we=C.handleBounds.target:we=[...C.handleBounds.target||[],...C.handleBounds.source||[]];const $e=td(we,y.value.targetHandle),_e=(be==null?void 0:be.position)||Se.Bottom,Ce=($e==null?void 0:$e.position)||Se.Top,{x:Te,y:Be}=Bn(I,be,_e),{x:N,y:A}=Bn(C,$e,Ce);return y.value.sourceX=Te,y.value.sourceY=Be,y.value.targetX=N,y.value.targetY=A,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${le.value===!1?"default":y.value.type||"default"}`,s.value,F.value,{updating:P.value,selected:y.value.selected,animated:y.value.animated,inactive:!k.value&&!V.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":y.value.ariaLabel===null?void 0:y.value.ariaLabel??`Edge from ${y.value.source} to ${y.value.target}`,"aria-describedby":S.value?`${Mc}-${t}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",...y.value.domAttributes,onClick:fe,onContextmenu:ge,onDblclick:Ee,onMouseenter:Re,onMousemove:Ie,onMouseleave:he,onKeyDown:S.value?w:void 0},[H.value?null:n.h(le.value===!1?c.value.default:le.value,{id:e.id,sourceNode:I,targetNode:C,source:y.value.source,target:y.value.target,type:y.value.type,updatable:Y.value,selected:y.value.selected,animated:y.value.animated,label:y.value.label,labelStyle:y.value.labelStyle,labelShowBg:y.value.labelShowBg,labelBgStyle:y.value.labelBgStyle,labelBgPadding:y.value.labelBgPadding,labelBgBorderRadius:y.value.labelBgBorderRadius,data:y.value.data,events:{...y.value.events,...ee},style:U.value,markerStart:`url('#${_o(y.value.markerStart,t)}')`,markerEnd:`url('#${_o(y.value.markerEnd,t)}')`,sourcePosition:_e,targetPosition:Ce,sourceX:Te,sourceY:Be,targetX:N,targetY:A,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth,...G}),[Y.value==="source"||Y.value===!0?[n.h("g",{onMousedown:j,onMouseenter:K,onMouseout:re},n.h(Sd,{position:_e,centerX:Te,centerY:Be,radius:a.value,type:"source","data-type":"source"}))]:null,Y.value==="target"||Y.value===!0?[n.h("g",{onMousedown:W,onMouseenter:K,onMouseout:re},n.h(Sd,{position:Ce,centerX:N,centerY:A,radius:a.value,type:"target","data-type":"target"}))]:null]])};function K(){P.value=!0}function re(){P.value=!1}function pe(I,C){v.update({event:I,edge:y.value,connection:C})}function ye(I){v.updateEnd({event:I,edge:y.value}),H.value=!1}function ue(I,C){I.button===0&&(H.value=!0,ne.value=C?y.value.target:y.value.source,ce.value=(C?y.value.targetHandle:y.value.sourceHandle)??null,L.value=C?"target":"source",v.updateStart({event:I,edge:y.value}),E(I))}function fe(I){var C;const G={event:I,edge:y.value};k.value&&(r.value=!1,y.value.selected&&m.value?(d([y.value]),(C=oe.value)==null||C.blur()):o([y.value])),v.click(G)}function ge(I){v.contextMenu({event:I,edge:y.value})}function Ee(I){v.doubleClick({event:I,edge:y.value})}function Re(I){v.mouseEnter({event:I,edge:y.value})}function Ie(I){v.mouseMove({event:I,edge:y.value})}function he(I){v.mouseLeave({event:I,edge:y.value})}function j(I){ue(I,!0)}function W(I){ue(I,!1)}function w(I){var C;!p.value&&Bc.includes(I.key)&&k.value&&(I.key==="Escape"?((C=oe.value)==null||C.blur(),d([u(e.id)])):o([u(e.id)]))}}}),K0=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:l,connectionLineType:r,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:f}=ze(),h=(e=n.inject(Vi))==null?void 0:e["connection-line"],m=n.computed(()=>{var V;return f((V=i.value)==null?void 0:V.nodeId)}),p=n.computed(()=>{var V;return f((V=a.value)==null?void 0:V.nodeId)??null}),g=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),b=n.computed(()=>c.value.markerStart?`url(#${_o(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${_o(c.value.markerEnd,t)})`:"");return()=>{var V,y,v;if(!m.value||!i.value)return null;const ee=i.value.id,x=i.value.type,O=m.value.handleBounds;let P=(O==null?void 0:O[x])??[];if(o.value===Dt.Loose){const U=(O==null?void 0:O[x==="source"?"target":"source"])??[];P=[...P,...U]}if(!P)return null;const H=(ee?P.find(U=>U.id===ee):P[0])??null,ne=(H==null?void 0:H.position)??Se.Top,{x:ce,y:L}=Bn(m.value,H,ne);let oe=null;p.value&&(o.value===Dt.Strict?oe=((V=p.value.handleBounds[x==="source"?"target":"source"])==null?void 0:V.find(U=>{var le;return U.id===((le=a.value)==null?void 0:le.id)}))||null:oe=((y=[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]])==null?void 0:y.find(U=>{var le;return U.id===((le=a.value)==null?void 0:le.id)}))||null);const k=((v=a.value)==null?void 0:v.position)??(ne?pl[ne]:null);if(!ne||!k)return null;const Y=r.value??c.value.type??ln.Bezier;let S="";const F={sourceX:ce,sourceY:L,sourcePosition:ne,targetX:g.value.x,targetY:g.value.y,targetPosition:k};return Y===ln.Bezier?[S]=Ed(F):Y===ln.Step?[S]=_l({...F,borderRadius:0}):Y===ln.SmoothStep?[S]=_l(F):Y===ln.SimpleBezier?[S]=Nd(F):S=`M${ce},${L} ${g.value.x},${g.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},h?n.h(h,{sourceX:ce,sourceY:L,sourcePosition:ne,targetX:g.value.x,targetY:g.value.y,targetPosition:k,sourceNode:m.value,sourceHandle:H,targetNode:p.value,targetHandle:oe,markerEnd:_.value,markerStart:b.value,connectionStatus:d.value}):n.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":b.value})))}}}),q0=["id","markerWidth","markerHeight","markerUnits","orient"],X0={name:"MarkerType",compatConfig:{MODE:3}},j0=n.defineComponent({...X0,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(t,o)=>(n.openBlock(),n.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===n.unref(al).ArrowClosed?(n.openBlock(),n.createElementBlock("polyline",{key:0,style:n.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):n.createCommentVNode("",!0),t.type===n.unref(al).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,q0))}}),Z0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},J0={name:"MarkerDefinitions",compatConfig:{MODE:3}},Q0=n.defineComponent({...J0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=ze(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=_o(d,t);r.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),r.add(u))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const u of[d.markerStart,d.markerEnd])c(u);return s.sort((d,u)=>d.id.localeCompare(u.id))});return(r,s)=>(n.openBlock(),n.createElementBlock("svg",Z0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(j0,{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))])]))}}),e1={name:"Edges",compatConfig:{MODE:3}},t1=n.defineComponent({...e1,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=ze();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(Q0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),r=>(n.openBlock(),n.createElementBlock("svg",{key:r.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(xb)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(W0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(K0))],64))}}),n1=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:l,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:m,disableKeyboardA11y:p,ariaLiveMessage:g,snapToGrid:b,snapGrid:_,nodeDragThreshold:V,nodesDraggable:y,elementsSelectable:v,nodesConnectable:ee,nodesFocusable:x,hooks:O}=ze(),P=n.ref(null);n.provide(md,P),n.provide(fd,e.id);const H=n.inject(Vi),ne=n.getCurrentInstance(),ce=gd(),{node:L,parentNode:oe}=yd(e.id),{emit:k,on:Y}=Yb(L,r),S=n.toRef(()=>typeof L.draggable>"u"?y.value:L.draggable),F=n.toRef(()=>typeof L.selectable>"u"?v.value:L.selectable),U=n.toRef(()=>typeof L.connectable>"u"?ee.value:L.connectable),le=n.toRef(()=>typeof L.focusable>"u"?x.value:L.focusable),E=n.computed(()=>F.value||S.value||O.value.nodeClick.hasListeners()||O.value.nodeDoubleClick.hasListeners()||O.value.nodeMouseEnter.hasListeners()||O.value.nodeMouseMove.hasListeners()||O.value.nodeMouseLeave.hasListeners()),K=n.toRef(()=>!!L.dimensions.width&&!!L.dimensions.height),re=n.computed(()=>{const C=L.type||"default",G=H==null?void 0:H[`node-${C}`];if(G)return G;let J=L.template||f.value[C];if(typeof J=="string"&&ne){const be=Object.keys(ne.appContext.components);be&&be.includes(C)&&(J=n.resolveComponent(C,!1))}return J&&typeof J!="string"?J:(r.error(new Qe(qe.NODE_TYPE_MISSING,J)),!1)}),pe=pd({id:e.id,el:P,disabled:()=>!S.value,selectable:F,dragHandle:()=>L.dragHandle,onStart(C){k.dragStart(C)},onDrag(C){k.drag(C)},onStop(C){k.dragStop(C)},onClick(C){w(C)}}),ye=n.computed(()=>L.class instanceof Function?L.class(L):L.class),ue=n.computed(()=>{const C=(L.style instanceof Function?L.style(L):L.style)||{},G=L.width instanceof Function?L.width(L):L.width,J=L.height instanceof Function?L.height(L):L.height;return!C.width&&G&&(C.width=typeof G=="string"?G:`${G}px`),!C.height&&J&&(C.height=typeof J=="string"?J:`${J}px`),C}),fe=n.toRef(()=>Number(L.zIndex??ue.value.zIndex??0));return u(C=>{(C.includes(e.id)||!C.length)&&Ee()}),n.onMounted(()=>{n.watch(()=>L.hidden,(C=!1,G,J)=>{!C&&P.value&&(e.resizeObserver.observe(P.value),J(()=>{P.value&&e.resizeObserver.unobserve(P.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>L.type,()=>L.sourcePosition,()=>L.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:P.value,forceUpdate:!0}])})}),n.watch([()=>L.position.x,()=>L.position.y,()=>{var C;return(C=oe.value)==null?void 0:C.computedPosition.x},()=>{var C;return(C=oe.value)==null?void 0:C.computedPosition.y},()=>{var C;return(C=oe.value)==null?void 0:C.computedPosition.z},fe,()=>L.selected,()=>L.dimensions.height,()=>L.dimensions.width,()=>{var C;return(C=oe.value)==null?void 0:C.dimensions.height},()=>{var C;return(C=oe.value)==null?void 0:C.dimensions.width}],([C,G,J,be,we,$e])=>{const _e={x:C,y:G,z:$e+(m.value&&L.selected?1e3:0)};typeof J<"u"&&typeof be<"u"?L.computedPosition=kb({x:J,y:be,z:we},_e):L.computedPosition=_e},{flush:"post",immediate:!0}),n.watch([()=>L.extent,h],([C,G],[J,be])=>{(C!==J||G!==be)&&ge()}),L.extent==="parent"||typeof L.extent=="object"&&"range"in L.extent&&L.extent.range==="parent"?Oa(()=>K).toBe(!0).then(ge):ge(),()=>L.hidden?null:n.h("div",{ref:P,"data-id":L.id,class:["vue-flow__node",`vue-flow__node-${re.value===!1?"default":L.type||"default"}`,{[o.value]:S.value,dragging:pe==null?void 0:pe.value,draggable:S.value,selected:L.selected,selectable:F.value,parent:L.isParent},ye.value],style:{visibility:K.value?"visible":"hidden",zIndex:L.computedPosition.z??fe.value,transform:`translate(${L.computedPosition.x}px,${L.computedPosition.y}px)`,pointerEvents:E.value?"all":"none",...ue.value},tabIndex:le.value?0:void 0,role:le.value?"group":void 0,"aria-describedby":p.value?void 0:`${Tc}-${t}`,"aria-label":L.ariaLabel,"aria-roledescription":"node",...L.domAttributes,onMouseenter:Re,onMousemove:Ie,onMouseleave:he,onContextmenu:j,onClick:w,onDblclick:W,onKeydown:I},[n.h(re.value===!1?f.value.default:re.value,{id:L.id,type:L.type,data:L.data,events:{...L.events,...Y},selected:L.selected,resizing:L.resizing,dragging:pe.value,connectable:U.value,position:L.computedPosition,dimensions:L.dimensions,isValidTargetPos:L.isValidTargetPos,isValidSourcePos:L.isValidSourcePos,parent:L.parentNode,parentNodeId:L.parentNode,zIndex:L.computedPosition.z??fe.value,targetPosition:L.targetPosition,sourcePosition:L.sourcePosition,label:L.label,dragHandle:L.dragHandle,onUpdateNodeInternals:Ee})]);function ge(){const C=L.computedPosition,{computedPosition:G,position:J}=ul(L,b.value?Ri(C,_.value):C,r.error,h.value,oe.value);(L.computedPosition.x!==G.x||L.computedPosition.y!==G.y)&&(L.computedPosition={...L.computedPosition,...G}),(L.position.x!==J.x||L.position.y!==J.y)&&(L.position=J)}function Ee(){P.value&&d([{id:e.id,nodeElement:P.value,forceUpdate:!0}])}function Re(C){pe!=null&&pe.value||k.mouseEnter({event:C,node:L})}function Ie(C){pe!=null&&pe.value||k.mouseMove({event:C,node:L})}function he(C){pe!=null&&pe.value||k.mouseLeave({event:C,node:L})}function j(C){return k.contextMenu({event:C,node:L})}function W(C){return k.doubleClick({event:C,node:L})}function w(C){F.value&&(!i.value||!S.value||V.value>0)&&hl(L,l.value,c,s,a,!1,P.value),k.click({event:C,node:L})}function I(C){if(!(ll(C)||p.value))if(Bc.includes(C.key)&&F.value){const G=C.key==="Escape";hl(L,l.value,c,s,a,G,P.value)}else S.value&&L.selected&&Tn[C.key]&&(C.preventDefault(),g.value=`Moved selected node ${C.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~L.position.x}, y: ${~~L.position.y}`,ce({x:Tn[C.key].x,y:Tn[C.key].y},C.shiftKey))}}});function o1(e={includeHiddenNodes:!1}){const{nodes:t}=ze();return n.computed(()=>{if(t.value.length===0)return!1;for(const o of t.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 i1={class:"vue-flow__nodes vue-flow__container"},a1={name:"Nodes",compatConfig:{MODE:3}},l1=n.defineComponent({...a1,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=ze(),a=o1(),l=n.ref();return n.watch(a,r=>{r&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{l.value=new ResizeObserver(r=>{const s=r.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var r;return(r=l.value)==null?void 0:r.disconnect()}),(r,s)=>(n.openBlock(),n.createElementBlock("div",i1,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const h=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,h))return f;const m=(n.openBlock(),n.createBlock(n.unref(n1),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return m.memo=h,m},s,0),128)):n.createCommentVNode("",!0)]))}});function r1(){const{emits:e}=ze();n.onMounted(()=>{if(ld()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Qe(qe.MISSING_STYLES))}})}const s1=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),c1={name:"VueFlow",compatConfig:{MODE:3}},d1=n.defineComponent({...c1,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:t,emit:o}){const i=e,a=n.useSlots(),l=La(i,"modelValue",o),r=La(i,"nodes",o),s=La(i,"edges",o),c=ze(i),d=Xb({modelValue:l,nodes:r,edges:s},i,c);return Zb(o,c.hooks),F0(),r1(),n.provide(Vi,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(O0,null,{default:n.withCtx(()=>[n.createVNode(t1),s1,n.createVNode(l1),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(H0)],512))}}),u1={name:"Panel",compatConfig:{MODE:3}},Cd=n.defineComponent({...u1,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=ze(),i=n.computed(()=>`${t.position}`.split("-"));return(a,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(a.$slots,"default")],6))}}),fn=["red","amber","green","teal","blue","indigo","violet","pink"],Rd={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function f1(e){return typeof e=="string"&&e in Rd}const m1={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},p1=.15;function h1(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,l=parseInt(o.slice(4,6),16)/255,r=Math.max(i,a,l),s=Math.min(i,a,l),c=r-s,d=(r+s)/2;let u=0,f=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),r===i?f=(a-l)/c%6:r===a?f=(l-i)/c+2:f=(i-a)/c+4,f*=60,f<0&&(f+=360)),{h:f,s:u,l:d}}function y1(e){if(typeof e!="string")return null;const t=h1(e);if(!t||t.s<p1)return null;let o=null,i=1/0;for(const a of fn){const l=Math.abs(t.h-m1[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function at(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(f1(t))return t;const o=e==null?void 0:e.properties;return y1((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function wl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const g1={red:"var(--em-swatch-red-bar)",amber:"var(--em-swatch-amber-bar)",green:"var(--em-swatch-green-bar)",teal:"var(--em-swatch-teal-bar)",blue:"var(--em-swatch-blue-bar)",indigo:"var(--em-swatch-indigo-bar)",violet:"var(--em-swatch-violet-bar)",pink:"var(--em-swatch-pink-bar)"},b1={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function Vd(e,t=!1){return e?t?b1[e]:g1[e]:null}function Dn(e){return Rd[e]}function On(e){return`var(--em-swatch-${e}-bar)`}const _1=["width","height","innerHTML"],k1=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(n.openBlock(),n.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:t[e.name]??""},null,8,_1))}}),Ue=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ue(k1,[["__scopeId","data-v-92c1dba8"]]),w1={class:"em-inline-issue__msgs"},mn=Ue(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},i=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),a=n.computed(()=>{let l=null;for(const r of i.value)(l===null||o[r.severity].order<o[l].order)&&(l=r.severity);return l});return(l,r)=>a.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${a.value}`])},[n.createVNode(Ve,{name:o[a.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",w1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(s,c)=>(n.openBlock(),n.createElementBlock("span",{key:c},n.toDisplayString(s.message),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-17f46a25"]]),E1={class:"em-mlang"},v1={class:"em-mlang__tabs",role:"tablist"},N1=["aria-selected","onClick"],$1={key:0,class:"em-mlang__dot"},El=Ue(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const l=n.ref(a());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function r(d){var u,f;return!!((f=(u=o.modelValue)==null?void 0:u[d])!=null&&f.trim())}const s=n.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[l.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[l.value]:u[l.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",E1,[n.createElementVNode("div",v1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,f=>(n.openBlock(),n.createElementBlock("button",{key:f,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":l.value===f}]),role:"tab","aria-selected":l.value===f,onClick:h=>l.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",$1,"•")):n.createCommentVNode("",!0)],10,N1))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ie.BSTextArea),{key:0,name:`${e.name}-${l.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`${e.name}-${l.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),x1=["disabled"],I1={class:"em-panel__sub-label"},S1={class:"em-field"},C1={class:"em-field"},R1={class:"em-field"},V1={class:"em-class"},A1={class:"em-field"},T1={class:"em-field"},M1={class:"em-field"},B1={class:"em-field"},D1={class:"em-multilang"},O1={class:"em-multilang"},L1={class:"em-jpa"},P1={class:"em-field"},z1={class:"em-field"},U1={class:"em-field"},H1={class:"em-swatch"},F1={class:"em-swatch__row"},G1=["title","onClick"],Ad=Ue(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(L=>L.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(L=>L.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var L;return at(((L=r.value)==null?void 0:L.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=L=>L;function h(L){return L==="inherit"?"기본(따름)":L}function m(L){l.value&&a.updateEntity(l.value.modelId,L)}function p(L,oe,k){var S;const Y=((S=l.value)==null?void 0:S.table)??{physicalName:""};m(L==="physicalName"?{table:{...Y,physicalName:k}}:{table:{...Y,logicalName:{...Y.logicalName,[oe]:k}}})}function g(L){m({description:Object.keys(L).length?L:void 0})}function b(L,oe){var k;m({jpaAttrs:{...(k=l.value)==null?void 0:k.jpaAttrs,[L]:oe}})}function _(L,oe){b(L,oe)}const V=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),y=n.computed(()=>{var L,oe;return!((oe=(L=l.value)==null?void 0:L.jpaAttrs)!=null&&oe.useDiscriminator)});function v(L){b("discriminatorType",L==="inherit"?void 0:L)}function ee(L){m({hasPersonalInfo:L})}function x(L){m({superClass:L.trim()||void 0})}function O(L){m({schema:L.trim()||void 0})}function P(L){m({abstractClass:L})}const H=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function ne(L){const oe=L.split(",").map(k=>k.trim()).filter(Boolean);m({declarationOfInterfaces:oe.length?oe:void 0})}function ce(L){l.value&&a.setEntitySwatch(l.value.modelId,L)}return(L,oe)=>{var k,Y,S;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:oe[0]||(oe[0]=F=>i("toggle"))},[n.createElementVNode("span",I1,[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||l.value.name||"엔티티"),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(mn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",S1,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=F=>m({name:F}))},null,8,["model-value"])]),n.createElementVNode("label",C1,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=F=>m({stereotype:F}))},null,8,["model-value"])]),n.createElementVNode("label",R1,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=F=>m({packageName:F}))},null,8,["model-value"])]),n.createElementVNode("fieldset",V1,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",A1,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=F=>x(F))},null,8,["model-value"])]),n.createElementVNode("label",T1,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":H.value,"onUpdate:modelValue":oe[5]||(oe[5]=F=>ne(F))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=F=>P(F))},null,8,["model-value"])]),n.createElementVNode("label",M1,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-table",width:"100%","model-value":((k=l.value.table)==null?void 0:k.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=F=>p("physicalName",null,F))},null,8,["model-value"])]),n.createElementVNode("label",B1,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=F=>O(F))},null,8,["model-value"])]),n.createElementVNode("fieldset",D1,[oe[21]||(oe[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,F=>{var U,le;return n.openBlock(),n.createElementBlock("label",{key:F,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(F),1),n.createVNode(n.unref(ie.BSTextInput),{name:`ent-logical-${F}`,width:"100%","model-value":((le=(U=l.value.table)==null?void 0:U.logicalName)==null?void 0:le[F])??"","onUpdate:modelValue":E=>p("logicalName",F,E)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",O1,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(El,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",L1,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,F=>{var U;return n.createVNode(n.unref(ie.BSCheckbox),{key:F.key,name:`jpa-${F.key}`,class:"em-check",label:F.label,"model-value":!!((U=l.value.jpaAttrs)!=null&&U[F.key]),"onUpdate:modelValue":le=>_(F.key,le)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",P1,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:y.value,"model-value":((Y=l.value.jpaAttrs)==null?void 0:Y.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=F=>b("discriminatorColumnName",F.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",z1,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ie.BSSelect),{disabled:y.value,"model-value":V.value,items:u,"value-provider":f,"label-provider":h,"onUpdate:modelValue":oe[10]||(oe[10]=F=>F&&v(F))},null,8,["disabled","model-value"])]),n.createElementVNode("label",U1,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ie.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:y.value,"model-value":(S=l.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=F=>b("discriminatorLength",F||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!l.value.hasPersonalInfo,"onUpdate:modelValue":ee},null,8,["model-value"]),n.createElementVNode("fieldset",H1,[oe[27]||(oe[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",F1,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:oe[12]||(oe[12]=F=>ce(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),F=>(n.openBlock(),n.createElementBlock("button",{key:F,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===F}]),style:n.normalizeStyle({background:n.unref(On)(F)}),title:n.unref(Dn)(F),onClick:U=>ce(F)},null,14,G1))),128))])])],64)):n.createCommentVNode("",!0)],8,x1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),Td=["ko","en","ja","zh"];function Y1(e){if(e)for(const t of Td){const o=e[t];if(o)return o}}function vl(e){const t=Y1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function W1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Td.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const K1=["aria-expanded"],q1=["aria-selected","onClick","onMouseenter"],X1={key:0,class:"gcc__opt gcc__opt--empty"},Md=Ue(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=n.ref(),l=n.ref(),r=n.ref(),s=n.ref(""),c=n.ref(!1),d=n.ref(-1),u=n.ref({}),f=n.computed(()=>o.items.find(P=>P.groupCode===o.modelValue)),h=n.computed(()=>f.value?vl(f.value):"");n.watch(h,P=>{c.value||(s.value=P)},{immediate:!0});const m=n.computed(()=>s.value===h.value?o.items:W1(o.items,s.value));function p(){var H;const P=(H=a.value)==null?void 0:H.getBoundingClientRect();P&&(u.value={left:`${P.left}px`,top:`${P.bottom}px`,width:`${P.width}px`})}function g(){c.value=!0,p(),d.value=Math.max(0,m.value.findIndex(P=>P.groupCode===o.modelValue)),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),document.addEventListener("mousedown",O)}function b(){c.value=!1,window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p),document.removeEventListener("mousedown",O)}n.onBeforeUnmount(b);function _(){g(),n.nextTick(()=>{var P;return(P=l.value)==null?void 0:P.select()})}function V(){c.value||g(),d.value=0}function y(P){i("update:modelValue",P.groupCode),s.value=vl(P),b()}function v(){i("update:modelValue",void 0),s.value="",b()}function ee(){s.value.trim()===""?v():(s.value=h.value,b())}function x(P){var H;if(P.key==="ArrowDown")c.value||g(),d.value=Math.min(d.value+1,m.value.length-1),P.preventDefault();else if(P.key==="ArrowUp")d.value=Math.max(d.value-1,0),P.preventDefault();else if(P.key==="Enter"){const ne=m.value[d.value];ne&&y(ne),P.preventDefault()}else P.key==="Escape"&&(s.value=h.value,b(),(H=l.value)==null||H.blur())}function O(P){var ne,ce;const H=P.target;!((ne=a.value)!=null&&ne.contains(H))&&!((ce=r.value)!=null&&ce.contains(H))&&ee()}return(P,H)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":H[0]||(H[0]=ne=>s.value=ne),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:V,onKeydown:x},null,40,K1),[[n.vModelText,s.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[c.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:r,class:"gcc__popup",style:n.normalizeStyle(u.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:H[1]||(H[1]=n.withModifiers(()=>{},["prevent"])),onClick:v},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("li",{key:ne.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":ce===d.value,"is-selected":ne.groupCode===e.modelValue}]),role:"option","aria-selected":ne.groupCode===e.modelValue,onMousedown:H[2]||(H[2]=n.withModifiers(()=>{},["prevent"])),onClick:L=>y(ne),onMouseenter:L=>d.value=ce},n.toDisplayString(n.unref(vl)(ne)),43,q1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",X1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),j1=["disabled"],Z1={class:"em-aw__toolbar"},J1={class:"em-aw__count"},Q1={class:"em-aw__scroll"},e_={class:"em-aw__table"},t_={key:0,class:"c-code"},n_=["colspan"],o_={class:"c-del"},i_={class:"c-flag"},a_={class:"c-flag"},l_={class:"c-flag"},r_={class:"c-flag"},s_={class:"c-flag"},c_={class:"c-flag"},d_={class:"c-flag"},u_={class:"c-flag"},f_={key:0},m_=["title"],p_=["colspan"],h_={class:"c-del"},y_={class:"em-aw__embed-label"},g_={class:"em-aw__ro"},b_={class:"em-aw__ro"},__={class:"em-aw__ro"},k_={class:"em-aw__ro"},w_={colspan:"8"},E_=["colspan"],v_={key:0},N_="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Pi="__OWN__",$_=Ue(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(T=>T.modelId===t.entityId)??null),a=n.computed(()=>{var T;return((T=i.value)==null?void 0:T.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var T;return(((T=i.value)==null?void 0:T.attributes)??[]).filter(z=>z.attrType!=="DIVIDER").length}),s=n.computed(()=>Y.value.length?19:18),c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(T){return T==="none"?"(없음)":T}const u=T=>T;function f(T,z){i.value&&o.updateAttribute(i.value.modelId,T.modelId,z)}function h(T){return!!i.value&&!!ni(o.state.logical,i.value.modelId,T.modelId)}function m(T,z){f(T,{naturalId:z||void 0,naturalIdMutable:z?T.naturalIdMutable:void 0})}function p(){return{naturalId:void 0,naturalIdMutable:void 0}}function g(T,z){f(T,{identifier:z,...z?p():{}})}function b(T,z){f(T,{transient:z||void 0,...z?p():{}})}function _(T){return!!T.transient}const V=T=>T.value,y=T=>T.label;function v(T,z){if(!z)return;const B=ce.value.find(me=>me.type===z);if(B){const me=T.dbAttrs[0]??{modelId:T.modelId+".c",physicalName:T.name,dataType:"VARCHAR"};f(T,{type:z,customType:void 0,dbAttrs:[{...me,dataType:B.dataType,length:B.length,scale:B.scale}]});return}f(T,z===Ct?{type:z}:{type:z,customType:void 0})}function ee(T,z){f(T,{customType:z.trim()===""?void 0:z})}function x(T,z){const me={...T.dbAttrs[0]??{modelId:T.modelId+".c",physicalName:T.name,dataType:"VARCHAR"},...z};z.dataType!==void 0&&!Go.has(me.dataType)&&(me.scale=void 0),f(T,{dbAttrs:[me]})}function O(T){var z;return Go.has(((z=T.dbAttrs[0])==null?void 0:z.dataType)??"")}function P(T,z,B){var me;x(T,{logicalName:{...(me=T.dbAttrs[0])==null?void 0:me.logicalName,[z]:B}})}function H(T){return T.personalInfoAttributeType??"none"}function ne(T,z){f(T,{personalInfoAttributeType:z==="none"?void 0:z})}const ce=n.computed(()=>o.predefinedCustomTypeCatalog.value),L=n.computed(()=>o.embeddableCatalog.value);function oe(T){var z,B;return((z=T.label)==null?void 0:z.ko)??((B=T.label)==null?void 0:B.en)??T.type}function k(T){!T||!i.value||o.addPredefinedEmbed(i.value.modelId,T)}const Y=n.computed(()=>o.groupCodeCatalog.value);function S(T){var z;return((z=Y.value.find(B=>B.groupCode===T.groupCode))==null?void 0:z.codes)??[]}function F(T){return["none",...S(T)]}function U(T){return T==="none"?"none":T.code}function le(T){var B,me;if(T==="none")return"(없음)";const z=((B=T.label)==null?void 0:B.ko)??((me=T.label)==null?void 0:me.en);return z?`${T.code} (${z})`:T.code}function E(T,z){i.value&&o.setAttributeGroupCode(i.value.modelId,T.modelId,z)}function K(T,z){f(T,{defaultValue:z==="none"?void 0:z})}function re(T,z){f(T,{defaultValue:z.trim()===""?void 0:z})}function pe(T){return T.attrType.startsWith("EMBED")&&T.dbAttrs.length>0}function ye(T,z,B){const me=T.dbAttrs.map((Z,Q)=>{if(Q!==z)return Z;const te={...Z,...B};for(const de of Object.keys(B))B[de]===void 0&&delete te[de];return te});i.value&&o.setEmbedColumns(i.value.modelId,T.modelId,me)}function ue(T,z,B,me){var Z;ye(T,z,{logicalName:{...(Z=T.dbAttrs[z])==null?void 0:Z.logicalName,[B]:me}})}function fe(T,z){var Z,Q,te;if(T.attrType==="EMBED_PREDEF"){const de=(Z=o.embeddableCatalog.value.find($=>$.type===T.type))==null?void 0:Z.fields[z];return de?{name:de.name,physicalName:de.physicalName,dataType:de.dataType,length:de.length,shareable:de.shareable,logicalName:de.logicalName}:void 0}const B=(Q=T.embedded)==null?void 0:Q.embeddableRef;if(!B)return;const me=(te=o.state.logical.entities.find(de=>de.modelId===B))==null?void 0:te.attributes.flatMap(de=>de.dbAttrs)[z];return me?{physicalName:me.physicalName,dataType:me.dataType,length:me.length,scale:me.scale,logicalName:me.logicalName}:void 0}function ge(T,z){var B,me;return((B=fe(T,z))==null?void 0:B.dataType)||((me=T.dbAttrs[z])==null?void 0:me.dataType)||""}function Ee(T,z){var B,me;return((B=fe(T,z))==null?void 0:B.length)??((me=T.dbAttrs[z])==null?void 0:me.length)}function Re(T,z){var B,me;return((B=fe(T,z))==null?void 0:B.scale)??((me=T.dbAttrs[z])==null?void 0:me.scale)}const Ie=["inherit","true","false"];function he(T){return T==="inherit"?"기본(따름)":T}function j(T){return(T==null?void 0:T.updatable)===void 0?"inherit":T.updatable?"true":"false"}function W(T,z,B){ye(T,z,{updatable:B==="inherit"?void 0:B==="true"})}function w(T,z){x(T,{updatable:z==="inherit"?void 0:z==="true"})}const I=["inherit","true","false"];function C(T){return T==="inherit"?"기본(따름)":T}function G(T){return(T==null?void 0:T.insertable)===void 0?"inherit":T.insertable?"true":"false"}function J(T,z,B){ye(T,z,{insertable:B==="inherit"?void 0:B==="true"})}function be(T,z){x(T,{insertable:z==="inherit"?void 0:z==="true"})}const we=n.computed(()=>i.value?Yo(i.value,o.state.logical.entities):[]),$e=n.computed(()=>qn(we.value.flatMap(T=>T.attributes.flatMap(z=>z.dbAttrs)))),_e=n.computed(()=>we.value.flatMap(T=>T.attributes.filter(z=>z.attrType==="NORMAL"&&z.dbAttrs.length===1&&z.dbAttrs[0]).map(z=>{var B;return{modelId:z.dbAttrs[0].modelId,physical:z.dbAttrs[0].physicalName||z.name,isCurrency:z.type==="Currency",ownerName:T.modelId===((B=i.value)==null?void 0:B.modelId)?void 0:T.name}})));function Ce(){const T=[..._e.value].sort((z,B)=>Number(B.isCurrency)-Number(z.isCurrency));return[Pi,...T.map(z=>z.modelId)]}function Te(T){if(T===Pi)return"전용 컬럼(OWN)";const z=_e.value.find(me=>me.modelId===T);return z?`↗ ${z.ownerName?`${z.ownerName}.`:""}${z.physical} (${z.isCurrency?"통화":"공유"})`:T}function Be(T){return(T==null?void 0:T.sharedColumnRef)??Pi}function N(T,z,B){ye(T,z,{sharedColumnRef:B===Pi?void 0:B})}function A(T){return(T==null?void 0:T.sharedColumnRef)!=null}function ae(T){var z;return((z=Wo(T,$e.value))==null?void 0:z.physicalName)??""}return(T,z)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",Z1,[n.createElementVNode("span",J1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:z[0]||(z[0]=B=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"구분선",onClick:z[1]||(z[1]=B=>n.unref(o).addDivider(i.value.modelId))}),L.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:L.value,"value-provider":B=>B.type,"label-provider":oe,"onUpdate:modelValue":k},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",Q1,[n.createElementVNode("table",e_,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[z[2]||(z[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),z[3]||(z[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),z[4]||(z[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),z[5]||(z[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),z[6]||(z[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),z[7]||(z[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),z[8]||(z[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),z[9]||(z[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),z[10]||(z[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),z[11]||(z[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),z[12]||(z[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),z[13]||(z[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),z[14]||(z[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),z[15]||(z[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),z[16]||(z[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),z[17]||(z[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),z[18]||(z[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),z[19]||(z[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),Y.value.length?(n.openBlock(),n.createElementBlock("th",t_,"코드그룹")):n.createCommentVNode("",!0),z[20]||(z[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),z[21]||(z[21]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,B=>{var me,Z,Q,te,de,$,D,se,R,q,M;return n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":B.name,"onUpdate:modelValue":X=>f(B,{name:X})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,n_),n.createElementVNode("td",o_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2)):pe(B)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":X=>f(B,{name:X})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:Y.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(B.dbAttrs.length)+"개",9,p_),n.createElementVNode("td",h_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(X,ke)=>{var De,Le,Pe,He,et,Ye,Ke;return n.openBlock(),n.createElementBlock("tr",{key:X.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",y_,"↳ "+n.toDisplayString(((De=fe(B,ke))==null?void 0:De.name)??((Le=fe(B,ke))==null?void 0:Le.physicalName)??`컬럼 ${ke+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",g_,n.toDisplayString(ge(B,ke)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-logical-${X.modelId}`,width:"100%",placeholder:((He=(Pe=fe(B,ke))==null?void 0:Pe.logicalName)==null?void 0:He.ko)??"논리명","model-value":((et=X.logicalName)==null?void 0:et.ko)??"","onUpdate:modelValue":je=>ue(B,ke,"ko",je)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-col-${X.modelId}`,width:"100%",disabled:A(X),placeholder:((Ye=fe(B,ke))==null?void 0:Ye.physicalName)??"컬럼","model-value":A(X)?ae(X):X.physicalName,"onUpdate:modelValue":je=>ye(B,ke,{physicalName:je})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":X.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",b_,n.toDisplayString(ge(B,ke)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",__,n.toDisplayString(Ee(B,ke)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",k_,n.toDisplayString(Re(B,ke)??""),1)]),n.createElementVNode("td",w_,[(Ke=fe(B,ke))!=null&&Ke.shareable?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":Be(X),items:Ce(),"value-provider":u,"label-provider":Te,"onUpdate:modelValue":je=>je&&N(B,ke,je)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:A(X),"model-value":A(X)?"false":G(X),items:I,"value-provider":u,"label-provider":C,"onUpdate:modelValue":je=>je&&J(B,ke,je)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:A(X),"model-value":A(X)?"false":j(X),items:Ie,"value-provider":u,"label-provider":he,"onUpdate:modelValue":je=>je&&W(B,ke,je)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:Y.value.length?4:3},null,8,E_)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(B.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":X=>f(B,{name:X})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:"타입",disabled:!!B.groupCode,items:n.unref(mr)(B.type,ce.value),"value-provider":V,"label-provider":y,"model-value":B.type,"onUpdate:modelValue":X=>v(B,X)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),B.type===n.unref(Ct)?(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":B.customType??"","onUpdate:modelValue":X=>ee(B,X)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-logical-${B.modelId}`,width:"100%",placeholder:"논리명","model-value":((Z=(me=B.dbAttrs[0])==null?void 0:me.logicalName)==null?void 0:Z.ko)??"","onUpdate:modelValue":X=>P(B,"ko",X)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:"컬럼",disabled:_(B),"model-value":((Q=B.dbAttrs[0])==null?void 0:Q.physicalName)??"","onUpdate:modelValue":X=>x(B,{physicalName:X})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(te=B.dbAttrs[0])==null?void 0:te.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:_(B),items:n.unref(ur)(((de=B.dbAttrs[0])==null?void 0:de.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(ka),"model-value":(($=B.dbAttrs[0])==null?void 0:$.dataType)??"","onUpdate:modelValue":X=>X&&x(B,{dataType:X})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:_(B),"model-value":(D=B.dbAttrs[0])==null?void 0:D.length,"onUpdate:modelValue":X=>x(B,{length:X||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"100%",placeholder:"scale",disabled:_(B)||!O(B),"model-value":(se=B.dbAttrs[0])==null?void 0:se.scale,"onUpdate:modelValue":X=>x(B,{scale:X||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",i_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-pk-${B.modelId}`,"model-value":B.identifier,disabled:a.value||_(B),"onUpdate:modelValue":X=>g(B,X)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",a_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nn-${B.modelId}`,"model-value":B.notNull,disabled:_(B),"onUpdate:modelValue":X=>f(B,{notNull:X})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",l_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-uq-${B.modelId}`,"model-value":!!((R=B.dbAttrs[0])!=null&&R.unique),disabled:_(B),"onUpdate:modelValue":X=>x(B,{unique:X})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",r_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-ai-${B.modelId}`,"model-value":!!((q=B.dbAttrs[0])!=null&&q.autoIncrement),disabled:_(B)||!B.identifier,"onUpdate:modelValue":X=>x(B,{autoIncrement:X})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",s_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-tr-${B.modelId}`,"model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":X=>b(B,X)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",c_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nid-${B.modelId}`,"model-value":!!B.naturalId,disabled:B.identifier||_(B),"onUpdate:modelValue":X=>m(B,X)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",d_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nidm-${B.modelId}`,"model-value":!!B.naturalIdMutable,disabled:_(B)||!B.naturalId,"onUpdate:modelValue":X=>f(B,{naturalIdMutable:X||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",u_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-mv-${B.modelId}`,"model-value":!!((M=B.dbAttrs[0])!=null&&M.multiValue),disabled:_(B),"onUpdate:modelValue":X=>x(B,{multiValue:X||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-ins-${B.modelId}`,width:"100%",disabled:_(B),"model-value":G(B.dbAttrs[0]),items:I,"value-provider":u,"label-provider":C,"onUpdate:modelValue":X=>X&&be(B,X)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-upd-${B.modelId}`,width:"100%",disabled:_(B),"model-value":j(B.dbAttrs[0]),items:Ie,"value-provider":u,"label-provider":he,"onUpdate:modelValue":X=>X&&w(B,X)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":H(B),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":X=>X&&ne(B,X)},null,8,["model-value","onUpdate:modelValue"])]),Y.value.length?(n.openBlock(),n.createElementBlock("td",f_,[n.createVNode(Md,{"model-value":B.groupCode,items:Y.value,"onUpdate:modelValue":X=>E(B,X)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[S(B).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":B.defaultValue??"none",items:F(B),"value-provider":U,"label-provider":le,"onUpdate:modelValue":X=>X&&K(B,X)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"100%",placeholder:"기본값","model-value":B.defaultValue??"","onUpdate:modelValue":X=>re(B,X)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",{class:"c-del",title:h(B)?N_:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,m_)],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",v_,[...z[22]||(z[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,j1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-79ca2048"]]),x_=["disabled"],I_={class:"em-idxw__list"},S_={class:"em-idxw__list-head"},C_=["onClick"],R_={class:"em-idxw__item-name"},V_={key:0,class:"em-idxw__badge"},A_={class:"em-idxw__item-cnt"},T_={key:0,class:"em-idxw__empty"},M_={key:0,class:"em-idxw__edit"},B_={class:"em-idxw__form"},D_={class:"em-field em-idxw__name"},O_={class:"em-field"},L_=["value"],P_={class:"em-idxw__transfer"},z_={class:"em-idxw__pane"},U_={class:"em-idxw__pane-head"},H_={class:"em-idxw__cols"},F_=["onClick"],G_={key:0,class:"em-idxw__empty"},Y_={class:"em-idxw__arrows"},W_={class:"em-idxw__pane"},K_={class:"em-idxw__pane-head"},q_={class:"em-idxw__cols"},X_={class:"em-idxw__col-name"},j_={class:"em-idxw__col-ops"},Z_=["disabled","onClick"],J_=["disabled","onClick"],Q_=["onClick"],ek={key:0,class:"em-idxw__empty"},tk={key:1,class:"em-idxw__edit em-idxw__edit--empty"},nk=Ue(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(x=>x.modelId===t.entityId)??null),a=n.computed(()=>{var x;return((x=i.value)==null?void 0:x.indexes)??[]}),l=n.computed(()=>{var x;return((x=i.value)==null?void 0:x.attributes)??[]}),r=n.ref(null);n.watch(a,x=>{var O;x.some(P=>P.modelId===r.value)||(r.value=((O=x[0])==null?void 0:O.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(x=>x.modelId===r.value)??null),c=n.computed(()=>{var x;return new Set(((x=s.value)==null?void 0:x.columns.map(O=>O.columnRef))??[])}),d=n.computed(()=>l.value.filter(x=>!c.value.has(x.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(x){var P;const O=(P=x.dbAttrs[0])==null?void 0:P.physicalName;return O&&O!==x.name?`${x.name} (${O})`:x.name}function h(x){const O=l.value.find(P=>P.modelId===x);return O?f(O):x}function m(x,O){i.value&&o.updateIndex(i.value.modelId,x,O)}function p(){var O;if(!i.value)return;const x=Oe();o.addIndex(i.value.modelId,{modelId:x,name:`idx_${(((O=i.value.indexes)==null?void 0:O.length)??0)+1}`,unique:!1,columns:[]}),r.value=x}function g(x){i.value&&o.removeIndex(i.value.modelId,x)}function b(x){s.value&&m(s.value.modelId,{parameters:x.trim()===""?void 0:x})}function _(x){const O=new Set(u.value);O.has(x)?O.delete(x):O.add(x),u.value=O}function V(){const x=s.value;if(!x||!u.value.size)return;const O=[...u.value].map(P=>({columnRef:P,descending:!1}));m(x.modelId,{columns:[...x.columns,...O]}),u.value=new Set}function y(x){const O=s.value;O&&m(O.modelId,{columns:O.columns.filter((P,H)=>H!==x)})}function v(x,O){const P=s.value;P&&m(P.modelId,{columns:P.columns.map((H,ne)=>ne===x?{...H,descending:O}:H)})}function ee(x,O){const P=s.value;if(!P)return;const H=x+O;if(H<0||H>=P.columns.length)return;const ne=[...P.columns];[ne[x],ne[H]]=[ne[H],ne[x]],m(P.modelId,{columns:ne})}return(x,O)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",I_,[n.createElementVNode("div",S_,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:p})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,P=>(n.openBlock(),n.createElementBlock("li",{key:P.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":P.modelId===r.value}]),onClick:H=>r.value=P.modelId},[n.createElementVNode("span",R_,n.toDisplayString(P.name||"(이름 없음)"),1),P.unique?(n.openBlock(),n.createElementBlock("span",V_,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",A_,n.toDisplayString(P.columns.length),1)],10,C_))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",T_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",M_,[n.createElementVNode("div",B_,[n.createElementVNode("label",D_,[O[4]||(O[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":O[0]||(O[0]=P=>m(s.value.modelId,{name:P}))},null,8,["model-value"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":O[1]||(O[1]=P=>m(s.value.modelId,{unique:P}))},null,8,["model-value"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:O[2]||(O[2]=P=>g(s.value.modelId))})]),n.createElementVNode("label",O_,[O[5]||(O[5]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A' AND deleted = false",onChange:O[3]||(O[3]=P=>b(P.target.value))},null,40,L_)]),n.createElementVNode("div",P_,[n.createElementVNode("div",z_,[n.createElementVNode("div",U_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",H_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>(n.openBlock(),n.createElementBlock("li",{key:P.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(P.modelId)}]),onClick:H=>_(P.modelId)},n.toDisplayString(f(P)),11,F_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",G_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",Y_,[n.createVNode(n.unref(ie.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:V},null,8,["disabled"])]),n.createElementVNode("div",W_,[n.createElementVNode("div",K_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",q_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(P,H)=>(n.openBlock(),n.createElementBlock("li",{key:H,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",X_,n.toDisplayString(h(P.columnRef)),1),n.createVNode(n.unref(ie.BSCheckbox),{name:`idxw-desc-${H}`,class:"em-check",label:"DESC","model-value":P.descending,"onUpdate:modelValue":ne=>v(H,ne)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",j_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:H===0,onClick:ne=>ee(H,-1)},"↑",8,Z_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:H===s.value.columns.length-1,onClick:ne=>ee(H,1)},"↓",8,J_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:ne=>y(H)},"✕",8,Q_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",ek,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",tk,"인덱스를 선택하거나 추가하세요."))],8,x_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),ok={class:"em-op-src"},ik={class:"em-op-src__actions"},Bd=Ue(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",ok,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),class:"em-op-src__area",spellcheck:"false",placeholder:"// Java 구현 코드"},null,512),[[n.vModelText,i.value]]),n.createElementVNode("div",ik,[n.createVNode(n.unref(ie.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-2150d2fc"]]),ak=["disabled"],lk={class:"em-ow__toolbar"},rk={class:"em-ow__count"},sk={class:"em-ow__scroll"},ck={class:"em-ow__table"},dk={class:"c-del"},uk={key:0},fk=Ue(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModal(),a=n.computed(()=>o.state.logical.entities.find(p=>p.modelId===t.entityId)??null),l=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(p){return p==="none"?"(없음)":p}const c=p=>p;function d(p,g){a.value&&o.updateOperation(a.value.modelId,p.modelId,g)}function u(p,g,b){d(p,{description:{...p.description,[g]:b}})}function f(p){return p.personalInfoAttributeType??"none"}function h(p,g){d(p,{personalInfoAttributeType:g==="none"?void 0:g})}function m(p){i.openModal({component:Bd,bind:{operationName:p.name,sourceCode:p.sourceCode??"",onSave:g=>d(p,{sourceCode:g})}})}return(p,g)=>{var b,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",lk,[n.createElementVNode("span",rk,"오퍼레이션 ("+n.toDisplayString(((b=a.value.operations)==null?void 0:b.length)??0)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:g[0]||(g[0]=V=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",sk,[n.createElementVNode("table",ck,[g[2]||(g[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],V=>{var y;return n.openBlock(),n.createElementBlock("tr",{key:V.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-name-${V.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":V.name,"onUpdate:modelValue":v=>d(V,{name:v})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":V.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":v=>v&&d(V,{visibility:v})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-desc-${V.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((y=V.description)==null?void 0:y.ko)??"","onUpdate:modelValue":v=>u(V,"ko",v)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":f(V),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":v=>v&&h(V,v)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:V.sourceCode?"본문 ●":"본문",onClick:v=>m(V)},null,8,["caption","onClick"])]),n.createElementVNode("td",dk,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:v=>n.unref(o).removeOperation(a.value.modelId,V.modelId)},null,8,["onClick"])])])}),128)),(_=a.value.operations)!=null&&_.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",uk,[...g[1]||(g[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,ak)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),mk={class:"em-detail__tabs"},pk=["onClick"],hk=Ue(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const l=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`엔티티 — ${((d=a.value)==null?void 0:d.name)??""}`},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",mk,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(l,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":r.value===u.key}]),onClick:f=>r.value=u.key},n.toDisplayString(u.label),11,pk)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(Ad,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock($_,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(nk,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(fk,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-67239153"]]);function zi(e,t,o){e.openModal({component:hk,bind:{controller:n.markRaw(t),entityId:o}})}const Dd="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function yk(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Oe(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const l=Oe();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Oe()}for(const a of t.indexes??[]){a.modelId=Oe();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const pn=Symbol("editorController");function Od(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Ui(e,t){const o=[];for(const i of t.remove)o.push($n(e,i));for(const i of t.update)o.push(en(e,i.attributeId,i.patch));for(const i of t.add)o.push(Vt(e,i));return o}function Ln(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Pn(e,t){const o=[];for(const[i,a]of ym(e,t,Oe))o.push(...Ui(i,a));return o}function Ld(e,t,o){const i=new Set(o.remove);return Ln(e,t,a=>[...a.filter(l=>!i.has(l.modelId)).map(l=>{const r=o.update.find(s=>s.attributeId===l.modelId);return r?{...l,...r.patch}:l}),...o.add])}function Nl(e,t){const o=eo(e,t,Oe),i=Ui(t,o),a=Ld(e,t,o);return i.push(...Pn(a,t)),i}function Pd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Oe()}))}function gk(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,p)=>Math.max(m,p.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let h="id";for(let m=2;f.has(h);m++)h=`id${m}`;a={modelId:Oe(),name:h,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Oe(),physicalName:h.toLowerCase(),dataType:"BIGINT"}]},i.push(Vt(t,a))}const l=[];for(const u of e.entities)for(const f of u.attributes){if(((d=f.embedded)==null?void 0:d.embeddableRef)!==t)continue;const h=e.associations.find(b=>b.modelId===f.embedded.associationRef);if(!h)continue;const m=h.end1.entityRef===u.modelId,p=m?h.end1:h.end2,g=m?h.end2:h.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:h.modelId,end1:{entityRef:u.modelId,multiplicity:p.multiplicity,navigable:p.navigable,composition:!1},end2:{entityRef:t,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(l.filter(h=>h.ownerId===u.modelId).map(h=>h.dispId));return f.size?{...u,attributes:u.attributes.filter(h=>!f.has(h.modelId))}:u}),associations:e.associations.map(u=>{const f=l.find(h=>h.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=eo(r,t,Oe);for(const u of l){const f=s.add.find(h=>{var m;return((m=h.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push($n(u.ownerId,u.dispId)),i.push(Jo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Ui(t,s));const c=Ld(r,t,s);return i.push(...Pn(c,t)),i}function bk(e,t){const o=e.entities.find(l=>l.modelId===t);if(!o)return[];const i=[],a=l=>l&&l.charAt(0).toLowerCase()+l.slice(1);for(const l of e.associations){if(l.end1.entityRef===l.end2.entityRef)continue;const r=l.end1.entityRef===t,s=l.end2.entityRef===t;if(!r&&!s)continue;const c=r?l.end2.entityRef:l.end1.entityRef,d=e.entities.find(y=>y.modelId===c);if(!d||d.attributes.some(y=>{var v;return((v=y.embedded)==null?void 0:v.associationRef)===l.modelId}))continue;const u=Oe(),f=d.attributes.reduce((y,v)=>Math.max(y,v.order),-1)+1,h=new Set(d.attributes.map(y=>y.name)),m=a(o.name);let p=m;for(let y=2;h.has(p);y++)p=`${m}${y}`;const g=o.attributes.filter(y=>!y.identifier&&!y.derivedFrom).flatMap(y=>y.dbAttrs).map(y=>({...y,modelId:Oe()})),b={modelId:u,name:p,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:g,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(Vt(c,b));const _=r?"end2":"end1",V=r?"end1":"end2";i.push(Jo(l.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Oe()},[V]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function _k(e=Od(),t={}){var Te,Be;const o=n.reactive(e);let i=new Ca(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),h=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),p=n.ref(!1),g=n.ref(!1),b=n.ref(0),_=n.ref(null);let V=0;const y=N=>{if(t.onNotice){t.onNotice(N);return}_.value={text:N,id:++V}},v=n.ref(((Te=t.meta)==null?void 0:Te.schemaVersion)??1),ee=n.ref(((Be=t.meta)==null?void 0:Be.opWriteEnabled)??!1),x=n.computed(()=>v.value>=2&&ee.value),O=t.historyTransport,P=n.computed(()=>x.value&&O!==void 0),H=t.restoreTransport,ne=n.ref(0),ce=n.computed(()=>x.value&&oe.value&&H!==void 0);async function L(N){if(!H||!oe.value)return{ok:!1,reason:"unavailable"};const A=await H(N);return A.ok&&ne.value++,A}const oe=n.ref(!(v.value>=2&&ee.value===!1)),k=n.ref("LOGICAL_PHYSICAL"),Y=n.ref("straight"),S=n.ref(!0),F=n.ref(!0),U=n.ref(null),le=n.computed(()=>{var N;return((N=U.value)==null?void 0:N.kind)==="attribute"?{entityId:U.value.entityId,attrId:U.value.anchor}:null}),E=n.computed(()=>{var N;return((N=U.value)==null?void 0:N.kind)==="attribute"?U.value.ids:[]}),K=n.computed(()=>{var N,A;return((N=U.value)==null?void 0:N.kind)==="entity"?U.value.id:((A=U.value)==null?void 0:A.kind)==="attribute"?U.value.entityId:null}),re=n.ref(null);let pe=0;const ye=n.ref(null),ue=n.ref(null);let fe=t.meta;function ge(){i.onChange(()=>{m.value=i.canUndo,p.value=i.canRedo,g.value=i.isDirty,b.value++})}ge();let Ee=null,Re=null;function Ie(){Re==null||Re(),Re=null,Ee=null}function he(){if(Ie(),!x.value||!t.opTransport)return;const N=new ds({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:A=>{oe.value=!1,ue.value=A},onError:t.onOpError});N.seed((fe==null?void 0:fe.revSeed)??{}),Re=N.attach(i),Ee=N}he();const j=n.computed(()=>Jl(o.logical,o.layout)),W=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:h.value,embeddableCatalog:a.value})),w=n.computed(()=>yr(o.logical,W.value)),I=n.computed(()=>{const N=new Map;for(const A of w.value){if(!A.targetRef)continue;const ae=N.get(A.targetRef);ae?ae.push(A):N.set(A.targetRef,[A])}return N}),C=N=>{oe.value&&i.execute(N)},G=N=>o.layout.entityLayouts.some(A=>A.entityRef===N&&!!A.locked),J=N=>o.layout.groupLayouts.some(A=>A.groupRef===N&&!!A.locked),be=N=>{const A=o.logical.associations.find(ae=>ae.modelId===N);return!!A&&(G(A.end1.entityRef)||G(A.end2.entityRef))},we=(N,A,ae)=>{if(G(N))return;const T=en(N,A,ae),z=Ln(o.logical,N,me=>me.map(Z=>Z.modelId===A?{...Z,...ae}:Z)),B=Pn(z,N);C(B.length?Ge("속성 수정",[T,...B]):T)};function $e(N){const A=N.map(Q=>o.layout.entityLayouts.find(te=>te.entityRef===Q)).filter(Q=>!!Q);if(!A.length)return{location:{x:40,y:40},size:{width:400,height:300}};let ae=1/0,T=1/0,z=-1/0,B=-1/0;for(const Q of A){const te=Q.geo.size.width||220,de=Q.geo.size.height||140;ae=Math.min(ae,Q.geo.location.x),T=Math.min(T,Q.geo.location.y),z=Math.max(z,Q.geo.location.x+te),B=Math.max(B,Q.geo.location.y+de)}const me=40,Z=28;return{location:{x:ae-me,y:T-me-Z},size:{width:z-ae+me*2,height:B-T+me*2+Z}}}function _e(N,A,ae){var Q;const T=o.layout.groupLayouts.find(te=>te.groupRef===N),z=(T==null?void 0:T.geo.location)??A,B=A.x-z.x,me=A.y-z.y,Z=[Ar(N,A),...ae.map(te=>Nn(te.id,te.location))];if(B||me){const te=new Set(((Q=o.logical.groups.find(de=>de.modelId===N))==null?void 0:Q.memberEntityRefs)??[]);for(const de of o.logical.associations){if(!te.has(de.end1.entityRef)||!te.has(de.end2.entityRef))continue;const $=o.layout.associationLayouts.find(D=>D.associationRef===de.modelId);$&&$.waypoints.length&&Z.push(Kr(de.modelId,B,me))}for(const de of(T==null?void 0:T.memberNoteRefs)??[]){const $=o.layout.notes.find(D=>D.modelId===de);$&&Z.push(Qn(de,{x:$.geo.location.x+B,y:$.geo.location.y+me}))}}return Z}const Ce={state:o,resolved:j,issues:w,issuesByRef:I,flagEntitiesWithoutRelations:h,canUndo:m,canRedo:p,dirty:g,revision:b,notice:_,editable:oe,schemaVersion:v,opWriteEnabled:ee,opMode:x,opConflict:ue,historyTransport:O,historyAvailable:P,restoreTransport:H,restoreAvailable:ce,restoreToSeq:L,reloadRequest:ne,displayMode:k,routingMode:Y,showGrid:S,showMinimap:F,selection:U,selectedAttr:le,selectedAttrIds:E,inspectedEntityId:K,focusRequest:re,clipboard:ye,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(N){oe.value=N&&x.value},setEmbeddableCatalog(N){a.value=N},setGroupCodeCatalog(N){l.value=N},setPredefinedCustomTypeCatalog(N){r.value=N},selectAttribute(N,A,ae="replace"){const T=U.value,z=(T==null?void 0:T.kind)==="attribute"&&T.entityId===N;if(ae==="replace"||!z){U.value={kind:"attribute",entityId:N,ids:[A],anchor:A};return}if(ae==="toggle"){const $=T.ids.includes(A),D=$?T.ids.filter(R=>R!==A):[...T.ids,A];if(!D.length){U.value=null;return}const se=$&&T.anchor===A?D[D.length-1]:$?T.anchor:A;U.value={kind:"attribute",entityId:N,ids:D,anchor:se};return}const B=o.logical.entities.find($=>$.modelId===N),me=[...(B==null?void 0:B.attributes)??[]].sort(($,D)=>$.order-D.order).map($=>$.modelId),Z=me.indexOf(T.anchor),Q=me.indexOf(A);if(Z<0||Q<0){U.value={kind:"attribute",entityId:N,ids:[A],anchor:A};return}const[te,de]=Z<=Q?[Z,Q]:[Q,Z];U.value={kind:"attribute",entityId:N,ids:me.slice(te,de+1),anchor:T.anchor}},moveAttributeFocus(N){const A=U.value;if((A==null?void 0:A.kind)!=="attribute")return!1;const ae=o.logical.entities.find(me=>me.modelId===A.entityId);if(!ae||!ae.attributes.length)return!1;const T=ae.attributes.findIndex(me=>me.modelId===A.anchor);if(T<0)return!1;const z=Math.min(Math.max(T+N,0),ae.attributes.length-1);if(z===T)return!0;const B=ae.attributes[z].modelId;return U.value={kind:"attribute",entityId:A.entityId,ids:[B],anchor:B},!0},nudgeSelectedAttributes(N){const A=U.value;if((A==null?void 0:A.kind)!=="attribute")return!1;const ae=o.logical.entities.find($=>$.modelId===A.entityId);if(!ae)return!1;const T=ae.attributes,z=new Set(A.ids),B=T.map(($,D)=>z.has($.modelId)?D:-1).filter($=>$>=0);if(!B.length)return!1;const me=Math.min(...B),Z=T.filter($=>!z.has($.modelId)),Q=T.slice(0,me).filter($=>!z.has($.modelId)).length;let te;if(N<0){if(Q<=0)return!0;te=Q-1}else{if(Z.length-Q<=0)return!0;te=Q+1}if(G(A.entityId))return!0;const de=T.filter($=>z.has($.modelId)).map($=>$.modelId);return C(Ta(A.entityId,de,te)),!0},deleteSelection(){if(!oe.value)return!1;const N=U.value;if(!N)return!1;if(N.kind==="attribute"){if(G(N.entityId))return!1;const A=N.ids;if(!A.length)return!1;A.length===1?Ce.removeAttribute(N.entityId,A[0]):Ce.removeAttributes(N.entityId,A)}else if(N.kind==="entity"){if(G(N.id))return!1;Ce.removeEntity(N.id)}else if(N.kind==="note")Ce.removeNote(N.id);else if(N.kind==="group"){if(J(N.id))return!1;Ce.removeGroup(N.id)}else Ce.removeAssociation(N.id);return U.value=null,!0},nudgeNodes(N,A,ae){if(!N.length||A===0&&ae===0)return!1;const T=new Set(o.logical.entities.map(te=>te.modelId)),z=new Set(o.logical.groups.map(te=>te.modelId)),B=new Set(o.layout.notes.map(te=>te.modelId)),me=new Set;for(const te of N){if(!z.has(te))continue;const de=o.logical.groups.find($=>$.modelId===te);for(const $ of(de==null?void 0:de.memberEntityRefs)??[])me.add($)}const Z=[],Q=[];for(const te of N)if(z.has(te)){if(J(te))continue;const de=o.layout.groupLayouts.find(R=>R.groupRef===te);if(!de)continue;const $=o.logical.groups.find(R=>R.modelId===te),D=(($==null?void 0:$.memberEntityRefs)??[]).map(R=>{var M;const q=((M=o.layout.entityLayouts.find(X=>X.entityRef===R))==null?void 0:M.geo.location)??{x:0,y:0};return{id:R,location:{x:q.x+A,y:q.y+ae}}}),se={x:de.geo.location.x+A,y:de.geo.location.y+ae};Z.push(Ge("그룹 이동",_e(te,se,D))),Q.push("g:"+te)}else if(T.has(te)){if(me.has(te)||G(te))continue;const de=o.layout.entityLayouts.find($=>$.entityRef===te);if(!de)continue;Z.push(Nn(te,{x:de.geo.location.x+A,y:de.geo.location.y+ae})),Q.push("e:"+te)}else if(B.has(te)){const de=o.layout.notes.find($=>$.modelId===te);if(!de)continue;Z.push(Qn(te,{x:de.geo.location.x+A,y:de.geo.location.y+ae})),Q.push("n:"+te)}return Z.length?(C(Ge("이동",Z,"nudge:"+Q.sort().join(","))),!0):!1},requestFocus(N){re.value={id:N,nonce:++pe}},undo:()=>{oe.value&&i.undo()},redo:()=>{oe.value&&i.redo()},markSaved:()=>{oe.value&&(Ee==null||Ee.flush(),i.markSavePoint())},loadDiagram(N,A){Ie(),o.logical=N.logical,o.layout=N.layout,i=new Ca(o),ge(),v.value=(A==null?void 0:A.schemaVersion)??1,ee.value=(A==null?void 0:A.opWriteEnabled)??!1,oe.value=!(v.value>=2&&ee.value===!1),fe=A,ue.value=null,U.value=null,m.value=i.canUndo,p.value=i.canRedo,g.value=i.isDirty,he()},flush(){Ee==null||Ee.flush()},whenOpsSettled(){return(Ee==null?void 0:Ee.whenSettled())??Promise.resolve()},addEntity(N="NewEntity",A={x:80,y:80}){const ae=Oe(),T={modelId:ae,name:N,stereotype:"JPA_ENTITY",table:{physicalName:N.toLowerCase()},attributes:[{modelId:Oe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Oe(),physicalName:"id",dataType:"BIGINT"}]}]};return C(Ra(T,{location:{...A},size:{width:220,height:140}})),ae},renameEntity(N,A){G(N)||C(Nr(N,A))},updateEntity(N,A){if(G(N))return;const ae=vr(N,A),T=o.logical.entities.find(me=>me.modelId===N),z=A.stereotype==="JPA_EMBEDDABLE"&&!!T&&T.stereotype!=="JPA_EMBEDDABLE",B=!!A.stereotype&&A.stereotype!=="JPA_EMBEDDABLE"&&!!T&&T.stereotype==="JPA_EMBEDDABLE";if(z&&T){const me=T.attributes.filter($=>$.identifier&&!$.derivedFrom).map($=>en(N,$.modelId,{identifier:!1})),Z=Ln({...o.logical,entities:o.logical.entities.map($=>$.modelId===N?{...$,stereotype:"JPA_EMBEDDABLE"}:$)},N,$=>$.map(D=>D.identifier&&!D.derivedFrom?{...D,identifier:!1}:D)),Q=Nl(Z,N),te=bk(o.logical,N),de=[ae,...me,...Q,...te];C(de.length>1?Ge("임베더블 변환",de):ae);return}if(B){const me=gk(o.logical,N),Z=[ae,...me];C(Z.length>1?Ge("엔터티 전환",Z):ae);return}C(ae)},moveEntity(N,A){G(N)||C(Nn(N,A))},resizeEntity(N,A){G(N)||C($r(N,A))},removeEntity(N){G(N)||C(Er(N))},setEntitySwatch(N,A){C(xr(N,A))},setEntityCollapsed(N,A){C(Ir(N,A))},setEntityLocked(N,A){C(Sr(N,A))},isEntityLocked(N){return G(N)},collapseAll(){C(Va(!0))},expandAll(){C(Va(!1))},setAttributeSwatch(N,A,ae){C(jo(N,A,ae))},dragGroup(N,A,ae){J(N)||C(Ge("그룹 이동",_e(N,A,ae)))},resizeGroup(N,A){J(N)||C(Tr(N,A))},setGroupSwatch(N,A){C(Mr(N,A))},setGroupLocked(N,A){C(Br(N,A))},isGroupLocked(N){return J(N)},updateGroup(N,A){J(N)||C(Cr(N,A))},createGroup(N,A){if(!N.length)return null;const ae=[];for(const B of o.logical.groups)for(const me of N)B.memberEntityRefs.includes(me)&&ae.push(Zo(B.modelId,me));const T=Oe(),z={modelId:T,name:A?{ko:A}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...N]};return ae.push(Aa(z,$e(N))),C(Ge("그룹 생성",ae)),U.value=null,T},addEmptyGroup(N,A){const ae=Oe();return C(Aa({modelId:ae,name:A?{ko:A}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...N},size:{width:360,height:260}})),ae},removeGroup(N){J(N)||C(Rr(N))},dropEntity(N,A,ae){var B;if(G(N))return;const T=((B=o.logical.groups.find(me=>me.memberEntityRefs.includes(N)))==null?void 0:B.modelId)??null,z=[Nn(N,A)];T!==ae&&(T&&z.push(Zo(T,N)),ae&&z.push(Vr(ae,N))),C(Ge("이동",z))},ungroupEntity(N){const A=o.logical.groups.find(ae=>ae.memberEntityRefs.includes(N));A&&C(Zo(A.modelId,N))},dropNote(N,A,ae){var B;const T=((B=o.layout.groupLayouts.find(me=>{var Z;return(Z=me.memberNoteRefs)==null?void 0:Z.includes(N)}))==null?void 0:B.groupRef)??null,z=[Qn(N,A)];T!==ae&&(T&&z.push(ns(T,N)),ae&&z.push(ts(ae,N))),C(Ge("이동",z))},addPredefinedEmbed(N,A){if(G(N))return;const ae=a.value.find(Q=>Q.type===A),T=o.logical.entities.find(Q=>Q.modelId===N);if(!ae||!T)return;const z=T.attributes.reduce((Q,te)=>Math.max(Q,te.order),-1)+1,B=Oe(),me=ae.fields.map(()=>({modelId:Oe(),physicalName:"",dataType:""})),Z={modelId:B,name:ae.defaultName,type:ae.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:z,dbAttrs:me};return C(Vt(N,Z)),B},addAttribute(N,A={}){if(G(N))return A.modelId??"";const ae=o.logical.entities.find(de=>de.modelId===N),T=ae?ae.attributes.length:0,z=A.modelId??Oe(),B=A.name??`field${T}`,me={modelId:z,name:B,type:A.type??wa,attrType:A.attrType??"NORMAL",identifier:A.identifier??!1,notNull:A.notNull??!1,order:T,dbAttrs:A.dbAttrs??[{modelId:Oe(),physicalName:B,dataType:"VARCHAR",length:255}],...A},Z=Vt(N,me),Q=Ln(o.logical,N,de=>[...de,me]),te=Pn(Q,N);return C(te.length?Ge("속성 추가",[Z,...te]):Z),z},addDivider(N){if(G(N))return"";const A=o.logical.entities.find(B=>B.modelId===N),ae=A?A.attributes.length:0,T=Oe();return C(Vt(N,{modelId:T,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:ae,dbAttrs:[]})),T},updateAttribute(N,A,ae){we(N,A,ae)},setAttributeGroupCode(N,A,ae){we(N,A,{groupCode:ae,type:ae?Kn:wa})},setEmbedColumns(N,A,ae){var Q,te;if(G(N))return;const T=en(N,A,{dbAttrs:ae}),z=(Q=o.logical.entities.find(de=>de.modelId===N))==null?void 0:Q.attributes.find(de=>de.modelId===A),B=(te=z==null?void 0:z.embedded)==null?void 0:te.associationRef,me=B?o.logical.associations.find(de=>de.modelId===B):void 0,Z=[];me&&B&&(me.end1.legacyEmbedRaw&&Z.push(xn(B,"end1",{legacyEmbedRaw:void 0})),me.end2.legacyEmbedRaw&&Z.push(xn(B,"end2",{legacyEmbedRaw:void 0}))),C(Z.length?Ge("임베드 컬럼 수정",[T,...Z]):T)},removeAttribute(N,A){if(G(N))return;if(ni(o.logical,N,A)){y(Dd);return}const ae=$n(N,A),T=Ln(o.logical,N,B=>B.filter(me=>me.modelId!==A)),z=Pn(T,N);C(z.length?Ge("속성 삭제",[ae,...z]):ae)},removeAttributes(N,A){var Z;if(!A.length||G(N))return;const ae=A.filter(Q=>!ni(o.logical,N,Q));if(ae.length<A.length&&y(Dd),!ae.length)return;const T=ae.map(Q=>$n(N,Q)),z=new Set(ae),B=Ln(o.logical,N,Q=>Q.filter(te=>!z.has(te.modelId))),me=[...T,...Pn(B,N)];C(me.length===1?me[0]:Ge("속성 삭제",me)),((Z=U.value)==null?void 0:Z.kind)==="attribute"&&U.value.entityId===N&&(U.value=null)},setAttributeSwatches(N,A,ae){A.length&&(A.length===1?C(jo(N,A[0],ae)):C(Ge("속성 색상",A.map(T=>jo(N,T,ae)))))},reorderAttributes(N,A,ae){!A.length||G(N)||C(Ta(N,A,ae))},addIndex(N,A){G(N)||C(Hr(N,A))},updateIndex(N,A,ae){G(N)||C(Fr(N,A,ae))},removeIndex(N,A){G(N)||C(Gr(N,A))},addOperation(N,A={}){var me;if(G(N))return A.modelId??"";const ae=o.logical.entities.find(Z=>Z.modelId===N),T=((me=ae==null?void 0:ae.operations)==null?void 0:me.length)??0,z=A.modelId??Oe(),B={modelId:z,name:A.name??`method${T}`,visibility:A.visibility??"PACKAGE",order:T,...A};return C(Dr(N,B)),z},updateOperation(N,A,ae){G(N)||C(Or(N,A,ae))},removeOperation(N,A){G(N)||C(Lr(N,A))},reorderOperations(N,A,ae){!A.length||G(N)||C(Pr(N,A,ae))},setOperationSwatch(N,A,ae){C(zr(N,A,ae))},addAssociation(N,A,ae,T){if(G(N)||G(A))return"";const z=Oe(),B={modelId:z,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:ae},end2:{entityRef:A,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},me={...o.logical,associations:[...o.logical.associations,B]},Z=eo(me,A,Oe),Q=Z.add[0];Q&&(B.end2.attributeRef=Q.modelId);const te={associationRef:z,waypoints:[],sourceColumnRef:ae,targetColumnRef:(Q==null?void 0:Q.modelId)??T},de=Ma(B,te),$=Ui(A,Z);return C($.length?Ge("관계 추가",[de,...$]):de),z},addEmbedAssociation(N,A){if(G(N))return;const ae=o.logical.entities.find(M=>M.modelId===N),T=o.logical.entities.find(M=>M.modelId===A);if(!ae||!T||T.stereotype!=="JPA_EMBEDDABLE")return;const z=Oe(),B=Oe(),me=Oe(),Z=ae.attributes.reduce((M,X)=>Math.max(M,X.order),-1)+1,Q=Pd(T),te=M=>M&&M.charAt(0).toLowerCase()+M.slice(1),de=new Set(ae.attributes.map(M=>M.name)),$=te(T.name);let D=$;for(let M=2;de.has(D);M++)D=`${$}${M}`;const se={modelId:B,name:D,type:T.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:Z,dbAttrs:Q,embedded:{associationRef:z,embeddableRef:A}},R={modelId:z,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:me},end2:{entityRef:A,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:B}},q={associationRef:z,waypoints:[],sourceColumnRef:B,targetColumnRef:void 0};return C(Ge("임베드 추가",[Vt(N,se),Ma(R,q)])),z},setEmbedCollectionMode(N,A){if(be(N))return;const ae=o.logical.associations.find(te=>te.modelId===N);if(!ae)return;let T,z;for(const te of o.logical.entities){const de=te.attributes.find($=>{var D;return((D=$.embedded)==null?void 0:D.associationRef)===N&&$.attrType==="EMBED_OWN"});if(de){T=te.modelId,z=de;break}}if(!T||!z)return;const B=z.embedded.embeddableRef,me=ae.end2.entityRef===B?"end2":"end1",Z=ae[me],Q=Z.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(A==="COLLECTION"?Q:!Q))if(A==="COLLECTION")C(Ge("임베드 컬렉션 전환",[en(T,z.modelId,{dbAttrs:[]}),xn(N,me,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...Z.jpa,collectionType:"LIST"}})]));else{const te=o.logical.entities.find(de=>de.modelId===B);if(!te)return;C(Ge("임베드 단일 전환",[en(T,z.modelId,{dbAttrs:Pd(te)}),xn(N,me,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...Z.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(N){if(be(N))return;const A=o.logical.associations.find(me=>me.modelId===N),ae=Ur(N);if(!A){C(ae);return}for(const me of o.logical.entities){const Z=me.attributes.find(Q=>{var te;return((te=Q.embedded)==null?void 0:te.associationRef)===N});if(Z){C(Ge("임베드 삭제",[ae,$n(me.modelId,Z.modelId)]));return}}const T=A.end2.entityRef,z={...o.logical,associations:o.logical.associations.filter(me=>me.modelId!==N)},B=Nl(z,T);C(B.length?Ge("관계 삭제",[ae,...B]):ae)},setAssociationIdentifying(N,A){if(be(N))return;const ae=o.logical.associations.find(Z=>Z.modelId===N),T=Jo(N,{identifying:A});if(!ae||ae.identifying===A){C(T);return}const z=ae.end2.entityRef,B={...o.logical,associations:o.logical.associations.map(Z=>Z.modelId===N?{...Z,identifying:A}:Z)},me=Nl(B,z);C(me.length?Ge("식별 관계 변경",[T,...me]):T)},updateAssociationEnd(N,A,ae){be(N)||C(xn(N,A,ae))},moveWaypoint(N,A,ae){C(Yr(N,A,ae))},addWaypoint(N,A,ae){C(Xr(N,A,ae))},removeWaypoint(N,A){C(Wr(N,A))},clearWaypoints(N){C(qr(N))},addNote(N="메모",A={x:80,y:80}){const ae=Oe();return C(jr({modelId:ae,memo:N,geo:{location:{...A},size:{width:200,height:120}}})),ae},removeNote(N){C(Zr(N))},moveNote(N,A){C(Qn(N,A))},resizeNote(N,A){C(Jr(N,A))},setNoteMemo(N,A){C(Qr(N,A))},setNoteSwatch(N,A){C(es(N,A))},addNoteConnection(N,A){C(os(N,A))},removeNoteConnection(N,A){C(is(N,A))},moveNoteConnectionWaypoint(N,A,ae,T){C(as(N,A,ae,T))},addNoteConnectionWaypoint(N,A,ae,T){C(ls(N,A,ae,T))},removeNoteConnectionWaypoint(N,A,ae){C(rs(N,A,ae))},clearNoteConnectionWaypoints(N,A){C(ss(N,A))},autoLayout(){const N=tr(o.logical,o.layout);N.length&&C(Ge("자동 배치",N.map(A=>Nn(A.id,A.location))))},copy(){const N=U.value;if((N==null?void 0:N.kind)==="attribute"){const B=o.logical.entities.find(Z=>Z.modelId===N.entityId);if(!B)return;const me=[...B.attributes].sort((Z,Q)=>Z.order-Q.order).filter(Z=>N.ids.includes(Z.modelId));if(!me.length)return;ye.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:me}));return}const A=K.value;if(!A)return;const ae=o.logical.entities.find(B=>B.modelId===A),T=o.layout.entityLayouts.find(B=>B.entityRef===A);if(!ae)return;const z=(T==null?void 0:T.geo)??{location:{x:80,y:80},size:{width:220,height:140}};ye.value=JSON.parse(JSON.stringify({kind:"entity",entity:ae,geo:z}))},paste(){if(!oe.value)return;const N=ye.value;if(!N)return;if(N.kind==="attribute"){const T=K.value;if(!T)return;const z=o.logical.entities.find(de=>de.modelId===T);if(!z)return;const B=new Set(z.attributes.map(de=>de.name)),me=new Set(z.attributes.flatMap(de=>de.dbAttrs.map($=>$.physicalName))),Z=z.attributes.length,Q=[],te=N.attributes.map((de,$)=>{const D=JSON.parse(JSON.stringify(de));D.modelId=Oe();for(const se of D.dbAttrs)se.modelId=Oe();B.has(D.name)&&(D.name=`${D.name}_copy`);for(const se of D.dbAttrs)se.physicalName&&me.has(se.physicalName)&&(se.physicalName=`${se.physicalName}_copy`);return D.order=Z+$,Q.push(D.modelId),Vt(T,D)});C(te.length===1?te[0]:Ge("속성 붙여넣기",te)),U.value={kind:"attribute",entityId:T,ids:Q,anchor:Q[Q.length-1]};return}const A=yk(N.entity),ae={location:{x:N.geo.location.x+40,y:N.geo.location.y+40},size:{...N.geo.size}};C(Ra(A,ae)),U.value={kind:"entity",id:A.modelId}}};return Ce}const Hi=Symbol("groupHover"),zd=Symbol("groupDrag"),zn=Symbol("relationHighlight"),kk={key:0,class:"em-sel","aria-hidden":"true"},wk=["title","aria-expanded","disabled"],Ek={class:"em-entity__stereotype"},vk={key:1,class:"em-entity__name"},Nk=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],$k=["onPointerdown"],xk={key:1,class:"em-entity__divider-label"},Ik=["title"],Sk={class:"em-key-slot"},Ck={class:"em-key-slot"},Rk={key:0,class:"em-entity__type"},Vk=["onClick"],Ak={class:"em-entity__attrname"},Tk={class:"em-entity__type"},Mk=["data-op"],Bk=["onPointerdown"],Dk={class:"em-entity__op-vis","aria-hidden":"true"},Ok=["title"],Lk={key:4,class:"em-entity__footer"},Ud=Ue(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=ie.useModal();function a(){o&&zi(i,o,t.id)}const l=n.inject(Hi,null),r=n.inject(zn,null),s=n.computed(()=>!!o&&o.editable.value);function c(){l&&(l.value=t.data.groupRef??null)}function d(){r==null||r.setEntityHover(t.id)}function u(){r==null||r.setEntityHover(null)}const f=n.computed(()=>!!r&&r.primaryEntityIds.value.has(t.id)),h=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),m=n.computed(()=>{var Z;return((Z=o==null?void 0:o.selection.value)==null?void 0:Z.kind)==="entity"&&o.selection.value.id===t.id}),p=n.computed(()=>!!t.selected&&!m.value),g=n.computed(()=>{var Z;return o&&((Z=o.selectedAttr.value)==null?void 0:Z.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),b=n.computed(()=>g.value.size>0);function _(Z,Q){const te=Q.shiftKey?"range":Q.metaKey||Q.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,Z.modelId,te)}const V=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),y=n.computed(()=>t.data.entity),v=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),ee=n.computed(()=>t.data.collapsed??!1),x=n.computed(()=>t.data.locked??!1);function O(){s.value&&(o==null||o.setEntityCollapsed(t.id,!ee.value))}const P=n.computed(()=>v.value==="PHYSICAL"||v.value==="LOGICAL_PHYSICAL"),H=n.computed(()=>{const Z=v.value==="PHYSICAL"||v.value==="LOGICAL_PHYSICAL",Q={};for(const te of y.value.attributes){const de=te.attrType.startsWith("RELATION")&&te.dbAttrs.length>0;Q[te.modelId]={pk:te.identifier,fk:de&&Z,required:te.notNull&&!te.identifier}}return Q});function ne(Z){if(!Z)return"";const Q=[];return Z.pk&&Z.fk?Q.push("PFK (식별 외래키)"):Z.pk?Q.push("PK (기본키)"):Z.fk&&Q.push("FK (외래키)"),Z.required&&Q.push("필수 (NOT NULL)"),Q.join(" · ")}const ce=n.computed(()=>{const Z=wl(at(t.data.style)),Q={};return Z&&(Q["--em-header-bg"]=Z.bar,Q["--em-header-fg"]=Z.barOn),Q});function L(Z){var Q,te;return(te=wl(at((Q=t.data.attributeStyles)==null?void 0:Q[Z.modelId])))==null?void 0:te.text}const oe=n.computed(()=>[...y.value.operations??[]].sort((Z,Q)=>Z.order-Q.order)),k=n.computed(()=>v.value==="CLASS"&&oe.value.length>0),Y={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function S(Z){return Z?Y[Z]:"~"}function F(Z){var Q,te;return(te=wl(at((Q=t.data.operationStyles)==null?void 0:Q[Z.modelId])))==null?void 0:te.text}function U(Z,Q,te){switch(v.value){case"CLASS":return[{text:Z}];case"PHYSICAL":return[{text:te||Z}];case"LOGICAL":return[Q?{text:Q}:{text:"(논리명)",missing:!0}];default:{const de=Q?{text:Q}:{text:"(논리명)",missing:!0};return te?[de,{text:` · ${te}`}]:[de]}}}function le(Z){var Q,te,de;return E(Z)?[{text:Z.name}]:U(Z.name,(te=(Q=Z.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:te.ko,((de=Z.dbAttrs[0])==null?void 0:de.physicalName)??"")}function E(Z){return Z.attrType.startsWith("EMBED")&&Z.dbAttrs.length>0}function K(Z){return Z.attrType==="DIVIDER"}function re(Z){if(Z.attrType!=="EMBED_PREDEF")return Z.dbAttrs;const Q=o==null?void 0:o.embeddableCatalog.value.find(de=>de.type===Z.type);if(!Q)return Z.dbAttrs;const te=qn(Na(y.value,(o==null?void 0:o.state.logical.entities)??[]));return Z.dbAttrs.map((de,$)=>{const D=Q.fields[$],se=Wo(de,te);return se?{...de,physicalName:se.physicalName,logicalName:de.logicalName??(D==null?void 0:D.logicalName),dataType:de.dataType||(D==null?void 0:D.dataType)||""}:D?{...de,physicalName:de.physicalName||D.physicalName,logicalName:de.logicalName??D.logicalName,dataType:de.dataType||D.dataType,length:de.length??D.length}:de})}function pe(Z){var Q;return U(Z.physicalName,(Q=Z.logicalName)==null?void 0:Q.ko,Z.physicalName)}function ye(Z){const Q=pr(Z,(o==null?void 0:o.state.logical.associations)??[]);return va(v.value,Z,Q)}const ue=n.computed(()=>{var Z,Q,te;return U(y.value.name,(Q=(Z=y.value.table)==null?void 0:Z.logicalName)==null?void 0:Q.ko,((te=y.value.table)==null?void 0:te.physicalName)??"")}),fe=n.ref(!1),ge=n.ref(""),Ee=n.ref(null);async function Re(){var Z,Q;s.value&&(ge.value=y.value.name,fe.value=!0,await n.nextTick(),(Z=Ee.value)==null||Z.focus(),(Q=Ee.value)==null||Q.select())}function Ie(){if(!fe.value)return;fe.value=!1;const Z=ge.value.trim();Z&&Z!==y.value.name&&(o==null||o.renameEntity(t.id,Z))}function he(){o==null||o.addAttribute(t.id)}function j(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:W,findNode:w}=ze(),I=n.ref(null),C=n.computed(()=>{const Z=I.value??t.data.size;return Z?{width:`${Z.width}px`,minHeight:`${Z.height}px`}:void 0});let G=null;function J(Z){var de,$,D;if(!s.value)return;Z.stopPropagation();const Q=(de=w(t.id))==null?void 0:de.dimensions,te=W({x:Z.clientX,y:Z.clientY});G={fx:te.x,fy:te.y,w:(Q==null?void 0:Q.width)??(($=t.data.size)==null?void 0:$.width)??200,h:(Q==null?void 0:Q.height)??((D=t.data.size)==null?void 0:D.height)??120},Z.target.setPointerCapture(Z.pointerId)}function be(Z){if(!G)return;const Q=W({x:Z.clientX,y:Z.clientY});I.value={width:Math.max(40,G.w+(Q.x-G.fx)),height:Math.max(40,G.h+(Q.y-G.fy))}}function we(Z){var Q,te,de;if(G&&I.value&&o){const $=(Q=w(t.id))==null?void 0:Q.dimensions;o.resizeEntity(t.id,{width:Math.round(($==null?void 0:$.width)??I.value.width),height:Math.round(($==null?void 0:$.height)??I.value.height)})}G=null,I.value=null,(de=(te=Z.target).releasePointerCapture)==null||de.call(te,Z.pointerId)}const $e=n.ref(null),_e=n.ref(null);function Ce(Z,Q){if(!s.value)return;Q.stopPropagation(),Q.preventDefault();const te=g.value,de=te.has(Z.modelId)?new Set(te):new Set([Z.modelId]);_e.value={ids:de,dropIndex:-1,lineY:0},Q.target.setPointerCapture(Q.pointerId)}function Te(Z){if(!_e.value||!$e.value)return;const Q=Array.from($e.value.querySelectorAll(".em-entity__row"));if(!Q.length)return;let te=Q.length;for(let D=0;D<Q.length;D++){const se=Q[D].getBoundingClientRect();if(Z.clientY<se.top+se.height/2){te=D;break}}const de=Q[Q.length-1],$=te<Q.length?Q[te].offsetTop:de.offsetTop+de.offsetHeight;_e.value={..._e.value,dropIndex:te,lineY:$}}function Be(){const Z=_e.value;if(_e.value=null,!Z||Z.dropIndex<0)return;const Q=y.value.attributes,te=Q.filter(R=>Z.ids.has(R.modelId)).map(R=>R.modelId),de=Q.filter((R,q)=>Z.ids.has(R.modelId)&&q<Z.dropIndex).length,$=Z.dropIndex-de,D=Q.filter(R=>!Z.ids.has(R.modelId)).map(R=>R.modelId);[...D.slice(0,$),...te,...D.slice($)].join(",")!==Q.map(R=>R.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,te,$))}function N(){_e.value=null}const A=n.ref(null),ae=n.ref(null);function T(Z,Q){s.value&&(Q.stopPropagation(),Q.preventDefault(),ae.value={id:Z.modelId,dropIndex:-1,lineY:0},Q.target.setPointerCapture(Q.pointerId))}function z(Z){if(!ae.value||!A.value)return;const Q=Array.from(A.value.querySelectorAll(".em-entity__op-row"));if(!Q.length)return;let te=Q.length;for(let D=0;D<Q.length;D++){const se=Q[D].getBoundingClientRect();if(Z.clientY<se.top+se.height/2){te=D;break}}const de=Q[Q.length-1],$=te<Q.length?Q[te].offsetTop:de.offsetTop+de.offsetHeight;ae.value={...ae.value,dropIndex:te,lineY:$}}function B(){const Z=ae.value;if(ae.value=null,!Z||Z.dropIndex<0)return;const te=oe.value.findIndex($=>$.modelId===Z.id);if(te<0)return;const de=Z.dropIndex-(te<Z.dropIndex?1:0);de!==te&&(o==null||o.reorderOperations(t.id,[Z.id],de))}function me(){ae.value=null}return(Z,Q)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":h.value,"is-dimmed":V.value,"is-selected":m.value,"is-multi-selected":p.value,"has-focused-attr":b.value,"is-locked":x.value}]),style:n.normalizeStyle(C.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",kk,[...Q[7]||(Q[7]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("header",{class:"em-entity__header",style:n.normalizeStyle(ce.value),onDblclick:n.withModifiers(Re,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:ee.value?"펼치기":"접기","aria-expanded":!ee.value,disabled:!s.value,onClick:n.withModifiers(O,["stop"]),onPointerdown:Q[0]||(Q[0]=n.withModifiers(()=>{},["stop"])),onDblclick:Q[1]||(Q[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(ee.value?"▸":"▾"),41,wk),n.createElementVNode("span",Ek,"«"+n.toDisplayString(y.value.stereotype)+"»",1),fe.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ee,"onUpdate:modelValue":Q[2]||(Q[2]=te=>ge.value=te),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Ie,["enter"]),Q[3]||(Q[3]=n.withKeys(te=>fe.value=!1,["esc"]))],onBlur:Ie,onPointerdown:Q[4]||(Q[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ge.value]]):(n.openBlock(),n.createElementBlock("span",vk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ue.value,(te,de)=>(n.openBlock(),n.createElementBlock("span",{key:de,class:n.normalizeClass({"em-entity__missing":te.missing})},n.toDisplayString(te.text),3))),128))])),x.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)],36),ee.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$e,class:"em-entity__attrs"},[_e.value&&_e.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${_e.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value.attributes,te=>{var de,$,D,se;return n.openBlock(),n.createElementBlock(n.Fragment,{key:te.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":g.value.has(te.modelId),"is-dragging":(de=_e.value)==null?void 0:de.ids.has(te.modelId),"is-embed":E(te),"is-divider":K(te),nodrag:K(te)&&s.value}]),"data-attr":te.modelId,onClick:n.withModifiers(R=>_(te,R),["stop"]),onPointerdown:R=>K(te)?Ce(te,R):void 0,onPointermove:R=>K(te)?Te(R):void 0,onPointerup:R=>K(te)?Be():void 0,onPointercancel:R=>K(te)?N():void 0},[s.value&&!K(te)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:R=>Ce(te,R),onPointermove:Te,onPointerup:Be,onPointercancel:N,onClick:Q[5]||(Q[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,$k)):n.createCommentVNode("",!0),K(te)?(n.openBlock(),n.createElementBlock("span",xk,n.toDisplayString(te.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(dn),{id:`l:${te.modelId}`,type:"target",position:n.unref(Se).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ne(H.value[te.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Sk,[($=H.value[te.modelId])!=null&&$.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(D=H.value[te.modelId])!=null&&D.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",Ck,[E(te)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(se=H.value[te.modelId])!=null&&se.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Ik),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:L(te)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le(te),(R,q)=>(n.openBlock(),n.createElementBlock("span",{key:q,class:n.normalizeClass({"em-entity__missing":R.missing})},n.toDisplayString(R.text),3))),128))],4),ye(te)?(n.openBlock(),n.createElementBlock("span",Rk,n.toDisplayString(ye(te)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(dn),{id:`r:${te.modelId}`,type:"source",position:n.unref(Se).Right,class:"em-handle"},null,8,["id","position"])],64))],42,Nk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(E(te)&&P.value?re(te):[],R=>(n.openBlock(),n.createElementBlock("li",{key:`${te.modelId}:${R.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":g.value.has(te.modelId)}]),onClick:n.withModifiers(q=>_(te,q),["stop"])},[Q[8]||(Q[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",Ak,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe(R),(q,M)=>(n.openBlock(),n.createElementBlock("span",{key:M,class:n.normalizeClass({"em-entity__missing":q.missing})},n.toDisplayString(q.text),3))),128))]),n.createElementVNode("span",Tk,n.toDisplayString(R.dataType),1)],10,Vk))),128))],64)}),128))],512)),!ee.value&&k.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:A,class:"em-entity__ops"},[ae.value&&ae.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${ae.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,te=>{var de;return n.openBlock(),n.createElementBlock("li",{key:te.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((de=ae.value)==null?void 0:de.id)===te.modelId}]),"data-op":te.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:$=>T(te,$),onPointermove:z,onPointerup:B,onPointercancel:me,onClick:Q[6]||(Q[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Bk)):n.createCommentVNode("",!0),n.createElementVNode("span",Dk,n.toDisplayString(S(te.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:F(te)})},n.toDisplayString(te.name)+"()",5)],10,Mk)}),128))],512)):oe.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${oe.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(oe.value.length)+"개",1)],8,Ok)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",Lk,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:he},"+ 속성"),Q[9]||(Q[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:j},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!fe.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:J,onPointermove:be,onPointerup:we},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3a3c0b9d"]]),Pk={key:0,class:"em-sel","aria-hidden":"true"},zk={class:"em-group__label"},Uk={class:"em-group__name"},Hk={key:0,class:"em-group__pkg"},Fk={key:1,class:"em-group__flag"},Hd=Ue(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>t.data.locked??!1),a=n.computed(()=>at(t.data.style)),l=n.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),r=n.inject(pn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var H;return!!t.id&&((H=r==null?void 0:r.selection.value)==null?void 0:H.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(Hi,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),h=n.inject(zn,null);function m(){t.id&&(h==null||h.setGroupHover(t.id))}function p(){h==null||h.setGroupHover(null)}const g=n.computed(()=>!!h&&h.hoverGroupId.value===t.id),b=n.computed(()=>!!h&&h.hoverGroupId.value!==null&&h.hoverGroupId.value!==t.id),{screenToFlowCoordinate:_,findNode:V}=ze();let y=null,v=null;function ee(H){var L;if(!t.id||!s.value)return;H.stopPropagation();const ne=((L=V(t.id))==null?void 0:L.dimensions)??{width:400,height:300},ce=_({x:H.clientX,y:H.clientY});y={fx:ce.x,fy:ce.y,w:ne.width,h:ne.height},H.target.setPointerCapture(H.pointerId)}function x(H){if(!y||!t.id)return;const ne=_({x:H.clientX,y:H.clientY});v={width:Math.max(160,y.w+(ne.x-y.fx)),height:Math.max(120,y.h+(ne.y-y.fy))};const ce=V(t.id);ce&&(ce.style={width:`${v.width}px`,height:`${v.height}px`})}function O(H){var ne,ce;y&&v&&t.id&&r&&r.resizeGroup(t.id,v),y=null,v=null,(ce=(ne=H.target).releasePointerCapture)==null||ce.call(ne,H.pointerId)}const P=n.computed(()=>{const H=o.value.name;return(H==null?void 0:H.ko)||(H==null?void 0:H.en)||(H==null?void 0:H.ja)||(H==null?void 0:H.zh)||o.value.packageName||"그룹"});return(H,ne)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":g.value,"is-dimmed":b.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:m,onMouseleave:p},[c.value?(n.openBlock(),n.createElementBlock("div",Pk,[...ne[0]||(ne[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",zk,[n.createElementVNode("span",Uk,n.toDisplayString(P.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Hk,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",Fk,"DDL 제외")):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-group__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)]),s.value&&!i.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:ee,onPointermove:x,onPointerup:O},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),Gk={key:0,class:"em-sel","aria-hidden":"true"},Yk={key:2,class:"em-note__text"},Fd=Ue(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=n.inject(Hi,null),a=n.inject(zn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>at(l.value.style)),c=n.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=t.data.groupRef??null)}function u(){a==null||a.setNoteHover(t.id)}function f(){a==null||a.setNoteHover(null)}const h=n.computed(()=>{var k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!h.value),p=n.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===t.id}),g=n.computed(()=>!!t.selected&&!p.value),b=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!p.value),_=[{id:"n-top",pos:Se.Top},{id:"n-right",pos:Se.Right},{id:"n-bottom",pos:Se.Bottom},{id:"n-left",pos:Se.Left}],V=n.ref(!1),y=n.ref(""),v=n.ref(null);async function ee(){var k;r.value&&(y.value=l.value.memo,V.value=!0,await n.nextTick(),(k=v.value)==null||k.focus())}function x(){V.value&&(V.value=!1,y.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,y.value)))}const{screenToFlowCoordinate:O,findNode:P}=ze();let H=null,ne=null;function ce(k){var F;if(!r.value)return;k.stopPropagation();const Y=((F=P(t.id))==null?void 0:F.dimensions)??l.value.geo.size,S=O({x:k.clientX,y:k.clientY});H={fx:S.x,fy:S.y,w:Y.width,h:Y.height},k.target.setPointerCapture(k.pointerId)}function L(k){if(!H)return;const Y=O({x:k.clientX,y:k.clientY});ne={width:Math.max(140,H.w+(Y.x-H.fx)),height:Math.max(60,H.h+(Y.y-H.fy))};const S=P(t.id);S&&(S.style={width:`${ne.width}px`,height:`${ne.height}px`})}function oe(k){var Y,S;H&&ne&&o&&o.resizeNote(t.id,ne),H=null,ne=null,(S=(Y=k.target).releasePointerCapture)==null||S.call(Y,k.pointerId)}return(k,Y)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":m.value,"is-dimmed":b.value,"is-selected":p.value,"is-multi-selected":g.value}]),style:n.normalizeStyle(c.value),onDblclick:ee,onPointerdown:d,onMouseenter:u,onMouseleave:f},[p.value?(n.openBlock(),n.createElementBlock("div",Gk,[...Y[4]||(Y[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),V.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:v,"onUpdate:modelValue":Y[0]||(Y[0]=S=>y.value=S),class:"em-note__edit nodrag",onBlur:x,onKeydown:Y[1]||(Y[1]=n.withKeys(S=>V.value=!1,["esc"])),onPointerdown:Y[2]||(Y[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,y.value]]):(n.openBlock(),n.createElementBlock("div",Yk,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,S=>n.createVNode(n.unref(dn),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:Y[3]||(Y[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!V.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:ce,onPointermove:L,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Wk=20,Kk=22,qk=7,Xk=22,Gd=31,Yd=7,jk=20,Wd=11,Kd=11,Zk=Gd+Yd;function Jk(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Qk(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Fi(e,t,o){const i=t.x-e.x,a=t.y-e.y,l=Math.hypot(i,a)||1;return{x:e.x+i*o/l,y:e.y+a*o/l}}function qd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Gi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Xd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:qd(e,t);return[Gi(o,a,l-Math.PI/2),Gi(o,a,l+Math.PI/2)]}function jd(e,t,o,i){const a=t*180/Math.PI,r=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(r)*o+e.x,y:Math.cos(r)*o+e.y}}function Zd(e,t,o,i){const a=[],l=[],r=[];if(e.x===t.x&&e.y===t.y)return{lines:a,circles:l,polygons:r};if(i==="db"){const c=Fi(e,t,Wk),[d,u]=Xd(e,t,c,Kk);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),Jk(o.multiplicity)){const f=Fi(e,t,Gd);l.push({cx:f.x,cy:f.y,r:Yd})}if(Qk(o.multiplicity)){const f=Fi(e,t,qk),[h,m]=Xd(e,t,f,Xk);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:a,circles:l,polygons:r}}let s=e;if(o.composition){const c=Fi(e,t,jk),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=qd(e,t),f=Gi(d,Wd/2,u-Math.PI/2),h=Gi(d,Wd/2,u+Math.PI/2);r.push({points:[e,f,c,h]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=jd(s,c,Kd,!0),u=jd(s,c,Kd,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:l,polygons:r}}const Jd=200,Qd=120,$l=24;function eu(e){var a,l;if(!e)return{x:0,y:0,width:Jd,height:Qd};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Jd,i=((l=e.dimensions)==null?void 0:l.height)||Qd;return{x:t.x,y:t.y,width:o,height:i}}function tu(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function nu(e){const t=n.computed(()=>eu(e.sourceNode())),o=n.computed(()=>eu(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var m,p;const d=t.value,u=d.x+d.width;let f=((m=e.sourceRowY)==null?void 0:m.call(e))??d.y+d.height/3,h=((p=e.targetRowY)==null?void 0:p.call(e))??d.y+d.height*2/3;if(Math.abs(h-f)<$l){const g=(f+h)/2;f=g-$l/2,h=g+$l/2}return{source:{x:u,y:f},target:{x:u,y:h}}}),l=n.computed(()=>e.waypoints()[0]??tu(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??tu(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ha(t.value,d,l.value.x):pa(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ha(o.value,d,r.value.x):pa(o.value,r.value)});return{source:n.computed(()=>i.value?a.value.source:s.value.point),target:n.computed(()=>i.value?a.value.target:c.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":c.value.side),isSelf:i}}const xl=Symbol("waypointController"),ew=["d"],tw=["d"],nw=["d"],ow=["x1","y1","x2","y2"],iw=["cx","cy","r"],aw=["x","y"],lw=["x","y"],rw=["cx","cy","onDblclick"],sw=["x","y","onPointerdown","onDblclick"],ou=Ue(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=ze(),i=n.inject(xl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(zd,null),s=n.inject(zn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var he;return((he=a==null?void 0:a.selection.value)==null?void 0:he.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),f=n.computed(()=>{const he=r==null?void 0:r.value;if(!he||!a)return null;const j=a.resolved.value.entities,W=I=>{var C;return(C=j.find(G=>G.entity.modelId===I))==null?void 0:C.groupRef},w=t.data.association;return W(w.end1.entityRef)===he.groupId&&W(w.end2.entityRef)===he.groupId?{dx:he.dx,dy:he.dy}:null}),h=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),p=n.ref({x:0,y:0}),g=n.computed(()=>{const he=f.value;return h.value.map((j,W)=>W===m.value?p.value:he?{x:j.x+he.dx,y:j.y+he.dy}:j)}),b=n.computed(()=>{var he;return!!((he=t.sourceNode.data)!=null&&he.collapsed)}),_=n.computed(()=>{var he;return!!((he=t.targetNode.data)!=null&&he.collapsed)}),{source:V,target:y,sourceSide:v,targetSide:ee,isSelf:x}=nu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!b.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),O=Zk+4,P=n.computed(()=>x.value?er(V.value,y.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?ua(V.value,v.value,g.value,y.value,ee.value,O):ma(V.value,g.value,y.value)),H=n.computed(()=>x.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?fa(V.value,v.value,g.value,y.value,ee.value,O):ya(V.value,g.value,y.value).map((he,j)=>({point:he,segIndex:j}))),ne=n.computed(()=>x.value||!l.value?[]:g.value);function ce(he){switch(he){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function L(he,j){m.value=he,p.value={...h.value[he]},j.target.setPointerCapture(j.pointerId),j.stopPropagation()}function oe(he){if(m.value<0)return;const j=o({x:he.clientX,y:he.clientY});p.value={x:j.x,y:j.y}}function k(he){var j,W;m.value>=0&&i&&i.movePoint(t.id,m.value,{...p.value}),m.value=-1,(W=(j=he.target).releasePointerCapture)==null||W.call(j,he.pointerId)}function Y(he,j){j.stopPropagation(),i==null||i.removePoint(t.id,he)}function S(he,j){if(!i)return;const W=o({x:j.clientX,y:j.clientY});i.insertPoint(t.id,he,{x:W.x,y:W.y})}const F=n.computed(()=>ce(t.data.association.end1.multiplicity)),U=n.computed(()=>ce(t.data.association.end2.multiplicity)),le=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),E=n.computed(()=>le.value==="class"),K=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const he=Yn(v.value);return{x:V.value.x+he.x*10,y:V.value.y+he.y*10}}return g.value[0]??y.value}),re=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const j=Yn(ee.value);return{x:y.value.x+j.x*10,y:y.value.y+j.y*10}}const he=g.value;return he[he.length-1]??V.value}),pe=n.computed(()=>{const he=t.data.association;return{multiplicity:he.end1.multiplicity,navigable:he.end1.navigable,composition:he.end1.composition,otherNavigable:he.end2.navigable}}),ye=n.computed(()=>{const he=t.data.association;return{multiplicity:he.end2.multiplicity,navigable:he.end2.navigable,composition:he.end2.composition,otherNavigable:he.end1.navigable}}),ue=n.computed(()=>Zd(V.value,K.value,pe.value,le.value)),fe=n.computed(()=>Zd(y.value,re.value,ye.value,le.value)),ge=n.computed(()=>[...ue.value.lines,...fe.value.lines]),Ee=n.computed(()=>[...ue.value.circles,...fe.value.circles]),Re=n.computed(()=>[...ue.value.polygons,...fe.value.polygons].map(he=>`M${he.points.map(j=>`${j.x},${j.y}`).join(" L")} Z`)),Ie=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(he,j)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:P.value,fill:"none",class:"em-edge__hit"},null,8,ew),n.createElementVNode("path",{d:P.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,tw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Re.value,(W,w)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${w}`,d:W,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ie.value])},null,10,nw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ge.value,(W,w)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${w}`,x1:W.x1,y1:W.y1,x2:W.x2,y2:W.y2,class:n.normalizeClass(["em-edge__marker",Ie.value])},null,10,ow))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ee.value,(W,w)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${w}`,cx:W.cx,cy:W.cy,r:W.r,class:n.normalizeClass(["em-edge__marker",Ie.value])},null,10,iw))),128)),E.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(V).x+8,y:n.unref(V).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(F.value),11,aw),n.createElementVNode("text",{x:n.unref(y).x-8,y:n.unref(y).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(U.value),11,lw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(H.value,(W,w)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${w}`,cx:W.point.x,cy:W.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(I=>S(W.segIndex,I),["stop"])},null,42,rw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.value,(W,w)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${w}`,x:W.x-5,y:W.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:I=>L(w,I),onPointermove:oe,onPointerup:k,onDblclick:I=>Y(w,I)},null,42,sw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Ot=(e=>(e.Lines="lines",e.Dots="dots",e))(Ot||{});const iu=function({dimensions:e,size:t,color:o}){return n.h("path",{stroke:o,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},au=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Ot.Lines+"",Ot.Dots+"";const cw={[Ot.Dots]:"#81818a",[Ot.Lines]:"#eee"},dw=["id","x","y","width","height","patternTransform"],uw={key:2,height:"100",width:"100"},fw=["fill"],mw=["x","y","fill"],pw={name:"Background",compatConfig:{MODE:3}},hw=n.defineComponent({...pw,props:{id:{},variant:{default:()=>Ot.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:t,viewport:o}=ze(),i=n.computed(()=>{const r=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*r||1,c*r||1],u=e.size*r,[f,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+d[0]/2,h*r||1+d[1]/2];return{scaledGap:d,offset:m,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),l=n.toRef(()=>e.color||e.patternColor||cw[e.variant||Ot.Dots]);return(r,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${r.height>100?100:r.height}%`,width:`${r.width>100?100:r.width}%`})},[n.renderSlot(r.$slots,"pattern-container",{id:a.value},()=>[n.createElementVNode("pattern",{id:a.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[n.renderSlot(r.$slots,"pattern",{},()=>[r.variant===n.unref(Ot).Lines?(n.openBlock(),n.createBlock(n.unref(iu),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Ot).Dots?(n.openBlock(),n.createBlock(n.unref(au),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",uw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,fw)])):n.createCommentVNode("",!0)])],8,dw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,mw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),yw={name:"ControlButton",compatConfig:{MODE:3}},gw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},bw={type:"button",class:"vue-flow__controls-button"};function _w(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",bw,[n.renderSlot(e.$slots,"default")])}const hn=gw(yw,[["render",_w]]),kw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ww=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Ew(e,t){return n.openBlock(),n.createElementBlock("svg",kw,ww)}const vw={render:Ew},Nw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},$w=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function xw(e,t){return n.openBlock(),n.createElementBlock("svg",Nw,$w)}const Iw={render:xw},Sw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Cw=[n.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 Rw(e,t){return n.openBlock(),n.createElementBlock("svg",Sw,Cw)}const Vw={render:Rw},Aw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Tw=[n.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 Mw(e,t){return n.openBlock(),n.createElementBlock("svg",Aw,Tw)}const Bw={render:Mw},Dw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Ow=[n.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 Lw(e,t){return n.openBlock(),n.createElementBlock("svg",Dw,Ow)}const Pw={render:Lw},zw={name:"Controls",compatConfig:{MODE:3}},Uw=n.defineComponent({...zw,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Vc.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:l,zoomIn:r,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:f}=ze(),h=n.toRef(()=>o.value||i.value||a.value),m=n.toRef(()=>d.value.zoom<=u.value),p=n.toRef(()=>d.value.zoom>=f.value);function g(){r(),t("zoomIn")}function b(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function V(){l(!h.value),t("interactionChange",!h.value)}return(y,v)=>(n.openBlock(),n.createBlock(n.unref(Cd),{class:"vue-flow__controls",position:y.position},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"top"),y.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(y.$slots,"control-zoom-in",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomin",disabled:p.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(vw))))])]),_:3},8,["disabled"])]),n.renderSlot(y.$slots,"control-zoom-out",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Iw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),y.showFitView?n.renderSlot(y.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hn,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Vw))))])]),_:3})]):n.createCommentVNode("",!0),y.showInteractive?n.renderSlot(y.$slots,"control-interactive",{key:2},()=>[y.showInteractive?(n.openBlock(),n.createBlock(hn,{key:0,class:"vue-flow__controls-interactive",onClick:V},{default:n.withCtx(()=>[h.value?n.renderSlot(y.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Pw))))]):n.createCommentVNode("",!0),h.value?n.createCommentVNode("",!0):n.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Bw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}});var Hw={value:()=>{}};function Il(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Yi(o)}function Yi(e){this._=e}function Fw(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Yi.prototype=Il.prototype={constructor:Yi,on:function(e,t){var o=this._,i=Fw(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Gw(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<r;)if(a=(e=i[l]).type)o[a]=lu(o[a],e.name,t);else if(t==null)for(a in o)o[a]=lu(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Yi(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function Gw(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function lu(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Hw,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Sl="http://www.w3.org/1999/xhtml";const ru={svg:"http://www.w3.org/2000/svg",xhtml:Sl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Wi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),ru.hasOwnProperty(t)?{space:ru[t],local:e}:e}function Yw(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Sl&&t.documentElement.namespaceURI===Sl?t.createElement(e):t.createElementNS(o,e)}}function Ww(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function su(e){var t=Wi(e);return(t.local?Ww:Yw)(t)}function Kw(){}function Cl(e){return e==null?Kw:function(){return this.querySelector(e)}}function qw(e){typeof e!="function"&&(e=Cl(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=new Array(r),c,d,u=0;u<r;++u)(c=l[u])&&(d=e.call(c,c.__data__,u,l))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new ft(i,this._parents)}function Xw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function jw(){return[]}function cu(e){return e==null?jw:function(){return this.querySelectorAll(e)}}function Zw(e){return function(){return Xw(e.apply(this,arguments))}}function Jw(e){typeof e=="function"?e=Zw(e):e=cu(e);for(var t=this._groups,o=t.length,i=[],a=[],l=0;l<o;++l)for(var r=t[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),a.push(c));return new ft(i,a)}function du(e){return function(){return this.matches(e)}}function uu(e){return function(t){return t.matches(e)}}var Qw=Array.prototype.find;function eE(e){return function(){return Qw.call(this.children,e)}}function tE(){return this.firstElementChild}function nE(e){return this.select(e==null?tE:eE(typeof e=="function"?e:uu(e)))}var oE=Array.prototype.filter;function iE(){return Array.from(this.children)}function aE(e){return function(){return oE.call(this.children,e)}}function lE(e){return this.selectAll(e==null?iE:aE(typeof e=="function"?e:uu(e)))}function rE(e){typeof e!="function"&&(e=du(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new ft(i,this._parents)}function fu(e){return new Array(e.length)}function sE(){return new ft(this._enter||this._groups.map(fu),this._parents)}function Ki(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ki.prototype={constructor:Ki,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function cE(e){return function(){return e}}function dE(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new Ki(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function uE(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(h[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new Ki(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function fE(e){return e.__data__}function mE(e,t){if(!arguments.length)return Array.from(this,fE);var o=t?uE:dE,i=this._parents,a=this._groups;typeof e!="function"&&(e=cE(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],h=f.length,m=pE(e.call(u,u&&u.__data__,d,i)),p=m.length,g=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,g,b,_,m,t);for(var V=0,y=0,v,ee;V<p;++V)if(v=g[V]){for(V>=y&&(y=V+1);!(ee=b[y])&&++y<p;);v._next=ee||null}}return r=new ft(r,i),r._enter=s,r._exit=c,r}function pE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hE(){return new ft(this._exit||this._groups.map(fu),this._parents)}function yE(e,t,o){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?l.remove():o(l),i&&a?i.merge(a).order():a}function gE(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,h=s[c]=new Array(f),m,p=0;p<f;++p)(m=d[p]||u[p])&&(h[p]=m);for(;c<a;++c)s[c]=o[c];return new ft(s,this._parents)}function bE(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function _E(e){e||(e=kE);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var o=this._groups,i=o.length,a=new Array(i),l=0;l<i;++l){for(var r=o[l],s=r.length,c=a[l]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new ft(a,this._parents).order()}function kE(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function wE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function EE(){return Array.from(this)}function vE(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function NE(){let e=0;for(const t of this)++e;return e}function $E(){return!this.node()}function xE(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],l=0,r=a.length,s;l<r;++l)(s=a[l])&&e.call(s,s.__data__,l,a);return this}function IE(e){return function(){this.removeAttribute(e)}}function SE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function CE(e,t){return function(){this.setAttribute(e,t)}}function RE(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function VE(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function AE(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function TE(e,t){var o=Wi(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?SE:IE:typeof t=="function"?o.local?AE:VE:o.local?RE:CE)(o,t))}function mu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ME(e){return function(){this.style.removeProperty(e)}}function BE(e,t,o){return function(){this.style.setProperty(e,t,o)}}function DE(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function OE(e,t,o){return arguments.length>1?this.each((t==null?ME:typeof t=="function"?DE:BE)(e,t,o??"")):Un(this.node(),e)}function Un(e,t){return e.style.getPropertyValue(t)||mu(e).getComputedStyle(e,null).getPropertyValue(t)}function LE(e){return function(){delete this[e]}}function PE(e,t){return function(){this[e]=t}}function zE(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function UE(e,t){return arguments.length>1?this.each((t==null?LE:typeof t=="function"?zE:PE)(e,t)):this.node()[e]}function pu(e){return e.trim().split(/^|\s+/)}function Rl(e){return e.classList||new hu(e)}function hu(e){this._node=e,this._names=pu(e.getAttribute("class")||"")}hu.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function yu(e,t){for(var o=Rl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function gu(e,t){for(var o=Rl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function HE(e){return function(){yu(this,e)}}function FE(e){return function(){gu(this,e)}}function GE(e,t){return function(){(t.apply(this,arguments)?yu:gu)(this,e)}}function YE(e,t){var o=pu(e+"");if(arguments.length<2){for(var i=Rl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?GE:t?HE:FE)(o,t))}function WE(){this.textContent=""}function KE(e){return function(){this.textContent=e}}function qE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function XE(e){return arguments.length?this.each(e==null?WE:(typeof e=="function"?qE:KE)(e)):this.node().textContent}function jE(){this.innerHTML=""}function ZE(e){return function(){this.innerHTML=e}}function JE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function QE(e){return arguments.length?this.each(e==null?jE:(typeof e=="function"?JE:ZE)(e)):this.node().innerHTML}function ev(){this.nextSibling&&this.parentNode.appendChild(this)}function tv(){return this.each(ev)}function nv(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ov(){return this.each(nv)}function iv(e){var t=typeof e=="function"?e:su(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function av(){return null}function lv(e,t){var o=typeof e=="function"?e:su(e),i=t==null?av:typeof t=="function"?t:Cl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function rv(){var e=this.parentNode;e&&e.removeChild(this)}function sv(){return this.each(rv)}function cv(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function dv(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function uv(e){return this.select(e?dv:cv)}function fv(e){return arguments.length?this.property("__data__",e):this.node().__data__}function mv(e){return function(t){e.call(this,t,this.__data__)}}function pv(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function hv(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function yv(e,t,o){return function(){var i=this.__on,a,l=mv(t);if(i){for(var r=0,s=i.length;r<s;++r)if((a=i[r]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=o),a.value=t;return}}this.addEventListener(e.type,l,o),a={type:e.type,name:e.name,value:t,listener:l,options:o},i?i.push(a):this.__on=[a]}}function gv(e,t,o){var i=pv(e+""),a,l=i.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<l;++a)if((r=i[a]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?yv:hv,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function bu(e,t,o){var i=mu(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function bv(e,t){return function(){return bu(this,e,t)}}function _v(e,t){return function(){return bu(this,e,t.apply(this,arguments))}}function kv(e,t){return this.each((typeof t=="function"?_v:bv)(e,t))}function*wv(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length,r;a<l;++a)(r=i[a])&&(yield r)}var _u=[null];function ft(e,t){this._groups=e,this._parents=t}function Eo(){return new ft([[document.documentElement]],_u)}function Ev(){return this}ft.prototype=Eo.prototype={constructor:ft,select:qw,selectAll:Jw,selectChild:nE,selectChildren:lE,filter:rE,data:mE,enter:sE,exit:hE,join:yE,merge:gE,selection:Ev,order:bE,sort:_E,call:wE,nodes:EE,node:vE,size:NE,empty:$E,each:xE,attr:TE,style:OE,property:UE,classed:YE,text:XE,html:QE,raise:tv,lower:ov,append:iv,insert:lv,remove:sv,clone:uv,datum:fv,on:gv,dispatch:kv,[Symbol.iterator]:wv};function qt(e){return typeof e=="string"?new ft([[document.querySelector(e)]],[document.documentElement]):new ft([[e]],_u)}function vv(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=vv(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const Vl={capture:!0,passive:!1};function Al(e){e.preventDefault(),e.stopImmediatePropagation()}function Nv(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",Al,Vl);"onselectstart"in t?o.on("selectstart.drag",Al,Vl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $v(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Al,Vl),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function Tl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function ku(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function vo(){}var No=.7,qi=1/No,Hn="\\s*([+-]?\\d+)\\s*",$o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",It="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xv=/^#([0-9a-f]{3,8})$/,Iv=new RegExp(`^rgb\\(${Hn},${Hn},${Hn}\\)$`),Sv=new RegExp(`^rgb\\(${It},${It},${It}\\)$`),Cv=new RegExp(`^rgba\\(${Hn},${Hn},${Hn},${$o}\\)$`),Rv=new RegExp(`^rgba\\(${It},${It},${It},${$o}\\)$`),Vv=new RegExp(`^hsl\\(${$o},${It},${It}\\)$`),Av=new RegExp(`^hsla\\(${$o},${It},${It},${$o}\\)$`),wu={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};Tl(vo,xo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Eu,formatHex:Eu,formatHex8:Tv,formatHsl:Mv,formatRgb:vu,toString:vu});function Eu(){return this.rgb().formatHex()}function Tv(){return this.rgb().formatHex8()}function Mv(){return Su(this).formatHsl()}function vu(){return this.rgb().formatRgb()}function xo(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=xv.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Nu(t):o===3?new ct(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Xi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Xi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Iv.exec(e))?new ct(t[1],t[2],t[3],1):(t=Sv.exec(e))?new ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cv.exec(e))?Xi(t[1],t[2],t[3],t[4]):(t=Rv.exec(e))?Xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Vv.exec(e))?Iu(t[1],t[2]/100,t[3]/100,1):(t=Av.exec(e))?Iu(t[1],t[2]/100,t[3]/100,t[4]):wu.hasOwnProperty(e)?Nu(wu[e]):e==="transparent"?new ct(NaN,NaN,NaN,0):null}function Nu(e){return new ct(e>>16&255,e>>8&255,e&255,1)}function Xi(e,t,o,i){return i<=0&&(e=t=o=NaN),new ct(e,t,o,i)}function Bv(e){return e instanceof vo||(e=xo(e)),e?(e=e.rgb(),new ct(e.r,e.g,e.b,e.opacity)):new ct}function Ml(e,t,o,i){return arguments.length===1?Bv(e):new ct(e,t,o,i??1)}function ct(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Tl(ct,Ml,ku(vo,{brighter(e){return e=e==null?qi:Math.pow(qi,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?No:Math.pow(No,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ct(yn(this.r),yn(this.g),yn(this.b),ji(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:$u,formatHex:$u,formatHex8:Dv,formatRgb:xu,toString:xu}));function $u(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function Dv(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function xu(){const e=ji(this.opacity);return`${e===1?"rgb(":"rgba("}${yn(this.r)}, ${yn(this.g)}, ${yn(this.b)}${e===1?")":`, ${e})`}`}function ji(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gn(e){return e=yn(e),(e<16?"0":"")+e.toString(16)}function Iu(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new bt(e,t,o,i)}function Su(e){if(e instanceof bt)return new bt(e.h,e.s,e.l,e.opacity);if(e instanceof vo||(e=xo(e)),!e)return new bt;if(e instanceof bt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),l=Math.max(t,o,i),r=NaN,s=l-a,c=(l+a)/2;return s?(t===l?r=(o-i)/s+(o<i)*6:o===l?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?l+a:2-l-a,r*=60):s=c>0&&c<1?0:r,new bt(r,s,c,e.opacity)}function Ov(e,t,o,i){return arguments.length===1?Su(e):new bt(e,t,o,i??1)}function bt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Tl(bt,Ov,ku(vo,{brighter(e){return e=e==null?qi:Math.pow(qi,e),new bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?No:Math.pow(No,e),new bt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new ct(Bl(e>=240?e-240:e+120,a,i),Bl(e,a,i),Bl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new bt(Cu(this.h),Zi(this.s),Zi(this.l),ji(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=ji(this.opacity);return`${e===1?"hsl(":"hsla("}${Cu(this.h)}, ${Zi(this.s)*100}%, ${Zi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Cu(e){return e=(e||0)%360,e<0?e+360:e}function Zi(e){return Math.max(0,Math.min(1,e||0))}function Bl(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Ru=e=>()=>e;function Lv(e,t){return function(o){return e+o*t}}function Pv(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function zv(e){return(e=+e)==1?Vu:function(t,o){return o-t?Pv(t,o,e):Ru(isNaN(t)?o:t)}}function Vu(e,t){var o=t-e;return o?Lv(e,o):Ru(isNaN(e)?t:e)}const Au=(function e(t){var o=zv(t);function i(a,l){var r=o((a=Ml(a)).r,(l=Ml(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Vu(a.opacity,l.opacity);return function(u){return a.r=r(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function jt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var Dl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ol=new RegExp(Dl.source,"g");function Uv(e){return function(){return e}}function Hv(e){return function(t){return e(t)+""}}function Fv(e,t){var o=Dl.lastIndex=Ol.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Dl.exec(e))&&(a=Ol.exec(t));)(l=a.index)>o&&(l=t.slice(o,l),s[r]?s[r]+=l:s[++r]=l),(i=i[0])===(a=a[0])?s[r]?s[r]+=a:s[++r]=a:(s[++r]=null,c.push({i:r,x:jt(i,a)})),o=Ol.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Hv(c[0].x):Uv(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}var Tu=180/Math.PI,Ll={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Mu(e,t,o,i,a,l){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*Tu,skewX:Math.atan(c)*Tu,scaleX:r,scaleY:s}}var Ji;function Gv(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ll:Mu(t.a,t.b,t.c,t.d,t.e,t.f)}function Yv(e){return e==null||(Ji||(Ji=document.createElementNS("http://www.w3.org/2000/svg","g")),Ji.setAttribute("transform",e),!(e=Ji.transform.baseVal.consolidate()))?Ll:(e=e.matrix,Mu(e.a,e.b,e.c,e.d,e.e,e.f))}function Bu(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,m,p){if(d!==f||u!==h){var g=m.push("translate(",null,t,null,o);p.push({i:g-4,x:jt(d,f)},{i:g-2,x:jt(u,h)})}else(f||h)&&m.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:jt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:jt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var g=m.push(a(m)+"scale(",null,",",null,")");p.push({i:g-4,x:jt(d,f)},{i:g-2,x:jt(u,h)})}else(f!==1||h!==1)&&m.push(a(m)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(m){for(var p=-1,g=h.length,b;++p<g;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var Wv=Bu(Gv,"px, ","px)","deg)"),Kv=Bu(Yv,", ",")",")"),qv=1e-12;function Du(e){return((e=Math.exp(e))+1/e)/2}function Xv(e){return((e=Math.exp(e))-1/e)/2}function jv(e){return((e=Math.exp(2*e))-1)/(e+1)}const Zv=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],h=r[2],m=u-s,p=f-c,g=m*m+p*p,b,_;if(g<qv)_=Math.log(h/d)/t,b=function(O){return[s+O*m,c+O*p,d*Math.exp(t*O*_)]};else{var V=Math.sqrt(g),y=(h*h-d*d+i*g)/(2*d*o*V),v=(h*h-d*d-i*g)/(2*h*o*V),ee=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(v*v+1)-v);_=(x-ee)/t,b=function(O){var P=O*_,H=Du(ee),ne=d/(o*V)*(H*jv(t*P+ee)-Xv(ee));return[s+ne*m,c+ne*p,d*H/Du(t*P+ee)]}}return b.duration=_*1e3*t/Math.SQRT2,b}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Fn=0,Io=0,So=0,Ou=1e3,Qi,Co,ea=0,bn=0,ta=0,Ro=typeof performance=="object"&&performance.now?performance:Date,Lu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Pl(){return bn||(Lu(Jv),bn=Ro.now()+ta)}function Jv(){bn=0}function na(){this._call=this._time=this._next=null}na.prototype=Pu.prototype={constructor:na,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Pl():+o)+(t==null?0:+t),!this._next&&Co!==this&&(Co?Co._next=this:Qi=this,Co=this),this._call=e,this._time=o,zl()},stop:function(){this._call&&(this._call=null,this._time=1/0,zl())}};function Pu(e,t,o){var i=new na;return i.restart(e,t,o),i}function Qv(){Pl(),++Fn;for(var e=Qi,t;e;)(t=bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fn}function zu(){bn=(ea=Ro.now())+ta,Fn=Io=0;try{Qv()}finally{Fn=0,tN(),bn=0}}function eN(){var e=Ro.now(),t=e-ea;t>Ou&&(ta-=t,ea=e)}function tN(){for(var e,t=Qi,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Qi=o);Co=e,zl(i)}function zl(e){if(!Fn){Io&&(Io=clearTimeout(Io));var t=e-bn;t>24?(e<1/0&&(Io=setTimeout(zu,e-Ro.now()-ta)),So&&(So=clearInterval(So))):(So||(ea=Ro.now(),So=setInterval(eN,Ou)),Fn=1,Lu(zu))}}function Uu(e,t,o){var i=new na;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var nN=Il("start","end","cancel","interrupt"),oN=[],Hu=0,Fu=1,Ul=2,oa=3,Gu=4,Hl=5,ia=6;function aa(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;iN(e,o,{name:t,index:i,group:a,on:nN,tween:oN,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Hu})}function Fl(e,t){var o=_t(e,t);if(o.state>Hu)throw new Error("too late; already scheduled");return o}function St(e,t){var o=_t(e,t);if(o.state>oa)throw new Error("too late; already running");return o}function _t(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function iN(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Pu(l,0,o.time);function l(d){o.state=Fu,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,m;if(o.state!==Fu)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===oa)return Uu(r);m.state===Gu?(m.state=ia,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=ia,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Uu(function(){o.state===oa&&(o.state=Gu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Ul,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ul){for(o.state=oa,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Hl,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Hl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ia,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function la(e,t){var o=e.__transition,i,a,l=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){l=!1;continue}a=i.state>Ul&&i.state<Hl,i.state=ia,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function aN(e){return this.each(function(){la(this,e)})}function lN(e,t){var o,i;return function(){var a=St(this,e),l=a.tween;if(l!==o){i=o=l;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}a.tween=i}}function rN(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=St(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function sN(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=_t(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?lN:rN)(o,e,t))}function Gl(e,t,o){var i=e._id;return e.each(function(){var a=St(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return _t(a,i).value[t]}}function Yu(e,t){var o;return(typeof t=="number"?jt:t instanceof xo?Au:(o=xo(t))?(t=o,Au):Fv)(e,t)}function cN(e){return function(){this.removeAttribute(e)}}function dN(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uN(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttribute(e);return r===a?null:r===i?l:l=t(i=r,o)}}function fN(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?l:l=t(i=r,o)}}function mN(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function pN(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function hN(e,t){var o=Wi(e),i=o==="transform"?Kv:Yu;return this.attrTween(e,typeof t=="function"?(o.local?pN:mN)(o,i,Gl(this,"attr."+e,t)):t==null?(o.local?dN:cN)(o):(o.local?fN:uN)(o,i,t))}function yN(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function gN(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function bN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&gN(e,l)),o}return a._value=t,a}function _N(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&yN(e,l)),o}return a._value=t,a}function kN(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Wi(e);return this.tween(o,(i.local?bN:_N)(i,t))}function wN(e,t){return function(){Fl(this,e).delay=+t.apply(this,arguments)}}function EN(e,t){return t=+t,function(){Fl(this,e).delay=t}}function vN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wN:EN)(t,e)):_t(this.node(),t).delay}function NN(e,t){return function(){St(this,e).duration=+t.apply(this,arguments)}}function $N(e,t){return t=+t,function(){St(this,e).duration=t}}function xN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?NN:$N)(t,e)):_t(this.node(),t).duration}function IN(e,t){if(typeof t!="function")throw new Error;return function(){St(this,e).ease=t}}function SN(e){var t=this._id;return arguments.length?this.each(IN(t,e)):_t(this.node(),t).ease}function CN(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;St(this,e).ease=o}}function RN(e){if(typeof e!="function")throw new Error;return this.each(CN(this._id,e))}function VN(e){typeof e!="function"&&(e=du(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Lt(i,this._parents,this._name,this._id)}function AN(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),h,m=0;m<u;++m)(h=c[m]||d[m])&&(f[m]=h);for(;s<i;++s)r[s]=t[s];return new Lt(r,this._parents,this._name,this._id)}function TN(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function MN(e,t,o){var i,a,l=TN(t)?Fl:St;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function BN(e,t){var o=this._id;return arguments.length<2?_t(this.node(),o).on.on(e):this.each(MN(o,e,t))}function DN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function ON(){return this.on("end.remove",DN(this._id))}function LN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Cl(e));for(var i=this._groups,a=i.length,l=new Array(a),r=0;r<a;++r)for(var s=i[r],c=s.length,d=l[r]=new Array(c),u,f,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),d[h]=f,aa(d[h],t,o,h,d,_t(u,o)));return new Lt(l,this._parents,t,o)}function PN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=cu(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),m,p=_t(u,o),g=0,b=h.length;g<b;++g)(m=h[g])&&aa(m,t,o,g,h,p);l.push(h),r.push(u)}return new Lt(l,r,t,o)}var zN=Eo.prototype.constructor;function UN(){return new zN(this._groups,this._parents)}function HN(e,t){var o,i,a;return function(){var l=Un(this,e),r=(this.style.removeProperty(e),Un(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Wu(e){return function(){this.style.removeProperty(e)}}function FN(e,t,o){var i,a=o+"",l;return function(){var r=Un(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function GN(e,t,o){var i,a,l;return function(){var r=Un(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Un(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function YN(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=St(this,e),d=c.on,u=c.value[l]==null?s||(s=Wu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function WN(e,t,o){var i=(e+="")=="transform"?Wv:Yu;return t==null?this.styleTween(e,HN(e,i)).on("end.style."+e,Wu(e)):typeof t=="function"?this.styleTween(e,GN(e,i,Gl(this,"style."+e,t))).each(YN(this._id,e)):this.styleTween(e,FN(e,i,t),o).on("end.style."+e,null)}function KN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function qN(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&KN(e,r,o)),i}return l._value=t,l}function XN(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,qN(e,t,o??""))}function jN(e){return function(){this.textContent=e}}function ZN(e){return function(){var t=e(this);this.textContent=t??""}}function JN(e){return this.tween("text",typeof e=="function"?ZN(Gl(this,"text",e)):jN(e==null?"":e+""))}function QN(e){return function(t){this.textContent=e.call(this,t)}}function e$(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&QN(a)),t}return i._value=e,i}function t$(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,e$(e))}function n$(){for(var e=this._name,t=this._id,o=Ku(),i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=_t(c,t);aa(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Lt(i,this._parents,e,o)}function o$(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(l,r){var s={value:r},c={value:function(){--a===0&&l()}};o.each(function(){var d=St(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&l()})}var i$=0;function Lt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Ku(){return++i$}var Pt=Eo.prototype;Lt.prototype={constructor:Lt,select:LN,selectAll:PN,selectChild:Pt.selectChild,selectChildren:Pt.selectChildren,filter:VN,merge:AN,selection:UN,transition:n$,call:Pt.call,nodes:Pt.nodes,node:Pt.node,size:Pt.size,empty:Pt.empty,each:Pt.each,on:BN,attr:hN,attrTween:kN,style:WN,styleTween:XN,text:JN,textTween:t$,remove:ON,tween:sN,delay:vN,duration:xN,ease:SN,easeVarying:RN,end:o$,[Symbol.iterator]:Pt[Symbol.iterator]};function a$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var l$={time:null,delay:0,duration:250,ease:a$};function r$(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function s$(e){var t,o;e instanceof Lt?(t=e._id,e=e._name):(t=Ku(),(o=l$).time=Pl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&aa(c,e,t,d,r,o||r$(c,t));return new Lt(i,this._parents,e,t)}Eo.prototype.interrupt=aN,Eo.prototype.transition=s$;const ra=e=>()=>e;function c$(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function zt(e,t,o){this.k=e,this.x=t,this.y=o}zt.prototype={constructor:zt,scale:function(e){return e===1?this:new zt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new zt(this.k,this.x+this.k*e,this.y+this.k*t)},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 Yl=new zt(1,0,0);zt.prototype;function Wl(e){e.stopImmediatePropagation()}function Vo(e){e.preventDefault(),e.stopImmediatePropagation()}function d$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function u$(){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 qu(){return this.__zoom||Yl}function f$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function m$(){return navigator.maxTouchPoints||"ontouchstart"in this}function p$(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],l=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),r>l?(l+r)/2:Math.min(0,l)||Math.max(0,r))}function h$(){var e=d$,t=u$,o=p$,i=f$,a=m$,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Zv,d=Il("start","zoom","end"),u,f,h,m=500,p=150,g=0,b=10;function _(k){k.property("__zoom",qu).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",ce).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,Y,S,F){var U=k.selection?k.selection():k;U.property("__zoom",qu),k!==U?ee(k,Y,S,F):U.interrupt().each(function(){x(this,arguments).event(F).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},_.scaleBy=function(k,Y,S,F){_.scaleTo(k,function(){var U=this.__zoom.k,le=typeof Y=="function"?Y.apply(this,arguments):Y;return U*le},S,F)},_.scaleTo=function(k,Y,S,F){_.transform(k,function(){var U=t.apply(this,arguments),le=this.__zoom,E=S==null?v(U):typeof S=="function"?S.apply(this,arguments):S,K=le.invert(E),re=typeof Y=="function"?Y.apply(this,arguments):Y;return o(y(V(le,re),E,K),U,r)},S,F)},_.translateBy=function(k,Y,S,F){_.transform(k,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),r)},null,F)},_.translateTo=function(k,Y,S,F,U){_.transform(k,function(){var le=t.apply(this,arguments),E=this.__zoom,K=F==null?v(le):typeof F=="function"?F.apply(this,arguments):F;return o(Yl.translate(K[0],K[1]).scale(E.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),le,r)},F,U)};function V(k,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===k.k?k:new zt(Y,k.x,k.y)}function y(k,Y,S){var F=Y[0]-S[0]*k.k,U=Y[1]-S[1]*k.k;return F===k.x&&U===k.y?k:new zt(k.k,F,U)}function v(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function ee(k,Y,S,F){k.on("start.zoom",function(){x(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(F).end()}).tween("zoom",function(){var U=this,le=arguments,E=x(U,le).event(F),K=t.apply(U,le),re=S==null?v(K):typeof S=="function"?S.apply(U,le):S,pe=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),ye=U.__zoom,ue=typeof Y=="function"?Y.apply(U,le):Y,fe=c(ye.invert(re).concat(pe/ye.k),ue.invert(re).concat(pe/ue.k));return function(ge){if(ge===1)ge=ue;else{var Ee=fe(ge),Re=pe/Ee[2];ge=new zt(Re,re[0]-Ee[0]*Re,re[1]-Ee[1]*Re)}E.zoom(null,ge)}})}function x(k,Y,S){return!S&&k.__zooming||new O(k,Y)}function O(k,Y){this.that=k,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,Y),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,Y){return this.mouse&&k!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var Y=qt(this.that).datum();d.call(k,this.that,new c$(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),Y)}};function P(k,...Y){if(!e.apply(this,arguments))return;var S=x(this,Y).event(k),F=this.__zoom,U=Math.max(l[0],Math.min(l[1],F.k*Math.pow(2,i.apply(this,arguments)))),le=Xt(k);if(S.wheel)(S.mouse[0][0]!==le[0]||S.mouse[0][1]!==le[1])&&(S.mouse[1]=F.invert(S.mouse[0]=le)),clearTimeout(S.wheel);else{if(F.k===U)return;S.mouse=[le,F.invert(le)],la(this),S.start()}Vo(k),S.wheel=setTimeout(E,p),S.zoom("mouse",o(y(V(F,U),S.mouse[0],S.mouse[1]),S.extent,r));function E(){S.wheel=null,S.end()}}function H(k,...Y){if(h||!e.apply(this,arguments))return;var S=k.currentTarget,F=x(this,Y,!0).event(k),U=qt(k.view).on("mousemove.zoom",re,!0).on("mouseup.zoom",pe,!0),le=Xt(k,S),E=k.clientX,K=k.clientY;Nv(k.view),Wl(k),F.mouse=[le,this.__zoom.invert(le)],la(this),F.start();function re(ye){if(Vo(ye),!F.moved){var ue=ye.clientX-E,fe=ye.clientY-K;F.moved=ue*ue+fe*fe>g}F.event(ye).zoom("mouse",o(y(F.that.__zoom,F.mouse[0]=Xt(ye,S),F.mouse[1]),F.extent,r))}function pe(ye){U.on("mousemove.zoom mouseup.zoom",null),$v(ye.view,F.moved),Vo(ye),F.event(ye).end()}}function ne(k,...Y){if(e.apply(this,arguments)){var S=this.__zoom,F=Xt(k.changedTouches?k.changedTouches[0]:k,this),U=S.invert(F),le=S.k*(k.shiftKey?.5:2),E=o(y(V(S,le),F,U),t.apply(this,Y),r);Vo(k),s>0?qt(this).transition().duration(s).call(ee,E,F,k):qt(this).call(_.transform,E,F,k)}}function ce(k,...Y){if(e.apply(this,arguments)){var S=k.touches,F=S.length,U=x(this,Y,k.changedTouches.length===F).event(k),le,E,K,re;for(Wl(k),E=0;E<F;++E)K=S[E],re=Xt(K,this),re=[re,this.__zoom.invert(re),K.identifier],U.touch0?!U.touch1&&U.touch0[2]!==re[2]&&(U.touch1=re,U.taps=0):(U.touch0=re,le=!0,U.taps=1+!!u);u&&(u=clearTimeout(u)),le&&(U.taps<2&&(f=re[0],u=setTimeout(function(){u=null},m)),la(this),U.start())}}function L(k,...Y){if(this.__zooming){var S=x(this,Y).event(k),F=k.changedTouches,U=F.length,le,E,K,re;for(Vo(k),le=0;le<U;++le)E=F[le],K=Xt(E,this),S.touch0&&S.touch0[2]===E.identifier?S.touch0[0]=K:S.touch1&&S.touch1[2]===E.identifier&&(S.touch1[0]=K);if(E=S.that.__zoom,S.touch1){var pe=S.touch0[0],ye=S.touch0[1],ue=S.touch1[0],fe=S.touch1[1],ge=(ge=ue[0]-pe[0])*ge+(ge=ue[1]-pe[1])*ge,Ee=(Ee=fe[0]-ye[0])*Ee+(Ee=fe[1]-ye[1])*Ee;E=V(E,Math.sqrt(ge/Ee)),K=[(pe[0]+ue[0])/2,(pe[1]+ue[1])/2],re=[(ye[0]+fe[0])/2,(ye[1]+fe[1])/2]}else if(S.touch0)K=S.touch0[0],re=S.touch0[1];else return;S.zoom("touch",o(y(E,K,re),S.extent,r))}}function oe(k,...Y){if(this.__zooming){var S=x(this,Y).event(k),F=k.changedTouches,U=F.length,le,E;for(Wl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),le=0;le<U;++le)E=F[le],S.touch0&&S.touch0[2]===E.identifier?delete S.touch0:S.touch1&&S.touch1[2]===E.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(E=Xt(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<b)){var K=qt(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:ra(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:ra(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:ra(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:ra([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),_):t},_.scaleExtent=function(k){return arguments.length?(l[0]=+k[0],l[1]=+k[1],_):[l[0],l[1]]},_.translateExtent=function(k){return arguments.length?(r[0][0]=+k[0][0],r[1][0]=+k[1][0],r[0][1]=+k[0][1],r[1][1]=+k[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(k){return arguments.length?(o=k,_):o},_.duration=function(k){return arguments.length?(s=+k,_):s},_.interpolate=function(k){return arguments.length?(c=k,_):c},_.on=function(){var k=d.on.apply(d,arguments);return k===d?_:k},_.clickDistance=function(k){return arguments.length?(g=(k=+k)*k,_):Math.sqrt(g)},_.tapDistance=function(k){return arguments.length?(b=+k,_):b},_}const Xu=Symbol("MiniMapSlots"),y$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],g$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},b$=n.defineComponent({...g$,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:t}){const o=e,i=n.inject(Xu),a=n.useAttrs(),l=n.toRef(()=>a.style??{});function r(f){t("click",f)}function s(f){t("dblclick",f)}function c(f){t("mouseenter",f)}function d(f){t("mousemove",f)}function u(f){t("mouseleave",f)}return(f,h)=>!f.hidden&&f.dimensions.width!==0&&f.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...f.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:f.id},f.$attrs,{class:["vue-flow__minimap-node",{selected:f.selected,dragging:f.dragging}],x:f.position.x,y:f.position.y,rx:f.borderRadius,ry:f.borderRadius,width:f.dimensions.width,height:f.dimensions.height,fill:f.color||l.value.background||l.value.backgroundColor,stroke:f.strokeColor,"stroke-width":f.strokeWidth,"shape-rendering":f.shapeRendering,onClick:r,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,y$))],64)):n.createCommentVNode("",!0)}}),_$=["width","height","viewBox","aria-labelledby"],k$=["id"],w$=["d","fill","stroke","stroke-width"],E$={name:"MiniMap",compatConfig:{MODE:3}},v$=n.defineComponent({...E$,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,l=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:h,d3Zoom:m,getNodesInitialized:p}=ze(),g=n.ref();n.provide(Xu,o);const b=n.toRef(()=>{var U;return e.width??((U=i.style)==null?void 0:U.width)??a}),_=n.toRef(()=>{var U;return e.height??((U=i.style)==null?void 0:U.height)??l}),V=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",y=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),v=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),ee=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),x=n.computed(()=>rl(p.value.filter(U=>!U.hidden))),O=n.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),P=n.computed(()=>p.value&&p.value.length?gb(x.value,O.value):O.value),H=n.computed(()=>{const U=P.value.width/b.value,le=P.value.height/_.value;return Math.max(U,le)}),ne=n.computed(()=>{const U=H.value*b.value,le=H.value*_.value,E=e.offsetScale*H.value;return{offset:E,x:P.value.x-(U-P.value.width)/2-E,y:P.value.y-(le-P.value.height)/2-E,width:U+E*2,height:le+E*2}}),ce=n.computed(()=>!ne.value.x||!ne.value.y?"":`
29
+ 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 Qe extends Error{constructor(t,...o){var i;super((i=td[t])==null?void 0:i.call(td,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function fl(e){return"clientX"in e}function Sb(e){return"sourceEvent"in e}function xt(e,t){const o=fl(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const ko=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Cb(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function Vi(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Rb=()=>!0;function ml(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Vb(e,t,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const l of t.values())Ii(a,xi(l))>0&&i.push(l);return i}const Ab=250;function Tb(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Vb(e,o,t+Ab);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((l=d.handleBounds)==null?void 0:l.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:p}=Bn(d,f,f.position,!0),m=Math.sqrt((h-e.x)**2+(p-e.y)**2);m>t||(m<s?(r=[{...f,x:h,y:p}],s=m):m===s&&r.push({...f,x:h,y:p}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function nd(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=Rb},u,f,h,p){const m=l==="target",b=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:_}=xt(e),V=r.elementFromPoint(y,_),g=V!=null&&V.classList.contains(`${s}-flow__handle`)?V:b,v={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const ee=od(void 0,g),x=g.getAttribute("data-nodeid"),O=g.getAttribute("data-handleid"),P=g.classList.contains("connectable"),H=g.classList.contains("connectableend");if(!x||!ee)return v;const ne={source:m?x:i,sourceHandle:m?O:a,target:m?i:x,targetHandle:m?a:O};v.connection=ne;const L=P&&H&&(o===Dt.Strict?m&&ee==="source"||!m&&ee==="target":x!==i||O!==a);v.isValid=L&&d(ne,{nodes:f,edges:u,sourceNode:h(ne.source),targetNode:h(ne.target)}),v.toHandle=id(x,ee,O,p,o,!0)}return v}function od(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Mb(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Bb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function id(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===Dt.Strict?(r=d.handleBounds)==null?void 0:r[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],f=(o?u==null?void 0:u.find(h=>h.id===o):u==null?void 0:u[0])??null;return f&&l?{...f,...Bn(d,f,f.position,!0)}:f}const pl={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top},Db=["production","prod"];function wo(e,...t){ad()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ad(){return!Db.includes(process.env.NODE_ENV||"")}function ld(e,t,o,i,a){const l=t.querySelectorAll(`.vue-flow__handle.${e}`);return l!=null&&l.length?Array.from(l).map(r=>{const s=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:e,nodeId:a,position:r.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Si(r)}}):null}function hl(e,t,o,i,a,l=!1,r){a.value=!1,e.selected?(l||e.selected&&t)&&(i([e]),n.nextTick(()=>{r.blur()})):o([e])}function Xe(e){return typeof n.unref(e)<"u"}function Ob(e,t,o,i){if(!e||!e.source||!e.target)return o(new Qe(qe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Gt(e)?a=e:a={...e,id:Pc(e)},a=Oc(a,void 0,i),gb(a,t)?!1:a}function Lb(e,t,o,i,a){if(!t.source||!t.target)return a(new Qe(qe.EDGE_INVALID,e.id)),!1;if(!o)return a(new Qe(qe.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?Pc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function rd(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!sn(r)){o(new Qe(qe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=pb(r,t(r.id),r.parentNode);r.parentNode&&(i[r.parentNode]=!0),a[l]=s}for(const l of a){const r=t(l.parentNode)||a.find(s=>s.id===l.parentNode);l.parentNode&&!r&&o(new Qe(qe.NODE_MISSING_PARENT,l.id,l.parentNode)),(l.parentNode||i[l.id])&&(i[l.id]&&(l.isParent=!0),r&&(r.isParent=!0))}return a}function sd(e,t,o,i,a,l){let r=a;const s=i.get(r)||new Map;i.set(r,s.set(o,t)),r=`${a}-${e}`;const c=i.get(r)||new Map;if(i.set(r,c.set(o,t)),l){r=`${a}-${e}-${l}`;const d=i.get(r)||new Map;i.set(r,d.set(o,t))}}function yl(e,t,o){e.clear();for(const i of o){const{source:a,target:l,sourceHandle:r=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:l,sourceHandle:r,targetHandle:s},d=`${a}-${r}--${l}-${s}`,u=`${l}-${s}--${a}-${r}`;sd("source",c,u,e,a,r),sd("target",c,d,e,l,s)}}function cd(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function gl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Gt(d)?d:Ob(d,s,a,l);if(!u)continue;const f=o(u.source),h=o(u.target);if(!f||!h){a(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Qe(qe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new Qe(qe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:h})){a(new Qe(qe.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...Oc(u,p,l),sourceNode:f,targetNode:h})}return c}const dd=Symbol("vueFlow"),ud=Symbol("nodeId"),fd=Symbol("nodeRef"),Pb=Symbol("edgeId"),zb=Symbol("edgeRef"),Ai=Symbol("slots");function md(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:l,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:h,findNode:p,multiSelectionActive:m,nodesSelectionActive:b,selectNodesOnDrag:y,removeSelectedElements:_,addSelectedNodes:V,updateNodePositions:g,emits:v}=ze(),{onStart:ee,onDrag:x,onStop:O,onClick:P,el:H,disabled:ne,id:ce,selectable:L,dragHandle:oe}=e,k=n.shallowRef(!1);let Y=[],S,F=null,U={x:void 0,y:void 0},le={x:0,y:0},E=null,K=!1,re=!1,pe=0,ye=!1;const ue=Fb(),fe=({x:j,y:W})=>{U={x:j,y:W};let w=!1;if(Y=Y.map(I=>{const C={x:j-I.distance.x,y:W-I.distance.y},{computedPosition:G}=ul(I,o.value?Vi(C,i.value):C,v.error,r.value,I.parentNode?p(I.parentNode):void 0);return w=w||I.position.x!==G.x||I.position.y!==G.y,I.position=G,I}),re=re||w,!!w&&(g(Y,!0,!0),k.value=!0,E)){const[I,C]=dl({id:ce,dragItems:Y,findNode:p});x({event:E,node:I,nodes:C})}},ge=()=>{if(!F)return;const[j,W]=Wc(le,F,u.value);if(j!==0||W!==0){const w={x:(U.x??0)-j/c.value.zoom,y:(U.y??0)-W/c.value.zoom};h({x:j,y:W})&&fe(w)}pe=requestAnimationFrame(ge)},Ee=(j,W)=>{K=!0;const w=p(ce);!y.value&&!m.value&&w&&(w.selected||_()),w&&n.toValue(L)&&y.value&&hl(w,m.value,V,_,b,!1,W);const I=ue(j.sourceEvent);if(U=I,Y=Eb(l.value,f.value,I,ce),Y.length){const[C,G]=dl({id:ce,dragItems:Y,findNode:p});ee({event:j.sourceEvent,node:C,nodes:G})}},Re=(j,W)=>{var w;j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||(re=!1,s.value===0&&Ee(j,W),U=ue(j.sourceEvent),F=((w=t.value)==null?void 0:w.getBoundingClientRect())||null,le=xt(j.sourceEvent,F))},Ie=(j,W)=>{const w=ue(j.sourceEvent);if(!ye&&K&&d.value&&(ye=!0,ge()),!K){const I=w.xSnapped-(U.x??0),C=w.ySnapped-(U.y??0);Math.sqrt(I*I+C*C)>s.value&&Ee(j,W)}(U.x!==w.xSnapped||U.y!==w.ySnapped)&&Y.length&&K&&(E=j.sourceEvent,le=xt(j.sourceEvent,F),fe(w))},he=j=>{let W=!1;if(!K&&!k.value&&!m.value){const w=j.sourceEvent,I=ue(w),C=I.xSnapped-(U.x??0),G=I.ySnapped-(U.y??0),J=Math.sqrt(C*C+G*G);J!==0&&J<=s.value&&(P==null||P(w),W=!0)}if(Y.length&&!W){re&&(g(Y,!1,!1),re=!1);const[w,I]=dl({id:ce,dragItems:Y,findNode:p});O({event:j.sourceEvent,node:w,nodes:I})}Y=[],k.value=!1,ye=!1,K=!1,U={x:void 0,y:void 0},cancelAnimationFrame(pe)};return n.watch([()=>n.toValue(ne),H],([j,W],w,I)=>{if(W){const C=ht(W);j||(S=my().on("start",G=>Re(G,W)).on("drag",G=>Ie(G,W)).on("end",G=>he(G)).filter(G=>{const J=G.target,be=n.toValue(oe);return!G.button&&(!a.value||!Jc(J,`.${a.value}`,W)&&(!be||Jc(J,be,W)))}),C.call(S)),I(()=>{C.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),k}function Ub(){return{doubleClick:xe(),click:xe(),mouseEnter:xe(),mouseMove:xe(),mouseLeave:xe(),contextMenu:xe(),updateStart:xe(),update:xe(),updateEnd:xe()}}function Hb(e,t){const o=Ub();return o.doubleClick.on(i=>{var a,l;t.edgeDoubleClick(i),(l=(a=e.events)==null?void 0:a.doubleClick)==null||l.call(a,i)}),o.click.on(i=>{var a,l;t.edgeClick(i),(l=(a=e.events)==null?void 0:a.click)==null||l.call(a,i)}),o.mouseEnter.on(i=>{var a,l;t.edgeMouseEnter(i),(l=(a=e.events)==null?void 0:a.mouseEnter)==null||l.call(a,i)}),o.mouseMove.on(i=>{var a,l;t.edgeMouseMove(i),(l=(a=e.events)==null?void 0:a.mouseMove)==null||l.call(a,i)}),o.mouseLeave.on(i=>{var a,l;t.edgeMouseLeave(i),(l=(a=e.events)==null?void 0:a.mouseLeave)==null||l.call(a,i)}),o.contextMenu.on(i=>{var a,l;t.edgeContextMenu(i),(l=(a=e.events)==null?void 0:a.contextMenu)==null||l.call(a,i)}),o.updateStart.on(i=>{var a,l;t.edgeUpdateStart(i),(l=(a=e.events)==null?void 0:a.updateStart)==null||l.call(a,i)}),o.update.on(i=>{var a,l;t.edgeUpdate(i),(l=(a=e.events)==null?void 0:a.update)==null||l.call(a,i)}),o.updateEnd.on(i=>{var a,l;t.edgeUpdateEnd(i),(l=(a=e.events)==null?void 0:a.updateEnd)==null||l.call(a,i)}),Object.entries(o).reduce((i,[a,l])=>(i.emit[a]=l.trigger,i.on[a]=l.on,i),{emit:{},on:{}})}function Fb(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=ze();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=Sb(a)?a.sourceEvent:a,{x:c,y:d}=xt(s,r),u=bo({x:c,y:d},e.value),{x:f,y:h}=o.value?Vi(u,t.value):u;return{xSnapped:f,ySnapped:h,...u}}}function Ti(){return!0}function pd({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:l,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:m,autoPanSpeed:b,findNode:y,panBy:_,startConnection:V,updateConnection:g,endConnection:v,emits:ee,viewport:x,edges:O,nodes:P,isValidConnection:H,nodeLookup:ne}=ze();let ce=null,L=!1,oe=null;function k(S){var F;const U=n.toValue(o)==="target",le=fl(S),E=Dc(S.target),K=S.currentTarget;if(K&&(le&&S.button===0||!le)){let re=function(_e){w=xt(_e,he),fe=Tb(bo(w,x.value,!1,[1,1]),u.value,ne.value,G),I||(C(),I=!0);const Ce=nd(_e,{handle:fe,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:U?"target":"source",isValidConnection:ue,doc:E,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,P.value,y,ne.value);oe=Ce.handleDomNode,ce=Ce.connection,L=Bb(!!fe,Ce.isValid);const Te={...$e,isValid:L,to:Ce.toHandle&&L?go({x:Ce.toHandle.x,y:Ce.toHandle.y},x.value):w,toHandle:Ce.toHandle,toPosition:L&&Ce.toHandle?Ce.toHandle.position:pl[G.position],toNode:Ce.toHandle?ne.value.get(Ce.toHandle.nodeId):null};if(L&&fe&&($e!=null&&$e.toHandle)&&Te.toHandle&&$e.toHandle.type===Te.toHandle.type&&$e.toHandle.nodeId===Te.toHandle.nodeId&&$e.toHandle.id===Te.toHandle.id&&$e.to.x===Te.to.x&&$e.to.y===Te.to.y)return;const Be=fe??Ce.toHandle;if(g(Be&&L?go({x:Be.x,y:Be.y},x.value):w,Be,Mb(!!Be,L)),$e=Te,!fe&&!L&&!oe)return ml(W);ce&&ce.source!==ce.target&&oe&&(ml(W),W=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!L),oe.classList.toggle("vue-flow__handle-valid",!!L))},pe=function(_e){"touches"in _e&&_e.touches.length>0||((fe||oe)&&ce&&L&&(l?l(_e,ce):ee.connect(ce)),ee.connectEnd(_e),a&&(r==null||r(_e)),ml(W),cancelAnimationFrame(ge),v(_e),I=!1,L=!1,ce=null,oe=null,E.removeEventListener("mousemove",re),E.removeEventListener("mouseup",pe),E.removeEventListener("touchmove",re),E.removeEventListener("touchend",pe))};const ye=y(n.toValue(t));let ue=n.toValue(i)||H.value||Ti;!ue&&ye&&(ue=(U?ye.isValidSourcePos:ye.isValidTargetPos)||Ti);let fe,ge=0;const{x:Ee,y:Re}=xt(S),Ie=od(n.toValue(a),K),he=(F=c.value)==null?void 0:F.getBoundingClientRect();if(!he||!Ie)return;const j=id(n.toValue(t),Ie,n.toValue(e),ne.value,d.value);if(!j)return;let W,w=xt(S,he),I=!1;const C=()=>{if(!m.value)return;const[_e,Ce]=Wc(w,he,b.value);_({x:_e,y:Ce}),ge=requestAnimationFrame(C)},G={...j,nodeId:n.toValue(t),type:Ie,position:j.position},J=ne.value.get(n.toValue(t)),we={inProgress:!0,isValid:null,from:Bn(J,G,Se.Left,!0),fromHandle:G,fromPosition:G.position,fromNode:J,to:w,toHandle:null,toPosition:pl[G.position],toNode:null};V({nodeId:n.toValue(t),id:n.toValue(e),type:Ie,position:(K==null?void 0:K.getAttribute("data-handlepos"))||Se.Top,...w},{x:Ee-he.left,y:Re-he.top}),ee.connectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ie});let $e=we;E.addEventListener("mousemove",re),E.addEventListener("mouseup",pe),E.addEventListener("touchmove",re),E.addEventListener("touchend",pe)}}function Y(S){var F,U;if(!f.value)return;const le=n.toValue(o)==="target";if(!h.value){ee.clickConnectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e)}),V({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Se.Top,...xt(S)},void 0,!0);return}let E=n.toValue(i)||H.value||Ti;const K=y(n.toValue(t));if(!E&&K&&(E=(le?K.isValidSourcePos:K.isValidTargetPos)||Ti),K&&(typeof K.connectable>"u"?p.value:K.connectable)===!1)return;const re=Dc(S.target),pe=nd(S,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Se.Top,...xt(S)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:E,doc:re,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,P.value,y,ne.value),ye=((F=pe.connection)==null?void 0:F.source)===((U=pe.connection)==null?void 0:U.target);pe.isValid&&pe.connection&&!ye&&ee.connect(pe.connection),ee.clickConnectEnd(S),v(S,!0)}return{handlePointerDown:k,handleClick:Y}}function Gb(){return n.inject(ud,"")}function hd(e){const t=e??Gb()??"",o=n.inject(fd,n.ref(null)),{findNode:i,edges:a,emits:l}=ze(),r=i(t);return r||l.error(new Qe(qe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>cn([r],a.value))}}function Yb(){return{doubleClick:xe(),click:xe(),mouseEnter:xe(),mouseMove:xe(),mouseLeave:xe(),contextMenu:xe(),dragStart:xe(),drag:xe(),dragStop:xe()}}function Wb(e,t){const o=Yb();return o.doubleClick.on(i=>{var a,l;t.nodeDoubleClick(i),(l=(a=e.events)==null?void 0:a.doubleClick)==null||l.call(a,i)}),o.click.on(i=>{var a,l;t.nodeClick(i),(l=(a=e.events)==null?void 0:a.click)==null||l.call(a,i)}),o.mouseEnter.on(i=>{var a,l;t.nodeMouseEnter(i),(l=(a=e.events)==null?void 0:a.mouseEnter)==null||l.call(a,i)}),o.mouseMove.on(i=>{var a,l;t.nodeMouseMove(i),(l=(a=e.events)==null?void 0:a.mouseMove)==null||l.call(a,i)}),o.mouseLeave.on(i=>{var a,l;t.nodeMouseLeave(i),(l=(a=e.events)==null?void 0:a.mouseLeave)==null||l.call(a,i)}),o.contextMenu.on(i=>{var a,l;t.nodeContextMenu(i),(l=(a=e.events)==null?void 0:a.contextMenu)==null||l.call(a,i)}),o.dragStart.on(i=>{var a,l;t.nodeDragStart(i),(l=(a=e.events)==null?void 0:a.dragStart)==null||l.call(a,i)}),o.drag.on(i=>{var a,l;t.nodeDrag(i),(l=(a=e.events)==null?void 0:a.drag)==null||l.call(a,i)}),o.dragStop.on(i=>{var a,l;t.nodeDragStop(i),(l=(a=e.events)==null?void 0:a.dragStop)==null||l.call(a,i)}),Object.entries(o).reduce((i,[a,l])=>(i.emit[a]=l.trigger,i.on[a]=l.on,i),{emit:{},on:{}})}function yd(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=ze();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,h=d?4:1,p=c.x*u*h,m=c.y*f*h,b=[];for(const y of e.value)if(y.draggable||r&&typeof y.draggable>"u"){const _={x:y.computedPosition.x+p,y:y.computedPosition.y+m},{position:V}=ul(y,_,s.error,t.value,y.parentNode?i(y.parentNode):void 0);b.push({id:y.id,position:V,from:y.position,distance:{x:c.x,y:c.y},dimensions:y.dimensions})}o(b,!0,!1)}}const Mi=.1,Kb=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kt(){return wo("Viewport not initialized yet."),Promise.resolve(!1)}const qb={zoomIn:Kt,zoomOut:Kt,zoomTo:Kt,fitView:Kt,setCenter:Kt,fitBounds:Kt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Kt,setTransform:Kt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Xb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ro:yi).scaleBy(bl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{l(!0)}),i):l(!1)})}function o(i,a,l,r){return new Promise(s=>{var c;const{x:d,y:u}=Bc({x:-i,y:-a},e.translateExtent),f=An.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?ro:yi).transform(bl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{s(!0)}),f):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>t(1.2,a),zoomOut:a=>t(1/1.2,a),zoomTo:(a,l)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((l==null?void 0:l.interpolate)==="linear"?ro:yi).scaleTo(bl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{r(!0)}),a):r(!1)}),setViewport:(a,l)=>o(a.x,a.y,a.zoom,l),setTransform:(a,l)=>o(a.x,a.y,a.zoom,l),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:(a={padding:Mi,includeHiddenNodes:!1,duration:0})=>{var l,r;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!h.hidden)&&(!((l=a.nodes)!=null&&l.length)||(r=a.nodes)!=null&&r.length&&a.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const c=rl(s),{x:d,y:u,zoom:f}=Fc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Mi);return o(d,u,f,a)},setCenter:(a,l,r)=>{const s=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-l*s;return o(c,d,s,r)},fitBounds:(a,l={padding:Mi})=>{const{x:r,y:s,zoom:c}=Fc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Mi);return o(r,s,c,l)},project:a=>bo(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:l,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-l,y:a.y-r};return bo(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:l,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+l,y:a.y+r};return go(s,e.viewport)}return{x:0,y:0}}}:qb)}function bl(e,t=0,o=Kb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function jb(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,y,_=!!(o.nodes.value.length||o.edges.value.length);b=In([e.modelValue,()=>{var V,g;return(g=(V=e.modelValue)==null?void 0:V.value)==null?void 0:g.length}],([V])=>{V&&Array.isArray(V)&&(y==null||y.pause(),o.setElements(V),!y&&!_&&V.length?_=!0:y==null||y.resume())}),y=In([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([V,g])=>{var v;(v=e.modelValue)!=null&&v.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...V,...g],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),y==null||y.stop()})})},l=()=>{i.run(()=>{let b,y,_=!!o.nodes.value.length;b=In([e.nodes,()=>{var V,g;return(g=(V=e.nodes)==null?void 0:V.value)==null?void 0:g.length}],([V])=>{V&&Array.isArray(V)&&(y==null||y.pause(),o.setNodes(V),!y&&!_&&V.length?_=!0:y==null||y.resume())}),y=In([o.nodes,()=>o.nodes.value.length],([V])=>{var g;(g=e.nodes)!=null&&g.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...V],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),y==null||y.stop()})})},r=()=>{i.run(()=>{let b,y,_=!!o.edges.value.length;b=In([e.edges,()=>{var V,g;return(g=(V=e.edges)==null?void 0:V.value)==null?void 0:g.length}],([V])=>{V&&Array.isArray(V)&&(y==null||y.pause(),o.setEdges(V),!y&&!_&&V.length?_=!0:y==null||y.resume())}),y=In([o.edges,()=>o.edges.value.length],([V])=>{var g;(g=e.edges)!=null&&g.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...V],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),y==null||y.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&Xe(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&Xe(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&Xe(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&Xe(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{Xe(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const b=async y=>{let _=y;typeof t.autoConnect=="function"&&(_=await t.autoConnect(y)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{Xe(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(y,_,V)=>{y?o.onConnect(b):o.hooks.value.connect.off(b),V(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},p=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const y of Object.keys(t)){const _=y;if(!b.includes(_)){const V=n.toRef(()=>t[_]),g=o[_];n.isRef(g)&&i.run(()=>{n.watch(V,v=>{Xe(v)&&(g.value=v)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),h(),p()})()}),()=>i.stop()}function Zb(){return{edgesChange:xe(),nodesChange:xe(),nodeDoubleClick:xe(),nodeClick:xe(),nodeMouseEnter:xe(),nodeMouseMove:xe(),nodeMouseLeave:xe(),nodeContextMenu:xe(),nodeDragStart:xe(),nodeDrag:xe(),nodeDragStop:xe(),nodesInitialized:xe(),miniMapNodeClick:xe(),miniMapNodeDoubleClick:xe(),miniMapNodeMouseEnter:xe(),miniMapNodeMouseMove:xe(),miniMapNodeMouseLeave:xe(),connect:xe(),connectStart:xe(),connectEnd:xe(),clickConnectStart:xe(),clickConnectEnd:xe(),paneReady:xe(),init:xe(),move:xe(),moveStart:xe(),moveEnd:xe(),selectionDragStart:xe(),selectionDrag:xe(),selectionDragStop:xe(),selectionContextMenu:xe(),selectionStart:xe(),selectionEnd:xe(),viewportChangeStart:xe(),viewportChange:xe(),viewportChangeEnd:xe(),paneScroll:xe(),paneClick:xe(),paneContextMenu:xe(),paneMouseEnter:xe(),paneMouseMove:xe(),paneMouseLeave:xe(),edgeContextMenu:xe(),edgeMouseEnter:xe(),edgeMouseMove:xe(),edgeMouseLeave:xe(),edgeDoubleClick:xe(),edgeClick:xe(),edgeUpdateStart:xe(),edgeUpdate:xe(),edgeUpdateEnd:xe(),updateNodeInternals:xe(),error:xe(e=>wo(e.message))}}function Jb(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[a,l]of Object.entries(t.value)){const r=s=>{e(a,s)};l.setEmitter(r),to(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),to(l.removeHasEmitListeners)}});function i(a){var l;const r=Qb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function Qb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function gd(){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:il.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:po.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:ln.Bezier,style:{}},connectionMode:Dt.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:ko()?"Meta":"Control",zoomActivationKeyCode:ko()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Zb(),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 e0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function t0(e,t,o){const i=Xb(e),a=w=>{const I=w??[];e.hooks.updateNodeInternals.trigger(I)},l=w=>yb(w,e.nodes,e.edges),r=w=>hb(w,e.nodes,e.edges),s=w=>cn(w,e.edges),c=({id:w,type:I,nodeId:C})=>{var G;const J=w?`-${I}-${w}`:`-${I}`;return Array.from(((G=e.connectionLookup.get(`${C}${J}`))==null?void 0:G.values())??[])},d=w=>{if(w)return t.value.get(w)},u=w=>{if(w)return o.value.get(w)},f=(w,I,C)=>{var G,J;const be=[];for(const we of w){const $e={id:we.id,type:"position",dragging:C,from:we.from};if(I&&($e.position=we.position,we.parentNode)){const _e=d(we.parentNode);$e.position={x:$e.position.x-(((G=_e==null?void 0:_e.computedPosition)==null?void 0:G.x)??0),y:$e.position.y-(((J=_e==null?void 0:_e.computedPosition)==null?void 0:J.y)??0)}}be.push($e)}be!=null&&be.length&&e.hooks.nodesChange.trigger(be)},h=w=>{if(!e.vueFlowRef)return;const I=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!I)return;const C=window.getComputedStyle(I),{m22:G}=new window.DOMMatrixReadOnly(C.transform),J=[];for(const be of w){const we=be,$e=d(we.id);if($e){const _e=Si(we.nodeElement);if(!!(_e.width&&_e.height&&($e.dimensions.width!==_e.width||$e.dimensions.height!==_e.height||we.forceUpdate))){const Te=we.nodeElement.getBoundingClientRect();$e.dimensions=_e,$e.handleBounds.source=ld("source",we.nodeElement,Te,G,$e.id),$e.handleBounds.target=ld("target",we.nodeElement,Te,G,$e.id),J.push({id:$e.id,type:"dimensions",dimensions:_e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),J.length&&e.hooks.nodesChange.trigger(J)},p=(w,I)=>{const C=new Set,G=new Set;for(const we of w)sn(we)?C.add(we.id):Gt(we)&&G.add(we.id);const J=Wt(t.value,C,!0),be=Wt(o.value,G);if(e.multiSelectionActive){for(const we of C)J.push(Yt(we,I));for(const we of G)be.push(Yt(we,I))}J.length&&e.hooks.nodesChange.trigger(J),be.length&&e.hooks.edgesChange.trigger(be)},m=w=>{if(e.multiSelectionActive){const I=w.map(C=>Yt(C.id,!0));e.hooks.nodesChange.trigger(I);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(w.map(I=>I.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},b=w=>{if(e.multiSelectionActive){const I=w.map(C=>Yt(C.id,!0));e.hooks.edgesChange.trigger(I);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(w.map(I=>I.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},y=w=>{p(w,!0)},_=w=>{const C=(w||e.nodes).map(G=>(G.selected=!1,Yt(G.id,!1)));e.hooks.nodesChange.trigger(C)},V=w=>{const C=(w||e.edges).map(G=>(G.selected=!1,Yt(G.id,!1)));e.hooks.edgesChange.trigger(C)},g=w=>{if(!w||!w.length)return p([],!1);const I=w.reduce((C,G)=>{const J=Yt(G.id,!1);return sn(G)?C.nodes.push(J):C.edges.push(J),C},{nodes:[],edges:[]});I.nodes.length&&e.hooks.nodesChange.trigger(I.nodes),I.edges.length&&e.hooks.edgesChange.trigger(I.edges)},v=w=>{var I;(I=e.d3Zoom)==null||I.scaleExtent([w,e.maxZoom]),e.minZoom=w},ee=w=>{var I;(I=e.d3Zoom)==null||I.scaleExtent([e.minZoom,w]),e.maxZoom=w},x=w=>{var I;(I=e.d3Zoom)==null||I.translateExtent(w),e.translateExtent=w},O=w=>{e.nodeExtent=w,a()},P=w=>{var I;(I=e.d3Zoom)==null||I.clickDistance(w)},H=w=>{e.nodesDraggable=w,e.nodesConnectable=w,e.elementsSelectable=w},ne=w=>{const I=w instanceof Function?w(e.nodes):w;!e.initialized&&!I.length||(e.nodes=rd(I,d,e.hooks.error.trigger))},ce=w=>{const I=w instanceof Function?w(e.edges):w;if(!e.initialized&&!I.length)return;const C=gl(I,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);yl(e.connectionLookup,o.value,C),e.edges=C},L=w=>{const I=w instanceof Function?w([...e.nodes,...e.edges]):w;!e.initialized&&!I.length||(ne(I.filter(sn)),ce(I.filter(Gt)))},oe=w=>{let I=w instanceof Function?w(e.nodes):w;I=Array.isArray(I)?I:[I];const C=rd(I,d,e.hooks.error.trigger),G=[];for(const J of C)G.push(qc(J));G.length&&e.hooks.nodesChange.trigger(G)},k=w=>{let I=w instanceof Function?w(e.edges):w;I=Array.isArray(I)?I:[I];const C=gl(I,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),G=[];for(const J of C)G.push(qc(J));G.length&&e.hooks.edgesChange.trigger(G)},Y=(w,I=!0,C=!1)=>{const G=w instanceof Function?w(e.nodes):w,J=Array.isArray(G)?G:[G],be=[],we=[];function $e(Ce){const Te=s(Ce);for(const Be of Te)(!Xe(Be.deletable)||Be.deletable)&&we.push(jc(Be.id,Be.source,Be.target,Be.sourceHandle,Be.targetHandle))}function _e(Ce){const Te=[];for(const Be of e.nodes)Be.parentNode===Ce&&Te.push(Be);if(Te.length){for(const Be of Te)be.push(Xc(Be.id));I&&$e(Te);for(const Be of Te)_e(Be.id)}}for(const Ce of J){const Te=typeof Ce=="string"?d(Ce):Ce;Te&&(Xe(Te.deletable)&&!Te.deletable||(be.push(Xc(Te.id)),I&&$e([Te]),C&&_e(Te.id)))}we.length&&e.hooks.edgesChange.trigger(we),be.length&&e.hooks.nodesChange.trigger(be)},S=w=>{const I=w instanceof Function?w(e.edges):w,C=Array.isArray(I)?I:[I],G=[];for(const J of C){const be=typeof J=="string"?u(J):J;be&&(Xe(be.deletable)&&!be.deletable||G.push(jc(typeof J=="string"?J:J.id,be.source,be.target,be.sourceHandle,be.targetHandle)))}e.hooks.edgesChange.trigger(G)},F=(w,I,C=!0)=>{const G=u(w.id);if(!G)return!1;const J=e.edges.indexOf(G),be=Lb(w,I,G,C,e.hooks.error.trigger);if(be){const[we]=gl([be],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map(($e,_e)=>_e===J?we:$e),yl(e.connectionLookup,o.value,[we]),we}return!1},U=(w,I,C={replace:!1})=>{const G=u(w);if(!G)return;const J=typeof I=="function"?I(G):I;G.data=C.replace?J:{...G.data,...J}},le=w=>Kc(w,e.nodes),E=w=>{const I=Kc(w,e.edges);return yl(e.connectionLookup,o.value,I),I},K=(w,I,C={replace:!1})=>{const G=d(w);if(!G)return;const J=typeof I=="function"?I(G):I;C.replace?e.nodes.splice(e.nodes.indexOf(G),1,J):Object.assign(G,J)},re=(w,I,C={replace:!1})=>{const G=d(w);if(!G)return;const J=typeof I=="function"?I(G):I;G.data=C.replace?J:{...G.data,...J}},pe=(w,I,C=!1)=>{C?e.connectionClickStartHandle=w:e.connectionStartHandle=w,e.connectionEndHandle=null,e.connectionStatus=null,I&&(e.connectionPosition=I)},ye=(w,I=null,C=null)=>{e.connectionStartHandle&&(e.connectionPosition=w,e.connectionEndHandle=I,e.connectionStatus=C)},ue=(w,I)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,I?e.connectionClickStartHandle=null:e.connectionStartHandle=null},fe=w=>{const I=mb(w),C=I?null:yo(w)?w:d(w.id);return!I&&!C?[null,null,I]:[I?w:xi(C),C,I]},ge=(w,I=!0,C=e.nodes)=>{const[G,J,be]=fe(w);if(!G)return[];const we=[];for(const $e of C||e.nodes){if(!be&&($e.id===J.id||!$e.computedPosition))continue;const _e=xi($e),Ce=Ii(_e,G);(I&&Ce>0||Ce>=_e.width*_e.height||Ce>=Number(G.width)*Number(G.height))&&we.push($e)}return we},Ee=(w,I,C=!0)=>{const[G]=fe(w);if(!G)return!1;const J=Ii(G,I);return C&&J>0||J>=Number(G.width)*Number(G.height)},Re=w=>{const{viewport:I,dimensions:C,d3Zoom:G,d3Selection:J,translateExtent:be}=e;if(!G||!J||!w.x&&!w.y)return!1;const we=An.translate(I.x+w.x,I.y+w.y).scale(I.zoom),$e=[[0,0],[C.width,C.height]],_e=G.constrain()(we,$e,be),Ce=e.viewport.x!==_e.x||e.viewport.y!==_e.y||e.viewport.zoom!==_e.k;return G.transform(J,_e),Ce},Ie=w=>{const I=w instanceof Function?w(e):w,C=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(I.defaultEdgeOptions)&&(e.defaultEdgeOptions=I.defaultEdgeOptions);const G=I.modelValue||I.nodes||I.edges?[]:void 0;G&&(I.modelValue&&G.push(...I.modelValue),I.nodes&&G.push(...I.nodes),I.edges&&G.push(...I.edges),L(G));const J=()=>{Xe(I.maxZoom)&&ee(I.maxZoom),Xe(I.minZoom)&&v(I.minZoom),Xe(I.translateExtent)&&x(I.translateExtent)};for(const be of Object.keys(I)){const we=be,$e=I[we];![...e0,...C].includes(we)&&Xe($e)&&(e[we]=$e)}Oa(()=>e.d3Zoom).not.toBeNull().then(J),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:L,setNodes:ne,setEdges:ce,addNodes:oe,addEdges:k,removeNodes:Y,removeEdges:S,findNode:d,findEdge:u,updateEdge:F,updateEdgeData:U,updateNode:K,updateNodeData:re,applyEdgeChanges:E,applyNodeChanges:le,addSelectedElements:y,addSelectedNodes:m,addSelectedEdges:b,setMinZoom:v,setMaxZoom:ee,setTranslateExtent:x,setNodeExtent:O,setPaneClickDistance:P,removeSelectedElements:g,removeSelectedNodes:_,removeSelectedEdges:V,startConnection:pe,updateConnection:ye,endConnection:ue,setInteractive:H,setState:Ie,getIntersectingNodes:ge,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ee,panBy:Re,fitView:w=>i.value.fitView(w),zoomIn:w=>i.value.zoomIn(w),zoomOut:w=>i.value.zoomOut(w),zoomTo:(w,I)=>i.value.zoomTo(w,I),setViewport:(w,I)=>i.value.setViewport(w,I),setTransform:(w,I)=>i.value.setTransform(w,I),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(w,I,C)=>i.value.setCenter(w,I,C),fitBounds:(w,I)=>i.value.fitBounds(w,I),project:w=>i.value.project(w),screenToFlowCoordinate:w=>i.value.screenToFlowCoordinate(w),flowToScreenCoordinate:w=>i.value.flowToScreenCoordinate(w),toObject:()=>{const w=[],I=[];for(const C of e.nodes){const{computedPosition:G,handleBounds:J,selected:be,dimensions:we,isParent:$e,resizing:_e,dragging:Ce,events:Te,...Be}=C;w.push(Be)}for(const C of e.edges){const{selected:G,sourceNode:J,targetNode:be,events:we,...$e}=C;I.push($e)}return JSON.parse(JSON.stringify({nodes:w,edges:I,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:w=>new Promise(I=>{const{nodes:C,edges:G,position:J,zoom:be,viewport:we}=w;C&&ne(C),G&&ce(G);const[$e,_e]=we!=null&&we.x&&(we!=null&&we.y)?[we.x,we.y]:J??[null,null];if($e&&_e){const Ce=(we==null?void 0:we.zoom)||be||e.viewport.zoom;return Oa(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:$e,y:_e,zoom:Ce}).then(()=>{I(!0)})})}else I(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const w=gd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const I=An.translate(w.defaultViewport.x??0,w.defaultViewport.y??0).scale(rn(w.defaultViewport.zoom??1,w.minZoom,w.maxZoom)),C=e.viewportRef.getBoundingClientRect(),G=[[0,0],[C.width,C.height]],J=e.d3Zoom.constrain()(I,G,w.translateExtent);e.d3Zoom.transform(e.d3Selection,J)}Ie(w)},$destroy:()=>{}}}const n0=["data-id","data-handleid","data-nodeid","data-handlepos"],o0={name:"Handle",compatConfig:{MODE:3}},dn=n.defineComponent({...o0,props:{id:{default:null},type:{},position:{default:()=>Se.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:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),a=n.toRef(()=>o.isValidConnection??null),{id:l,connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:f,noPanClassName:h}=ze(),{id:p,node:m,nodeEl:b,connectedEdges:y}=hd(),_=n.ref(),V=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),g=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),v=n.toRef(()=>{var ce,L,oe,k,Y,S;return((ce=r.value)==null?void 0:ce.nodeId)===p&&((L=r.value)==null?void 0:L.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===p&&((Y=c.value)==null?void 0:Y.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),ee=n.toRef(()=>{var ce,L,oe;return((ce=s.value)==null?void 0:ce.nodeId)===p&&((L=s.value)==null?void 0:L.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:x,handleClick:O}=pd({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),P=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!y.value.some(ce=>{const L=ce[`${i.value}Handle`];return ce[i.value]!==p?!1:L?L===e.id:!0}):typeof e.connectable=="number"?y.value.filter(ce=>{const L=ce[`${i.value}Handle`];return ce[i.value]!==p?!1:L?L===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(m,y.value):Xe(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var ce;if(!m.dimensions.width||!m.dimensions.height)return;const L=(ce=m.handleBounds[i.value])==null?void 0:ce.find(le=>le.id===e.id);if(!d.value||L)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!_.value||!oe||!e.id)return;const k=b.value.getBoundingClientRect(),Y=_.value.getBoundingClientRect(),S=window.getComputedStyle(oe),{m22:F}=new window.DOMMatrixReadOnly(S.transform),U={id:e.id,position:e.position,x:(Y.left-k.left)/F,y:(Y.top-k.top)/F,type:i.value,nodeId:p,...Si(_.value)};m.handleBounds[i.value]=[...m.handleBounds[i.value]??[],U]});function H(ce){const L=fl(ce);P.value&&V.value&&(L&&ce.button===0||!L)&&x(ce)}function ne(ce){!p||!s.value&&!V.value||P.value&&O(ce)}return t({handleClick:O,handlePointerDown:x,onClick:ne,onPointerDown:H}),(ce,L)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${n.unref(l)}-${n.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(p),"data-handlepos":ce.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${ce.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(h),i.value,{connectable:P.value,connecting:ee.value,connectablestart:V.value,connectableend:g.value,connectionindicator:P.value&&(V.value&&!v.value||g.value&&v.value)}]]),onMousedown:H,onTouchstartPassive:H,onClick:ne},[n.renderSlot(ce.$slots,"default",{id:ce.id})],42,n0))}}),Bi=function({sourcePosition:e=Se.Bottom,targetPosition:t=Se.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(dn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(dn,{type:"source",position:e,connectable:i,isValidConnection:l})]};Bi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Bi.inheritAttrs=!1,Bi.compatConfig={MODE:3};const i0=Bi,Di=function({targetPosition:e=Se.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(dn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Di.props=["targetPosition","label","isValidTargetPos","connectable","data"],Di.inheritAttrs=!1,Di.compatConfig={MODE:3};const a0=Di,Oi=function({sourcePosition:e=Se.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:a}){const l=a.label??t;return[typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l]),n.h(dn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Oi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Oi.inheritAttrs=!1,Oi.compatConfig={MODE:3};const l0=Oi,r0=["transform"],s0=["width","height","x","y","rx","ry"],c0=["y"],d0={name:"EdgeText",compatConfig:{MODE:3}},u0=n.defineComponent({...d0,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(a),n.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const l=o.value.getBBox();(l.width!==t.value.width||l.height!==t.value.height)&&(t.value=l)}return(l,r)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[l.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*l.labelBgPadding[0]}px`,height:`${t.value.height+2*l.labelBgPadding[1]}px`,x:-l.labelBgPadding[0],y:-l.labelBgPadding[1],style:n.normalizeStyle(l.labelBgStyle),rx:l.labelBgBorderRadius,ry:l.labelBgBorderRadius},null,12,s0)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(l.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:l.labelStyle}),[n.renderSlot(l.$slots,"default",{},()=>[typeof l.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(l.label),1)],64))])],16,c0)],8,r0))}}),f0=["id","d","marker-end","marker-start"],m0=["d","stroke-width"],p0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Li=n.defineComponent({...p0,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),a=n.ref(null),l=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:a}),(r,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(l),{id:r.id,ref_key:"pathEl",ref:o,d:r.path,class:"vue-flow__edge-path","marker-end":r.markerEnd,"marker-start":r.markerStart}),null,16,f0),r.interactionWidth?(n.openBlock(),n.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:r.path,"stroke-width":r.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,m0)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(u0,{key:1,ref_key:"labelEl",ref:a,x:r.labelX,y:r.labelY,label:r.label,"label-show-bg":r.labelShowBg,"label-bg-style":r.labelBgStyle,"label-bg-padding":r.labelBgPadding,"label-bg-border-radius":r.labelBgBorderRadius,"label-style":r.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):n.createCommentVNode("",!0)],64))}});function bd({sourceX:e,sourceY:t,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,l=o<e?o+a:o-a,r=Math.abs(i-t)/2,s=i<t?i+r:i-r;return[l,s,a,r]}function _d({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:r,targetControlY:s}){const c=e*.125+a*.375+r*.375+o*.125,d=t*.125+l*.375+s*.375+i*.125,u=Math.abs(c-e),f=Math.abs(d-t);return[c,d,u,f]}function Pi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function kd({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Se.Left:r=t-Pi(t-i,l),s=o;break;case Se.Right:r=t+Pi(i-t,l),s=o;break;case Se.Top:r=t,s=o-Pi(o-a,l);break;case Se.Bottom:r=t,s=o+Pi(a-o,l);break}return[r,s]}function wd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,curvature:s=.25}=e,[c,d]=kd({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=kd({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[h,p,m,b]=_d({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${a},${l}`,h,p,m,b]}function Ed({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case Se.Left:case Se.Right:l=.5*(t+i),r=o;break;case Se.Top:case Se.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function vd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top}=e,[s,c]=Ed({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=Ed({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,h,p,m]=_d({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${l}`,f,h,p,m]}const Nd={[Se.Left]:{x:-1,y:0},[Se.Right]:{x:1,y:0},[Se.Top]:{x:0,y:-1},[Se.Bottom]:{x:0,y:1}};function h0({source:e,sourcePosition:t=Se.Bottom,target:o}){return t===Se.Left||t===Se.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 $d(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function y0({source:e,sourcePosition:t=Se.Bottom,target:o,targetPosition:i=Se.Top,center:a,offset:l}){const r=Nd[t],s=Nd[i],c={x:e.x+r.x*l,y:e.y+r.y*l},d={x:o.x+s.x*l,y:o.y+s.y*l},u=h0({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let p,m,b;const y={x:0,y:0},_={x:0,y:0},[V,g,v,ee]=bd({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){m=a.x??V,b=a.y??g;const O=[{x:m,y:c.y},{x:m,y:d.y}],P=[{x:c.x,y:b},{x:d.x,y:b}];r[f]===h?p=f==="x"?O:P:p=f==="x"?P:O}else{const O=[{x:c.x,y:d.y}],P=[{x:d.x,y:c.y}];if(f==="x"?p=r.x===h?P:O:p=r.y===h?O:P,t===i){const oe=Math.abs(e[f]-o[f]);if(oe<=l){const k=Math.min(l-1,l-oe);r[f]===h?y[f]=(c[f]>e[f]?-1:1)*k:_[f]=(d[f]>o[f]?-1:1)*k}}if(t!==i){const oe=f==="x"?"y":"x",k=r[f]===s[oe],Y=c[oe]>d[oe],S=c[oe]<d[oe];(r[f]===1&&(!k&&Y||k&&S)||r[f]!==1&&(!k&&S||k&&Y))&&(p=f==="x"?O:P)}const H={x:c.x+y.x,y:c.y+y.y},ne={x:d.x+_.x,y:d.y+_.y},ce=Math.max(Math.abs(H.x-p[0].x),Math.abs(ne.x-p[0].x)),L=Math.max(Math.abs(H.y-p[0].y),Math.abs(ne.y-p[0].y));ce>=L?(m=(H.x+ne.x)/2,b=p[0].y):(m=p[0].x,b=(H.y+ne.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...p,{x:d.x+_.x,y:d.y+_.y},o],m,b,v,ee]}function g0(e,t,o,i){const a=Math.min($d(e,t)/2,$d(t,o)/2,i),{x:l,y:r}=t;if(e.x===l&&l===o.x||e.y===r&&r===o.y)return`L${l} ${r}`;if(e.y===r){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${l+a*d},${r}Q ${l},${r} ${l},${r+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${l},${r+a*c}Q ${l},${r} ${l+a*s},${r}`}function _l(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,h,p,m,b]=y0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((_,V,g)=>{let v;return g>0&&g<f.length-1?v=g0(f[g-1],V,f[g+1],s):v=`${g===0?"M":"L"}${V.x} ${V.y}`,_+=v,_},""),h,p,m,b]}function b0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=bd({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const _0=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=b0(e);return n.h(Li,{path:o,labelX:i,labelY:a,...t,...e})}}}),xd=n.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:t}){return()=>{const[o,i,a]=_l({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Li,{path:o,labelX:i,labelY:a,...t,...e})}}}),k0=n.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>n.h(xd,{...e,...t,borderRadius:0})}}),w0=n.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:t}){return()=>{const[o,i,a]=wd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Li,{path:o,labelX:i,labelY:a,...t,...e})}}}),E0=n.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:t}){return()=>{const[o,i,a]=vd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Li,{path:o,labelX:i,labelY:a,...t,...e})}}}),v0={input:l0,default:i0,output:a0},N0={default:w0,straight:_0,step:k0,smoothstep:xd,simplebezier:E0};function $0(e,t,o){const i=n.computed(()=>b=>t.value.get(b)),a=n.computed(()=>b=>o.value.get(b)),l=n.computed(()=>{const b={...N0,...e.edgeTypes},y=Object.keys(b);for(const _ of e.edges)_.type&&!y.includes(_.type)&&(b[_.type]=_.type);return b}),r=n.computed(()=>{const b={...v0,...e.nodeTypes},y=Object.keys(b);for(const _ of e.nodes)_.type&&!y.includes(_.type)&&(b[_.type]=_.type);return b}),s=n.computed(()=>e.onlyRenderVisibleElements?Hc(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const y of e.edges){const _=t.value.get(y.source),V=t.value.get(y.target);xb({sourcePos:_.computedPosition||{x:0,y:0},targetPos:V.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:V.dimensions.width,targetHeight:V.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(y)}return b}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const b=[];for(const y of e.nodes)y.selected&&b.push(y);return b}),f=n.computed(()=>{const b=[];for(const y of e.edges)y.selected&&b.push(y);return b}),h=n.computed(()=>[...u.value,...f.value]),p=n.computed(()=>{const b=[];for(const y of e.nodes)y.dimensions.width&&y.dimensions.height&&y.handleBounds!==void 0&&b.push(y);return b}),m=n.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:l,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:m}}class un{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??un.instance;return un.instance=i??new un,o&&(o.config.globalProperties.$vueFlowStorage=un.instance),un.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=gd(),a=n.reactive(i),l={};for(const[h,p]of Object.entries(a.hooks)){const m=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;l[m]=p.on}const r={};for(const[h,p]of Object.entries(a.hooks))r[h]=p.trigger;const s=n.computed(()=>{const h=new Map;for(const p of a.nodes)h.set(p.id,p);return h}),c=n.computed(()=>{const h=new Map;for(const p of a.edges)h.set(p.id,p);return h}),d=$0(a,s,c),u=t0(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...Ep(a),nodeLookup:s,edgeLookup:c,emits:r,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function ze(e){const t=un.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},l=a.id,r=l??(o==null?void 0:o.vueFlowId);let s;if(o){const c=n.inject(dd,null);typeof c<"u"&&c!==null&&(!r||c.id===r)&&(s=c)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const c=l??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,h,p)=>{const m=y=>{d.applyNodeChanges(y)},b=y=>{d.applyEdgeChanges(y)};f?(d.onNodesChange(m),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(m),d.hooks.value.edgesChange.off(b)),p(()=>{d.hooks.value.nodesChange.off(m),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),to(()=>{if(s){const f=t.get(s.id);f?f.$destroy():wo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(dd,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Qe(qe.USEVUEFLOW_OPTIONS))}return s}function x0(e){const{emits:t,dimensions:o}=ze();let i;n.onMounted(()=>{const a=()=>{var l,r;if(!e.value||!(((r=(l=e.value).checkVisibility)==null?void 0:r.call(l))??!0))return;const s=Si(e.value);(s.width===0||s.height===0)&&t.error(new Qe(qe.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const I0={name:"UserSelection",compatConfig:{MODE:3}},S0=n.defineComponent({...I0,props:{userSelectionRect:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:n.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),C0=["tabIndex"],R0={name:"NodesSelection",compatConfig:{MODE:3}},V0=n.defineComponent({...R0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=ze(),s=yd(),c=n.ref(null),d=md({el:c,onStart(m){t.selectionDragStart(m),t.nodeDragStart(m)},onDrag(m){t.selectionDrag(m),t.nodeDrag(m)},onStop(m){t.selectionDragStop(m),t.nodeDragStop(m)}});n.onMounted(()=>{var m;l.value||(m=c.value)==null||m.focus({preventScroll:!0})});const u=n.computed(()=>rl(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(m){t.selectionContextMenu({event:m,nodes:i.value})}function p(m){l.value||Tn[m.key]&&(m.preventDefault(),s({x:Tn[m.key].x,y:Tn[m.key].y},m.shiftKey))}return(m,b)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(l)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,C0)],6)):n.createCommentVNode("",!0)}});function A0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const T0={name:"Pane",compatConfig:{MODE:3}},M0=n.defineComponent({...T0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:l,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:h,removeEdges:p,selectionMode:m,deleteKeyCode:b,multiSelectionKeyCode:y,multiSelectionActive:_,edgeLookup:V,nodeLookup:g,connectionLookup:v,defaultEdgeOptions:ee,connectionStartHandle:x,panOnDrag:O}=ze(),P=n.shallowRef(null),H=n.shallowRef(new Set),ne=n.shallowRef(new Set),ce=n.shallowRef(null),L=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>x.value!==null);let k=!1,Y=!1;const S=ho(b,{actInsideInputWithModifier:!1}),F=ho(y);n.watch(S,ue=>{ue&&(h(f.value),p(u.value),d.value=!1)}),n.watch(F,ue=>{_.value=ue});function U(ue,fe){return ge=>{ge.target===fe&&(ue==null||ue(ge))}}function le(ue){if(k||oe.value){k=!1;return}a.paneClick(ue),r(),d.value=!1}function E(ue){var fe;if(Array.isArray(O.value)&&((fe=O.value)!=null&&fe.includes(2))){ue.preventDefault();return}a.paneContextMenu(ue)}function K(ue){a.paneScroll(ue)}function re(ue){var fe,ge,Ee;if(ce.value=((fe=t.value)==null?void 0:fe.getBoundingClientRect())??null,!c.value||!e.isSelecting||ue.button!==0||ue.target!==P.value||!ce.value)return;(Ee=(ge=ue.target)==null?void 0:ge.setPointerCapture)==null||Ee.call(ge,ue.pointerId);const{x:Re,y:Ie}=A0(ue,ce.value);Y=!0,k=!1,r(),s.value={width:0,height:0,startX:Re,startY:Ie,x:Re,y:Ie},a.selectionStart(ue)}function pe(ue){var fe;if(!ce.value||!s.value)return;k=!0;const{x:ge,y:Ee}=xt(ue,ce.value),{startX:Re=0,startY:Ie=0}=s.value,he={startX:Re,startY:Ie,x:ge<Re?ge:Re,y:Ee<Ie?Ee:Ie,width:Math.abs(ge-Re),height:Math.abs(Ee-Ie)},j=H.value,W=ne.value;H.value=new Set(Hc(o.value,he,i.value,m.value===il.Partial,!0).map(I=>I.id)),ne.value=new Set;const w=((fe=ee.value)==null?void 0:fe.selectable)??!0;for(const I of H.value){const C=v.value.get(I);if(C)for(const{edgeId:G}of C.values()){const J=V.value.get(G);J&&(J.selectable??w)&&ne.value.add(G)}}if(!cd(j,H.value)){const I=Wt(g.value,H.value,!0);a.nodesChange(I)}if(!cd(W,ne.value)){const I=Wt(V.value,ne.value);a.edgesChange(I)}s.value=he,l.value=!0,d.value=!1}function ye(ue){var fe;ue.button!==0||!Y||((fe=ue.target)==null||fe.releasePointerCapture(ue.pointerId),!l.value&&s.value&&ue.target===P.value&&le(ue),l.value=!1,s.value=null,d.value=H.value.size>0,a.selectionEnd(ue),e.selectionKeyPressed&&(k=!1),Y=!1)}return(ue,fe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:P,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:ue.isSelecting}]),onClick:fe[0]||(fe[0]=ge=>L.value?void 0:U(le,P.value)(ge)),onContextmenu:fe[1]||(fe[1]=ge=>U(E,P.value)(ge)),onWheelPassive:fe[2]||(fe[2]=ge=>U(K,P.value)(ge)),onPointerenter:fe[3]||(fe[3]=ge=>L.value?void 0:n.unref(a).paneMouseEnter(ge)),onPointerdown:fe[4]||(fe[4]=ge=>L.value?re(ge):n.unref(a).paneMouseMove(ge)),onPointermove:fe[5]||(fe[5]=ge=>L.value?pe(ge):n.unref(a).paneMouseMove(ge)),onPointerup:fe[6]||(fe[6]=ge=>L.value?ye(ge):void 0),onPointerleave:fe[7]||(fe[7]=ge=>n.unref(a).paneMouseLeave(ge))},[n.renderSlot(ue.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(S0,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(d)&&n.unref(f).length?(n.openBlock(),n.createBlock(V0,{key:1})):n.createCommentVNode("",!0)],34))}}),B0={name:"Transform",compatConfig:{MODE:3}},D0=n.defineComponent({...B0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=ze(),a=n.computed(()=>o.value?!i.value:!1),l=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(r,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:l.value,opacity:a.value?0:void 0})},[n.renderSlot(r.$slots,"default")],4))}}),O0={name:"Viewport",compatConfig:{MODE:3}},L0=n.defineComponent({...O0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:l,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:m,preventScrolling:b,noWheelClassName:y,noPanClassName:_,emits:V,connectionStartHandle:g,userSelectionActive:v,paneDragging:ee,d3Zoom:x,d3Selection:O,d3ZoomHandler:P,viewport:H,viewportRef:ne,paneClickDistance:ce}=ze();x0(ne);const L=n.shallowRef(!1),oe=n.shallowRef(!1);let k=null,Y=!1,S=0,F={x:0,y:0,zoom:0};const U=ho(s),le=ho(r),E=ho(l),K=n.toRef(()=>(!le.value||le.value&&r.value===!0)&&(U.value||f.value)),re=n.toRef(()=>U.value||c.value),pe=n.toRef(()=>r.value===!0&&K.value!==!0),ye=n.toRef(()=>le.value&&r.value!==!0||v.value||pe.value),ue=n.toRef(()=>g.value!==null);n.onMounted(()=>{if(!ne.value){wo("Viewport element is missing");return}const Ie=ne.value,he=Ie.getBoundingClientRect(),j=lb().clickDistance(ce.value).scaleExtent([t.value,o.value]).translateExtent(a.value),W=ht(Ie).call(j),w=W.on("wheel.zoom"),I=An.translate(i.value.x??0,i.value.y??0).scale(rn(i.value.zoom??1,t.value,o.value)),C=[[0,0],[he.width,he.height]],G=j.constrain()(I,C,a.value);j.transform(W,G),j.wheelDelta(sl),x.value=j,O.value=W,P.value=w,H.value={x:G.x,y:G.y,zoom:G.k},j.on("start",J=>{var be;if(!J.sourceEvent)return null;S=J.sourceEvent.button,L.value=!0;const we=Ee(J.transform);((be=J.sourceEvent)==null?void 0:be.type)==="mousedown"&&(ee.value=!0),F=we,V.viewportChangeStart(we),V.moveStart({event:J,flowTransform:we})}),j.on("end",J=>{if(!J.sourceEvent)return null;if(L.value=!1,ee.value=!1,fe(K.value,S??0)&&!Y&&V.paneContextMenu(J.sourceEvent),Y=!1,ge(F,J.transform)){const be=Ee(J.transform);F=be,V.viewportChangeEnd(be),V.moveEnd({event:J,flowTransform:be})}}),j.filter(J=>{var be;const we=E.value||m.value,$e=p.value&&J.ctrlKey,_e=J.button,Ce=J.type==="wheel";if(_e===1&&J.type==="mousedown"&&(Re(J,"vue-flow__node")||Re(J,"vue-flow__edge")))return!0;if(!K.value&&!we&&!re.value&&!h.value&&!p.value||v.value||ue.value&&!Ce||!h.value&&J.type==="dblclick"||Re(J,y.value)&&Ce||Re(J,_.value)&&(!Ce||re.value&&Ce&&!E.value)||!p.value&&J.ctrlKey&&Ce||!we&&!re.value&&!$e&&Ce)return!1;if(!p&&J.type==="touchstart"&&((be=J.touches)==null?void 0:be.length)>1)return J.preventDefault(),!1;if(!K.value&&(J.type==="mousedown"||J.type==="touchstart")||pe.value&&Array.isArray(f.value)&&f.value.includes(0)&&_e===0||Array.isArray(f.value)&&!f.value.includes(_e)&&(J.type==="mousedown"||J.type==="touchstart"))return!1;const Te=Array.isArray(f.value)&&f.value.includes(_e)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!_e||_e<=1;return(!J.ctrlKey||U.value||Ce)&&Te}),n.watch([v,K],()=>{v.value&&!L.value?j.on("zoom",null):v.value||j.on("zoom",J=>{H.value={x:J.transform.x,y:J.transform.y,zoom:J.transform.k};const be=Ee(J.transform);Y=fe(K.value,S??0),V.viewportChange(be),V.move({event:J,flowTransform:be})})},{immediate:!0}),n.watch([v,re,d,E,p,b,y],()=>{re.value&&!E.value&&!v.value?W.on("wheel.zoom",J=>{if(Re(J,y.value))return!1;const be=E.value||m.value,we=p.value&&J.ctrlKey;if(!(!b.value||re.value||be||we))return!1;J.preventDefault(),J.stopImmediatePropagation();const _e=W.property("__zoom").k||1,Ce=ko();if(!U.value&&J.ctrlKey&&p.value&&Ce){const ae=Et(J),T=sl(J),z=_e*2**T;j.scaleTo(W,z,ae,J);return}const Te=J.deltaMode===1?20:1;let Be=d.value===po.Vertical?0:J.deltaX*Te,N=d.value===po.Horizontal?0:J.deltaY*Te;!Ce&&J.shiftKey&&d.value!==po.Vertical&&!Be&&N&&(Be=N,N=0),j.translateBy(W,-(Be/_e)*u.value,-(N/_e)*u.value);const A=Ee(W.property("__zoom"));k&&clearTimeout(k),oe.value?(V.move({event:J,flowTransform:A}),V.viewportChange(A),k=setTimeout(()=>{V.moveEnd({event:J,flowTransform:A}),V.viewportChangeEnd(A),oe.value=!1},150)):(oe.value=!0,V.moveStart({event:J,flowTransform:A}),V.viewportChangeStart(A))},{passive:!1}):typeof w<"u"&&W.on("wheel.zoom",function(J,be){const we=!b.value&&J.type==="wheel"&&!J.ctrlKey,$e=E.value||m.value,_e=p.value&&J.ctrlKey;if(!$e&&!c.value&&!_e&&J.type==="wheel"||we||Re(J,y.value))return null;J.preventDefault(),w.call(this,J,be)},{passive:!1})},{immediate:!0})});function fe(Ie,he){return he===2&&Array.isArray(Ie)&&Ie.includes(2)}function ge(Ie,he){return Ie.x!==he.x&&!Number.isNaN(he.x)||Ie.y!==he.y&&!Number.isNaN(he.y)||Ie.zoom!==he.k&&!Number.isNaN(he.k)}function Ee(Ie){return{x:Ie.x,y:Ie.y,zoom:Ie.k}}function Re(Ie,he){return Ie.target.closest(`.${he}`)}return(Ie,he)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:ne,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(M0,{"is-selecting":ye.value,"selection-key-pressed":n.unref(le),class:n.normalizeClass({connecting:ue.value,dragging:n.unref(ee),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(D0,null,{default:n.withCtx(()=>[n.renderSlot(Ie.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),P0=["id"],z0=["id"],U0=["id"],H0={name:"A11yDescriptions",compatConfig:{MODE:3}},F0=n.defineComponent({...H0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=ze();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Ac)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.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,P0),n.createElementVNode("div",{id:`${n.unref(Tc)}-${n.unref(t)}`,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,z0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(fb)}-${n.unref(t)}`,"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%)"}},n.toDisplayString(n.unref(i)),9,U0))],64))}});function G0(){const e=ze();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Y0(e,t,o){return o===Se.Left?e-t:o===Se.Right?e+t:e}function W0(e,t,o){return o===Se.Top?e-t:o===Se.Bottom?e+t:e}const kl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Se.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:Y0(t,e,i),cy:W0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};kl.props=["radius","centerX","centerY","position","type"],kl.compatConfig={MODE:3};const Id=kl,K0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:l,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:m,elementsSelectable:b,edgesUpdatable:y,edgesFocusable:_,hooks:V}=ze(),g=n.computed(()=>u(e.id)),{emit:v,on:ee}=Hb(g.value,l),x=n.inject(Ai),O=n.getCurrentInstance(),P=n.ref(!1),H=n.ref(!1),ne=n.ref(""),ce=n.ref(null),L=n.ref("source"),oe=n.ref(null),k=n.toRef(()=>typeof g.value.selectable>"u"?b.value:g.value.selectable),Y=n.toRef(()=>typeof g.value.updatable>"u"?y.value:g.value.updatable),S=n.toRef(()=>typeof g.value.focusable>"u"?_.value:g.value.focusable);n.provide(Pb,e.id),n.provide(zb,oe);const F=n.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),U=n.computed(()=>g.value.style instanceof Function?g.value.style(g.value):g.value.style),le=n.computed(()=>{const I=g.value.type||"default",C=x==null?void 0:x[`edge-${I}`];if(C)return C;let G=g.value.template??c.value[I];if(typeof G=="string"&&O){const J=Object.keys(O.appContext.components);J&&J.includes(I)&&(G=n.resolveComponent(I,!1))}return G&&typeof G!="string"?G:(l.error(new Qe(qe.EDGE_TYPE_MISSING,G)),!1)}),{handlePointerDown:E}=pd({nodeId:ne,handleId:ce,type:L,isValidConnection:h,edgeUpdaterType:L,onEdgeUpdate:pe,onEdgeUpdateEnd:ye});return()=>{const I=f(g.value.source),C=f(g.value.target),G="pathOptions"in g.value?g.value.pathOptions:{};if(!I&&!C)return l.error(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,g.value.id,g.value.source,g.value.target)),null;if(!I)return l.error(new Qe(qe.EDGE_SOURCE_MISSING,g.value.id,g.value.source)),null;if(!C)return l.error(new Qe(qe.EDGE_TARGET_MISSING,g.value.id,g.value.target)),null;if(!g.value||g.value.hidden||I.hidden||C.hidden)return null;let J;i.value===Dt.Strict?J=I.handleBounds.source:J=[...I.handleBounds.source||[],...I.handleBounds.target||[]];const be=ed(J,g.value.sourceHandle);let we;i.value===Dt.Strict?we=C.handleBounds.target:we=[...C.handleBounds.target||[],...C.handleBounds.source||[]];const $e=ed(we,g.value.targetHandle),_e=(be==null?void 0:be.position)||Se.Bottom,Ce=($e==null?void 0:$e.position)||Se.Top,{x:Te,y:Be}=Bn(I,be,_e),{x:N,y:A}=Bn(C,$e,Ce);return g.value.sourceX=Te,g.value.sourceY=Be,g.value.targetX=N,g.value.targetY=A,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${le.value===!1?"default":g.value.type||"default"}`,s.value,F.value,{updating:P.value,selected:g.value.selected,animated:g.value.animated,inactive:!k.value&&!V.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":g.value.ariaLabel===null?void 0:g.value.ariaLabel??`Edge from ${g.value.source} to ${g.value.target}`,"aria-describedby":S.value?`${Tc}-${t}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",...g.value.domAttributes,onClick:fe,onContextmenu:ge,onDblclick:Ee,onMouseenter:Re,onMousemove:Ie,onMouseleave:he,onKeyDown:S.value?w:void 0},[H.value?null:n.h(le.value===!1?c.value.default:le.value,{id:e.id,sourceNode:I,targetNode:C,source:g.value.source,target:g.value.target,type:g.value.type,updatable:Y.value,selected:g.value.selected,animated:g.value.animated,label:g.value.label,labelStyle:g.value.labelStyle,labelShowBg:g.value.labelShowBg,labelBgStyle:g.value.labelBgStyle,labelBgPadding:g.value.labelBgPadding,labelBgBorderRadius:g.value.labelBgBorderRadius,data:g.value.data,events:{...g.value.events,...ee},style:U.value,markerStart:`url('#${_o(g.value.markerStart,t)}')`,markerEnd:`url('#${_o(g.value.markerEnd,t)}')`,sourcePosition:_e,targetPosition:Ce,sourceX:Te,sourceY:Be,targetX:N,targetY:A,sourceHandleId:g.value.sourceHandle,targetHandleId:g.value.targetHandle,interactionWidth:g.value.interactionWidth,...G}),[Y.value==="source"||Y.value===!0?[n.h("g",{onMousedown:j,onMouseenter:K,onMouseout:re},n.h(Id,{position:_e,centerX:Te,centerY:Be,radius:a.value,type:"source","data-type":"source"}))]:null,Y.value==="target"||Y.value===!0?[n.h("g",{onMousedown:W,onMouseenter:K,onMouseout:re},n.h(Id,{position:Ce,centerX:N,centerY:A,radius:a.value,type:"target","data-type":"target"}))]:null]])};function K(){P.value=!0}function re(){P.value=!1}function pe(I,C){v.update({event:I,edge:g.value,connection:C})}function ye(I){v.updateEnd({event:I,edge:g.value}),H.value=!1}function ue(I,C){I.button===0&&(H.value=!0,ne.value=C?g.value.target:g.value.source,ce.value=(C?g.value.targetHandle:g.value.sourceHandle)??null,L.value=C?"target":"source",v.updateStart({event:I,edge:g.value}),E(I))}function fe(I){var C;const G={event:I,edge:g.value};k.value&&(r.value=!1,g.value.selected&&p.value?(d([g.value]),(C=oe.value)==null||C.blur()):o([g.value])),v.click(G)}function ge(I){v.contextMenu({event:I,edge:g.value})}function Ee(I){v.doubleClick({event:I,edge:g.value})}function Re(I){v.mouseEnter({event:I,edge:g.value})}function Ie(I){v.mouseMove({event:I,edge:g.value})}function he(I){v.mouseLeave({event:I,edge:g.value})}function j(I){ue(I,!0)}function W(I){ue(I,!1)}function w(I){var C;!m.value&&Mc.includes(I.key)&&k.value&&(I.key==="Escape"?((C=oe.value)==null||C.blur(),d([u(e.id)])):o([u(e.id)]))}}}),q0=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:l,connectionLineType:r,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:f}=ze(),h=(e=n.inject(Ai))==null?void 0:e["connection-line"],p=n.computed(()=>{var V;return f((V=i.value)==null?void 0:V.nodeId)}),m=n.computed(()=>{var V;return f((V=a.value)==null?void 0:V.nodeId)??null}),b=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),y=n.computed(()=>c.value.markerStart?`url(#${_o(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${_o(c.value.markerEnd,t)})`:"");return()=>{var V,g,v;if(!p.value||!i.value)return null;const ee=i.value.id,x=i.value.type,O=p.value.handleBounds;let P=(O==null?void 0:O[x])??[];if(o.value===Dt.Loose){const U=(O==null?void 0:O[x==="source"?"target":"source"])??[];P=[...P,...U]}if(!P)return null;const H=(ee?P.find(U=>U.id===ee):P[0])??null,ne=(H==null?void 0:H.position)??Se.Top,{x:ce,y:L}=Bn(p.value,H,ne);let oe=null;m.value&&(o.value===Dt.Strict?oe=((V=m.value.handleBounds[x==="source"?"target":"source"])==null?void 0:V.find(U=>{var le;return U.id===((le=a.value)==null?void 0:le.id)}))||null:oe=((g=[...m.value.handleBounds.source??[],...m.value.handleBounds.target??[]])==null?void 0:g.find(U=>{var le;return U.id===((le=a.value)==null?void 0:le.id)}))||null);const k=((v=a.value)==null?void 0:v.position)??(ne?pl[ne]:null);if(!ne||!k)return null;const Y=r.value??c.value.type??ln.Bezier;let S="";const F={sourceX:ce,sourceY:L,sourcePosition:ne,targetX:b.value.x,targetY:b.value.y,targetPosition:k};return Y===ln.Bezier?[S]=wd(F):Y===ln.Step?[S]=_l({...F,borderRadius:0}):Y===ln.SmoothStep?[S]=_l(F):Y===ln.SimpleBezier?[S]=vd(F):S=`M${ce},${L} ${b.value.x},${b.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},h?n.h(h,{sourceX:ce,sourceY:L,sourcePosition:ne,targetX:b.value.x,targetY:b.value.y,targetPosition:k,sourceNode:p.value,sourceHandle:H,targetNode:m.value,targetHandle:oe,markerEnd:_.value,markerStart:y.value,connectionStatus:d.value}):n.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":y.value})))}}}),X0=["id","markerWidth","markerHeight","markerUnits","orient"],j0={name:"MarkerType",compatConfig:{MODE:3}},Z0=n.defineComponent({...j0,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(t,o)=>(n.openBlock(),n.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===n.unref(al).ArrowClosed?(n.openBlock(),n.createElementBlock("polyline",{key:0,style:n.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):n.createCommentVNode("",!0),t.type===n.unref(al).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,X0))}}),J0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Q0={name:"MarkerDefinitions",compatConfig:{MODE:3}},e1=n.defineComponent({...Q0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=ze(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=_o(d,t);r.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),r.add(u))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const u of[d.markerStart,d.markerEnd])c(u);return s.sort((d,u)=>d.id.localeCompare(u.id))});return(r,s)=>(n.openBlock(),n.createElementBlock("svg",J0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(Z0,{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))])]))}}),t1={name:"Edges",compatConfig:{MODE:3}},n1=n.defineComponent({...t1,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=ze();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(e1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),r=>(n.openBlock(),n.createElementBlock("svg",{key:r.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(Ib)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(K0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(q0))],64))}}),o1=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:l,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:m,ariaLiveMessage:b,snapToGrid:y,snapGrid:_,nodeDragThreshold:V,nodesDraggable:g,elementsSelectable:v,nodesConnectable:ee,nodesFocusable:x,hooks:O}=ze(),P=n.ref(null);n.provide(fd,P),n.provide(ud,e.id);const H=n.inject(Ai),ne=n.getCurrentInstance(),ce=yd(),{node:L,parentNode:oe}=hd(e.id),{emit:k,on:Y}=Wb(L,r),S=n.toRef(()=>typeof L.draggable>"u"?g.value:L.draggable),F=n.toRef(()=>typeof L.selectable>"u"?v.value:L.selectable),U=n.toRef(()=>typeof L.connectable>"u"?ee.value:L.connectable),le=n.toRef(()=>typeof L.focusable>"u"?x.value:L.focusable),E=n.computed(()=>F.value||S.value||O.value.nodeClick.hasListeners()||O.value.nodeDoubleClick.hasListeners()||O.value.nodeMouseEnter.hasListeners()||O.value.nodeMouseMove.hasListeners()||O.value.nodeMouseLeave.hasListeners()),K=n.toRef(()=>!!L.dimensions.width&&!!L.dimensions.height),re=n.computed(()=>{const C=L.type||"default",G=H==null?void 0:H[`node-${C}`];if(G)return G;let J=L.template||f.value[C];if(typeof J=="string"&&ne){const be=Object.keys(ne.appContext.components);be&&be.includes(C)&&(J=n.resolveComponent(C,!1))}return J&&typeof J!="string"?J:(r.error(new Qe(qe.NODE_TYPE_MISSING,J)),!1)}),pe=md({id:e.id,el:P,disabled:()=>!S.value,selectable:F,dragHandle:()=>L.dragHandle,onStart(C){k.dragStart(C)},onDrag(C){k.drag(C)},onStop(C){k.dragStop(C)},onClick(C){w(C)}}),ye=n.computed(()=>L.class instanceof Function?L.class(L):L.class),ue=n.computed(()=>{const C=(L.style instanceof Function?L.style(L):L.style)||{},G=L.width instanceof Function?L.width(L):L.width,J=L.height instanceof Function?L.height(L):L.height;return!C.width&&G&&(C.width=typeof G=="string"?G:`${G}px`),!C.height&&J&&(C.height=typeof J=="string"?J:`${J}px`),C}),fe=n.toRef(()=>Number(L.zIndex??ue.value.zIndex??0));return u(C=>{(C.includes(e.id)||!C.length)&&Ee()}),n.onMounted(()=>{n.watch(()=>L.hidden,(C=!1,G,J)=>{!C&&P.value&&(e.resizeObserver.observe(P.value),J(()=>{P.value&&e.resizeObserver.unobserve(P.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>L.type,()=>L.sourcePosition,()=>L.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:P.value,forceUpdate:!0}])})}),n.watch([()=>L.position.x,()=>L.position.y,()=>{var C;return(C=oe.value)==null?void 0:C.computedPosition.x},()=>{var C;return(C=oe.value)==null?void 0:C.computedPosition.y},()=>{var C;return(C=oe.value)==null?void 0:C.computedPosition.z},fe,()=>L.selected,()=>L.dimensions.height,()=>L.dimensions.width,()=>{var C;return(C=oe.value)==null?void 0:C.dimensions.height},()=>{var C;return(C=oe.value)==null?void 0:C.dimensions.width}],([C,G,J,be,we,$e])=>{const _e={x:C,y:G,z:$e+(p.value&&L.selected?1e3:0)};typeof J<"u"&&typeof be<"u"?L.computedPosition=wb({x:J,y:be,z:we},_e):L.computedPosition=_e},{flush:"post",immediate:!0}),n.watch([()=>L.extent,h],([C,G],[J,be])=>{(C!==J||G!==be)&&ge()}),L.extent==="parent"||typeof L.extent=="object"&&"range"in L.extent&&L.extent.range==="parent"?Oa(()=>K).toBe(!0).then(ge):ge(),()=>L.hidden?null:n.h("div",{ref:P,"data-id":L.id,class:["vue-flow__node",`vue-flow__node-${re.value===!1?"default":L.type||"default"}`,{[o.value]:S.value,dragging:pe==null?void 0:pe.value,draggable:S.value,selected:L.selected,selectable:F.value,parent:L.isParent},ye.value],style:{visibility:K.value?"visible":"hidden",zIndex:L.computedPosition.z??fe.value,transform:`translate(${L.computedPosition.x}px,${L.computedPosition.y}px)`,pointerEvents:E.value?"all":"none",...ue.value},tabIndex:le.value?0:void 0,role:le.value?"group":void 0,"aria-describedby":m.value?void 0:`${Ac}-${t}`,"aria-label":L.ariaLabel,"aria-roledescription":"node",...L.domAttributes,onMouseenter:Re,onMousemove:Ie,onMouseleave:he,onContextmenu:j,onClick:w,onDblclick:W,onKeydown:I},[n.h(re.value===!1?f.value.default:re.value,{id:L.id,type:L.type,data:L.data,events:{...L.events,...Y},selected:L.selected,resizing:L.resizing,dragging:pe.value,connectable:U.value,position:L.computedPosition,dimensions:L.dimensions,isValidTargetPos:L.isValidTargetPos,isValidSourcePos:L.isValidSourcePos,parent:L.parentNode,parentNodeId:L.parentNode,zIndex:L.computedPosition.z??fe.value,targetPosition:L.targetPosition,sourcePosition:L.sourcePosition,label:L.label,dragHandle:L.dragHandle,onUpdateNodeInternals:Ee})]);function ge(){const C=L.computedPosition,{computedPosition:G,position:J}=ul(L,y.value?Vi(C,_.value):C,r.error,h.value,oe.value);(L.computedPosition.x!==G.x||L.computedPosition.y!==G.y)&&(L.computedPosition={...L.computedPosition,...G}),(L.position.x!==J.x||L.position.y!==J.y)&&(L.position=J)}function Ee(){P.value&&d([{id:e.id,nodeElement:P.value,forceUpdate:!0}])}function Re(C){pe!=null&&pe.value||k.mouseEnter({event:C,node:L})}function Ie(C){pe!=null&&pe.value||k.mouseMove({event:C,node:L})}function he(C){pe!=null&&pe.value||k.mouseLeave({event:C,node:L})}function j(C){return k.contextMenu({event:C,node:L})}function W(C){return k.doubleClick({event:C,node:L})}function w(C){F.value&&(!i.value||!S.value||V.value>0)&&hl(L,l.value,c,s,a,!1,P.value),k.click({event:C,node:L})}function I(C){if(!(ll(C)||m.value))if(Mc.includes(C.key)&&F.value){const G=C.key==="Escape";hl(L,l.value,c,s,a,G,P.value)}else S.value&&L.selected&&Tn[C.key]&&(C.preventDefault(),b.value=`Moved selected node ${C.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~L.position.x}, y: ${~~L.position.y}`,ce({x:Tn[C.key].x,y:Tn[C.key].y},C.shiftKey))}}});function i1(e={includeHiddenNodes:!1}){const{nodes:t}=ze();return n.computed(()=>{if(t.value.length===0)return!1;for(const o of t.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 a1={class:"vue-flow__nodes vue-flow__container"},l1={name:"Nodes",compatConfig:{MODE:3}},r1=n.defineComponent({...l1,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=ze(),a=i1(),l=n.ref();return n.watch(a,r=>{r&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{l.value=new ResizeObserver(r=>{const s=r.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var r;return(r=l.value)==null?void 0:r.disconnect()}),(r,s)=>(n.openBlock(),n.createElementBlock("div",a1,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const h=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,h))return f;const p=(n.openBlock(),n.createBlock(n.unref(o1),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return p.memo=h,p},s,0),128)):n.createCommentVNode("",!0)]))}});function s1(){const{emits:e}=ze();n.onMounted(()=>{if(ad()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Qe(qe.MISSING_STYLES))}})}const c1=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),d1={name:"VueFlow",compatConfig:{MODE:3}},u1=n.defineComponent({...d1,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:t,emit:o}){const i=e,a=n.useSlots(),l=La(i,"modelValue",o),r=La(i,"nodes",o),s=La(i,"edges",o),c=ze(i),d=jb({modelValue:l,nodes:r,edges:s},i,c);return Jb(o,c.hooks),G0(),s1(),n.provide(Ai,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(L0,null,{default:n.withCtx(()=>[n.createVNode(n1),c1,n.createVNode(r1),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(F0)],512))}}),f1={name:"Panel",compatConfig:{MODE:3}},Sd=n.defineComponent({...f1,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=ze(),i=n.computed(()=>`${t.position}`.split("-"));return(a,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(a.$slots,"default")],6))}}),fn=["red","amber","green","teal","blue","indigo","violet","pink"],Cd={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function m1(e){return typeof e=="string"&&e in Cd}const p1={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},h1=.15;function y1(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,l=parseInt(o.slice(4,6),16)/255,r=Math.max(i,a,l),s=Math.min(i,a,l),c=r-s,d=(r+s)/2;let u=0,f=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),r===i?f=(a-l)/c%6:r===a?f=(l-i)/c+2:f=(i-a)/c+4,f*=60,f<0&&(f+=360)),{h:f,s:u,l:d}}function g1(e){if(typeof e!="string")return null;const t=y1(e);if(!t||t.s<h1)return null;let o=null,i=1/0;for(const a of fn){const l=Math.abs(t.h-p1[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function at(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(m1(t))return t;const o=e==null?void 0:e.properties;return g1((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function wl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const b1={red:"var(--em-swatch-red-bar)",amber:"var(--em-swatch-amber-bar)",green:"var(--em-swatch-green-bar)",teal:"var(--em-swatch-teal-bar)",blue:"var(--em-swatch-blue-bar)",indigo:"var(--em-swatch-indigo-bar)",violet:"var(--em-swatch-violet-bar)",pink:"var(--em-swatch-pink-bar)"},_1={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function Rd(e,t=!1){return e?t?_1[e]:b1[e]:null}function Dn(e){return Cd[e]}function On(e){return`var(--em-swatch-${e}-bar)`}const k1=["width","height","innerHTML"],w1=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(n.openBlock(),n.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:t[e.name]??""},null,8,k1))}}),Ue=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ue(w1,[["__scopeId","data-v-92c1dba8"]]),E1={class:"em-inline-issue__msgs"},mn=Ue(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},i=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),a=n.computed(()=>{let l=null;for(const r of i.value)(l===null||o[r.severity].order<o[l].order)&&(l=r.severity);return l});return(l,r)=>a.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${a.value}`])},[n.createVNode(Ve,{name:o[a.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",E1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(s,c)=>(n.openBlock(),n.createElementBlock("span",{key:c},n.toDisplayString(s.message),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-17f46a25"]]),v1={class:"em-mlang"},N1={class:"em-mlang__tabs",role:"tablist"},$1=["aria-selected","onClick"],x1={key:0,class:"em-mlang__dot"},El=Ue(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const l=n.ref(a());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function r(d){var u,f;return!!((f=(u=o.modelValue)==null?void 0:u[d])!=null&&f.trim())}const s=n.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[l.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[l.value]:u[l.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",v1,[n.createElementVNode("div",N1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,f=>(n.openBlock(),n.createElementBlock("button",{key:f,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":l.value===f}]),role:"tab","aria-selected":l.value===f,onClick:h=>l.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",x1,"•")):n.createCommentVNode("",!0)],10,$1))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ie.BSTextArea),{key:0,name:`${e.name}-${l.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`${e.name}-${l.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),I1=["disabled"],S1={class:"em-panel__sub-label"},C1={class:"em-field"},R1={class:"em-field"},V1={class:"em-field"},A1={class:"em-class"},T1={class:"em-field"},M1={class:"em-field"},B1={class:"em-field"},D1={class:"em-field"},O1={class:"em-multilang"},L1={class:"em-multilang"},P1={class:"em-jpa"},z1={class:"em-field"},U1={class:"em-field"},H1={class:"em-field"},F1={class:"em-swatch"},G1={class:"em-swatch__row"},Y1=["title","onClick"],Vd=Ue(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(L=>L.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(L=>L.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var L;return at(((L=r.value)==null?void 0:L.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=L=>L;function h(L){return L==="inherit"?"기본(따름)":L}function p(L){l.value&&a.updateEntity(l.value.modelId,L)}function m(L,oe,k){var S;const Y=((S=l.value)==null?void 0:S.table)??{physicalName:""};p(L==="physicalName"?{table:{...Y,physicalName:k}}:{table:{...Y,logicalName:{...Y.logicalName,[oe]:k}}})}function b(L){p({description:Object.keys(L).length?L:void 0})}function y(L,oe){var k;p({jpaAttrs:{...(k=l.value)==null?void 0:k.jpaAttrs,[L]:oe}})}function _(L,oe){y(L,oe)}const V=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),g=n.computed(()=>{var L,oe;return!((oe=(L=l.value)==null?void 0:L.jpaAttrs)!=null&&oe.useDiscriminator)});function v(L){y("discriminatorType",L==="inherit"?void 0:L)}function ee(L){p({hasPersonalInfo:L})}function x(L){p({superClass:L.trim()||void 0})}function O(L){p({schema:L.trim()||void 0})}function P(L){p({abstractClass:L})}const H=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function ne(L){const oe=L.split(",").map(k=>k.trim()).filter(Boolean);p({declarationOfInterfaces:oe.length?oe:void 0})}function ce(L){l.value&&a.setEntitySwatch(l.value.modelId,L)}return(L,oe)=>{var k,Y,S;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:oe[0]||(oe[0]=F=>i("toggle"))},[n.createElementVNode("span",S1,[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||l.value.name||"엔티티"),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(mn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",C1,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=F=>p({name:F}))},null,8,["model-value"])]),n.createElementVNode("label",R1,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=F=>p({stereotype:F}))},null,8,["model-value"])]),n.createElementVNode("label",V1,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=F=>p({packageName:F}))},null,8,["model-value"])]),n.createElementVNode("fieldset",A1,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",T1,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=F=>x(F))},null,8,["model-value"])]),n.createElementVNode("label",M1,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":H.value,"onUpdate:modelValue":oe[5]||(oe[5]=F=>ne(F))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=F=>P(F))},null,8,["model-value"])]),n.createElementVNode("label",B1,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-table",width:"100%","model-value":((k=l.value.table)==null?void 0:k.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=F=>m("physicalName",null,F))},null,8,["model-value"])]),n.createElementVNode("label",D1,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=F=>O(F))},null,8,["model-value"])]),n.createElementVNode("fieldset",O1,[oe[21]||(oe[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,F=>{var U,le;return n.openBlock(),n.createElementBlock("label",{key:F,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(F),1),n.createVNode(n.unref(ie.BSTextInput),{name:`ent-logical-${F}`,width:"100%","model-value":((le=(U=l.value.table)==null?void 0:U.logicalName)==null?void 0:le[F])??"","onUpdate:modelValue":E=>m("logicalName",F,E)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",L1,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(El,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":b},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",P1,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,F=>{var U;return n.createVNode(n.unref(ie.BSCheckbox),{key:F.key,name:`jpa-${F.key}`,class:"em-check",label:F.label,"model-value":!!((U=l.value.jpaAttrs)!=null&&U[F.key]),"onUpdate:modelValue":le=>_(F.key,le)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",z1,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:g.value,"model-value":((Y=l.value.jpaAttrs)==null?void 0:Y.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=F=>y("discriminatorColumnName",F.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",U1,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ie.BSSelect),{disabled:g.value,"model-value":V.value,items:u,"value-provider":f,"label-provider":h,"onUpdate:modelValue":oe[10]||(oe[10]=F=>F&&v(F))},null,8,["disabled","model-value"])]),n.createElementVNode("label",H1,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ie.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:g.value,"model-value":(S=l.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=F=>y("discriminatorLength",F||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!l.value.hasPersonalInfo,"onUpdate:modelValue":ee},null,8,["model-value"]),n.createElementVNode("fieldset",F1,[oe[27]||(oe[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",G1,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:oe[12]||(oe[12]=F=>ce(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),F=>(n.openBlock(),n.createElementBlock("button",{key:F,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===F}]),style:n.normalizeStyle({background:n.unref(On)(F)}),title:n.unref(Dn)(F),onClick:U=>ce(F)},null,14,Y1))),128))])])],64)):n.createCommentVNode("",!0)],8,I1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),Ad=["ko","en","ja","zh"];function W1(e){if(e)for(const t of Ad){const o=e[t];if(o)return o}}function vl(e){const t=W1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function K1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Ad.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const q1=["aria-expanded"],X1=["aria-selected","onClick","onMouseenter"],j1={key:0,class:"gcc__opt gcc__opt--empty"},Td=Ue(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=n.ref(),l=n.ref(),r=n.ref(),s=n.ref(""),c=n.ref(!1),d=n.ref(-1),u=n.ref({}),f=n.computed(()=>o.items.find(P=>P.groupCode===o.modelValue)),h=n.computed(()=>f.value?vl(f.value):"");n.watch(h,P=>{c.value||(s.value=P)},{immediate:!0});const p=n.computed(()=>s.value===h.value?o.items:K1(o.items,s.value));function m(){var H;const P=(H=a.value)==null?void 0:H.getBoundingClientRect();P&&(u.value={left:`${P.left}px`,top:`${P.bottom}px`,width:`${P.width}px`})}function b(){c.value=!0,m(),d.value=Math.max(0,p.value.findIndex(P=>P.groupCode===o.modelValue)),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),document.addEventListener("mousedown",O)}function y(){c.value=!1,window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m),document.removeEventListener("mousedown",O)}n.onBeforeUnmount(y);function _(){b(),n.nextTick(()=>{var P;return(P=l.value)==null?void 0:P.select()})}function V(){c.value||b(),d.value=0}function g(P){i("update:modelValue",P.groupCode),s.value=vl(P),y()}function v(){i("update:modelValue",void 0),s.value="",y()}function ee(){s.value.trim()===""?v():(s.value=h.value,y())}function x(P){var H;if(P.key==="ArrowDown")c.value||b(),d.value=Math.min(d.value+1,p.value.length-1),P.preventDefault();else if(P.key==="ArrowUp")d.value=Math.max(d.value-1,0),P.preventDefault();else if(P.key==="Enter"){const ne=p.value[d.value];ne&&g(ne),P.preventDefault()}else P.key==="Escape"&&(s.value=h.value,y(),(H=l.value)==null||H.blur())}function O(P){var ne,ce;const H=P.target;!((ne=a.value)!=null&&ne.contains(H))&&!((ce=r.value)!=null&&ce.contains(H))&&ee()}return(P,H)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":H[0]||(H[0]=ne=>s.value=ne),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:V,onKeydown:x},null,40,q1),[[n.vModelText,s.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[c.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:r,class:"gcc__popup",style:n.normalizeStyle(u.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:H[1]||(H[1]=n.withModifiers(()=>{},["prevent"])),onClick:v},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("li",{key:ne.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":ce===d.value,"is-selected":ne.groupCode===e.modelValue}]),role:"option","aria-selected":ne.groupCode===e.modelValue,onMousedown:H[2]||(H[2]=n.withModifiers(()=>{},["prevent"])),onClick:L=>g(ne),onMouseenter:L=>d.value=ce},n.toDisplayString(n.unref(vl)(ne)),43,X1))),128)),p.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",j1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),Z1=["disabled"],J1={class:"em-aw__toolbar"},Q1={class:"em-aw__count"},e_={class:"em-aw__scroll"},t_={class:"em-aw__table"},n_={key:0,class:"c-code"},o_=["colspan"],i_={class:"c-del"},a_={class:"c-flag"},l_={class:"c-flag"},r_={class:"c-flag"},s_={class:"c-flag"},c_={class:"c-flag"},d_={class:"c-flag"},u_={class:"c-flag"},f_={class:"c-flag"},m_={key:0},p_=["title"],h_=["colspan"],y_={class:"c-del"},g_={class:"em-aw__embed-label"},b_={class:"em-aw__ro"},__={class:"em-aw__ro"},k_={class:"em-aw__ro"},w_={class:"em-aw__ro"},E_={colspan:"8"},v_=["colspan"],N_={key:0},$_="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",zi="__OWN__",x_=Ue(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(T=>T.modelId===t.entityId)??null),a=n.computed(()=>{var T;return((T=i.value)==null?void 0:T.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var T;return(((T=i.value)==null?void 0:T.attributes)??[]).filter(z=>z.attrType!=="DIVIDER").length}),s=n.computed(()=>Y.value.length?19:18),c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(T){return T==="none"?"(없음)":T}const u=T=>T;function f(T,z){i.value&&o.updateAttribute(i.value.modelId,T.modelId,z)}function h(T){return!!i.value&&!!oi(o.state.logical,i.value.modelId,T.modelId)}function p(T,z){f(T,{naturalId:z||void 0,naturalIdMutable:z?T.naturalIdMutable:void 0})}function m(){return{naturalId:void 0,naturalIdMutable:void 0}}function b(T,z){f(T,{identifier:z,...z?m():{}})}function y(T,z){f(T,{transient:z||void 0,...z?m():{}})}function _(T){return!!T.transient}const V=T=>T.value,g=T=>T.label;function v(T,z){if(!z)return;const B=ce.value.find(me=>me.type===z);if(B){const me=T.dbAttrs[0]??{modelId:T.modelId+".c",physicalName:T.name,dataType:"VARCHAR"};f(T,{type:z,customType:void 0,dbAttrs:[{...me,dataType:B.dataType,length:B.length,scale:B.scale}]});return}f(T,z===Ct?{type:z}:{type:z,customType:void 0})}function ee(T,z){f(T,{customType:z.trim()===""?void 0:z})}function x(T,z){const me={...T.dbAttrs[0]??{modelId:T.modelId+".c",physicalName:T.name,dataType:"VARCHAR"},...z};z.dataType!==void 0&&!Go.has(me.dataType)&&(me.scale=void 0),f(T,{dbAttrs:[me]})}function O(T){var z;return Go.has(((z=T.dbAttrs[0])==null?void 0:z.dataType)??"")}function P(T,z,B){var me;x(T,{logicalName:{...(me=T.dbAttrs[0])==null?void 0:me.logicalName,[z]:B}})}function H(T){return T.personalInfoAttributeType??"none"}function ne(T,z){f(T,{personalInfoAttributeType:z==="none"?void 0:z})}const ce=n.computed(()=>o.predefinedCustomTypeCatalog.value),L=n.computed(()=>o.embeddableCatalog.value);function oe(T){var z,B;return((z=T.label)==null?void 0:z.ko)??((B=T.label)==null?void 0:B.en)??T.type}function k(T){!T||!i.value||o.addPredefinedEmbed(i.value.modelId,T)}const Y=n.computed(()=>o.groupCodeCatalog.value);function S(T){var z;return((z=Y.value.find(B=>B.groupCode===T.groupCode))==null?void 0:z.codes)??[]}function F(T){return["none",...S(T)]}function U(T){return T==="none"?"none":T.code}function le(T){var B,me;if(T==="none")return"(없음)";const z=((B=T.label)==null?void 0:B.ko)??((me=T.label)==null?void 0:me.en);return z?`${T.code} (${z})`:T.code}function E(T,z){i.value&&o.setAttributeGroupCode(i.value.modelId,T.modelId,z)}function K(T,z){f(T,{defaultValue:z==="none"?void 0:z})}function re(T,z){f(T,{defaultValue:z.trim()===""?void 0:z})}function pe(T){return T.attrType.startsWith("EMBED")&&T.dbAttrs.length>0}function ye(T,z,B){const me=T.dbAttrs.map((Z,Q)=>{if(Q!==z)return Z;const te={...Z,...B};for(const de of Object.keys(B))B[de]===void 0&&delete te[de];return te});i.value&&o.setEmbedColumns(i.value.modelId,T.modelId,me)}function ue(T,z,B,me){var Z;ye(T,z,{logicalName:{...(Z=T.dbAttrs[z])==null?void 0:Z.logicalName,[B]:me}})}function fe(T,z){var Z,Q,te;if(T.attrType==="EMBED_PREDEF"){const de=(Z=o.embeddableCatalog.value.find($=>$.type===T.type))==null?void 0:Z.fields[z];return de?{name:de.name,physicalName:de.physicalName,dataType:de.dataType,length:de.length,shareable:de.shareable,logicalName:de.logicalName}:void 0}const B=(Q=T.embedded)==null?void 0:Q.embeddableRef;if(!B)return;const me=(te=o.state.logical.entities.find(de=>de.modelId===B))==null?void 0:te.attributes.flatMap(de=>de.dbAttrs)[z];return me?{physicalName:me.physicalName,dataType:me.dataType,length:me.length,scale:me.scale,logicalName:me.logicalName}:void 0}function ge(T,z){var B,me;return((B=fe(T,z))==null?void 0:B.dataType)||((me=T.dbAttrs[z])==null?void 0:me.dataType)||""}function Ee(T,z){var B,me;return((B=fe(T,z))==null?void 0:B.length)??((me=T.dbAttrs[z])==null?void 0:me.length)}function Re(T,z){var B,me;return((B=fe(T,z))==null?void 0:B.scale)??((me=T.dbAttrs[z])==null?void 0:me.scale)}const Ie=["inherit","true","false"];function he(T){return T==="inherit"?"기본(따름)":T}function j(T){return(T==null?void 0:T.updatable)===void 0?"inherit":T.updatable?"true":"false"}function W(T,z,B){ye(T,z,{updatable:B==="inherit"?void 0:B==="true"})}function w(T,z){x(T,{updatable:z==="inherit"?void 0:z==="true"})}const I=["inherit","true","false"];function C(T){return T==="inherit"?"기본(따름)":T}function G(T){return(T==null?void 0:T.insertable)===void 0?"inherit":T.insertable?"true":"false"}function J(T,z,B){ye(T,z,{insertable:B==="inherit"?void 0:B==="true"})}function be(T,z){x(T,{insertable:z==="inherit"?void 0:z==="true"})}const we=n.computed(()=>i.value?Yo(i.value,o.state.logical.entities):[]),$e=n.computed(()=>qn(we.value.flatMap(T=>T.attributes.flatMap(z=>z.dbAttrs)))),_e=n.computed(()=>we.value.flatMap(T=>T.attributes.filter(z=>z.attrType==="NORMAL"&&z.dbAttrs.length===1&&z.dbAttrs[0]).map(z=>{var B;return{modelId:z.dbAttrs[0].modelId,physical:z.dbAttrs[0].physicalName||z.name,isCurrency:z.type==="Currency",ownerName:T.modelId===((B=i.value)==null?void 0:B.modelId)?void 0:T.name}})));function Ce(){const T=[..._e.value].sort((z,B)=>Number(B.isCurrency)-Number(z.isCurrency));return[zi,...T.map(z=>z.modelId)]}function Te(T){if(T===zi)return"전용 컬럼(OWN)";const z=_e.value.find(me=>me.modelId===T);return z?`↗ ${z.ownerName?`${z.ownerName}.`:""}${z.physical} (${z.isCurrency?"통화":"공유"})`:T}function Be(T){return(T==null?void 0:T.sharedColumnRef)??zi}function N(T,z,B){ye(T,z,{sharedColumnRef:B===zi?void 0:B})}function A(T){return(T==null?void 0:T.sharedColumnRef)!=null}function ae(T){var z;return((z=Ko(T,$e.value))==null?void 0:z.physicalName)??""}return(T,z)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",J1,[n.createElementVNode("span",Q1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:z[0]||(z[0]=B=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"구분선",onClick:z[1]||(z[1]=B=>n.unref(o).addDivider(i.value.modelId))}),L.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:L.value,"value-provider":B=>B.type,"label-provider":oe,"onUpdate:modelValue":k},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",e_,[n.createElementVNode("table",t_,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[z[2]||(z[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),z[3]||(z[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),z[4]||(z[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),z[5]||(z[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),z[6]||(z[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),z[7]||(z[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),z[8]||(z[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),z[9]||(z[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),z[10]||(z[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),z[11]||(z[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),z[12]||(z[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),z[13]||(z[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),z[14]||(z[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),z[15]||(z[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),z[16]||(z[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),z[17]||(z[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),z[18]||(z[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),z[19]||(z[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),Y.value.length?(n.openBlock(),n.createElementBlock("th",n_,"코드그룹")):n.createCommentVNode("",!0),z[20]||(z[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),z[21]||(z[21]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,B=>{var me,Z,Q,te,de,$,D,se,R,q,M;return n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":B.name,"onUpdate:modelValue":X=>f(B,{name:X})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,o_),n.createElementVNode("td",i_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2)):pe(B)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":X=>f(B,{name:X})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:Y.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(B.dbAttrs.length)+"개",9,h_),n.createElementVNode("td",y_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(X,ke)=>{var De,Le,Pe,He,et,Ye,Ke;return n.openBlock(),n.createElementBlock("tr",{key:X.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",g_,"↳ "+n.toDisplayString(((De=fe(B,ke))==null?void 0:De.name)??((Le=fe(B,ke))==null?void 0:Le.physicalName)??`컬럼 ${ke+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",b_,n.toDisplayString(ge(B,ke)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-logical-${X.modelId}`,width:"100%",placeholder:((He=(Pe=fe(B,ke))==null?void 0:Pe.logicalName)==null?void 0:He.ko)??"논리명","model-value":((et=X.logicalName)==null?void 0:et.ko)??"","onUpdate:modelValue":je=>ue(B,ke,"ko",je)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-col-${X.modelId}`,width:"100%",disabled:A(X),placeholder:((Ye=fe(B,ke))==null?void 0:Ye.physicalName)??"컬럼","model-value":A(X)?ae(X):X.physicalName,"onUpdate:modelValue":je=>ye(B,ke,{physicalName:je})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":X.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",__,n.toDisplayString(ge(B,ke)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",k_,n.toDisplayString(Ee(B,ke)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",w_,n.toDisplayString(Re(B,ke)??""),1)]),n.createElementVNode("td",E_,[(Ke=fe(B,ke))!=null&&Ke.shareable?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":Be(X),items:Ce(),"value-provider":u,"label-provider":Te,"onUpdate:modelValue":je=>je&&N(B,ke,je)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:A(X),"model-value":A(X)?"false":G(X),items:I,"value-provider":u,"label-provider":C,"onUpdate:modelValue":je=>je&&J(B,ke,je)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:A(X),"model-value":A(X)?"false":j(X),items:Ie,"value-provider":u,"label-provider":he,"onUpdate:modelValue":je=>je&&W(B,ke,je)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:Y.value.length?4:3},null,8,v_)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(B.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":X=>f(B,{name:X})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:"타입",disabled:!!B.groupCode,items:n.unref(mr)(B.type,ce.value),"value-provider":V,"label-provider":g,"model-value":B.type,"onUpdate:modelValue":X=>v(B,X)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),B.type===n.unref(Ct)?(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":B.customType??"","onUpdate:modelValue":X=>ee(B,X)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-logical-${B.modelId}`,width:"100%",placeholder:"논리명","model-value":((Z=(me=B.dbAttrs[0])==null?void 0:me.logicalName)==null?void 0:Z.ko)??"","onUpdate:modelValue":X=>P(B,"ko",X)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:"컬럼",disabled:_(B),"model-value":((Q=B.dbAttrs[0])==null?void 0:Q.physicalName)??"","onUpdate:modelValue":X=>x(B,{physicalName:X})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(te=B.dbAttrs[0])==null?void 0:te.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:_(B),items:n.unref(ur)(((de=B.dbAttrs[0])==null?void 0:de.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(wa),"model-value":(($=B.dbAttrs[0])==null?void 0:$.dataType)??"","onUpdate:modelValue":X=>X&&x(B,{dataType:X})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:_(B),"model-value":(D=B.dbAttrs[0])==null?void 0:D.length,"onUpdate:modelValue":X=>x(B,{length:X||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"100%",placeholder:"scale",disabled:_(B)||!O(B),"model-value":(se=B.dbAttrs[0])==null?void 0:se.scale,"onUpdate:modelValue":X=>x(B,{scale:X||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",a_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-pk-${B.modelId}`,"model-value":B.identifier,disabled:a.value||_(B),"onUpdate:modelValue":X=>b(B,X)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",l_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nn-${B.modelId}`,"model-value":B.notNull,disabled:_(B),"onUpdate:modelValue":X=>f(B,{notNull:X})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",r_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-uq-${B.modelId}`,"model-value":!!((R=B.dbAttrs[0])!=null&&R.unique),disabled:_(B),"onUpdate:modelValue":X=>x(B,{unique:X})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",s_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-ai-${B.modelId}`,"model-value":!!((q=B.dbAttrs[0])!=null&&q.autoIncrement),disabled:_(B)||!B.identifier,"onUpdate:modelValue":X=>x(B,{autoIncrement:X})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",c_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-tr-${B.modelId}`,"model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":X=>y(B,X)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",d_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nid-${B.modelId}`,"model-value":!!B.naturalId,disabled:B.identifier||_(B),"onUpdate:modelValue":X=>p(B,X)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",u_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nidm-${B.modelId}`,"model-value":!!B.naturalIdMutable,disabled:_(B)||!B.naturalId,"onUpdate:modelValue":X=>f(B,{naturalIdMutable:X||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",f_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-mv-${B.modelId}`,"model-value":!!((M=B.dbAttrs[0])!=null&&M.multiValue),disabled:_(B),"onUpdate:modelValue":X=>x(B,{multiValue:X||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-ins-${B.modelId}`,width:"100%",disabled:_(B),"model-value":G(B.dbAttrs[0]),items:I,"value-provider":u,"label-provider":C,"onUpdate:modelValue":X=>X&&be(B,X)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-upd-${B.modelId}`,width:"100%",disabled:_(B),"model-value":j(B.dbAttrs[0]),items:Ie,"value-provider":u,"label-provider":he,"onUpdate:modelValue":X=>X&&w(B,X)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":H(B),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":X=>X&&ne(B,X)},null,8,["model-value","onUpdate:modelValue"])]),Y.value.length?(n.openBlock(),n.createElementBlock("td",m_,[n.createVNode(Td,{"model-value":B.groupCode,items:Y.value,"onUpdate:modelValue":X=>E(B,X)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[S(B).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":B.defaultValue??"none",items:F(B),"value-provider":U,"label-provider":le,"onUpdate:modelValue":X=>X&&K(B,X)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"100%",placeholder:"기본값","model-value":B.defaultValue??"","onUpdate:modelValue":X=>re(B,X)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",{class:"c-del",title:h(B)?$_:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,p_)],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",N_,[...z[22]||(z[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,Z1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-79ca2048"]]),I_=["disabled"],S_={class:"em-idxw__list"},C_={class:"em-idxw__list-head"},R_=["onClick"],V_={class:"em-idxw__item-name"},A_={key:0,class:"em-idxw__badge"},T_={class:"em-idxw__item-cnt"},M_={key:0,class:"em-idxw__empty"},B_={key:0,class:"em-idxw__edit"},D_={class:"em-idxw__form"},O_={class:"em-field em-idxw__name"},L_={class:"em-field"},P_=["value"],z_={class:"em-idxw__transfer"},U_={class:"em-idxw__pane"},H_={class:"em-idxw__pane-head"},F_={class:"em-idxw__cols"},G_=["onClick"],Y_={key:0,class:"em-idxw__empty"},W_={class:"em-idxw__arrows"},K_={class:"em-idxw__pane"},q_={class:"em-idxw__pane-head"},X_={class:"em-idxw__cols"},j_={class:"em-idxw__col-name"},Z_={class:"em-idxw__col-ops"},J_=["disabled","onClick"],Q_=["disabled","onClick"],ek=["onClick"],tk={key:0,class:"em-idxw__empty"},nk={key:1,class:"em-idxw__edit em-idxw__edit--empty"},ok=Ue(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(x=>x.modelId===t.entityId)??null),a=n.computed(()=>{var x;return((x=i.value)==null?void 0:x.indexes)??[]}),l=n.computed(()=>{var x;return((x=i.value)==null?void 0:x.attributes)??[]}),r=n.ref(null);n.watch(a,x=>{var O;x.some(P=>P.modelId===r.value)||(r.value=((O=x[0])==null?void 0:O.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(x=>x.modelId===r.value)??null),c=n.computed(()=>{var x;return new Set(((x=s.value)==null?void 0:x.columns.map(O=>O.columnRef))??[])}),d=n.computed(()=>l.value.filter(x=>!c.value.has(x.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(x){var P;const O=(P=x.dbAttrs[0])==null?void 0:P.physicalName;return O&&O!==x.name?`${x.name} (${O})`:x.name}function h(x){const O=l.value.find(P=>P.modelId===x);return O?f(O):x}function p(x,O){i.value&&o.updateIndex(i.value.modelId,x,O)}function m(){var O;if(!i.value)return;const x=Oe();o.addIndex(i.value.modelId,{modelId:x,name:`idx_${(((O=i.value.indexes)==null?void 0:O.length)??0)+1}`,unique:!1,columns:[]}),r.value=x}function b(x){i.value&&o.removeIndex(i.value.modelId,x)}function y(x){s.value&&p(s.value.modelId,{parameters:x.trim()===""?void 0:x})}function _(x){const O=new Set(u.value);O.has(x)?O.delete(x):O.add(x),u.value=O}function V(){const x=s.value;if(!x||!u.value.size)return;const O=[...u.value].map(P=>({columnRef:P,descending:!1}));p(x.modelId,{columns:[...x.columns,...O]}),u.value=new Set}function g(x){const O=s.value;O&&p(O.modelId,{columns:O.columns.filter((P,H)=>H!==x)})}function v(x,O){const P=s.value;P&&p(P.modelId,{columns:P.columns.map((H,ne)=>ne===x?{...H,descending:O}:H)})}function ee(x,O){const P=s.value;if(!P)return;const H=x+O;if(H<0||H>=P.columns.length)return;const ne=[...P.columns];[ne[x],ne[H]]=[ne[H],ne[x]],p(P.modelId,{columns:ne})}return(x,O)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",S_,[n.createElementVNode("div",C_,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:m})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,P=>(n.openBlock(),n.createElementBlock("li",{key:P.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":P.modelId===r.value}]),onClick:H=>r.value=P.modelId},[n.createElementVNode("span",V_,n.toDisplayString(P.name||"(이름 없음)"),1),P.unique?(n.openBlock(),n.createElementBlock("span",A_,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",T_,n.toDisplayString(P.columns.length),1)],10,R_))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",M_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",B_,[n.createElementVNode("div",D_,[n.createElementVNode("label",O_,[O[4]||(O[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":O[0]||(O[0]=P=>p(s.value.modelId,{name:P}))},null,8,["model-value"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":O[1]||(O[1]=P=>p(s.value.modelId,{unique:P}))},null,8,["model-value"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:O[2]||(O[2]=P=>b(s.value.modelId))})]),n.createElementVNode("label",L_,[O[5]||(O[5]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A' AND deleted = false",onChange:O[3]||(O[3]=P=>y(P.target.value))},null,40,P_)]),n.createElementVNode("div",z_,[n.createElementVNode("div",U_,[n.createElementVNode("div",H_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",F_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>(n.openBlock(),n.createElementBlock("li",{key:P.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(P.modelId)}]),onClick:H=>_(P.modelId)},n.toDisplayString(f(P)),11,G_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Y_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",W_,[n.createVNode(n.unref(ie.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:V},null,8,["disabled"])]),n.createElementVNode("div",K_,[n.createElementVNode("div",q_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",X_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(P,H)=>(n.openBlock(),n.createElementBlock("li",{key:H,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",j_,n.toDisplayString(h(P.columnRef)),1),n.createVNode(n.unref(ie.BSCheckbox),{name:`idxw-desc-${H}`,class:"em-check",label:"DESC","model-value":P.descending,"onUpdate:modelValue":ne=>v(H,ne)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",Z_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:H===0,onClick:ne=>ee(H,-1)},"↑",8,J_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:H===s.value.columns.length-1,onClick:ne=>ee(H,1)},"↓",8,Q_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:ne=>g(H)},"✕",8,ek)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",tk,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",nk,"인덱스를 선택하거나 추가하세요."))],8,I_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),ik={class:"em-op-src"},ak={class:"em-op-src__actions"},Md=Ue(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",ik,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),class:"em-op-src__area",spellcheck:"false",placeholder:"// Java 구현 코드"},null,512),[[n.vModelText,i.value]]),n.createElementVNode("div",ak,[n.createVNode(n.unref(ie.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-2150d2fc"]]),lk=["disabled"],rk={class:"em-ow__toolbar"},sk={class:"em-ow__count"},ck={class:"em-ow__scroll"},dk={class:"em-ow__table"},uk={class:"c-del"},fk={key:0},mk=Ue(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModal(),a=n.computed(()=>o.state.logical.entities.find(m=>m.modelId===t.entityId)??null),l=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(m){return m==="none"?"(없음)":m}const c=m=>m;function d(m,b){a.value&&o.updateOperation(a.value.modelId,m.modelId,b)}function u(m,b,y){d(m,{description:{...m.description,[b]:y}})}function f(m){return m.personalInfoAttributeType??"none"}function h(m,b){d(m,{personalInfoAttributeType:b==="none"?void 0:b})}function p(m){i.openModal({component:Md,bind:{operationName:m.name,sourceCode:m.sourceCode??"",onSave:b=>d(m,{sourceCode:b})}})}return(m,b)=>{var y,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",rk,[n.createElementVNode("span",sk,"오퍼레이션 ("+n.toDisplayString(((y=a.value.operations)==null?void 0:y.length)??0)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:b[0]||(b[0]=V=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",ck,[n.createElementVNode("table",dk,[b[2]||(b[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],V=>{var g;return n.openBlock(),n.createElementBlock("tr",{key:V.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-name-${V.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":V.name,"onUpdate:modelValue":v=>d(V,{name:v})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":V.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":v=>v&&d(V,{visibility:v})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-desc-${V.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((g=V.description)==null?void 0:g.ko)??"","onUpdate:modelValue":v=>u(V,"ko",v)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":f(V),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":v=>v&&h(V,v)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:V.sourceCode?"본문 ●":"본문",onClick:v=>p(V)},null,8,["caption","onClick"])]),n.createElementVNode("td",uk,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:v=>n.unref(o).removeOperation(a.value.modelId,V.modelId)},null,8,["onClick"])])])}),128)),(_=a.value.operations)!=null&&_.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",fk,[...b[1]||(b[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,lk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),pk={class:"em-detail__tabs"},hk=["onClick"],yk=Ue(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const l=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`엔티티 — ${((d=a.value)==null?void 0:d.name)??""}`},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",pk,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(l,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":r.value===u.key}]),onClick:f=>r.value=u.key},n.toDisplayString(u.label),11,hk)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(Vd,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(x_,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(ok,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(mk,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-67239153"]]);function Ui(e,t,o){e.openModal({component:yk,bind:{controller:n.markRaw(t),entityId:o}})}const Bd="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function gk(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Oe(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const l=Oe();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Oe()}for(const a of t.indexes??[]){a.modelId=Oe();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const pn=Symbol("editorController");function Dd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Hi(e,t){const o=[];for(const i of t.remove)o.push($n(e,i));for(const i of t.update)o.push(en(e,i.attributeId,i.patch));for(const i of t.add)o.push(Vt(e,i));return o}function Ln(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Pn(e,t){const o=[];for(const[i,a]of hm(e,t,Oe))o.push(...Hi(i,a));return o}function Od(e,t,o){const i=new Set(o.remove);return Ln(e,t,a=>[...a.filter(l=>!i.has(l.modelId)).map(l=>{const r=o.update.find(s=>s.attributeId===l.modelId);return r?{...l,...r.patch}:l}),...o.add])}function Nl(e,t){const o=eo(e,t,Oe),i=Hi(t,o),a=Od(e,t,o);return i.push(...Pn(a,t)),i}function Ld(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Oe()}))}function bk(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((p,m)=>Math.max(p,m.order),-1)+1,f=new Set(o.attributes.map(p=>p.name));let h="id";for(let p=2;f.has(h);p++)h=`id${p}`;a={modelId:Oe(),name:h,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Oe(),physicalName:h.toLowerCase(),dataType:"BIGINT"}]},i.push(Vt(t,a))}const l=[];for(const u of e.entities)for(const f of u.attributes){if(((d=f.embedded)==null?void 0:d.embeddableRef)!==t)continue;const h=e.associations.find(y=>y.modelId===f.embedded.associationRef);if(!h)continue;const p=h.end1.entityRef===u.modelId,m=p?h.end1:h.end2,b=p?h.end2:h.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:h.modelId,end1:{entityRef:u.modelId,multiplicity:m.multiplicity,navigable:m.navigable,composition:!1},end2:{entityRef:t,multiplicity:b.multiplicity,navigable:b.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(l.filter(h=>h.ownerId===u.modelId).map(h=>h.dispId));return f.size?{...u,attributes:u.attributes.filter(h=>!f.has(h.modelId))}:u}),associations:e.associations.map(u=>{const f=l.find(h=>h.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=eo(r,t,Oe);for(const u of l){const f=s.add.find(h=>{var p;return((p=h.derivedFrom)==null?void 0:p.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push($n(u.ownerId,u.dispId)),i.push(Qo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Hi(t,s));const c=Od(r,t,s);return i.push(...Pn(c,t)),i}function _k(e,t){const o=e.entities.find(l=>l.modelId===t);if(!o)return[];const i=[],a=l=>l&&l.charAt(0).toLowerCase()+l.slice(1);for(const l of e.associations){if(l.end1.entityRef===l.end2.entityRef)continue;const r=l.end1.entityRef===t,s=l.end2.entityRef===t;if(!r&&!s)continue;const c=r?l.end2.entityRef:l.end1.entityRef,d=e.entities.find(g=>g.modelId===c);if(!d||d.attributes.some(g=>{var v;return((v=g.embedded)==null?void 0:v.associationRef)===l.modelId}))continue;const u=Oe(),f=d.attributes.reduce((g,v)=>Math.max(g,v.order),-1)+1,h=new Set(d.attributes.map(g=>g.name)),p=a(o.name);let m=p;for(let g=2;h.has(m);g++)m=`${p}${g}`;const b=o.attributes.filter(g=>!g.identifier&&!g.derivedFrom).flatMap(g=>g.dbAttrs).map(g=>({...g,modelId:Oe()})),y={modelId:u,name:m,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:b,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(Vt(c,y));const _=r?"end2":"end1",V=r?"end1":"end2";i.push(Qo(l.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Oe()},[V]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function kk(e=Dd(),t={}){var Te,Be;const o=n.reactive(e);let i=new Ca(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),h=n.ref(t.flagEntitiesWithoutRelations??!1),p=n.ref(!1),m=n.ref(!1),b=n.ref(!1),y=n.ref(0),_=n.ref(null);let V=0;const g=N=>{if(t.onNotice){t.onNotice(N);return}_.value={text:N,id:++V}},v=n.ref(((Te=t.meta)==null?void 0:Te.schemaVersion)??1),ee=n.ref(((Be=t.meta)==null?void 0:Be.opWriteEnabled)??!1),x=n.computed(()=>v.value>=2&&ee.value),O=t.historyTransport,P=n.computed(()=>x.value&&O!==void 0),H=t.restoreTransport,ne=n.ref(0),ce=n.computed(()=>x.value&&oe.value&&H!==void 0);async function L(N){if(!H||!oe.value)return{ok:!1,reason:"unavailable"};const A=await H(N);return A.ok&&ne.value++,A}const oe=n.ref(!(v.value>=2&&ee.value===!1)),k=n.ref("LOGICAL_PHYSICAL"),Y=n.ref("straight"),S=n.ref(!0),F=n.ref(!0),U=n.ref(null),le=n.computed(()=>{var N;return((N=U.value)==null?void 0:N.kind)==="attribute"?{entityId:U.value.entityId,attrId:U.value.anchor}:null}),E=n.computed(()=>{var N;return((N=U.value)==null?void 0:N.kind)==="attribute"?U.value.ids:[]}),K=n.computed(()=>{var N,A;return((N=U.value)==null?void 0:N.kind)==="entity"?U.value.id:((A=U.value)==null?void 0:A.kind)==="attribute"?U.value.entityId:null}),re=n.ref(null);let pe=0;const ye=n.ref(null),ue=n.ref(null);let fe=t.meta;function ge(){i.onChange(()=>{p.value=i.canUndo,m.value=i.canRedo,b.value=i.isDirty,y.value++})}ge();let Ee=null,Re=null;function Ie(){Re==null||Re(),Re=null,Ee=null}function he(){if(Ie(),!x.value||!t.opTransport)return;const N=new ds({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:A=>{oe.value=!1,ue.value=A},onError:t.onOpError});N.seed((fe==null?void 0:fe.revSeed)??{}),Re=N.attach(i),Ee=N}he();const j=n.computed(()=>Jl(o.logical,o.layout)),W=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:h.value,embeddableCatalog:a.value})),w=n.computed(()=>yr(o.logical,W.value)),I=n.computed(()=>{const N=new Map;for(const A of w.value){if(!A.targetRef)continue;const ae=N.get(A.targetRef);ae?ae.push(A):N.set(A.targetRef,[A])}return N}),C=N=>{oe.value&&i.execute(N)},G=N=>o.layout.entityLayouts.some(A=>A.entityRef===N&&!!A.locked),J=N=>o.layout.groupLayouts.some(A=>A.groupRef===N&&!!A.locked),be=N=>{const A=o.logical.associations.find(ae=>ae.modelId===N);return!!A&&(G(A.end1.entityRef)||G(A.end2.entityRef))},we=(N,A,ae)=>{if(G(N))return;const T=en(N,A,ae),z=Ln(o.logical,N,me=>me.map(Z=>Z.modelId===A?{...Z,...ae}:Z)),B=Pn(z,N);C(B.length?Ge("속성 수정",[T,...B]):T)};function $e(N){const A=N.map(Q=>o.layout.entityLayouts.find(te=>te.entityRef===Q)).filter(Q=>!!Q);if(!A.length)return{location:{x:40,y:40},size:{width:400,height:300}};let ae=1/0,T=1/0,z=-1/0,B=-1/0;for(const Q of A){const te=Q.geo.size.width||220,de=Q.geo.size.height||140;ae=Math.min(ae,Q.geo.location.x),T=Math.min(T,Q.geo.location.y),z=Math.max(z,Q.geo.location.x+te),B=Math.max(B,Q.geo.location.y+de)}const me=40,Z=28;return{location:{x:ae-me,y:T-me-Z},size:{width:z-ae+me*2,height:B-T+me*2+Z}}}function _e(N,A,ae){var Q;const T=o.layout.groupLayouts.find(te=>te.groupRef===N),z=(T==null?void 0:T.geo.location)??A,B=A.x-z.x,me=A.y-z.y,Z=[Ar(N,A),...ae.map(te=>Nn(te.id,te.location))];if(B||me){const te=new Set(((Q=o.logical.groups.find(de=>de.modelId===N))==null?void 0:Q.memberEntityRefs)??[]);for(const de of o.logical.associations){if(!te.has(de.end1.entityRef)||!te.has(de.end2.entityRef))continue;const $=o.layout.associationLayouts.find(D=>D.associationRef===de.modelId);$&&$.waypoints.length&&Z.push(Kr(de.modelId,B,me))}for(const de of(T==null?void 0:T.memberNoteRefs)??[]){const $=o.layout.notes.find(D=>D.modelId===de);$&&Z.push(Qn(de,{x:$.geo.location.x+B,y:$.geo.location.y+me}))}}return Z}const Ce={state:o,resolved:j,issues:w,issuesByRef:I,flagEntitiesWithoutRelations:h,canUndo:p,canRedo:m,dirty:b,revision:y,notice:_,editable:oe,schemaVersion:v,opWriteEnabled:ee,opMode:x,opConflict:ue,historyTransport:O,historyAvailable:P,restoreTransport:H,restoreAvailable:ce,restoreToSeq:L,reloadRequest:ne,displayMode:k,routingMode:Y,showGrid:S,showMinimap:F,selection:U,selectedAttr:le,selectedAttrIds:E,inspectedEntityId:K,focusRequest:re,clipboard:ye,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(N){oe.value=N&&x.value},setEmbeddableCatalog(N){a.value=N},setGroupCodeCatalog(N){l.value=N},setPredefinedCustomTypeCatalog(N){r.value=N},selectAttribute(N,A,ae="replace"){const T=U.value,z=(T==null?void 0:T.kind)==="attribute"&&T.entityId===N;if(ae==="replace"||!z){U.value={kind:"attribute",entityId:N,ids:[A],anchor:A};return}if(ae==="toggle"){const $=T.ids.includes(A),D=$?T.ids.filter(R=>R!==A):[...T.ids,A];if(!D.length){U.value=null;return}const se=$&&T.anchor===A?D[D.length-1]:$?T.anchor:A;U.value={kind:"attribute",entityId:N,ids:D,anchor:se};return}const B=o.logical.entities.find($=>$.modelId===N),me=[...(B==null?void 0:B.attributes)??[]].sort(($,D)=>$.order-D.order).map($=>$.modelId),Z=me.indexOf(T.anchor),Q=me.indexOf(A);if(Z<0||Q<0){U.value={kind:"attribute",entityId:N,ids:[A],anchor:A};return}const[te,de]=Z<=Q?[Z,Q]:[Q,Z];U.value={kind:"attribute",entityId:N,ids:me.slice(te,de+1),anchor:T.anchor}},moveAttributeFocus(N){const A=U.value;if((A==null?void 0:A.kind)!=="attribute")return!1;const ae=o.logical.entities.find(me=>me.modelId===A.entityId);if(!ae||!ae.attributes.length)return!1;const T=ae.attributes.findIndex(me=>me.modelId===A.anchor);if(T<0)return!1;const z=Math.min(Math.max(T+N,0),ae.attributes.length-1);if(z===T)return!0;const B=ae.attributes[z].modelId;return U.value={kind:"attribute",entityId:A.entityId,ids:[B],anchor:B},!0},nudgeSelectedAttributes(N){const A=U.value;if((A==null?void 0:A.kind)!=="attribute")return!1;const ae=o.logical.entities.find($=>$.modelId===A.entityId);if(!ae)return!1;const T=ae.attributes,z=new Set(A.ids),B=T.map(($,D)=>z.has($.modelId)?D:-1).filter($=>$>=0);if(!B.length)return!1;const me=Math.min(...B),Z=T.filter($=>!z.has($.modelId)),Q=T.slice(0,me).filter($=>!z.has($.modelId)).length;let te;if(N<0){if(Q<=0)return!0;te=Q-1}else{if(Z.length-Q<=0)return!0;te=Q+1}if(G(A.entityId))return!0;const de=T.filter($=>z.has($.modelId)).map($=>$.modelId);return C(Ta(A.entityId,de,te)),!0},deleteSelection(){if(!oe.value)return!1;const N=U.value;if(!N)return!1;if(N.kind==="attribute"){if(G(N.entityId))return!1;const A=N.ids;if(!A.length)return!1;A.length===1?Ce.removeAttribute(N.entityId,A[0]):Ce.removeAttributes(N.entityId,A)}else if(N.kind==="entity"){if(G(N.id))return!1;Ce.removeEntity(N.id)}else if(N.kind==="note")Ce.removeNote(N.id);else if(N.kind==="group"){if(J(N.id))return!1;Ce.removeGroup(N.id)}else Ce.removeAssociation(N.id);return U.value=null,!0},nudgeNodes(N,A,ae){if(!N.length||A===0&&ae===0)return!1;const T=new Set(o.logical.entities.map(te=>te.modelId)),z=new Set(o.logical.groups.map(te=>te.modelId)),B=new Set(o.layout.notes.map(te=>te.modelId)),me=new Set;for(const te of N){if(!z.has(te))continue;const de=o.logical.groups.find($=>$.modelId===te);for(const $ of(de==null?void 0:de.memberEntityRefs)??[])me.add($)}const Z=[],Q=[];for(const te of N)if(z.has(te)){if(J(te))continue;const de=o.layout.groupLayouts.find(R=>R.groupRef===te);if(!de)continue;const $=o.logical.groups.find(R=>R.modelId===te),D=(($==null?void 0:$.memberEntityRefs)??[]).map(R=>{var M;const q=((M=o.layout.entityLayouts.find(X=>X.entityRef===R))==null?void 0:M.geo.location)??{x:0,y:0};return{id:R,location:{x:q.x+A,y:q.y+ae}}}),se={x:de.geo.location.x+A,y:de.geo.location.y+ae};Z.push(Ge("그룹 이동",_e(te,se,D))),Q.push("g:"+te)}else if(T.has(te)){if(me.has(te)||G(te))continue;const de=o.layout.entityLayouts.find($=>$.entityRef===te);if(!de)continue;Z.push(Nn(te,{x:de.geo.location.x+A,y:de.geo.location.y+ae})),Q.push("e:"+te)}else if(B.has(te)){const de=o.layout.notes.find($=>$.modelId===te);if(!de)continue;Z.push(Qn(te,{x:de.geo.location.x+A,y:de.geo.location.y+ae})),Q.push("n:"+te)}return Z.length?(C(Ge("이동",Z,"nudge:"+Q.sort().join(","))),!0):!1},requestFocus(N){re.value={id:N,nonce:++pe}},undo:()=>{oe.value&&i.undo()},redo:()=>{oe.value&&i.redo()},markSaved:()=>{oe.value&&(Ee==null||Ee.flush(),i.markSavePoint())},loadDiagram(N,A){Ie(),o.logical=N.logical,o.layout=N.layout,i=new Ca(o),ge(),v.value=(A==null?void 0:A.schemaVersion)??1,ee.value=(A==null?void 0:A.opWriteEnabled)??!1,oe.value=!(v.value>=2&&ee.value===!1),fe=A,ue.value=null,U.value=null,p.value=i.canUndo,m.value=i.canRedo,b.value=i.isDirty,he()},flush(){Ee==null||Ee.flush()},whenOpsSettled(){return(Ee==null?void 0:Ee.whenSettled())??Promise.resolve()},addEntity(N="NewEntity",A={x:80,y:80}){const ae=Oe(),T={modelId:ae,name:N,stereotype:"JPA_ENTITY",table:{physicalName:N.toLowerCase()},attributes:[{modelId:Oe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Oe(),physicalName:"id",dataType:"BIGINT"}]}]};return C(Ra(T,{location:{...A},size:{width:220,height:140}})),ae},renameEntity(N,A){G(N)||C(Nr(N,A))},updateEntity(N,A){if(G(N))return;const ae=vr(N,A),T=o.logical.entities.find(me=>me.modelId===N),z=A.stereotype==="JPA_EMBEDDABLE"&&!!T&&T.stereotype!=="JPA_EMBEDDABLE",B=!!A.stereotype&&A.stereotype!=="JPA_EMBEDDABLE"&&!!T&&T.stereotype==="JPA_EMBEDDABLE";if(z&&T){const me=T.attributes.filter($=>$.identifier&&!$.derivedFrom).map($=>en(N,$.modelId,{identifier:!1})),Z=Ln({...o.logical,entities:o.logical.entities.map($=>$.modelId===N?{...$,stereotype:"JPA_EMBEDDABLE"}:$)},N,$=>$.map(D=>D.identifier&&!D.derivedFrom?{...D,identifier:!1}:D)),Q=Nl(Z,N),te=_k(o.logical,N),de=[ae,...me,...Q,...te];C(de.length>1?Ge("임베더블 변환",de):ae);return}if(B){const me=bk(o.logical,N),Z=[ae,...me];C(Z.length>1?Ge("엔터티 전환",Z):ae);return}C(ae)},moveEntity(N,A){G(N)||C(Nn(N,A))},resizeEntity(N,A){G(N)||C($r(N,A))},removeEntity(N){G(N)||C(Er(N))},setEntitySwatch(N,A){C(xr(N,A))},setEntityCollapsed(N,A){C(Ir(N,A))},setEntityLocked(N,A){C(Sr(N,A))},isEntityLocked(N){return G(N)},collapseAll(){C(Va(!0))},expandAll(){C(Va(!1))},setAttributeSwatch(N,A,ae){C(Zo(N,A,ae))},dragGroup(N,A,ae){J(N)||C(Ge("그룹 이동",_e(N,A,ae)))},resizeGroup(N,A){J(N)||C(Tr(N,A))},setGroupSwatch(N,A){C(Mr(N,A))},setGroupLocked(N,A){C(Br(N,A))},isGroupLocked(N){return J(N)},updateGroup(N,A){J(N)||C(Cr(N,A))},createGroup(N,A){if(!N.length)return null;const ae=[];for(const B of o.logical.groups)for(const me of N)B.memberEntityRefs.includes(me)&&ae.push(Jo(B.modelId,me));const T=Oe(),z={modelId:T,name:A?{ko:A}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...N]};return ae.push(Aa(z,$e(N))),C(Ge("그룹 생성",ae)),U.value=null,T},addEmptyGroup(N,A){const ae=Oe();return C(Aa({modelId:ae,name:A?{ko:A}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...N},size:{width:360,height:260}})),ae},removeGroup(N){J(N)||C(Rr(N))},dropEntity(N,A,ae){var B;if(G(N))return;const T=((B=o.logical.groups.find(me=>me.memberEntityRefs.includes(N)))==null?void 0:B.modelId)??null,z=[Nn(N,A)];T!==ae&&(T&&z.push(Jo(T,N)),ae&&z.push(Vr(ae,N))),C(Ge("이동",z))},ungroupEntity(N){const A=o.logical.groups.find(ae=>ae.memberEntityRefs.includes(N));A&&C(Jo(A.modelId,N))},dropNote(N,A,ae){var B;const T=((B=o.layout.groupLayouts.find(me=>{var Z;return(Z=me.memberNoteRefs)==null?void 0:Z.includes(N)}))==null?void 0:B.groupRef)??null,z=[Qn(N,A)];T!==ae&&(T&&z.push(ns(T,N)),ae&&z.push(ts(ae,N))),C(Ge("이동",z))},addPredefinedEmbed(N,A){if(G(N))return;const ae=a.value.find(Q=>Q.type===A),T=o.logical.entities.find(Q=>Q.modelId===N);if(!ae||!T)return;const z=T.attributes.reduce((Q,te)=>Math.max(Q,te.order),-1)+1,B=Oe(),me=ae.fields.map(()=>({modelId:Oe(),physicalName:"",dataType:""})),Z={modelId:B,name:ae.defaultName,type:ae.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:z,dbAttrs:me};return C(Vt(N,Z)),B},addAttribute(N,A={}){if(G(N))return A.modelId??"";const ae=o.logical.entities.find(de=>de.modelId===N),T=ae?ae.attributes.length:0,z=A.modelId??Oe(),B=A.name??`field${T}`,me={modelId:z,name:B,type:A.type??Ea,attrType:A.attrType??"NORMAL",identifier:A.identifier??!1,notNull:A.notNull??!1,order:T,dbAttrs:A.dbAttrs??[{modelId:Oe(),physicalName:B,dataType:"VARCHAR",length:255}],...A},Z=Vt(N,me),Q=Ln(o.logical,N,de=>[...de,me]),te=Pn(Q,N);return C(te.length?Ge("속성 추가",[Z,...te]):Z),z},addDivider(N){if(G(N))return"";const A=o.logical.entities.find(B=>B.modelId===N),ae=A?A.attributes.length:0,T=Oe();return C(Vt(N,{modelId:T,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:ae,dbAttrs:[]})),T},updateAttribute(N,A,ae){we(N,A,ae)},setAttributeGroupCode(N,A,ae){we(N,A,{groupCode:ae,type:ae?Kn:Ea})},setEmbedColumns(N,A,ae){var Q,te;if(G(N))return;const T=en(N,A,{dbAttrs:ae}),z=(Q=o.logical.entities.find(de=>de.modelId===N))==null?void 0:Q.attributes.find(de=>de.modelId===A),B=(te=z==null?void 0:z.embedded)==null?void 0:te.associationRef,me=B?o.logical.associations.find(de=>de.modelId===B):void 0,Z=[];me&&B&&(me.end1.legacyEmbedRaw&&Z.push(xn(B,"end1",{legacyEmbedRaw:void 0})),me.end2.legacyEmbedRaw&&Z.push(xn(B,"end2",{legacyEmbedRaw:void 0}))),C(Z.length?Ge("임베드 컬럼 수정",[T,...Z]):T)},removeAttribute(N,A){if(G(N))return;if(oi(o.logical,N,A)){g(Bd);return}const ae=$n(N,A),T=Ln(o.logical,N,B=>B.filter(me=>me.modelId!==A)),z=Pn(T,N);C(z.length?Ge("속성 삭제",[ae,...z]):ae)},removeAttributes(N,A){var Z;if(!A.length||G(N))return;const ae=A.filter(Q=>!oi(o.logical,N,Q));if(ae.length<A.length&&g(Bd),!ae.length)return;const T=ae.map(Q=>$n(N,Q)),z=new Set(ae),B=Ln(o.logical,N,Q=>Q.filter(te=>!z.has(te.modelId))),me=[...T,...Pn(B,N)];C(me.length===1?me[0]:Ge("속성 삭제",me)),((Z=U.value)==null?void 0:Z.kind)==="attribute"&&U.value.entityId===N&&(U.value=null)},setAttributeSwatches(N,A,ae){A.length&&(A.length===1?C(Zo(N,A[0],ae)):C(Ge("속성 색상",A.map(T=>Zo(N,T,ae)))))},reorderAttributes(N,A,ae){!A.length||G(N)||C(Ta(N,A,ae))},addIndex(N,A){G(N)||C(Hr(N,A))},updateIndex(N,A,ae){G(N)||C(Fr(N,A,ae))},removeIndex(N,A){G(N)||C(Gr(N,A))},addOperation(N,A={}){var me;if(G(N))return A.modelId??"";const ae=o.logical.entities.find(Z=>Z.modelId===N),T=((me=ae==null?void 0:ae.operations)==null?void 0:me.length)??0,z=A.modelId??Oe(),B={modelId:z,name:A.name??`method${T}`,visibility:A.visibility??"PACKAGE",order:T,...A};return C(Dr(N,B)),z},updateOperation(N,A,ae){G(N)||C(Or(N,A,ae))},removeOperation(N,A){G(N)||C(Lr(N,A))},reorderOperations(N,A,ae){!A.length||G(N)||C(Pr(N,A,ae))},setOperationSwatch(N,A,ae){C(zr(N,A,ae))},addAssociation(N,A,ae,T){if(G(N)||G(A))return"";const z=Oe(),B={modelId:z,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:ae},end2:{entityRef:A,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},me={...o.logical,associations:[...o.logical.associations,B]},Z=eo(me,A,Oe),Q=Z.add[0];Q&&(B.end2.attributeRef=Q.modelId);const te={associationRef:z,waypoints:[],sourceColumnRef:ae,targetColumnRef:(Q==null?void 0:Q.modelId)??T},de=Ma(B,te),$=Hi(A,Z);return C($.length?Ge("관계 추가",[de,...$]):de),z},addEmbedAssociation(N,A){if(G(N))return;const ae=o.logical.entities.find(M=>M.modelId===N),T=o.logical.entities.find(M=>M.modelId===A);if(!ae||!T||T.stereotype!=="JPA_EMBEDDABLE")return;const z=Oe(),B=Oe(),me=Oe(),Z=ae.attributes.reduce((M,X)=>Math.max(M,X.order),-1)+1,Q=Ld(T),te=M=>M&&M.charAt(0).toLowerCase()+M.slice(1),de=new Set(ae.attributes.map(M=>M.name)),$=te(T.name);let D=$;for(let M=2;de.has(D);M++)D=`${$}${M}`;const se={modelId:B,name:D,type:T.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:Z,dbAttrs:Q,embedded:{associationRef:z,embeddableRef:A}},R={modelId:z,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:me},end2:{entityRef:A,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:B}},q={associationRef:z,waypoints:[],sourceColumnRef:B,targetColumnRef:void 0};return C(Ge("임베드 추가",[Vt(N,se),Ma(R,q)])),z},setEmbedCollectionMode(N,A){if(be(N))return;const ae=o.logical.associations.find(te=>te.modelId===N);if(!ae)return;let T,z;for(const te of o.logical.entities){const de=te.attributes.find($=>{var D;return((D=$.embedded)==null?void 0:D.associationRef)===N&&$.attrType==="EMBED_OWN"});if(de){T=te.modelId,z=de;break}}if(!T||!z)return;const B=z.embedded.embeddableRef,me=ae.end2.entityRef===B?"end2":"end1",Z=ae[me],Q=Z.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(A==="COLLECTION"?Q:!Q))if(A==="COLLECTION")C(Ge("임베드 컬렉션 전환",[en(T,z.modelId,{dbAttrs:[]}),xn(N,me,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...Z.jpa,collectionType:"LIST"}})]));else{const te=o.logical.entities.find(de=>de.modelId===B);if(!te)return;C(Ge("임베드 단일 전환",[en(T,z.modelId,{dbAttrs:Ld(te)}),xn(N,me,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...Z.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(N){if(be(N))return;const A=o.logical.associations.find(me=>me.modelId===N),ae=Ur(N);if(!A){C(ae);return}for(const me of o.logical.entities){const Z=me.attributes.find(Q=>{var te;return((te=Q.embedded)==null?void 0:te.associationRef)===N});if(Z){C(Ge("임베드 삭제",[ae,$n(me.modelId,Z.modelId)]));return}}const T=A.end2.entityRef,z={...o.logical,associations:o.logical.associations.filter(me=>me.modelId!==N)},B=Nl(z,T);C(B.length?Ge("관계 삭제",[ae,...B]):ae)},setAssociationIdentifying(N,A){if(be(N))return;const ae=o.logical.associations.find(Z=>Z.modelId===N),T=Qo(N,{identifying:A});if(!ae||ae.identifying===A){C(T);return}const z=ae.end2.entityRef,B={...o.logical,associations:o.logical.associations.map(Z=>Z.modelId===N?{...Z,identifying:A}:Z)},me=Nl(B,z);C(me.length?Ge("식별 관계 변경",[T,...me]):T)},updateAssociationEnd(N,A,ae){be(N)||C(xn(N,A,ae))},moveWaypoint(N,A,ae){C(Yr(N,A,ae))},addWaypoint(N,A,ae){C(Xr(N,A,ae))},removeWaypoint(N,A){C(Wr(N,A))},clearWaypoints(N){C(qr(N))},addNote(N="메모",A={x:80,y:80}){const ae=Oe();return C(jr({modelId:ae,memo:N,geo:{location:{...A},size:{width:200,height:120}}})),ae},removeNote(N){C(Zr(N))},moveNote(N,A){C(Qn(N,A))},resizeNote(N,A){C(Jr(N,A))},setNoteMemo(N,A){C(Qr(N,A))},setNoteSwatch(N,A){C(es(N,A))},addNoteConnection(N,A){C(os(N,A))},removeNoteConnection(N,A){C(is(N,A))},moveNoteConnectionWaypoint(N,A,ae,T){C(as(N,A,ae,T))},addNoteConnectionWaypoint(N,A,ae,T){C(ls(N,A,ae,T))},removeNoteConnectionWaypoint(N,A,ae){C(rs(N,A,ae))},clearNoteConnectionWaypoints(N,A){C(ss(N,A))},autoLayout(){const N=tr(o.logical,o.layout);N.length&&C(Ge("자동 배치",N.map(A=>Nn(A.id,A.location))))},copy(){const N=U.value;if((N==null?void 0:N.kind)==="attribute"){const B=o.logical.entities.find(Z=>Z.modelId===N.entityId);if(!B)return;const me=[...B.attributes].sort((Z,Q)=>Z.order-Q.order).filter(Z=>N.ids.includes(Z.modelId));if(!me.length)return;ye.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:me}));return}const A=K.value;if(!A)return;const ae=o.logical.entities.find(B=>B.modelId===A),T=o.layout.entityLayouts.find(B=>B.entityRef===A);if(!ae)return;const z=(T==null?void 0:T.geo)??{location:{x:80,y:80},size:{width:220,height:140}};ye.value=JSON.parse(JSON.stringify({kind:"entity",entity:ae,geo:z}))},paste(){if(!oe.value)return;const N=ye.value;if(!N)return;if(N.kind==="attribute"){const T=K.value;if(!T)return;const z=o.logical.entities.find(de=>de.modelId===T);if(!z)return;const B=new Set(z.attributes.map(de=>de.name)),me=new Set(z.attributes.flatMap(de=>de.dbAttrs.map($=>$.physicalName))),Z=z.attributes.length,Q=[],te=N.attributes.map((de,$)=>{const D=JSON.parse(JSON.stringify(de));D.modelId=Oe();for(const se of D.dbAttrs)se.modelId=Oe();B.has(D.name)&&(D.name=`${D.name}_copy`);for(const se of D.dbAttrs)se.physicalName&&me.has(se.physicalName)&&(se.physicalName=`${se.physicalName}_copy`);return D.order=Z+$,Q.push(D.modelId),Vt(T,D)});C(te.length===1?te[0]:Ge("속성 붙여넣기",te)),U.value={kind:"attribute",entityId:T,ids:Q,anchor:Q[Q.length-1]};return}const A=gk(N.entity),ae={location:{x:N.geo.location.x+40,y:N.geo.location.y+40},size:{...N.geo.size}};C(Ra(A,ae)),U.value={kind:"entity",id:A.modelId}}};return Ce}const Fi=Symbol("groupHover"),Pd=Symbol("groupDrag"),zn=Symbol("relationHighlight"),wk={key:0,class:"em-sel","aria-hidden":"true"},Ek=["title","aria-expanded","disabled"],vk={class:"em-entity__stereotype"},Nk={key:1,class:"em-entity__name"},$k=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],xk=["onPointerdown"],Ik={key:1,class:"em-entity__divider-label"},Sk=["title"],Ck={class:"em-key-slot"},Rk={class:"em-key-slot"},Vk={key:0,class:"em-entity__type"},Ak=["onClick"],Tk={class:"em-entity__attrname"},Mk={class:"em-entity__type"},Bk=["data-op"],Dk=["onPointerdown"],Ok={class:"em-entity__op-vis","aria-hidden":"true"},Lk=["title"],Pk={key:4,class:"em-entity__footer"},zd=Ue(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=ie.useModal();function a(){o&&Ui(i,o,t.id)}const l=n.inject(Fi,null),r=n.inject(zn,null),s=n.computed(()=>!!o&&o.editable.value);function c(){l&&(l.value=t.data.groupRef??null)}function d(){r==null||r.setEntityHover(t.id)}function u(){r==null||r.setEntityHover(null)}const f=n.computed(()=>!!r&&r.primaryEntityIds.value.has(t.id)),h=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),p=n.computed(()=>{var Z;return((Z=o==null?void 0:o.selection.value)==null?void 0:Z.kind)==="entity"&&o.selection.value.id===t.id}),m=n.computed(()=>!!t.selected&&!p.value),b=n.computed(()=>{var Z;return o&&((Z=o.selectedAttr.value)==null?void 0:Z.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),y=n.computed(()=>b.value.size>0);function _(Z,Q){const te=Q.shiftKey?"range":Q.metaKey||Q.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,Z.modelId,te)}const V=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!p.value),g=n.computed(()=>t.data.entity),v=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),ee=n.computed(()=>t.data.collapsed??!1),x=n.computed(()=>t.data.locked??!1);function O(){s.value&&(o==null||o.setEntityCollapsed(t.id,!ee.value))}const P=n.computed(()=>v.value==="PHYSICAL"||v.value==="LOGICAL_PHYSICAL"),H=n.computed(()=>{const Z=v.value==="PHYSICAL"||v.value==="LOGICAL_PHYSICAL",Q={};for(const te of g.value.attributes){const de=te.attrType.startsWith("RELATION")&&te.dbAttrs.length>0;Q[te.modelId]={pk:te.identifier,fk:de&&Z,required:te.notNull&&!te.identifier}}return Q});function ne(Z){if(!Z)return"";const Q=[];return Z.pk&&Z.fk?Q.push("PFK (식별 외래키)"):Z.pk?Q.push("PK (기본키)"):Z.fk&&Q.push("FK (외래키)"),Z.required&&Q.push("필수 (NOT NULL)"),Q.join(" · ")}const ce=n.computed(()=>{const Z=wl(at(t.data.style)),Q={};return Z&&(Q["--em-header-bg"]=Z.bar,Q["--em-header-fg"]=Z.barOn),Q});function L(Z){var Q,te;return(te=wl(at((Q=t.data.attributeStyles)==null?void 0:Q[Z.modelId])))==null?void 0:te.text}const oe=n.computed(()=>[...g.value.operations??[]].sort((Z,Q)=>Z.order-Q.order)),k=n.computed(()=>v.value==="CLASS"&&oe.value.length>0),Y={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function S(Z){return Z?Y[Z]:"~"}function F(Z){var Q,te;return(te=wl(at((Q=t.data.operationStyles)==null?void 0:Q[Z.modelId])))==null?void 0:te.text}function U(Z,Q,te){switch(v.value){case"CLASS":return[{text:Z}];case"PHYSICAL":return[{text:te||Z}];case"LOGICAL":return[Q?{text:Q}:{text:"(논리명)",missing:!0}];default:{const de=Q?{text:Q}:{text:"(논리명)",missing:!0};return te?[de,{text:` · ${te}`}]:[de]}}}function le(Z){var Q,te,de;return E(Z)?[{text:Z.name}]:U(Z.name,(te=(Q=Z.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:te.ko,((de=Z.dbAttrs[0])==null?void 0:de.physicalName)??"")}function E(Z){return Z.attrType.startsWith("EMBED")&&Z.dbAttrs.length>0}function K(Z){return Z.attrType==="DIVIDER"}function re(Z){if(Z.attrType!=="EMBED_PREDEF")return Z.dbAttrs;const Q=o==null?void 0:o.embeddableCatalog.value.find(de=>de.type===Z.type);if(!Q)return Z.dbAttrs;const te=qn(Wo(g.value,(o==null?void 0:o.state.logical.entities)??[]));return Z.dbAttrs.map((de,$)=>{const D=Q.fields[$],se=Ko(de,te);return se?{...de,physicalName:se.physicalName,logicalName:de.logicalName??(D==null?void 0:D.logicalName),dataType:de.dataType||(D==null?void 0:D.dataType)||""}:D?{...de,physicalName:de.physicalName||D.physicalName,logicalName:de.logicalName??D.logicalName,dataType:de.dataType||D.dataType,length:de.length??D.length}:de})}function pe(Z){var Q;return U(Z.physicalName,(Q=Z.logicalName)==null?void 0:Q.ko,Z.physicalName)}function ye(Z){const Q=pr(Z,(o==null?void 0:o.state.logical.associations)??[]);return Na(v.value,Z,Q)}const ue=n.computed(()=>{var Z,Q,te;return U(g.value.name,(Q=(Z=g.value.table)==null?void 0:Z.logicalName)==null?void 0:Q.ko,((te=g.value.table)==null?void 0:te.physicalName)??"")}),fe=n.ref(!1),ge=n.ref(""),Ee=n.ref(null);async function Re(){var Z,Q;s.value&&(ge.value=g.value.name,fe.value=!0,await n.nextTick(),(Z=Ee.value)==null||Z.focus(),(Q=Ee.value)==null||Q.select())}function Ie(){if(!fe.value)return;fe.value=!1;const Z=ge.value.trim();Z&&Z!==g.value.name&&(o==null||o.renameEntity(t.id,Z))}function he(){o==null||o.addAttribute(t.id)}function j(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:W,findNode:w}=ze(),I=n.ref(null),C=n.computed(()=>{const Z=I.value??t.data.size;return Z?{width:`${Z.width}px`,minHeight:`${Z.height}px`}:void 0});let G=null;function J(Z){var de,$,D;if(!s.value)return;Z.stopPropagation();const Q=(de=w(t.id))==null?void 0:de.dimensions,te=W({x:Z.clientX,y:Z.clientY});G={fx:te.x,fy:te.y,w:(Q==null?void 0:Q.width)??(($=t.data.size)==null?void 0:$.width)??200,h:(Q==null?void 0:Q.height)??((D=t.data.size)==null?void 0:D.height)??120},Z.target.setPointerCapture(Z.pointerId)}function be(Z){if(!G)return;const Q=W({x:Z.clientX,y:Z.clientY});I.value={width:Math.max(40,G.w+(Q.x-G.fx)),height:Math.max(40,G.h+(Q.y-G.fy))}}function we(Z){var Q,te,de;if(G&&I.value&&o){const $=(Q=w(t.id))==null?void 0:Q.dimensions;o.resizeEntity(t.id,{width:Math.round(($==null?void 0:$.width)??I.value.width),height:Math.round(($==null?void 0:$.height)??I.value.height)})}G=null,I.value=null,(de=(te=Z.target).releasePointerCapture)==null||de.call(te,Z.pointerId)}const $e=n.ref(null),_e=n.ref(null);function Ce(Z,Q){if(!s.value)return;Q.stopPropagation(),Q.preventDefault();const te=b.value,de=te.has(Z.modelId)?new Set(te):new Set([Z.modelId]);_e.value={ids:de,dropIndex:-1,lineY:0},Q.target.setPointerCapture(Q.pointerId)}function Te(Z){if(!_e.value||!$e.value)return;const Q=Array.from($e.value.querySelectorAll(".em-entity__row"));if(!Q.length)return;let te=Q.length;for(let D=0;D<Q.length;D++){const se=Q[D].getBoundingClientRect();if(Z.clientY<se.top+se.height/2){te=D;break}}const de=Q[Q.length-1],$=te<Q.length?Q[te].offsetTop:de.offsetTop+de.offsetHeight;_e.value={..._e.value,dropIndex:te,lineY:$}}function Be(){const Z=_e.value;if(_e.value=null,!Z||Z.dropIndex<0)return;const Q=g.value.attributes,te=Q.filter(R=>Z.ids.has(R.modelId)).map(R=>R.modelId),de=Q.filter((R,q)=>Z.ids.has(R.modelId)&&q<Z.dropIndex).length,$=Z.dropIndex-de,D=Q.filter(R=>!Z.ids.has(R.modelId)).map(R=>R.modelId);[...D.slice(0,$),...te,...D.slice($)].join(",")!==Q.map(R=>R.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,te,$))}function N(){_e.value=null}const A=n.ref(null),ae=n.ref(null);function T(Z,Q){s.value&&(Q.stopPropagation(),Q.preventDefault(),ae.value={id:Z.modelId,dropIndex:-1,lineY:0},Q.target.setPointerCapture(Q.pointerId))}function z(Z){if(!ae.value||!A.value)return;const Q=Array.from(A.value.querySelectorAll(".em-entity__op-row"));if(!Q.length)return;let te=Q.length;for(let D=0;D<Q.length;D++){const se=Q[D].getBoundingClientRect();if(Z.clientY<se.top+se.height/2){te=D;break}}const de=Q[Q.length-1],$=te<Q.length?Q[te].offsetTop:de.offsetTop+de.offsetHeight;ae.value={...ae.value,dropIndex:te,lineY:$}}function B(){const Z=ae.value;if(ae.value=null,!Z||Z.dropIndex<0)return;const te=oe.value.findIndex($=>$.modelId===Z.id);if(te<0)return;const de=Z.dropIndex-(te<Z.dropIndex?1:0);de!==te&&(o==null||o.reorderOperations(t.id,[Z.id],de))}function me(){ae.value=null}return(Z,Q)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":h.value,"is-dimmed":V.value,"is-selected":p.value,"is-multi-selected":m.value,"has-focused-attr":y.value,"is-locked":x.value}]),style:n.normalizeStyle(C.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[p.value?(n.openBlock(),n.createElementBlock("div",wk,[...Q[7]||(Q[7]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("header",{class:"em-entity__header",style:n.normalizeStyle(ce.value),onDblclick:n.withModifiers(Re,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:ee.value?"펼치기":"접기","aria-expanded":!ee.value,disabled:!s.value,onClick:n.withModifiers(O,["stop"]),onPointerdown:Q[0]||(Q[0]=n.withModifiers(()=>{},["stop"])),onDblclick:Q[1]||(Q[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(ee.value?"▸":"▾"),41,Ek),n.createElementVNode("span",vk,"«"+n.toDisplayString(g.value.stereotype)+"»",1),fe.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ee,"onUpdate:modelValue":Q[2]||(Q[2]=te=>ge.value=te),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Ie,["enter"]),Q[3]||(Q[3]=n.withKeys(te=>fe.value=!1,["esc"]))],onBlur:Ie,onPointerdown:Q[4]||(Q[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ge.value]]):(n.openBlock(),n.createElementBlock("span",Nk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ue.value,(te,de)=>(n.openBlock(),n.createElementBlock("span",{key:de,class:n.normalizeClass({"em-entity__missing":te.missing})},n.toDisplayString(te.text),3))),128))])),x.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)],36),ee.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$e,class:"em-entity__attrs"},[_e.value&&_e.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${_e.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value.attributes,te=>{var de,$,D,se;return n.openBlock(),n.createElementBlock(n.Fragment,{key:te.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(te.modelId),"is-dragging":(de=_e.value)==null?void 0:de.ids.has(te.modelId),"is-embed":E(te),"is-divider":K(te),nodrag:K(te)&&s.value}]),"data-attr":te.modelId,onClick:n.withModifiers(R=>_(te,R),["stop"]),onPointerdown:R=>K(te)?Ce(te,R):void 0,onPointermove:R=>K(te)?Te(R):void 0,onPointerup:R=>K(te)?Be():void 0,onPointercancel:R=>K(te)?N():void 0},[s.value&&!K(te)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:R=>Ce(te,R),onPointermove:Te,onPointerup:Be,onPointercancel:N,onClick:Q[5]||(Q[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,xk)):n.createCommentVNode("",!0),K(te)?(n.openBlock(),n.createElementBlock("span",Ik,n.toDisplayString(te.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(dn),{id:`l:${te.modelId}`,type:"target",position:n.unref(Se).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ne(H.value[te.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Ck,[($=H.value[te.modelId])!=null&&$.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(D=H.value[te.modelId])!=null&&D.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",Rk,[E(te)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(se=H.value[te.modelId])!=null&&se.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Sk),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:L(te)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le(te),(R,q)=>(n.openBlock(),n.createElementBlock("span",{key:q,class:n.normalizeClass({"em-entity__missing":R.missing})},n.toDisplayString(R.text),3))),128))],4),ye(te)?(n.openBlock(),n.createElementBlock("span",Vk,n.toDisplayString(ye(te)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(dn),{id:`r:${te.modelId}`,type:"source",position:n.unref(Se).Right,class:"em-handle"},null,8,["id","position"])],64))],42,$k),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(E(te)&&P.value?re(te):[],R=>(n.openBlock(),n.createElementBlock("li",{key:`${te.modelId}:${R.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(te.modelId)}]),onClick:n.withModifiers(q=>_(te,q),["stop"])},[Q[8]||(Q[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",Tk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe(R),(q,M)=>(n.openBlock(),n.createElementBlock("span",{key:M,class:n.normalizeClass({"em-entity__missing":q.missing})},n.toDisplayString(q.text),3))),128))]),n.createElementVNode("span",Mk,n.toDisplayString(R.dataType),1)],10,Ak))),128))],64)}),128))],512)),!ee.value&&k.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:A,class:"em-entity__ops"},[ae.value&&ae.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${ae.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,te=>{var de;return n.openBlock(),n.createElementBlock("li",{key:te.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((de=ae.value)==null?void 0:de.id)===te.modelId}]),"data-op":te.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:$=>T(te,$),onPointermove:z,onPointerup:B,onPointercancel:me,onClick:Q[6]||(Q[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Dk)):n.createCommentVNode("",!0),n.createElementVNode("span",Ok,n.toDisplayString(S(te.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:F(te)})},n.toDisplayString(te.name)+"()",5)],10,Bk)}),128))],512)):oe.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${oe.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(oe.value.length)+"개",1)],8,Lk)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",Pk,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:he},"+ 속성"),Q[9]||(Q[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:j},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!fe.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:J,onPointermove:be,onPointerup:we},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3a3c0b9d"]]),zk={key:0,class:"em-sel","aria-hidden":"true"},Uk={class:"em-group__label"},Hk={class:"em-group__name"},Fk={key:0,class:"em-group__pkg"},Gk={key:1,class:"em-group__flag"},Ud=Ue(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>t.data.locked??!1),a=n.computed(()=>at(t.data.style)),l=n.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),r=n.inject(pn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var H;return!!t.id&&((H=r==null?void 0:r.selection.value)==null?void 0:H.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(Fi,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),h=n.inject(zn,null);function p(){t.id&&(h==null||h.setGroupHover(t.id))}function m(){h==null||h.setGroupHover(null)}const b=n.computed(()=>!!h&&h.hoverGroupId.value===t.id),y=n.computed(()=>!!h&&h.hoverGroupId.value!==null&&h.hoverGroupId.value!==t.id),{screenToFlowCoordinate:_,findNode:V}=ze();let g=null,v=null;function ee(H){var L;if(!t.id||!s.value)return;H.stopPropagation();const ne=((L=V(t.id))==null?void 0:L.dimensions)??{width:400,height:300},ce=_({x:H.clientX,y:H.clientY});g={fx:ce.x,fy:ce.y,w:ne.width,h:ne.height},H.target.setPointerCapture(H.pointerId)}function x(H){if(!g||!t.id)return;const ne=_({x:H.clientX,y:H.clientY});v={width:Math.max(160,g.w+(ne.x-g.fx)),height:Math.max(120,g.h+(ne.y-g.fy))};const ce=V(t.id);ce&&(ce.style={width:`${v.width}px`,height:`${v.height}px`})}function O(H){var ne,ce;g&&v&&t.id&&r&&r.resizeGroup(t.id,v),g=null,v=null,(ce=(ne=H.target).releasePointerCapture)==null||ce.call(ne,H.pointerId)}const P=n.computed(()=>{const H=o.value.name;return(H==null?void 0:H.ko)||(H==null?void 0:H.en)||(H==null?void 0:H.ja)||(H==null?void 0:H.zh)||o.value.packageName||"그룹"});return(H,ne)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":b.value,"is-dimmed":y.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:p,onMouseleave:m},[c.value?(n.openBlock(),n.createElementBlock("div",zk,[...ne[0]||(ne[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",Uk,[n.createElementVNode("span",Hk,n.toDisplayString(P.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Fk,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",Gk,"DDL 제외")):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-group__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)]),s.value&&!i.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:ee,onPointermove:x,onPointerup:O},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),Yk={key:0,class:"em-sel","aria-hidden":"true"},Wk={key:2,class:"em-note__text"},Hd=Ue(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=n.inject(Fi,null),a=n.inject(zn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>at(l.value.style)),c=n.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=t.data.groupRef??null)}function u(){a==null||a.setNoteHover(t.id)}function f(){a==null||a.setNoteHover(null)}const h=n.computed(()=>{var k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===t.id}),p=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!h.value),m=n.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===t.id}),b=n.computed(()=>!!t.selected&&!m.value),y=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!m.value),_=[{id:"n-top",pos:Se.Top},{id:"n-right",pos:Se.Right},{id:"n-bottom",pos:Se.Bottom},{id:"n-left",pos:Se.Left}],V=n.ref(!1),g=n.ref(""),v=n.ref(null);async function ee(){var k;r.value&&(g.value=l.value.memo,V.value=!0,await n.nextTick(),(k=v.value)==null||k.focus())}function x(){V.value&&(V.value=!1,g.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,g.value)))}const{screenToFlowCoordinate:O,findNode:P}=ze();let H=null,ne=null;function ce(k){var F;if(!r.value)return;k.stopPropagation();const Y=((F=P(t.id))==null?void 0:F.dimensions)??l.value.geo.size,S=O({x:k.clientX,y:k.clientY});H={fx:S.x,fy:S.y,w:Y.width,h:Y.height},k.target.setPointerCapture(k.pointerId)}function L(k){if(!H)return;const Y=O({x:k.clientX,y:k.clientY});ne={width:Math.max(140,H.w+(Y.x-H.fx)),height:Math.max(60,H.h+(Y.y-H.fy))};const S=P(t.id);S&&(S.style={width:`${ne.width}px`,height:`${ne.height}px`})}function oe(k){var Y,S;H&&ne&&o&&o.resizeNote(t.id,ne),H=null,ne=null,(S=(Y=k.target).releasePointerCapture)==null||S.call(Y,k.pointerId)}return(k,Y)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":p.value,"is-dimmed":y.value,"is-selected":m.value,"is-multi-selected":b.value}]),style:n.normalizeStyle(c.value),onDblclick:ee,onPointerdown:d,onMouseenter:u,onMouseleave:f},[m.value?(n.openBlock(),n.createElementBlock("div",Yk,[...Y[4]||(Y[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),V.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:v,"onUpdate:modelValue":Y[0]||(Y[0]=S=>g.value=S),class:"em-note__edit nodrag",onBlur:x,onKeydown:Y[1]||(Y[1]=n.withKeys(S=>V.value=!1,["esc"])),onPointerdown:Y[2]||(Y[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,g.value]]):(n.openBlock(),n.createElementBlock("div",Wk,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,S=>n.createVNode(n.unref(dn),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:Y[3]||(Y[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!V.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:ce,onPointermove:L,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Kk=20,qk=22,Xk=7,jk=22,Fd=31,Gd=7,Zk=20,Yd=11,Wd=11,Jk=Fd+Gd;function Qk(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function ew(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Gi(e,t,o){const i=t.x-e.x,a=t.y-e.y,l=Math.hypot(i,a)||1;return{x:e.x+i*o/l,y:e.y+a*o/l}}function Kd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Yi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function qd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:Kd(e,t);return[Yi(o,a,l-Math.PI/2),Yi(o,a,l+Math.PI/2)]}function Xd(e,t,o,i){const a=t*180/Math.PI,r=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(r)*o+e.x,y:Math.cos(r)*o+e.y}}function jd(e,t,o,i){const a=[],l=[],r=[];if(e.x===t.x&&e.y===t.y)return{lines:a,circles:l,polygons:r};if(i==="db"){const c=Gi(e,t,Kk),[d,u]=qd(e,t,c,qk);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),Qk(o.multiplicity)){const f=Gi(e,t,Fd);l.push({cx:f.x,cy:f.y,r:Gd})}if(ew(o.multiplicity)){const f=Gi(e,t,Xk),[h,p]=qd(e,t,f,jk);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:a,circles:l,polygons:r}}let s=e;if(o.composition){const c=Gi(e,t,Zk),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Kd(e,t),f=Yi(d,Yd/2,u-Math.PI/2),h=Yi(d,Yd/2,u+Math.PI/2);r.push({points:[e,f,c,h]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=Xd(s,c,Wd,!0),u=Xd(s,c,Wd,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:l,polygons:r}}const Zd=200,Jd=120,$l=24;function Qd(e){var a,l;if(!e)return{x:0,y:0,width:Zd,height:Jd};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Zd,i=((l=e.dimensions)==null?void 0:l.height)||Jd;return{x:t.x,y:t.y,width:o,height:i}}function eu(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function tu(e){const t=n.computed(()=>Qd(e.sourceNode())),o=n.computed(()=>Qd(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var p,m;const d=t.value,u=d.x+d.width;let f=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,h=((m=e.targetRowY)==null?void 0:m.call(e))??d.y+d.height*2/3;if(Math.abs(h-f)<$l){const b=(f+h)/2;f=b-$l/2,h=b+$l/2}return{source:{x:u,y:f},target:{x:u,y:h}}}),l=n.computed(()=>e.waypoints()[0]??eu(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??eu(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ya(t.value,d,l.value.x):ha(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ya(o.value,d,r.value.x):ha(o.value,r.value)});return{source:n.computed(()=>i.value?a.value.source:s.value.point),target:n.computed(()=>i.value?a.value.target:c.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":c.value.side),isSelf:i}}const xl=Symbol("waypointController"),tw=["d"],nw=["d"],ow=["d"],iw=["x1","y1","x2","y2"],aw=["cx","cy","r"],lw=["x","y"],rw=["x","y"],sw=["cx","cy","onDblclick"],cw=["x","y","onPointerdown","onDblclick"],nu=Ue(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=ze(),i=n.inject(xl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Pd,null),s=n.inject(zn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var he;return((he=a==null?void 0:a.selection.value)==null?void 0:he.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),f=n.computed(()=>{const he=r==null?void 0:r.value;if(!he||!a)return null;const j=a.resolved.value.entities,W=I=>{var C;return(C=j.find(G=>G.entity.modelId===I))==null?void 0:C.groupRef},w=t.data.association;return W(w.end1.entityRef)===he.groupId&&W(w.end2.entityRef)===he.groupId?{dx:he.dx,dy:he.dy}:null}),h=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),p=n.ref(-1),m=n.ref({x:0,y:0}),b=n.computed(()=>{const he=f.value;return h.value.map((j,W)=>W===p.value?m.value:he?{x:j.x+he.dx,y:j.y+he.dy}:j)}),y=n.computed(()=>{var he;return!!((he=t.sourceNode.data)!=null&&he.collapsed)}),_=n.computed(()=>{var he;return!!((he=t.targetNode.data)!=null&&he.collapsed)}),{source:V,target:g,sourceSide:v,targetSide:ee,isSelf:x}=tu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>b.value,sourceRowY:()=>t.data.sourceColumnRef&&!y.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),O=Jk+4,P=n.computed(()=>x.value?er(V.value,g.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?fa(V.value,v.value,b.value,g.value,ee.value,O):pa(V.value,b.value,g.value)),H=n.computed(()=>x.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ma(V.value,v.value,b.value,g.value,ee.value,O):ga(V.value,b.value,g.value).map((he,j)=>({point:he,segIndex:j}))),ne=n.computed(()=>x.value||!l.value?[]:b.value);function ce(he){switch(he){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function L(he,j){p.value=he,m.value={...h.value[he]},j.target.setPointerCapture(j.pointerId),j.stopPropagation()}function oe(he){if(p.value<0)return;const j=o({x:he.clientX,y:he.clientY});m.value={x:j.x,y:j.y}}function k(he){var j,W;p.value>=0&&i&&i.movePoint(t.id,p.value,{...m.value}),p.value=-1,(W=(j=he.target).releasePointerCapture)==null||W.call(j,he.pointerId)}function Y(he,j){j.stopPropagation(),i==null||i.removePoint(t.id,he)}function S(he,j){if(!i)return;const W=o({x:j.clientX,y:j.clientY});i.insertPoint(t.id,he,{x:W.x,y:W.y})}const F=n.computed(()=>ce(t.data.association.end1.multiplicity)),U=n.computed(()=>ce(t.data.association.end2.multiplicity)),le=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),E=n.computed(()=>le.value==="class"),K=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const he=Yn(v.value);return{x:V.value.x+he.x*10,y:V.value.y+he.y*10}}return b.value[0]??g.value}),re=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const j=Yn(ee.value);return{x:g.value.x+j.x*10,y:g.value.y+j.y*10}}const he=b.value;return he[he.length-1]??V.value}),pe=n.computed(()=>{const he=t.data.association;return{multiplicity:he.end1.multiplicity,navigable:he.end1.navigable,composition:he.end1.composition,otherNavigable:he.end2.navigable}}),ye=n.computed(()=>{const he=t.data.association;return{multiplicity:he.end2.multiplicity,navigable:he.end2.navigable,composition:he.end2.composition,otherNavigable:he.end1.navigable}}),ue=n.computed(()=>jd(V.value,K.value,pe.value,le.value)),fe=n.computed(()=>jd(g.value,re.value,ye.value,le.value)),ge=n.computed(()=>[...ue.value.lines,...fe.value.lines]),Ee=n.computed(()=>[...ue.value.circles,...fe.value.circles]),Re=n.computed(()=>[...ue.value.polygons,...fe.value.polygons].map(he=>`M${he.points.map(j=>`${j.x},${j.y}`).join(" L")} Z`)),Ie=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(he,j)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:P.value,fill:"none",class:"em-edge__hit"},null,8,tw),n.createElementVNode("path",{d:P.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,nw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Re.value,(W,w)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${w}`,d:W,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ie.value])},null,10,ow))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ge.value,(W,w)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${w}`,x1:W.x1,y1:W.y1,x2:W.x2,y2:W.y2,class:n.normalizeClass(["em-edge__marker",Ie.value])},null,10,iw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ee.value,(W,w)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${w}`,cx:W.cx,cy:W.cy,r:W.r,class:n.normalizeClass(["em-edge__marker",Ie.value])},null,10,aw))),128)),E.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(V).x+8,y:n.unref(V).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(F.value),11,lw),n.createElementVNode("text",{x:n.unref(g).x-8,y:n.unref(g).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(U.value),11,rw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(H.value,(W,w)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${w}`,cx:W.point.x,cy:W.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(I=>S(W.segIndex,I),["stop"])},null,42,sw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.value,(W,w)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${w}`,x:W.x-5,y:W.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:I=>L(w,I),onPointermove:oe,onPointerup:k,onDblclick:I=>Y(w,I)},null,42,cw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Ot=(e=>(e.Lines="lines",e.Dots="dots",e))(Ot||{});const ou=function({dimensions:e,size:t,color:o}){return n.h("path",{stroke:o,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},iu=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Ot.Lines+"",Ot.Dots+"";const dw={[Ot.Dots]:"#81818a",[Ot.Lines]:"#eee"},uw=["id","x","y","width","height","patternTransform"],fw={key:2,height:"100",width:"100"},mw=["fill"],pw=["x","y","fill"],hw={name:"Background",compatConfig:{MODE:3}},yw=n.defineComponent({...hw,props:{id:{},variant:{default:()=>Ot.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:t,viewport:o}=ze(),i=n.computed(()=>{const r=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*r||1,c*r||1],u=e.size*r,[f,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[f*r||1+d[0]/2,h*r||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),l=n.toRef(()=>e.color||e.patternColor||dw[e.variant||Ot.Dots]);return(r,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${r.height>100?100:r.height}%`,width:`${r.width>100?100:r.width}%`})},[n.renderSlot(r.$slots,"pattern-container",{id:a.value},()=>[n.createElementVNode("pattern",{id:a.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[n.renderSlot(r.$slots,"pattern",{},()=>[r.variant===n.unref(Ot).Lines?(n.openBlock(),n.createBlock(n.unref(ou),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Ot).Dots?(n.openBlock(),n.createBlock(n.unref(iu),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",fw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,mw)])):n.createCommentVNode("",!0)])],8,uw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,pw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),gw={name:"ControlButton",compatConfig:{MODE:3}},bw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},_w={type:"button",class:"vue-flow__controls-button"};function kw(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",_w,[n.renderSlot(e.$slots,"default")])}const hn=bw(gw,[["render",kw]]),ww={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Ew=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function vw(e,t){return n.openBlock(),n.createElementBlock("svg",ww,Ew)}const Nw={render:vw},$w={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},xw=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Iw(e,t){return n.openBlock(),n.createElementBlock("svg",$w,xw)}const Sw={render:Iw},Cw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Rw=[n.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 Vw(e,t){return n.openBlock(),n.createElementBlock("svg",Cw,Rw)}const Aw={render:Vw},Tw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Mw=[n.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 Bw(e,t){return n.openBlock(),n.createElementBlock("svg",Tw,Mw)}const Dw={render:Bw},Ow={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Lw=[n.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 Pw(e,t){return n.openBlock(),n.createElementBlock("svg",Ow,Lw)}const zw={render:Pw},Uw={name:"Controls",compatConfig:{MODE:3}},Hw=n.defineComponent({...Uw,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Rc.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:l,zoomIn:r,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:f}=ze(),h=n.toRef(()=>o.value||i.value||a.value),p=n.toRef(()=>d.value.zoom<=u.value),m=n.toRef(()=>d.value.zoom>=f.value);function b(){r(),t("zoomIn")}function y(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function V(){l(!h.value),t("interactionChange",!h.value)}return(g,v)=>(n.openBlock(),n.createBlock(n.unref(Sd),{class:"vue-flow__controls",position:g.position},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"top"),g.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(g.$slots,"control-zoom-in",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomin",disabled:m.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Nw))))])]),_:3},8,["disabled"])]),n.renderSlot(g.$slots,"control-zoom-out",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:y},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Sw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),g.showFitView?n.renderSlot(g.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hn,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Aw))))])]),_:3})]):n.createCommentVNode("",!0),g.showInteractive?n.renderSlot(g.$slots,"control-interactive",{key:2},()=>[g.showInteractive?(n.openBlock(),n.createBlock(hn,{key:0,class:"vue-flow__controls-interactive",onClick:V},{default:n.withCtx(()=>[h.value?n.renderSlot(g.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(zw))))]):n.createCommentVNode("",!0),h.value?n.createCommentVNode("",!0):n.renderSlot(g.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Dw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(g.$slots,"default")]),_:3},8,["position"]))}});var Fw={value:()=>{}};function Il(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Wi(o)}function Wi(e){this._=e}function Gw(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Wi.prototype=Il.prototype={constructor:Wi,on:function(e,t){var o=this._,i=Gw(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Yw(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<r;)if(a=(e=i[l]).type)o[a]=au(o[a],e.name,t);else if(t==null)for(a in o)o[a]=au(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Wi(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function Yw(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function au(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Fw,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Sl="http://www.w3.org/1999/xhtml";const lu={svg:"http://www.w3.org/2000/svg",xhtml:Sl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ki(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),lu.hasOwnProperty(t)?{space:lu[t],local:e}:e}function Ww(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Sl&&t.documentElement.namespaceURI===Sl?t.createElement(e):t.createElementNS(o,e)}}function Kw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ru(e){var t=Ki(e);return(t.local?Kw:Ww)(t)}function qw(){}function Cl(e){return e==null?qw:function(){return this.querySelector(e)}}function Xw(e){typeof e!="function"&&(e=Cl(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=new Array(r),c,d,u=0;u<r;++u)(c=l[u])&&(d=e.call(c,c.__data__,u,l))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new ft(i,this._parents)}function jw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Zw(){return[]}function su(e){return e==null?Zw:function(){return this.querySelectorAll(e)}}function Jw(e){return function(){return jw(e.apply(this,arguments))}}function Qw(e){typeof e=="function"?e=Jw(e):e=su(e);for(var t=this._groups,o=t.length,i=[],a=[],l=0;l<o;++l)for(var r=t[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),a.push(c));return new ft(i,a)}function cu(e){return function(){return this.matches(e)}}function du(e){return function(t){return t.matches(e)}}var eE=Array.prototype.find;function tE(e){return function(){return eE.call(this.children,e)}}function nE(){return this.firstElementChild}function oE(e){return this.select(e==null?nE:tE(typeof e=="function"?e:du(e)))}var iE=Array.prototype.filter;function aE(){return Array.from(this.children)}function lE(e){return function(){return iE.call(this.children,e)}}function rE(e){return this.selectAll(e==null?aE:lE(typeof e=="function"?e:du(e)))}function sE(e){typeof e!="function"&&(e=cu(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new ft(i,this._parents)}function uu(e){return new Array(e.length)}function cE(){return new ft(this._enter||this._groups.map(uu),this._parents)}function qi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}qi.prototype={constructor:qi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function dE(e){return function(){return e}}function uE(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new qi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function fE(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(h[s]=p=r.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<f;++s)p=r.call(e,l[s],s,l)+"",(c=d.get(p))?(i[s]=c,c.__data__=l[s],d.delete(p)):o[s]=new qi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function mE(e){return e.__data__}function pE(e,t){if(!arguments.length)return Array.from(this,mE);var o=t?fE:uE,i=this._parents,a=this._groups;typeof e!="function"&&(e=dE(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],h=f.length,p=hE(e.call(u,u&&u.__data__,d,i)),m=p.length,b=s[d]=new Array(m),y=r[d]=new Array(m),_=c[d]=new Array(h);o(u,f,b,y,_,p,t);for(var V=0,g=0,v,ee;V<m;++V)if(v=b[V]){for(V>=g&&(g=V+1);!(ee=y[g])&&++g<m;);v._next=ee||null}}return r=new ft(r,i),r._enter=s,r._exit=c,r}function hE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yE(){return new ft(this._exit||this._groups.map(uu),this._parents)}function gE(e,t,o){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?l.remove():o(l),i&&a?i.merge(a).order():a}function bE(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,h=s[c]=new Array(f),p,m=0;m<f;++m)(p=d[m]||u[m])&&(h[m]=p);for(;c<a;++c)s[c]=o[c];return new ft(s,this._parents)}function _E(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function kE(e){e||(e=wE);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var o=this._groups,i=o.length,a=new Array(i),l=0;l<i;++l){for(var r=o[l],s=r.length,c=a[l]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new ft(a,this._parents).order()}function wE(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function EE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function vE(){return Array.from(this)}function NE(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function $E(){let e=0;for(const t of this)++e;return e}function xE(){return!this.node()}function IE(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],l=0,r=a.length,s;l<r;++l)(s=a[l])&&e.call(s,s.__data__,l,a);return this}function SE(e){return function(){this.removeAttribute(e)}}function CE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function RE(e,t){return function(){this.setAttribute(e,t)}}function VE(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function AE(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function TE(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function ME(e,t){var o=Ki(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?CE:SE:typeof t=="function"?o.local?TE:AE:o.local?VE:RE)(o,t))}function fu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function BE(e){return function(){this.style.removeProperty(e)}}function DE(e,t,o){return function(){this.style.setProperty(e,t,o)}}function OE(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function LE(e,t,o){return arguments.length>1?this.each((t==null?BE:typeof t=="function"?OE:DE)(e,t,o??"")):Un(this.node(),e)}function Un(e,t){return e.style.getPropertyValue(t)||fu(e).getComputedStyle(e,null).getPropertyValue(t)}function PE(e){return function(){delete this[e]}}function zE(e,t){return function(){this[e]=t}}function UE(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function HE(e,t){return arguments.length>1?this.each((t==null?PE:typeof t=="function"?UE:zE)(e,t)):this.node()[e]}function mu(e){return e.trim().split(/^|\s+/)}function Rl(e){return e.classList||new pu(e)}function pu(e){this._node=e,this._names=mu(e.getAttribute("class")||"")}pu.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function hu(e,t){for(var o=Rl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function yu(e,t){for(var o=Rl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function FE(e){return function(){hu(this,e)}}function GE(e){return function(){yu(this,e)}}function YE(e,t){return function(){(t.apply(this,arguments)?hu:yu)(this,e)}}function WE(e,t){var o=mu(e+"");if(arguments.length<2){for(var i=Rl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?YE:t?FE:GE)(o,t))}function KE(){this.textContent=""}function qE(e){return function(){this.textContent=e}}function XE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function jE(e){return arguments.length?this.each(e==null?KE:(typeof e=="function"?XE:qE)(e)):this.node().textContent}function ZE(){this.innerHTML=""}function JE(e){return function(){this.innerHTML=e}}function QE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ev(e){return arguments.length?this.each(e==null?ZE:(typeof e=="function"?QE:JE)(e)):this.node().innerHTML}function tv(){this.nextSibling&&this.parentNode.appendChild(this)}function nv(){return this.each(tv)}function ov(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function iv(){return this.each(ov)}function av(e){var t=typeof e=="function"?e:ru(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function lv(){return null}function rv(e,t){var o=typeof e=="function"?e:ru(e),i=t==null?lv:typeof t=="function"?t:Cl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function sv(){var e=this.parentNode;e&&e.removeChild(this)}function cv(){return this.each(sv)}function dv(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function uv(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fv(e){return this.select(e?uv:dv)}function mv(e){return arguments.length?this.property("__data__",e):this.node().__data__}function pv(e){return function(t){e.call(this,t,this.__data__)}}function hv(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function yv(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function gv(e,t,o){return function(){var i=this.__on,a,l=pv(t);if(i){for(var r=0,s=i.length;r<s;++r)if((a=i[r]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=o),a.value=t;return}}this.addEventListener(e.type,l,o),a={type:e.type,name:e.name,value:t,listener:l,options:o},i?i.push(a):this.__on=[a]}}function bv(e,t,o){var i=hv(e+""),a,l=i.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<l;++a)if((r=i[a]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?gv:yv,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function gu(e,t,o){var i=fu(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function _v(e,t){return function(){return gu(this,e,t)}}function kv(e,t){return function(){return gu(this,e,t.apply(this,arguments))}}function wv(e,t){return this.each((typeof t=="function"?kv:_v)(e,t))}function*Ev(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length,r;a<l;++a)(r=i[a])&&(yield r)}var bu=[null];function ft(e,t){this._groups=e,this._parents=t}function Eo(){return new ft([[document.documentElement]],bu)}function vv(){return this}ft.prototype=Eo.prototype={constructor:ft,select:Xw,selectAll:Qw,selectChild:oE,selectChildren:rE,filter:sE,data:pE,enter:cE,exit:yE,join:gE,merge:bE,selection:vv,order:_E,sort:kE,call:EE,nodes:vE,node:NE,size:$E,empty:xE,each:IE,attr:ME,style:LE,property:HE,classed:WE,text:jE,html:ev,raise:nv,lower:iv,append:av,insert:rv,remove:cv,clone:fv,datum:mv,on:bv,dispatch:wv,[Symbol.iterator]:Ev};function qt(e){return typeof e=="string"?new ft([[document.querySelector(e)]],[document.documentElement]):new ft([[e]],bu)}function Nv(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=Nv(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const Vl={capture:!0,passive:!1};function Al(e){e.preventDefault(),e.stopImmediatePropagation()}function $v(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",Al,Vl);"onselectstart"in t?o.on("selectstart.drag",Al,Vl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xv(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Al,Vl),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function Tl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function _u(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function vo(){}var No=.7,Xi=1/No,Hn="\\s*([+-]?\\d+)\\s*",$o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",It="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Iv=/^#([0-9a-f]{3,8})$/,Sv=new RegExp(`^rgb\\(${Hn},${Hn},${Hn}\\)$`),Cv=new RegExp(`^rgb\\(${It},${It},${It}\\)$`),Rv=new RegExp(`^rgba\\(${Hn},${Hn},${Hn},${$o}\\)$`),Vv=new RegExp(`^rgba\\(${It},${It},${It},${$o}\\)$`),Av=new RegExp(`^hsl\\(${$o},${It},${It}\\)$`),Tv=new RegExp(`^hsla\\(${$o},${It},${It},${$o}\\)$`),ku={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};Tl(vo,xo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:wu,formatHex:wu,formatHex8:Mv,formatHsl:Bv,formatRgb:Eu,toString:Eu});function wu(){return this.rgb().formatHex()}function Mv(){return this.rgb().formatHex8()}function Bv(){return Iu(this).formatHsl()}function Eu(){return this.rgb().formatRgb()}function xo(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Iv.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?vu(t):o===3?new ct(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?ji(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ji(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Sv.exec(e))?new ct(t[1],t[2],t[3],1):(t=Cv.exec(e))?new ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Rv.exec(e))?ji(t[1],t[2],t[3],t[4]):(t=Vv.exec(e))?ji(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Av.exec(e))?xu(t[1],t[2]/100,t[3]/100,1):(t=Tv.exec(e))?xu(t[1],t[2]/100,t[3]/100,t[4]):ku.hasOwnProperty(e)?vu(ku[e]):e==="transparent"?new ct(NaN,NaN,NaN,0):null}function vu(e){return new ct(e>>16&255,e>>8&255,e&255,1)}function ji(e,t,o,i){return i<=0&&(e=t=o=NaN),new ct(e,t,o,i)}function Dv(e){return e instanceof vo||(e=xo(e)),e?(e=e.rgb(),new ct(e.r,e.g,e.b,e.opacity)):new ct}function Ml(e,t,o,i){return arguments.length===1?Dv(e):new ct(e,t,o,i??1)}function ct(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Tl(ct,Ml,_u(vo,{brighter(e){return e=e==null?Xi:Math.pow(Xi,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?No:Math.pow(No,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ct(yn(this.r),yn(this.g),yn(this.b),Zi(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:Nu,formatHex:Nu,formatHex8:Ov,formatRgb:$u,toString:$u}));function Nu(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function Ov(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function $u(){const e=Zi(this.opacity);return`${e===1?"rgb(":"rgba("}${yn(this.r)}, ${yn(this.g)}, ${yn(this.b)}${e===1?")":`, ${e})`}`}function Zi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gn(e){return e=yn(e),(e<16?"0":"")+e.toString(16)}function xu(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new bt(e,t,o,i)}function Iu(e){if(e instanceof bt)return new bt(e.h,e.s,e.l,e.opacity);if(e instanceof vo||(e=xo(e)),!e)return new bt;if(e instanceof bt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),l=Math.max(t,o,i),r=NaN,s=l-a,c=(l+a)/2;return s?(t===l?r=(o-i)/s+(o<i)*6:o===l?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?l+a:2-l-a,r*=60):s=c>0&&c<1?0:r,new bt(r,s,c,e.opacity)}function Lv(e,t,o,i){return arguments.length===1?Iu(e):new bt(e,t,o,i??1)}function bt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Tl(bt,Lv,_u(vo,{brighter(e){return e=e==null?Xi:Math.pow(Xi,e),new bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?No:Math.pow(No,e),new bt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new ct(Bl(e>=240?e-240:e+120,a,i),Bl(e,a,i),Bl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new bt(Su(this.h),Ji(this.s),Ji(this.l),Zi(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=Zi(this.opacity);return`${e===1?"hsl(":"hsla("}${Su(this.h)}, ${Ji(this.s)*100}%, ${Ji(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Su(e){return e=(e||0)%360,e<0?e+360:e}function Ji(e){return Math.max(0,Math.min(1,e||0))}function Bl(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Cu=e=>()=>e;function Pv(e,t){return function(o){return e+o*t}}function zv(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function Uv(e){return(e=+e)==1?Ru:function(t,o){return o-t?zv(t,o,e):Cu(isNaN(t)?o:t)}}function Ru(e,t){var o=t-e;return o?Pv(e,o):Cu(isNaN(e)?t:e)}const Vu=(function e(t){var o=Uv(t);function i(a,l){var r=o((a=Ml(a)).r,(l=Ml(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Ru(a.opacity,l.opacity);return function(u){return a.r=r(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function jt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var Dl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ol=new RegExp(Dl.source,"g");function Hv(e){return function(){return e}}function Fv(e){return function(t){return e(t)+""}}function Gv(e,t){var o=Dl.lastIndex=Ol.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Dl.exec(e))&&(a=Ol.exec(t));)(l=a.index)>o&&(l=t.slice(o,l),s[r]?s[r]+=l:s[++r]=l),(i=i[0])===(a=a[0])?s[r]?s[r]+=a:s[++r]=a:(s[++r]=null,c.push({i:r,x:jt(i,a)})),o=Ol.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Fv(c[0].x):Hv(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}var Au=180/Math.PI,Ll={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Tu(e,t,o,i,a,l){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*Au,skewX:Math.atan(c)*Au,scaleX:r,scaleY:s}}var Qi;function Yv(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ll:Tu(t.a,t.b,t.c,t.d,t.e,t.f)}function Wv(e){return e==null||(Qi||(Qi=document.createElementNS("http://www.w3.org/2000/svg","g")),Qi.setAttribute("transform",e),!(e=Qi.transform.baseVal.consolidate()))?Ll:(e=e.matrix,Tu(e.a,e.b,e.c,e.d,e.e,e.f))}function Mu(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,p,m){if(d!==f||u!==h){var b=p.push("translate(",null,t,null,o);m.push({i:b-4,x:jt(d,f)},{i:b-2,x:jt(u,h)})}else(f||h)&&p.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:jt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:jt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,p,m){if(d!==f||u!==h){var b=p.push(a(p)+"scale(",null,",",null,")");m.push({i:b-4,x:jt(d,f)},{i:b-2,x:jt(u,h)})}else(f!==1||h!==1)&&p.push(a(p)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(p){for(var m=-1,b=h.length,y;++m<b;)f[(y=h[m]).i]=y.x(p);return f.join("")}}}var Kv=Mu(Yv,"px, ","px)","deg)"),qv=Mu(Wv,", ",")",")"),Xv=1e-12;function Bu(e){return((e=Math.exp(e))+1/e)/2}function jv(e){return((e=Math.exp(e))-1/e)/2}function Zv(e){return((e=Math.exp(2*e))-1)/(e+1)}const Jv=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],h=r[2],p=u-s,m=f-c,b=p*p+m*m,y,_;if(b<Xv)_=Math.log(h/d)/t,y=function(O){return[s+O*p,c+O*m,d*Math.exp(t*O*_)]};else{var V=Math.sqrt(b),g=(h*h-d*d+i*b)/(2*d*o*V),v=(h*h-d*d-i*b)/(2*h*o*V),ee=Math.log(Math.sqrt(g*g+1)-g),x=Math.log(Math.sqrt(v*v+1)-v);_=(x-ee)/t,y=function(O){var P=O*_,H=Bu(ee),ne=d/(o*V)*(H*Zv(t*P+ee)-jv(ee));return[s+ne*p,c+ne*m,d*H/Bu(t*P+ee)]}}return y.duration=_*1e3*t/Math.SQRT2,y}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Fn=0,Io=0,So=0,Du=1e3,ea,Co,ta=0,bn=0,na=0,Ro=typeof performance=="object"&&performance.now?performance:Date,Ou=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Pl(){return bn||(Ou(Qv),bn=Ro.now()+na)}function Qv(){bn=0}function oa(){this._call=this._time=this._next=null}oa.prototype=Lu.prototype={constructor:oa,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Pl():+o)+(t==null?0:+t),!this._next&&Co!==this&&(Co?Co._next=this:ea=this,Co=this),this._call=e,this._time=o,zl()},stop:function(){this._call&&(this._call=null,this._time=1/0,zl())}};function Lu(e,t,o){var i=new oa;return i.restart(e,t,o),i}function eN(){Pl(),++Fn;for(var e=ea,t;e;)(t=bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fn}function Pu(){bn=(ta=Ro.now())+na,Fn=Io=0;try{eN()}finally{Fn=0,nN(),bn=0}}function tN(){var e=Ro.now(),t=e-ta;t>Du&&(na-=t,ta=e)}function nN(){for(var e,t=ea,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:ea=o);Co=e,zl(i)}function zl(e){if(!Fn){Io&&(Io=clearTimeout(Io));var t=e-bn;t>24?(e<1/0&&(Io=setTimeout(Pu,e-Ro.now()-na)),So&&(So=clearInterval(So))):(So||(ta=Ro.now(),So=setInterval(tN,Du)),Fn=1,Ou(Pu))}}function zu(e,t,o){var i=new oa;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var oN=Il("start","end","cancel","interrupt"),iN=[],Uu=0,Hu=1,Ul=2,ia=3,Fu=4,Hl=5,aa=6;function la(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;aN(e,o,{name:t,index:i,group:a,on:oN,tween:iN,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Uu})}function Fl(e,t){var o=_t(e,t);if(o.state>Uu)throw new Error("too late; already scheduled");return o}function St(e,t){var o=_t(e,t);if(o.state>ia)throw new Error("too late; already running");return o}function _t(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function aN(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Lu(l,0,o.time);function l(d){o.state=Hu,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,p;if(o.state!==Hu)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===ia)return zu(r);p.state===Fu?(p.state=aa,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=aa,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(zu(function(){o.state===ia&&(o.state=Fu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Ul,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ul){for(o.state=ia,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=p);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Hl,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Hl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=aa,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function ra(e,t){var o=e.__transition,i,a,l=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){l=!1;continue}a=i.state>Ul&&i.state<Hl,i.state=aa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function lN(e){return this.each(function(){ra(this,e)})}function rN(e,t){var o,i;return function(){var a=St(this,e),l=a.tween;if(l!==o){i=o=l;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}a.tween=i}}function sN(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=St(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function cN(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=_t(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?rN:sN)(o,e,t))}function Gl(e,t,o){var i=e._id;return e.each(function(){var a=St(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return _t(a,i).value[t]}}function Gu(e,t){var o;return(typeof t=="number"?jt:t instanceof xo?Vu:(o=xo(t))?(t=o,Vu):Gv)(e,t)}function dN(e){return function(){this.removeAttribute(e)}}function uN(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fN(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttribute(e);return r===a?null:r===i?l:l=t(i=r,o)}}function mN(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?l:l=t(i=r,o)}}function pN(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function hN(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function yN(e,t){var o=Ki(e),i=o==="transform"?qv:Gu;return this.attrTween(e,typeof t=="function"?(o.local?hN:pN)(o,i,Gl(this,"attr."+e,t)):t==null?(o.local?uN:dN)(o):(o.local?mN:fN)(o,i,t))}function gN(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function bN(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function _N(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&bN(e,l)),o}return a._value=t,a}function kN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&gN(e,l)),o}return a._value=t,a}function wN(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Ki(e);return this.tween(o,(i.local?_N:kN)(i,t))}function EN(e,t){return function(){Fl(this,e).delay=+t.apply(this,arguments)}}function vN(e,t){return t=+t,function(){Fl(this,e).delay=t}}function NN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?EN:vN)(t,e)):_t(this.node(),t).delay}function $N(e,t){return function(){St(this,e).duration=+t.apply(this,arguments)}}function xN(e,t){return t=+t,function(){St(this,e).duration=t}}function IN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?$N:xN)(t,e)):_t(this.node(),t).duration}function SN(e,t){if(typeof t!="function")throw new Error;return function(){St(this,e).ease=t}}function CN(e){var t=this._id;return arguments.length?this.each(SN(t,e)):_t(this.node(),t).ease}function RN(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;St(this,e).ease=o}}function VN(e){if(typeof e!="function")throw new Error;return this.each(RN(this._id,e))}function AN(e){typeof e!="function"&&(e=cu(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Lt(i,this._parents,this._name,this._id)}function TN(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||d[p])&&(f[p]=h);for(;s<i;++s)r[s]=t[s];return new Lt(r,this._parents,this._name,this._id)}function MN(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function BN(e,t,o){var i,a,l=MN(t)?Fl:St;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function DN(e,t){var o=this._id;return arguments.length<2?_t(this.node(),o).on.on(e):this.each(BN(o,e,t))}function ON(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function LN(){return this.on("end.remove",ON(this._id))}function PN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Cl(e));for(var i=this._groups,a=i.length,l=new Array(a),r=0;r<a;++r)for(var s=i[r],c=s.length,d=l[r]=new Array(c),u,f,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),d[h]=f,la(d[h],t,o,h,d,_t(u,o)));return new Lt(l,this._parents,t,o)}function zN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=su(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),p,m=_t(u,o),b=0,y=h.length;b<y;++b)(p=h[b])&&la(p,t,o,b,h,m);l.push(h),r.push(u)}return new Lt(l,r,t,o)}var UN=Eo.prototype.constructor;function HN(){return new UN(this._groups,this._parents)}function FN(e,t){var o,i,a;return function(){var l=Un(this,e),r=(this.style.removeProperty(e),Un(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Yu(e){return function(){this.style.removeProperty(e)}}function GN(e,t,o){var i,a=o+"",l;return function(){var r=Un(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function YN(e,t,o){var i,a,l;return function(){var r=Un(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Un(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function WN(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=St(this,e),d=c.on,u=c.value[l]==null?s||(s=Yu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function KN(e,t,o){var i=(e+="")=="transform"?Kv:Gu;return t==null?this.styleTween(e,FN(e,i)).on("end.style."+e,Yu(e)):typeof t=="function"?this.styleTween(e,YN(e,i,Gl(this,"style."+e,t))).each(WN(this._id,e)):this.styleTween(e,GN(e,i,t),o).on("end.style."+e,null)}function qN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function XN(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&qN(e,r,o)),i}return l._value=t,l}function jN(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,XN(e,t,o??""))}function ZN(e){return function(){this.textContent=e}}function JN(e){return function(){var t=e(this);this.textContent=t??""}}function QN(e){return this.tween("text",typeof e=="function"?JN(Gl(this,"text",e)):ZN(e==null?"":e+""))}function e$(e){return function(t){this.textContent=e.call(this,t)}}function t$(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&e$(a)),t}return i._value=e,i}function n$(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,t$(e))}function o$(){for(var e=this._name,t=this._id,o=Wu(),i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=_t(c,t);la(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Lt(i,this._parents,e,o)}function i$(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(l,r){var s={value:r},c={value:function(){--a===0&&l()}};o.each(function(){var d=St(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&l()})}var a$=0;function Lt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Wu(){return++a$}var Pt=Eo.prototype;Lt.prototype={constructor:Lt,select:PN,selectAll:zN,selectChild:Pt.selectChild,selectChildren:Pt.selectChildren,filter:AN,merge:TN,selection:HN,transition:o$,call:Pt.call,nodes:Pt.nodes,node:Pt.node,size:Pt.size,empty:Pt.empty,each:Pt.each,on:DN,attr:yN,attrTween:wN,style:KN,styleTween:jN,text:QN,textTween:n$,remove:LN,tween:cN,delay:NN,duration:IN,ease:CN,easeVarying:VN,end:i$,[Symbol.iterator]:Pt[Symbol.iterator]};function l$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var r$={time:null,delay:0,duration:250,ease:l$};function s$(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function c$(e){var t,o;e instanceof Lt?(t=e._id,e=e._name):(t=Wu(),(o=r$).time=Pl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&la(c,e,t,d,r,o||s$(c,t));return new Lt(i,this._parents,e,t)}Eo.prototype.interrupt=lN,Eo.prototype.transition=c$;const sa=e=>()=>e;function d$(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function zt(e,t,o){this.k=e,this.x=t,this.y=o}zt.prototype={constructor:zt,scale:function(e){return e===1?this:new zt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new zt(this.k,this.x+this.k*e,this.y+this.k*t)},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 Yl=new zt(1,0,0);zt.prototype;function Wl(e){e.stopImmediatePropagation()}function Vo(e){e.preventDefault(),e.stopImmediatePropagation()}function u$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function f$(){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 Ku(){return this.__zoom||Yl}function m$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function p$(){return navigator.maxTouchPoints||"ontouchstart"in this}function h$(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],l=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),r>l?(l+r)/2:Math.min(0,l)||Math.max(0,r))}function y$(){var e=u$,t=f$,o=h$,i=m$,a=p$,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Jv,d=Il("start","zoom","end"),u,f,h,p=500,m=150,b=0,y=10;function _(k){k.property("__zoom",Ku).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",ce).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,Y,S,F){var U=k.selection?k.selection():k;U.property("__zoom",Ku),k!==U?ee(k,Y,S,F):U.interrupt().each(function(){x(this,arguments).event(F).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},_.scaleBy=function(k,Y,S,F){_.scaleTo(k,function(){var U=this.__zoom.k,le=typeof Y=="function"?Y.apply(this,arguments):Y;return U*le},S,F)},_.scaleTo=function(k,Y,S,F){_.transform(k,function(){var U=t.apply(this,arguments),le=this.__zoom,E=S==null?v(U):typeof S=="function"?S.apply(this,arguments):S,K=le.invert(E),re=typeof Y=="function"?Y.apply(this,arguments):Y;return o(g(V(le,re),E,K),U,r)},S,F)},_.translateBy=function(k,Y,S,F){_.transform(k,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),r)},null,F)},_.translateTo=function(k,Y,S,F,U){_.transform(k,function(){var le=t.apply(this,arguments),E=this.__zoom,K=F==null?v(le):typeof F=="function"?F.apply(this,arguments):F;return o(Yl.translate(K[0],K[1]).scale(E.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),le,r)},F,U)};function V(k,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===k.k?k:new zt(Y,k.x,k.y)}function g(k,Y,S){var F=Y[0]-S[0]*k.k,U=Y[1]-S[1]*k.k;return F===k.x&&U===k.y?k:new zt(k.k,F,U)}function v(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function ee(k,Y,S,F){k.on("start.zoom",function(){x(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(F).end()}).tween("zoom",function(){var U=this,le=arguments,E=x(U,le).event(F),K=t.apply(U,le),re=S==null?v(K):typeof S=="function"?S.apply(U,le):S,pe=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),ye=U.__zoom,ue=typeof Y=="function"?Y.apply(U,le):Y,fe=c(ye.invert(re).concat(pe/ye.k),ue.invert(re).concat(pe/ue.k));return function(ge){if(ge===1)ge=ue;else{var Ee=fe(ge),Re=pe/Ee[2];ge=new zt(Re,re[0]-Ee[0]*Re,re[1]-Ee[1]*Re)}E.zoom(null,ge)}})}function x(k,Y,S){return!S&&k.__zooming||new O(k,Y)}function O(k,Y){this.that=k,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,Y),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,Y){return this.mouse&&k!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var Y=qt(this.that).datum();d.call(k,this.that,new d$(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),Y)}};function P(k,...Y){if(!e.apply(this,arguments))return;var S=x(this,Y).event(k),F=this.__zoom,U=Math.max(l[0],Math.min(l[1],F.k*Math.pow(2,i.apply(this,arguments)))),le=Xt(k);if(S.wheel)(S.mouse[0][0]!==le[0]||S.mouse[0][1]!==le[1])&&(S.mouse[1]=F.invert(S.mouse[0]=le)),clearTimeout(S.wheel);else{if(F.k===U)return;S.mouse=[le,F.invert(le)],ra(this),S.start()}Vo(k),S.wheel=setTimeout(E,m),S.zoom("mouse",o(g(V(F,U),S.mouse[0],S.mouse[1]),S.extent,r));function E(){S.wheel=null,S.end()}}function H(k,...Y){if(h||!e.apply(this,arguments))return;var S=k.currentTarget,F=x(this,Y,!0).event(k),U=qt(k.view).on("mousemove.zoom",re,!0).on("mouseup.zoom",pe,!0),le=Xt(k,S),E=k.clientX,K=k.clientY;$v(k.view),Wl(k),F.mouse=[le,this.__zoom.invert(le)],ra(this),F.start();function re(ye){if(Vo(ye),!F.moved){var ue=ye.clientX-E,fe=ye.clientY-K;F.moved=ue*ue+fe*fe>b}F.event(ye).zoom("mouse",o(g(F.that.__zoom,F.mouse[0]=Xt(ye,S),F.mouse[1]),F.extent,r))}function pe(ye){U.on("mousemove.zoom mouseup.zoom",null),xv(ye.view,F.moved),Vo(ye),F.event(ye).end()}}function ne(k,...Y){if(e.apply(this,arguments)){var S=this.__zoom,F=Xt(k.changedTouches?k.changedTouches[0]:k,this),U=S.invert(F),le=S.k*(k.shiftKey?.5:2),E=o(g(V(S,le),F,U),t.apply(this,Y),r);Vo(k),s>0?qt(this).transition().duration(s).call(ee,E,F,k):qt(this).call(_.transform,E,F,k)}}function ce(k,...Y){if(e.apply(this,arguments)){var S=k.touches,F=S.length,U=x(this,Y,k.changedTouches.length===F).event(k),le,E,K,re;for(Wl(k),E=0;E<F;++E)K=S[E],re=Xt(K,this),re=[re,this.__zoom.invert(re),K.identifier],U.touch0?!U.touch1&&U.touch0[2]!==re[2]&&(U.touch1=re,U.taps=0):(U.touch0=re,le=!0,U.taps=1+!!u);u&&(u=clearTimeout(u)),le&&(U.taps<2&&(f=re[0],u=setTimeout(function(){u=null},p)),ra(this),U.start())}}function L(k,...Y){if(this.__zooming){var S=x(this,Y).event(k),F=k.changedTouches,U=F.length,le,E,K,re;for(Vo(k),le=0;le<U;++le)E=F[le],K=Xt(E,this),S.touch0&&S.touch0[2]===E.identifier?S.touch0[0]=K:S.touch1&&S.touch1[2]===E.identifier&&(S.touch1[0]=K);if(E=S.that.__zoom,S.touch1){var pe=S.touch0[0],ye=S.touch0[1],ue=S.touch1[0],fe=S.touch1[1],ge=(ge=ue[0]-pe[0])*ge+(ge=ue[1]-pe[1])*ge,Ee=(Ee=fe[0]-ye[0])*Ee+(Ee=fe[1]-ye[1])*Ee;E=V(E,Math.sqrt(ge/Ee)),K=[(pe[0]+ue[0])/2,(pe[1]+ue[1])/2],re=[(ye[0]+fe[0])/2,(ye[1]+fe[1])/2]}else if(S.touch0)K=S.touch0[0],re=S.touch0[1];else return;S.zoom("touch",o(g(E,K,re),S.extent,r))}}function oe(k,...Y){if(this.__zooming){var S=x(this,Y).event(k),F=k.changedTouches,U=F.length,le,E;for(Wl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),le=0;le<U;++le)E=F[le],S.touch0&&S.touch0[2]===E.identifier?delete S.touch0:S.touch1&&S.touch1[2]===E.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(E=Xt(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<y)){var K=qt(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:sa(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:sa(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:sa(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:sa([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),_):t},_.scaleExtent=function(k){return arguments.length?(l[0]=+k[0],l[1]=+k[1],_):[l[0],l[1]]},_.translateExtent=function(k){return arguments.length?(r[0][0]=+k[0][0],r[1][0]=+k[1][0],r[0][1]=+k[0][1],r[1][1]=+k[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(k){return arguments.length?(o=k,_):o},_.duration=function(k){return arguments.length?(s=+k,_):s},_.interpolate=function(k){return arguments.length?(c=k,_):c},_.on=function(){var k=d.on.apply(d,arguments);return k===d?_:k},_.clickDistance=function(k){return arguments.length?(b=(k=+k)*k,_):Math.sqrt(b)},_.tapDistance=function(k){return arguments.length?(y=+k,_):y},_}const qu=Symbol("MiniMapSlots"),g$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],b$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},_$=n.defineComponent({...b$,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:t}){const o=e,i=n.inject(qu),a=n.useAttrs(),l=n.toRef(()=>a.style??{});function r(f){t("click",f)}function s(f){t("dblclick",f)}function c(f){t("mouseenter",f)}function d(f){t("mousemove",f)}function u(f){t("mouseleave",f)}return(f,h)=>!f.hidden&&f.dimensions.width!==0&&f.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...f.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:f.id},f.$attrs,{class:["vue-flow__minimap-node",{selected:f.selected,dragging:f.dragging}],x:f.position.x,y:f.position.y,rx:f.borderRadius,ry:f.borderRadius,width:f.dimensions.width,height:f.dimensions.height,fill:f.color||l.value.background||l.value.backgroundColor,stroke:f.strokeColor,"stroke-width":f.strokeWidth,"shape-rendering":f.shapeRendering,onClick:r,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,g$))],64)):n.createCommentVNode("",!0)}}),k$=["width","height","viewBox","aria-labelledby"],w$=["id"],E$=["d","fill","stroke","stroke-width"],v$={name:"MiniMap",compatConfig:{MODE:3}},N$=n.defineComponent({...v$,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,l=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:h,d3Zoom:p,getNodesInitialized:m}=ze(),b=n.ref();n.provide(qu,o);const y=n.toRef(()=>{var U;return e.width??((U=i.style)==null?void 0:U.width)??a}),_=n.toRef(()=>{var U;return e.height??((U=i.style)==null?void 0:U.height)??l}),V=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",g=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),v=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),ee=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),x=n.computed(()=>rl(m.value.filter(U=>!U.hidden))),O=n.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),P=n.computed(()=>m.value&&m.value.length?bb(x.value,O.value):O.value),H=n.computed(()=>{const U=P.value.width/y.value,le=P.value.height/_.value;return Math.max(U,le)}),ne=n.computed(()=>{const U=H.value*y.value,le=H.value*_.value,E=e.offsetScale*H.value;return{offset:E,x:P.value.x-(U-P.value.width)/2-E,y:P.value.y-(le-P.value.height)/2-E,width:U+E*2,height:le+E*2}}),ce=n.computed(()=>!ne.value.x||!ne.value.y?"":`
30
30
  M${ne.value.x-ne.value.offset},${ne.value.y-ne.value.offset}
31
31
  h${ne.value.width+ne.value.offset*2}
32
32
  v${ne.value.height+ne.value.offset*2}
@@ -39,5 +39,5 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
39
39
  h${-(O.value.width-2*e.maskBorderRadius)}
40
40
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
41
41
  v${-(O.value.height-2*e.maskBorderRadius)}
42
- a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(U=>{if(g.value){const le=qt(g.value),E=pe=>{if(pe.sourceEvent.type!=="wheel"||!h.value||!m.value)return;const ye=pe.sourceEvent.ctrlKey&&ko()?10:1,ue=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*e.zoomStep,fe=c.value.zoom*2**(ue*ye);m.value.scaleTo(h.value,fe)},K=pe=>{if(pe.sourceEvent.type!=="mousemove"||!h.value||!m.value)return;const ye=H.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),ue={x:c.value.x-pe.sourceEvent.movementX*ye,y:c.value.y-pe.sourceEvent.movementY*ye},fe=[[0,0],[u.value.width,u.value.height]],ge=Yl.translate(ue.x,ue.y).scale(c.value.zoom),Ee=m.value.constrain()(ge,fe,d.value);m.value.transform(h.value,Ee)},re=h$().wheelDelta(pe=>sl(pe)*(e.zoomStep/10)).on("zoom",e.pannable?K:()=>{}).on("zoom.wheel",e.zoomable?E:()=>{});le.call(re),U(()=>{le.on("zoom",null)})}},{flush:"post"});function L(U){const[le,E]=Xt(U);t("click",{event:U,position:{x:le,y:E}})}function oe(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeClick(E),t("nodeClick",E)}function k(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeDoubleClick(E),t("nodeDblclick",E)}function Y(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseEnter(E),t("nodeMouseenter",E)}function S(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseMove(E),t("nodeMousemove",E)}function F(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseLeave(E),t("nodeMouseleave",E)}return(U,le)=>(n.openBlock(),n.createBlock(n.unref(Cd),{position:U.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:U.pannable,zoomable:U.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:b.value,height:_.value,viewBox:[ne.value.x,ne.value.y,ne.value.width,ne.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:L},[U.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(U.ariaLabel),9,k$)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(p),E=>(n.openBlock(),n.createBlock(b$,{id:E.id,key:E.id,f:"",position:E.computedPosition,dimensions:E.dimensions,selected:E.selected,dragging:E.dragging,style:n.normalizeStyle(E.style),class:n.normalizeClass(ee.value(E)),color:y.value(E),"border-radius":U.nodeBorderRadius,"stroke-color":v.value(E),"stroke-width":U.nodeStrokeWidth,"shape-rendering":n.unref(V),type:E.type,hidden:E.hidden,onClick:K=>oe(K,E),onDblclick:K=>k(K,E),onMouseenter:K=>Y(K,E),onMousemove:K=>S(K,E),onMouseleave:K=>F(K,E)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),n.createElementVNode("path",{class:"vue-flow__minimap-mask",d:ce.value,fill:U.maskColor,stroke:U.maskStrokeColor,"stroke-width":U.maskStrokeWidth,"fill-rule":"evenodd"},null,8,w$)],8,_$))]),_:1},8,["position","class"]))}}),N$=["d"],$$=["cx","cy","onDblclick"],x$=["x","y","onPointerdown","onDblclick"],I$=Ue(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=ze(),i=n.inject(xl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(zn,null),s=n.computed(()=>!!r&&r.active.value&&(!r.relatedEntityIds.value.has(t.data.targetRef)||!r.relatedNoteIds.value.has(t.data.noteRef))),c=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),d=n.ref(-1),u=n.ref({x:0,y:0}),f=n.computed(()=>c.value.map((P,H)=>H===d.value?u.value:P)),{source:h,target:m,sourceSide:p,targetSide:g}=nu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),b=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?ua(h.value,p.value,f.value,m.value,g.value):ma(h.value,f.value,m.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?fa(h.value,p.value,f.value,m.value,g.value):ya(h.value,f.value,m.value).map((P,H)=>({point:P,segIndex:H})):[]),V=n.computed(()=>l.value?f.value:[]);function y(P,H){d.value=P,u.value={...c.value[P]},H.target.setPointerCapture(H.pointerId),H.stopPropagation()}function v(P){if(d.value<0)return;const H=o({x:P.clientX,y:P.clientY});u.value={x:H.x,y:H.y}}function ee(P){var H,ne;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(ne=(H=P.target).releasePointerCapture)==null||ne.call(H,P.pointerId)}function x(P,H){H.stopPropagation(),i==null||i.removePoint(t.id,P)}function O(P,H){if(!i)return;const ne=o({x:H.clientX,y:H.clientY});i.insertPoint(t.id,P,{x:ne.x,y:ne.y})}return(P,H)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:b.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,N$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${ce}`,cx:ne.point.x,cy:ne.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(L=>O(ne.segIndex,L),["stop"])},null,42,$$))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(V.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${ce}`,x:ne.x-5,y:ne.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:L=>y(ce,L),onPointermove:v,onPointerup:ee,onDblclick:L=>x(ce,L)},null,42,x$))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),S$=["data-theme"],C$={key:0,class:"em-ctx__sep",role:"separator"},R$={key:1,class:"em-ctx__swatches"},V$={class:"em-ctx__swatches-label"},A$={class:"em-ctx__chips"},T$=["onClick"],M$=["title","onClick"],B$=["disabled","onClick"],D$={class:"em-ctx__icon"},O$={class:"em-ctx__caption"},L$=Ue(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),a=n.ref(void 0),l=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(m,p){var _;i.value=p,a.value=(_=m.target)!=null&&_.closest('[data-theme="dark"]')?"dark":void 0,r.x=m.clientX,r.y=m.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const g=l.value;if(!g)return;const b=g.getBoundingClientRect();r.x+b.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-b.width)),r.y+b.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-b.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(m){m.key==="Escape"&&(m.stopPropagation(),d())}function f(m){m.disabled||(m.handler(),d())}function h(m,p){m.onPick(p),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,p)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":a.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:l,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:p[0]||(p[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(g,b)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b},[g.type==="separator"?(n.openBlock(),n.createElementBlock("div",C$)):g.type==="swatches"?(n.openBlock(),n.createElementBlock("div",R$,[n.createElementVNode("span",V$,n.toDisplayString(g.caption),1),n.createElementVNode("div",A$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":g.current===null}]),title:"없음",onClick:_=>h(g,null)},null,10,T$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),_=>(n.openBlock(),n.createElementBlock("button",{key:_,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":g.current===_}]),style:n.normalizeStyle({background:n.unref(On)(_)}),title:n.unref(Dn)(_),onClick:V=>h(g,_)},null,14,M$))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":g.danger,"is-disabled":g.disabled}]),disabled:g.disabled,role:"menuitem",onClick:_=>f(g)},[n.createElementVNode("span",D$,[g.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:g.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",O$,n.toDisplayString(g.caption),1)],10,B$))],64))),128))],36)],8,S$)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Kl=[".em-entity__grip",".em-entity__add",".em-entity__footer",".em-sel",".em-handle",".em-note-handle",".vue-flow__handle",".em-group__resize",".em-note__resize",".em-edge__waypoint",".em-edge__mid",".em-note-edge__waypoint",".em-note-edge__mid"].join(",");function Gn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function P$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function z$(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const l=e.firstChild,r=a.getClientRects();if(!l||l.nodeType!==3||r.length<=1){const p=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(p.width===0&&p.height===0)return[];const g=t(p.left,p.top+p.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,h=0;const m=()=>{const p=d.trim();if(p){const g=t(f,(u+h)/2);c.push({...i,x:g.x,y:g.y,text:p})}d=""};for(let p=0;p<s.length;p++){a.setStart(l,p),a.setEnd(l,p+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(m(),u=g.top,f=g.left,h=g.bottom,d=s[p]):(d+=s[p],h=Math.max(h,g.bottom))}return m(),c}function sa(e,t){const o=[];for(const i of e.querySelectorAll("*"))P$(i)&&(i.closest(Kl)||Gn(i)&&o.push(...z$(i,t)));return o}function Ao(e){return Math.round(e*100)/100}function U$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Kl)||!Gn(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const l=t(a.left,a.top),r=t(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${Ao(l.x)}" y="${Ao(l.y)}" width="${Ao(r.x-l.x)}" height="${Ao(r.y-l.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function H$(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Gn(o))continue;const i=getComputedStyle(o),a=i.stroke,l=parseFloat(i.strokeWidth)||1.5,r=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Ao(parseFloat(o.getAttribute(d)??"0"));s==="line"?t.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${l}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${l}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${r}" stroke="${a}" stroke-width="${l}" stroke-linejoin="round" />`)}return t}function ju(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Kl)||!Gn(a))continue;const l=getComputedStyle(a),r=parseFloat(l.borderTopWidth);if(!r)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:l.borderTopColor,strokeWidth:r})}return i}function To(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=t(o.left,o.top),l=t(o.right,o.bottom),r=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:l.x-a.x,h:l.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:r?"6 4":void 0,radius:s}}function ql(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function F$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,p)=>e.screenToFlowCoordinate({x:m,y:p}),i=[],a=[],l=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const p=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!p||!Gn(p))continue;const g=p.firstElementChild;if(g)if(m.type==="group"){const b=To(g,o);ql(s,b),i.push({...b,texts:[]});const _=g.querySelector(".em-group__label");_&&i.push({...To(_,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:sa(g,o)})}else if(m.type==="note"){const b={...To(g,o),texts:sa(g,o),lines:ju(g,g,o)};ql(s,b),l.push(b)}else{const b=To(g,o);ql(s,b);const _=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const V=g.querySelector(".em-entity__header");if(V){const y=To(V,o);a.push({x:b.x,y:b.y,w:b.w,h:y.y+y.h-b.y,fill:y.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:sa(g,o),lines:ju(g,g,o),icons:U$(g,o)}),a.push({...b,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const p=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!p||!Gn(p))continue;const g=p.getAttribute("d");if(!g)continue;const b=getComputedStyle(p),_=b.strokeDasharray,V=H$(m);r.push({d:g,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:sa(m,o),markers:V.length?V:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:r,entities:a,notes:l}}function Xl(e){return dr(F$(e))}function Zu(e,t){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function Ju(e,t="diagram.svg"){const o=Xl(e);Zu(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function G$(e){var i,a;const t=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:t>0?t:1,h:o>0?o:1}}async function Qu(e,t="diagram.png",o=2){const i=Xl(e),{w:a,h:l}=G$(i),r=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=l,await new Promise((f,h)=>{s.onload=()=>f(),s.onerror=()=>h(new Error("SVG 이미지 로드 실패")),s.src=r});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(l*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,l);const u=await new Promise(f=>c.toBlob(f,"image/png"));if(!u)throw new Error("PNG 변환 실패");Zu(u,t)}finally{URL.revokeObjectURL(r)}}const Y$={class:"em-shortcuts"},W$={class:"em-shortcuts__title"},K$={class:"em-shortcuts__keys"},q$={class:"em-shortcuts__kbd"},X$={key:0,class:"em-shortcuts__plus"},j$={class:"em-shortcuts__desc"},Z$={class:"em-shortcuts__actions"},ef=Ue(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ie.useModalHandle(),i=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",a=[{title:"편집",items:[{keys:[i,"Z"],desc:"실행 취소"},{keys:[i,"Shift","Z"],desc:"다시 실행"},{keys:[i,"C"],desc:"선택 복사"},{keys:[i,"V"],desc:"붙여넣기"},{keys:["Delete"],desc:"선택 항목 삭제 (Backspace 동일)"}]},{title:"이동 · 정렬",items:[{keys:["←","↑","→","↓"],desc:"선택 노드 1px 이동"},{keys:["Shift","방향키"],desc:"선택 노드 10px 이동"},{keys:["↑","↓"],desc:"속성 선택 시 포커스 이동"},{keys:["Alt","↑","↓"],desc:"속성 순서 위/아래로"}]},{title:"기타",items:[{keys:["우클릭"],desc:"컨텍스트 메뉴 (엔티티·노트 추가 등)"},{keys:["Enter"],desc:"인라인 편집 확정"},{keys:["Esc"],desc:"편집·메뉴 닫기"},{keys:["?"],desc:"이 도움말 열기"}]}];return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",Y$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",W$,n.toDisplayString(s.title),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.items,c=>(n.openBlock(),n.createElementBlock("div",{key:c.desc,class:"em-shortcuts__row"},[n.createElementVNode("span",K$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.keys,(d,u)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:d+u},[n.createElementVNode("kbd",q$,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",X$,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",j$,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",Z$,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function J$(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const Q$={key:0,class:"em-canvas__empty","aria-hidden":"true"},ex={key:1,class:"em-canvas__empty-title"},tx={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},nx={class:"em-conflict-banner__body"},ox={class:"em-conflict-banner__title"},ix={class:"em-conflict-banner__detail"},ax={key:0,class:"em-toast",role:"status","aria-live":"polite"},jl="nc:",tf=Ue(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,$=>{$&&(l.value=$.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>J$(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f($){u.x=$.clientX,u.y=$.clientY}const h=n.ref(null);n.provide(Hi,h);const m=n.ref(null);n.provide(zd,m);const p=n.ref(null),g=n.computed(()=>{const $=p.value,D=new Set;if(!$)return D;if($.kind==="entity")D.add($.id);else if($.kind==="group"){const se=i.resolved.value.groups.find(R=>R.group.modelId===$.id);for(const R of(se==null?void 0:se.group.memberEntityRefs)??[])D.add(R)}return D}),b=n.computed(()=>{const $=p.value,D=new Set(g.value),se=new Set,R=new Set;if(!$)return{related:D,edges:se,notes:R};if($.kind==="note"){R.add($.id);for(const M of i.resolved.value.noteConnections)M.noteRef===$.id&&D.add(M.targetRef);return{related:D,edges:se,notes:R}}const q=g.value;if(!q.size)return{related:D,edges:se,notes:R};for(const M of i.resolved.value.associations){const{end1:X,end2:ke}=M.association;(q.has(X.entityRef)||q.has(ke.entityRef))&&(se.add(M.association.modelId),D.add(X.entityRef),D.add(ke.entityRef))}for(const M of i.resolved.value.noteConnections)D.has(M.targetRef)&&R.add(M.noteRef);return{related:D,edges:se,notes:R}});n.provide(zn,{source:p,active:n.computed(()=>p.value!==null),primaryEntityIds:g,relatedEntityIds:n.computed(()=>b.value.related),relatedEdgeIds:n.computed(()=>b.value.edges),relatedNoteIds:n.computed(()=>b.value.notes),hoverGroupId:n.computed(()=>{var $;return(($=p.value)==null?void 0:$.kind)==="group"?p.value.id:null}),setEntityHover:$=>{m.value||d.value||(p.value=$?{kind:"entity",id:$}:null)},setGroupHover:$=>{m.value||d.value||(p.value=$?{kind:"group",id:$}:null)},setNoteHover:$=>{m.value||d.value||(p.value=$?{kind:"note",id:$}:null)}}),n.provide(pn,i);function _($,D){return`${jl}${$}:${D}`}function V($){if(!$.startsWith(jl))return null;const[D,se]=$.slice(jl.length).split(":");return D&&se?{noteRef:D,targetRef:se}:null}n.provide(xl,{points:$=>{var se,R;const D=V($);return D?((se=i.resolved.value.noteConnections.find(q=>q.noteRef===D.noteRef&&q.targetRef===D.targetRef))==null?void 0:se.waypoints)??[]:((R=i.resolved.value.associations.find(q=>q.association.modelId===$))==null?void 0:R.waypoints)??[]},movePoint:($,D,se)=>{const R=V($);R?i.moveNoteConnectionWaypoint(R.noteRef,R.targetRef,D,se):i.moveWaypoint($,D,se)},insertPoint:($,D,se)=>{const R=V($);R?i.addNoteConnectionWaypoint(R.noteRef,R.targetRef,D,se):i.addWaypoint($,D,se)},removePoint:($,D)=>{const se=V($);se?i.removeNoteConnectionWaypoint(se.noteRef,se.targetRef,D):i.removeWaypoint($,D)}});const y=ze(),{nodes:v,edges:ee,findNode:x,findEdge:O,addNodes:P,addEdges:H,removeNodes:ne,removeEdges:ce,fitView:L,setCenter:oe,getViewport:k,screenToFlowCoordinate:Y,getSelectedNodes:S,updateNodeInternals:F}=y,U=n.ref(!1);async function le($){U.value=!0,await n.nextTick(),await new Promise(D=>requestAnimationFrame(()=>D(null)));try{return await $()}finally{U.value=!1}}function E(){return le(()=>Ju(y))}function K(){return le(()=>Qu(y))}t({exportSvg:E,exportPng:K});const re=n.computed(()=>i.resolved.value.entities.length===0);function pe(){const $=k(),{width:D,height:se}=y.dimensions.value;return{x:(D/2-$.x)/$.zoom,y:(se/2-$.y)/$.zoom}}function ye(){const $=pe();i.addEntity("NewEntity",{x:$.x,y:$.y})}function ue(){const $=pe();i.addNote("메모",{x:$.x,y:$.y})}function fe($){for(const D of i.resolved.value.groups){const{location:se,size:R}=D.geo;if($.x>=se.x&&$.x<=se.x+R.width&&$.y>=se.y&&$.y<=se.y+R.height)return D.group.modelId}return null}function ge(){const $=i.resolved.value,D=new Map($.groups.map(X=>[X.group.modelId,X.geo])),se=new Set($.groups.map(X=>X.group.modelId)),R=new Set([...se,...$.entities.map(X=>X.entity.modelId),...$.notes.map(X=>X.note.modelId)]);for(const X of[...v.value])R.has(X.id)||ne([X.id]);for(const X of $.groups){const ke=X.group.modelId,De={width:`${X.geo.size.width}px`,height:`${X.geo.size.height}px`},Le={group:X.group,style:X.style,locked:X.locked},Pe=X.locked?!1:void 0,He=x(ke);He?(He.position={...X.geo.location},He.data=Le,He.style=De,He.draggable=Pe):P([{id:ke,type:"group",position:{...X.geo.location},draggable:Pe,style:De,data:Le}])}for(const X of $.entities){const ke=X.entity.modelId,De=X.groupRef&&se.has(X.groupRef)?X.groupRef:void 0,Le={entity:X.entity,displayMode:i.displayMode.value,collapsed:X.collapsed,locked:X.locked,groupRef:De,size:X.geo.size,style:X.style,attributeStyles:X.attributeStyles,operationStyles:X.operationStyles},Pe=X.locked?!1:void 0,He=De?D.get(De):void 0,et=He?{x:X.geo.location.x-He.location.x,y:X.geo.location.y-He.location.y}:{...X.geo.location},Ye=x(ke);Ye?(Ye.position=et,Ye.data=Le,Ye.parentNode=De,Ye.draggable=Pe):P([{id:ke,type:"entity",position:et,parentNode:De,draggable:Pe,data:Le}])}for(const X of $.notes){const ke=X.note,De=ke.modelId,Le=X.groupRef&&se.has(X.groupRef)?X.groupRef:void 0,Pe={note:ke,groupRef:Le},He={width:`${ke.geo.size.width}px`,height:`${ke.geo.size.height}px`},et=Le?D.get(Le):void 0,Ye=et?{x:ke.geo.location.x-et.location.x,y:ke.geo.location.y-et.location.y}:{...ke.geo.location},Ke=x(De);Ke?(Ke.position=Ye,Ke.data=Pe,Ke.style=He,Ke.parentNode=Le):P([{id:De,type:"note",position:Ye,parentNode:Le,style:He,data:Pe}])}const q=new Map($.associations.map(X=>[X.association.modelId,X])),M=new Set($.noteConnections.map(X=>_(X.noteRef,X.targetRef)));for(const X of[...ee.value])!q.has(X.id)&&!M.has(X.id)&&ce([X.id]);for(const[X,ke]of q){const De={id:X,type:"association",source:ke.association.end1.entityRef,target:ke.association.end2.entityRef,sourceHandle:ke.sourceColumnRef?`r:${ke.sourceColumnRef}`:void 0,targetHandle:ke.targetColumnRef?`l:${ke.targetColumnRef}`:void 0,data:{association:ke.association,sourceColumnRef:ke.sourceColumnRef,targetColumnRef:ke.targetColumnRef}},Le=O(X);Le?(Le.data=De.data,Le.sourceHandle=De.sourceHandle,Le.targetHandle=De.targetHandle):H([De])}for(const X of $.noteConnections){const ke=_(X.noteRef,X.targetRef),De={noteRef:X.noteRef,targetRef:X.targetRef},Le=O(ke);Le?Le.data=De:H([{id:ke,type:"note-connection",source:X.noteRef,target:X.targetRef,data:De}])}Ee()}function Ee(){n.nextTick(()=>requestAnimationFrame(()=>F()))}function Re(){const $=S.value.map(se=>se.id);if($.length)return $;const D=i.selection.value;return D&&(D.kind==="entity"||D.kind==="note"||D.kind==="group")?[D.id]:[]}function Ie($){var q;const D=$.target;if(D&&(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable))return;if($.key==="?"){a.openModal({component:ef}),$.preventDefault();return}if(!i.editable.value){($.metaKey||$.ctrlKey)&&$.key.toLowerCase()==="c"&&(i.copy(),$.preventDefault());return}if($.key==="Delete"||$.key==="Backspace"){i.deleteSelection()&&$.preventDefault();return}if($.key==="ArrowUp"||$.key==="ArrowDown"||$.key==="ArrowLeft"||$.key==="ArrowRight"){if(((q=i.selection.value)==null?void 0:q.kind)==="attribute"){if($.key==="ArrowUp"||$.key==="ArrowDown"){const De=$.key==="ArrowDown"?1:-1;($.altKey?i.nudgeSelectedAttributes(De):i.moveAttributeFocus(De))&&$.preventDefault()}return}const M=$.shiftKey?10:1,X=$.key==="ArrowLeft"?-M:$.key==="ArrowRight"?M:0,ke=$.key==="ArrowUp"?-M:$.key==="ArrowDown"?M:0;i.nudgeNodes(Re(),X,ke)&&$.preventDefault();return}if(!($.metaKey||$.ctrlKey))return;const R=$.key.toLowerCase();R==="c"?(i.copy(),$.preventDefault()):R==="v"?(i.paste(),$.preventDefault()):R==="z"&&($.shiftKey?i.redo():i.undo(),$.preventDefault())}n.onMounted(async()=>{ge(),await n.nextTick(),L(),window.addEventListener("keydown",Ie),window.addEventListener("pointerup",he),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ie),window.removeEventListener("pointerup",he),window.removeEventListener("pointermove",f)});function he(){h.value=null}function j(){d.value=!0,p.value=null}function W(){var R;d.value=!1;const $=(R=document.elementFromPoint(u.x,u.y))==null?void 0:R.closest(".vue-flow__node"),D=$==null?void 0:$.dataset.id;if(!D){p.value=null;return}const se=$.classList.contains("vue-flow__node-group")?"group":$.classList.contains("vue-flow__node-note")?"note":"entity";p.value={kind:se,id:D}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ge),n.watch(()=>i.revision.value,Ee),n.watch(()=>i.resolved.value,$=>{const D=p.value;if(!D)return;(D.kind==="entity"?$.entities.some(R=>R.entity.modelId===D.id):D.kind==="group"?$.groups.some(R=>R.group.modelId===D.id):$.notes.some(R=>R.note.modelId===D.id))||(p.value=null)});function w($){const D=$.computedPosition??$.position,se=$.dimensions??{width:0,height:0};return{x:D.x+se.width/2,y:D.y+se.height/2}}function I($){const D=$.node;if(D){if(p.value=null,D.type==="group"){const se=i.resolved.value.groups.find(R=>R.group.modelId===D.id);m.value=se?{groupId:D.id,dx:D.position.x-se.geo.location.x,dy:D.position.y-se.geo.location.y}:null,h.value=null;return}if(D.type!=="entity"&&D.type!=="note"){h.value=null;return}h.value=fe(w(D))}}function C($){var R;h.value=null,m.value=null;const D=(R=$.nodes)!=null&&R.length?$.nodes:[$.node],se=D.filter(q=>(q==null?void 0:q.type)==="group");if(se.length){for(const q of se){if(!q)continue;const M=i.resolved.value.entities.filter(X=>X.groupRef===q.id).map(X=>{const ke=x(X.entity.modelId),De=(ke==null?void 0:ke.computedPosition)??(ke==null?void 0:ke.position)??{x:0,y:0};return{id:X.entity.modelId,location:{x:De.x,y:De.y}}});i.dragGroup(q.id,{x:q.position.x,y:q.position.y},M)}return}for(const q of D){if(!q||q.type==="group")continue;const M=q.computedPosition??q.position,X=q.dimensions??{width:0,height:0},ke={x:M.x+X.width/2,y:M.y+X.height/2};q.type==="note"?i.dropNote(q.id,{x:M.x,y:M.y},fe(ke)):i.dropEntity(q.id,{x:M.x,y:M.y},fe(ke))}}function G($){var De,Le,Pe,He,et;if(!i.editable.value||!$.source||!$.target)return;const D=((De=x($.source))==null?void 0:De.type)==="note",se=((Le=x($.target))==null?void 0:Le.type)==="note";if(D||se){if(D&&se)return;const Ye=D?$.source:$.target,Ke=D?$.target:$.source;((Pe=x(Ke))==null?void 0:Pe.type)==="entity"&&i.addNoteConnection(Ye,Ke);return}const R=Ye=>{var Ke;return(Ke=i.state.logical.entities.find(je=>je.modelId===Ye))==null?void 0:Ke.stereotype},q=R($.source)==="JPA_EMBEDDABLE",M=R($.target)==="JPA_EMBEDDABLE";if(q||M){if(q&&M)return;const Ye=q?$.source:$.target,Ke=q?$.target:$.source;i.addEmbedAssociation(Ke,Ye);return}const X=(He=$.sourceHandle)!=null&&He.startsWith("r:")?$.sourceHandle.slice(2):void 0,ke=(et=$.targetHandle)!=null&&et.startsWith("l:")?$.targetHandle.slice(2):void 0;i.addAssociation($.source,$.target,X,ke)}const J=n.ref(null);function be($,D){var R;const se=i.state.layout.entityLayouts.find(q=>q.entityRef===$);return at((R=se==null?void 0:se.attributeStyles)==null?void 0:R[D])}function we($,D){var R;const se=i.state.layout.entityLayouts.find(q=>q.entityRef===$);return at((R=se==null?void 0:se.operationStyles)==null?void 0:R[D])}function $e($){var D;return at((D=i.state.layout.groupLayouts.find(se=>se.groupRef===$))==null?void 0:D.style)}function _e($){var D;return at((D=i.state.layout.notes.find(se=>se.modelId===$))==null?void 0:D.style)}function Ce($){var R,q;if($.preventDefault(),!i.editable.value)return;const D=()=>Y({x:$.clientX,y:$.clientY}),se=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const M=D();i.addEntity("NewEntity",{x:M.x,y:M.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const M=D();i.addNote("메모",{x:M.x,y:M.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const M=D();i.addEmptyGroup({x:M.x,y:M.y})}}];((R=i.clipboard.value)==null?void 0:R.kind)==="entity"&&se.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&se.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(q=J.value)==null||q.open($,se)}function Te({event:$,node:D}){var De,Le,Pe,He,et,Ye,Ke,je,Mo,ve,tt,Bo,Do,Oo,Lo,Po,zo,Uo;const se=$;if(se.preventDefault(),!i.editable.value){if(D.type==="group"||D.type==="note")return;const Me=(Le=(De=se.target)==null?void 0:De.closest("[data-attr]"))==null?void 0:Le.dataset.attr;if(Me){const Ze=i.selection.value;(Ze==null?void 0:Ze.kind)==="attribute"&&Ze.entityId===D.id&&Ze.ids.includes(Me)||i.selectAttribute(D.id,Me);const _n=((Pe=i.selection.value)==null?void 0:Pe.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[Me];(He=J.value)==null||He.open(se,[{caption:_n.length>1?`복사 (${_n.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(et=J.value)==null||et.open(se,[{caption:"상세 편집…",icon:"pencil",handler:()=>zi(a,i,D.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}]);return}if(D.type==="group"){const Me=i.isGroupLocked(D.id),Ze=[];Me||Ze.push({type:"swatches",caption:"색상",current:$e(D.id),onPick:ot=>i.setGroupSwatch(D.id,ot)},{type:"separator"}),Ze.push({caption:Me?"잠금 해제":"잠금",icon:Me?"unlock":"lock",handler:()=>i.setGroupLocked(D.id,!Me)}),Me||Ze.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(D.id)}),(Ye=J.value)==null||Ye.open(se,Ze);return}if(D.type==="note"){(Ke=J.value)==null||Ke.open(se,[{type:"swatches",caption:"색상",current:_e(D.id),onPick:Me=>i.setNoteSwatch(D.id,Me)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(D.id)}]);return}const R=(Mo=(je=se.target)==null?void 0:je.closest("[data-attr]"))==null?void 0:Mo.dataset.attr;if(R){const Me=i.selection.value;(Me==null?void 0:Me.kind)==="attribute"&&Me.entityId===D.id&&Me.ids.includes(R)||i.selectAttribute(D.id,R);const ot=((ve=i.selection.value)==null?void 0:ve.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[R];if(i.isEntityLocked(D.id)){(tt=J.value)==null||tt.open(se,[{caption:ot.length>1?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const _n=ot.length>1,Zl=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{type:"swatches",caption:_n?`색상 (${ot.length})`:"색상",current:_n?null:be(D.id,R),onPick:iC=>i.setAttributeSwatches(D.id,ot,iC)},{type:"separator"},{caption:_n?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Ho=i.clipboard.value;(Ho==null?void 0:Ho.kind)==="attribute"&&Zl.push({caption:Ho.attributes.length>1?`속성 붙여넣기 (${Ho.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Zl.push({type:"separator"},{caption:_n?`속성 삭제 (${ot.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(D.id,ot)}),(Bo=J.value)==null||Bo.open(se,Zl);return}const q=(Oo=(Do=se.target)==null?void 0:Do.closest("[data-op]"))==null?void 0:Oo.dataset.op;if(q){if(i.isEntityLocked(D.id))return;(Lo=J.value)==null||Lo.open(se,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(D.id)},{type:"swatches",caption:"색상",current:we(D.id,q),onPick:Me=>i.setOperationSwatch(D.id,q,Me)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(D.id,q)}]);return}const M=i.resolved.value.entities.find(Me=>Me.entity.modelId===D.id),X=!!(M!=null&&M.locked),ke=[{caption:X?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>zi(a,i,D.id)}];if(!X){ke.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(D.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Ze=S.value.filter(ot=>ot.type==="entity").map(ot=>ot.id);i.createGroup(Ze.includes(D.id)&&Ze.length?Ze:[D.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(D.id,D.id)});const Me=i.embeddableCatalog.value;if(Me.length){ke.push({type:"separator"});for(const Ze of Me){const ot=((Po=Ze.label)==null?void 0:Po.ko)??((zo=Ze.label)==null?void 0:zo.en)??Ze.type;ke.push({caption:`임베더블 추가: ${ot}`,icon:"link",handler:()=>i.addPredefinedEmbed(D.id,Ze.type)})}}}if(ke.push({type:"separator"}),ke.push({caption:M!=null&&M.collapsed?"펼치기":"접기",icon:M!=null&&M.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(D.id,!(M!=null&&M.collapsed))}),M!=null&&M.groupRef&&!X&&ke.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(D.id)}),ke.push({caption:X?"잠금 해제":"잠금",icon:X?"unlock":"lock",handler:()=>i.setEntityLocked(D.id,!X)}),ke.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}),!X){const Me=i.clipboard.value;(Me==null?void 0:Me.kind)==="attribute"&&ke.push({caption:Me.attributes.length>1?`속성 붙여넣기 (${Me.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),ke.push({type:"separator"}),ke.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(D.id)})}(Uo=J.value)==null||Uo.open(se,ke)}function Be({event:$,edge:D}){var q,M;const se=$;if(se.preventDefault(),!i.editable.value)return;const R=V(D.id);if(R){(q=J.value)==null||q.open(se,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(R.noteRef,R.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(R.noteRef,R.targetRef)}]);return}(M=J.value)==null||M.open(se,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(D.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(D.id)}])}function N($){return $==="group"?"group":$==="note"?"note":"entity"}function A({node:$}){if(S.value.length>1){i.selection.value=null;return}i.selection.value={kind:N($.type),id:$.id}}function ae({nodes:$}){$.length>1&&(i.selection.value=null)}function T({edge:$}){const D=V($.id);i.selection.value=D?{kind:"note",id:D.noteRef}:{kind:"association",id:$.id}}function z($){const D=i.selection.value;return!!D&&D.kind!=="attribute"&&D.id===$.id}function B($){var D,se;return z($)?$.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":$.type==="note"?"var(--em-note-soft)":$.type==="group"?Vd(at((D=$.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":Vd(at((se=$.data)==null?void 0:se.style))??"var(--em-mm-entity)"}function me($){return z($)?"var(--em-selection)":$.type==="note"?"var(--em-note-accent)":$.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function Z($,D){oe($,D,{zoom:k().zoom,duration:350})}n.watch(()=>i.focusRequest.value,$=>{if(!$)return;const D=x($.id);if(!D)return;const se=D.computedPosition??D.position,R=D.dimensions??{width:0,height:0};Z(se.x+R.width/2,se.y+R.height/2)});function Q({position:$}){Z($.x,$.y)}function te({node:$}){i.selection.value={kind:N($.type),id:$.id};const D=$.computedPosition??$.position,se=$.dimensions??{width:0,height:0};Z(D.x+se.width/2,D.y+se.height/2)}function de({node:$}){L({nodes:[$.id],duration:350,maxZoom:1.2,padding:.6})}return($,D)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(d1),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!U.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":n.unref(i).editable.value,"nodes-connectable":n.unref(i).editable.value,"connection-mode":n.unref(Dt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:j,onMoveEnd:W,onConnect:G,onConnectStart:D[1]||(D[1]=se=>c.value=!0),onConnectEnd:D[2]||(D[2]=se=>c.value=!1),onNodeDrag:I,onNodeDragStop:C,onNodeClick:A,onEdgeClick:T,onSelectionChange:ae,onPaneClick:D[3]||(D[3]=se=>n.unref(i).selection.value=null),onPaneContextMenu:Ce,onNodeContextMenu:Te,onEdgeContextMenu:Be},{"node-group":n.withCtx(se=>[n.createVNode(Hd,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),"node-entity":n.withCtx(se=>[n.createVNode(Ud,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),"node-note":n.withCtx(se=>[n.createVNode(Fd,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),"edge-association":n.withCtx(se=>[n.createVNode(ou,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),"edge-note-connection":n.withCtx(se=>[n.createVNode(I$,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(hw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Uw),{"show-interactive":!1,position:"bottom-left"},{default:n.withCtx(()=>[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(n.unref(hn),{class:"em-palette__group-start",title:"엔티티 추가",onClick:ye},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"노트 추가",onClick:ue},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"자동 배치",onClick:D[0]||(D[0]=se=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:14})]),_:1})],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(v$),{key:1,pannable:"",width:224,height:160,"node-color":B,"node-stroke-color":me,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:Q,onNodeClick:te,onNodeDblclick:de})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),re.value?(n.openBlock(),n.createElementBlock("div",Q$,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[D[4]||(D[4]=n.createElementVNode("p",{class:"em-canvas__empty-title"},"빈 다이어그램입니다",-1)),D[5]||(D[5]=n.createElementVNode("p",{class:"em-canvas__empty-hint"},[n.createTextVNode(" 캔버스를 "),n.createElementVNode("strong",null,"우클릭"),n.createTextVNode("하거나 좌하단 "),n.createElementVNode("strong",null,"+"),n.createTextVNode(" 버튼으로 첫 엔티티를 추가하세요. ")],-1)),D[6]||(D[6]=n.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub"},[n.createTextVNode(" 단축키 도움말은 "),n.createElementVNode("kbd",null,"?"),n.createTextVNode(" 키 ")],-1))],64)):(n.openBlock(),n.createElementBlock("p",ex,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",tx,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",nx,[n.createElementVNode("strong",ox,n.toDisplayString(s.value.title),1),n.createElementVNode("span",ix,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(L$,{ref_key:"menuRef",ref:J},null,512),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",ax,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function ca(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function lx(e,t){const o=new Set,i=a=>{const l=!!a.matchText&&a.matchText.includes(t);let r=!1;for(const c of a.children)i(c)&&(r=!0);const s=l||r;return s&&o.add(a.key),s};return i(e),o}const rx={class:"em-explorer em-scroll-overlay"},sx={class:"em-explorer__search"},cx={key:0,class:"em-explorer__empty"},dx={class:"em-explorer__rows"},ux=["data-key","onClick","onDblclick"],fx=["onClick"],mx=["title"],px={class:"em-key-slot"},hx={class:"em-key-slot"},yx={class:"em-explorer__label"},nf=Ue(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.computed(()=>{var le;const x=i.resolved.value,O=i.displayMode.value,P=E=>{var K,re,pe;return Fo(O,E.name,(re=(K=E.table)==null?void 0:K.logicalName)==null?void 0:re.ko,(pe=E.table)==null?void 0:pe.physicalName)},H=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",ne=E=>{const K=E.attrType.startsWith("RELATION")&&E.dbAttrs.length>0;return{icon:E.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:E.identifier,fk:K&&H}}},ce=E=>E.attrType.startsWith("EMBED")&&E.dbAttrs.length>0,L=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",oe=E=>{if(E.attrType!=="EMBED_PREDEF")return E.dbAttrs;const K=i.embeddableCatalog.value.find(re=>re.type===E.type);return K?E.dbAttrs.map((re,pe)=>{const ye=K.fields[pe];return ye?{...re,physicalName:re.physicalName||ye.physicalName,logicalName:re.logicalName??ye.logicalName,dataType:re.dataType||ye.dataType,length:re.length??ye.length}:re}):E.dbAttrs},k=(E,K)=>{var ue,fe,ge,Ee,Re,Ie,he,j,W;const re={entityId:K,attrId:E.modelId};if(ce(E)){const w=va(O,E);return{key:`attr:${E.modelId}`,label:E.name+(w?` : ${w}`:""),icon:"table",attrRef:re,focusId:K,matchText:ca(E.name,(fe=(ue=E.dbAttrs[0])==null?void 0:ue.logicalName)==null?void 0:fe.ko,(ge=E.dbAttrs[0])==null?void 0:ge.physicalName),children:L?oe(E).map(I=>{var C,G;return{key:`attr:${E.modelId}:col:${I.modelId}`,label:Fo(O,I.physicalName,(C=I.logicalName)==null?void 0:C.ko,I.physicalName)+(I.dataType?` : ${I.dataType}`:""),icon:"field",attrRef:re,focusId:K,matchText:ca(I.physicalName,(G=I.logicalName)==null?void 0:G.ko),children:[]}}):[]}}const pe=pr(E,i.state.logical.associations),ye=va(O,E,pe);return{key:`attr:${E.modelId}`,label:Fo(O,E.name,(Re=(Ee=E.dbAttrs[0])==null?void 0:Ee.logicalName)==null?void 0:Re.ko,(Ie=E.dbAttrs[0])==null?void 0:Ie.physicalName)+(ye?` : ${ye}`:""),...ne(E),attrRef:re,focusId:K,matchText:ca(E.name,(j=(he=E.dbAttrs[0])==null?void 0:he.logicalName)==null?void 0:j.ko,(W=E.dbAttrs[0])==null?void 0:W.physicalName),children:[]}},Y=E=>{var pe,ye,ue;const K=E.entity,re=[...K.attributes].sort((fe,ge)=>fe.order-ge.order);return{key:`entity:${K.modelId}`,label:P(K),icon:"table",selectKind:"entity",selectId:K.modelId,focusId:K.modelId,matchText:ca(K.name,(ye=(pe=K.table)==null?void 0:pe.logicalName)==null?void 0:ye.ko,(ue=K.table)==null?void 0:ue.physicalName),children:re.map(fe=>k(fe,K.modelId))}},S=new Map,F=[];for(const E of x.entities)if(E.groupRef){const K=S.get(E.groupRef)??[];K.push(E),S.set(E.groupRef,K)}else F.push(E);const U=[];for(const E of x.groups){const K=E.group;U.push({key:`group:${K.modelId}`,label:((le=K.name)==null?void 0:le.ko)||K.packageName||"(그룹)",icon:"folder",focusId:K.modelId,children:(S.get(K.modelId)??[]).map(Y)})}for(const E of F)U.push(Y(E));if(x.associations.length){const E=new Map(x.entities.map(K=>[K.entity.modelId,P(K.entity)]));U.push({key:"section:associations",label:`관계 (${x.associations.length})`,icon:"arrow-lr",children:x.associations.map(K=>{const re=K.association,pe=E.get(re.end1.entityRef)??re.end1.entityRef,ye=E.get(re.end2.entityRef)??re.end2.entityRef;return{key:`assoc:${re.modelId}`,label:`${pe} — ${ye}`,icon:"arrow-lr",selectKind:"association",selectId:re.modelId,children:[]}})})}return x.notes.length&&U.push({key:"section:notes",label:`노트 (${x.notes.length})`,icon:"note",children:x.notes.map(({note:E})=>{var K;return{key:`note:${E.modelId}`,label:((K=E.memo.split(`
43
- `)[0])==null?void 0:K.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:E.modelId,focusId:E.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:U}});function r(x){return x?x.pk&&x.fk?"PFK (식별 외래키)":x.pk?"PK (기본키)":x.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(x){const O=new Set(s.value);O.has(x)?O.delete(x):O.add(x),s.value=O}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),h=n.computed(()=>{const x=[];if(f.value){const P=lx(l.value,d.value.trim().toLowerCase()),H=(ne,ce)=>{if(P.has(ne.key)){x.push({node:ne,depth:ce});for(const L of ne.children)H(L,ce+1)}};return H(l.value,0),x}const O=(P,H)=>{if(x.push({node:P,depth:H}),!s.value.has(P.key))for(const ne of P.children)O(ne,H+1)};return O(l.value,0),x}),m=n.computed(()=>f.value&&h.value.length<=1);function p(x){var H;if(x.key!=="/"||x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;const O=x.target,P=O==null?void 0:O.tagName;P==="INPUT"||P==="TEXTAREA"||P==="SELECT"||O!=null&&O.isContentEditable||(x.preventDefault(),(H=u.value)==null||H.focus())}n.onMounted(()=>window.addEventListener("keydown",p)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",p));const g=n.computed(()=>{const x=[],O=P=>{if(P.children.length){P.key!=="root"&&x.push(P.key);for(const H of P.children)O(H)}};return O(l.value),x}),b=n.computed(()=>!g.value.some(x=>s.value.has(x)));function _(){s.value=b.value?new Set(g.value):new Set}t({toggleAll:_,allExpanded:b,hasExpandable:n.computed(()=>g.value.length>0)});function V(x){const O=i.selection.value;return x.attrRef?(O==null?void 0:O.kind)==="attribute"&&O.entityId===x.attrRef.entityId&&O.ids.includes(x.attrRef.attrId):!!O&&O.kind!=="attribute"&&!!x.selectId&&x.selectKind===O.kind&&x.selectId===O.id}function y(x){const O=i.selection.value;return x.selectKind==="entity"&&(O==null?void 0:O.kind)==="attribute"&&O.entityId===x.selectId}function v(x,O){if(x.attrRef){const P=O.shiftKey?"range":O.metaKey||O.ctrlKey?"toggle":"replace";i.selectAttribute(x.attrRef.entityId,x.attrRef.attrId,P)}else x.selectKind&&x.selectId&&(i.selection.value={kind:x.selectKind,id:x.selectId});x.focusId&&i.requestFocus(x.focusId)}function ee(x){x.selectKind==="entity"&&x.selectId&&zi(a,i,x.selectId)}return(x,O)=>(n.openBlock(),n.createElementBlock("section",rx,[n.createElementVNode("div",sx,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":O[0]||(O[0]=P=>d.value=P),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:O[1]||(O[1]=n.withKeys(P=>d.value="",["esc"]))},null,544),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":"검색어 지우기",title:"지우기 (Esc)",onClick:O[2]||(O[2]=P=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("p",cx,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",dx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,({node:P,depth:H})=>(n.openBlock(),n.createElementBlock("div",{key:P.key,class:n.normalizeClass(["em-explorer__row",{"is-active":V(P),"is-focus-parent":y(P),"is-selectable":!!P.selectKind||!!P.attrRef||!!P.focusId}]),"data-key":P.key,style:n.normalizeStyle({paddingLeft:4+H*14+"px"}),onClick:ne=>v(P,ne),onDblclick:ne=>ee(P)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!P.children.length,"is-open":!s.value.has(P.key)}]),onClick:n.withModifiers(ne=>P.children.length&&c(P.key),["stop"])},[P.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,fx),P.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(P.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",px,[P.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):P.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:P.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",hx,[P.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,mx)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:P.icon,size:15},null,8,["name"])),n.createElementVNode("span",yx,n.toDisplayString(P.label),1)],46,ux))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),gx={class:"em-text-export"},bx={key:0,class:"em-text-export__tabs",role:"tablist"},_x=["aria-selected","onClick"],kx={class:"em-text-export__pre"},wx={class:"em-text-export__actions"},Ex=Ue(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(0);function a(){return t.formats[i.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(a().content),ie.showNotification("클립보드에 복사되었습니다.","info")}catch{ie.showNotification("복사에 실패했습니다.","error")}}function r(){const s=a(),c=new Blob([s.content],{type:"text/plain;charset=utf-8"}),d=URL.createObjectURL(c);try{const u=document.createElement("a");u.href=d,u.download=s.filename,document.body.appendChild(u),u.click(),u.remove()}finally{URL.revokeObjectURL(d)}}return(s,c)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",gx,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",bx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.formats,(d,u)=>(n.openBlock(),n.createElementBlock("button",{key:d.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-export__tab",{"is-active":u===i.value}]),"aria-selected":u===i.value,onClick:f=>i.value=u},n.toDisplayString(d.label),11,_x))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",kx,n.toDisplayString(a().content),1),n.createElementVNode("div",wx,[n.createVNode(n.unref(ie.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ie.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),vx={class:"em-toolbar"},Nx={class:"em-toolbar__mode"},of=Ue(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ie.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:m=>i.displayMode.value=m});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(p=>p.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){const m=i.state.logical;l.openModal({component:Ex,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:ar(m),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:ga(m,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:ga(m,"class"),filename:"diagram.class.mmd"}]}})}function h(){l.openModal({component:ef})}return(m,p)=>(n.openBlock(),n.createElementBlock("div",vx,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:p[0]||(p[0]=g=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:p[1]||(p[1]=g=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),p[10]||(p[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",Nx,[p[8]||(p[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:s.value,"onUpdate:modelValue":p[2]||(p[2]=g=>s.value=g),items:r,"value-provider":g=>g.v,"label-provider":g=>g.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:p[3]||(p[3]=g=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:p[4]||(p[4]=g=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:d.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),p[11]||(p[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"내보내기 (텍스트 · Mermaid)",onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:p[5]||(p[5]=g=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:p[6]||(p[6]=g=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[p[9]||(p[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:p[7]||(p[7]=g=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:"키보드 단축키 (?)",onClick:h},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1})]))}}),[["__scopeId","data-v-aea19e30"]]),$x={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},xx=["title"],Ix=["disabled","aria-pressed"],Sx=["disabled","aria-pressed"],Cx=Ue(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t;function a(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,r)=>e.frozen?(n.openBlock(),n.createElementBlock("div",$x,[n.createVNode(Ve,{name:"lock",size:14}),r[2]||(r[2]=n.createElementVNode("span",null,"편집 잠김 (충돌)",-1))])):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:"이 다이어그램은 조회 전용입니다"},[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:r[0]||(r[0]=s=>a(!1))},[n.createVNode(Ve,{name:"eye",size:13}),r[3]||(r[3]=n.createElementVNode("span",null,"조회",-1))],10,Ix),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:r[1]||(r[1]=s=>a(!0))},[n.createVNode(Ve,{name:"pencil",size:13}),r[4]||(r[4]=n.createElementVNode("span",null,"편집",-1))],10,Sx)],10,xx))}}),[["__scopeId","data-v-44f7d737"]]),Rx=["disabled"],Vx={class:"em-panel__sub"},Ax={class:"em-nav"},Tx={key:0,class:"em-nav__divider","aria-hidden":"true"},Mx={key:1},Bx=["onClick","onKeydown"],Dx={class:"em-nav__name"},Ox=["title"],Lx={key:0,class:"em-panel__note"},Px=["data-attr-block"],zx={class:"em-attr__row"},Ux=["title"],Hx={key:0,class:"em-attr__row"},Fx={class:"em-attr__row"},Gx={class:"em-attr__row"},Yx={class:"em-attr__flags"},Wx={class:"em-attr__pii"},Kx={class:"em-attr__pii"},qx={class:"em-attr__pii"},Xx={key:0,class:"em-attr__pii em-attr__codetop"},jx={class:"em-multilang"},Zx={key:2,class:"em-embed-cols"},Jx={class:"em-embed-col__label"},Qx={class:"em-attr__row"},eI={class:"em-attr__row"},tI={key:0,class:"em-embed-upd"},nI={class:"em-embed-upd"},oI={class:"em-embed-upd"},iI={class:"em-swatch__row em-attr__swatch"},aI=["onClick"],lI=["title","onClick"],rI={key:0,class:"em-attr__swatch-hint"},sI="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",da="__OWN__",cI=Ue(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(R=>R.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(R=>R.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes.filter(q=>q.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes)??[]}),d=n.computed(()=>s.value.filter(R=>r.value.has(R.modelId)));function u(R){return{pk:R.identifier,fk:R.attrType.startsWith("RELATION")&&R.dbAttrs.length>0,required:R.notNull&&!R.identifier}}function f(R){return!!i.value&&!!ni(o.state.logical,i.value.modelId,R.modelId)}function h(R){const q=u(R),M=[q.pk&&"PK",q.fk&&"FK",q.required&&"NOT NULL"].filter(Boolean);return M.length?M.join(" · "):void 0}function m(R,q){i.value&&o.selectAttribute(i.value.modelId,R.modelId,q.shiftKey?"range":q.metaKey||q.ctrlKey?"toggle":"replace")}const p=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function g(R){return R==="none"?"(없음)":R}const b=R=>R;function _(R){var q,M;return at((M=(q=a.value)==null?void 0:q.attributeStyles)==null?void 0:M[R.modelId])}function V(R){return r.value.size>1&&r.value.has(R.modelId)}function y(R,q){if(!i.value)return;const M=V(R)?o.selectedAttrIds.value:[R.modelId];o.setAttributeSwatches(i.value.modelId,M,q)}function v(R,q){i.value&&o.updateAttribute(i.value.modelId,R.modelId,q)}function ee(R,q){v(R,{naturalId:q||void 0,naturalIdMutable:q?R.naturalIdMutable:void 0})}function x(){return{naturalId:void 0,naturalIdMutable:void 0}}function O(R,q){v(R,{identifier:q,...q?x():{}})}function P(R,q){v(R,{transient:q||void 0,...q?x():{}})}function H(R){return!!R.transient}const ne=R=>R.value,ce=R=>R.label;function L(R,q){if(!q)return;const M=E.value.find(X=>X.type===q);if(M){const X=R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"};v(R,{type:q,customType:void 0,dbAttrs:[{...X,dataType:M.dataType,length:M.length,scale:M.scale}]});return}v(R,q===Ct?{type:q}:{type:q,customType:void 0})}function oe(R,q){v(R,{customType:q.trim()===""?void 0:q})}function k(R,q){const X={...R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"},...q};q.dataType!==void 0&&!Go.has(X.dataType)&&(X.scale=void 0),v(R,{dbAttrs:[X]})}function Y(R){var q;return Go.has(((q=R.dbAttrs[0])==null?void 0:q.dataType)??"")}function S(R,q,M){var X;k(R,{logicalName:{...(X=R.dbAttrs[0])==null?void 0:X.logicalName,[q]:M}})}function F(R,q){v(R,{description:Object.keys(q).length?q:void 0})}function U(R){return R.personalInfoAttributeType??"none"}function le(R,q){v(R,{personalInfoAttributeType:q==="none"?void 0:q})}const E=n.computed(()=>o.predefinedCustomTypeCatalog.value),K=n.computed(()=>o.embeddableCatalog.value),re=n.ref(void 0);function pe(R){var q,M;return((q=R.label)==null?void 0:q.ko)??((M=R.label)==null?void 0:M.en)??R.type}function ye(R){if(!R||!i.value)return;const q=o.addPredefinedEmbed(i.value.modelId,R);q&&o.selectAttribute(i.value.modelId,q),re.value=void 0}function ue(){if(!i.value)return;const R=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,R)}const fe=n.computed(()=>o.groupCodeCatalog.value);function ge(R){var q;return((q=fe.value.find(M=>M.groupCode===R.groupCode))==null?void 0:q.codes)??[]}function Ee(R){return["none",...ge(R)]}function Re(R){return R==="none"?"none":R.code}function Ie(R){var M,X;if(R==="none")return"(없음)";const q=((M=R.label)==null?void 0:M.ko)??((X=R.label)==null?void 0:X.en);return q?`${R.code} (${q})`:R.code}function he(R,q){i.value&&o.setAttributeGroupCode(i.value.modelId,R.modelId,q)}function j(R,q){v(R,{defaultValue:q==="none"?void 0:q})}function W(R,q){v(R,{defaultValue:q.trim()===""?void 0:q})}function w(R){return R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0}function I(R,q,M){const X=R.dbAttrs.map((ke,De)=>{if(De!==q)return ke;const Le={...ke,...M};for(const Pe of Object.keys(M))M[Pe]===void 0&&delete Le[Pe];return Le});i.value&&o.setEmbedColumns(i.value.modelId,R.modelId,X)}function C(R,q,M,X){var ke;I(R,q,{logicalName:{...(ke=R.dbAttrs[q])==null?void 0:ke.logicalName,[M]:X}})}function G(R,q){var ke,De,Le;if(R.attrType==="EMBED_PREDEF"){const Pe=(ke=o.embeddableCatalog.value.find(He=>He.type===R.type))==null?void 0:ke.fields[q];return Pe?{name:Pe.name,physicalName:Pe.physicalName,dataType:Pe.dataType,length:Pe.length,shareable:Pe.shareable,logicalName:Pe.logicalName}:void 0}const M=(De=R.embedded)==null?void 0:De.embeddableRef;if(!M)return;const X=(Le=o.state.logical.entities.find(Pe=>Pe.modelId===M))==null?void 0:Le.attributes.flatMap(Pe=>Pe.dbAttrs)[q];return X?{physicalName:X.physicalName,dataType:X.dataType,length:X.length,scale:X.scale,logicalName:X.logicalName}:void 0}function J(R,q){var M,X;return((M=G(R,q))==null?void 0:M.dataType)||((X=R.dbAttrs[q])==null?void 0:X.dataType)||""}function be(R,q){var M,X;return((M=G(R,q))==null?void 0:M.length)??((X=R.dbAttrs[q])==null?void 0:X.length)}function we(R,q){var M,X;return((M=G(R,q))==null?void 0:M.scale)??((X=R.dbAttrs[q])==null?void 0:X.scale)}const $e=["inherit","true","false"];function _e(R){return R==="inherit"?"기본(따름)":R}function Ce(R){return(R==null?void 0:R.updatable)===void 0?"inherit":R.updatable?"true":"false"}function Te(R,q,M){I(R,q,{updatable:M==="inherit"?void 0:M==="true"})}function Be(R,q){k(R,{updatable:q==="inherit"?void 0:q==="true"})}const N=["inherit","true","false"];function A(R){return R==="inherit"?"기본(따름)":R}function ae(R){return(R==null?void 0:R.insertable)===void 0?"inherit":R.insertable?"true":"false"}function T(R,q,M){I(R,q,{insertable:M==="inherit"?void 0:M==="true"})}function z(R,q){k(R,{insertable:q==="inherit"?void 0:q==="true"})}const B=n.computed(()=>i.value?Yo(i.value,o.state.logical.entities):[]),me=n.computed(()=>qn(B.value.flatMap(R=>R.attributes.flatMap(q=>q.dbAttrs)))),Z=n.computed(()=>B.value.flatMap(R=>R.attributes.filter(q=>q.attrType==="NORMAL"&&q.dbAttrs.length===1&&q.dbAttrs[0]).map(q=>{var M;return{modelId:q.dbAttrs[0].modelId,physical:q.dbAttrs[0].physicalName||q.name,isCurrency:q.type==="Currency",ownerName:R.modelId===((M=i.value)==null?void 0:M.modelId)?void 0:R.name}})));function Q(){const R=[...Z.value].sort((q,M)=>Number(M.isCurrency)-Number(q.isCurrency));return[da,...R.map(q=>q.modelId)]}function te(R){if(R===da)return"전용 컬럼(OWN)";const q=Z.value.find(X=>X.modelId===R);return q?`↗ ${q.ownerName?`${q.ownerName}.`:""}${q.physical} (${q.isCurrency?"통화":"공유"})`:R}function de(R){return(R==null?void 0:R.sharedColumnRef)??da}function $(R,q,M){I(R,q,{sharedColumnRef:M===da?void 0:M})}function D(R){return(R==null?void 0:R.sharedColumnRef)!=null}function se(R){var q;return((q=Wo(R,me.value))==null?void 0:q.physicalName)??""}return(R,q)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",Vx,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:ue}),K.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":re.value,items:K.value,"value-provider":M=>M.type,"label-provider":pe,"onUpdate:modelValue":ye},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",Ax,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,M=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:M.modelId},[M.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",Tx,[...q[0]||(q[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",Mx,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(M.modelId)}]),role:"button",tabindex:"0",onClick:X=>m(M,X),onKeydown:[n.withKeys(n.withModifiers(X=>m(M,X),["prevent"]),["enter"]),n.withKeys(n.withModifiers(X=>m(M,X),["prevent"]),["space"])]},[n.createElementVNode("span",Dx,n.toDisplayString(M.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:h(M)},[u(M).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(M).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(M).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,Ox)],42,Bx)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",Lx," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,M=>{var X,ke,De,Le,Pe,He,et,Ye,Ke,je,Mo;return n.openBlock(),n.createElementBlock("div",{key:M.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(M.modelId)}]),"data-attr-block":M.modelId},[n.createElementVNode("div",zx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-name-${M.modelId}`,width:"100%",placeholder:"이름","model-value":M.name,"onUpdate:modelValue":ve=>v(M,{name:ve})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-type-${M.modelId}`,width:"84px",placeholder:"타입",disabled:M.attrType.startsWith("EMBED")||!!M.groupCode,items:n.unref(mr)(M.type,E.value),"value-provider":ne,"label-provider":ce,"model-value":M.type,"onUpdate:modelValue":ve=>L(M,ve)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(M)?sI:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ve=>n.unref(o).removeAttribute(i.value.modelId,M.modelId)},null,8,["onClick"])],8,Ux)]),M.type===n.unref(Ct)?(n.openBlock(),n.createElementBlock("div",Hx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-customtype-${M.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":M.customType??"","onUpdate:modelValue":ve=>oe(M,ve)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),w(M)?(n.openBlock(),n.createElementBlock("div",Zx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(M.dbAttrs,(ve,tt)=>{var Bo,Do,Oo,Lo,Po,zo,Uo;return n.openBlock(),n.createElementBlock("div",{key:ve.modelId,class:"em-embed-col"},[n.createElementVNode("span",Jx,n.toDisplayString(((Bo=G(M,tt))==null?void 0:Bo.name)??((Do=G(M,tt))==null?void 0:Do.physicalName)??`컬럼 ${tt+1}`),1),n.createElementVNode("div",Qx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-col-${ve.modelId}`,width:"100%",disabled:D(ve),placeholder:((Oo=G(M,tt))==null?void 0:Oo.physicalName)??"컬럼","model-value":D(ve)?se(ve):ve.physicalName,"onUpdate:modelValue":Me=>I(M,tt,{physicalName:Me})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSTextInput),{name:`embed-dtype-${ve.modelId}`,width:"84px",disabled:"","model-value":J(M,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-len-${ve.modelId}`,width:"48px",disabled:"","model-value":be(M,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-scale-${ve.modelId}`,width:"48px",disabled:"","model-value":we(M,tt)},null,8,["name","model-value"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":ve.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",eI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-logical-${ve.modelId}`,width:"100%",placeholder:((Po=(Lo=G(M,tt))==null?void 0:Lo.logicalName)==null?void 0:Po.ko)??"논리명","model-value":((zo=ve.logicalName)==null?void 0:zo.ko)??"","onUpdate:modelValue":Me=>C(M,tt,"ko",Me)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Uo=G(M,tt))!=null&&Uo.shareable?(n.openBlock(),n.createElementBlock("label",tI,[q[7]||(q[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px","model-value":de(ve),items:Q(),"value-provider":b,"label-provider":te,"onUpdate:modelValue":Me=>Me&&$(M,tt,Me)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",nI,[q[8]||(q[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:D(ve),"model-value":D(ve)?"false":ae(ve),items:N,"value-provider":b,"label-provider":A,"onUpdate:modelValue":Me=>Me&&T(M,tt,Me)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",oI,[q[9]||(q[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:D(ve),"model-value":D(ve)?"false":Ce(ve),items:$e,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":Me=>Me&&Te(M,tt,Me)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",Fx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-logical-${M.modelId}`,width:"100%",placeholder:"논리명","model-value":((ke=(X=M.dbAttrs[0])==null?void 0:X.logicalName)==null?void 0:ke.ko)??"","onUpdate:modelValue":ve=>S(M,"ko",ve)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Gx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-col-${M.modelId}`,width:"100%",placeholder:"컬럼",disabled:H(M),"model-value":((De=M.dbAttrs[0])==null?void 0:De.physicalName)??"","onUpdate:modelValue":ve=>k(M,{physicalName:ve})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-dtype-${M.modelId}`,width:"84px",placeholder:"dataType",disabled:H(M),items:n.unref(ur)(((Le=M.dbAttrs[0])==null?void 0:Le.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":b,"label-provider":n.unref(ka),"model-value":((Pe=M.dbAttrs[0])==null?void 0:Pe.dataType)??"","onUpdate:modelValue":ve=>ve&&k(M,{dataType:ve})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-len-${M.modelId}`,width:"48px",placeholder:"len",disabled:H(M),"model-value":(He=M.dbAttrs[0])==null?void 0:He.length,"onUpdate:modelValue":ve=>k(M,{length:ve||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-scale-${M.modelId}`,width:"48px",placeholder:"scale",disabled:H(M)||!Y(M),"model-value":(et=M.dbAttrs[0])==null?void 0:et.scale,"onUpdate:modelValue":ve=>k(M,{scale:ve||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Ye=M.dbAttrs[0])==null?void 0:Ye.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",Yx,[n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-pk-${M.modelId}`,label:"Primary Key","model-value":M.identifier,disabled:l.value||H(M),"onUpdate:modelValue":ve=>O(M,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nn-${M.modelId}`,label:"Not Null","model-value":M.notNull,disabled:H(M),"onUpdate:modelValue":ve=>v(M,{notNull:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-uq-${M.modelId}`,label:"Unique","model-value":!!((Ke=M.dbAttrs[0])!=null&&Ke.unique),disabled:H(M),"onUpdate:modelValue":ve=>k(M,{unique:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-ai-${M.modelId}`,label:"Auto Increment","model-value":!!((je=M.dbAttrs[0])!=null&&je.autoIncrement),disabled:H(M)||!M.identifier,"onUpdate:modelValue":ve=>k(M,{autoIncrement:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-tr-${M.modelId}`,label:"@Transient","model-value":!!M.transient,disabled:M.identifier,"onUpdate:modelValue":ve=>P(M,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nid-${M.modelId}`,label:"@NaturalId","model-value":!!M.naturalId,disabled:M.identifier||H(M),"onUpdate:modelValue":ve=>ee(M,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${M.modelId}`,label:"mutable","model-value":!!M.naturalIdMutable,disabled:H(M)||!M.naturalId,"onUpdate:modelValue":ve=>v(M,{naturalIdMutable:ve||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-mv-${M.modelId}`,label:"Multi-Value (Set)","model-value":!!((Mo=M.dbAttrs[0])!=null&&Mo.multiValue),disabled:H(M),"onUpdate:modelValue":ve=>k(M,{multiValue:ve||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",Wx,[q[1]||(q[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:H(M),"model-value":ae(M.dbAttrs[0]),items:N,"value-provider":b,"label-provider":A,"onUpdate:modelValue":ve=>ve&&z(M,ve)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Kx,[q[2]||(q[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:H(M),"model-value":Ce(M.dbAttrs[0]),items:$e,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":ve=>ve&&Be(M,ve)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",qx,[q[3]||(q[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":U(M),items:p,"value-provider":b,"label-provider":g,"onUpdate:modelValue":ve=>ve&&le(M,ve)},null,8,["model-value","onUpdate:modelValue"])]),fe.value.length?(n.openBlock(),n.createElementBlock("label",Xx,[q[4]||(q[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Md,{"model-value":M.groupCode,items:fe.value,"onUpdate:modelValue":ve=>he(M,ve)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!fe.value.length}])},[q[5]||(q[5]=n.createElementVNode("span",null,"기본값",-1)),ge(M).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":M.defaultValue??"none",items:Ee(M),"value-provider":Re,"label-provider":Ie,"onUpdate:modelValue":ve=>ve&&j(M,ve)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`attr-default-${M.modelId}`,width:"100%",placeholder:"기본값","model-value":M.defaultValue??"","onUpdate:modelValue":ve=>W(M,ve)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",jx,[q[6]||(q[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(El,{multiline:"",name:`attr-desc-${M.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":M.description,"onUpdate:modelValue":ve=>F(M,ve)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",iI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(M)===null}]),title:"없음",onClick:ve=>y(M,null)},"∅",10,aI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),ve=>(n.openBlock(),n.createElementBlock("button",{key:ve,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(M)===ve}]),style:n.normalizeStyle({background:n.unref(On)(ve)}),title:n.unref(Dn)(ve),onClick:tt=>y(M,ve)},null,14,lI))),128)),V(M)?(n.openBlock(),n.createElementBlock("span",rI,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,Px)}),128))],8,Rx)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4d527728"]]),dI=["disabled"],uI={class:"em-panel__sub-label"},fI={class:"em-attr__row"},mI={class:"em-field em-idx-params"},pI=["value","onChange"],hI=Ue(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(m=>m.modelId===o.entityId)??null);function r(){var p;if(!l.value)return;const m=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:Oe(),name:`idx_${(((p=l.value.indexes)==null?void 0:p.length)??0)+1}`,unique:!1,columns:m?[{columnRef:m.modelId,descending:!1}]:[]})}function s(m,p){l.value&&a.updateIndex(l.value.modelId,m,p)}function c(m){var g;const p=(g=l.value)==null?void 0:g.attributes[0];p&&s(m.modelId,{columns:[...m.columns,{columnRef:p.modelId,descending:!1}]})}function d(m,p,g){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,columnRef:g}:b)})}function u(m,p,g){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,descending:g}:b)})}function f(m,p){s(m.modelId,{columns:m.columns.filter((g,b)=>b!==p)})}function h(m,p){s(m.modelId,{parameters:p.trim()===""?void 0:p})}return(m,p)=>{var g;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:p[0]||(p[0]=b=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",uI,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 인덱스 ("+n.toDisplayString(((g=l.value.indexes)==null?void 0:g.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(r,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],b=>(n.openBlock(),n.createElementBlock("div",{key:b.modelId,class:"em-attr"},[n.createElementVNode("div",fI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`idx-name-${b.modelId}`,width:"100%",placeholder:"인덱스명","model-value":b.name,"onUpdate:modelValue":_=>s(b.modelId,{name:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-uq-${b.modelId}`,class:"em-check",label:"UQ","model-value":b.unique,"onUpdate:modelValue":_=>s(b.modelId,{unique:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(a).removeIndex(l.value.modelId,b.modelId)},null,8,["onClick"])]),n.createVNode(mn,{controller:n.unref(a),"ref-id":b.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.columns,(_,V)=>(n.openBlock(),n.createElementBlock("div",{key:V,class:"em-attr__row"},[n.createVNode(n.unref(ie.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":y=>y.modelId,"label-provider":y=>y.name,"onUpdate:modelValue":y=>y&&d(b,V,y)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-${b.modelId}-desc-${V}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":y=>u(b,V,y)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"−",onClick:y=>f(b,V)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(b)},null,8,["onClick"]),n.createElementVNode("label",mI,[p[1]||(p[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:b.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:_=>h(b,_.target.value)},null,40,pI)])]))),128)):n.createCommentVNode("",!0)],8,dI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),yI=["disabled"],gI={class:"em-panel__sub-label"},bI={class:"em-attr__row"},_I={class:"em-attr__row"},kI={class:"em-multilang"},wI={class:"em-attr__pii"},EI={class:"em-swatch__row em-attr__swatch"},vI=["onClick"],NI=["title","onClick"],$I=Ue(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=ie.useModal(),r=n.computed(()=>a.state.logical.entities.find(y=>y.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(y=>y.entityRef===r.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(y){return y==="none"?"(없음)":y}const f=y=>y;function h(y,v){r.value&&a.updateOperation(r.value.modelId,y.modelId,v)}function m(y,v){h(y,{description:Object.keys(v).length?v:void 0})}function p(y){return y.personalInfoAttributeType??"none"}function g(y,v){h(y,{personalInfoAttributeType:v==="none"?void 0:v})}function b(y){var v,ee;return at((ee=(v=s.value)==null?void 0:v.operationStyles)==null?void 0:ee[y.modelId])}function _(y,v){r.value&&a.setOperationSwatch(r.value.modelId,y.modelId,v)}function V(y){l.openModal({component:Bd,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:v=>h(y,{sourceCode:v})}})}return(y,v)=>{var ee;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:v[1]||(v[1]=x=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",gI,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 오퍼레이션 ("+n.toDisplayString(((ee=r.value.operations)==null?void 0:ee.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:v[0]||(v[0]=n.withModifiers(x=>n.unref(a).addOperation(r.value.modelId),["stop"]))})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.operations??[],x=>(n.openBlock(),n.createElementBlock("div",{key:x.modelId,class:"em-attr"},[n.createElementVNode("div",bI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`op-name-${x.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":x.name,"onUpdate:modelValue":O=>h(x,{name:O})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{width:"96px","model-value":x.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":O=>O&&h(x,{visibility:O})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:O=>n.unref(a).removeOperation(r.value.modelId,x.modelId)},null,8,["onClick"])]),n.createElementVNode("div",_I,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:x.sourceCode?"본문 편집 ●":"본문 편집",onClick:O=>V(x)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",kI,[v[2]||(v[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(El,{multiline:"",name:`op-desc-${x.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":x.description,"onUpdate:modelValue":O=>m(x,O)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",wI,[v[3]||(v[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":p(x),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":O=>O&&g(x,O)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",EI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(x)===null}]),title:"없음",onClick:O=>_(x,null)},"∅",10,vI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),O=>(n.openBlock(),n.createElementBlock("button",{key:O,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(x)===O}]),style:n.normalizeStyle({background:n.unref(On)(O)}),title:n.unref(Dn)(O),onClick:P=>_(x,O)},null,14,NI))),128))])]))),128)):n.createCommentVNode("",!0)],8,yI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),xI={class:"em-panel__head"},II={class:"em-panel__head-row"},SI={class:"em-panel__context"},CI={key:0,class:"em-panel__lock"},RI=["disabled"],VI={key:0,class:"em-panel__note"},AI={key:1,class:"em-panel__note"},TI={key:2,class:"em-jpa"},MI={class:"em-field"},BI={class:"em-field"},DI={key:0,class:"em-field"},OI={class:"em-panel__sub"},LI={class:"em-field"},PI={class:"em-jpa"},zI={key:0,class:"em-panel__note"},UI={class:"em-jpa"},HI={class:"em-field"},FI={key:0,class:"em-panel__note"},GI={class:"em-field"},YI={class:"em-multilang"},WI={class:"em-field"},KI=["value"],qI={class:"em-field"},XI={class:"em-swatch"},jI={class:"em-swatch__row"},ZI=["title","onClick"],JI={class:"em-panel__note"},QI={class:"em-field"},eS=["value"],tS={class:"em-swatch"},nS={class:"em-swatch__row"},oS=["title","onClick"],af=Ue(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.selection.value),r=n.computed(()=>a.inspectedEntityId.value),s=n.computed(()=>{const j=r.value;return j?a.state.logical.entities.find(W=>W.modelId===j)??null:null}),c=n.computed(()=>{const j=l.value;if((j==null?void 0:j.kind)==="association"){const w=a.state.logical.associations.find(I=>I.modelId===j.id);return!!w&&(a.isEntityLocked(w.end1.entityRef)||a.isEntityLocked(w.end2.entityRef))}const W=r.value;return!!W&&a.isEntityLocked(W)}),d=n.computed(()=>{var j;return((j=a.selectedAttr.value)==null?void 0:j.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),f=n.computed(()=>d.value!==null),h=n.ref({});n.watch(f,()=>{h.value={}});function m(j){return h.value[j]??f.value}function p(j){h.value={...h.value,[j]:!m(j)}}const g=n.computed(()=>{var w;const j=s.value;if(!j)return"엔티티";const W=(w=j.table)==null?void 0:w.physicalName;return W?`${j.name} (${W})`:j.name}),b=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="association"?a.state.logical.associations.find(W=>W.modelId===j.id)??null:null}),_=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="group"?a.state.logical.groups.find(W=>W.modelId===j.id)??null:null}),V=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="note"?a.state.layout.notes.find(W=>W.modelId===j.id)??null:null}),y=n.computed(()=>{var W,w;const j=(W=_.value)==null?void 0:W.name;return(j==null?void 0:j.ko)||(j==null?void 0:j.en)||(j==null?void 0:j.ja)||(j==null?void 0:j.zh)||((w=_.value)==null?void 0:w.packageName)||"그룹"}),v=n.computed(()=>{if(s.value){const j=u.value.size;if(j>1)return`엔티티 · ${s.value.name} › 속성 · ${j}개`;if(d.value){const W=s.value.attributes.find(w=>w.modelId===d.value);return(W==null?void 0:W.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(W==null?void 0:W.name)??""}`}return`엔티티 · ${s.value.name}`}if(b.value){const j=W=>{var w;return((w=a.state.logical.entities.find(I=>I.modelId===W))==null?void 0:w.name)??W};return`관계 · ${j(b.value.end1.entityRef)} — ${j(b.value.end2.entityRef)}`}return _.value?`그룹 · ${y.value}`:V.value?"노트":"선택된 항목 없음"}),ee=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],x=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],O=["LIST","SET"],P=["inherit","LAZY","EAGER"],H=j=>j;function ne(j){return j==="inherit"?"기본(따름)":j}const ce=n.computed(()=>!!b.value&&b.value.end1.entityRef===b.value.end2.entityRef);function L(j,W){b.value&&a.updateAssociationEnd(b.value.modelId,j,W)}function oe(j){b.value&&!ce.value&&a.setAssociationIdentifying(b.value.modelId,j)}function k(j){var W,w,I;return!!((I=(w=(W=b.value)==null?void 0:W[j].jpa)==null?void 0:w.cascadeTypes)!=null&&I.includes("ALL"))}function Y(j,W,w){var G,J;const I=(G=b.value)==null?void 0:G[j];if(W==="ALL"&&w){L(j,{jpa:{...I==null?void 0:I.jpa,cascadeTypes:["ALL"]}});return}const C=new Set(((J=I==null?void 0:I.jpa)==null?void 0:J.cascadeTypes)??[]);w?C.add(W):C.delete(W),L(j,{jpa:{...I==null?void 0:I.jpa,cascadeTypes:[...C]}})}function S(j,W){var I;const w=(I=b.value)==null?void 0:I[j];L(j,{jpa:{...w==null?void 0:w.jpa,...W}})}function F(j){var W,w;return((w=(W=b.value)==null?void 0:W[j].jpa)==null?void 0:w.fetchType)??"inherit"}function U(j,W){S(j,{fetchType:W==="inherit"?void 0:W})}function le(j){var w;const W=(w=b.value)==null?void 0:w[j==="end1"?"end2":"end1"];return(W==null?void 0:W.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(W==null?void 0:W.multiplicity)==="ONE_OR_MORE_INSTANCES"}const E=n.computed(()=>{const j=b.value;if(!j)return null;for(const W of a.state.logical.entities){const w=W.attributes.find(G=>{var J;return((J=G.embedded)==null?void 0:J.associationRef)===j.modelId&&G.attrType==="EMBED_OWN"});if(!w)continue;const I=j.end2.entityRef===w.embedded.embeddableRef?"end2":"end1",C=j[I].jpa;return{which:I,isCollection:j[I].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(C==null?void 0:C.collectionType)??"LIST",collectionTable:(C==null?void 0:C.collectionTable)??"",orderColumn:(C==null?void 0:C.orderColumn)??""}}return null});function K(j){b.value&&a.setEmbedCollectionMode(b.value.modelId,j?"COLLECTION":"SINGLE")}function re(j){const W=E.value;W&&S(W.which,j==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function pe(j){const W=E.value;W&&S(W.which,{collectionTable:j.trim()||void 0})}function ye(j){const W=E.value;W&&S(W.which,{orderColumn:j.trim()||void 0})}function ue(j){_.value&&a.updateGroup(_.value.modelId,j)}function fe(j,W){var w;ue({name:{...(w=_.value)==null?void 0:w.name,[j]:W}})}const ge=n.computed(()=>{var j;return _.value?at((j=a.state.layout.groupLayouts.find(W=>W.groupRef===_.value.modelId))==null?void 0:j.style):null});function Ee(j){_.value&&a.setGroupSwatch(_.value.modelId,j)}function Re(j){V.value&&a.setNoteMemo(V.value.modelId,j)}const Ie=n.computed(()=>{var j;return at((j=V.value)==null?void 0:j.style)});function he(j){V.value&&a.setNoteSwatch(V.value.modelId,j)}return(j,W)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:"너비 조절",onPointerdown:W[0]||(W[0]=(...w)=>e.startResize&&e.startResize(...w))},null,34),n.createElementVNode("header",xI,[n.createElementVNode("div",II,[W[13]||(W[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:W[1]||(W[1]=w=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",SI,n.toDisplayString(v.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",CI,[n.createVNode(Ve,{name:"lock",size:13}),W[14]||(W[14]=n.createElementVNode("span",null,"편집 잠김 — 이동·수정·삭제 차단",-1)),n.unref(a).editable.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:W[2]||(W[2]=w=>n.unref(a).setEntityLocked(r.value,!1))},"잠금 해제")):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value||c.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(Ad,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("basics"),title:g.value,onToggle:W[3]||(W[3]=w=>p("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(cI,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(hI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("index"),onToggle:W[4]||(W[4]=w=>p("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode($I,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("ops"),onToggle:W[5]||(W[5]=w=>p("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ie.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!b.value.identifying,disabled:ce.value||!!E.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),ce.value?(n.openBlock(),n.createElementBlock("p",VI,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):E.value?(n.openBlock(),n.createElementBlock("p",AI,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),E.value?(n.openBlock(),n.createElementBlock("fieldset",TI,[W[18]||(W[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ie.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":E.value.isCollection,"onUpdate:modelValue":K},null,8,["model-value"]),E.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",MI,[W[15]||(W[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":E.value.collectionType,items:O,"value-provider":H,"label-provider":H,"onUpdate:modelValue":W[6]||(W[6]=w=>w&&re(w))},null,8,["model-value"])]),n.createElementVNode("label",BI,[W[16]||(W[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":E.value.collectionTable,"onUpdate:modelValue":pe},null,8,["model-value"])]),E.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",DI,[W[17]||(W[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":E.value.orderColumn,"onUpdate:modelValue":ye},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),W[19]||(W[19]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],w=>{var I,C,G,J;return n.createElementVNode("div",{key:w,class:"em-end"},[n.createElementVNode("h4",OI,n.toDisplayString(w)+" → "+n.toDisplayString(b.value[w].entityRef),1),n.createElementVNode("label",LI,[W[20]||(W[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":b.value[w].multiplicity,items:ee,"value-provider":H,"label-provider":H,disabled:((I=E.value)==null?void 0:I.which)===w,"onUpdate:modelValue":be=>L(w,{multiplicity:be})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-navigable`,class:"em-check",label:"navigable","model-value":b.value[w].navigable,"onUpdate:modelValue":be=>L(w,{navigable:be})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-composition`,class:"em-check",label:"composition","model-value":b.value[w].composition,"onUpdate:modelValue":be=>L(w,{composition:be})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",PI,[W[21]||(W[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(x,be=>{var we,$e;return n.createVNode(n.unref(ie.BSCheckbox),{key:be,name:`${w}-cascade-${be}`,class:"em-check",label:be,"model-value":!!(($e=(we=b.value[w].jpa)==null?void 0:we.cascadeTypes)!=null&&$e.includes(be)),disabled:be!=="ALL"&&k(w),"onUpdate:modelValue":_e=>Y(w,be,_e)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),k(w)?(n.openBlock(),n.createElementBlock("p",zI,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",UI,[W[24]||(W[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",HI,[W[22]||(W[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":F(w),items:P,"value-provider":H,"label-provider":ne,"onUpdate:modelValue":be=>be&&U(w,be)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((C=b.value[w].jpa)!=null&&C.orphanRemoval),disabled:le(w),"onUpdate:modelValue":be=>S(w,{orphanRemoval:be})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),le(w)&&((G=b.value[w].jpa)!=null&&G.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",FI,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",GI,[W[23]||(W[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:`${w}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((J=b.value[w].jpa)==null?void 0:J.orderBy)??"","onUpdate:modelValue":be=>S(w,{orderBy:be.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",YI,[W[25]||(W[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,w=>{var I;return n.openBlock(),n.createElementBlock("label",{key:w,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(w),1),n.createVNode(n.unref(ie.BSTextInput),{name:`grp-name-${w}`,width:"100%","model-value":((I=_.value.name)==null?void 0:I[w])??"","onUpdate:modelValue":C=>fe(w,C)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",WI,[W[26]||(W[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:W[7]||(W[7]=w=>ue({description:w.target.value}))},null,40,KI)]),n.createElementVNode("label",qI,[W[27]||(W[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":W[8]||(W[8]=w=>ue({packageName:w}))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":W[9]||(W[9]=w=>ue({excludeDDLGeneration:w}))},null,8,["model-value"]),n.createElementVNode("fieldset",XI,[W[28]||(W[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",jI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ge.value===null}]),title:"없음",onClick:W[10]||(W[10]=w=>Ee(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),w=>(n.openBlock(),n.createElementBlock("button",{key:w,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ge.value===w}]),style:n.normalizeStyle({background:n.unref(On)(w)}),title:n.unref(Dn)(w),onClick:I=>Ee(w)},null,14,ZI))),128))])]),n.createElementVNode("p",JI,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),V.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",QI,[W[29]||(W[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:V.value.memo,rows:"6",onChange:W[11]||(W[11]=w=>Re(w.target.value))},null,40,eS)]),n.createElementVNode("fieldset",tS,[W[30]||(W[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",nS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ie.value===null}]),title:"없음",onClick:W[12]||(W[12]=w=>he(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),w=>(n.openBlock(),n.createElementBlock("button",{key:w,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":Ie.value===w}]),style:n.normalizeStyle({background:n.unref(On)(w)}),title:n.unref(Dn)(w),onClick:I=>he(w)},null,14,oS))),128))])])],64)):n.createCommentVNode("",!0)],8,RI)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),iS={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function aS(e){const t=e.split("-")[1];return t?iS[t]??t:e}function lS(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const rS=["title"],sS=["title","onClick"],cS={key:0,class:"em-validation__body"},dS={class:"em-validation__opt"},uS={key:0,class:"em-validation__empty"},fS={key:1,class:"em-validation__empty"},mS={key:2,class:"em-validation__list"},pS=["onClick"],hS={class:"em-validation__item-msg"},yS={key:0,class:"em-validation__item-entity"},gS=["title"],bS=Ue(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const g=new Map;for(const b of o.state.logical.entities)g.set(b.modelId,b.name);return g});function l(g){const b=lS(g);if(!b)return null;const _=a.value.get(b);return _===void 0?null:_.trim()===""?"(이름 없음)":_}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const g={error:0,warning:0,info:0};for(const b of i.value)g[b.severity]++;return g}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,b)=>r[g.severity].order-r[b.severity].order)),u=n.computed(()=>d.value.map(g=>({issue:g,entityName:l(g),category:aS(g.ruleId)}))),f=n.ref(!1);function h(g){c.value[g]=!c.value[g]}function m(g){if(!f.value){f.value=!0;return}h(g)}function p(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,b)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(f.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:b[1]||(b[1]=_=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),b[3]||(b[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,rS),n.createElementVNode("div",{class:"em-validation__counts",onClick:b[0]||(b[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],_=>n.createElementVNode("button",{key:_,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:f.value?`${r[_].label} ${c.value[_]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:V=>m(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,sS)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",cS,[n.createElementVNode("label",dS,[n.createVNode(n.unref(ie.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":b[2]||(b[2]=_=>n.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",uS,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",fS," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",mS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:V,category:y},v)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${v}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:ee=>p(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",hS,[V?(n.openBlock(),n.createElementBlock("span",yS,n.toDisplayString(V),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(_.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},n.toDisplayString(y),9,gS)],10,pS))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),_S={class:"em-history"},kS={class:"em-history__head"},wS={class:"em-history__title"},ES={class:"em-history__head-actions"},vS=["disabled"],NS={class:"em-history__filters"},$S={class:"em-history__filter"},xS={class:"em-history__body"},IS={key:0,class:"em-history__empty"},SS={key:1,class:"em-history__empty is-error"},CS={key:2,class:"em-history__empty"},RS={key:3,class:"em-history__list"},VS=["onClick"],AS={class:"em-history__summary"},TS={class:"em-history__seq"},MS={class:"em-history__gmeta"},BS={class:"em-history__who"},DS={key:0,class:"em-history__time"},OS={key:1,class:"em-history__restored-from"},LS={key:0,class:"em-history__detail"},PS={class:"em-history__action-head"},zS={class:"em-history__action-name"},US={key:0,class:"em-history__fields"},HS={class:"em-history__fname"},FS={key:0,class:"em-history__old"},GS={class:"em-history__val"},YS={key:1,class:"em-history__restore"},WS=["disabled","onClick"],KS=["disabled"],qS=["onClick"],XS=Ue(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.ref([]),r=n.ref(!1),s=n.ref(null),c=n.ref(!1);async function d(){if(a.historyTransport){r.value=!0,s.value=null;try{l.value=await a.historyTransport(),c.value=!0}catch(E){s.value=E instanceof Error?E.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,E=>{E&&u()},{immediate:!0});let f=null;n.watch(()=>a.revision.value,()=>{o.open&&(f&&clearTimeout(f),f=setTimeout(()=>void u(),500))}),n.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const h=n.computed(()=>new Map(a.state.logical.entities.map(E=>[E.modelId,E]))),m=n.computed(()=>new Map(a.state.logical.associations.map(E=>[E.modelId,E]))),p=n.computed(()=>new Map((a.state.logical.groups??[]).map(E=>{var K;return[E.modelId,E.packageName||((K=E.name)==null?void 0:K.ko)||E.modelId]})));function g(E){var ye,ue,fe,ge,Ee,Re,Ie;const K=m.value.get(E);if(!K)return"연관";if((ye=K.description)!=null&&ye.trim())return K.description.trim();const re=(ge=(fe=h.value.get((ue=K.end1)==null?void 0:ue.entityRef))==null?void 0:fe.name)==null?void 0:ge.trim(),pe=(Ie=(Re=h.value.get((Ee=K.end2)==null?void 0:Ee.entityRef))==null?void 0:Re.name)==null?void 0:Ie.trim();return re&&pe?`${re}→${pe}`:"연관"}function b(E){var K,re,pe,ye;if(E.kind==="entity")return((re=(K=h.value.get(E.ref))==null?void 0:K.name)==null?void 0:re.trim())||"(이름 없음)";if(E.kind==="attribute"||E.kind==="operation"||E.kind==="index"){const ue=E.entityRef?h.value.get(E.entityRef):void 0,ge=((E.kind==="attribute"?ue==null?void 0:ue.attributes:E.kind==="operation"?ue==null?void 0:ue.operations:ue==null?void 0:ue.indexes)??[]).find(Re=>Re.modelId===E.ref),Ee=(pe=ue==null?void 0:ue.name)==null?void 0:pe.trim();return`${Ee?Ee+".":""}${((ye=ge==null?void 0:ge.name)==null?void 0:ye.trim())||E.ref}`}return E.kind==="association"?g(E.ref):E.kind==="associationEnd"?`${g(E.ref)}(${E.end})`:E.kind==="group"?`그룹 ${p.value.get(E.ref)??E.ref}`:E.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},V={add:"추가",update:"수정",remove:"삭제"},y=n.ref("all"),v=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],ee=n.computed({get:()=>y.value,set:E=>{E&&(y.value=E)}}),x=n.computed(()=>kr(l.value)),O=n.computed(()=>x.value.length?x.value[0].seq:null),P=n.computed(()=>y.value==="all"?x.value:x.value.filter(E=>(E.kind??"edit")===y.value));function H(E){return E===void 0?"—":E===null?"(비움)":typeof E=="object"?JSON.stringify(E):String(E)}function ne(E){const K=b(E.subject);if(E.verb==="add")return`${K} 추가`;if(E.verb==="remove")return`${K} 삭제`;if(E.fields.length===1){const re=E.fields[0];return`${K}.${re.field} ${re.oldValue!==void 0?H(re.oldValue)+"→":""}${H(re.value)}`}return`${K} ${E.fields.length}개 변경`}function ce(E){return E.actions.length===0?"변경 없음":E.actions.length===1?ne(E.actions[0]):`${ne(E.actions[0])} 외 ${E.actions.length-1}건`}const L=n.ref(new Set);function oe(E){const K=new Set(L.value);K.has(E)?K.delete(E):K.add(E),L.value=K}function k(E){if(E==null)return"";const K=new Date(E);return isNaN(K.getTime())?String(E):K.toLocaleString()}function Y(E){const K=E.author,re=E.origin;return K&&re?`${K}(${re})`:K||(re?`(${re})`:"—")}const S=n.ref(null),F=n.ref(!1);function U(E){S.value=E}async function le(E){F.value=!0;try{const K=await a.restoreToSeq(E);K.ok||(s.value=`복원 실패: ${K.reason??"알 수 없음"}`)}finally{F.value=!1,S.value=null}}return(E,K)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",_S,[n.createElementVNode("header",kS,[n.createElementVNode("div",wS,[n.createVNode(Ve,{name:"undo",size:15}),K[4]||(K[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",ES,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:K[0]||(K[0]=re=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,vS),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:K[1]||(K[1]=re=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",NS,[n.createElementVNode("label",$S,[K[5]||(K[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:ee.value,"onUpdate:modelValue":K[2]||(K[2]=re=>ee.value=re),items:v,"value-provider":re=>re.v,"label-provider":re=>re.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",xS,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",IS,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",SS,n.toDisplayString(s.value),1)):P.value.length===0?(n.openBlock(),n.createElementBlock("p",CS,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",RS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.value,re=>(n.openBlock(),n.createElementBlock("li",{key:re.seq,class:n.normalizeClass(["em-history__group",[`is-${re.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:pe=>oe(re.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":L.value.has(re.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${re.kind??"edit"}`])},n.toDisplayString(re.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",AS,n.toDisplayString(ce(re)),1),n.createElementVNode("span",TS,"#"+n.toDisplayString(re.seq),1)],8,VS),n.createElementVNode("div",MS,[n.createElementVNode("span",BS,n.toDisplayString(Y(re)),1),re.ts?(n.openBlock(),n.createElementBlock("span",DS,n.toDisplayString(k(re.ts)),1)):n.createCommentVNode("",!0),re.kind==="restore"&&re.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",OS,"← #"+n.toDisplayString(re.restoredFromSeq),1)):n.createCommentVNode("",!0)]),L.value.has(re.seq)?(n.openBlock(),n.createElementBlock("div",LS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(re.actions,(pe,ye)=>(n.openBlock(),n.createElementBlock("div",{key:ye,class:"em-history__action"},[n.createElementVNode("div",PS,[n.createVNode(Ve,{name:_[pe.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",zS,n.toDisplayString(b(pe.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${pe.verb}`])},n.toDisplayString(V[pe.verb]),3)]),pe.fields.length?(n.openBlock(),n.createElementBlock("ul",US,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe.fields,(ue,fe)=>(n.openBlock(),n.createElementBlock("li",{key:fe,class:"em-history__field"},[n.createElementVNode("span",HS,n.toDisplayString(ue.field),1),ue.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",FS,n.toDisplayString(H(ue.oldValue)),1)):n.createCommentVNode("",!0),ue.oldValue!==void 0?(n.openBlock(),n.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",GS,n.toDisplayString(H(ue.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&re.seq!==O.value?(n.openBlock(),n.createElementBlock("div",YS,[S.value===re.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[K[6]||(K[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:F.value,onClick:pe=>le(re.seq)},"복원",8,WS),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:F.value,onClick:K[3]||(K[3]=pe=>S.value=null)},"취소",8,KS)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:pe=>U(re.seq)},[n.createVNode(Ve,{name:"undo",size:12}),K[7]||(K[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,qS))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function jS(e,t){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=t?i:null}function lf(e){const t=n.ref(jS(e.storageKey,e.min)??e.initial),o=n.ref(!1);function i(a){a.preventDefault();const l=a.clientX,r=t.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?l-d.clientX:d.clientX-l;let f=r+u;f=Math.max(e.min,f),e.max!=null&&(f=Math.min(e.max,f)),t.value=f},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(t.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:t,dragging:o,startResize:i}}const ZS={class:"em-modeler"},JS={class:"em-modeler__body"},QS={class:"em-drawer__inner"},eC={class:"em-drawer__head"},tC={class:"em-drawer__actions"},nC=["title"],oC=Ue(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(!0),i=n.ref(!1),{width:a,dragging:l,startResize:r}=lf({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=lf({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(h,m)=>{var p,g,b;return n.openBlock(),n.createElementBlock("div",ZS,[n.createVNode(of,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=_=>{var V;return(V=u.value)==null?void 0:V.exportSvg()}),onExportPng:m[1]||(m[1]=_=>{var V;return(V=u.value)==null?void 0:V.exportPng()}),onToggleHistory:m[2]||(m[2]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",JS,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",QS,[n.createElementVNode("header",eC,[m[10]||(m[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",tC,[(p=f.value)!=null&&p.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(g=f.value)!=null&&g.allExpanded?"모두 접기":"모두 펼치기",onClick:m[3]||(m[3]=_=>{var V;return(V=f.value)==null?void 0:V.toggleAll()})},[n.createVNode(Ve,{name:(b=f.value)!=null&&b.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,nC)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[4]||(m[4]=_=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(nf,{ref_key:"explorer",ref:f,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(l)}]),title:"너비 조절",onPointerdown:m[5]||(m[5]=(..._)=>n.unref(r)&&n.unref(r)(..._))},null,34),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:m[6]||(m[6]=_=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],512),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(l),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(tf,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(af,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[7]||(m[7]=_=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:"Inspector 열기",onClick:m[8]||(m[8]=_=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(XS,{controller:e.controller,open:i.value,onClose:m[9]||(m[9]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(bS,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1bc07cae"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=Bm,Ne.AssociationEdge=ou,Ne.CUSTOM_TYPE_VALUE=Ct,Ne.CommandStack=Ca,Ne.DEFAULT_JAVA_TYPE=wa,Ne.DiagramCanvas=tf,Ne.DiagramExplorer=nf,Ne.EDITOR=pn,Ne.EditModeToggle=Cx,Ne.EditorToolbar=of,Ne.EntityModeler=oC,Ne.EntityNode=Ud,Ne.GROUP_CODE_ENUM_VALUE=Kn,Ne.GroupNode=Hd,Ne.JAVA_TYPES=Ea,Ne.NoteNode=Fd,Ne.OpSyncAdapter=ds,Ne.PHYSICAL_NAME_MAX_LENGTH=$a,Ne.PropertyPanel=af,Ne.RevCache=cs,Ne.SELECTABLE_JAVA_TYPES=fr,Ne.SYMBOLIC_OP_KINDS=us,Ne.SYMBOLIC_OP_SCHEMA=Es,Ne.anchoredEdgePoint=ha,Ne.buildAgentBatch=Dm,Ne.buildDiagramSvg=Xl,Ne.buildOrthogonalPath=ua,Ne.buildSelfLoopPath=er,Ne.buildStraightPath=ma,Ne.collectSharedColumns=Na,Ne.commands=am,Ne.computeAutoLayout=tr,Ne.createEditorController=_k,Ne.defaultMermaidDialect=pf,Ne.displayLabel=Fo,Ne.emptyState=Od,Ne.entityModelToMermaid=ga,Ne.entityModelToText=ar,Ne.estimateEntityHeight=or,Ne.exportDiagramPng=Qu,Ne.exportDiagramSvg=Ju,Ne.fromPersisted=Zm,Ne.indexColumnsByModelId=qn,Ne.javaTypeLabel=wn,Ne.migrateLegacyMoney=zf,Ne.newId=Oe,Ne.orthogonalMidpoints=fa,Ne.packEntityBoxes=mf,Ne.physicalNameWarning=Ko,Ne.projectActionLog=kr,Ne.projectEntityAudit=br,Ne.projectFieldAudit=Ut,Ne.rectExitPoint=pa,Ne.renderDiagramSvg=dr,Ne.resolveDiagram=Jl,Ne.resolveSharedColumn=Wo,Ne.resolveSymbolicOps=$m,Ne.restoreDeepEqual=En,Ne.segmentMidpoints=ya,Ne.sharedColumnScopeEntities=Yo,Ne.sideDir=Yn,Ne.synthesizeRestoreOps=jf,Ne.toPersisted=up,Ne.toPersistedV2=fp,Ne.validateModel=yr,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
42
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(U=>{if(b.value){const le=qt(b.value),E=pe=>{if(pe.sourceEvent.type!=="wheel"||!h.value||!p.value)return;const ye=pe.sourceEvent.ctrlKey&&ko()?10:1,ue=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*e.zoomStep,fe=c.value.zoom*2**(ue*ye);p.value.scaleTo(h.value,fe)},K=pe=>{if(pe.sourceEvent.type!=="mousemove"||!h.value||!p.value)return;const ye=H.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),ue={x:c.value.x-pe.sourceEvent.movementX*ye,y:c.value.y-pe.sourceEvent.movementY*ye},fe=[[0,0],[u.value.width,u.value.height]],ge=Yl.translate(ue.x,ue.y).scale(c.value.zoom),Ee=p.value.constrain()(ge,fe,d.value);p.value.transform(h.value,Ee)},re=y$().wheelDelta(pe=>sl(pe)*(e.zoomStep/10)).on("zoom",e.pannable?K:()=>{}).on("zoom.wheel",e.zoomable?E:()=>{});le.call(re),U(()=>{le.on("zoom",null)})}},{flush:"post"});function L(U){const[le,E]=Xt(U);t("click",{event:U,position:{x:le,y:E}})}function oe(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeClick(E),t("nodeClick",E)}function k(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeDoubleClick(E),t("nodeDblclick",E)}function Y(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseEnter(E),t("nodeMouseenter",E)}function S(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseMove(E),t("nodeMousemove",E)}function F(U,le){const E={event:U,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseLeave(E),t("nodeMouseleave",E)}return(U,le)=>(n.openBlock(),n.createBlock(n.unref(Sd),{position:U.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:U.pannable,zoomable:U.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:b,width:y.value,height:_.value,viewBox:[ne.value.x,ne.value.y,ne.value.width,ne.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:L},[U.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(U.ariaLabel),9,w$)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(m),E=>(n.openBlock(),n.createBlock(_$,{id:E.id,key:E.id,f:"",position:E.computedPosition,dimensions:E.dimensions,selected:E.selected,dragging:E.dragging,style:n.normalizeStyle(E.style),class:n.normalizeClass(ee.value(E)),color:g.value(E),"border-radius":U.nodeBorderRadius,"stroke-color":v.value(E),"stroke-width":U.nodeStrokeWidth,"shape-rendering":n.unref(V),type:E.type,hidden:E.hidden,onClick:K=>oe(K,E),onDblclick:K=>k(K,E),onMouseenter:K=>Y(K,E),onMousemove:K=>S(K,E),onMouseleave:K=>F(K,E)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),n.createElementVNode("path",{class:"vue-flow__minimap-mask",d:ce.value,fill:U.maskColor,stroke:U.maskStrokeColor,"stroke-width":U.maskStrokeWidth,"fill-rule":"evenodd"},null,8,E$)],8,k$))]),_:1},8,["position","class"]))}}),$$=["d"],x$=["cx","cy","onDblclick"],I$=["x","y","onPointerdown","onDblclick"],S$=Ue(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=ze(),i=n.inject(xl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(zn,null),s=n.computed(()=>!!r&&r.active.value&&(!r.relatedEntityIds.value.has(t.data.targetRef)||!r.relatedNoteIds.value.has(t.data.noteRef))),c=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),d=n.ref(-1),u=n.ref({x:0,y:0}),f=n.computed(()=>c.value.map((P,H)=>H===d.value?u.value:P)),{source:h,target:p,sourceSide:m,targetSide:b}=tu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),y=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?fa(h.value,m.value,f.value,p.value,b.value):pa(h.value,f.value,p.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ma(h.value,m.value,f.value,p.value,b.value):ga(h.value,f.value,p.value).map((P,H)=>({point:P,segIndex:H})):[]),V=n.computed(()=>l.value?f.value:[]);function g(P,H){d.value=P,u.value={...c.value[P]},H.target.setPointerCapture(H.pointerId),H.stopPropagation()}function v(P){if(d.value<0)return;const H=o({x:P.clientX,y:P.clientY});u.value={x:H.x,y:H.y}}function ee(P){var H,ne;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(ne=(H=P.target).releasePointerCapture)==null||ne.call(H,P.pointerId)}function x(P,H){H.stopPropagation(),i==null||i.removePoint(t.id,P)}function O(P,H){if(!i)return;const ne=o({x:H.clientX,y:H.clientY});i.insertPoint(t.id,P,{x:ne.x,y:ne.y})}return(P,H)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:y.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,$$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${ce}`,cx:ne.point.x,cy:ne.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(L=>O(ne.segIndex,L),["stop"])},null,42,x$))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(V.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${ce}`,x:ne.x-5,y:ne.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:L=>g(ce,L),onPointermove:v,onPointerup:ee,onDblclick:L=>x(ce,L)},null,42,I$))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),C$=["data-theme"],R$={key:0,class:"em-ctx__sep",role:"separator"},V$={key:1,class:"em-ctx__swatches"},A$={class:"em-ctx__swatches-label"},T$={class:"em-ctx__chips"},M$=["onClick"],B$=["title","onClick"],D$=["disabled","onClick"],O$={class:"em-ctx__icon"},L$={class:"em-ctx__caption"},P$=Ue(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),a=n.ref(void 0),l=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(p,m){var _;i.value=m,a.value=(_=p.target)!=null&&_.closest('[data-theme="dark"]')?"dark":void 0,r.x=p.clientX,r.y=p.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const b=l.value;if(!b)return;const y=b.getBoundingClientRect();r.x+y.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-y.width)),r.y+y.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-y.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(p){p.key==="Escape"&&(p.stopPropagation(),d())}function f(p){p.disabled||(p.handler(),d())}function h(p,m){p.onPick(m),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(p,m)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":a.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:l,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:m[0]||(m[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(b,y)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:y},[b.type==="separator"?(n.openBlock(),n.createElementBlock("div",R$)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",V$,[n.createElementVNode("span",A$,n.toDisplayString(b.caption),1),n.createElementVNode("div",T$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:"없음",onClick:_=>h(b,null)},null,10,M$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),_=>(n.openBlock(),n.createElementBlock("button",{key:_,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":b.current===_}]),style:n.normalizeStyle({background:n.unref(On)(_)}),title:n.unref(Dn)(_),onClick:V=>h(b,_)},null,14,B$))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":b.danger,"is-disabled":b.disabled}]),disabled:b.disabled,role:"menuitem",onClick:_=>f(b)},[n.createElementVNode("span",O$,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",L$,n.toDisplayString(b.caption),1)],10,D$))],64))),128))],36)],8,C$)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Kl=[".em-entity__grip",".em-entity__add",".em-entity__footer",".em-sel",".em-handle",".em-note-handle",".vue-flow__handle",".em-group__resize",".em-note__resize",".em-edge__waypoint",".em-edge__mid",".em-note-edge__waypoint",".em-note-edge__mid"].join(",");function Gn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function z$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function U$(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const l=e.firstChild,r=a.getClientRects();if(!l||l.nodeType!==3||r.length<=1){const m=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(m.width===0&&m.height===0)return[];const b=t(m.left,m.top+m.height/2);return[{...i,x:b.x,y:b.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,h=0;const p=()=>{const m=d.trim();if(m){const b=t(f,(u+h)/2);c.push({...i,x:b.x,y:b.y,text:m})}d=""};for(let m=0;m<s.length;m++){a.setStart(l,m),a.setEnd(l,m+1);const b=a.getBoundingClientRect();u===null||Math.abs(b.top-u)>1?(p(),u=b.top,f=b.left,h=b.bottom,d=s[m]):(d+=s[m],h=Math.max(h,b.bottom))}return p(),c}function ca(e,t){const o=[];for(const i of e.querySelectorAll("*"))z$(i)&&(i.closest(Kl)||Gn(i)&&o.push(...U$(i,t)));return o}function Ao(e){return Math.round(e*100)/100}function H$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Kl)||!Gn(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const l=t(a.left,a.top),r=t(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${Ao(l.x)}" y="${Ao(l.y)}" width="${Ao(r.x-l.x)}" height="${Ao(r.y-l.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function F$(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Gn(o))continue;const i=getComputedStyle(o),a=i.stroke,l=parseFloat(i.strokeWidth)||1.5,r=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Ao(parseFloat(o.getAttribute(d)??"0"));s==="line"?t.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${l}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${l}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${r}" stroke="${a}" stroke-width="${l}" stroke-linejoin="round" />`)}return t}function Xu(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Kl)||!Gn(a))continue;const l=getComputedStyle(a),r=parseFloat(l.borderTopWidth);if(!r)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:l.borderTopColor,strokeWidth:r})}return i}function To(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=t(o.left,o.top),l=t(o.right,o.bottom),r=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:l.x-a.x,h:l.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:r?"6 4":void 0,radius:s}}function ql(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function G$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(p,m)=>e.screenToFlowCoordinate({x:p,y:m}),i=[],a=[],l=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const p of e.nodes.value){const m=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(p.id)}"]`);if(!m||!Gn(m))continue;const b=m.firstElementChild;if(b)if(p.type==="group"){const y=To(b,o);ql(s,y),i.push({...y,texts:[]});const _=b.querySelector(".em-group__label");_&&i.push({...To(_,o),stroke:"none",texts:[]}),i.push({...y,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ca(b,o)})}else if(p.type==="note"){const y={...To(b,o),texts:ca(b,o),lines:Xu(b,b,o)};ql(s,y),l.push(y)}else{const y=To(b,o);ql(s,y);const _=y.radius??{tl:0,tr:0};a.push({...y,stroke:"none",texts:[]});const V=b.querySelector(".em-entity__header");if(V){const g=To(V,o);a.push({x:y.x,y:y.y,w:y.w,h:g.y+g.h-y.y,fill:g.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...y,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ca(b,o),lines:Xu(b,b,o),icons:H$(b,o)}),a.push({...y,fill:"none",texts:[]})}}for(const p of t.querySelectorAll(".vue-flow__edge")){const m=p.querySelector("path.em-edge__path, path.em-note-edge__path");if(!m||!Gn(m))continue;const b=m.getAttribute("d");if(!b)continue;const y=getComputedStyle(m),_=y.strokeDasharray,V=F$(p);r.push({d:b,stroke:y.stroke,strokeWidth:parseFloat(y.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:ca(p,o),markers:V.length?V:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:r,entities:a,notes:l}}function Xl(e){return dr(G$(e))}function ju(e,t){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function Zu(e,t="diagram.svg"){const o=Xl(e);ju(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function Y$(e){var i,a;const t=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:t>0?t:1,h:o>0?o:1}}async function Ju(e,t="diagram.png",o=2){const i=Xl(e),{w:a,h:l}=Y$(i),r=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=l,await new Promise((f,h)=>{s.onload=()=>f(),s.onerror=()=>h(new Error("SVG 이미지 로드 실패")),s.src=r});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(l*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,l);const u=await new Promise(f=>c.toBlob(f,"image/png"));if(!u)throw new Error("PNG 변환 실패");ju(u,t)}finally{URL.revokeObjectURL(r)}}const W$={class:"em-shortcuts"},K$={class:"em-shortcuts__title"},q$={class:"em-shortcuts__keys"},X$={class:"em-shortcuts__kbd"},j$={key:0,class:"em-shortcuts__plus"},Z$={class:"em-shortcuts__desc"},J$={class:"em-shortcuts__actions"},Qu=Ue(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ie.useModalHandle(),i=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",a=[{title:"편집",items:[{keys:[i,"Z"],desc:"실행 취소"},{keys:[i,"Shift","Z"],desc:"다시 실행"},{keys:[i,"C"],desc:"선택 복사"},{keys:[i,"V"],desc:"붙여넣기"},{keys:["Delete"],desc:"선택 항목 삭제 (Backspace 동일)"}]},{title:"이동 · 정렬",items:[{keys:["←","↑","→","↓"],desc:"선택 노드 1px 이동"},{keys:["Shift","방향키"],desc:"선택 노드 10px 이동"},{keys:["↑","↓"],desc:"속성 선택 시 포커스 이동"},{keys:["Alt","↑","↓"],desc:"속성 순서 위/아래로"}]},{title:"기타",items:[{keys:["우클릭"],desc:"컨텍스트 메뉴 (엔티티·노트 추가 등)"},{keys:["Enter"],desc:"인라인 편집 확정"},{keys:["Esc"],desc:"편집·메뉴 닫기"},{keys:["?"],desc:"이 도움말 열기"}]}];return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",W$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",K$,n.toDisplayString(s.title),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.items,c=>(n.openBlock(),n.createElementBlock("div",{key:c.desc,class:"em-shortcuts__row"},[n.createElementVNode("span",q$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.keys,(d,u)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:d+u},[n.createElementVNode("kbd",X$,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",j$,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",Z$,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",J$,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function Q$(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const ex={key:0,class:"em-canvas__empty","aria-hidden":"true"},tx={key:1,class:"em-canvas__empty-title"},nx={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},ox={class:"em-conflict-banner__body"},ix={class:"em-conflict-banner__title"},ax={class:"em-conflict-banner__detail"},lx={key:0,class:"em-toast",role:"status","aria-live":"polite"},jl="nc:",ef=Ue(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,$=>{$&&(l.value=$.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>Q$(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f($){u.x=$.clientX,u.y=$.clientY}const h=n.ref(null);n.provide(Fi,h);const p=n.ref(null);n.provide(Pd,p);const m=n.ref(null),b=n.computed(()=>{const $=m.value,D=new Set;if(!$)return D;if($.kind==="entity")D.add($.id);else if($.kind==="group"){const se=i.resolved.value.groups.find(R=>R.group.modelId===$.id);for(const R of(se==null?void 0:se.group.memberEntityRefs)??[])D.add(R)}return D}),y=n.computed(()=>{const $=m.value,D=new Set(b.value),se=new Set,R=new Set;if(!$)return{related:D,edges:se,notes:R};if($.kind==="note"){R.add($.id);for(const M of i.resolved.value.noteConnections)M.noteRef===$.id&&D.add(M.targetRef);return{related:D,edges:se,notes:R}}const q=b.value;if(!q.size)return{related:D,edges:se,notes:R};for(const M of i.resolved.value.associations){const{end1:X,end2:ke}=M.association;(q.has(X.entityRef)||q.has(ke.entityRef))&&(se.add(M.association.modelId),D.add(X.entityRef),D.add(ke.entityRef))}for(const M of i.resolved.value.noteConnections)D.has(M.targetRef)&&R.add(M.noteRef);return{related:D,edges:se,notes:R}});n.provide(zn,{source:m,active:n.computed(()=>m.value!==null),primaryEntityIds:b,relatedEntityIds:n.computed(()=>y.value.related),relatedEdgeIds:n.computed(()=>y.value.edges),relatedNoteIds:n.computed(()=>y.value.notes),hoverGroupId:n.computed(()=>{var $;return(($=m.value)==null?void 0:$.kind)==="group"?m.value.id:null}),setEntityHover:$=>{p.value||d.value||(m.value=$?{kind:"entity",id:$}:null)},setGroupHover:$=>{p.value||d.value||(m.value=$?{kind:"group",id:$}:null)},setNoteHover:$=>{p.value||d.value||(m.value=$?{kind:"note",id:$}:null)}}),n.provide(pn,i);function _($,D){return`${jl}${$}:${D}`}function V($){if(!$.startsWith(jl))return null;const[D,se]=$.slice(jl.length).split(":");return D&&se?{noteRef:D,targetRef:se}:null}n.provide(xl,{points:$=>{var se,R;const D=V($);return D?((se=i.resolved.value.noteConnections.find(q=>q.noteRef===D.noteRef&&q.targetRef===D.targetRef))==null?void 0:se.waypoints)??[]:((R=i.resolved.value.associations.find(q=>q.association.modelId===$))==null?void 0:R.waypoints)??[]},movePoint:($,D,se)=>{const R=V($);R?i.moveNoteConnectionWaypoint(R.noteRef,R.targetRef,D,se):i.moveWaypoint($,D,se)},insertPoint:($,D,se)=>{const R=V($);R?i.addNoteConnectionWaypoint(R.noteRef,R.targetRef,D,se):i.addWaypoint($,D,se)},removePoint:($,D)=>{const se=V($);se?i.removeNoteConnectionWaypoint(se.noteRef,se.targetRef,D):i.removeWaypoint($,D)}});const g=ze(),{nodes:v,edges:ee,findNode:x,findEdge:O,addNodes:P,addEdges:H,removeNodes:ne,removeEdges:ce,fitView:L,setCenter:oe,getViewport:k,screenToFlowCoordinate:Y,getSelectedNodes:S,updateNodeInternals:F}=g,U=n.ref(!1);async function le($){U.value=!0,await n.nextTick(),await new Promise(D=>requestAnimationFrame(()=>D(null)));try{return await $()}finally{U.value=!1}}function E(){return le(()=>Zu(g))}function K(){return le(()=>Ju(g))}t({exportSvg:E,exportPng:K});const re=n.computed(()=>i.resolved.value.entities.length===0);function pe(){const $=k(),{width:D,height:se}=g.dimensions.value;return{x:(D/2-$.x)/$.zoom,y:(se/2-$.y)/$.zoom}}function ye(){const $=pe();i.addEntity("NewEntity",{x:$.x,y:$.y})}function ue(){const $=pe();i.addNote("메모",{x:$.x,y:$.y})}function fe($){for(const D of i.resolved.value.groups){const{location:se,size:R}=D.geo;if($.x>=se.x&&$.x<=se.x+R.width&&$.y>=se.y&&$.y<=se.y+R.height)return D.group.modelId}return null}function ge(){const $=i.resolved.value,D=new Map($.groups.map(X=>[X.group.modelId,X.geo])),se=new Set($.groups.map(X=>X.group.modelId)),R=new Set([...se,...$.entities.map(X=>X.entity.modelId),...$.notes.map(X=>X.note.modelId)]);for(const X of[...v.value])R.has(X.id)||ne([X.id]);for(const X of $.groups){const ke=X.group.modelId,De={width:`${X.geo.size.width}px`,height:`${X.geo.size.height}px`},Le={group:X.group,style:X.style,locked:X.locked},Pe=X.locked?!1:void 0,He=x(ke);He?(He.position={...X.geo.location},He.data=Le,He.style=De,He.draggable=Pe):P([{id:ke,type:"group",position:{...X.geo.location},draggable:Pe,style:De,data:Le}])}for(const X of $.entities){const ke=X.entity.modelId,De=X.groupRef&&se.has(X.groupRef)?X.groupRef:void 0,Le={entity:X.entity,displayMode:i.displayMode.value,collapsed:X.collapsed,locked:X.locked,groupRef:De,size:X.geo.size,style:X.style,attributeStyles:X.attributeStyles,operationStyles:X.operationStyles},Pe=X.locked?!1:void 0,He=De?D.get(De):void 0,et=He?{x:X.geo.location.x-He.location.x,y:X.geo.location.y-He.location.y}:{...X.geo.location},Ye=x(ke);Ye?(Ye.position=et,Ye.data=Le,Ye.parentNode=De,Ye.draggable=Pe):P([{id:ke,type:"entity",position:et,parentNode:De,draggable:Pe,data:Le}])}for(const X of $.notes){const ke=X.note,De=ke.modelId,Le=X.groupRef&&se.has(X.groupRef)?X.groupRef:void 0,Pe={note:ke,groupRef:Le},He={width:`${ke.geo.size.width}px`,height:`${ke.geo.size.height}px`},et=Le?D.get(Le):void 0,Ye=et?{x:ke.geo.location.x-et.location.x,y:ke.geo.location.y-et.location.y}:{...ke.geo.location},Ke=x(De);Ke?(Ke.position=Ye,Ke.data=Pe,Ke.style=He,Ke.parentNode=Le):P([{id:De,type:"note",position:Ye,parentNode:Le,style:He,data:Pe}])}const q=new Map($.associations.map(X=>[X.association.modelId,X])),M=new Set($.noteConnections.map(X=>_(X.noteRef,X.targetRef)));for(const X of[...ee.value])!q.has(X.id)&&!M.has(X.id)&&ce([X.id]);for(const[X,ke]of q){const De={id:X,type:"association",source:ke.association.end1.entityRef,target:ke.association.end2.entityRef,sourceHandle:ke.sourceColumnRef?`r:${ke.sourceColumnRef}`:void 0,targetHandle:ke.targetColumnRef?`l:${ke.targetColumnRef}`:void 0,data:{association:ke.association,sourceColumnRef:ke.sourceColumnRef,targetColumnRef:ke.targetColumnRef}},Le=O(X);Le?(Le.data=De.data,Le.sourceHandle=De.sourceHandle,Le.targetHandle=De.targetHandle):H([De])}for(const X of $.noteConnections){const ke=_(X.noteRef,X.targetRef),De={noteRef:X.noteRef,targetRef:X.targetRef},Le=O(ke);Le?Le.data=De:H([{id:ke,type:"note-connection",source:X.noteRef,target:X.targetRef,data:De}])}Ee()}function Ee(){n.nextTick(()=>requestAnimationFrame(()=>F()))}function Re(){const $=S.value.map(se=>se.id);if($.length)return $;const D=i.selection.value;return D&&(D.kind==="entity"||D.kind==="note"||D.kind==="group")?[D.id]:[]}function Ie($){var q;const D=$.target;if(D&&(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable))return;if($.key==="?"){a.openModal({component:Qu}),$.preventDefault();return}if(!i.editable.value){($.metaKey||$.ctrlKey)&&$.key.toLowerCase()==="c"&&(i.copy(),$.preventDefault());return}if($.key==="Delete"||$.key==="Backspace"){i.deleteSelection()&&$.preventDefault();return}if($.key==="ArrowUp"||$.key==="ArrowDown"||$.key==="ArrowLeft"||$.key==="ArrowRight"){if(((q=i.selection.value)==null?void 0:q.kind)==="attribute"){if($.key==="ArrowUp"||$.key==="ArrowDown"){const De=$.key==="ArrowDown"?1:-1;($.altKey?i.nudgeSelectedAttributes(De):i.moveAttributeFocus(De))&&$.preventDefault()}return}const M=$.shiftKey?10:1,X=$.key==="ArrowLeft"?-M:$.key==="ArrowRight"?M:0,ke=$.key==="ArrowUp"?-M:$.key==="ArrowDown"?M:0;i.nudgeNodes(Re(),X,ke)&&$.preventDefault();return}if(!($.metaKey||$.ctrlKey))return;const R=$.key.toLowerCase();R==="c"?(i.copy(),$.preventDefault()):R==="v"?(i.paste(),$.preventDefault()):R==="z"&&($.shiftKey?i.redo():i.undo(),$.preventDefault())}n.onMounted(async()=>{ge(),await n.nextTick(),L(),window.addEventListener("keydown",Ie),window.addEventListener("pointerup",he),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ie),window.removeEventListener("pointerup",he),window.removeEventListener("pointermove",f)});function he(){h.value=null}function j(){d.value=!0,m.value=null}function W(){var R;d.value=!1;const $=(R=document.elementFromPoint(u.x,u.y))==null?void 0:R.closest(".vue-flow__node"),D=$==null?void 0:$.dataset.id;if(!D){m.value=null;return}const se=$.classList.contains("vue-flow__node-group")?"group":$.classList.contains("vue-flow__node-note")?"note":"entity";m.value={kind:se,id:D}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ge),n.watch(()=>i.revision.value,Ee),n.watch(()=>i.resolved.value,$=>{const D=m.value;if(!D)return;(D.kind==="entity"?$.entities.some(R=>R.entity.modelId===D.id):D.kind==="group"?$.groups.some(R=>R.group.modelId===D.id):$.notes.some(R=>R.note.modelId===D.id))||(m.value=null)});function w($){const D=$.computedPosition??$.position,se=$.dimensions??{width:0,height:0};return{x:D.x+se.width/2,y:D.y+se.height/2}}function I($){const D=$.node;if(D){if(m.value=null,D.type==="group"){const se=i.resolved.value.groups.find(R=>R.group.modelId===D.id);p.value=se?{groupId:D.id,dx:D.position.x-se.geo.location.x,dy:D.position.y-se.geo.location.y}:null,h.value=null;return}if(D.type!=="entity"&&D.type!=="note"){h.value=null;return}h.value=fe(w(D))}}function C($){var R;h.value=null,p.value=null;const D=(R=$.nodes)!=null&&R.length?$.nodes:[$.node],se=D.filter(q=>(q==null?void 0:q.type)==="group");if(se.length){for(const q of se){if(!q)continue;const M=i.resolved.value.entities.filter(X=>X.groupRef===q.id).map(X=>{const ke=x(X.entity.modelId),De=(ke==null?void 0:ke.computedPosition)??(ke==null?void 0:ke.position)??{x:0,y:0};return{id:X.entity.modelId,location:{x:De.x,y:De.y}}});i.dragGroup(q.id,{x:q.position.x,y:q.position.y},M)}return}for(const q of D){if(!q||q.type==="group")continue;const M=q.computedPosition??q.position,X=q.dimensions??{width:0,height:0},ke={x:M.x+X.width/2,y:M.y+X.height/2};q.type==="note"?i.dropNote(q.id,{x:M.x,y:M.y},fe(ke)):i.dropEntity(q.id,{x:M.x,y:M.y},fe(ke))}}function G($){var De,Le,Pe,He,et;if(!i.editable.value||!$.source||!$.target)return;const D=((De=x($.source))==null?void 0:De.type)==="note",se=((Le=x($.target))==null?void 0:Le.type)==="note";if(D||se){if(D&&se)return;const Ye=D?$.source:$.target,Ke=D?$.target:$.source;((Pe=x(Ke))==null?void 0:Pe.type)==="entity"&&i.addNoteConnection(Ye,Ke);return}const R=Ye=>{var Ke;return(Ke=i.state.logical.entities.find(je=>je.modelId===Ye))==null?void 0:Ke.stereotype},q=R($.source)==="JPA_EMBEDDABLE",M=R($.target)==="JPA_EMBEDDABLE";if(q||M){if(q&&M)return;const Ye=q?$.source:$.target,Ke=q?$.target:$.source;i.addEmbedAssociation(Ke,Ye);return}const X=(He=$.sourceHandle)!=null&&He.startsWith("r:")?$.sourceHandle.slice(2):void 0,ke=(et=$.targetHandle)!=null&&et.startsWith("l:")?$.targetHandle.slice(2):void 0;i.addAssociation($.source,$.target,X,ke)}const J=n.ref(null);function be($,D){var R;const se=i.state.layout.entityLayouts.find(q=>q.entityRef===$);return at((R=se==null?void 0:se.attributeStyles)==null?void 0:R[D])}function we($,D){var R;const se=i.state.layout.entityLayouts.find(q=>q.entityRef===$);return at((R=se==null?void 0:se.operationStyles)==null?void 0:R[D])}function $e($){var D;return at((D=i.state.layout.groupLayouts.find(se=>se.groupRef===$))==null?void 0:D.style)}function _e($){var D;return at((D=i.state.layout.notes.find(se=>se.modelId===$))==null?void 0:D.style)}function Ce($){var R,q;if($.preventDefault(),!i.editable.value)return;const D=()=>Y({x:$.clientX,y:$.clientY}),se=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const M=D();i.addEntity("NewEntity",{x:M.x,y:M.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const M=D();i.addNote("메모",{x:M.x,y:M.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const M=D();i.addEmptyGroup({x:M.x,y:M.y})}}];((R=i.clipboard.value)==null?void 0:R.kind)==="entity"&&se.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&se.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(q=J.value)==null||q.open($,se)}function Te({event:$,node:D}){var De,Le,Pe,He,et,Ye,Ke,je,Mo,ve,tt,Bo,Do,Oo,Lo,Po,zo,Uo;const se=$;if(se.preventDefault(),!i.editable.value){if(D.type==="group"||D.type==="note")return;const Me=(Le=(De=se.target)==null?void 0:De.closest("[data-attr]"))==null?void 0:Le.dataset.attr;if(Me){const Ze=i.selection.value;(Ze==null?void 0:Ze.kind)==="attribute"&&Ze.entityId===D.id&&Ze.ids.includes(Me)||i.selectAttribute(D.id,Me);const _n=((Pe=i.selection.value)==null?void 0:Pe.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[Me];(He=J.value)==null||He.open(se,[{caption:_n.length>1?`복사 (${_n.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(et=J.value)==null||et.open(se,[{caption:"상세 편집…",icon:"pencil",handler:()=>Ui(a,i,D.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}]);return}if(D.type==="group"){const Me=i.isGroupLocked(D.id),Ze=[];Me||Ze.push({type:"swatches",caption:"색상",current:$e(D.id),onPick:ot=>i.setGroupSwatch(D.id,ot)},{type:"separator"}),Ze.push({caption:Me?"잠금 해제":"잠금",icon:Me?"unlock":"lock",handler:()=>i.setGroupLocked(D.id,!Me)}),Me||Ze.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(D.id)}),(Ye=J.value)==null||Ye.open(se,Ze);return}if(D.type==="note"){(Ke=J.value)==null||Ke.open(se,[{type:"swatches",caption:"색상",current:_e(D.id),onPick:Me=>i.setNoteSwatch(D.id,Me)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(D.id)}]);return}const R=(Mo=(je=se.target)==null?void 0:je.closest("[data-attr]"))==null?void 0:Mo.dataset.attr;if(R){const Me=i.selection.value;(Me==null?void 0:Me.kind)==="attribute"&&Me.entityId===D.id&&Me.ids.includes(R)||i.selectAttribute(D.id,R);const ot=((ve=i.selection.value)==null?void 0:ve.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[R];if(i.isEntityLocked(D.id)){(tt=J.value)==null||tt.open(se,[{caption:ot.length>1?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const _n=ot.length>1,Zl=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{type:"swatches",caption:_n?`색상 (${ot.length})`:"색상",current:_n?null:be(D.id,R),onPick:aC=>i.setAttributeSwatches(D.id,ot,aC)},{type:"separator"},{caption:_n?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Ho=i.clipboard.value;(Ho==null?void 0:Ho.kind)==="attribute"&&Zl.push({caption:Ho.attributes.length>1?`속성 붙여넣기 (${Ho.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Zl.push({type:"separator"},{caption:_n?`속성 삭제 (${ot.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(D.id,ot)}),(Bo=J.value)==null||Bo.open(se,Zl);return}const q=(Oo=(Do=se.target)==null?void 0:Do.closest("[data-op]"))==null?void 0:Oo.dataset.op;if(q){if(i.isEntityLocked(D.id))return;(Lo=J.value)==null||Lo.open(se,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(D.id)},{type:"swatches",caption:"색상",current:we(D.id,q),onPick:Me=>i.setOperationSwatch(D.id,q,Me)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(D.id,q)}]);return}const M=i.resolved.value.entities.find(Me=>Me.entity.modelId===D.id),X=!!(M!=null&&M.locked),ke=[{caption:X?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>Ui(a,i,D.id)}];if(!X){ke.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(D.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Ze=S.value.filter(ot=>ot.type==="entity").map(ot=>ot.id);i.createGroup(Ze.includes(D.id)&&Ze.length?Ze:[D.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(D.id,D.id)});const Me=i.embeddableCatalog.value;if(Me.length){ke.push({type:"separator"});for(const Ze of Me){const ot=((Po=Ze.label)==null?void 0:Po.ko)??((zo=Ze.label)==null?void 0:zo.en)??Ze.type;ke.push({caption:`임베더블 추가: ${ot}`,icon:"link",handler:()=>i.addPredefinedEmbed(D.id,Ze.type)})}}}if(ke.push({type:"separator"}),ke.push({caption:M!=null&&M.collapsed?"펼치기":"접기",icon:M!=null&&M.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(D.id,!(M!=null&&M.collapsed))}),M!=null&&M.groupRef&&!X&&ke.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(D.id)}),ke.push({caption:X?"잠금 해제":"잠금",icon:X?"unlock":"lock",handler:()=>i.setEntityLocked(D.id,!X)}),ke.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}),!X){const Me=i.clipboard.value;(Me==null?void 0:Me.kind)==="attribute"&&ke.push({caption:Me.attributes.length>1?`속성 붙여넣기 (${Me.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),ke.push({type:"separator"}),ke.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(D.id)})}(Uo=J.value)==null||Uo.open(se,ke)}function Be({event:$,edge:D}){var q,M;const se=$;if(se.preventDefault(),!i.editable.value)return;const R=V(D.id);if(R){(q=J.value)==null||q.open(se,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(R.noteRef,R.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(R.noteRef,R.targetRef)}]);return}(M=J.value)==null||M.open(se,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(D.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(D.id)}])}function N($){return $==="group"?"group":$==="note"?"note":"entity"}function A({node:$}){if(S.value.length>1){i.selection.value=null;return}i.selection.value={kind:N($.type),id:$.id}}function ae({nodes:$}){$.length>1&&(i.selection.value=null)}function T({edge:$}){const D=V($.id);i.selection.value=D?{kind:"note",id:D.noteRef}:{kind:"association",id:$.id}}function z($){const D=i.selection.value;return!!D&&D.kind!=="attribute"&&D.id===$.id}function B($){var D,se;return z($)?$.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":$.type==="note"?"var(--em-note-soft)":$.type==="group"?Rd(at((D=$.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":Rd(at((se=$.data)==null?void 0:se.style))??"var(--em-mm-entity)"}function me($){return z($)?"var(--em-selection)":$.type==="note"?"var(--em-note-accent)":$.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function Z($,D){oe($,D,{zoom:k().zoom,duration:350})}n.watch(()=>i.focusRequest.value,$=>{if(!$)return;const D=x($.id);if(!D)return;const se=D.computedPosition??D.position,R=D.dimensions??{width:0,height:0};Z(se.x+R.width/2,se.y+R.height/2)});function Q({position:$}){Z($.x,$.y)}function te({node:$}){i.selection.value={kind:N($.type),id:$.id};const D=$.computedPosition??$.position,se=$.dimensions??{width:0,height:0};Z(D.x+se.width/2,D.y+se.height/2)}function de({node:$}){L({nodes:[$.id],duration:350,maxZoom:1.2,padding:.6})}return($,D)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(u1),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!U.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":n.unref(i).editable.value,"nodes-connectable":n.unref(i).editable.value,"connection-mode":n.unref(Dt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:j,onMoveEnd:W,onConnect:G,onConnectStart:D[1]||(D[1]=se=>c.value=!0),onConnectEnd:D[2]||(D[2]=se=>c.value=!1),onNodeDrag:I,onNodeDragStop:C,onNodeClick:A,onEdgeClick:T,onSelectionChange:ae,onPaneClick:D[3]||(D[3]=se=>n.unref(i).selection.value=null),onPaneContextMenu:Ce,onNodeContextMenu:Te,onEdgeContextMenu:Be},{"node-group":n.withCtx(se=>[n.createVNode(Ud,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),"node-entity":n.withCtx(se=>[n.createVNode(zd,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),"node-note":n.withCtx(se=>[n.createVNode(Hd,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),"edge-association":n.withCtx(se=>[n.createVNode(nu,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),"edge-note-connection":n.withCtx(se=>[n.createVNode(S$,n.normalizeProps(n.guardReactiveProps(se)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(yw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Hw),{"show-interactive":!1,position:"bottom-left"},{default:n.withCtx(()=>[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(n.unref(hn),{class:"em-palette__group-start",title:"엔티티 추가",onClick:ye},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"노트 추가",onClick:ue},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"자동 배치",onClick:D[0]||(D[0]=se=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:14})]),_:1})],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(N$),{key:1,pannable:"",width:224,height:160,"node-color":B,"node-stroke-color":me,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:Q,onNodeClick:te,onNodeDblclick:de})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),re.value?(n.openBlock(),n.createElementBlock("div",ex,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[D[4]||(D[4]=n.createElementVNode("p",{class:"em-canvas__empty-title"},"빈 다이어그램입니다",-1)),D[5]||(D[5]=n.createElementVNode("p",{class:"em-canvas__empty-hint"},[n.createTextVNode(" 캔버스를 "),n.createElementVNode("strong",null,"우클릭"),n.createTextVNode("하거나 좌하단 "),n.createElementVNode("strong",null,"+"),n.createTextVNode(" 버튼으로 첫 엔티티를 추가하세요. ")],-1)),D[6]||(D[6]=n.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub"},[n.createTextVNode(" 단축키 도움말은 "),n.createElementVNode("kbd",null,"?"),n.createTextVNode(" 키 ")],-1))],64)):(n.openBlock(),n.createElementBlock("p",tx,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",nx,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",ox,[n.createElementVNode("strong",ix,n.toDisplayString(s.value.title),1),n.createElementVNode("span",ax,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(P$,{ref_key:"menuRef",ref:J},null,512),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",lx,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function da(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function rx(e,t){const o=new Set,i=a=>{const l=!!a.matchText&&a.matchText.includes(t);let r=!1;for(const c of a.children)i(c)&&(r=!0);const s=l||r;return s&&o.add(a.key),s};return i(e),o}const sx={class:"em-explorer em-scroll-overlay"},cx={class:"em-explorer__search"},dx={key:0,class:"em-explorer__empty"},ux={class:"em-explorer__rows"},fx=["data-key","onClick","onDblclick"],mx=["onClick"],px=["title"],hx={class:"em-key-slot"},yx={class:"em-key-slot"},gx={class:"em-explorer__label"},tf=Ue(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.computed(()=>{var le;const x=i.resolved.value,O=i.displayMode.value,P=E=>{var K,re,pe;return Fo(O,E.name,(re=(K=E.table)==null?void 0:K.logicalName)==null?void 0:re.ko,(pe=E.table)==null?void 0:pe.physicalName)},H=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",ne=E=>{const K=E.attrType.startsWith("RELATION")&&E.dbAttrs.length>0;return{icon:E.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:E.identifier,fk:K&&H}}},ce=E=>E.attrType.startsWith("EMBED")&&E.dbAttrs.length>0,L=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",oe=E=>{if(E.attrType!=="EMBED_PREDEF")return E.dbAttrs;const K=i.embeddableCatalog.value.find(re=>re.type===E.type);return K?E.dbAttrs.map((re,pe)=>{const ye=K.fields[pe];return ye?{...re,physicalName:re.physicalName||ye.physicalName,logicalName:re.logicalName??ye.logicalName,dataType:re.dataType||ye.dataType,length:re.length??ye.length}:re}):E.dbAttrs},k=(E,K)=>{var ue,fe,ge,Ee,Re,Ie,he,j,W;const re={entityId:K,attrId:E.modelId};if(ce(E)){const w=Na(O,E);return{key:`attr:${E.modelId}`,label:E.name+(w?` : ${w}`:""),icon:"table",attrRef:re,focusId:K,matchText:da(E.name,(fe=(ue=E.dbAttrs[0])==null?void 0:ue.logicalName)==null?void 0:fe.ko,(ge=E.dbAttrs[0])==null?void 0:ge.physicalName),children:L?oe(E).map(I=>{var C,G;return{key:`attr:${E.modelId}:col:${I.modelId}`,label:Fo(O,I.physicalName,(C=I.logicalName)==null?void 0:C.ko,I.physicalName)+(I.dataType?` : ${I.dataType}`:""),icon:"field",attrRef:re,focusId:K,matchText:da(I.physicalName,(G=I.logicalName)==null?void 0:G.ko),children:[]}}):[]}}const pe=pr(E,i.state.logical.associations),ye=Na(O,E,pe);return{key:`attr:${E.modelId}`,label:Fo(O,E.name,(Re=(Ee=E.dbAttrs[0])==null?void 0:Ee.logicalName)==null?void 0:Re.ko,(Ie=E.dbAttrs[0])==null?void 0:Ie.physicalName)+(ye?` : ${ye}`:""),...ne(E),attrRef:re,focusId:K,matchText:da(E.name,(j=(he=E.dbAttrs[0])==null?void 0:he.logicalName)==null?void 0:j.ko,(W=E.dbAttrs[0])==null?void 0:W.physicalName),children:[]}},Y=E=>{var pe,ye,ue;const K=E.entity,re=[...K.attributes].sort((fe,ge)=>fe.order-ge.order);return{key:`entity:${K.modelId}`,label:P(K),icon:"table",selectKind:"entity",selectId:K.modelId,focusId:K.modelId,matchText:da(K.name,(ye=(pe=K.table)==null?void 0:pe.logicalName)==null?void 0:ye.ko,(ue=K.table)==null?void 0:ue.physicalName),children:re.map(fe=>k(fe,K.modelId))}},S=new Map,F=[];for(const E of x.entities)if(E.groupRef){const K=S.get(E.groupRef)??[];K.push(E),S.set(E.groupRef,K)}else F.push(E);const U=[];for(const E of x.groups){const K=E.group;U.push({key:`group:${K.modelId}`,label:((le=K.name)==null?void 0:le.ko)||K.packageName||"(그룹)",icon:"folder",focusId:K.modelId,children:(S.get(K.modelId)??[]).map(Y)})}for(const E of F)U.push(Y(E));if(x.associations.length){const E=new Map(x.entities.map(K=>[K.entity.modelId,P(K.entity)]));U.push({key:"section:associations",label:`관계 (${x.associations.length})`,icon:"arrow-lr",children:x.associations.map(K=>{const re=K.association,pe=E.get(re.end1.entityRef)??re.end1.entityRef,ye=E.get(re.end2.entityRef)??re.end2.entityRef;return{key:`assoc:${re.modelId}`,label:`${pe} — ${ye}`,icon:"arrow-lr",selectKind:"association",selectId:re.modelId,children:[]}})})}return x.notes.length&&U.push({key:"section:notes",label:`노트 (${x.notes.length})`,icon:"note",children:x.notes.map(({note:E})=>{var K;return{key:`note:${E.modelId}`,label:((K=E.memo.split(`
43
+ `)[0])==null?void 0:K.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:E.modelId,focusId:E.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:U}});function r(x){return x?x.pk&&x.fk?"PFK (식별 외래키)":x.pk?"PK (기본키)":x.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(x){const O=new Set(s.value);O.has(x)?O.delete(x):O.add(x),s.value=O}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),h=n.computed(()=>{const x=[];if(f.value){const P=rx(l.value,d.value.trim().toLowerCase()),H=(ne,ce)=>{if(P.has(ne.key)){x.push({node:ne,depth:ce});for(const L of ne.children)H(L,ce+1)}};return H(l.value,0),x}const O=(P,H)=>{if(x.push({node:P,depth:H}),!s.value.has(P.key))for(const ne of P.children)O(ne,H+1)};return O(l.value,0),x}),p=n.computed(()=>f.value&&h.value.length<=1);function m(x){var H;if(x.key!=="/"||x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;const O=x.target,P=O==null?void 0:O.tagName;P==="INPUT"||P==="TEXTAREA"||P==="SELECT"||O!=null&&O.isContentEditable||(x.preventDefault(),(H=u.value)==null||H.focus())}n.onMounted(()=>window.addEventListener("keydown",m)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",m));const b=n.computed(()=>{const x=[],O=P=>{if(P.children.length){P.key!=="root"&&x.push(P.key);for(const H of P.children)O(H)}};return O(l.value),x}),y=n.computed(()=>!b.value.some(x=>s.value.has(x)));function _(){s.value=y.value?new Set(b.value):new Set}t({toggleAll:_,allExpanded:y,hasExpandable:n.computed(()=>b.value.length>0)});function V(x){const O=i.selection.value;return x.attrRef?(O==null?void 0:O.kind)==="attribute"&&O.entityId===x.attrRef.entityId&&O.ids.includes(x.attrRef.attrId):!!O&&O.kind!=="attribute"&&!!x.selectId&&x.selectKind===O.kind&&x.selectId===O.id}function g(x){const O=i.selection.value;return x.selectKind==="entity"&&(O==null?void 0:O.kind)==="attribute"&&O.entityId===x.selectId}function v(x,O){if(x.attrRef){const P=O.shiftKey?"range":O.metaKey||O.ctrlKey?"toggle":"replace";i.selectAttribute(x.attrRef.entityId,x.attrRef.attrId,P)}else x.selectKind&&x.selectId&&(i.selection.value={kind:x.selectKind,id:x.selectId});x.focusId&&i.requestFocus(x.focusId)}function ee(x){x.selectKind==="entity"&&x.selectId&&Ui(a,i,x.selectId)}return(x,O)=>(n.openBlock(),n.createElementBlock("section",sx,[n.createElementVNode("div",cx,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":O[0]||(O[0]=P=>d.value=P),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:O[1]||(O[1]=n.withKeys(P=>d.value="",["esc"]))},null,544),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":"검색어 지우기",title:"지우기 (Esc)",onClick:O[2]||(O[2]=P=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),p.value?(n.openBlock(),n.createElementBlock("p",dx,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",ux,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,({node:P,depth:H})=>(n.openBlock(),n.createElementBlock("div",{key:P.key,class:n.normalizeClass(["em-explorer__row",{"is-active":V(P),"is-focus-parent":g(P),"is-selectable":!!P.selectKind||!!P.attrRef||!!P.focusId}]),"data-key":P.key,style:n.normalizeStyle({paddingLeft:4+H*14+"px"}),onClick:ne=>v(P,ne),onDblclick:ne=>ee(P)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!P.children.length,"is-open":!s.value.has(P.key)}]),onClick:n.withModifiers(ne=>P.children.length&&c(P.key),["stop"])},[P.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,mx),P.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(P.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",hx,[P.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):P.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:P.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",yx,[P.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,px)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:P.icon,size:15},null,8,["name"])),n.createElementVNode("span",gx,n.toDisplayString(P.label),1)],46,fx))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),bx={class:"em-text-export"},_x={key:0,class:"em-text-export__tabs",role:"tablist"},kx=["aria-selected","onClick"],wx={class:"em-text-export__pre"},Ex={class:"em-text-export__actions"},vx=Ue(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(0);function a(){return t.formats[i.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(a().content),ie.showNotification("클립보드에 복사되었습니다.","info")}catch{ie.showNotification("복사에 실패했습니다.","error")}}function r(){const s=a(),c=new Blob([s.content],{type:"text/plain;charset=utf-8"}),d=URL.createObjectURL(c);try{const u=document.createElement("a");u.href=d,u.download=s.filename,document.body.appendChild(u),u.click(),u.remove()}finally{URL.revokeObjectURL(d)}}return(s,c)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",bx,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",_x,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.formats,(d,u)=>(n.openBlock(),n.createElementBlock("button",{key:d.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-export__tab",{"is-active":u===i.value}]),"aria-selected":u===i.value,onClick:f=>i.value=u},n.toDisplayString(d.label),11,kx))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",wx,n.toDisplayString(a().content),1),n.createElementVNode("div",Ex,[n.createVNode(n.unref(ie.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ie.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),Nx={class:"em-toolbar"},$x={class:"em-toolbar__mode"},nf=Ue(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ie.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:p=>i.displayMode.value=p});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const p=i.resolved.value.entities;return p.length>0&&p.every(m=>m.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){const p=i.state.logical;l.openModal({component:vx,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:ar(p),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:ba(p,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:ba(p,"class"),filename:"diagram.class.mmd"}]}})}function h(){l.openModal({component:Qu})}return(p,m)=>(n.openBlock(),n.createElementBlock("div",Nx,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:m[0]||(m[0]=b=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:m[1]||(m[1]=b=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),m[10]||(m[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",$x,[m[8]||(m[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:s.value,"onUpdate:modelValue":m[2]||(m[2]=b=>s.value=b),items:r,"value-provider":b=>b.v,"label-provider":b=>b.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:m[3]||(m[3]=b=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:m[4]||(m[4]=b=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:d.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),m[11]||(m[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"내보내기 (텍스트 · Mermaid)",onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:m[5]||(m[5]=b=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:m[6]||(m[6]=b=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[m[9]||(m[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:m[7]||(m[7]=b=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:"키보드 단축키 (?)",onClick:h},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1})]))}}),[["__scopeId","data-v-aea19e30"]]),xx={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},Ix=["title"],Sx=["disabled","aria-pressed"],Cx=["disabled","aria-pressed"],Rx=Ue(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t;function a(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,r)=>e.frozen?(n.openBlock(),n.createElementBlock("div",xx,[n.createVNode(Ve,{name:"lock",size:14}),r[2]||(r[2]=n.createElementVNode("span",null,"편집 잠김 (충돌)",-1))])):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:"이 다이어그램은 조회 전용입니다"},[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:r[0]||(r[0]=s=>a(!1))},[n.createVNode(Ve,{name:"eye",size:13}),r[3]||(r[3]=n.createElementVNode("span",null,"조회",-1))],10,Sx),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:r[1]||(r[1]=s=>a(!0))},[n.createVNode(Ve,{name:"pencil",size:13}),r[4]||(r[4]=n.createElementVNode("span",null,"편집",-1))],10,Cx)],10,Ix))}}),[["__scopeId","data-v-44f7d737"]]),Vx=["disabled"],Ax={class:"em-panel__sub"},Tx={class:"em-nav"},Mx={key:0,class:"em-nav__divider","aria-hidden":"true"},Bx={key:1},Dx=["onClick","onKeydown"],Ox={class:"em-nav__name"},Lx=["title"],Px={key:0,class:"em-panel__note"},zx=["data-attr-block"],Ux={class:"em-attr__row"},Hx=["title"],Fx={key:0,class:"em-attr__row"},Gx={class:"em-attr__row"},Yx={class:"em-attr__row"},Wx={class:"em-attr__flags"},Kx={class:"em-attr__pii"},qx={class:"em-attr__pii"},Xx={class:"em-attr__pii"},jx={key:0,class:"em-attr__pii em-attr__codetop"},Zx={class:"em-multilang"},Jx={key:2,class:"em-embed-cols"},Qx={class:"em-embed-col__label"},eI={class:"em-attr__row"},tI={class:"em-attr__row"},nI={key:0,class:"em-embed-upd"},oI={class:"em-embed-upd"},iI={class:"em-embed-upd"},aI={class:"em-swatch__row em-attr__swatch"},lI=["onClick"],rI=["title","onClick"],sI={key:0,class:"em-attr__swatch-hint"},cI="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",ua="__OWN__",dI=Ue(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(R=>R.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(R=>R.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes.filter(q=>q.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes)??[]}),d=n.computed(()=>s.value.filter(R=>r.value.has(R.modelId)));function u(R){return{pk:R.identifier,fk:R.attrType.startsWith("RELATION")&&R.dbAttrs.length>0,required:R.notNull&&!R.identifier}}function f(R){return!!i.value&&!!oi(o.state.logical,i.value.modelId,R.modelId)}function h(R){const q=u(R),M=[q.pk&&"PK",q.fk&&"FK",q.required&&"NOT NULL"].filter(Boolean);return M.length?M.join(" · "):void 0}function p(R,q){i.value&&o.selectAttribute(i.value.modelId,R.modelId,q.shiftKey?"range":q.metaKey||q.ctrlKey?"toggle":"replace")}const m=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function b(R){return R==="none"?"(없음)":R}const y=R=>R;function _(R){var q,M;return at((M=(q=a.value)==null?void 0:q.attributeStyles)==null?void 0:M[R.modelId])}function V(R){return r.value.size>1&&r.value.has(R.modelId)}function g(R,q){if(!i.value)return;const M=V(R)?o.selectedAttrIds.value:[R.modelId];o.setAttributeSwatches(i.value.modelId,M,q)}function v(R,q){i.value&&o.updateAttribute(i.value.modelId,R.modelId,q)}function ee(R,q){v(R,{naturalId:q||void 0,naturalIdMutable:q?R.naturalIdMutable:void 0})}function x(){return{naturalId:void 0,naturalIdMutable:void 0}}function O(R,q){v(R,{identifier:q,...q?x():{}})}function P(R,q){v(R,{transient:q||void 0,...q?x():{}})}function H(R){return!!R.transient}const ne=R=>R.value,ce=R=>R.label;function L(R,q){if(!q)return;const M=E.value.find(X=>X.type===q);if(M){const X=R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"};v(R,{type:q,customType:void 0,dbAttrs:[{...X,dataType:M.dataType,length:M.length,scale:M.scale}]});return}v(R,q===Ct?{type:q}:{type:q,customType:void 0})}function oe(R,q){v(R,{customType:q.trim()===""?void 0:q})}function k(R,q){const X={...R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"},...q};q.dataType!==void 0&&!Go.has(X.dataType)&&(X.scale=void 0),v(R,{dbAttrs:[X]})}function Y(R){var q;return Go.has(((q=R.dbAttrs[0])==null?void 0:q.dataType)??"")}function S(R,q,M){var X;k(R,{logicalName:{...(X=R.dbAttrs[0])==null?void 0:X.logicalName,[q]:M}})}function F(R,q){v(R,{description:Object.keys(q).length?q:void 0})}function U(R){return R.personalInfoAttributeType??"none"}function le(R,q){v(R,{personalInfoAttributeType:q==="none"?void 0:q})}const E=n.computed(()=>o.predefinedCustomTypeCatalog.value),K=n.computed(()=>o.embeddableCatalog.value),re=n.ref(void 0);function pe(R){var q,M;return((q=R.label)==null?void 0:q.ko)??((M=R.label)==null?void 0:M.en)??R.type}function ye(R){if(!R||!i.value)return;const q=o.addPredefinedEmbed(i.value.modelId,R);q&&o.selectAttribute(i.value.modelId,q),re.value=void 0}function ue(){if(!i.value)return;const R=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,R)}const fe=n.computed(()=>o.groupCodeCatalog.value);function ge(R){var q;return((q=fe.value.find(M=>M.groupCode===R.groupCode))==null?void 0:q.codes)??[]}function Ee(R){return["none",...ge(R)]}function Re(R){return R==="none"?"none":R.code}function Ie(R){var M,X;if(R==="none")return"(없음)";const q=((M=R.label)==null?void 0:M.ko)??((X=R.label)==null?void 0:X.en);return q?`${R.code} (${q})`:R.code}function he(R,q){i.value&&o.setAttributeGroupCode(i.value.modelId,R.modelId,q)}function j(R,q){v(R,{defaultValue:q==="none"?void 0:q})}function W(R,q){v(R,{defaultValue:q.trim()===""?void 0:q})}function w(R){return R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0}function I(R,q,M){const X=R.dbAttrs.map((ke,De)=>{if(De!==q)return ke;const Le={...ke,...M};for(const Pe of Object.keys(M))M[Pe]===void 0&&delete Le[Pe];return Le});i.value&&o.setEmbedColumns(i.value.modelId,R.modelId,X)}function C(R,q,M,X){var ke;I(R,q,{logicalName:{...(ke=R.dbAttrs[q])==null?void 0:ke.logicalName,[M]:X}})}function G(R,q){var ke,De,Le;if(R.attrType==="EMBED_PREDEF"){const Pe=(ke=o.embeddableCatalog.value.find(He=>He.type===R.type))==null?void 0:ke.fields[q];return Pe?{name:Pe.name,physicalName:Pe.physicalName,dataType:Pe.dataType,length:Pe.length,shareable:Pe.shareable,logicalName:Pe.logicalName}:void 0}const M=(De=R.embedded)==null?void 0:De.embeddableRef;if(!M)return;const X=(Le=o.state.logical.entities.find(Pe=>Pe.modelId===M))==null?void 0:Le.attributes.flatMap(Pe=>Pe.dbAttrs)[q];return X?{physicalName:X.physicalName,dataType:X.dataType,length:X.length,scale:X.scale,logicalName:X.logicalName}:void 0}function J(R,q){var M,X;return((M=G(R,q))==null?void 0:M.dataType)||((X=R.dbAttrs[q])==null?void 0:X.dataType)||""}function be(R,q){var M,X;return((M=G(R,q))==null?void 0:M.length)??((X=R.dbAttrs[q])==null?void 0:X.length)}function we(R,q){var M,X;return((M=G(R,q))==null?void 0:M.scale)??((X=R.dbAttrs[q])==null?void 0:X.scale)}const $e=["inherit","true","false"];function _e(R){return R==="inherit"?"기본(따름)":R}function Ce(R){return(R==null?void 0:R.updatable)===void 0?"inherit":R.updatable?"true":"false"}function Te(R,q,M){I(R,q,{updatable:M==="inherit"?void 0:M==="true"})}function Be(R,q){k(R,{updatable:q==="inherit"?void 0:q==="true"})}const N=["inherit","true","false"];function A(R){return R==="inherit"?"기본(따름)":R}function ae(R){return(R==null?void 0:R.insertable)===void 0?"inherit":R.insertable?"true":"false"}function T(R,q,M){I(R,q,{insertable:M==="inherit"?void 0:M==="true"})}function z(R,q){k(R,{insertable:q==="inherit"?void 0:q==="true"})}const B=n.computed(()=>i.value?Yo(i.value,o.state.logical.entities):[]),me=n.computed(()=>qn(B.value.flatMap(R=>R.attributes.flatMap(q=>q.dbAttrs)))),Z=n.computed(()=>B.value.flatMap(R=>R.attributes.filter(q=>q.attrType==="NORMAL"&&q.dbAttrs.length===1&&q.dbAttrs[0]).map(q=>{var M;return{modelId:q.dbAttrs[0].modelId,physical:q.dbAttrs[0].physicalName||q.name,isCurrency:q.type==="Currency",ownerName:R.modelId===((M=i.value)==null?void 0:M.modelId)?void 0:R.name}})));function Q(){const R=[...Z.value].sort((q,M)=>Number(M.isCurrency)-Number(q.isCurrency));return[ua,...R.map(q=>q.modelId)]}function te(R){if(R===ua)return"전용 컬럼(OWN)";const q=Z.value.find(X=>X.modelId===R);return q?`↗ ${q.ownerName?`${q.ownerName}.`:""}${q.physical} (${q.isCurrency?"통화":"공유"})`:R}function de(R){return(R==null?void 0:R.sharedColumnRef)??ua}function $(R,q,M){I(R,q,{sharedColumnRef:M===ua?void 0:M})}function D(R){return(R==null?void 0:R.sharedColumnRef)!=null}function se(R){var q;return((q=Ko(R,me.value))==null?void 0:q.physicalName)??""}return(R,q)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",Ax,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:ue}),K.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":re.value,items:K.value,"value-provider":M=>M.type,"label-provider":pe,"onUpdate:modelValue":ye},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",Tx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,M=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:M.modelId},[M.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",Mx,[...q[0]||(q[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",Bx,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(M.modelId)}]),role:"button",tabindex:"0",onClick:X=>p(M,X),onKeydown:[n.withKeys(n.withModifiers(X=>p(M,X),["prevent"]),["enter"]),n.withKeys(n.withModifiers(X=>p(M,X),["prevent"]),["space"])]},[n.createElementVNode("span",Ox,n.toDisplayString(M.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:h(M)},[u(M).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(M).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(M).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,Lx)],42,Dx)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",Px," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,M=>{var X,ke,De,Le,Pe,He,et,Ye,Ke,je,Mo;return n.openBlock(),n.createElementBlock("div",{key:M.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(M.modelId)}]),"data-attr-block":M.modelId},[n.createElementVNode("div",Ux,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-name-${M.modelId}`,width:"100%",placeholder:"이름","model-value":M.name,"onUpdate:modelValue":ve=>v(M,{name:ve})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-type-${M.modelId}`,width:"84px",placeholder:"타입",disabled:M.attrType.startsWith("EMBED")||!!M.groupCode,items:n.unref(mr)(M.type,E.value),"value-provider":ne,"label-provider":ce,"model-value":M.type,"onUpdate:modelValue":ve=>L(M,ve)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(M)?cI:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ve=>n.unref(o).removeAttribute(i.value.modelId,M.modelId)},null,8,["onClick"])],8,Hx)]),M.type===n.unref(Ct)?(n.openBlock(),n.createElementBlock("div",Fx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-customtype-${M.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":M.customType??"","onUpdate:modelValue":ve=>oe(M,ve)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),w(M)?(n.openBlock(),n.createElementBlock("div",Jx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(M.dbAttrs,(ve,tt)=>{var Bo,Do,Oo,Lo,Po,zo,Uo;return n.openBlock(),n.createElementBlock("div",{key:ve.modelId,class:"em-embed-col"},[n.createElementVNode("span",Qx,n.toDisplayString(((Bo=G(M,tt))==null?void 0:Bo.name)??((Do=G(M,tt))==null?void 0:Do.physicalName)??`컬럼 ${tt+1}`),1),n.createElementVNode("div",eI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-col-${ve.modelId}`,width:"100%",disabled:D(ve),placeholder:((Oo=G(M,tt))==null?void 0:Oo.physicalName)??"컬럼","model-value":D(ve)?se(ve):ve.physicalName,"onUpdate:modelValue":Me=>I(M,tt,{physicalName:Me})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSTextInput),{name:`embed-dtype-${ve.modelId}`,width:"84px",disabled:"","model-value":J(M,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-len-${ve.modelId}`,width:"48px",disabled:"","model-value":be(M,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-scale-${ve.modelId}`,width:"48px",disabled:"","model-value":we(M,tt)},null,8,["name","model-value"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":ve.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",tI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-logical-${ve.modelId}`,width:"100%",placeholder:((Po=(Lo=G(M,tt))==null?void 0:Lo.logicalName)==null?void 0:Po.ko)??"논리명","model-value":((zo=ve.logicalName)==null?void 0:zo.ko)??"","onUpdate:modelValue":Me=>C(M,tt,"ko",Me)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Uo=G(M,tt))!=null&&Uo.shareable?(n.openBlock(),n.createElementBlock("label",nI,[q[7]||(q[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px","model-value":de(ve),items:Q(),"value-provider":y,"label-provider":te,"onUpdate:modelValue":Me=>Me&&$(M,tt,Me)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",oI,[q[8]||(q[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:D(ve),"model-value":D(ve)?"false":ae(ve),items:N,"value-provider":y,"label-provider":A,"onUpdate:modelValue":Me=>Me&&T(M,tt,Me)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",iI,[q[9]||(q[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:D(ve),"model-value":D(ve)?"false":Ce(ve),items:$e,"value-provider":y,"label-provider":_e,"onUpdate:modelValue":Me=>Me&&Te(M,tt,Me)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",Gx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-logical-${M.modelId}`,width:"100%",placeholder:"논리명","model-value":((ke=(X=M.dbAttrs[0])==null?void 0:X.logicalName)==null?void 0:ke.ko)??"","onUpdate:modelValue":ve=>S(M,"ko",ve)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Yx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-col-${M.modelId}`,width:"100%",placeholder:"컬럼",disabled:H(M),"model-value":((De=M.dbAttrs[0])==null?void 0:De.physicalName)??"","onUpdate:modelValue":ve=>k(M,{physicalName:ve})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-dtype-${M.modelId}`,width:"84px",placeholder:"dataType",disabled:H(M),items:n.unref(ur)(((Le=M.dbAttrs[0])==null?void 0:Le.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":y,"label-provider":n.unref(wa),"model-value":((Pe=M.dbAttrs[0])==null?void 0:Pe.dataType)??"","onUpdate:modelValue":ve=>ve&&k(M,{dataType:ve})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-len-${M.modelId}`,width:"48px",placeholder:"len",disabled:H(M),"model-value":(He=M.dbAttrs[0])==null?void 0:He.length,"onUpdate:modelValue":ve=>k(M,{length:ve||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-scale-${M.modelId}`,width:"48px",placeholder:"scale",disabled:H(M)||!Y(M),"model-value":(et=M.dbAttrs[0])==null?void 0:et.scale,"onUpdate:modelValue":ve=>k(M,{scale:ve||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Ye=M.dbAttrs[0])==null?void 0:Ye.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",Wx,[n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-pk-${M.modelId}`,label:"Primary Key","model-value":M.identifier,disabled:l.value||H(M),"onUpdate:modelValue":ve=>O(M,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nn-${M.modelId}`,label:"Not Null","model-value":M.notNull,disabled:H(M),"onUpdate:modelValue":ve=>v(M,{notNull:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-uq-${M.modelId}`,label:"Unique","model-value":!!((Ke=M.dbAttrs[0])!=null&&Ke.unique),disabled:H(M),"onUpdate:modelValue":ve=>k(M,{unique:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-ai-${M.modelId}`,label:"Auto Increment","model-value":!!((je=M.dbAttrs[0])!=null&&je.autoIncrement),disabled:H(M)||!M.identifier,"onUpdate:modelValue":ve=>k(M,{autoIncrement:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-tr-${M.modelId}`,label:"@Transient","model-value":!!M.transient,disabled:M.identifier,"onUpdate:modelValue":ve=>P(M,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nid-${M.modelId}`,label:"@NaturalId","model-value":!!M.naturalId,disabled:M.identifier||H(M),"onUpdate:modelValue":ve=>ee(M,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${M.modelId}`,label:"mutable","model-value":!!M.naturalIdMutable,disabled:H(M)||!M.naturalId,"onUpdate:modelValue":ve=>v(M,{naturalIdMutable:ve||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-mv-${M.modelId}`,label:"Multi-Value (Set)","model-value":!!((Mo=M.dbAttrs[0])!=null&&Mo.multiValue),disabled:H(M),"onUpdate:modelValue":ve=>k(M,{multiValue:ve||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",Kx,[q[1]||(q[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:H(M),"model-value":ae(M.dbAttrs[0]),items:N,"value-provider":y,"label-provider":A,"onUpdate:modelValue":ve=>ve&&z(M,ve)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",qx,[q[2]||(q[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:H(M),"model-value":Ce(M.dbAttrs[0]),items:$e,"value-provider":y,"label-provider":_e,"onUpdate:modelValue":ve=>ve&&Be(M,ve)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Xx,[q[3]||(q[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":U(M),items:m,"value-provider":y,"label-provider":b,"onUpdate:modelValue":ve=>ve&&le(M,ve)},null,8,["model-value","onUpdate:modelValue"])]),fe.value.length?(n.openBlock(),n.createElementBlock("label",jx,[q[4]||(q[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Td,{"model-value":M.groupCode,items:fe.value,"onUpdate:modelValue":ve=>he(M,ve)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!fe.value.length}])},[q[5]||(q[5]=n.createElementVNode("span",null,"기본값",-1)),ge(M).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":M.defaultValue??"none",items:Ee(M),"value-provider":Re,"label-provider":Ie,"onUpdate:modelValue":ve=>ve&&j(M,ve)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`attr-default-${M.modelId}`,width:"100%",placeholder:"기본값","model-value":M.defaultValue??"","onUpdate:modelValue":ve=>W(M,ve)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",Zx,[q[6]||(q[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(El,{multiline:"",name:`attr-desc-${M.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":M.description,"onUpdate:modelValue":ve=>F(M,ve)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",aI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(M)===null}]),title:"없음",onClick:ve=>g(M,null)},"∅",10,lI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),ve=>(n.openBlock(),n.createElementBlock("button",{key:ve,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(M)===ve}]),style:n.normalizeStyle({background:n.unref(On)(ve)}),title:n.unref(Dn)(ve),onClick:tt=>g(M,ve)},null,14,rI))),128)),V(M)?(n.openBlock(),n.createElementBlock("span",sI,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,zx)}),128))],8,Vx)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4d527728"]]),uI=["disabled"],fI={class:"em-panel__sub-label"},mI={class:"em-attr__row"},pI={class:"em-field em-idx-params"},hI=["value","onChange"],yI=Ue(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(p=>p.modelId===o.entityId)??null);function r(){var m;if(!l.value)return;const p=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:Oe(),name:`idx_${(((m=l.value.indexes)==null?void 0:m.length)??0)+1}`,unique:!1,columns:p?[{columnRef:p.modelId,descending:!1}]:[]})}function s(p,m){l.value&&a.updateIndex(l.value.modelId,p,m)}function c(p){var b;const m=(b=l.value)==null?void 0:b.attributes[0];m&&s(p.modelId,{columns:[...p.columns,{columnRef:m.modelId,descending:!1}]})}function d(p,m,b){s(p.modelId,{columns:p.columns.map((y,_)=>_===m?{...y,columnRef:b}:y)})}function u(p,m,b){s(p.modelId,{columns:p.columns.map((y,_)=>_===m?{...y,descending:b}:y)})}function f(p,m){s(p.modelId,{columns:p.columns.filter((b,y)=>y!==m)})}function h(p,m){s(p.modelId,{parameters:m.trim()===""?void 0:m})}return(p,m)=>{var b;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:m[0]||(m[0]=y=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",fI,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 인덱스 ("+n.toDisplayString(((b=l.value.indexes)==null?void 0:b.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(r,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],y=>(n.openBlock(),n.createElementBlock("div",{key:y.modelId,class:"em-attr"},[n.createElementVNode("div",mI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`idx-name-${y.modelId}`,width:"100%",placeholder:"인덱스명","model-value":y.name,"onUpdate:modelValue":_=>s(y.modelId,{name:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-uq-${y.modelId}`,class:"em-check",label:"UQ","model-value":y.unique,"onUpdate:modelValue":_=>s(y.modelId,{unique:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(a).removeIndex(l.value.modelId,y.modelId)},null,8,["onClick"])]),n.createVNode(mn,{controller:n.unref(a),"ref-id":y.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.columns,(_,V)=>(n.openBlock(),n.createElementBlock("div",{key:V,class:"em-attr__row"},[n.createVNode(n.unref(ie.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":g=>g.modelId,"label-provider":g=>g.name,"onUpdate:modelValue":g=>g&&d(y,V,g)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-${y.modelId}-desc-${V}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":g=>u(y,V,g)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"−",onClick:g=>f(y,V)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(y)},null,8,["onClick"]),n.createElementVNode("label",pI,[m[1]||(m[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:y.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:_=>h(y,_.target.value)},null,40,hI)])]))),128)):n.createCommentVNode("",!0)],8,uI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),gI=["disabled"],bI={class:"em-panel__sub-label"},_I={class:"em-attr__row"},kI={class:"em-attr__row"},wI={class:"em-multilang"},EI={class:"em-attr__pii"},vI={class:"em-swatch__row em-attr__swatch"},NI=["onClick"],$I=["title","onClick"],xI=Ue(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=ie.useModal(),r=n.computed(()=>a.state.logical.entities.find(g=>g.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(g=>g.entityRef===r.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(g){return g==="none"?"(없음)":g}const f=g=>g;function h(g,v){r.value&&a.updateOperation(r.value.modelId,g.modelId,v)}function p(g,v){h(g,{description:Object.keys(v).length?v:void 0})}function m(g){return g.personalInfoAttributeType??"none"}function b(g,v){h(g,{personalInfoAttributeType:v==="none"?void 0:v})}function y(g){var v,ee;return at((ee=(v=s.value)==null?void 0:v.operationStyles)==null?void 0:ee[g.modelId])}function _(g,v){r.value&&a.setOperationSwatch(r.value.modelId,g.modelId,v)}function V(g){l.openModal({component:Md,bind:{operationName:g.name,sourceCode:g.sourceCode??"",onSave:v=>h(g,{sourceCode:v})}})}return(g,v)=>{var ee;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:v[1]||(v[1]=x=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",bI,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 오퍼레이션 ("+n.toDisplayString(((ee=r.value.operations)==null?void 0:ee.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:v[0]||(v[0]=n.withModifiers(x=>n.unref(a).addOperation(r.value.modelId),["stop"]))})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.operations??[],x=>(n.openBlock(),n.createElementBlock("div",{key:x.modelId,class:"em-attr"},[n.createElementVNode("div",_I,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`op-name-${x.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":x.name,"onUpdate:modelValue":O=>h(x,{name:O})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{width:"96px","model-value":x.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":O=>O&&h(x,{visibility:O})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:O=>n.unref(a).removeOperation(r.value.modelId,x.modelId)},null,8,["onClick"])]),n.createElementVNode("div",kI,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:x.sourceCode?"본문 편집 ●":"본문 편집",onClick:O=>V(x)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",wI,[v[2]||(v[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(El,{multiline:"",name:`op-desc-${x.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":x.description,"onUpdate:modelValue":O=>p(x,O)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",EI,[v[3]||(v[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":m(x),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":O=>O&&b(x,O)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",vI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":y(x)===null}]),title:"없음",onClick:O=>_(x,null)},"∅",10,NI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),O=>(n.openBlock(),n.createElementBlock("button",{key:O,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":y(x)===O}]),style:n.normalizeStyle({background:n.unref(On)(O)}),title:n.unref(Dn)(O),onClick:P=>_(x,O)},null,14,$I))),128))])]))),128)):n.createCommentVNode("",!0)],8,gI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),II={class:"em-panel__head"},SI={class:"em-panel__head-row"},CI={class:"em-panel__context"},RI={key:0,class:"em-panel__lock"},VI=["disabled"],AI={key:0,class:"em-panel__note"},TI={key:1,class:"em-panel__note"},MI={key:2,class:"em-jpa"},BI={class:"em-field"},DI={class:"em-field"},OI={key:0,class:"em-field"},LI={class:"em-panel__sub"},PI={class:"em-field"},zI={class:"em-jpa"},UI={key:0,class:"em-panel__note"},HI={class:"em-jpa"},FI={class:"em-field"},GI={key:0,class:"em-panel__note"},YI={class:"em-field"},WI={class:"em-multilang"},KI={class:"em-field"},qI=["value"],XI={class:"em-field"},jI={class:"em-swatch"},ZI={class:"em-swatch__row"},JI=["title","onClick"],QI={class:"em-panel__note"},eS={class:"em-field"},tS=["value"],nS={class:"em-swatch"},oS={class:"em-swatch__row"},iS=["title","onClick"],of=Ue(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.selection.value),r=n.computed(()=>a.inspectedEntityId.value),s=n.computed(()=>{const j=r.value;return j?a.state.logical.entities.find(W=>W.modelId===j)??null:null}),c=n.computed(()=>{const j=l.value;if((j==null?void 0:j.kind)==="association"){const w=a.state.logical.associations.find(I=>I.modelId===j.id);return!!w&&(a.isEntityLocked(w.end1.entityRef)||a.isEntityLocked(w.end2.entityRef))}const W=r.value;return!!W&&a.isEntityLocked(W)}),d=n.computed(()=>{var j;return((j=a.selectedAttr.value)==null?void 0:j.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),f=n.computed(()=>d.value!==null),h=n.ref({});n.watch(f,()=>{h.value={}});function p(j){return h.value[j]??f.value}function m(j){h.value={...h.value,[j]:!p(j)}}const b=n.computed(()=>{var w;const j=s.value;if(!j)return"엔티티";const W=(w=j.table)==null?void 0:w.physicalName;return W?`${j.name} (${W})`:j.name}),y=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="association"?a.state.logical.associations.find(W=>W.modelId===j.id)??null:null}),_=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="group"?a.state.logical.groups.find(W=>W.modelId===j.id)??null:null}),V=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="note"?a.state.layout.notes.find(W=>W.modelId===j.id)??null:null}),g=n.computed(()=>{var W,w;const j=(W=_.value)==null?void 0:W.name;return(j==null?void 0:j.ko)||(j==null?void 0:j.en)||(j==null?void 0:j.ja)||(j==null?void 0:j.zh)||((w=_.value)==null?void 0:w.packageName)||"그룹"}),v=n.computed(()=>{if(s.value){const j=u.value.size;if(j>1)return`엔티티 · ${s.value.name} › 속성 · ${j}개`;if(d.value){const W=s.value.attributes.find(w=>w.modelId===d.value);return(W==null?void 0:W.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(W==null?void 0:W.name)??""}`}return`엔티티 · ${s.value.name}`}if(y.value){const j=W=>{var w;return((w=a.state.logical.entities.find(I=>I.modelId===W))==null?void 0:w.name)??W};return`관계 · ${j(y.value.end1.entityRef)} — ${j(y.value.end2.entityRef)}`}return _.value?`그룹 · ${g.value}`:V.value?"노트":"선택된 항목 없음"}),ee=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],x=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],O=["LIST","SET"],P=["inherit","LAZY","EAGER"],H=j=>j;function ne(j){return j==="inherit"?"기본(따름)":j}const ce=n.computed(()=>!!y.value&&y.value.end1.entityRef===y.value.end2.entityRef);function L(j,W){y.value&&a.updateAssociationEnd(y.value.modelId,j,W)}function oe(j){y.value&&!ce.value&&a.setAssociationIdentifying(y.value.modelId,j)}function k(j){var W,w,I;return!!((I=(w=(W=y.value)==null?void 0:W[j].jpa)==null?void 0:w.cascadeTypes)!=null&&I.includes("ALL"))}function Y(j,W,w){var G,J;const I=(G=y.value)==null?void 0:G[j];if(W==="ALL"&&w){L(j,{jpa:{...I==null?void 0:I.jpa,cascadeTypes:["ALL"]}});return}const C=new Set(((J=I==null?void 0:I.jpa)==null?void 0:J.cascadeTypes)??[]);w?C.add(W):C.delete(W),L(j,{jpa:{...I==null?void 0:I.jpa,cascadeTypes:[...C]}})}function S(j,W){var I;const w=(I=y.value)==null?void 0:I[j];L(j,{jpa:{...w==null?void 0:w.jpa,...W}})}function F(j){var W,w;return((w=(W=y.value)==null?void 0:W[j].jpa)==null?void 0:w.fetchType)??"inherit"}function U(j,W){S(j,{fetchType:W==="inherit"?void 0:W})}function le(j){var w;const W=(w=y.value)==null?void 0:w[j==="end1"?"end2":"end1"];return(W==null?void 0:W.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(W==null?void 0:W.multiplicity)==="ONE_OR_MORE_INSTANCES"}const E=n.computed(()=>{const j=y.value;if(!j)return null;for(const W of a.state.logical.entities){const w=W.attributes.find(G=>{var J;return((J=G.embedded)==null?void 0:J.associationRef)===j.modelId&&G.attrType==="EMBED_OWN"});if(!w)continue;const I=j.end2.entityRef===w.embedded.embeddableRef?"end2":"end1",C=j[I].jpa;return{which:I,isCollection:j[I].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(C==null?void 0:C.collectionType)??"LIST",collectionTable:(C==null?void 0:C.collectionTable)??"",orderColumn:(C==null?void 0:C.orderColumn)??""}}return null});function K(j){y.value&&a.setEmbedCollectionMode(y.value.modelId,j?"COLLECTION":"SINGLE")}function re(j){const W=E.value;W&&S(W.which,j==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function pe(j){const W=E.value;W&&S(W.which,{collectionTable:j.trim()||void 0})}function ye(j){const W=E.value;W&&S(W.which,{orderColumn:j.trim()||void 0})}function ue(j){_.value&&a.updateGroup(_.value.modelId,j)}function fe(j,W){var w;ue({name:{...(w=_.value)==null?void 0:w.name,[j]:W}})}const ge=n.computed(()=>{var j;return _.value?at((j=a.state.layout.groupLayouts.find(W=>W.groupRef===_.value.modelId))==null?void 0:j.style):null});function Ee(j){_.value&&a.setGroupSwatch(_.value.modelId,j)}function Re(j){V.value&&a.setNoteMemo(V.value.modelId,j)}const Ie=n.computed(()=>{var j;return at((j=V.value)==null?void 0:j.style)});function he(j){V.value&&a.setNoteSwatch(V.value.modelId,j)}return(j,W)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:"너비 조절",onPointerdown:W[0]||(W[0]=(...w)=>e.startResize&&e.startResize(...w))},null,34),n.createElementVNode("header",II,[n.createElementVNode("div",SI,[W[13]||(W[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:W[1]||(W[1]=w=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",CI,n.toDisplayString(v.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",RI,[n.createVNode(Ve,{name:"lock",size:13}),W[14]||(W[14]=n.createElementVNode("span",null,"편집 잠김 — 이동·수정·삭제 차단",-1)),n.unref(a).editable.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:W[2]||(W[2]=w=>n.unref(a).setEntityLocked(r.value,!1))},"잠금 해제")):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value||c.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(Vd,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:b.value,onToggle:W[3]||(W[3]=w=>m("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(dI,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(yI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:W[4]||(W[4]=w=>m("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(xI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:W[5]||(W[5]=w=>m("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),y.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ie.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!y.value.identifying,disabled:ce.value||!!E.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),ce.value?(n.openBlock(),n.createElementBlock("p",AI,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):E.value?(n.openBlock(),n.createElementBlock("p",TI,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),E.value?(n.openBlock(),n.createElementBlock("fieldset",MI,[W[18]||(W[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ie.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":E.value.isCollection,"onUpdate:modelValue":K},null,8,["model-value"]),E.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",BI,[W[15]||(W[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":E.value.collectionType,items:O,"value-provider":H,"label-provider":H,"onUpdate:modelValue":W[6]||(W[6]=w=>w&&re(w))},null,8,["model-value"])]),n.createElementVNode("label",DI,[W[16]||(W[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":E.value.collectionTable,"onUpdate:modelValue":pe},null,8,["model-value"])]),E.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",OI,[W[17]||(W[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":E.value.orderColumn,"onUpdate:modelValue":ye},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),W[19]||(W[19]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],w=>{var I,C,G,J;return n.createElementVNode("div",{key:w,class:"em-end"},[n.createElementVNode("h4",LI,n.toDisplayString(w)+" → "+n.toDisplayString(y.value[w].entityRef),1),n.createElementVNode("label",PI,[W[20]||(W[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":y.value[w].multiplicity,items:ee,"value-provider":H,"label-provider":H,disabled:((I=E.value)==null?void 0:I.which)===w,"onUpdate:modelValue":be=>L(w,{multiplicity:be})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-navigable`,class:"em-check",label:"navigable","model-value":y.value[w].navigable,"onUpdate:modelValue":be=>L(w,{navigable:be})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-composition`,class:"em-check",label:"composition","model-value":y.value[w].composition,"onUpdate:modelValue":be=>L(w,{composition:be})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",zI,[W[21]||(W[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(x,be=>{var we,$e;return n.createVNode(n.unref(ie.BSCheckbox),{key:be,name:`${w}-cascade-${be}`,class:"em-check",label:be,"model-value":!!(($e=(we=y.value[w].jpa)==null?void 0:we.cascadeTypes)!=null&&$e.includes(be)),disabled:be!=="ALL"&&k(w),"onUpdate:modelValue":_e=>Y(w,be,_e)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),k(w)?(n.openBlock(),n.createElementBlock("p",UI,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",HI,[W[24]||(W[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",FI,[W[22]||(W[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":F(w),items:P,"value-provider":H,"label-provider":ne,"onUpdate:modelValue":be=>be&&U(w,be)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((C=y.value[w].jpa)!=null&&C.orphanRemoval),disabled:le(w),"onUpdate:modelValue":be=>S(w,{orphanRemoval:be})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),le(w)&&((G=y.value[w].jpa)!=null&&G.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",GI,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",YI,[W[23]||(W[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:`${w}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((J=y.value[w].jpa)==null?void 0:J.orderBy)??"","onUpdate:modelValue":be=>S(w,{orderBy:be.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",WI,[W[25]||(W[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,w=>{var I;return n.openBlock(),n.createElementBlock("label",{key:w,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(w),1),n.createVNode(n.unref(ie.BSTextInput),{name:`grp-name-${w}`,width:"100%","model-value":((I=_.value.name)==null?void 0:I[w])??"","onUpdate:modelValue":C=>fe(w,C)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",KI,[W[26]||(W[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:W[7]||(W[7]=w=>ue({description:w.target.value}))},null,40,qI)]),n.createElementVNode("label",XI,[W[27]||(W[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":W[8]||(W[8]=w=>ue({packageName:w}))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":W[9]||(W[9]=w=>ue({excludeDDLGeneration:w}))},null,8,["model-value"]),n.createElementVNode("fieldset",jI,[W[28]||(W[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",ZI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ge.value===null}]),title:"없음",onClick:W[10]||(W[10]=w=>Ee(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),w=>(n.openBlock(),n.createElementBlock("button",{key:w,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ge.value===w}]),style:n.normalizeStyle({background:n.unref(On)(w)}),title:n.unref(Dn)(w),onClick:I=>Ee(w)},null,14,JI))),128))])]),n.createElementVNode("p",QI,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),V.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",eS,[W[29]||(W[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:V.value.memo,rows:"6",onChange:W[11]||(W[11]=w=>Re(w.target.value))},null,40,tS)]),n.createElementVNode("fieldset",nS,[W[30]||(W[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",oS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ie.value===null}]),title:"없음",onClick:W[12]||(W[12]=w=>he(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),w=>(n.openBlock(),n.createElementBlock("button",{key:w,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":Ie.value===w}]),style:n.normalizeStyle({background:n.unref(On)(w)}),title:n.unref(Dn)(w),onClick:I=>he(w)},null,14,iS))),128))])])],64)):n.createCommentVNode("",!0)],8,VI)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),aS={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function lS(e){const t=e.split("-")[1];return t?aS[t]??t:e}function rS(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const sS=["title"],cS=["title","onClick"],dS={key:0,class:"em-validation__body"},uS={class:"em-validation__opt"},fS={key:0,class:"em-validation__empty"},mS={key:1,class:"em-validation__empty"},pS={key:2,class:"em-validation__list"},hS=["onClick"],yS={class:"em-validation__item-msg"},gS={key:0,class:"em-validation__item-entity"},bS=["title"],_S=Ue(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const b=new Map;for(const y of o.state.logical.entities)b.set(y.modelId,y.name);return b});function l(b){const y=rS(b);if(!y)return null;const _=a.value.get(y);return _===void 0?null:_.trim()===""?"(이름 없음)":_}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const b={error:0,warning:0,info:0};for(const y of i.value)b[y.severity]++;return b}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(b=>c.value[b.severity]).slice().sort((b,y)=>r[b.severity].order-r[y.severity].order)),u=n.computed(()=>d.value.map(b=>({issue:b,entityName:l(b),category:lS(b.ruleId)}))),f=n.ref(!1);function h(b){c.value[b]=!c.value[b]}function p(b){if(!f.value){f.value=!0;return}h(b)}function m(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,y)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(f.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:y[1]||(y[1]=_=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),y[3]||(y[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,sS),n.createElementVNode("div",{class:"em-validation__counts",onClick:y[0]||(y[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],_=>n.createElementVNode("button",{key:_,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:f.value?`${r[_].label} ${c.value[_]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:V=>p(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,cS)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",dS,[n.createElementVNode("label",uS,[n.createVNode(n.unref(ie.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":y[2]||(y[2]=_=>n.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",fS,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",mS," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",pS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:V,category:g},v)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${v}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:ee=>m(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",yS,[V?(n.openBlock(),n.createElementBlock("span",gS,n.toDisplayString(V),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(_.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},n.toDisplayString(g),9,bS)],10,hS))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),kS={class:"em-history"},wS={class:"em-history__head"},ES={class:"em-history__title"},vS={class:"em-history__head-actions"},NS=["disabled"],$S={class:"em-history__filters"},xS={class:"em-history__filter"},IS={class:"em-history__body"},SS={key:0,class:"em-history__empty"},CS={key:1,class:"em-history__empty is-error"},RS={key:2,class:"em-history__empty"},VS={key:3,class:"em-history__list"},AS=["onClick"],TS={class:"em-history__summary"},MS={class:"em-history__seq"},BS={class:"em-history__gmeta"},DS={class:"em-history__who"},OS={key:0,class:"em-history__time"},LS={key:1,class:"em-history__restored-from"},PS={key:0,class:"em-history__detail"},zS={class:"em-history__action-head"},US={class:"em-history__action-name"},HS={key:0,class:"em-history__fields"},FS={class:"em-history__fname"},GS={key:0,class:"em-history__old"},YS={class:"em-history__val"},WS={key:1,class:"em-history__restore"},KS=["disabled","onClick"],qS=["disabled"],XS=["onClick"],jS=Ue(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.ref([]),r=n.ref(!1),s=n.ref(null),c=n.ref(!1);async function d(){if(a.historyTransport){r.value=!0,s.value=null;try{l.value=await a.historyTransport(),c.value=!0}catch(E){s.value=E instanceof Error?E.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,E=>{E&&u()},{immediate:!0});let f=null;n.watch(()=>a.revision.value,()=>{o.open&&(f&&clearTimeout(f),f=setTimeout(()=>void u(),500))}),n.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const h=n.computed(()=>new Map(a.state.logical.entities.map(E=>[E.modelId,E]))),p=n.computed(()=>new Map(a.state.logical.associations.map(E=>[E.modelId,E]))),m=n.computed(()=>new Map((a.state.logical.groups??[]).map(E=>{var K;return[E.modelId,E.packageName||((K=E.name)==null?void 0:K.ko)||E.modelId]})));function b(E){var ye,ue,fe,ge,Ee,Re,Ie;const K=p.value.get(E);if(!K)return"연관";if((ye=K.description)!=null&&ye.trim())return K.description.trim();const re=(ge=(fe=h.value.get((ue=K.end1)==null?void 0:ue.entityRef))==null?void 0:fe.name)==null?void 0:ge.trim(),pe=(Ie=(Re=h.value.get((Ee=K.end2)==null?void 0:Ee.entityRef))==null?void 0:Re.name)==null?void 0:Ie.trim();return re&&pe?`${re}→${pe}`:"연관"}function y(E){var K,re,pe,ye;if(E.kind==="entity")return((re=(K=h.value.get(E.ref))==null?void 0:K.name)==null?void 0:re.trim())||"(이름 없음)";if(E.kind==="attribute"||E.kind==="operation"||E.kind==="index"){const ue=E.entityRef?h.value.get(E.entityRef):void 0,ge=((E.kind==="attribute"?ue==null?void 0:ue.attributes:E.kind==="operation"?ue==null?void 0:ue.operations:ue==null?void 0:ue.indexes)??[]).find(Re=>Re.modelId===E.ref),Ee=(pe=ue==null?void 0:ue.name)==null?void 0:pe.trim();return`${Ee?Ee+".":""}${((ye=ge==null?void 0:ge.name)==null?void 0:ye.trim())||E.ref}`}return E.kind==="association"?b(E.ref):E.kind==="associationEnd"?`${b(E.ref)}(${E.end})`:E.kind==="group"?`그룹 ${m.value.get(E.ref)??E.ref}`:E.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},V={add:"추가",update:"수정",remove:"삭제"},g=n.ref("all"),v=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],ee=n.computed({get:()=>g.value,set:E=>{E&&(g.value=E)}}),x=n.computed(()=>kr(l.value)),O=n.computed(()=>x.value.length?x.value[0].seq:null),P=n.computed(()=>g.value==="all"?x.value:x.value.filter(E=>(E.kind??"edit")===g.value));function H(E){return E===void 0?"—":E===null?"(비움)":typeof E=="object"?JSON.stringify(E):String(E)}function ne(E){const K=y(E.subject);if(E.verb==="add")return`${K} 추가`;if(E.verb==="remove")return`${K} 삭제`;if(E.fields.length===1){const re=E.fields[0];return`${K}.${re.field} ${re.oldValue!==void 0?H(re.oldValue)+"→":""}${H(re.value)}`}return`${K} ${E.fields.length}개 변경`}function ce(E){return E.actions.length===0?"변경 없음":E.actions.length===1?ne(E.actions[0]):`${ne(E.actions[0])} 외 ${E.actions.length-1}건`}const L=n.ref(new Set);function oe(E){const K=new Set(L.value);K.has(E)?K.delete(E):K.add(E),L.value=K}function k(E){if(E==null)return"";const K=new Date(E);return isNaN(K.getTime())?String(E):K.toLocaleString()}function Y(E){const K=E.author,re=E.origin;return K&&re?`${K}(${re})`:K||(re?`(${re})`:"—")}const S=n.ref(null),F=n.ref(!1);function U(E){S.value=E}async function le(E){F.value=!0;try{const K=await a.restoreToSeq(E);K.ok||(s.value=`복원 실패: ${K.reason??"알 수 없음"}`)}finally{F.value=!1,S.value=null}}return(E,K)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",kS,[n.createElementVNode("header",wS,[n.createElementVNode("div",ES,[n.createVNode(Ve,{name:"undo",size:15}),K[4]||(K[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",vS,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:K[0]||(K[0]=re=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,NS),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:K[1]||(K[1]=re=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",$S,[n.createElementVNode("label",xS,[K[5]||(K[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:ee.value,"onUpdate:modelValue":K[2]||(K[2]=re=>ee.value=re),items:v,"value-provider":re=>re.v,"label-provider":re=>re.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",IS,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",SS,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",CS,n.toDisplayString(s.value),1)):P.value.length===0?(n.openBlock(),n.createElementBlock("p",RS,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",VS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.value,re=>(n.openBlock(),n.createElementBlock("li",{key:re.seq,class:n.normalizeClass(["em-history__group",[`is-${re.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:pe=>oe(re.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":L.value.has(re.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${re.kind??"edit"}`])},n.toDisplayString(re.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",TS,n.toDisplayString(ce(re)),1),n.createElementVNode("span",MS,"#"+n.toDisplayString(re.seq),1)],8,AS),n.createElementVNode("div",BS,[n.createElementVNode("span",DS,n.toDisplayString(Y(re)),1),re.ts?(n.openBlock(),n.createElementBlock("span",OS,n.toDisplayString(k(re.ts)),1)):n.createCommentVNode("",!0),re.kind==="restore"&&re.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",LS,"← #"+n.toDisplayString(re.restoredFromSeq),1)):n.createCommentVNode("",!0)]),L.value.has(re.seq)?(n.openBlock(),n.createElementBlock("div",PS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(re.actions,(pe,ye)=>(n.openBlock(),n.createElementBlock("div",{key:ye,class:"em-history__action"},[n.createElementVNode("div",zS,[n.createVNode(Ve,{name:_[pe.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",US,n.toDisplayString(y(pe.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${pe.verb}`])},n.toDisplayString(V[pe.verb]),3)]),pe.fields.length?(n.openBlock(),n.createElementBlock("ul",HS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe.fields,(ue,fe)=>(n.openBlock(),n.createElementBlock("li",{key:fe,class:"em-history__field"},[n.createElementVNode("span",FS,n.toDisplayString(ue.field),1),ue.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",GS,n.toDisplayString(H(ue.oldValue)),1)):n.createCommentVNode("",!0),ue.oldValue!==void 0?(n.openBlock(),n.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",YS,n.toDisplayString(H(ue.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&re.seq!==O.value?(n.openBlock(),n.createElementBlock("div",WS,[S.value===re.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[K[6]||(K[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:F.value,onClick:pe=>le(re.seq)},"복원",8,KS),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:F.value,onClick:K[3]||(K[3]=pe=>S.value=null)},"취소",8,qS)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:pe=>U(re.seq)},[n.createVNode(Ve,{name:"undo",size:12}),K[7]||(K[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,XS))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function ZS(e,t){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=t?i:null}function af(e){const t=n.ref(ZS(e.storageKey,e.min)??e.initial),o=n.ref(!1);function i(a){a.preventDefault();const l=a.clientX,r=t.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?l-d.clientX:d.clientX-l;let f=r+u;f=Math.max(e.min,f),e.max!=null&&(f=Math.min(e.max,f)),t.value=f},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(t.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:t,dragging:o,startResize:i}}const JS={class:"em-modeler"},QS={class:"em-modeler__body"},eC={class:"em-drawer__inner"},tC={class:"em-drawer__head"},nC={class:"em-drawer__actions"},oC=["title"],iC=Ue(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(!0),i=n.ref(!1),{width:a,dragging:l,startResize:r}=af({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=af({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(h,p)=>{var m,b,y;return n.openBlock(),n.createElementBlock("div",JS,[n.createVNode(nf,{controller:e.controller,"history-open":i.value,onExportSvg:p[0]||(p[0]=_=>{var V;return(V=u.value)==null?void 0:V.exportSvg()}),onExportPng:p[1]||(p[1]=_=>{var V;return(V=u.value)==null?void 0:V.exportPng()}),onToggleHistory:p[2]||(p[2]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",QS,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",eC,[n.createElementVNode("header",tC,[p[10]||(p[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",nC,[(m=f.value)!=null&&m.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(b=f.value)!=null&&b.allExpanded?"모두 접기":"모두 펼치기",onClick:p[3]||(p[3]=_=>{var V;return(V=f.value)==null?void 0:V.toggleAll()})},[n.createVNode(Ve,{name:(y=f.value)!=null&&y.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,oC)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:p[4]||(p[4]=_=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(tf,{ref_key:"explorer",ref:f,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(l)}]),title:"너비 조절",onPointerdown:p[5]||(p[5]=(..._)=>n.unref(r)&&n.unref(r)(..._))},null,34),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:p[6]||(p[6]=_=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],512),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(l),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(ef,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(of,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:p[7]||(p[7]=_=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:"Inspector 열기",onClick:p[8]||(p[8]=_=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(jS,{controller:e.controller,open:i.value,onClose:p[9]||(p[9]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(_S,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1bc07cae"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=Dm,Ne.AssociationEdge=nu,Ne.CUSTOM_TYPE_VALUE=Ct,Ne.CommandStack=Ca,Ne.DEFAULT_JAVA_TYPE=Ea,Ne.DiagramCanvas=ef,Ne.DiagramExplorer=tf,Ne.EDITOR=pn,Ne.EditModeToggle=Rx,Ne.EditorToolbar=nf,Ne.EntityModeler=iC,Ne.EntityNode=zd,Ne.GROUP_CODE_ENUM_VALUE=Kn,Ne.GroupNode=Ud,Ne.JAVA_TYPES=va,Ne.NoteNode=Hd,Ne.OpSyncAdapter=ds,Ne.PHYSICAL_NAME_MAX_LENGTH=$a,Ne.PropertyPanel=of,Ne.RevCache=cs,Ne.SELECTABLE_JAVA_TYPES=fr,Ne.SYMBOLIC_OP_KINDS=us,Ne.SYMBOLIC_OP_SCHEMA=ws,Ne.anchoredEdgePoint=ya,Ne.buildAgentBatch=Om,Ne.buildDiagramSvg=Xl,Ne.buildOrthogonalPath=fa,Ne.buildSelfLoopPath=er,Ne.buildStraightPath=pa,Ne.collectSharedColumns=Wo,Ne.commands=im,Ne.computeAutoLayout=tr,Ne.createEditorController=kk,Ne.defaultMermaidDialect=mf,Ne.displayLabel=Fo,Ne.emptyState=Dd,Ne.entityModelToMermaid=ba,Ne.entityModelToText=ar,Ne.estimateEntityHeight=or,Ne.exportDiagramPng=Ju,Ne.exportDiagramSvg=Zu,Ne.fromPersisted=Jm,Ne.indexColumnsByModelId=qn,Ne.javaTypeLabel=wn,Ne.migrateLegacyMoney=Pf,Ne.newId=Oe,Ne.orthogonalMidpoints=ma,Ne.packEntityBoxes=ff,Ne.physicalNameWarning=qo,Ne.projectActionLog=kr,Ne.projectEntityAudit=br,Ne.projectFieldAudit=Ut,Ne.rectExitPoint=ha,Ne.renderDiagramSvg=dr,Ne.resolveDiagram=Jl,Ne.resolveSharedColumn=Ko,Ne.resolveSymbolicOps=xm,Ne.restoreDeepEqual=En,Ne.segmentMidpoints=ga,Ne.sharedColumnScopeEntities=Yo,Ne.sideDir=Yn,Ne.synthesizeRestoreOps=Xf,Ne.toPersisted=fp,Ne.toPersistedV2=mp,Ne.validateModel=yr,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));