@g1cloud/entity-modeler-next 5.0.0-alpha.20 → 5.0.0-alpha.21

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,ae){"use strict";var hC=Object.defineProperty;var yC=(Ne,n,ae)=>n in Ne?hC(Ne,n,{enumerable:!0,configurable:!0,writable:!0,value:ae}):Ne[n]=ae;var We=(Ne,n,ae)=>yC(Ne,typeof n!="symbol"?n+"":n,ae);const mf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function pf(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 tr(e,t,o={}){const i={...mf,...o},a=new Map(e.entities.map(b=>[b.modelId,b])),l=new Map(e.associations.map(b=>[b.modelId,b])),r=new Map(t.entityLayouts.map(b=>[b.entityRef,b])),s=new Map(t.associationLayouts.map(b=>[b.associationRef,b])),c=t.entityLayouts.map(b=>b.entityRef).filter(b=>!a.has(b)),d=t.associationLayouts.map(b=>b.associationRef).filter(b=>!l.has(b)),u=new Map;for(const b of e.groups)for(const v of b.memberEntityRefs)u.set(v,b.modelId);const f=new Map;for(const b of t.groupLayouts)for(const v of b.memberNoteRefs??[])f.set(v,b.groupRef);let h=0;const p=e.entities.map(b=>{const v=u.get(b.modelId),te=r.get(b.modelId);if(te){const P={location:{x:te.geo.location.x,y:te.geo.location.y},size:{width:te.geo.size.width,height:te.geo.size.height}};return{entity:b,geo:P,collapsed:te.collapsed??!1,locked:te.locked??!1,groupRef:v,style:te.style,attributeStyles:te.attributeStyles,operationStyles:te.operationStyles}}const I=pf(h++,i);return{entity:b,geo:I,collapsed:!1,locked:!1,groupRef:v}}),m=new Map(t.groupLayouts.map(b=>[b.groupRef,b])),g=e.groups.map(b=>{const v=m.get(b.modelId),te=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:b,geo:te,style:v==null?void 0:v.style,locked:(v==null?void 0:v.locked)??!1}}),y=e.associations.map(b=>{const v=s.get(b.modelId);return{association:b,waypoints:(v==null?void 0:v.waypoints)??[],sourceColumnRef:v==null?void 0:v.sourceColumnRef,targetColumnRef:v==null?void 0:v.targetColumnRef}}),_=t.notes.map(b=>({note:{...b,geo:{location:{x:b.geo.location.x,y:b.geo.location.y},size:{width:b.geo.size.width,height:b.geo.size.height}}},groupRef:f.get(b.modelId)})),A=[];for(const b of t.notes)for(const v of b.connections??[])a.has(v.targetRef)&&A.push({noteRef:b.modelId,targetRef:v.targetRef,waypoints:v.waypoints.map(te=>({x:te.x,y:te.y}))});return{entities:p,associations:y,groups:g,notes:_,noteConnections:A,prunedEntityRefs:c,prunedAssociationRefs:d}}function Wn(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 nr(e,t,o,i,a,l){const r=Wn(t),s=Wn(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,g=c;for(let y=1;y<u.length;y++){const _=u[y],A=y<=o.length?y-1:o.length,b=Math.abs(_.x-g.x)<kn,v=Math.abs(_.y-g.y)<kn;b&&v||(b?(p(_,A),m=!1):v?(p(_,A),m=!0):m?(p({x:g.x,y:_.y},A),p(_,A),m=!0):(p({x:_.x,y:g.y},A),p(_,A),m=!1),g=_)}return p(i,o.length),f}function ya(e,t,o,i,a,l=20){const r=nr(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 hf=14;function ga(e,t,o,i,a,l=20){return nr(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=hf).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 yf=36;function or(e,t,o=yf){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 ba(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 gf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function _a(e,t){const o=gf(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 ka(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 wa(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 bf={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function ir(e,t,o={}){const i={...bf,...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((g,y)=>{const _=y%m,A=Math.floor(y/m);l.push({id:g,location:{x:h.x+i.pad+_*i.cellWidth,y:h.y+i.pad+i.headerHeight+A*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 ar={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function lr(e,t={}){const o={...ar,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function _f(e,t={}){const o={...ar,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=lr(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 Go(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 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){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],g=m!=null&&m.length?`(${m.length}${m.scale!=null?`,${m.scale}`:""})`:"",y=m?` → ${m.physicalName} ${m.dataType}${g}`:"",_=[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(g=>`${o.get(g.columnRef)??g.columnRef}${g.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}}`:"",g=(s=p.description)!=null&&s.ko?` — ${p.description.ko}`:"";a.push(` method ${p.name}()${m}${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} ${rr(c.end1.multiplicity)} —— ${rr(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
2
- `).trim()}function kf(e){return e==="CLASS"?"class":"er"}function Ea(e,t){return t==="class"?$f(e):Ef(e)}function Kn(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function va(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function cr(e,t){const o=new Set,i=new Map;return e.entities.forEach((a,l)=>{const r=Kn(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 wf(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function dr(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 ur(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 Ef(e){var i,a;const t=cr(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=Kn((d==null?void 0:d.dataType)||c.type,"unknown"),f=Kn((d==null?void 0:d.physicalName)||c.name,"col"),h=[c.identifier?"PK":"",wf(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,g=va([m,p].filter(Boolean).join(" ")),y=[` ${u} ${f}`];h&&y.push(h);let _=y.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=`${ur(l.end1.multiplicity,"left")}--${ur(l.end2.multiplicity,"right")}`,d=va(l.description);o.push(` ${r} ${c} ${s} : "${d}"`)}return o.join(`
3
- `)}function vf(e){return e&&e!=="UNDEFINED"?e:null}function Nf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function $f(e){const t=cr(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),l=[],r=vf(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(` +${Nf(c.type)} ${Kn(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))l.push(` +${Kn(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=xf(i),s=va(i.description),c=` ${a} "${dr(i.end1.multiplicity)}" ${r} "${dr(i.end2.multiplicity)}" ${l}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
- `)}function xf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const If=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function dt(e){return e.replace(If,"").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 fr(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 Sf(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 Cf(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 Rf(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 Na(e){const t=Cf(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="${Rf(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(Sf(r));for(const r of e.texts)l.push(fr(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Vf(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(fr(i));return`<g>${o.join("")}</g>`}function mr(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(Na(r));for(const r of e.edges)l.push(Vf(r));for(const r of e.entities)l.push(Na(r));for(const r of e.notes)l.push(Na(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 Af=["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"],Tf=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"]),Mf=Af.filter(e=>!Tf.has(e)),Bf={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function $a(e){return Bf[e]??e}const Df=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Yo=new Set(["NUMERIC","DECIMAL"]);function pr(e,t=Mf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ct="CustomType",qn="GroupCodeEnum",xa="String",Ia=[{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:qn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Ct,label:"CustomType"}],Of=new Map(Ia.map(e=>[e.value,e.label]));function wn(e){return Of.get(e)??e}const Lf=new Set([qn,"CustomMoneyType"]),hr=Ia.filter(e=>!Lf.has(e.value)).map(e=>e.value===Ct?{...e,label:"CustomType (사용자정의)"}:e);function yr(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=[...hr,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:wn(e)},...i]:i}function Pf(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function gr(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 Sa(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${wn(t.type)}>`:Pf(t)?wn(t.type):e==="CLASS"?t.type===Ct&&t.customType||wn(t.type):$a(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Wo(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 Ko(e,t){return Wo(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function Xn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function qo(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 Ca=63;function Xo(e){if(!e)return null;const t=e.length;return t<=Ca?null:`물리명이 ${Ca}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function br(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 jn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function zf(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 Uf(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 Ra(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 _r(e,t){var l,r,s;const o=[];for(const c of Ra(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(g=>g.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(g=>g.identifier&&g.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 g of m.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) 속성에만 쓸 수 있습니다 — 비식별 속성 "${m.name}"에 설정되어 있습니다`});for(const m of d.filter(g=>g.naturalId&&g.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(g=>g.naturalId&&g.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(g=>g.naturalId&&!g.notNull&&!g.identifier&&!g.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 Ra(d,g=>g.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((g,y)=>({col:g,name:Uf(m,g,y,e,t)})).filter(g=>g.col.sharedColumnRef==null));for(const m of Ra(f,g=>g.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 g=Xo(m.physicalName);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:g}),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)&&Df.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=Xn(Ko(c,e.entities));for(const g of d){if(g.attrType!=="EMBED_PREDEF")continue;const y=t.embeddableCatalog.find(_=>_.type===g.type);y&&g.dbAttrs.forEach((_,A)=>{if(_.sharedColumnRef==null)return;const b=y.fields[A],v=m.get(_.sharedColumnRef);if(!b||!v)return;(v.dataType!==b.dataType||(v.length??null)!==(b.length??null)||(v.scale??null)!==(b.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${br(v)})이 ${b.name??"컬럼"} 정의(${br(b)})와 다릅니다`})})}}for(const m of d){const g=m.dbAttrs[0];if(!(g!=null&&g.multiValue))continue;m.type===qn&&g.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${m.type||"타입 미지정"} / ${g.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const h=(s=c.table)==null?void 0:s.physicalName,p=Xo(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 g=Xo(m.name);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:g}),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){jn(c.end1.multiplicity)&&jn(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"}와 의미가 겹칩니다`}),jn(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&&jn(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에서만 유효합니다`}),!jn(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 zf(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 Ff="CustomMoneyType",Hf="Money";function Gf(e){return!(e.type!==Ff||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Yf(e){const t=e.dbAttrs[0]??{modelId:Oe(),physicalName:"",dataType:""},o={modelId:Oe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Hf,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Wf(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>Gf(r)?(a=!0,t=!0,Yf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function kr(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function wr(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(kr);if(!i.length)continue;const a=o.filter(s=>!kr(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 En(e){return JSON.parse(JSON.stringify(e))}function Er(e,t,o){var P;const i=o.idFactory??Oe,a=o.offset??{x:0,y:0},{logical:l,layout:r}=e,s=new Set(t);if(o.includeRelated){const x=new Set(t);for(const O of l.associations){const H=x.has(O.end1.entityRef),de=x.has(O.end2.entityRef);H!==de&&s.add(H?O.end2.entityRef:O.end1.entityRef)}}const c=l.entities.filter(x=>s.has(x.modelId)),d=new Set(c.map(x=>x.modelId)),u=l.associations.filter(x=>d.has(x.end1.entityRef)&&d.has(x.end2.entityRef)),f=new Set(u.map(x=>x.modelId)),h=new Map,p=x=>{let O=h.get(x);return O||(O=i(),h.set(x,O)),O};for(const x of c){p(x.modelId);for(const O of x.attributes){p(O.modelId);for(const H of O.dbAttrs)p(H.modelId)}for(const O of x.indexes??[])p(O.modelId);for(const O of x.operations??[])p(O.modelId)}for(const x of u)p(x.modelId);const m=x=>h.get(x),g=c.map(x=>{const O=En(x);O.modelId=m(x.modelId),O.attributes=O.attributes.map(H=>Kf(H,m,f,d));for(const H of O.indexes??[])H.modelId=m(H.modelId),H.columns=H.columns.map(de=>({...de,columnRef:m(de.columnRef)})).filter(de=>de.columnRef!==void 0);for(const H of O.operations??[])H.modelId=m(H.modelId);return O});wr(g);const y=u.map(x=>{const O=En(x);return O.modelId=m(x.modelId),O.end1=vr(O.end1,m),O.end2=vr(O.end2,m),O}),_=[];for(const x of l.groups){const O=x.memberEntityRefs.filter(de=>d.has(de));if(O.length===0)continue;const H=En(x);H.modelId=p(x.modelId),H.memberEntityRefs=O.map(de=>m(de)),_.push(H)}const A=new Set(o.existing.entities.map(x=>x.name)),b=new Set(o.existing.entities.map(x=>{var O;return(O=x.table)==null?void 0:O.physicalName}).filter(x=>!!x));for(const x of g)A.has(x.name)&&(x.name=`${x.name}_imported`),(P=x.table)!=null&&P.physicalName&&b.has(x.table.physicalName)&&(x.table.physicalName=`${x.table.physicalName}_imported`);const v=[];for(const x of r.entityLayouts){const O=m(x.entityRef);if(!O)continue;const H=En(x);H.entityRef=O,H.geo={...H.geo,location:Va(H.geo.location,a)},H.attributeStyles&&(H.attributeStyles=Nr(H.attributeStyles,m)),H.operationStyles&&(H.operationStyles=Nr(H.operationStyles,m)),v.push(H)}const te=[];for(const x of r.associationLayouts){const O=m(x.associationRef);if(!O)continue;const H=En(x);H.associationRef=O,H.sourceColumnRef=x.sourceColumnRef?m(x.sourceColumnRef):void 0,H.targetColumnRef=x.targetColumnRef?m(x.targetColumnRef):void 0,H.waypoints=H.waypoints.map(de=>Va(de,a)),te.push(H)}const I=[];for(const x of r.groupLayouts){const O=m(x.groupRef);if(!O)continue;const H=En(x);H.groupRef=O,H.geo={...H.geo,location:Va(H.geo.location,a)},delete H.memberNoteRefs,I.push(H)}return{logical:{entities:g,associations:y,groups:_},layout:{entityLayouts:v,associationLayouts:te,groupLayouts:I},idMap:h}}function Va(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Kf(e,t,o,i){e.modelId=t(e.modelId);for(const a of e.dbAttrs)if(a.modelId=t(a.modelId),a.sharedColumnRef!==void 0){const l=t(a.sharedColumnRef);l?a.sharedColumnRef=l:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:t(e.derivedFrom.associationRef),sourceAttributeRef:t(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:t(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:t(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function vr(e,t){return{...e,entityRef:t(e.entityRef),attributeRef:e.attributeRef?t(e.attributeRef):void 0}}function Nr(e,t){const o={};for(const[i,a]of Object.entries(e)){const l=t(i);l&&(o[l]=a)}return o}function Aa(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function vn(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)=>vn(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(!vn(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)||vn(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 qf(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 Xf=new Set(["attributes","operations","indexes","rev"]),jf=new Set(["end1","end2","rev"]),Zf=new Set(["memberEntityRefs","rev"]),$r=new Set(["modelId"]),Jf=new Set(["modelId","columns"]),Qf=new Set([]);function em(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,$r);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,$r);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(!vn(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,Jf);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function tm(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:Aa(r)});for(const{cur:r,tgt:s}of i.common){const c=Zt(r,s,Xf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),em(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:Aa(r)});for(const{cur:r,tgt:s}of a.common){const c=Zt(r,s,jf);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]??{},Qf);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:Aa(r)});for(const{cur:r,tgt:s}of l.common){const c=Zt(r,s,Zf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=qf(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 jo(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)vn(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 nm(e,t,o){jo(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),jo(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),jo(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),jo(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function om(e,t){const o=[];return tm(e.logical,t.logical,o),nm(e.layout,t.layout,o),o}function im(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 am={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 lm{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({...Zn(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({...Zn(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({...Zn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...Zn(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({...Zn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Zn(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=am[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 Ta(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=im(t),i=new lm(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 g=Ta((l=m.value)==null?void 0:l.attributes,t.attributeRef);g&&kt(i,p,g,"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 g=Ta((s=m.value)==null?void 0:s.operations,t.operationRef);g&&kt(i,p,g,"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 g=Ta((d=m.value)==null?void 0:d.indexes,t.indexRef);g&&kt(i,p,g,"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 g=(f=m.value)==null?void 0:f[t.end];kt(i,p,g,"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 g=(h=m.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(g))for(const y of g)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 rm(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function Nn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function sm(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;Nn(c==null?void 0:c.attributes,o),Nn(c==null?void 0:c.operations,i),Nn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?Nn([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?Nn([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?Nn([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 Zo(e,t){return e.map(o=>({...o,subject:t}))}function xr(e,t){const o=e.filter(s=>s.ops.some(c=>rm(c,t))),{attributes:i,operations:a,indexes:l}=sm(o,t),r=[...Zo(Ut(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...Zo(Ut(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...Zo(Ut(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...Zo(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 Ir(e){return`${e.kind}:${e.ref}:${e.end??""}`}function cm(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 dm(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 um(e){const{entities:t,associations:o,groups:i}=dm(e),a=[];for(const l of t)for(const r of xr(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 Sr(e){const t=um(e),o=cm(e),i=new Map;for(const r of t){const s=Ir(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=Ir(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 Ma{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 Cr(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 He(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 Jo(e,t,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:t,...o})},invert(i){const a=Cr(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const l=Je(i,e.modelId);l>=0&&i.layout.entityLayouts.splice(l,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Rr(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Cr(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=He(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(He(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 Ar(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=He(i,e);o=a.name,a.name=t},invert(i){He(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 $n(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 Tr(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 Jn(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 Mr(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=Jn(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 Br(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 Dr(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 Ba(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 Qo(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=Jn(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 ei(e,t,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:t,...o})},invert(i){const a=i.logical.groups.findIndex(r=>r.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const l=i.layout.groupLayouts.findIndex(r=>r.groupRef===e.modelId);l>=0&&i.layout.groupLayouts.splice(l,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Or(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 Lr(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 Pr(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 ti(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 zr(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 Ur(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 Fr(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=Jn(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 Hr(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){He(o,e).attributes.push(t)},invert(o){const i=He(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=He(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 xn(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=He(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&&He(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 Da(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=He(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&&He(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=He(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 Gr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=He(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=He(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 Yr(e,t,o){const i={},a=l=>{var s;const r=(s=He(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 Wr(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=He(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=He(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 Kr(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=He(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=He(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(He(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 qr(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=Jn(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 ni(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 Xr(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 oi(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 In(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 jr(e,t){return{label:"인덱스 추가",apply(o){const i=He(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=He(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 Zr(e,t,o){const i={},a=l=>{var s;const r=(s=He(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 Jr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=He(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&&He(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}}),Qn=(e,t)=>{var o;return((o=pt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Qr(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=Qn(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[wt(e,l)],invert:[wt(e,r)]}}}}function es(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=Qn(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function ts(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,Qn(a,e))],invert:[wt(e,i??[])]}}}}function ns(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,Qn(o,e))],invert:[wt(e,t??[])]}}}}function os(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=Qn(i,e),l=a.slice();return l.splice(t,1),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function is(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 as(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 eo(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 ls(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 rs(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 ss(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=Jn(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 cs(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 ds(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 Ft=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),ii=(e,t,o)=>{var i;return((i=Rt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function us(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 fs(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 ms(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=ii(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Ft(e,t,r)],invert:[Ft(e,t,s)]}}}}function ps(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=ii(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ft(e,t,l)],invert:[Ft(e,t,r)]}}}}function hs(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=ii(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ft(e,t,l)],invert:[Ft(e,t,r)]}}}}function ys(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:[Ft(e,t,ii(i,e,t))],invert:[Ft(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 fm=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:ni,addAttribute:Vt,addEntity:Jo,addEntityToGroup:Pr,addGroup:ei,addIndex:jr,addNote:is,addNoteConnection:us,addNoteConnectionWaypoint:ps,addNoteToGroup:cs,addOperation:Gr,addWaypoint:os,clearNoteConnectionWaypoints:ys,clearWaypoints:ns,composite:Ge,moveEntity:$n,moveGroup:zr,moveNote:eo,moveNoteConnectionWaypoint:ms,moveWaypoint:Qr,removeAssociation:Xr,removeAttribute:xn,removeEntity:Rr,removeEntityFromGroup:ti,removeGroup:Lr,removeIndex:Jr,removeNote:as,removeNoteConnection:fs,removeNoteConnectionWaypoint:hs,removeNoteFromGroup:ds,removeOperation:Wr,removeWaypoint:es,renameEntity:Ar,reorderAttributes:Da,reorderOperations:Kr,resizeEntity:Tr,resizeGroup:Ur,resizeNote:ls,setAllEntitiesCollapsed:Ba,setAttributeSwatch:Qo,setEntityCollapsed:Br,setEntityLocked:Dr,setEntitySwatch:Mr,setGroupLocked:Hr,setGroupSwatch:Fr,setNoteMemo:rs,setNoteSwatch:ss,setOperationSwatch:qr,translateWaypoints:ts,updateAssociation:oi,updateAssociationEnd:In,updateAttribute:en,updateEntity:Vr,updateGroup:Or,updateIndex:Zr,updateOperation:Yr},Symbol.toStringTag,{value:"Module"}));class gs{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 bs{constructor(t){We(this,"cache",new gs);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 _s=["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"],ks=()=>crypto.randomUUID(),mm=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,pm=e=>e&&e[0].toLowerCase()+e.slice(1),hm=e=>e&&e[0].toUpperCase()+e.slice(1),ym=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function gm(e,t){return pm(e)+hm(t)}function bm(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=gm(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:ym(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const ai=(e,t)=>`${e}::${t}`,li=e=>e??void 0;function _m(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||li(s.length)!==li(l.length)||li(s.scale)!==li(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 km(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 to(e,t,o=ks){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=>bm(e,f)),s=new Map(r.map(f=>[ai(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ai(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=ai(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=ai(f.associationRef,f.sourceAttributeRef),p=d.get(h);if(!p)i.add.push(km(f,u++,o));else{const m=_m(p,f,o);m&&i.update.push({attributeId:p.modelId,patch:m})}}return i}function wm(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 Em(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function vm(e,t,o=ks){const i=new Map,a=Em(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=to(a,d,o);if(mm(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(h=>h.modelId===d);f&&wm(f,u),l.has(d)||r.push(d)}}return i}function ri(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 Nm(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 $m(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 ws(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=Nm(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 xm(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 Im(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 Sm(e,t){const o=Im(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 Cm(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 Rm(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 Am(e,t){const o=Rm(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 Tm(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 Es(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 vs(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 g={ref:m.sharedColumnPhysicalName,by:"physicalName"},y=Cm(Ko(i,a),g);if(!y.ok){s.push(y.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:l,entity:r,handle:g}:{code:"shared-column-target-ambiguous",opIndex:l,entity:r,handle:g,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 Ns(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 $s(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=Sm(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 Mm(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,g;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}}:{}},A={ref:f.spec.name};let b=!1;for(const[I,P]of(f.spec.attributes??[]).entries()){if(P.type==="GroupCodeEnum"&&!P.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:A,handle:{ref:P.name}}),b=!0;continue}const x=l(P.type);if(x){const O=vs(P,x,I,_,e.entities,h,A,s,i);O?_.attributes.push(O):b=!0}else(p=P.embeddableOverrides)!=null&&p.length?(s.push({code:"embeddable-type-unresolved",opIndex:h,entity:A,handle:{ref:P.name}}),b=!0):_.attributes.push(Es(P,I,i))}const v=(f.spec.operations??[]).map((I,P)=>Ns(I,P,i));v.length&&(_.operations=v);const te=[];for(const I of f.spec.indexes??[]){const P=$s(_,I,h,A,s,i);P?te.push(P):b=!0}if(te.length&&(_.indexes=te),b)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 A=l(f.spec.type);let b;if(A)b=vs(f.spec,A,_,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 b=Es(f.spec,_,i);if(!b)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,value:b});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 _=xm(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 A=i(),b={modelId:A,...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,b]},te=to(v,_.value.modelId,i);te.add[0]&&(b.end2.attributeRef=te.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:A,value:b});for(const I of te.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:I});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 A=ws(e,y.value.modelId,_.value.modelId);if(A.length!==1){s.push(A.length===0?{code:"association-not-found",opIndex:h,handle:f.association}:{code:"association-ambiguous",opIndex:h,handle:f.association,matches:A.map(b=>b.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:A[0].modelId});break}case"association.update":{const y=xs(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=xs(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 _=$s(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 _=Am(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)??((g=y.value.operations)==null?void 0:g.length)??0;d.set(y.value.modelId,_+1);const A=Ns(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:y.value.modelId,entityRef:y.value.modelId,operationRef:A.modelId,value:A});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 _=Tm(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 te=lt(e,v);if(!te.ok){s.push(rt(te.reason,h,v,te.matches,u)),_=!0;continue}y.push(te.value.modelId)}if(_)break;const A=i(),b={modelId:A,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:A,value:b});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 xs(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=ws(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 Is={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Bm={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Dm={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},si={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Om={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:{...si,description:"속성 설명(다국어)."},columnLogicalName:{...si,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},Ss={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Lm={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Ss,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Ss,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},Pm={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Is,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},zm={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...si,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Um={type:"object",properties:{name:{...si,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},Fm={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function nt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Hm={"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"]})},Cs={anyOf:_s.map(e=>Hm[e])},Gm={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Is,assocHandle:Bm,entitySpec:Dm,attrSpec:Om,assocSpec:Lm,indexSpec:Pm,operationSpec:zm,groupSpec:Um,patch:Fm,symbolicOp:Cs}};function Ym(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 Rs={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 Wm=/^[-=_*~\s]{3,}$/;function Km(e){return e.attrType&&e.attrType!=="NORMAL"||!Wm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function qm(e){return e.type===Ct&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Xm(e,t){if(e.attrType==="DIVIDER"||Km(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=qm(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 jm(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 Zm(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 Jm(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(Xm),operations:(t=e.operations)==null?void 0:t.map(jm),indexes:(o=e.indexes)==null?void 0:o.map(Zm),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Qm(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??{...Rs},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 As(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 Oa(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:As(e)}}function ep(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Oa(e.end1),end2:Oa(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 Ts(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Ms(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Bs(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 Ds(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 tp(e,t,o){var y,_;const i=Ts(e.end1.attribute),a=Ts(e.end2.attribute);if(i===a)return ep(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((A,b)=>Math.max(A,b.order),-1)+1:s.order??0,h={...Ds(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const p=(A,b)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:b?d:h.modelId,legacyNavRaw:b?void 0:A.attribute,jpa:As(A)}),m={modelId:e.modelId,description:e.description,end1:p(e.end1,i),end2:p(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:m.end1.attributeRef,targetColumnRef:m.end2.attributeRef,style:e.style};return{assoc:m,layout:g}}function np(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 op(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((g,y)=>Math.max(g,y.order),-1)+1:r.order??0,d={...Ds(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(g=>np(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...Oa(g),legacyEmbedRaw:g.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 ip(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 Os(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=ip(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 Ls(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 ap(e){return(e.schemaVersion??1)>=2&&"logical"in e?lp(e):rp(e)}function lp(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;Ls(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 rp(e){var _,A;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(b,v)=>{o.push(Jm(b));const te=Qm(b);te.geo={location:{x:te.geo.location.x+v.x,y:te.geo.location.y+v.y},size:te.geo.size},i.push(te);for(const I of b.ownedAssociations??[])c.push(I)},u={x:0,y:0};for(const b of e.entities??[])d(b,u);const f=[];for(const b of e.groups??[]){const v=b.entities??[];r.push({modelId:b.modelId,name:b.name,description:b.description,packageName:b.packageName,excludeDDLGeneration:b.excludeDDLGeneration??!1,memberEntityRefs:v.map(I=>I.modelId)});const te=((_=b.geo)==null?void 0:_.location)??u;if(b.geo){const I=(b.notes??[]).map(P=>P.modelId);s.push({groupRef:b.modelId,geo:b.geo,style:b.style,locked:b.locked,memberNoteRefs:I.length?I:void 0})}for(const I of v)d(I,te);for(const I of b.notes??[])f.push(Os(I,te))}const h=new Map(o.map(b=>[b.modelId,b])),p=new Map,m=new Map;for(const b of o)for(const v of b.attributes)for(const te of v.dbAttrs)p.set(te.modelId,v.modelId),m.set(te.modelId,te);for(const b of c)for(const v of[b.end1,b.end2]){const te=v.attribute;if(te&&(((A=te.dbAttrs)==null?void 0:A.length)??0)>0)for(const I of te.dbAttrs)I.modelId&&p.set(I.modelId,te.modelId)}for(const b of c){const v=Ms(b.end1.attribute),te=Ms(b.end2.attribute),I=Bs(b.end1)||Bs(b.end2),{assoc:P,layout:x}=v!==te||I?op(b,h,m):tp(b,h,p);a.push(P),l.push(x)}Ls(o,a,l),wr(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(b=>Os(b)),...f]}},y={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:y}}function Ps(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 sp(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(Ps),style:t}}function cp(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 dp(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 Ht(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 up(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{...Ps(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function fp(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 mp(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 pp(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function hp(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:pp(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 yp(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)=>hp(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:Ht(e.end1,c?s:u),end2:Ht(e.end2,c?u:s)}}function gp(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:Ht(e.end1,e.end1.legacyEmbedRaw),end2:Ht(e.end2,e.end2.legacyEmbedRaw)};const a=yp(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?up(u,f):void 0,p=s.legacyNavRaw;return{...i,end1:Ht(e.end1,l?p:h),end2:Ht(e.end2,r?p:h)}}return{...i,end1:Ht(e.end1),end2:Ht(e.end2)}}function zs(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)??{...Rs},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 sp(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 cp(h,(p=l==null?void 0:l.operationStyles)==null?void 0:p[h.modelId])}),ownedAssociations:r.map(h=>gp(h,t,s(h.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(dp),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 bp(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=>Us(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>zs(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 Us(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 _p(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=fp(e),l=mp(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=>zs(s,e,a,l)),groups:e.logical.groups.map(s=>bp(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>Us(s))}}function kp(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 no(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function At(e){return typeof e=="function"?e():n.unref(e)}const wp=typeof window<"u"&&typeof document<"u",Ep=e=>typeof e<"u",vp=Object.prototype.toString,Np=e=>vp.call(e)==="[object Object]",$p=()=>{};function xp(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 Fs=e=>e();function Ip(e=Fs){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 Hs(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function Sp(e,t,o={}){const{eventFilter:i=Fs,...a}=o;return n.watch(e,xp(i,t),a)}function Sn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=Ip(i);return{stop:Sp(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function Cp(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 La(e,t=!1){function o(f,{flush:h="sync",deep:p=!1,timeout:m,throwOnTimeout:g}={}){let y=null;const A=[new Promise(b=>{y=n.watch(e,v=>{f(v)!==t&&(y==null||y(),b(v))},{flush:h,deep:p,immediate:!0})})];return m!=null&&A.push(Hs(m,g).then(()=>At(e)).finally(()=>y==null?void 0:y())),Promise.race(A)}function i(f,h){if(!n.isRef(f))return o(v=>v===f,h);const{flush:p="sync",deep:m=!1,timeout:g,throwOnTimeout:y}=h??{};let _=null;const b=[new Promise(v=>{_=n.watch([e,f],([te,I])=>{t!==(te===I)&&(_==null||_(),v(te))},{flush:p,deep:m,immediate:!0})})];return g!=null&&b.push(Hs(g,y).then(()=>At(e)).finally(()=>(_==null||_(),At(e)))),Promise.race(b)}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 La(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return La(e,!t)}}}function Pa(e){return La(e)}function Rp(e){var t;const o=At(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Gs=wp?window:void 0;function Ys(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Gs):[t,o,i,a]=e,!t)return $p;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(()=>[Rp(t),At(a)],([u,f])=>{if(r(),!u)return;const h=Np(f)?{...f}:f;l.push(...o.flatMap(p=>i.map(m=>s(u,p,m,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return no(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 Ws(...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=Gs,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=Vp(t);return Ys(a,l,u=>{u.repeat&&At(s)||c(u)&&o(u)},r)}function Ap(e){return JSON.parse(JSON.stringify(e))}function za(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 g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const y=b=>s?typeof s=="function"?s(b):Ap(b):b,_=()=>Ep(e[t])?y(e[t]):f,A=b=>{h?h(b)&&m(g,b):m(g,b)};if(c){const b=_(),v=n.ref(b);let te=!1;return n.watch(()=>e[t],I=>{te||(te=!0,v.value=y(I),n.nextTick(()=>te=!1))}),n.watch(v,I=>{!te&&(I!==e[t]||u)&&A(I)},{deep:u}),v}else return n.computed({get(){return _()},set(b){A(b)}})}var Tp={value:()=>{}};function ci(){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 di(o)}function di(e){this._=e}function Mp(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}})}di.prototype=ci.prototype={constructor:di,on:function(e,t){var o=this._,i=Mp(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Bp(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]=Ks(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Ks(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 di(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 Bp(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Ks(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Tp,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Ua="http://www.w3.org/1999/xhtml";const qs={svg:"http://www.w3.org/2000/svg",xhtml:Ua,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ui(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),qs.hasOwnProperty(t)?{space:qs[t],local:e}:e}function Dp(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Ua&&t.documentElement.namespaceURI===Ua?t.createElement(e):t.createElementNS(o,e)}}function Op(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Xs(e){var t=ui(e);return(t.local?Op:Dp)(t)}function Lp(){}function Fa(e){return e==null?Lp:function(){return this.querySelector(e)}}function Pp(e){typeof e!="function"&&(e=Fa(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 zp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Up(){return[]}function js(e){return e==null?Up:function(){return this.querySelectorAll(e)}}function Fp(e){return function(){return zp(e.apply(this,arguments))}}function Hp(e){typeof e=="function"?e=Fp(e):e=js(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 Zs(e){return function(){return this.matches(e)}}function Js(e){return function(t){return t.matches(e)}}var Gp=Array.prototype.find;function Yp(e){return function(){return Gp.call(this.children,e)}}function Wp(){return this.firstElementChild}function Kp(e){return this.select(e==null?Wp:Yp(typeof e=="function"?e:Js(e)))}var qp=Array.prototype.filter;function Xp(){return Array.from(this.children)}function jp(e){return function(){return qp.call(this.children,e)}}function Zp(e){return this.selectAll(e==null?Xp:jp(typeof e=="function"?e:Js(e)))}function Jp(e){typeof e!="function"&&(e=Zs(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 Qs(e){return new Array(e.length)}function Qp(){return new ut(this._enter||this._groups.map(Qs),this._parents)}function fi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}fi.prototype={constructor:fi,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 eh(e){return function(){return e}}function th(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 fi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function nh(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 fi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function oh(e){return e.__data__}function ih(e,t){if(!arguments.length)return Array.from(this,oh);var o=t?nh:th,i=this._parents,a=this._groups;typeof e!="function"&&(e=eh(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=ah(e.call(u,u&&u.__data__,d,i)),m=p.length,g=s[d]=new Array(m),y=r[d]=new Array(m),_=c[d]=new Array(h);o(u,f,g,y,_,p,t);for(var A=0,b=0,v,te;A<m;++A)if(v=g[A]){for(A>=b&&(b=A+1);!(te=y[b])&&++b<m;);v._next=te||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function ah(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lh(){return new ut(this._exit||this._groups.map(Qs),this._parents)}function rh(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 sh(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 ch(){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 dh(e){e||(e=uh);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 uh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mh(){return Array.from(this)}function ph(){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 hh(){let e=0;for(const t of this)++e;return e}function yh(){return!this.node()}function gh(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 bh(e){return function(){this.removeAttribute(e)}}function _h(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kh(e,t){return function(){this.setAttribute(e,t)}}function wh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Eh(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function vh(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 Nh(e,t){var o=ui(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?_h:bh:typeof t=="function"?o.local?vh:Eh:o.local?wh:kh)(o,t))}function ec(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function $h(e){return function(){this.style.removeProperty(e)}}function xh(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Ih(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Sh(e,t,o){return arguments.length>1?this.each((t==null?$h:typeof t=="function"?Ih:xh)(e,t,o??"")):Cn(this.node(),e)}function Cn(e,t){return e.style.getPropertyValue(t)||ec(e).getComputedStyle(e,null).getPropertyValue(t)}function Ch(e){return function(){delete this[e]}}function Rh(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 Ah(e,t){return arguments.length>1?this.each((t==null?Ch:typeof t=="function"?Vh:Rh)(e,t)):this.node()[e]}function tc(e){return e.trim().split(/^|\s+/)}function Ha(e){return e.classList||new nc(e)}function nc(e){this._node=e,this._names=tc(e.getAttribute("class")||"")}nc.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 oc(e,t){for(var o=Ha(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function ic(e,t){for(var o=Ha(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Th(e){return function(){oc(this,e)}}function Mh(e){return function(){ic(this,e)}}function Bh(e,t){return function(){(t.apply(this,arguments)?oc:ic)(this,e)}}function Dh(e,t){var o=tc(e+"");if(arguments.length<2){for(var i=Ha(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Bh:t?Th:Mh)(o,t))}function Oh(){this.textContent=""}function Lh(e){return function(){this.textContent=e}}function Ph(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zh(e){return arguments.length?this.each(e==null?Oh:(typeof e=="function"?Ph:Lh)(e)):this.node().textContent}function Uh(){this.innerHTML=""}function Fh(e){return function(){this.innerHTML=e}}function Hh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Gh(e){return arguments.length?this.each(e==null?Uh:(typeof e=="function"?Hh:Fh)(e)):this.node().innerHTML}function Yh(){this.nextSibling&&this.parentNode.appendChild(this)}function Wh(){return this.each(Yh)}function Kh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qh(){return this.each(Kh)}function Xh(e){var t=typeof e=="function"?e:Xs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function jh(){return null}function Zh(e,t){var o=typeof e=="function"?e:Xs(e),i=t==null?jh:typeof t=="function"?t:Fa(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Jh(){var e=this.parentNode;e&&e.removeChild(this)}function Qh(){return this.each(Jh)}function ey(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ty(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ny(e){return this.select(e?ty:ey)}function oy(e){return arguments.length?this.property("__data__",e):this.node().__data__}function iy(e){return function(t){e.call(this,t,this.__data__)}}function ay(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 ly(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 ry(e,t,o){return function(){var i=this.__on,a,l=iy(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 sy(e,t,o){var i=ay(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?ry:ly,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function ac(e,t,o){var i=ec(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 cy(e,t){return function(){return ac(this,e,t)}}function dy(e,t){return function(){return ac(this,e,t.apply(this,arguments))}}function uy(e,t){return this.each((typeof t=="function"?dy:cy)(e,t))}function*fy(){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 lc=[null];function ut(e,t){this._groups=e,this._parents=t}function oo(){return new ut([[document.documentElement]],lc)}function my(){return this}ut.prototype=oo.prototype={constructor:ut,select:Pp,selectAll:Hp,selectChild:Kp,selectChildren:Zp,filter:Jp,data:ih,enter:Qp,exit:lh,join:rh,merge:sh,selection:my,order:ch,sort:dh,call:fh,nodes:mh,node:ph,size:hh,empty:yh,each:gh,attr:Nh,style:Sh,property:Ah,classed:Dh,text:zh,html:Gh,raise:Wh,lower:qh,append:Xh,insert:Zh,remove:Qh,clone:ny,datum:oy,on:sy,dispatch:uy,[Symbol.iterator]:fy};function ht(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],lc)}function py(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Et(e,t){if(e=py(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 hy={passive:!1},io={capture:!0,passive:!1};function Ga(e){e.stopImmediatePropagation()}function Rn(e){e.preventDefault(),e.stopImmediatePropagation()}function rc(e){var t=e.document.documentElement,o=ht(e).on("dragstart.drag",Rn,io);"onselectstart"in t?o.on("selectstart.drag",Rn,io):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function sc(e,t){var o=e.document.documentElement,i=ht(e).on("dragstart.drag",null);t&&(i.on("click.drag",Rn,io),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 mi=e=>()=>e;function Ya(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}})}Ya.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yy(e){return!e.ctrlKey&&!e.button}function gy(){return this.parentNode}function by(e,t){return t??{x:e.x,y:e.y}}function _y(){return navigator.maxTouchPoints||"ontouchstart"in this}function ky(){var e=yy,t=gy,o=by,i=_y,a={},l=ci("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",_,hy).on("touchend.drag touchcancel.drag",A).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(v,te){if(!(u||!e.call(this,v,te))){var I=b(this,t.call(this,v,te),v,te,"mouse");I&&(ht(v.view).on("mousemove.drag",m,io).on("mouseup.drag",g,io),rc(v.view),Ga(v),d=!1,s=v.clientX,c=v.clientY,I("start",v))}}function m(v){if(Rn(v),!d){var te=v.clientX-s,I=v.clientY-c;d=te*te+I*I>f}a.mouse("drag",v)}function g(v){ht(v.view).on("mousemove.drag mouseup.drag",null),sc(v.view,d),Rn(v),a.mouse("end",v)}function y(v,te){if(e.call(this,v,te)){var I=v.changedTouches,P=t.call(this,v,te),x=I.length,O,H;for(O=0;O<x;++O)(H=b(this,P,v,te,I[O].identifier,I[O]))&&(Ga(v),H("start",v,I[O]))}}function _(v){var te=v.changedTouches,I=te.length,P,x;for(P=0;P<I;++P)(x=a[te[P].identifier])&&(Rn(v),x("drag",v,te[P]))}function A(v){var te=v.changedTouches,I=te.length,P,x;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),P=0;P<I;++P)(x=a[te[P].identifier])&&(Ga(v),x("end",v,te[P]))}function b(v,te,I,P,x,O){var H=l.copy(),de=Et(O||I,te),z,oe,k;if((k=o.call(v,new Ya("beforestart",{sourceEvent:I,target:h,identifier:x,active:r,x:de[0],y:de[1],dx:0,dy:0,dispatch:H}),P))!=null)return z=k.x-de[0]||0,oe=k.y-de[1]||0,function W(R,G,F){var le=de,$;switch(R){case"start":a[x]=W,$=r++;break;case"end":delete a[x],--r;case"drag":de=Et(F||G,te),$=r;break}H.call(R,v,new Ya(R,{sourceEvent:G,subject:k,target:h,identifier:x,active:$,x:de[0]+z,y:de[1]+oe,dx:de[0]-le[0],dy:de[1]-le[1],dispatch:H}),P)}}return h.filter=function(v){return arguments.length?(e=typeof v=="function"?v:mi(!!v),h):e},h.container=function(v){return arguments.length?(t=typeof v=="function"?v:mi(v),h):t},h.subject=function(v){return arguments.length?(o=typeof v=="function"?v:mi(v),h):o},h.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:mi(!!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 Wa(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function cc(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function ao(){}var lo=.7,pi=1/lo,Vn="\\s*([+-]?\\d+)\\s*",ro="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wy=/^#([0-9a-f]{3,8})$/,Ey=new RegExp(`^rgb\\(${Vn},${Vn},${Vn}\\)$`),vy=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),Ny=new RegExp(`^rgba\\(${Vn},${Vn},${Vn},${ro}\\)$`),$y=new RegExp(`^rgba\\(${vt},${vt},${vt},${ro}\\)$`),xy=new RegExp(`^hsl\\(${ro},${vt},${vt}\\)$`),Iy=new RegExp(`^hsla\\(${ro},${vt},${vt},${ro}\\)$`),dc={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};Wa(ao,tn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:uc,formatHex:uc,formatHex8:Sy,formatHsl:Cy,formatRgb:fc,toString:fc});function uc(){return this.rgb().formatHex()}function Sy(){return this.rgb().formatHex8()}function Cy(){return gc(this).formatHsl()}function fc(){return this.rgb().formatRgb()}function tn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=wy.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?mc(t):o===3?new st(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?hi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?hi(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=Ey.exec(e))?new st(t[1],t[2],t[3],1):(t=vy.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ny.exec(e))?hi(t[1],t[2],t[3],t[4]):(t=$y.exec(e))?hi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xy.exec(e))?yc(t[1],t[2]/100,t[3]/100,1):(t=Iy.exec(e))?yc(t[1],t[2]/100,t[3]/100,t[4]):dc.hasOwnProperty(e)?mc(dc[e]):e==="transparent"?new st(NaN,NaN,NaN,0):null}function mc(e){return new st(e>>16&255,e>>8&255,e&255,1)}function hi(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function Ry(e){return e instanceof ao||(e=tn(e)),e?(e=e.rgb(),new st(e.r,e.g,e.b,e.opacity)):new st}function Ka(e,t,o,i){return arguments.length===1?Ry(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}Wa(st,Ka,cc(ao,{brighter(e){return e=e==null?pi:Math.pow(pi,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?lo:Math.pow(lo,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),yi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:pc,formatHex:pc,formatHex8:Vy,formatRgb:hc,toString:hc}));function pc(){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 hc(){const e=yi(this.opacity);return`${e===1?"rgb(":"rgba("}${nn(this.r)}, ${nn(this.g)}, ${nn(this.b)}${e===1?")":`, ${e})`}`}function yi(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 yc(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 gc(e){if(e instanceof yt)return new yt(e.h,e.s,e.l,e.opacity);if(e instanceof ao||(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 Ay(e,t,o,i){return arguments.length===1?gc(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}Wa(yt,Ay,cc(ao,{brighter(e){return e=e==null?pi:Math.pow(pi,e),new yt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?lo:Math.pow(lo,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(qa(e>=240?e-240:e+120,a,i),qa(e,a,i),qa(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new yt(bc(this.h),gi(this.s),gi(this.l),yi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=yi(this.opacity);return`${e===1?"hsl(":"hsla("}${bc(this.h)}, ${gi(this.s)*100}%, ${gi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function bc(e){return e=(e||0)%360,e<0?e+360:e}function gi(e){return Math.max(0,Math.min(1,e||0))}function qa(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 Xa=e=>()=>e;function Ty(e,t){return function(o){return e+o*t}}function My(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 By(e){return(e=+e)==1?_c:function(t,o){return o-t?My(t,o,e):Xa(isNaN(t)?o:t)}}function _c(e,t){var o=t-e;return o?Ty(e,o):Xa(isNaN(e)?t:e)}const bi=(function e(t){var o=By(t);function i(a,l){var r=o((a=Ka(a)).r,(l=Ka(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=_c(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 Dy(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 Oy(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ly(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]=so(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 Py(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 zy(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]=so(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var ja=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Za=new RegExp(ja.source,"g");function Uy(e){return function(){return e}}function Fy(e){return function(t){return e(t)+""}}function kc(e,t){var o=ja.lastIndex=Za.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=ja.exec(e))&&(a=Za.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=Za.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Fy(c[0].x):Uy(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 so(e,t){var o=typeof t,i;return t==null||o==="boolean"?Xa(t):(o==="number"?Nt:o==="string"?(i=tn(t))?(t=i,bi):kc:t instanceof tn?bi:t instanceof Date?Py:Oy(t)?Dy:Array.isArray(t)?Ly:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?zy:Nt)(e,t)}var wc=180/Math.PI,Ja={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ec(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)*wc,skewX:Math.atan(c)*wc,scaleX:r,scaleY:s}}var _i;function Hy(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ja:Ec(t.a,t.b,t.c,t.d,t.e,t.f)}function Gy(e){return e==null||(_i||(_i=document.createElementNS("http://www.w3.org/2000/svg","g")),_i.setAttribute("transform",e),!(e=_i.transform.baseVal.consolidate()))?Ja:(e=e.matrix,Ec(e.a,e.b,e.c,e.d,e.e,e.f))}function vc(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 g=p.push("translate(",null,t,null,o);m.push({i:g-4,x:Nt(d,f)},{i:g-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 g=p.push(a(p)+"scale(",null,",",null,")");m.push({i:g-4,x:Nt(d,f)},{i:g-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,g=h.length,y;++m<g;)f[(y=h[m]).i]=y.x(p);return f.join("")}}}var Yy=vc(Hy,"px, ","px)","deg)"),Wy=vc(Gy,", ",")",")"),Ky=1e-12;function Nc(e){return((e=Math.exp(e))+1/e)/2}function qy(e){return((e=Math.exp(e))-1/e)/2}function Xy(e){return((e=Math.exp(2*e))-1)/(e+1)}const ki=(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,g=p*p+m*m,y,_;if(g<Ky)_=Math.log(h/d)/t,y=function(P){return[s+P*p,c+P*m,d*Math.exp(t*P*_)]};else{var A=Math.sqrt(g),b=(h*h-d*d+i*g)/(2*d*o*A),v=(h*h-d*d-i*g)/(2*h*o*A),te=Math.log(Math.sqrt(b*b+1)-b),I=Math.log(Math.sqrt(v*v+1)-v);_=(I-te)/t,y=function(P){var x=P*_,O=Nc(te),H=d/(o*A)*(O*Xy(t*x+te)-qy(te));return[s+H*p,c+H*m,d*O/Nc(t*x+te)]}}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 An=0,co=0,uo=0,$c=1e3,wi,fo,Ei=0,an=0,vi=0,mo=typeof performance=="object"&&performance.now?performance:Date,xc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Qa(){return an||(xc(jy),an=mo.now()+vi)}function jy(){an=0}function Ni(){this._call=this._time=this._next=null}Ni.prototype=Ic.prototype={constructor:Ni,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Qa():+o)+(t==null?0:+t),!this._next&&fo!==this&&(fo?fo._next=this:wi=this,fo=this),this._call=e,this._time=o,el()},stop:function(){this._call&&(this._call=null,this._time=1/0,el())}};function Ic(e,t,o){var i=new Ni;return i.restart(e,t,o),i}function Zy(){Qa(),++An;for(var e=wi,t;e;)(t=an-e._time)>=0&&e._call.call(void 0,t),e=e._next;--An}function Sc(){an=(Ei=mo.now())+vi,An=co=0;try{Zy()}finally{An=0,Qy(),an=0}}function Jy(){var e=mo.now(),t=e-Ei;t>$c&&(vi-=t,Ei=e)}function Qy(){for(var e,t=wi,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:wi=o);fo=e,el(i)}function el(e){if(!An){co&&(co=clearTimeout(co));var t=e-an;t>24?(e<1/0&&(co=setTimeout(Sc,e-mo.now()-vi)),uo&&(uo=clearInterval(uo))):(uo||(Ei=mo.now(),uo=setInterval(Jy,$c)),An=1,xc(Sc))}}function Cc(e,t,o){var i=new Ni;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var eg=ci("start","end","cancel","interrupt"),tg=[],Rc=0,Vc=1,tl=2,$i=3,Ac=4,nl=5,xi=6;function Ii(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;ng(e,o,{name:t,index:i,group:a,on:eg,tween:tg,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Rc})}function ol(e,t){var o=gt(e,t);if(o.state>Rc)throw new Error("too late; already scheduled");return o}function $t(e,t){var o=gt(e,t);if(o.state>$i)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 ng(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Ic(l,0,o.time);function l(d){o.state=Vc,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!==Vc)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===$i)return Cc(r);p.state===Ac?(p.state=xi,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=xi,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Cc(function(){o.state===$i&&(o.state=Ac,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=tl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===tl){for(o.state=$i,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=nl,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===nl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=xi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Si(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>tl&&i.state<nl,i.state=xi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function og(e){return this.each(function(){Si(this,e)})}function ig(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 ag(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 lg(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?ig:ag)(o,e,t))}function il(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 Tc(e,t){var o;return(typeof t=="number"?Nt:t instanceof tn?bi:(o=tn(t))?(t=o,bi):kc)(e,t)}function rg(e){return function(){this.removeAttribute(e)}}function sg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cg(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 dg(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 ug(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 fg(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 mg(e,t){var o=ui(e),i=o==="transform"?Wy:Tc;return this.attrTween(e,typeof t=="function"?(o.local?fg:ug)(o,i,il(this,"attr."+e,t)):t==null?(o.local?sg:rg)(o):(o.local?dg:cg)(o,i,t))}function pg(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function hg(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function yg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&hg(e,l)),o}return a._value=t,a}function gg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&pg(e,l)),o}return a._value=t,a}function bg(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=ui(e);return this.tween(o,(i.local?yg:gg)(i,t))}function _g(e,t){return function(){ol(this,e).delay=+t.apply(this,arguments)}}function kg(e,t){return t=+t,function(){ol(this,e).delay=t}}function wg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_g:kg)(t,e)):gt(this.node(),t).delay}function Eg(e,t){return function(){$t(this,e).duration=+t.apply(this,arguments)}}function vg(e,t){return t=+t,function(){$t(this,e).duration=t}}function Ng(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Eg:vg)(t,e)):gt(this.node(),t).duration}function $g(e,t){if(typeof t!="function")throw new Error;return function(){$t(this,e).ease=t}}function xg(e){var t=this._id;return arguments.length?this.each($g(t,e)):gt(this.node(),t).ease}function Ig(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;$t(this,e).ease=o}}function Sg(e){if(typeof e!="function")throw new Error;return this.each(Ig(this._id,e))}function Cg(e){typeof e!="function"&&(e=Zs(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 Rg(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 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 Ag(e,t,o){var i,a,l=Vg(t)?ol:$t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Tg(e,t){var o=this._id;return arguments.length<2?gt(this.node(),o).on.on(e):this.each(Ag(o,e,t))}function Mg(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Bg(){return this.on("end.remove",Mg(this._id))}function Dg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Fa(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,Ii(d[h],t,o,h,d,gt(u,o)));return new Tt(l,this._parents,t,o)}function Og(e){var t=this._name,o=this._id;typeof e!="function"&&(e=js(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),g=0,y=h.length;g<y;++g)(p=h[g])&&Ii(p,t,o,g,h,m);l.push(h),r.push(u)}return new Tt(l,r,t,o)}var Lg=oo.prototype.constructor;function Pg(){return new Lg(this._groups,this._parents)}function zg(e,t){var o,i,a;return function(){var l=Cn(this,e),r=(this.style.removeProperty(e),Cn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Mc(e){return function(){this.style.removeProperty(e)}}function Ug(e,t,o){var i,a=o+"",l;return function(){var r=Cn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Fg(e,t,o){var i,a,l;return function(){var r=Cn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Cn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Hg(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=Mc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Gg(e,t,o){var i=(e+="")=="transform"?Yy:Tc;return t==null?this.styleTween(e,zg(e,i)).on("end.style."+e,Mc(e)):typeof t=="function"?this.styleTween(e,Fg(e,i,il(this,"style."+e,t))).each(Hg(this._id,e)):this.styleTween(e,Ug(e,i,t),o).on("end.style."+e,null)}function Yg(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Wg(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Yg(e,r,o)),i}return l._value=t,l}function Kg(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,Wg(e,t,o??""))}function qg(e){return function(){this.textContent=e}}function Xg(e){return function(){var t=e(this);this.textContent=t??""}}function jg(e){return this.tween("text",typeof e=="function"?Xg(il(this,"text",e)):qg(e==null?"":e+""))}function Zg(e){return function(t){this.textContent=e.call(this,t)}}function Jg(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Zg(a)),t}return i._value=e,i}function Qg(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,Jg(e))}function eb(){for(var e=this._name,t=this._id,o=Bc(),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);Ii(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 tb(){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 nb=0;function Tt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Bc(){return++nb}var Mt=oo.prototype;Tt.prototype={constructor:Tt,select:Dg,selectAll:Og,selectChild:Mt.selectChild,selectChildren:Mt.selectChildren,filter:Cg,merge:Rg,selection:Pg,transition:eb,call:Mt.call,nodes:Mt.nodes,node:Mt.node,size:Mt.size,empty:Mt.empty,each:Mt.each,on:Tg,attr:mg,attrTween:bg,style:Gg,styleTween:Kg,text:jg,textTween:Qg,remove:Bg,tween:lg,delay:wg,duration:Ng,ease:xg,easeVarying:Sg,end:tb,[Symbol.iterator]:Mt[Symbol.iterator]};function ob(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ib={time:null,delay:0,duration:250,ease:ob};function ab(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 lb(e){var t,o;e instanceof Tt?(t=e._id,e=e._name):(t=Bc(),(o=ib).time=Qa(),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])&&Ii(c,e,t,d,r,o||ab(c,t));return new Tt(i,this._parents,e,t)}oo.prototype.interrupt=og,oo.prototype.transition=lb;const Ci=e=>()=>e;function rb(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 Tn=new Bt(1,0,0);Bt.prototype;function al(e){e.stopImmediatePropagation()}function po(e){e.preventDefault(),e.stopImmediatePropagation()}function sb(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function cb(){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 Dc(){return this.__zoom||Tn}function db(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ub(){return navigator.maxTouchPoints||"ontouchstart"in this}function fb(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 mb(){var e=sb,t=cb,o=fb,i=db,a=ub,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ki,d=ci("start","zoom","end"),u,f,h,p=500,m=150,g=0,y=10;function _(k){k.property("__zoom",Dc).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",H).filter(a).on("touchstart.zoom",de).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,W,R,G){var F=k.selection?k.selection():k;F.property("__zoom",Dc),k!==F?te(k,W,R,G):F.interrupt().each(function(){I(this,arguments).event(G).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},_.scaleBy=function(k,W,R,G){_.scaleTo(k,function(){var F=this.__zoom.k,le=typeof W=="function"?W.apply(this,arguments):W;return F*le},R,G)},_.scaleTo=function(k,W,R,G){_.transform(k,function(){var F=t.apply(this,arguments),le=this.__zoom,$=R==null?v(F):typeof R=="function"?R.apply(this,arguments):R,X=le.invert($),re=typeof W=="function"?W.apply(this,arguments):W;return o(b(A(le,re),$,X),F,r)},R,G)},_.translateBy=function(k,W,R,G){_.transform(k,function(){return o(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof R=="function"?R.apply(this,arguments):R),t.apply(this,arguments),r)},null,G)},_.translateTo=function(k,W,R,G,F){_.transform(k,function(){var le=t.apply(this,arguments),$=this.__zoom,X=G==null?v(le):typeof G=="function"?G.apply(this,arguments):G;return o(Tn.translate(X[0],X[1]).scale($.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof R=="function"?-R.apply(this,arguments):-R),le,r)},G,F)};function A(k,W){return W=Math.max(l[0],Math.min(l[1],W)),W===k.k?k:new Bt(W,k.x,k.y)}function b(k,W,R){var G=W[0]-R[0]*k.k,F=W[1]-R[1]*k.k;return G===k.x&&F===k.y?k:new Bt(k.k,G,F)}function v(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function te(k,W,R,G){k.on("start.zoom",function(){I(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(G).end()}).tween("zoom",function(){var F=this,le=arguments,$=I(F,le).event(G),X=t.apply(F,le),re=R==null?v(X):typeof R=="function"?R.apply(F,le):R,pe=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),ye=F.__zoom,ue=typeof W=="function"?W.apply(F,le):W,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)}$.zoom(null,ge)}})}function I(k,W,R){return!R&&k.__zooming||new P(k,W)}function P(k,W){this.that=k,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,W),this.taps=0}P.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,W){return this.mouse&&k!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var W=ht(this.that).datum();d.call(k,this.that,new rb(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),W)}};function x(k,...W){if(!e.apply(this,arguments))return;var R=I(this,W).event(k),G=this.__zoom,F=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,i.apply(this,arguments)))),le=Et(k);if(R.wheel)(R.mouse[0][0]!==le[0]||R.mouse[0][1]!==le[1])&&(R.mouse[1]=G.invert(R.mouse[0]=le)),clearTimeout(R.wheel);else{if(G.k===F)return;R.mouse=[le,G.invert(le)],Si(this),R.start()}po(k),R.wheel=setTimeout($,m),R.zoom("mouse",o(b(A(G,F),R.mouse[0],R.mouse[1]),R.extent,r));function $(){R.wheel=null,R.end()}}function O(k,...W){if(h||!e.apply(this,arguments))return;var R=k.currentTarget,G=I(this,W,!0).event(k),F=ht(k.view).on("mousemove.zoom",re,!0).on("mouseup.zoom",pe,!0),le=Et(k,R),$=k.clientX,X=k.clientY;rc(k.view),al(k),G.mouse=[le,this.__zoom.invert(le)],Si(this),G.start();function re(ye){if(po(ye),!G.moved){var ue=ye.clientX-$,fe=ye.clientY-X;G.moved=ue*ue+fe*fe>g}G.event(ye).zoom("mouse",o(b(G.that.__zoom,G.mouse[0]=Et(ye,R),G.mouse[1]),G.extent,r))}function pe(ye){F.on("mousemove.zoom mouseup.zoom",null),sc(ye.view,G.moved),po(ye),G.event(ye).end()}}function H(k,...W){if(e.apply(this,arguments)){var R=this.__zoom,G=Et(k.changedTouches?k.changedTouches[0]:k,this),F=R.invert(G),le=R.k*(k.shiftKey?.5:2),$=o(b(A(R,le),G,F),t.apply(this,W),r);po(k),s>0?ht(this).transition().duration(s).call(te,$,G,k):ht(this).call(_.transform,$,G,k)}}function de(k,...W){if(e.apply(this,arguments)){var R=k.touches,G=R.length,F=I(this,W,k.changedTouches.length===G).event(k),le,$,X,re;for(al(k),$=0;$<G;++$)X=R[$],re=Et(X,this),re=[re,this.__zoom.invert(re),X.identifier],F.touch0?!F.touch1&&F.touch0[2]!==re[2]&&(F.touch1=re,F.taps=0):(F.touch0=re,le=!0,F.taps=1+!!u);u&&(u=clearTimeout(u)),le&&(F.taps<2&&(f=re[0],u=setTimeout(function(){u=null},p)),Si(this),F.start())}}function z(k,...W){if(this.__zooming){var R=I(this,W).event(k),G=k.changedTouches,F=G.length,le,$,X,re;for(po(k),le=0;le<F;++le)$=G[le],X=Et($,this),R.touch0&&R.touch0[2]===$.identifier?R.touch0[0]=X:R.touch1&&R.touch1[2]===$.identifier&&(R.touch1[0]=X);if($=R.that.__zoom,R.touch1){var pe=R.touch0[0],ye=R.touch0[1],ue=R.touch1[0],fe=R.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;$=A($,Math.sqrt(ge/Ee)),X=[(pe[0]+ue[0])/2,(pe[1]+ue[1])/2],re=[(ye[0]+fe[0])/2,(ye[1]+fe[1])/2]}else if(R.touch0)X=R.touch0[0],re=R.touch0[1];else return;R.zoom("touch",o(b($,X,re),R.extent,r))}}function oe(k,...W){if(this.__zooming){var R=I(this,W).event(k),G=k.changedTouches,F=G.length,le,$;for(al(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),le=0;le<F;++le)$=G[le],R.touch0&&R.touch0[2]===$.identifier?delete R.touch0:R.touch1&&R.touch1[2]===$.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&($=Et($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<y)){var X=ht(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ci(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ci(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Ci(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:Ci([[+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?(y=+k,_):y},_}var Se=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Se||{}),ll=(e=>(e.Partial="partial",e.Full="full",e))(ll||{}),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||{}),rl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(rl||{}),ho=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ho||{}),Oc=(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))(Oc||{});const pb=["INPUT","SELECT","TEXTAREA"],hb=typeof document<"u"?document:null;function sl(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 pb.includes(i==null?void 0:i.nodeName)||a||!!l}function yb(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Lc(e,t,o,i){const a=t.replace("+",`
1
+ (function(ke,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):(ke=typeof globalThis<"u"?globalThis:ke||self,n(ke.EntityModeler={},ke.Vue,ke.OpenBlueseaCore))})(this,(function(ke,n,ae){"use strict";var OC=Object.defineProperty;var LC=(ke,n,ae)=>n in ke?OC(ke,n,{enumerable:!0,configurable:!0,writable:!0,value:ae}):ke[n]=ae;var Ye=(ke,n,ae)=>LC(ke,typeof n!="symbol"?n+"":n,ae);const bf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function _f(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 ar(e,t,o={}){const i={...bf,...o},a=new Map(e.entities.map(h=>[h.modelId,h])),l=new Map(e.associations.map(h=>[h.modelId,h])),r=new Map(t.entityLayouts.map(h=>[h.entityRef,h])),s=new Map(t.associationLayouts.map(h=>[h.associationRef,h])),c=t.entityLayouts.map(h=>h.entityRef).filter(h=>!a.has(h)),d=t.associationLayouts.map(h=>h.associationRef).filter(h=>!l.has(h)),u=new Map;for(const h of e.groups)for(const E of h.memberEntityRefs)u.set(E,h.modelId);const f=new Map;for(const h of t.groupLayouts)for(const E of h.memberNoteRefs??[])f.set(E,h.groupRef);let m=0;const p=e.entities.map(h=>{const E=u.get(h.modelId),Z=r.get(h.modelId);if(Z){const G={location:{x:Z.geo.location.x,y:Z.geo.location.y},size:{width:Z.geo.size.width,height:Z.geo.size.height}};return{entity:h,geo:G,collapsed:Z.collapsed??!1,locked:Z.locked??!1,groupRef:E,style:Z.style,attributeStyles:Z.attributeStyles,operationStyles:Z.operationStyles}}const L=_f(m++,i);return{entity:h,geo:L,collapsed:!1,locked:!1,groupRef:E}}),y=new Map(t.groupLayouts.map(h=>[h.groupRef,h])),b=e.groups.map(h=>{const E=y.get(h.modelId),Z=E?{location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:h,geo:Z,style:E==null?void 0:E.style,locked:(E==null?void 0:E.locked)??!1}}),g=e.associations.map(h=>{const E=s.get(h.modelId);return{association:h,waypoints:(E==null?void 0:E.waypoints)??[],sourceColumnRef:E==null?void 0:E.sourceColumnRef,targetColumnRef:E==null?void 0:E.targetColumnRef}}),_=t.notes.map(h=>({note:{...h,geo:{location:{x:h.geo.location.x,y:h.geo.location.y},size:{width:h.geo.size.width,height:h.geo.size.height}}},groupRef:f.get(h.modelId)})),C=[];for(const h of t.notes)for(const E of h.connections??[])a.has(E.targetRef)&&C.push({noteRef:h.modelId,targetRef:E.targetRef,waypoints:E.waypoints.map(Z=>({x:Z.x,y:Z.y}))});return{entities:p,associations:g,groups:b,notes:_,noteConnections:C,prunedEntityRefs:c,prunedAssociationRefs:d}}function Kn(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 lr(e,t,o,i,a,l){const r=Kn(t),s=Kn(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 m=e;const p=(g,_)=>{(Math.abs(g.x-m.x)>=kn||Math.abs(g.y-m.y)>=kn)&&(f.push({a:m,b:g,seg:_}),m=g)};p(c,0);let y=r.x!==0,b=c;for(let g=1;g<u.length;g++){const _=u[g],C=g<=o.length?g-1:o.length,h=Math.abs(_.x-b.x)<kn,E=Math.abs(_.y-b.y)<kn;h&&E||(h?(p(_,C),y=!1):E?(p(_,C),y=!0):y?(p({x:b.x,y:_.y},C),p(_,C),y=!0):(p({x:_.x,y:b.y},C),p(_,C),y=!1),b=_)}return p(i,o.length),f}function _a(e,t,o,i,a,l=20){const r=lr(e,t,o,i,a,l);let s=`M ${ot(e.x)},${ot(e.y)}`;for(const c of r)s+=` L ${ot(c.b.x)},${ot(c.b.y)}`;return s}const wf=14;function wa(e,t,o,i,a,l=20){return lr(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=wf).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function ot(e){return Math.round(e*100)/100}const kf=36;function rr(e,t,o=kf){const i=Math.max(e.x,t.x)+o;return`M ${ot(e.x)},${ot(e.y)} L ${ot(i)},${ot(e.y)} L ${ot(i)},${ot(t.y)} L ${ot(t.x)},${ot(t.y)}`}function ka(e,t,o){const i=[e,...t,o];let a=`M ${ot(i[0].x)},${ot(i[0].y)}`;for(let l=1;l<i.length;l++)a+=` L ${ot(i[l].x)},${ot(i[l].y)}`;return a}function Ef(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ea(e,t){const o=Ef(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 va(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 Na(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 vf={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function sr(e,t,o={}){const i={...vf,...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),m=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 y=Math.max(1,Math.floor((p-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((b,g)=>{const _=g%y,C=Math.floor(g/y);l.push({id:b,location:{x:m.x+i.pad+_*i.cellWidth,y:m.y+i.pad+i.headerHeight+C*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 m=f%i.ungroupedCols,p=Math.floor(f/i.ungroupedCols);l.push({id:u.modelId,location:{x:i.pad+m*i.cellWidth,y:d+p*i.cellHeight}})}),l}const cr={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function dr(e,t={}){const o={...cr,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Nf(e,t={}){const o={...cr,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=dr(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}}})}const Yo="inherited:";function ur(e,t){return`${Yo}${e}:${t}`}function qn(e){return e.startsWith(Yo)}function Ia(e){if(!qn(e))return null;const t=e.slice(Yo.length),o=t.indexOf(":");if(o<0)return null;const i=t.slice(0,o),a=t.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function Wo(e,t){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(t.some(l=>l.name===e.name))return[];const o=e.superClass||((a=t.find(l=>l.default))==null?void 0:a.name);if(!o)return[];const i=t.find(l=>l.name===o);return i?i.columns.map(l=>({modelId:ur(i.name,l.field),baseClass:i.name,field:l.field,physicalName:l.physicalName,dataType:l.dataType,logicalName:l.logicalName,length:l.length,scale:l.scale})):[]}function Ko(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 fr(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 mr(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,y)=>p.order-y.order);for(const p of f){if(p.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${p.name?` ${p.name} ${"─".repeat(8)}`:""}`);continue}const y=p.dbAttrs[0],b=y!=null&&y.length?`(${y.length}${y.scale!=null?`,${y.scale}`:""})`:"",g=y?` → ${y.physicalName} ${y.dataType}${b}`:"",_=[p.identifier?"PK":"",p.notNull?"NOT NULL":"",y!=null&&y.unique?"UNIQUE":"",y!=null&&y.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${p.name}: ${p.type}${g}${_.length?` {${_.join(", ")}}`:""}`)}for(const p of c.indexes??[]){const y=p.columns.map(b=>{var g;return`${o.get(b.columnRef)??((g=Ia(b.columnRef))==null?void 0:g.field)??b.columnRef}${b.descending?" DESC":""}`}).join(", ");a.push(` index ${p.name}${p.unique?" UNIQUE":""}: ${y}`)}const m=[...c.operations??[]].sort((p,y)=>p.order-y.order);for(const p of m){const y=p.visibility?` {${p.visibility}}`:"",b=(s=p.description)!=null&&s.ko?` — ${p.description.ko}`:"";a.push(` method ${p.name}()${y}${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} ${fr(c.end1.multiplicity)} —— ${fr(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
2
+ `).trim()}function If(e){return e==="CLASS"?"class":"er"}function $a(e,t){return t==="class"?Rf(e):xf(e)}function Xn(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function xa(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function pr(e,t){const o=new Set,i=new Map;return e.entities.forEach((a,l)=>{const r=Xn(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 $f(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function hr(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 yr(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 xf(e){var i,a;const t=pr(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=Xn((d==null?void 0:d.dataType)||c.type,"unknown"),f=Xn((d==null?void 0:d.physicalName)||c.name,"col"),m=[c.identifier?"PK":"",$f(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),p=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",y=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,b=xa([y,p].filter(Boolean).join(" ")),g=[` ${u} ${f}`];m&&g.push(m);let _=g.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=`${yr(l.end1.multiplicity,"left")}--${yr(l.end2.multiplicity,"right")}`,d=xa(l.description);o.push(` ${r} ${c} ${s} : "${d}"`)}return o.join(`
3
+ `)}function Sf(e){return e&&e!=="UNDEFINED"?e:null}function Cf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function Rf(e){const t=pr(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),l=[],r=Sf(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(` +${Cf(c.type)} ${Xn(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))l.push(` +${Xn(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=Vf(i),s=xa(i.description),c=` ${a} "${hr(i.end1.multiplicity)}" ${r} "${hr(i.end2.multiplicity)}" ${l}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
+ `)}function Vf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const Af=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function ct(e){return e.replace(Af,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Te(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function gr(e){return`<text ${[`x="${Te(e.x)}"`,`y="${Te(e.y)}"`,`fill="${ct(e.fill)}"`,`font-size="${Te(e.fontSize)}"`,e.fontFamily?`font-family="${ct(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${ct(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${ct(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${ct(e.text)}</text>`}function Tf(e){return`<line x1="${Te(e.x1)}" y1="${Te(e.y)}" x2="${Te(e.x2)}" y2="${Te(e.y)}" stroke="${ct(e.stroke)}" stroke-width="${Te(e.strokeWidth??1)}" />`}function Mf(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 Bf(e,t,o,i,a){return[`M${Te(e+a.tl)},${Te(t)}`,`L${Te(e+o-a.tr)},${Te(t)}`,a.tr?`Q${Te(e+o)},${Te(t)} ${Te(e+o)},${Te(t+a.tr)}`:"",`L${Te(e+o)},${Te(t+i-a.br)}`,a.br?`Q${Te(e+o)},${Te(t+i)} ${Te(e+o-a.br)},${Te(t+i)}`:"",`L${Te(e+a.bl)},${Te(t+i)}`,a.bl?`Q${Te(e)},${Te(t+i)} ${Te(e)},${Te(t+i-a.bl)}`:"",`L${Te(e)},${Te(t+a.tl)}`,a.tl?`Q${Te(e)},${Te(t)} ${Te(e+a.tl)},${Te(t)}`:"","Z"].filter(Boolean).join(" ")}function Sa(e){const t=Mf(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${ct(e.fill)}"`,`stroke="${ct(e.stroke)}"`,`stroke-width="${Te(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${ct(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Te(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${Bf(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Te(e.x)}" y="${Te(e.y)}" width="${Te(e.w)}" height="${Te(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(Tf(r));for(const r of e.texts)l.push(gr(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Df(e){const o=[`<path ${[`d="${ct(e.d)}"`,'fill="none"',`stroke="${ct(e.stroke)}"`,`stroke-width="${Te(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${ct(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(gr(i));return`<g>${o.join("")}</g>`}function br(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Te(t)}" y="${Te(o)}" width="${Te(i)}" height="${Te(a)}" fill="${ct(e.background)}" />`);for(const r of e.groups)l.push(Sa(r));for(const r of e.edges)l.push(Df(r));for(const r of e.entities)l.push(Sa(r));for(const r of e.notes)l.push(Sa(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Te(t)} ${Te(o)} ${Te(i)} ${Te(a)}" width="${Te(i)}" height="${Te(a)}">`+l.join("")+"</svg>"}const Of=["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"],Lf=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"]),Pf=Of.filter(e=>!Lf.has(e)),zf={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Ca(e){return zf[e]??e}const Uf=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),qo=new Set(["NUMERIC","DECIMAL"]);function _r(e,t=Pf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ct="CustomType",jn="GroupCodeEnum",Ra="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:jn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Ct,label:"CustomType"}],Ff=new Map(Va.map(e=>[e.value,e.label]));function En(e){return Ff.get(e)??e}const Hf=new Set([jn,"CustomMoneyType"]),wr=Va.filter(e=>!Hf.has(e.value)).map(e=>e.value===Ct?{...e,label:"CustomType (사용자정의)"}:e);function kr(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=[...wr,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:En(e)},...i]:i}function Gf(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Er(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 Aa(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${En(t.type)}>`:Gf(t)?En(t.type):e==="CLASS"?t.type===Ct&&t.customType||En(t.type):Ca(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Xo(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 jo(e,t){return Xo(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function Zn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Zo(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 Ta=63;function Jo(e){if(!e)return null;const t=e.length;return t<=Ta?null:`물리명이 ${Ta}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function vr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function ft(e){return!e||e.trim()===""}function Jn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Yf(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 m=l.get(f)??o;if(m===o)d(f);else if(m===i){const p=r.slice(r.indexOf(f)),y=[...p].sort().join(" ");c.has(y)||(c.add(y),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 Wf(e,t,o,i,a){var l,r,s,c,d;if(!ft(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(m=>m.modelId===u))==null?void 0:d.attributes.flatMap(m=>m.dbAttrs)[o];return(f==null?void 0:f.physicalName)??""}return t.physicalName??""}function Ma(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 Nr(e,t){var l,r,s,c,d;const o=[];for(const u of Ma(e.entities,f=>f.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:`엔티티 이름이 중복됩니다: "${u.name}"`});for(const u of e.entities){const f=u.attributes.filter(h=>h.attrType!=="DIVIDER");if(ft(u.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"엔티티 이름이 비어 있습니다"}),u.stereotype==="JPA_ENTITY"&&!u.abstractClass&&(f.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:u.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),ft((l=u.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),u.stereotype==="JPA_EMBEDDABLE")for(const h of f.filter(E=>E.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${h.name}"`});for(const h of f.filter(E=>E.identifier&&E.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of f)if(!h.identifier)for(const E of h.dbAttrs)!E.autoIncrement&&ft(E.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:E.modelId,contextRef:u.modelId,message:`채번(${E.autoIncrement?"auto increment":`시퀀스 "${E.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${h.name}"에 설정되어 있습니다`});for(const h of f.filter(E=>E.naturalId&&E.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${h.name}"`});for(const h of f.filter(E=>E.naturalId&&E.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of f.filter(E=>E.naturalId&&!E.notNull&&!E.identifier&&!E.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${h.name}"`});!u.abstractClass&&f.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&f.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:u.modelId,message:`속성이 ${f.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const h of Ma(f,E=>E.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`속성 이름이 중복됩니다: "${h.name}"`});for(const h of f)ft(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:"속성 이름이 비어 있습니다"});const m=f.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),p=f.flatMap(h=>h.dbAttrs.map((E,Z)=>({col:E,name:Wf(h,E,Z,e,t)})).filter(E=>E.col.sharedColumnRef==null));for(const h of Ma(p,E=>E.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:u.modelId,message:`컬럼 물리명이 중복됩니다: "${h.name}"`});for(const h of m){const E=Jo(h.physicalName);E&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:E}),t!=null&&t.reservedWords&&!ft(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${h.physicalName}"`}),t!=null&&t.selectableDataTypes&&!ft(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${h.dataType}"`}),!ft(h.dataType)&&Uf.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`${h.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const h=Zn(jo(u,e.entities));for(const E of f){if(E.attrType!=="EMBED_PREDEF")continue;const Z=t.embeddableCatalog.find(L=>L.type===E.type);Z&&E.dbAttrs.forEach((L,G)=>{if(L.sharedColumnRef==null)return;const T=Z.fields[G],S=h.get(L.sharedColumnRef);if(!T||!S)return;(S.dataType!==T.dataType||(S.length??null)!==(T.length??null)||(S.scale??null)!==(T.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:L.modelId,contextRef:u.modelId,message:`공유 대상 컬럼의 타입(${vr(S)})이 ${T.name??"컬럼"} 정의(${vr(T)})와 다릅니다`})})}}for(const h of f){const E=h.dbAttrs[0];if(!(E!=null&&E.multiValue))continue;h.type===jn&&E.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:E.modelId,contextRef:u.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${h.type||"타입 미지정"} / ${E.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const y=(s=u.table)==null?void 0:s.physicalName,b=Jo(y);b&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:b}),t!=null&&t.reservedWords&&!ft(y)&&t.reservedWords.has(y.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${y}"`});const g=new Set;for(const h of u.attributes){g.add(h.modelId);for(const E of h.dbAttrs)g.add(E.modelId)}const _=new Set(Wo(u,(t==null?void 0:t.superClassCatalog)??[]).map(h=>h.modelId)),C=(((c=t==null?void 0:t.superClassCatalog)==null?void 0:c.length)??0)>0;for(const h of u.indexes??[]){const E=Jo(h.name);E&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:E}),t!=null&&t.reservedWords&&!ft(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${h.name}"`});for(const Z of h.columns){const L=Z.columnRef;if(g.has(L)||_.has(L))continue;const G=qn(L);G&&!C||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:G?`인덱스 "${h.name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다(${((d=Ia(L))==null?void 0:d.field)??L}).`:`인덱스 "${h.name}"가 존재하지 않는 컬럼을 참조합니다.`})}}}const i=new Map;for(const u of e.entities)for(const f of u.attributes)f.attrType==="EMBED_OWN"&&f.embedded&&i.set(f.embedded.associationRef,f);for(const u of e.associations){Jn(u.end1.multiplicity)&&Jn(u.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:u.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(u.modelId)&&u.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:u.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const f of["end1","end2"]){const m=u[f].jpa;if(!m)continue;const p=m.cascadeTypes??[],y=p.includes("ALL"),b=p.includes("REMOVE");y&&p.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),m.orphanRemoval&&(b||y)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:u.modelId,message:`${f}: orphanRemoval이 cascade ${y?"ALL":"REMOVE"}와 의미가 겹칩니다`}),Jn(u[f].multiplicity)&&m.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),m.orphanRemoval&&Jn(u[f==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:u.modelId,message:`${f}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!Jn(u[f].multiplicity)&&(m.collectionType||m.collectionTable||m.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),m.collectionType==="SET"&&m.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(u=>[u.modelId,u.name||u.modelId]));for(const u of Yf(e)){const f=[...u,u[0]].map(m=>a.get(m)??m).join(" → ");for(const m of u)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:m,message:`식별 관계 사이클입니다 (PK 무한 의존): ${f}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const u=new Set;for(const m of e.associations)u.add(m.end1.entityRef),u.add(m.end2.entityRef);const f=new Map(e.entities.map(m=>[m.name,m.modelId]));for(const m of e.entities){for(const p of m.attributes)p.embedded&&(u.add(m.modelId),u.add(p.embedded.embeddableRef));if(!ft(m.superClass)){u.add(m.modelId);const p=f.get(m.superClass);p&&u.add(p)}}for(const m of e.entities)u.has(m.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:m.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function Oe(){return crypto.randomUUID()}const Kf="CustomMoneyType",qf="Money";function Xf(e){return!(e.type!==Kf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function jf(e){const t=e.dbAttrs[0]??{modelId:Oe(),physicalName:"",dataType:""},o={modelId:Oe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:qf,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=>Xf(r)?(a=!0,t=!0,jf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function Ir(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function $r(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Ir);if(!i.length)continue;const a=o.filter(s=>!Ir(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 vn(e){return JSON.parse(JSON.stringify(e))}function xr(e,t,o){var G;const i=o.idFactory??Oe,a=o.offset??{x:0,y:0},{logical:l,layout:r}=e,s=new Set(t);if(o.includeRelated){const T=new Set(t);for(const S of l.associations){const O=T.has(S.end1.entityRef),te=T.has(S.end2.entityRef);O!==te&&s.add(O?S.end2.entityRef:S.end1.entityRef)}}const c=l.entities.filter(T=>s.has(T.modelId)),d=new Set(c.map(T=>T.modelId)),u=l.associations.filter(T=>d.has(T.end1.entityRef)&&d.has(T.end2.entityRef)),f=new Set(u.map(T=>T.modelId)),m=new Map,p=T=>{let S=m.get(T);return S||(S=i(),m.set(T,S)),S};for(const T of c){p(T.modelId);for(const S of T.attributes){p(S.modelId);for(const O of S.dbAttrs)p(O.modelId)}for(const S of T.indexes??[])p(S.modelId);for(const S of T.operations??[])p(S.modelId)}for(const T of u)p(T.modelId);const y=T=>m.get(T),b=c.map(T=>{const S=vn(T);S.modelId=y(T.modelId),S.attributes=S.attributes.map(O=>Jf(O,y,f,d));for(const O of S.indexes??[])O.modelId=y(O.modelId),O.columns=O.columns.map(te=>qn(te.columnRef)?te:{...te,columnRef:y(te.columnRef)}).filter(te=>te.columnRef!==void 0);for(const O of S.operations??[])O.modelId=y(O.modelId);return S});$r(b);const g=u.map(T=>{const S=vn(T);return S.modelId=y(T.modelId),S.end1=Sr(S.end1,y),S.end2=Sr(S.end2,y),S}),_=[];for(const T of l.groups){const S=T.memberEntityRefs.filter(te=>d.has(te));if(S.length===0)continue;const O=vn(T);O.modelId=p(T.modelId),O.memberEntityRefs=S.map(te=>y(te)),_.push(O)}const C=new Set(o.existing.entities.map(T=>T.name)),h=new Set(o.existing.entities.map(T=>{var S;return(S=T.table)==null?void 0:S.physicalName}).filter(T=>!!T));for(const T of b)C.has(T.name)&&(T.name=`${T.name}_imported`),(G=T.table)!=null&&G.physicalName&&h.has(T.table.physicalName)&&(T.table.physicalName=`${T.table.physicalName}_imported`);const E=[];for(const T of r.entityLayouts){const S=y(T.entityRef);if(!S)continue;const O=vn(T);O.entityRef=S,O.geo={...O.geo,location:Ba(O.geo.location,a)},O.attributeStyles&&(O.attributeStyles=Cr(O.attributeStyles,y)),O.operationStyles&&(O.operationStyles=Cr(O.operationStyles,y)),E.push(O)}const Z=[];for(const T of r.associationLayouts){const S=y(T.associationRef);if(!S)continue;const O=vn(T);O.associationRef=S,O.sourceColumnRef=T.sourceColumnRef?y(T.sourceColumnRef):void 0,O.targetColumnRef=T.targetColumnRef?y(T.targetColumnRef):void 0,O.waypoints=O.waypoints.map(te=>Ba(te,a)),Z.push(O)}const L=[];for(const T of r.groupLayouts){const S=y(T.groupRef);if(!S)continue;const O=vn(T);O.groupRef=S,O.geo={...O.geo,location:Ba(O.geo.location,a)},delete O.memberNoteRefs,L.push(O)}return{logical:{entities:b,associations:g,groups:_},layout:{entityLayouts:E,associationLayouts:Z,groupLayouts:L},idMap:m}}function Ba(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Jf(e,t,o,i){e.modelId=t(e.modelId);for(const a of e.dbAttrs)if(a.modelId=t(a.modelId),a.sharedColumnRef!==void 0){const l=t(a.sharedColumnRef);l?a.sharedColumnRef=l:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:t(e.derivedFrom.associationRef),sourceAttributeRef:t(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:t(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:t(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function Sr(e,t){return{...e,entityRef:t(e.entityRef),attributeRef:e.attributeRef?t(e.attributeRef):void 0}}function Cr(e,t){const o={};for(const[i,a]of Object.entries(e)){const l=t(i);l&&(o[l]=a)}return o}function Da(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function Nn(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)=>Nn(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(!Nn(e[i],t[i]))return!1;return!0}return!1}function Jt(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const l of a)o.has(l)||Nn(e[l],t[l])||(i[l]=t[l]===void 0?null:t[l]);return Object.keys(i).length?i:null}function Qt(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 Qf(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 em=new Set(["attributes","operations","indexes","rev"]),tm=new Set(["end1","end2","rev"]),nm=new Set(["memberEntityRefs","rev"]),Rr=new Set(["modelId"]),om=new Set(["modelId","columns"]),im=new Set([]);function am(e,t,o,i){const a=Qt(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=Jt(s,c,Rr);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=Qt(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=Jt(s,c,Rr);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=Qt(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(!Nn(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=Jt(s,c,om);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function lm(e,t,o){const i=Qt(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:Da(r)});for(const{cur:r,tgt:s}of i.common){const c=Jt(r,s,em);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),am(r.modelId,r,s,o)}const a=Qt(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:Da(r)});for(const{cur:r,tgt:s}of a.common){const c=Jt(r,s,tm);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Jt(r[d]??{},s[d]??{},im);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=Qt(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:Da(r)});for(const{cur:r,tgt:s}of l.common){const c=Jt(r,s,nm);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=Qf(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=Qt(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)Nn(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 rm(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 sm(e,t){const o=[];return lm(e.logical,t.logical,o),rm(e.layout,t.layout,o),o}function cm(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 dm={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 um{constructor(t){Ye(this,"out",[]);Ye(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({...Qn(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({...Qn(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({...Qn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...Qn(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({...Qn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Qn(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 _t(e,t,o,i){if(o==null||typeof o!="object")return;const a=dm[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function en(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function Oa(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,m;const o=cm(t),i=new um(t.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==t.entityRef)break;y.kind==="entity.add"?_t(i,p,y.value,"entity"):y.kind==="entity.update"?en(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=Oa((l=y.value)==null?void 0:l.attributes,t.attributeRef);b&&_t(i,p,b,"attribute")}else y.kind==="attribute.add"&&((r=y.value)==null?void 0:r.modelId)===t.attributeRef?_t(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===t.attributeRef?en(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===t.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=Oa((s=y.value)==null?void 0:s.operations,t.operationRef);b&&_t(i,p,b,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===t.operationRef?_t(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===t.operationRef?en(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===t.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=Oa((d=y.value)==null?void 0:d.indexes,t.indexRef);b&&_t(i,p,b,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===t.indexRef?_t(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===t.indexRef?en(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===t.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==t.associationRef)break;y.kind==="association.add"?_t(i,p,y.value,"association"):y.kind==="association.update"?en(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==t.associationRef)break;if(y.kind==="association.add"){const b=(f=y.value)==null?void 0:f[t.end];_t(i,p,b,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===t.end?en(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==t.groupRef)break;if(y.kind==="group.add"){_t(i,p,y.value,"group");const b=(m=y.value)==null?void 0:m.memberEntityRefs;if(Array.isArray(b))for(const g of b)i.member(p,g,!1)}else y.kind==="group.update"?en(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}function fm(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function In(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function mm(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;In(c==null?void 0:c.attributes,o),In(c==null?void 0:c.operations,i),In(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?In([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?In([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?In([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 ei(e,t){return e.map(o=>({...o,subject:t}))}function Vr(e,t){const o=e.filter(s=>s.ops.some(c=>fm(c,t))),{attributes:i,operations:a,indexes:l}=mm(o,t),r=[...ei(Ut(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...ei(Ut(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...ei(Ut(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...ei(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 Ar(e){return`${e.kind}:${e.ref}:${e.end??""}`}function pm(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 hm(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 ym(e){const{entities:t,associations:o,groups:i}=hm(e),a=[];for(const l of t)for(const r of Vr(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 Tr(e){const t=ym(e),o=pm(e),i=new Map;for(const r of t){const s=Ar(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=Ar(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 La{constructor(t){Ye(this,"undoStack",[]);Ye(this,"redoStack",[]);Ye(this,"savePoint",null);Ye(this,"listeners",new Set);Ye(this,"commandListeners",new Set);Ye(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 Mr(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Ze(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function mt(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 ti(e,t,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:t,...o})},invert(i){const a=Mr(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const l=Ze(i,e.modelId);l>=0&&i.layout.entityLayouts.splice(l,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Br(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Mr(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=Ze(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(m=>m.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 Dr(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 Or(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 $n(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=Ze(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=Ze(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 Lr(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Ze(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=Ze(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 eo(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 Pr(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=Ze(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.style,l.style=eo(l.style,t)},invert(i){const a=Ze(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Ze(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 zr(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Ze(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=Ze(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 Ur(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Ze(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=Ze(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 Pa(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 ni(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=Ze(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.attributeStyles;const s={...r.attributeStyles},c=eo(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const l=Ze(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=Ze(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 oi(e,t,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:t,...o})},invert(i){const a=i.logical.groups.findIndex(r=>r.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const l=i.layout.groupLayouts.findIndex(r=>r.groupRef===e.modelId);l>=0&&i.layout.groupLayouts.splice(l,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Fr(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 Hr(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 Gr(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 ii(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 Yr(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 Wr(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 Kr(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=eo(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 qr(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 tn(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 xn(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 za(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,m)=>f.order=m)},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 Xr(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 jr(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 Zr(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 Jr(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=Fe(a,e),r=l.operations??[];i=r.map(m=>({...m}));const s=new Set(t),c=r.filter(m=>s.has(m.modelId)),d=r.filter(m=>!s.has(m.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((m,p)=>m.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 Qr(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=Ze(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.operationStyles;const s={...r.operationStyles},c=eo(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(a){const l=Ze(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=Ze(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 ai(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 es(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 li(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 Sn(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 ts(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 ns(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 os(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}}),to=(e,t)=>{var o;return((o=mt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function is(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=mt(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=mt(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=to(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[wt(e,l)],invert:[wt(e,r)]}}}}function as(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=mt(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=mt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=to(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function ls(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=mt(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=mt(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[wt(e,to(a,e))],invert:[wt(e,i??[])]}}}}function rs(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=mt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=mt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[wt(e,to(o,e))],invert:[wt(e,t??[])]}}}}function ss(e,t,o){return{label:"waypoint 추가",apply(i){const a=mt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=mt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=to(i,e),l=a.slice();return l.splice(t,1),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function cs(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 ds(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 no(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 us(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 fs(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 ms(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=eo(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 ps(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 hs(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 Ft=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),ri=(e,t,o)=>{var i;return((i=Rt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function ys(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 gs(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 bs(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=ri(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Ft(e,t,r)],invert:[Ft(e,t,s)]}}}}function _s(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=ri(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ft(e,t,l)],invert:[Ft(e,t,r)]}}}}function ws(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=ri(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ft(e,t,l)],invert:[Ft(e,t,r)]}}}}function ks(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:[Ft(e,t,ri(i,e,t))],invert:[Ft(e,t,o??[])]}}}}function He(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 gm=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:ai,addAttribute:Vt,addEntity:ti,addEntityToGroup:Gr,addGroup:oi,addIndex:ts,addNote:cs,addNoteConnection:ys,addNoteConnectionWaypoint:_s,addNoteToGroup:ps,addOperation:Xr,addWaypoint:ss,clearNoteConnectionWaypoints:ks,clearWaypoints:rs,composite:He,moveEntity:$n,moveGroup:Yr,moveNote:no,moveNoteConnectionWaypoint:bs,moveWaypoint:is,removeAssociation:es,removeAttribute:xn,removeEntity:Br,removeEntityFromGroup:ii,removeGroup:Hr,removeIndex:os,removeNote:ds,removeNoteConnection:gs,removeNoteConnectionWaypoint:ws,removeNoteFromGroup:hs,removeOperation:Zr,removeWaypoint:as,renameEntity:Or,reorderAttributes:za,reorderOperations:Jr,resizeEntity:Lr,resizeGroup:Wr,resizeNote:us,setAllEntitiesCollapsed:Pa,setAttributeSwatch:ni,setEntityCollapsed:zr,setEntityLocked:Ur,setEntitySwatch:Pr,setGroupLocked:qr,setGroupSwatch:Kr,setNoteMemo:fs,setNoteSwatch:ms,setOperationSwatch:Qr,translateWaypoints:ls,updateAssociation:li,updateAssociationEnd:Sn,updateAttribute:tn,updateEntity:Dr,updateGroup:Fr,updateIndex:ns,updateOperation:jr},Symbol.toStringTag,{value:"Module"}));class Es{constructor(){Ye(this,"revs",new Map);Ye(this,"layoutVersion",0);Ye(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 vs{constructor(t){Ye(this,"cache",new Es);Ye(this,"newClientOpId");Ye(this,"debounceMs");Ye(this,"emissions",new WeakMap);Ye(this,"open",null);Ye(this,"debounceHandle",null);Ye(this,"queue",[]);Ye(this,"sending",!1);Ye(this,"_frozen",!1);Ye(this,"stack",null);Ye(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 Ns=["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"],Is=()=>crypto.randomUUID(),bm=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,_m=e=>e&&e[0].toLowerCase()+e.slice(1),wm=e=>e&&e[0].toUpperCase()+e.slice(1),km=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Em(e,t){return _m(e)+wm(t)}function vm(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=Em(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:km(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const si=(e,t)=>`${e}::${t}`,ci=e=>e??void 0;function Nm(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||ci(s.length)!==ci(l.length)||ci(s.scale)!==ci(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 Im(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 oo(e,t,o=Is){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=>vm(e,f)),s=new Map(r.map(f=>[si(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[si(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const m=si(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(m)||i.remove.push(f.modelId)}let u=a.attributes.reduce((f,m)=>Math.max(f,m.order),-1)+1;for(const f of r){const m=si(f.associationRef,f.sourceAttributeRef),p=d.get(m);if(!p)i.add.push(Im(f,u++,o));else{const y=Nm(p,f,o);y&&i.update.push({attributeId:p.modelId,patch:y})}}return i}function $m(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 xm(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function Sm(e,t,o=Is){const i=new Map,a=xm(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=oo(a,d,o);if(bm(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(m=>m.modelId===d);f&&$m(f,u),l.has(d)||r.push(d)}}return i}function di(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 Cm(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 Rm(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 $s(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function at(e,t){const o=Cm(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 Vm(e,t){const o=Rm(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 Am(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 Tm(e,t){const o=Am(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 Mm(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 Bm(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function Dm(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Om(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 Lm(e,t){const o=Dm(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 xs(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 Ss(e,t,o,i,a,l,r,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),f=[];let m=!1;for(const p of t.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const b={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=Mm(jo(i,a),b);if(!g.ok){s.push(g.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:g.matches}),m=!0;continue}f.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});continue}f.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return m?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 Cs(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 Rs(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=Tm(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 Pm(e,t,o={}){const i=o.mkId??Oe,a=o.embeddableCatalog??[],l=f=>a.find(m=>m.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,m)=>{var p,y,b;switch(f.kind){case"entity.add":{const g=i(),_={modelId:g,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}}:{}},C={ref:f.spec.name};let h=!1;for(const[L,G]of(f.spec.attributes??[]).entries()){if(G.type==="GroupCodeEnum"&&!G.groupCode){s.push({code:"groupcode-required",opIndex:m,entity:C,handle:{ref:G.name}}),h=!0;continue}const T=l(G.type);if(T){const S=Ss(G,T,L,_,e.entities,m,C,s,i);S?_.attributes.push(S):h=!0}else(p=G.embeddableOverrides)!=null&&p.length?(s.push({code:"embeddable-type-unresolved",opIndex:m,entity:C,handle:{ref:G.name}}),h=!0):_.attributes.push(xs(G,L,i))}const E=(f.spec.operations??[]).map((L,G)=>Cs(L,G,i));E.length&&(_.operations=E);const Z=[];for(const L of f.spec.indexes??[]){const G=Rs(_,L,m,C,s,i);G?Z.push(G):h=!0}if(Z.length&&(_.indexes=Z),h)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:g,value:_});break}case"entity.update":{const g=at(e,f.entity);if(!g.ok){s.push(lt(g.reason,m,f.entity,g.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,patch:f.patch});break}case"entity.remove":{const g=at(e,f.entity);if(!g.ok){s.push(lt(g.reason,m,f.entity,g.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:g.value.modelId});break}case"attribute.add":{const g=at(e,f.entity);if(!g.ok){s.push(lt(g.reason,m,f.entity,g.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:m,entity:f.entity,handle:{ref:f.spec.name}});break}const _=c.get(g.value.modelId)??g.value.attributes.length;c.set(g.value.modelId,_+1);const C=l(f.spec.type);let h;if(C)h=Ss(f.spec,C,_,g.value,e.entities,m,f.entity,s,i);else if((y=f.spec.embeddableOverrides)!=null&&y.length){s.push({code:"embeddable-type-unresolved",opIndex:m,entity:f.entity,handle:{ref:f.spec.name}});break}else h=xs(f.spec,_,i);if(!h)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,value:h});break}case"attribute.update":case"attribute.remove":{const g=at(e,f.entity);if(!g.ok){s.push(lt(g.reason,m,f.entity,g.matches,u));break}const _=Vm(g.value,f.attribute);if(!_.ok){s.push(_.reason==="not-found"?{code:"attribute-not-found",opIndex:m,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:m,entity:f.entity,handle:f.attribute,matches:_.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,attributeRef:_.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,attributeRef:_.value.modelId});break}case"association.add":{const g=at(e,f.spec.from),_=at(e,f.spec.to);if(g.ok||s.push(lt(g.reason,m,f.spec.from,g.matches,u)),_.ok||s.push(lt(_.reason,m,f.spec.to,_.matches,u)),!g.ok||!_.ok)break;if(f.spec.identifying&&g.value.modelId===_.value.modelId){s.push({code:"self-identifying",opIndex:m,handle:{from:f.spec.from,to:f.spec.to}});break}const C=i(),h={modelId:C,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:g.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}},E={...e,associations:[...e.associations,h]},Z=oo(E,_.value.modelId,i);Z.add[0]&&(h.end2.attributeRef=Z.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:C,value:h});for(const L of Z.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:L});break}case"association.remove":{const g=at(e,f.association.from),_=at(e,f.association.to);if(g.ok||s.push(lt(g.reason,m,f.association.from,g.matches,u)),_.ok||s.push(lt(_.reason,m,f.association.to,_.matches,u)),!g.ok||!_.ok)break;const C=$s(e,g.value.modelId,_.value.modelId);if(C.length!==1){s.push(C.length===0?{code:"association-not-found",opIndex:m,handle:f.association}:{code:"association-ambiguous",opIndex:m,handle:f.association,matches:C.map(h=>h.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:C[0].modelId});break}case"association.update":{const g=Vs(e,f.association,m,s,u);if(!g)break;r.push({kind:"association.update",casUnit:"logical",containerRef:g.modelId,associationRef:g.modelId,patch:f.patch});break}case"associationEnd.update":{const g=Vs(e,f.association,m,s,u);if(!g)break;const _=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:g.modelId,associationRef:g.modelId,end:_,patch:f.patch});break}case"index.add":{const g=at(e,f.entity);if(!g.ok){s.push(lt(g.reason,m,f.entity,g.matches,u));break}const _=Rs(g.value,f.spec,m,f.entity,s,i);if(!_)break;r.push({kind:"index.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:_.modelId,value:_});break}case"index.update":case"index.remove":{const g=at(e,f.entity);if(!g.ok){s.push(lt(g.reason,m,f.entity,g.matches,u));break}const _=Om(g.value,f.index);if(!_.ok){s.push(_.reason==="not-found"?{code:"index-not-found",opIndex:m,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:m,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:m,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:_.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:_.value.modelId});break}case"operation.add":{const g=at(e,f.entity);if(!g.ok){s.push(lt(g.reason,m,f.entity,g.matches,u));break}const _=d.get(g.value.modelId)??((b=g.value.operations)==null?void 0:b.length)??0;d.set(g.value.modelId,_+1);const C=Cs(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:C.modelId,value:C});break}case"operation.update":case"operation.remove":{const g=at(e,f.entity);if(!g.ok){s.push(lt(g.reason,m,f.entity,g.matches,u));break}const _=Lm(g.value,f.operation);if(!_.ok){s.push(_.reason==="not-found"?{code:"operation-not-found",opIndex:m,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:m,entity:f.entity,handle:f.operation,matches:_.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:_.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:_.value.modelId});break}case"group.add":{const g=[];let _=!1;for(const E of f.spec.members){const Z=at(e,E);if(!Z.ok){s.push(lt(Z.reason,m,E,Z.matches,u)),_=!0;continue}g.push(Z.value.modelId)}if(_)break;const C=i(),h={modelId:C,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:g,...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:C,value:h});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function lt(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 Vs(e,t,o,i,a){const l=at(e,t.from),r=at(e,t.to);if(l.ok||i.push(lt(l.reason,o,t.from,l.matches,a)),r.ok||i.push(lt(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=$s(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 As={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},zm={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Um={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},ui={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Fm={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:{...ui,description:"속성 설명(다국어)."},columnLogicalName:{...ui,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},Ts={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Hm={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Ts,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Ts,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},Gm={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...As,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},Ym={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...ui,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Wm={type:"object",properties:{name:{...ui,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},Km={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function tt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const qm={"entity.add":tt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":tt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":tt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":tt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":tt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":tt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":tt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":tt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":tt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":tt("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":tt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":tt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":tt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":tt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":tt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":tt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":tt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Ms={anyOf:Ns.map(e=>qm[e])},Xm={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:As,assocHandle:zm,entitySpec:Um,attrSpec:Fm,assocSpec:Hm,indexSpec:Gm,operationSpec:Ym,groupSpec:Wm,patch:Km,symbolicOp:Ms}};function jm(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 Bs={location:{x:0,y:0},size:{width:220,height:140}};function Ds(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 Zm=/^[-=_*~\s]{3,}$/;function Jm(e){return e.attrType&&e.attrType!=="NORMAL"||!Zm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Qm(e){return e.type===Ct&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function ep(e,t){if(e.attrType==="DIVIDER"||Jm(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=Qm(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(Ds)}}function tp(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 np(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 op(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(ep),operations:(t=e.operations)==null?void 0:t.map(tp),indexes:(o=e.indexes)==null?void 0:o.map(np),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function ip(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??{...Bs},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 Os(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 Ua(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:Os(e)}}function ap(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Ua(e.end1),end2:Ua(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 Ls(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Ps(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function zs(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 Us(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(Ds)}}function lp(e,t,o){var g,_;const i=Ls(e.end1.attribute),a=Ls(e.end2.attribute);if(i===a)return ap(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(_=(g=s.dbAttrs)==null?void 0:g[0])==null?void 0:_.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((C,h)=>Math.max(C,h.order),-1)+1:s.order??0,m={...Us(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(m);const p=(C,h)=>({entityRef:C.endModel.refId,multiplicity:C.multiplicity,navigable:C.navigable,composition:C.composition,attributeRef:h?d:m.modelId,legacyNavRaw:h?void 0:C.attribute,jpa:Os(C)}),y={modelId:e.modelId,description:e.description,end1:p(e.end1,i),end2:p(e.end2,a)},b={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:y.end1.attributeRef,targetColumnRef:y.end2.attributeRef,style:e.style};return{assoc:y,layout:b}}function rp(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 sp(e,t,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.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,g)=>Math.max(b,g.order),-1)+1:r.order??0,d={...Us(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(b=>rp(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...Ua(b),legacyEmbedRaw:b.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},m=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:m?d.modelId:void 0,targetColumnRef:m?void 0:d.modelId,style:e.style};return{assoc:f,layout:p}}function cp(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 Fs(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=cp(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 Hs(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 dp(e){return(e.schemaVersion??1)>=2&&"logical"in e?up(e):fp(e)}function up(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:m,...p}=f;return m!=null&&(o[f.modelId]=m),p},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout;Hs(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 fp(e){var _,C;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(h,E)=>{o.push(op(h));const Z=ip(h);Z.geo={location:{x:Z.geo.location.x+E.x,y:Z.geo.location.y+E.y},size:Z.geo.size},i.push(Z);for(const L of h.ownedAssociations??[])c.push(L)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const f=[];for(const h of e.groups??[]){const E=h.entities??[];r.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:E.map(L=>L.modelId)});const Z=((_=h.geo)==null?void 0:_.location)??u;if(h.geo){const L=(h.notes??[]).map(G=>G.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:L.length?L:void 0})}for(const L of E)d(L,Z);for(const L of h.notes??[])f.push(Fs(L,Z))}const m=new Map(o.map(h=>[h.modelId,h])),p=new Map,y=new Map;for(const h of o)for(const E of h.attributes)for(const Z of E.dbAttrs)p.set(Z.modelId,E.modelId),y.set(Z.modelId,Z);for(const h of c)for(const E of[h.end1,h.end2]){const Z=E.attribute;if(Z&&(((C=Z.dbAttrs)==null?void 0:C.length)??0)>0)for(const L of Z.dbAttrs)L.modelId&&p.set(L.modelId,Z.modelId)}for(const h of c){const E=Ps(h.end1.attribute),Z=Ps(h.end2.attribute),L=zs(h.end1)||zs(h.end2),{assoc:G,layout:T}=E!==Z||L?sp(h,m,y):lp(h,m,p);a.push(G),l.push(T)}Hs(o,a,l),$r(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(h=>Fs(h)),...f]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:g}}function Gs(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 mp(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(Gs),style:t}}function pp(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 hp(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 Ht(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 yp(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{...Gs(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function gp(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 bp(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 _p(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function wp(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:_p(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 kp(e,t,o){let i;for(const f of t.logical.entities){const m=f.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(m){i=m;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,m)=>wp(f,r[m]))},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:Ht(e.end1,c?s:u),end2:Ht(e.end2,c?u:s)}}function Ep(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:Ht(e.end1,e.end1.legacyEmbedRaw),end2:Ht(e.end2,e.end2.legacyEmbedRaw)};const a=kp(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(y=>y.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(y=>y.modelId===s.attributeRef),f=t.logical.entities.find(y=>y.modelId===c.entityRef),m=u?yp(u,f):void 0,p=s.legacyNavRaw;return{...i,end1:Ht(e.end1,l?p:m),end2:Ht(e.end2,r?p:m)}}return{...i,end1:Ht(e.end1),end2:Ht(e.end2)}}function Ys(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(m=>m.entityRef===e.modelId),r=t.logical.associations.filter(m=>m.end1.entityRef===e.modelId),s=m=>t.layout.associationLayouts.find(p=>p.associationRef===m),c=(l==null?void 0:l.geo)??{...Bs},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(m=>!o.has(m.modelId)&&!i.has(m.modelId)).map(m=>{var p;return mp(m,(p=l==null?void 0:l.attributeStyles)==null?void 0:p[m.modelId])}),operations:(u=e.operations)==null?void 0:u.map(m=>{var p;return pp(m,(p=l==null?void 0:l.operationStyles)==null?void 0:p[m.modelId])}),ownedAssociations:r.map(m=>Ep(m,t,s(m.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(hp),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 vp(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=>Ws(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>Ys(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 Ws(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 Np(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=gp(e),l=bp(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=>Ys(s,e,a,l)),groups:e.logical.groups.map(s=>vp(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>Ws(s))}}function Ip(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 io(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function At(e){return typeof e=="function"?e():n.unref(e)}const $p=typeof window<"u"&&typeof document<"u",xp=e=>typeof e<"u",Sp=Object.prototype.toString,Cp=e=>Sp.call(e)==="[object Object]",Rp=()=>{};function Vp(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 Ks=e=>e();function Ap(e=Ks){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 qs(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function Tp(e,t,o={}){const{eventFilter:i=Ks,...a}=o;return n.watch(e,Vp(i,t),a)}function Cn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=Ap(i);return{stop:Tp(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function Mp(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 Fa(e,t=!1){function o(f,{flush:m="sync",deep:p=!1,timeout:y,throwOnTimeout:b}={}){let g=null;const C=[new Promise(h=>{g=n.watch(e,E=>{f(E)!==t&&(g==null||g(),h(E))},{flush:m,deep:p,immediate:!0})})];return y!=null&&C.push(qs(y,b).then(()=>At(e)).finally(()=>g==null?void 0:g())),Promise.race(C)}function i(f,m){if(!n.isRef(f))return o(E=>E===f,m);const{flush:p="sync",deep:y=!1,timeout:b,throwOnTimeout:g}=m??{};let _=null;const h=[new Promise(E=>{_=n.watch([e,f],([Z,L])=>{t!==(Z===L)&&(_==null||_(),E(Z))},{flush:p,deep:y,immediate:!0})})];return b!=null&&h.push(qs(b,g).then(()=>At(e)).finally(()=>(_==null||_(),At(e)))),Promise.race(h)}function a(f){return o(m=>!!m,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,m){return o(p=>{const y=Array.from(p);return y.includes(f)||y.includes(At(f))},m)}function d(f){return u(1,f)}function u(f=1,m){let p=-1;return o(()=>(p+=1,p>=f),m)}return Array.isArray(At(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Fa(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Fa(e,!t)}}}function Ha(e){return Fa(e)}function Bp(e){var t;const o=At(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Xs=$p?window:void 0;function js(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Xs):[t,o,i,a]=e,!t)return Rp;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,m,p)=>(u.addEventListener(f,m,p),()=>u.removeEventListener(f,m,p)),c=n.watch(()=>[Bp(t),At(a)],([u,f])=>{if(r(),!u)return;const m=Cp(f)?{...f}:f;l.push(...o.flatMap(p=>i.map(y=>s(u,p,y,m))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return io(d),d}function Dp(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=Xs,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=Dp(t);return js(a,l,u=>{u.repeat&&At(s)||c(u)&&o(u)},r)}function Op(e){return JSON.parse(JSON.stringify(e))}function Ga(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:m}=i,p=n.getCurrentInstance(),y=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 g=h=>s?typeof s=="function"?s(h):Op(h):h,_=()=>xp(e[t])?g(e[t]):f,C=h=>{m?m(h)&&y(b,h):y(b,h)};if(c){const h=_(),E=n.ref(h);let Z=!1;return n.watch(()=>e[t],L=>{Z||(Z=!0,E.value=g(L),n.nextTick(()=>Z=!1))}),n.watch(E,L=>{!Z&&(L!==e[t]||u)&&C(L)},{deep:u}),E}else return n.computed({get(){return _()},set(h){C(h)}})}var Lp={value:()=>{}};function fi(){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 mi(o)}function mi(e){this._=e}function Pp(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}})}mi.prototype=fi.prototype={constructor:mi,on:function(e,t){var o=this._,i=Pp(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=zp(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]=Js(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Js(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 mi(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 zp(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Js(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Lp,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Ya="http://www.w3.org/1999/xhtml";const Qs={svg:"http://www.w3.org/2000/svg",xhtml:Ya,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Qs.hasOwnProperty(t)?{space:Qs[t],local:e}:e}function Up(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Ya&&t.documentElement.namespaceURI===Ya?t.createElement(e):t.createElementNS(o,e)}}function Fp(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ec(e){var t=pi(e);return(t.local?Fp:Up)(t)}function Hp(){}function Wa(e){return e==null?Hp:function(){return this.querySelector(e)}}function Gp(e){typeof e!="function"&&(e=Wa(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 dt(i,this._parents)}function Yp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Wp(){return[]}function tc(e){return e==null?Wp:function(){return this.querySelectorAll(e)}}function Kp(e){return function(){return Yp(e.apply(this,arguments))}}function qp(e){typeof e=="function"?e=Kp(e):e=tc(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 dt(i,a)}function nc(e){return function(){return this.matches(e)}}function oc(e){return function(t){return t.matches(e)}}var Xp=Array.prototype.find;function jp(e){return function(){return Xp.call(this.children,e)}}function Zp(){return this.firstElementChild}function Jp(e){return this.select(e==null?Zp:jp(typeof e=="function"?e:oc(e)))}var Qp=Array.prototype.filter;function eh(){return Array.from(this.children)}function th(e){return function(){return Qp.call(this.children,e)}}function nh(e){return this.selectAll(e==null?eh:th(typeof e=="function"?e:oc(e)))}function oh(e){typeof e!="function"&&(e=nc(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 dt(i,this._parents)}function ic(e){return new Array(e.length)}function ih(){return new dt(this._enter||this._groups.map(ic),this._parents)}function hi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}hi.prototype={constructor:hi,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 ah(e){return function(){return e}}function lh(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 hi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function rh(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,m=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(m[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 hi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(m[s])===c&&(a[s]=c)}function sh(e){return e.__data__}function ch(e,t){if(!arguments.length)return Array.from(this,sh);var o=t?rh:lh,i=this._parents,a=this._groups;typeof e!="function"&&(e=ah(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],m=f.length,p=dh(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),g=r[d]=new Array(y),_=c[d]=new Array(m);o(u,f,b,g,_,p,t);for(var C=0,h=0,E,Z;C<y;++C)if(E=b[C]){for(C>=h&&(h=C+1);!(Z=g[h])&&++h<y;);E._next=Z||null}}return r=new dt(r,i),r._enter=s,r._exit=c,r}function dh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function uh(){return new dt(this._exit||this._groups.map(ic),this._parents)}function fh(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 mh(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,m=s[c]=new Array(f),p,y=0;y<f;++y)(p=d[y]||u[y])&&(m[y]=p);for(;c<a;++c)s[c]=o[c];return new dt(s,this._parents)}function ph(){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 hh(e){e||(e=yh);function t(f,m){return f&&m?e(f.__data__,m.__data__):!f-!m}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 dt(a,this._parents).order()}function yh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function bh(){return Array.from(this)}function _h(){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 wh(){let e=0;for(const t of this)++e;return e}function kh(){return!this.node()}function Eh(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 vh(e){return function(){this.removeAttribute(e)}}function Nh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ih(e,t){return function(){this.setAttribute(e,t)}}function $h(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function xh(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Sh(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 Ch(e,t){var o=pi(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?Nh:vh:typeof t=="function"?o.local?Sh:xh:o.local?$h:Ih)(o,t))}function ac(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Rh(e){return function(){this.style.removeProperty(e)}}function Vh(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Ah(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Th(e,t,o){return arguments.length>1?this.each((t==null?Rh:typeof t=="function"?Ah:Vh)(e,t,o??"")):Rn(this.node(),e)}function Rn(e,t){return e.style.getPropertyValue(t)||ac(e).getComputedStyle(e,null).getPropertyValue(t)}function Mh(e){return function(){delete this[e]}}function Bh(e,t){return function(){this[e]=t}}function Dh(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Oh(e,t){return arguments.length>1?this.each((t==null?Mh:typeof t=="function"?Dh:Bh)(e,t)):this.node()[e]}function lc(e){return e.trim().split(/^|\s+/)}function Ka(e){return e.classList||new rc(e)}function rc(e){this._node=e,this._names=lc(e.getAttribute("class")||"")}rc.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 sc(e,t){for(var o=Ka(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function cc(e,t){for(var o=Ka(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Lh(e){return function(){sc(this,e)}}function Ph(e){return function(){cc(this,e)}}function zh(e,t){return function(){(t.apply(this,arguments)?sc:cc)(this,e)}}function Uh(e,t){var o=lc(e+"");if(arguments.length<2){for(var i=Ka(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?zh:t?Lh:Ph)(o,t))}function Fh(){this.textContent=""}function Hh(e){return function(){this.textContent=e}}function Gh(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Yh(e){return arguments.length?this.each(e==null?Fh:(typeof e=="function"?Gh:Hh)(e)):this.node().textContent}function Wh(){this.innerHTML=""}function Kh(e){return function(){this.innerHTML=e}}function qh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Xh(e){return arguments.length?this.each(e==null?Wh:(typeof e=="function"?qh:Kh)(e)):this.node().innerHTML}function jh(){this.nextSibling&&this.parentNode.appendChild(this)}function Zh(){return this.each(jh)}function Jh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Qh(){return this.each(Jh)}function ey(e){var t=typeof e=="function"?e:ec(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ty(){return null}function ny(e,t){var o=typeof e=="function"?e:ec(e),i=t==null?ty:typeof t=="function"?t:Wa(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function oy(){var e=this.parentNode;e&&e.removeChild(this)}function iy(){return this.each(oy)}function ay(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ly(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ry(e){return this.select(e?ly:ay)}function sy(e){return arguments.length?this.property("__data__",e):this.node().__data__}function cy(e){return function(t){e.call(this,t,this.__data__)}}function dy(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 uy(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 fy(e,t,o){return function(){var i=this.__on,a,l=cy(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 my(e,t,o){var i=dy(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?fy:uy,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function dc(e,t,o){var i=ac(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 py(e,t){return function(){return dc(this,e,t)}}function hy(e,t){return function(){return dc(this,e,t.apply(this,arguments))}}function yy(e,t){return this.each((typeof t=="function"?hy:py)(e,t))}function*gy(){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 uc=[null];function dt(e,t){this._groups=e,this._parents=t}function ao(){return new dt([[document.documentElement]],uc)}function by(){return this}dt.prototype=ao.prototype={constructor:dt,select:Gp,selectAll:qp,selectChild:Jp,selectChildren:nh,filter:oh,data:ch,enter:ih,exit:uh,join:fh,merge:mh,selection:by,order:ph,sort:hh,call:gh,nodes:bh,node:_h,size:wh,empty:kh,each:Eh,attr:Ch,style:Th,property:Oh,classed:Uh,text:Yh,html:Xh,raise:Zh,lower:Qh,append:ey,insert:ny,remove:iy,clone:ry,datum:sy,on:my,dispatch:yy,[Symbol.iterator]:gy};function pt(e){return typeof e=="string"?new dt([[document.querySelector(e)]],[document.documentElement]):new dt([[e]],uc)}function _y(e){let t;for(;t=e.sourceEvent;)e=t;return e}function kt(e,t){if(e=_y(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 wy={passive:!1},lo={capture:!0,passive:!1};function qa(e){e.stopImmediatePropagation()}function Vn(e){e.preventDefault(),e.stopImmediatePropagation()}function fc(e){var t=e.document.documentElement,o=pt(e).on("dragstart.drag",Vn,lo);"onselectstart"in t?o.on("selectstart.drag",Vn,lo):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function mc(e,t){var o=e.document.documentElement,i=pt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Vn,lo),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 yi=e=>()=>e;function Xa(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}})}Xa.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ky(e){return!e.ctrlKey&&!e.button}function Ey(){return this.parentNode}function vy(e,t){return t??{x:e.x,y:e.y}}function Ny(){return navigator.maxTouchPoints||"ontouchstart"in this}function Iy(){var e=ky,t=Ey,o=vy,i=Ny,a={},l=fi("start","drag","end"),r=0,s,c,d,u,f=0;function m(E){E.on("mousedown.drag",p).filter(i).on("touchstart.drag",g).on("touchmove.drag",_,wy).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(E,Z){if(!(u||!e.call(this,E,Z))){var L=h(this,t.call(this,E,Z),E,Z,"mouse");L&&(pt(E.view).on("mousemove.drag",y,lo).on("mouseup.drag",b,lo),fc(E.view),qa(E),d=!1,s=E.clientX,c=E.clientY,L("start",E))}}function y(E){if(Vn(E),!d){var Z=E.clientX-s,L=E.clientY-c;d=Z*Z+L*L>f}a.mouse("drag",E)}function b(E){pt(E.view).on("mousemove.drag mouseup.drag",null),mc(E.view,d),Vn(E),a.mouse("end",E)}function g(E,Z){if(e.call(this,E,Z)){var L=E.changedTouches,G=t.call(this,E,Z),T=L.length,S,O;for(S=0;S<T;++S)(O=h(this,G,E,Z,L[S].identifier,L[S]))&&(qa(E),O("start",E,L[S]))}}function _(E){var Z=E.changedTouches,L=Z.length,G,T;for(G=0;G<L;++G)(T=a[Z[G].identifier])&&(Vn(E),T("drag",E,Z[G]))}function C(E){var Z=E.changedTouches,L=Z.length,G,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),G=0;G<L;++G)(T=a[Z[G].identifier])&&(qa(E),T("end",E,Z[G]))}function h(E,Z,L,G,T,S){var O=l.copy(),te=kt(S||L,Z),M,oe,w;if((w=o.call(E,new Xa("beforestart",{sourceEvent:L,target:m,identifier:T,active:r,x:te[0],y:te[1],dx:0,dy:0,dispatch:O}),G))!=null)return M=w.x-te[0]||0,oe=w.y-te[1]||0,function j(A,W,Q){var ee=te,x;switch(A){case"start":a[T]=j,x=r++;break;case"end":delete a[T],--r;case"drag":te=kt(Q||W,Z),x=r;break}O.call(A,E,new Xa(A,{sourceEvent:W,subject:w,target:m,identifier:T,active:x,x:te[0]+M,y:te[1]+oe,dx:te[0]-ee[0],dy:te[1]-ee[1],dispatch:O}),G)}}return m.filter=function(E){return arguments.length?(e=typeof E=="function"?E:yi(!!E),m):e},m.container=function(E){return arguments.length?(t=typeof E=="function"?E:yi(E),m):t},m.subject=function(E){return arguments.length?(o=typeof E=="function"?E:yi(E),m):o},m.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:yi(!!E),m):i},m.on=function(){var E=l.on.apply(l,arguments);return E===l?m:E},m.clickDistance=function(E){return arguments.length?(f=(E=+E)*E,m):Math.sqrt(f)},m}function ja(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function pc(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function ro(){}var so=.7,gi=1/so,An="\\s*([+-]?\\d+)\\s*",co="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$y=/^#([0-9a-f]{3,8})$/,xy=new RegExp(`^rgb\\(${An},${An},${An}\\)$`),Sy=new RegExp(`^rgb\\(${Et},${Et},${Et}\\)$`),Cy=new RegExp(`^rgba\\(${An},${An},${An},${co}\\)$`),Ry=new RegExp(`^rgba\\(${Et},${Et},${Et},${co}\\)$`),Vy=new RegExp(`^hsl\\(${co},${Et},${Et}\\)$`),Ay=new RegExp(`^hsla\\(${co},${Et},${Et},${co}\\)$`),hc={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};ja(ro,nn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yc,formatHex:yc,formatHex8:Ty,formatHsl:My,formatRgb:gc,toString:gc});function yc(){return this.rgb().formatHex()}function Ty(){return this.rgb().formatHex8()}function My(){return Ec(this).formatHsl()}function gc(){return this.rgb().formatRgb()}function nn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=$y.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?bc(t):o===3?new rt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?bi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?bi(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=xy.exec(e))?new rt(t[1],t[2],t[3],1):(t=Sy.exec(e))?new rt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cy.exec(e))?bi(t[1],t[2],t[3],t[4]):(t=Ry.exec(e))?bi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Vy.exec(e))?kc(t[1],t[2]/100,t[3]/100,1):(t=Ay.exec(e))?kc(t[1],t[2]/100,t[3]/100,t[4]):hc.hasOwnProperty(e)?bc(hc[e]):e==="transparent"?new rt(NaN,NaN,NaN,0):null}function bc(e){return new rt(e>>16&255,e>>8&255,e&255,1)}function bi(e,t,o,i){return i<=0&&(e=t=o=NaN),new rt(e,t,o,i)}function By(e){return e instanceof ro||(e=nn(e)),e?(e=e.rgb(),new rt(e.r,e.g,e.b,e.opacity)):new rt}function Za(e,t,o,i){return arguments.length===1?By(e):new rt(e,t,o,i??1)}function rt(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}ja(rt,Za,pc(ro,{brighter(e){return e=e==null?gi:Math.pow(gi,e),new rt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?so:Math.pow(so,e),new rt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rt(on(this.r),on(this.g),on(this.b),_i(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:_c,formatHex:_c,formatHex8:Dy,formatRgb:wc,toString:wc}));function _c(){return`#${an(this.r)}${an(this.g)}${an(this.b)}`}function Dy(){return`#${an(this.r)}${an(this.g)}${an(this.b)}${an((isNaN(this.opacity)?1:this.opacity)*255)}`}function wc(){const e=_i(this.opacity);return`${e===1?"rgb(":"rgba("}${on(this.r)}, ${on(this.g)}, ${on(this.b)}${e===1?")":`, ${e})`}`}function _i(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function on(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function an(e){return e=on(e),(e<16?"0":"")+e.toString(16)}function kc(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new ht(e,t,o,i)}function Ec(e){if(e instanceof ht)return new ht(e.h,e.s,e.l,e.opacity);if(e instanceof ro||(e=nn(e)),!e)return new ht;if(e instanceof ht)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 ht(r,s,c,e.opacity)}function Oy(e,t,o,i){return arguments.length===1?Ec(e):new ht(e,t,o,i??1)}function ht(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}ja(ht,Oy,pc(ro,{brighter(e){return e=e==null?gi:Math.pow(gi,e),new ht(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?so:Math.pow(so,e),new ht(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 rt(Ja(e>=240?e-240:e+120,a,i),Ja(e,a,i),Ja(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new ht(vc(this.h),wi(this.s),wi(this.l),_i(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=_i(this.opacity);return`${e===1?"hsl(":"hsla("}${vc(this.h)}, ${wi(this.s)*100}%, ${wi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vc(e){return e=(e||0)%360,e<0?e+360:e}function wi(e){return Math.max(0,Math.min(1,e||0))}function Ja(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 Qa=e=>()=>e;function Ly(e,t){return function(o){return e+o*t}}function Py(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 zy(e){return(e=+e)==1?Nc:function(t,o){return o-t?Py(t,o,e):Qa(isNaN(t)?o:t)}}function Nc(e,t){var o=t-e;return o?Ly(e,o):Qa(isNaN(e)?t:e)}const ki=(function e(t){var o=zy(t);function i(a,l){var r=o((a=Za(a)).r,(l=Za(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Nc(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 Uy(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 Fy(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Hy(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]=uo(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 Gy(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function vt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Yy(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]=uo(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var el=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tl=new RegExp(el.source,"g");function Wy(e){return function(){return e}}function Ky(e){return function(t){return e(t)+""}}function Ic(e,t){var o=el.lastIndex=tl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=el.exec(e))&&(a=tl.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:vt(i,a)})),o=tl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Ky(c[0].x):Wy(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 uo(e,t){var o=typeof t,i;return t==null||o==="boolean"?Qa(t):(o==="number"?vt:o==="string"?(i=nn(t))?(t=i,ki):Ic:t instanceof nn?ki:t instanceof Date?Gy:Fy(t)?Uy:Array.isArray(t)?Hy:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Yy:vt)(e,t)}var $c=180/Math.PI,nl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function xc(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)*$c,skewX:Math.atan(c)*$c,scaleX:r,scaleY:s}}var Ei;function qy(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?nl:xc(t.a,t.b,t.c,t.d,t.e,t.f)}function Xy(e){return e==null||(Ei||(Ei=document.createElementNS("http://www.w3.org/2000/svg","g")),Ei.setAttribute("transform",e),!(e=Ei.transform.baseVal.consolidate()))?nl:(e=e.matrix,xc(e.a,e.b,e.c,e.d,e.e,e.f))}function Sc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,m,p,y){if(d!==f||u!==m){var b=p.push("translate(",null,t,null,o);y.push({i:b-4,x:vt(d,f)},{i:b-2,x:vt(u,m)})}else(f||m)&&p.push("translate("+f+t+m+o)}function r(d,u,f,m){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),m.push({i:f.push(a(f)+"rotate(",null,i)-2,x:vt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,m){d!==u?m.push({i:f.push(a(f)+"skewX(",null,i)-2,x:vt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,m,p,y){if(d!==f||u!==m){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:vt(d,f)},{i:b-2,x:vt(u,m)})}else(f!==1||m!==1)&&p.push(a(p)+"scale("+f+","+m+")")}return function(d,u){var f=[],m=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,m),r(d.rotate,u.rotate,f,m),s(d.skewX,u.skewX,f,m),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,m),d=u=null,function(p){for(var y=-1,b=m.length,g;++y<b;)f[(g=m[y]).i]=g.x(p);return f.join("")}}}var jy=Sc(qy,"px, ","px)","deg)"),Zy=Sc(Xy,", ",")",")"),Jy=1e-12;function Cc(e){return((e=Math.exp(e))+1/e)/2}function Qy(e){return((e=Math.exp(e))-1/e)/2}function eg(e){return((e=Math.exp(2*e))-1)/(e+1)}const vi=(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],m=r[2],p=u-s,y=f-c,b=p*p+y*y,g,_;if(b<Jy)_=Math.log(m/d)/t,g=function(G){return[s+G*p,c+G*y,d*Math.exp(t*G*_)]};else{var C=Math.sqrt(b),h=(m*m-d*d+i*b)/(2*d*o*C),E=(m*m-d*d-i*b)/(2*m*o*C),Z=Math.log(Math.sqrt(h*h+1)-h),L=Math.log(Math.sqrt(E*E+1)-E);_=(L-Z)/t,g=function(G){var T=G*_,S=Cc(Z),O=d/(o*C)*(S*eg(t*T+Z)-Qy(Z));return[s+O*p,c+O*y,d*S/Cc(t*T+Z)]}}return g.duration=_*1e3*t/Math.SQRT2,g}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 Tn=0,fo=0,mo=0,Rc=1e3,Ni,po,Ii=0,ln=0,$i=0,ho=typeof performance=="object"&&performance.now?performance:Date,Vc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ol(){return ln||(Vc(tg),ln=ho.now()+$i)}function tg(){ln=0}function xi(){this._call=this._time=this._next=null}xi.prototype=Ac.prototype={constructor:xi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ol():+o)+(t==null?0:+t),!this._next&&po!==this&&(po?po._next=this:Ni=this,po=this),this._call=e,this._time=o,il()},stop:function(){this._call&&(this._call=null,this._time=1/0,il())}};function Ac(e,t,o){var i=new xi;return i.restart(e,t,o),i}function ng(){ol(),++Tn;for(var e=Ni,t;e;)(t=ln-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Tn}function Tc(){ln=(Ii=ho.now())+$i,Tn=fo=0;try{ng()}finally{Tn=0,ig(),ln=0}}function og(){var e=ho.now(),t=e-Ii;t>Rc&&($i-=t,Ii=e)}function ig(){for(var e,t=Ni,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:Ni=o);po=e,il(i)}function il(e){if(!Tn){fo&&(fo=clearTimeout(fo));var t=e-ln;t>24?(e<1/0&&(fo=setTimeout(Tc,e-ho.now()-$i)),mo&&(mo=clearInterval(mo))):(mo||(Ii=ho.now(),mo=setInterval(og,Rc)),Tn=1,Vc(Tc))}}function Mc(e,t,o){var i=new xi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var ag=fi("start","end","cancel","interrupt"),lg=[],Bc=0,Dc=1,al=2,Si=3,Oc=4,ll=5,Ci=6;function Ri(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;rg(e,o,{name:t,index:i,group:a,on:ag,tween:lg,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Bc})}function rl(e,t){var o=yt(e,t);if(o.state>Bc)throw new Error("too late; already scheduled");return o}function Nt(e,t){var o=yt(e,t);if(o.state>Si)throw new Error("too late; already running");return o}function yt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function rg(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Ac(l,0,o.time);function l(d){o.state=Dc,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,m,p;if(o.state!==Dc)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Si)return Mc(r);p.state===Oc?(p.state=Ci,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=Ci,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Mc(function(){o.state===Si&&(o.state=Oc,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=al,o.on.call("start",e,e.__data__,o.index,o.group),o.state===al){for(o.state=Si,a=new Array(m=o.tween.length),u=0,f=-1;u<m;++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=ll,1),f=-1,m=a.length;++f<m;)a[f].call(e,u);o.state===ll&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ci,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>al&&i.state<ll,i.state=Ci,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function sg(e){return this.each(function(){Vi(this,e)})}function cg(e,t){var o,i;return function(){var a=Nt(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 dg(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=Nt(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 ug(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=yt(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?cg:dg)(o,e,t))}function sl(e,t,o){var i=e._id;return e.each(function(){var a=Nt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return yt(a,i).value[t]}}function Lc(e,t){var o;return(typeof t=="number"?vt:t instanceof nn?ki:(o=nn(t))?(t=o,ki):Ic)(e,t)}function fg(e){return function(){this.removeAttribute(e)}}function mg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pg(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 hg(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 yg(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 gg(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 bg(e,t){var o=pi(e),i=o==="transform"?Zy:Lc;return this.attrTween(e,typeof t=="function"?(o.local?gg:yg)(o,i,sl(this,"attr."+e,t)):t==null?(o.local?mg:fg)(o):(o.local?hg:pg)(o,i,t))}function _g(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function wg(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function kg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&wg(e,l)),o}return a._value=t,a}function Eg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&_g(e,l)),o}return a._value=t,a}function vg(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=pi(e);return this.tween(o,(i.local?kg:Eg)(i,t))}function Ng(e,t){return function(){rl(this,e).delay=+t.apply(this,arguments)}}function Ig(e,t){return t=+t,function(){rl(this,e).delay=t}}function $g(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ng:Ig)(t,e)):yt(this.node(),t).delay}function xg(e,t){return function(){Nt(this,e).duration=+t.apply(this,arguments)}}function Sg(e,t){return t=+t,function(){Nt(this,e).duration=t}}function Cg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xg:Sg)(t,e)):yt(this.node(),t).duration}function Rg(e,t){if(typeof t!="function")throw new Error;return function(){Nt(this,e).ease=t}}function Vg(e){var t=this._id;return arguments.length?this.each(Rg(t,e)):yt(this.node(),t).ease}function Ag(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Nt(this,e).ease=o}}function Tg(e){if(typeof e!="function")throw new Error;return this.each(Ag(this._id,e))}function Mg(e){typeof e!="function"&&(e=nc(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 Bg(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),m,p=0;p<u;++p)(m=c[p]||d[p])&&(f[p]=m);for(;s<i;++s)r[s]=t[s];return new Tt(r,this._parents,this._name,this._id)}function Dg(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 Og(e,t,o){var i,a,l=Dg(t)?rl:Nt;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Lg(e,t){var o=this._id;return arguments.length<2?yt(this.node(),o).on.on(e):this.each(Og(o,e,t))}function Pg(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function zg(){return this.on("end.remove",Pg(this._id))}function Ug(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Wa(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,m=0;m<c;++m)(u=s[m])&&(f=e.call(u,u.__data__,m,s))&&("__data__"in u&&(f.__data__=u.__data__),d[m]=f,Ri(d[m],t,o,m,d,yt(u,o)));return new Tt(l,this._parents,t,o)}function Fg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=tc(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 m=e.call(u,u.__data__,f,c),p,y=yt(u,o),b=0,g=m.length;b<g;++b)(p=m[b])&&Ri(p,t,o,b,m,y);l.push(m),r.push(u)}return new Tt(l,r,t,o)}var Hg=ao.prototype.constructor;function Gg(){return new Hg(this._groups,this._parents)}function Yg(e,t){var o,i,a;return function(){var l=Rn(this,e),r=(this.style.removeProperty(e),Rn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Pc(e){return function(){this.style.removeProperty(e)}}function Wg(e,t,o){var i,a=o+"",l;return function(){var r=Rn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Kg(e,t,o){var i,a,l;return function(){var r=Rn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Rn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function qg(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=Nt(this,e),d=c.on,u=c.value[l]==null?s||(s=Pc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Xg(e,t,o){var i=(e+="")=="transform"?jy:Lc;return t==null?this.styleTween(e,Yg(e,i)).on("end.style."+e,Pc(e)):typeof t=="function"?this.styleTween(e,Kg(e,i,sl(this,"style."+e,t))).each(qg(this._id,e)):this.styleTween(e,Wg(e,i,t),o).on("end.style."+e,null)}function jg(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Zg(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&jg(e,r,o)),i}return l._value=t,l}function Jg(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,Zg(e,t,o??""))}function Qg(e){return function(){this.textContent=e}}function eb(e){return function(){var t=e(this);this.textContent=t??""}}function tb(e){return this.tween("text",typeof e=="function"?eb(sl(this,"text",e)):Qg(e==null?"":e+""))}function nb(e){return function(t){this.textContent=e.call(this,t)}}function ob(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&nb(a)),t}return i._value=e,i}function ib(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,ob(e))}function ab(){for(var e=this._name,t=this._id,o=zc(),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=yt(c,t);Ri(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 lb(){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=Nt(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 rb=0;function Tt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function zc(){return++rb}var Mt=ao.prototype;Tt.prototype={constructor:Tt,select:Ug,selectAll:Fg,selectChild:Mt.selectChild,selectChildren:Mt.selectChildren,filter:Mg,merge:Bg,selection:Gg,transition:ab,call:Mt.call,nodes:Mt.nodes,node:Mt.node,size:Mt.size,empty:Mt.empty,each:Mt.each,on:Lg,attr:bg,attrTween:vg,style:Xg,styleTween:Jg,text:tb,textTween:ib,remove:zg,tween:ug,delay:$g,duration:Cg,ease:Vg,easeVarying:Tg,end:lb,[Symbol.iterator]:Mt[Symbol.iterator]};function sb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cb={time:null,delay:0,duration:250,ease:sb};function db(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 ub(e){var t,o;e instanceof Tt?(t=e._id,e=e._name):(t=zc(),(o=cb).time=ol(),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])&&Ri(c,e,t,d,r,o||db(c,t));return new Tt(i,this._parents,e,t)}ao.prototype.interrupt=sg,ao.prototype.transition=ub;const Ai=e=>()=>e;function fb(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 Mn=new Bt(1,0,0);Bt.prototype;function cl(e){e.stopImmediatePropagation()}function yo(e){e.preventDefault(),e.stopImmediatePropagation()}function mb(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pb(){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 Uc(){return this.__zoom||Mn}function hb(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yb(){return navigator.maxTouchPoints||"ontouchstart"in this}function gb(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 bb(){var e=mb,t=pb,o=gb,i=hb,a=yb,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=vi,d=fi("start","zoom","end"),u,f,m,p=500,y=150,b=0,g=10;function _(w){w.property("__zoom",Uc).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",O).filter(a).on("touchstart.zoom",te).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,j,A,W){var Q=w.selection?w.selection():w;Q.property("__zoom",Uc),w!==Q?Z(w,j,A,W):Q.interrupt().each(function(){L(this,arguments).event(W).start().zoom(null,typeof j=="function"?j.apply(this,arguments):j).end()})},_.scaleBy=function(w,j,A,W){_.scaleTo(w,function(){var Q=this.__zoom.k,ee=typeof j=="function"?j.apply(this,arguments):j;return Q*ee},A,W)},_.scaleTo=function(w,j,A,W){_.transform(w,function(){var Q=t.apply(this,arguments),ee=this.__zoom,x=A==null?E(Q):typeof A=="function"?A.apply(this,arguments):A,X=ee.invert(x),le=typeof j=="function"?j.apply(this,arguments):j;return o(h(C(ee,le),x,X),Q,r)},A,W)},_.translateBy=function(w,j,A,W){_.transform(w,function(){return o(this.__zoom.translate(typeof j=="function"?j.apply(this,arguments):j,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),r)},null,W)},_.translateTo=function(w,j,A,W,Q){_.transform(w,function(){var ee=t.apply(this,arguments),x=this.__zoom,X=W==null?E(ee):typeof W=="function"?W.apply(this,arguments):W;return o(Mn.translate(X[0],X[1]).scale(x.k).translate(typeof j=="function"?-j.apply(this,arguments):-j,typeof A=="function"?-A.apply(this,arguments):-A),ee,r)},W,Q)};function C(w,j){return j=Math.max(l[0],Math.min(l[1],j)),j===w.k?w:new Bt(j,w.x,w.y)}function h(w,j,A){var W=j[0]-A[0]*w.k,Q=j[1]-A[1]*w.k;return W===w.x&&Q===w.y?w:new Bt(w.k,W,Q)}function E(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function Z(w,j,A,W){w.on("start.zoom",function(){L(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){L(this,arguments).event(W).end()}).tween("zoom",function(){var Q=this,ee=arguments,x=L(Q,ee).event(W),X=t.apply(Q,ee),le=A==null?E(X):typeof A=="function"?A.apply(Q,ee):A,pe=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),be=Q.__zoom,de=typeof j=="function"?j.apply(Q,ee):j,me=c(be.invert(le).concat(pe/be.k),de.invert(le).concat(pe/de.k));return function(ye){if(ye===1)ye=de;else{var ve=me(ye),Ce=pe/ve[2];ye=new Bt(Ce,le[0]-ve[0]*Ce,le[1]-ve[1]*Ce)}x.zoom(null,ye)}})}function L(w,j,A){return!A&&w.__zooming||new G(w,j)}function G(w,j){this.that=w,this.args=j,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,j),this.taps=0}G.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,j){return this.mouse&&w!=="mouse"&&(this.mouse[1]=j.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=j.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=j.invert(this.touch1[0])),this.that.__zoom=j,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var j=pt(this.that).datum();d.call(w,this.that,new fb(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),j)}};function T(w,...j){if(!e.apply(this,arguments))return;var A=L(this,j).event(w),W=this.__zoom,Q=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,i.apply(this,arguments)))),ee=kt(w);if(A.wheel)(A.mouse[0][0]!==ee[0]||A.mouse[0][1]!==ee[1])&&(A.mouse[1]=W.invert(A.mouse[0]=ee)),clearTimeout(A.wheel);else{if(W.k===Q)return;A.mouse=[ee,W.invert(ee)],Vi(this),A.start()}yo(w),A.wheel=setTimeout(x,y),A.zoom("mouse",o(h(C(W,Q),A.mouse[0],A.mouse[1]),A.extent,r));function x(){A.wheel=null,A.end()}}function S(w,...j){if(m||!e.apply(this,arguments))return;var A=w.currentTarget,W=L(this,j,!0).event(w),Q=pt(w.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",pe,!0),ee=kt(w,A),x=w.clientX,X=w.clientY;fc(w.view),cl(w),W.mouse=[ee,this.__zoom.invert(ee)],Vi(this),W.start();function le(be){if(yo(be),!W.moved){var de=be.clientX-x,me=be.clientY-X;W.moved=de*de+me*me>b}W.event(be).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=kt(be,A),W.mouse[1]),W.extent,r))}function pe(be){Q.on("mousemove.zoom mouseup.zoom",null),mc(be.view,W.moved),yo(be),W.event(be).end()}}function O(w,...j){if(e.apply(this,arguments)){var A=this.__zoom,W=kt(w.changedTouches?w.changedTouches[0]:w,this),Q=A.invert(W),ee=A.k*(w.shiftKey?.5:2),x=o(h(C(A,ee),W,Q),t.apply(this,j),r);yo(w),s>0?pt(this).transition().duration(s).call(Z,x,W,w):pt(this).call(_.transform,x,W,w)}}function te(w,...j){if(e.apply(this,arguments)){var A=w.touches,W=A.length,Q=L(this,j,w.changedTouches.length===W).event(w),ee,x,X,le;for(cl(w),x=0;x<W;++x)X=A[x],le=kt(X,this),le=[le,this.__zoom.invert(le),X.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==le[2]&&(Q.touch1=le,Q.taps=0):(Q.touch0=le,ee=!0,Q.taps=1+!!u);u&&(u=clearTimeout(u)),ee&&(Q.taps<2&&(f=le[0],u=setTimeout(function(){u=null},p)),Vi(this),Q.start())}}function M(w,...j){if(this.__zooming){var A=L(this,j).event(w),W=w.changedTouches,Q=W.length,ee,x,X,le;for(yo(w),ee=0;ee<Q;++ee)x=W[ee],X=kt(x,this),A.touch0&&A.touch0[2]===x.identifier?A.touch0[0]=X:A.touch1&&A.touch1[2]===x.identifier&&(A.touch1[0]=X);if(x=A.that.__zoom,A.touch1){var pe=A.touch0[0],be=A.touch0[1],de=A.touch1[0],me=A.touch1[1],ye=(ye=de[0]-pe[0])*ye+(ye=de[1]-pe[1])*ye,ve=(ve=me[0]-be[0])*ve+(ve=me[1]-be[1])*ve;x=C(x,Math.sqrt(ye/ve)),X=[(pe[0]+de[0])/2,(pe[1]+de[1])/2],le=[(be[0]+me[0])/2,(be[1]+me[1])/2]}else if(A.touch0)X=A.touch0[0],le=A.touch0[1];else return;A.zoom("touch",o(h(x,X,le),A.extent,r))}}function oe(w,...j){if(this.__zooming){var A=L(this,j).event(w),W=w.changedTouches,Q=W.length,ee,x;for(cl(w),m&&clearTimeout(m),m=setTimeout(function(){m=null},p),ee=0;ee<Q;++ee)x=W[ee],A.touch0&&A.touch0[2]===x.identifier?delete A.touch0:A.touch1&&A.touch1[2]===x.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(x=kt(x,this),Math.hypot(f[0]-x[0],f[1]-x[1])<g)){var X=pt(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Ai(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ai(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Ai(!!w),_):a},_.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Ai([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):t},_.scaleExtent=function(w){return arguments.length?(l[0]=+w[0],l[1]=+w[1],_):[l[0],l[1]]},_.translateExtent=function(w){return arguments.length?(r[0][0]=+w[0][0],r[1][0]=+w[1][0],r[0][1]=+w[0][1],r[1][1]=+w[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,_):Math.sqrt(b)},_.tapDistance=function(w){return arguments.length?(g=+w,_):g},_}var Se=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Se||{}),dl=(e=>(e.Partial="partial",e.Full="full",e))(dl||{}),rn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(rn||{}),Dt=(e=>(e.Strict="strict",e.Loose="loose",e))(Dt||{}),ul=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(ul||{}),go=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(go||{}),Fc=(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))(Fc||{});const _b=["INPUT","SELECT","TEXTAREA"],wb=typeof document<"u"?document:null;function fl(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 _b.includes(i==null?void 0:i.nodeName)||a||!!l}function kb(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Hc(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 gb(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=bb(o.code,e);return Array.isArray(e)?e.some(a=>Lc(o[i],a,t,o.type==="keyup")):Lc(o[i],e,t,o.type==="keyup")}}function bb(e,t){return t.includes(e)?"code":"key"}function yo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??hb),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}),Ys(["blur","contextmenu"],s),Ws((...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=yb(d),(!a||a&&!h)&&sl(d))return;const g=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,y=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!p&&(a||!y)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Ws((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&sl(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"?gb(d,l):d}return i}const Pc="vue-flow__node-desc",zc="vue-flow__edge-desc",_b="vue-flow__aria-live",Uc=["Enter"," ","Escape"],Mn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ri(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Vi(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 Ai(e){return{width:e.offsetWidth,height:e.offsetHeight}}function rn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Fc(e,t){return{x:rn(e.x,t[0][0],t[1][0]),y:rn(e.y,t[0][1],t[1][1])}}function Hc(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 go(e){return sn(e)&&"computedPosition"in e}function Ti(e){return!Number.isNaN(e)&&Number.isFinite(e)}function kb(e){return Ti(e.width)&&Ti(e.height)&&Ti(e.x)&&Ti(e.y)}function wb(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 Gc(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 Yc(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 Eb(...e){if(e.length===3){const[l,r,s]=e;return Yc(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 vb(...e){if(e.length===3){const[l,r,s]=e;return Yc(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 Wc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function Nb(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 bo({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function _o({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?Bi(s,r):s}function Kc(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 Mi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function qc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function $b(e,t){return qc(Kc(Mi(e),Mi(t)))}function cl(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=Kc(t,Mi({...i.computedPosition,...i.dimensions}))}return qc(t)}function Xc(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={..._o(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=Vi(l,Ri(s)),m=f===null||h===null,g=i&&p>0,y=(f??0)*(h??0);(m||g||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 Bn(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 Eo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xb(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Bn(e,o),a=Bn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Bn(e.top??e.y??0,o),a=Bn(e.bottom??e.y??0,o),l=Bn(e.left??e.x??0,t),r=Bn(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 Ib(e,t,o,i,a,l){const{x:r,y:s}=bo(e,{x:t,y:o,zoom:i}),{x:c,y:d}=bo({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 jc(e,t,o,i,a,l=.1){const r=xb(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,g=Ib(e,p,m,u,t,o),y={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:p-y.left+y.right,y:m-y.top+y.bottom,zoom:u}}function Sb(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Zc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Zc(o,t):!1}function ko(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function dl(e){const t=e.ctrlKey&&wo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Jc(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 Qc(e,t,o=15,i=40){const a=Jc(e.x,i,t.width-i)*o,l=Jc(e.y,i,t.height-i)*o;return[a,l]}function ul(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 ed(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(go(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&&go(c)&&ul(r,c)}break;case"dimensions":if(go(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&&go(c)&&(!!c.dimensions.width&&!!c.dimensions.height?ul(r,c):n.nextTick(()=>{ul(r,c)}))}break}return t}function Yt(e,t){return{id:e,type:"select",selected:t}}function td(e){return{item:e,type:"add"}}function nd(e){return{id:e,type:"remove"}}function od(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 id=()=>{};function xe(e){const t=new Set;let o=id,i=()=>!1;const a=()=>t.size>0||i(),l=h=>{o=h},r=()=>{o=id},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{t.delete(h)};return{on:h=>{t.add(h);const p=()=>d(h);return no(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 ad(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 Cb(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Zc(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 fl({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 ld(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 Rb(e,t,o){const[i,a,l,r]=typeof e!="string"?ld(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=Rb(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]=ld(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 Ab({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function ml(e,t,o,i,a){const l=Ab(e.dimensions,Vb(e,o,i,a)),r=Fc(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 Dn(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??Db(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 rd(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function Tb({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=Mi({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 Mb(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 sd={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 Eb(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=vb(o.code,e);return Array.isArray(e)?e.some(a=>Hc(o[i],a,t,o.type==="keyup")):Hc(o[i],e,t,o.type==="keyup")}}function vb(e,t){return t.includes(e)?"code":"key"}function bo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??wb),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}),js(["blur","contextmenu"],s),Zs((...d)=>r(...d),d=>{var u,f;const m=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,p=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=kb(d),(!a||a&&!m)&&fl(d))return;const b=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,g=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!p&&(a||!g)&&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)&&fl(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"?Eb(d,l):d}return i}const Gc="vue-flow__node-desc",Yc="vue-flow__edge-desc",Nb="vue-flow__aria-live",Wc=["Enter"," ","Escape"],Bn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ti(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Mi(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 Bi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function sn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Kc(e,t){return{x:sn(e.x,t[0][0],t[1][0]),y:sn(e.y,t[0][1],t[1][1])}}function qc(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 cn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Gt(e)}function _o(e){return cn(e)&&"computedPosition"in e}function Di(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Ib(e){return Di(e.width)&&Di(e.height)&&Di(e.x)&&Di(e.y)}function $b(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 Xc(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 jc(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 xb(...e){if(e.length===3){const[l,r,s]=e;return jc(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=>cn(r)&&r.id===l.target))}function Sb(...e){if(e.length===3){const[l,r,s]=e;return jc(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=>cn(r)&&r.id===l.source))}function Zc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function Cb(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 wo({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function ko({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?Li(s,r):s}function Jc(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 Oi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function Qc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function Rb(e,t){return Qc(Jc(Oi(e),Oi(t)))}function ml(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=Jc(t,Oi({...i.computedPosition,...i.dimensions}))}return Qc(t)}function ed(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...ko(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,m=c.height??s.height??null;if(a&&!d||u)continue;const p=Mi(l,Ti(s)),y=f===null||m===null,b=i&&p>0,g=(f??0)*(m??0);(y||b||p>=g||s.dragging)&&r.push(s)}return r}function dn(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 Dn(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 No(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Vb(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Dn(e,o),a=Dn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Dn(e.top??e.y??0,o),a=Dn(e.bottom??e.y??0,o),l=Dn(e.left??e.x??0,t),r=Dn(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 Ab(e,t,o,i,a,l){const{x:r,y:s}=wo(e,{x:t,y:o,zoom:i}),{x:c,y:d}=wo({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 td(e,t,o,i,a,l=.1){const r=Vb(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=sn(d,i,a),f=e.x+e.width/2,m=e.y+e.height/2,p=t/2-f*u,y=o/2-m*u,b=Ab(e,p,y,u,t,o),g={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-g.left+g.right,y:y-g.top+g.bottom,zoom:u}}function Tb(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function nd(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:nd(o,t):!1}function Eo(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function pl(e){const t=e.ctrlKey&&vo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function od(e,t,o){return e<t?sn(Math.abs(e-t),1,t)/t:e>o?-sn(Math.abs(e-o),1,t)/t:0}function id(e,t,o=15,i=40){const a=od(e.x,i,t.width-i)*o,l=od(e.y,i,t.height-i)*o;return[a,l]}function hl(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 ad(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(_o(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&&_o(c)&&hl(r,c)}break;case"dimensions":if(_o(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&&_o(c)&&(!!c.dimensions.width&&!!c.dimensions.height?hl(r,c):n.nextTick(()=>{hl(r,c)}))}break}return t}function Yt(e,t){return{id:e,type:"select",selected:t}}function ld(e){return{item:e,type:"add"}}function rd(e){return{id:e,type:"remove"}}function sd(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 cd=()=>{};function $e(e){const t=new Set;let o=cd,i=()=>!1;const a=()=>t.size>0||i(),l=m=>{o=m},r=()=>{o=cd},s=m=>{i=m},c=()=>{i=()=>!1},d=m=>{t.delete(m)};return{on:m=>{t.add(m);const p=()=>d(m);return io(p),{off:p}},off:d,trigger:m=>{const p=[o];return a()?p.push(...t):e&&p.push(e),Promise.allSettled(p.map(y=>y(m)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function dd(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 Mb(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!nd(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 yl({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 ud(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 Bb(e,t,o){const[i,a,l,r]=typeof e!="string"?ud(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 Db(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=Bb(a,e,i);l&&(a=l)}else t(new Je(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]=ud(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 Ob({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function gl(e,t,o,i,a){const l=Ob(e.dimensions,Db(e,o,i,a)),r=Kc(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 On(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??Ub(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 fd(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function Lb({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=Oi({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)),m=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*m)>0}function Pb(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 md={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,18 +26,18 @@ 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=sd[t])==null?void 0:i.call(sd,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function pl(e){return"clientX"in e}function Bb(e){return"sourceEvent"in e}function xt(e,t){const o=pl(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 wo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Db(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 Bi(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Ob=()=>!0;function hl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Lb(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())Vi(a,Ri(l))>0&&i.push(l);return i}const Pb=250;function zb(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Lb(e,o,t+Pb);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}=Dn(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 cd(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=Ob},u,f,h,p){const m=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:y,y:_}=xt(e),A=r.elementFromPoint(y,_),b=A!=null&&A.classList.contains(`${s}-flow__handle`)?A:g,v={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const te=dd(void 0,b),I=b.getAttribute("data-nodeid"),P=b.getAttribute("data-handleid"),x=b.classList.contains("connectable"),O=b.classList.contains("connectableend");if(!I||!te)return v;const H={source:m?I:i,sourceHandle:m?P:a,target:m?i:I,targetHandle:m?a:P};v.connection=H;const z=x&&O&&(o===Dt.Strict?m&&te==="source"||!m&&te==="target":I!==i||P!==a);v.isValid=z&&d(H,{nodes:f,edges:u,sourceNode:h(H.source),targetNode:h(H.target)}),v.toHandle=ud(I,te,P,p,o,!0)}return v}function dd(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ub(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Fb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function ud(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,...Dn(d,f,f.position,!0)}:f}const yl={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top},Hb=["production","prod"];function Eo(e,...t){fd()&&console.warn(`[Vue Flow]: ${e}`,...t)}function fd(){return!Hb.includes(process.env.NODE_ENV||"")}function md(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,...Ai(r)}}):null}function gl(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 Gb(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:Wc(e)},a=Gc(a,void 0,i),Nb(a,t)?!1:a}function Yb(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?Wc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function pd(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=wb(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 hd(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 bl(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}`;hd("source",c,u,e,a,r),hd("target",c,d,e,l,s)}}function yd(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function _l(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Gt(d)?d:Gb(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({...Gc(u,p,l),sourceNode:f,targetNode:h})}return c}const gd=Symbol("vueFlow"),bd=Symbol("nodeId"),_d=Symbol("nodeRef"),Wb=Symbol("edgeId"),Kb=Symbol("edgeRef"),Di=Symbol("slots");function kd(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:g,selectNodesOnDrag:y,removeSelectedElements:_,addSelectedNodes:A,updateNodePositions:b,emits:v}=ze(),{onStart:te,onDrag:I,onStop:P,onClick:x,el:O,disabled:H,id:de,selectable:z,dragHandle:oe}=e,k=n.shallowRef(!1);let W=[],R,G=null,F={x:void 0,y:void 0},le={x:0,y:0},$=null,X=!1,re=!1,pe=0,ye=!1;const ue=jb(),fe=({x:Z,y:K})=>{F={x:Z,y:K};let w=!1;if(W=W.map(S=>{const C={x:Z-S.distance.x,y:K-S.distance.y},{computedPosition:Y}=ml(S,o.value?Bi(C,i.value):C,v.error,r.value,S.parentNode?p(S.parentNode):void 0);return w=w||S.position.x!==Y.x||S.position.y!==Y.y,S.position=Y,S}),re=re||w,!!w&&(b(W,!0,!0),k.value=!0,$)){const[S,C]=fl({id:de,dragItems:W,findNode:p});I({event:$,node:S,nodes:C})}},ge=()=>{if(!G)return;const[Z,K]=Qc(le,G,u.value);if(Z!==0||K!==0){const w={x:(F.x??0)-Z/c.value.zoom,y:(F.y??0)-K/c.value.zoom};h({x:Z,y:K})&&fe(w)}pe=requestAnimationFrame(ge)},Ee=(Z,K)=>{X=!0;const w=p(de);!y.value&&!m.value&&w&&(w.selected||_()),w&&n.toValue(z)&&y.value&&gl(w,m.value,A,_,g,!1,K);const S=ue(Z.sourceEvent);if(F=S,W=Cb(l.value,f.value,S,de),W.length){const[C,Y]=fl({id:de,dragItems:W,findNode:p});te({event:Z.sourceEvent,node:C,nodes:Y})}},Re=(Z,K)=>{var w;Z.sourceEvent.type==="touchmove"&&Z.sourceEvent.touches.length>1||(re=!1,s.value===0&&Ee(Z,K),F=ue(Z.sourceEvent),G=((w=t.value)==null?void 0:w.getBoundingClientRect())||null,le=xt(Z.sourceEvent,G))},Ie=(Z,K)=>{const w=ue(Z.sourceEvent);if(!ye&&X&&d.value&&(ye=!0,ge()),!X){const S=w.xSnapped-(F.x??0),C=w.ySnapped-(F.y??0);Math.sqrt(S*S+C*C)>s.value&&Ee(Z,K)}(F.x!==w.xSnapped||F.y!==w.ySnapped)&&W.length&&X&&($=Z.sourceEvent,le=xt(Z.sourceEvent,G),fe(w))},he=Z=>{let K=!1;if(!X&&!k.value&&!m.value){const w=Z.sourceEvent,S=ue(w),C=S.xSnapped-(F.x??0),Y=S.ySnapped-(F.y??0),ee=Math.sqrt(C*C+Y*Y);ee!==0&&ee<=s.value&&(x==null||x(w),K=!0)}if(W.length&&!K){re&&(b(W,!1,!1),re=!1);const[w,S]=fl({id:de,dragItems:W,findNode:p});P({event:Z.sourceEvent,node:w,nodes:S})}W=[],k.value=!1,ye=!1,X=!1,F={x:void 0,y:void 0},cancelAnimationFrame(pe)};return n.watch([()=>n.toValue(H),O],([Z,K],w,S)=>{if(K){const C=ht(K);Z||(R=ky().on("start",Y=>Re(Y,K)).on("drag",Y=>Ie(Y,K)).on("end",Y=>he(Y)).filter(Y=>{const ee=Y.target,be=n.toValue(oe);return!Y.button&&(!a.value||!ad(ee,`.${a.value}`,K)&&(!be||ad(ee,be,K)))}),C.call(R)),S(()=>{C.on(".drag",null),R&&(R.on("start",null),R.on("drag",null),R.on("end",null))})}}),k}function qb(){return{doubleClick:xe(),click:xe(),mouseEnter:xe(),mouseMove:xe(),mouseLeave:xe(),contextMenu:xe(),updateStart:xe(),update:xe(),updateEnd:xe()}}function Xb(e,t){const o=qb();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 jb(){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=Bb(a)?a.sourceEvent:a,{x:c,y:d}=xt(s,r),u=_o({x:c,y:d},e.value),{x:f,y:h}=o.value?Bi(u,t.value):u;return{xSnapped:f,ySnapped:h,...u}}}function Oi(){return!0}function wd({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:g,findNode:y,panBy:_,startConnection:A,updateConnection:b,endConnection:v,emits:te,viewport:I,edges:P,nodes:x,isValidConnection:O,nodeLookup:H}=ze();let de=null,z=!1,oe=null;function k(R){var G;const F=n.toValue(o)==="target",le=pl(R),$=Hc(R.target),X=R.currentTarget;if(X&&(le&&R.button===0||!le)){let re=function(_e){w=xt(_e,he),fe=zb(_o(w,I.value,!1,[1,1]),u.value,H.value,Y),S||(C(),S=!0);const Ce=cd(_e,{handle:fe,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:F?"target":"source",isValidConnection:ue,doc:$,lib:"vue",flowId:s,nodeLookup:H.value},P.value,x.value,y,H.value);oe=Ce.handleDomNode,de=Ce.connection,z=Fb(!!fe,Ce.isValid);const Te={...$e,isValid:z,to:Ce.toHandle&&z?bo({x:Ce.toHandle.x,y:Ce.toHandle.y},I.value):w,toHandle:Ce.toHandle,toPosition:z&&Ce.toHandle?Ce.toHandle.position:yl[Y.position],toNode:Ce.toHandle?H.value.get(Ce.toHandle.nodeId):null};if(z&&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(b(Be&&z?bo({x:Be.x,y:Be.y},I.value):w,Be,Ub(!!Be,z)),$e=Te,!fe&&!z&&!oe)return hl(K);de&&de.source!==de.target&&oe&&(hl(K),K=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!z),oe.classList.toggle("vue-flow__handle-valid",!!z))},pe=function(_e){"touches"in _e&&_e.touches.length>0||((fe||oe)&&de&&z&&(l?l(_e,de):te.connect(de)),te.connectEnd(_e),a&&(r==null||r(_e)),hl(K),cancelAnimationFrame(ge),v(_e),S=!1,z=!1,de=null,oe=null,$.removeEventListener("mousemove",re),$.removeEventListener("mouseup",pe),$.removeEventListener("touchmove",re),$.removeEventListener("touchend",pe))};const ye=y(n.toValue(t));let ue=n.toValue(i)||O.value||Oi;!ue&&ye&&(ue=(F?ye.isValidSourcePos:ye.isValidTargetPos)||Oi);let fe,ge=0;const{x:Ee,y:Re}=xt(R),Ie=dd(n.toValue(a),X),he=(G=c.value)==null?void 0:G.getBoundingClientRect();if(!he||!Ie)return;const Z=ud(n.toValue(t),Ie,n.toValue(e),H.value,d.value);if(!Z)return;let K,w=xt(R,he),S=!1;const C=()=>{if(!m.value)return;const[_e,Ce]=Qc(w,he,g.value);_({x:_e,y:Ce}),ge=requestAnimationFrame(C)},Y={...Z,nodeId:n.toValue(t),type:Ie,position:Z.position},ee=H.value.get(n.toValue(t)),we={inProgress:!0,isValid:null,from:Dn(ee,Y,Se.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:ee,to:w,toHandle:null,toPosition:yl[Y.position],toNode:null};A({nodeId:n.toValue(t),id:n.toValue(e),type:Ie,position:(X==null?void 0:X.getAttribute("data-handlepos"))||Se.Top,...w},{x:Ee-he.left,y:Re-he.top}),te.connectStart({event:R,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ie});let $e=we;$.addEventListener("mousemove",re),$.addEventListener("mouseup",pe),$.addEventListener("touchmove",re),$.addEventListener("touchend",pe)}}function W(R){var G,F;if(!f.value)return;const le=n.toValue(o)==="target";if(!h.value){te.clickConnectStart({event:R,nodeId:n.toValue(t),handleId:n.toValue(e)}),A({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Se.Top,...xt(R)},void 0,!0);return}let $=n.toValue(i)||O.value||Oi;const X=y(n.toValue(t));if(!$&&X&&($=(le?X.isValidSourcePos:X.isValidTargetPos)||Oi),X&&(typeof X.connectable>"u"?p.value:X.connectable)===!1)return;const re=Hc(R.target),pe=cd(R,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Se.Top,...xt(R)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:$,doc:re,lib:"vue",flowId:s,nodeLookup:H.value},P.value,x.value,y,H.value),ye=((G=pe.connection)==null?void 0:G.source)===((F=pe.connection)==null?void 0:F.target);pe.isValid&&pe.connection&&!ye&&te.connect(pe.connection),te.clickConnectEnd(R),v(R,!0)}return{handlePointerDown:k,handleClick:W}}function Zb(){return n.inject(bd,"")}function Ed(e){const t=e??Zb()??"",o=n.inject(_d,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 Jb(){return{doubleClick:xe(),click:xe(),mouseEnter:xe(),mouseMove:xe(),mouseLeave:xe(),contextMenu:xe(),dragStart:xe(),drag:xe(),dragStop:xe()}}function Qb(e,t){const o=Jb();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 vd(){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,g=[];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:A}=ml(y,_,s.error,t.value,y.parentNode?i(y.parentNode):void 0);g.push({id:y.id,position:A,from:y.position,distance:{x:c.x,y:c.y},dimensions:y.dimensions})}o(g,!0,!1)}}const Li=.1,e0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kt(){return Eo("Viewport not initialized yet."),Promise.resolve(!1)}const t0={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 n0(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?so:ki).scaleBy(kl(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}=Fc({x:-i,y:-a},e.translateExtent),f=Tn.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?so:ki).transform(kl(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"?so:ki).scaleTo(kl(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:Li,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=cl(s),{x:d,y:u,zoom:f}=jc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Li);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:Li})=>{const{x:r,y:s,zoom:c}=jc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Li);return o(r,s,c,l)},project:a=>_o(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 _o(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 bo(s,e.viewport)}return{x:0,y:0}}}:t0)}function kl(e,t=0,o=e0,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function o0(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,y,_=!!(o.nodes.value.length||o.edges.value.length);g=Sn([e.modelValue,()=>{var A,b;return(b=(A=e.modelValue)==null?void 0:A.value)==null?void 0:b.length}],([A])=>{A&&Array.isArray(A)&&(y==null||y.pause(),o.setElements(A),!y&&!_&&A.length?_=!0:y==null||y.resume())}),y=Sn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([A,b])=>{var v;(v=e.modelValue)!=null&&v.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...A,...b],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),y==null||y.stop()})})},l=()=>{i.run(()=>{let g,y,_=!!o.nodes.value.length;g=Sn([e.nodes,()=>{var A,b;return(b=(A=e.nodes)==null?void 0:A.value)==null?void 0:b.length}],([A])=>{A&&Array.isArray(A)&&(y==null||y.pause(),o.setNodes(A),!y&&!_&&A.length?_=!0:y==null||y.resume())}),y=Sn([o.nodes,()=>o.nodes.value.length],([A])=>{var b;(b=e.nodes)!=null&&b.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...A],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),y==null||y.stop()})})},r=()=>{i.run(()=>{let g,y,_=!!o.edges.value.length;g=Sn([e.edges,()=>{var A,b;return(b=(A=e.edges)==null?void 0:A.value)==null?void 0:b.length}],([A])=>{A&&Array.isArray(A)&&(y==null||y.pause(),o.setEdges(A),!y&&!_&&A.length?_=!0:y==null||y.resume())}),y=Sn([o.edges,()=>o.edges.value.length],([A])=>{var b;(b=e.edges)!=null&&b.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...A],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.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 g=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,_,A)=>{y?o.onConnect(g):o.hooks.value.connect.off(g),A(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},p=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const y of Object.keys(t)){const _=y;if(!g.includes(_)){const A=n.toRef(()=>t[_]),b=o[_];n.isRef(b)&&i.run(()=>{n.watch(A,v=>{Xe(v)&&(b.value=v)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),h(),p()})()}),()=>i.stop()}function i0(){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=>Eo(e.message))}}function a0(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),no(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),no(l.removeHasEmitListeners)}});function i(a){var l;const r=l0(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function l0(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Nd(){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:ll.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ho.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:wo()?"Meta":"Control",zoomActivationKeyCode:wo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:i0(),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 r0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function s0(e,t,o){const i=n0(e),a=w=>{const S=w??[];e.hooks.updateNodeInternals.trigger(S)},l=w=>vb(w,e.nodes,e.edges),r=w=>Eb(w,e.nodes,e.edges),s=w=>cn(w,e.edges),c=({id:w,type:S,nodeId:C})=>{var Y;const ee=w?`-${S}-${w}`:`-${S}`;return Array.from(((Y=e.connectionLookup.get(`${C}${ee}`))==null?void 0:Y.values())??[])},d=w=>{if(w)return t.value.get(w)},u=w=>{if(w)return o.value.get(w)},f=(w,S,C)=>{var Y,ee;const be=[];for(const we of w){const $e={id:we.id,type:"position",dragging:C,from:we.from};if(S&&($e.position=we.position,we.parentNode)){const _e=d(we.parentNode);$e.position={x:$e.position.x-(((Y=_e==null?void 0:_e.computedPosition)==null?void 0:Y.x)??0),y:$e.position.y-(((ee=_e==null?void 0:_e.computedPosition)==null?void 0:ee.y)??0)}}be.push($e)}be!=null&&be.length&&e.hooks.nodesChange.trigger(be)},h=w=>{if(!e.vueFlowRef)return;const S=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!S)return;const C=window.getComputedStyle(S),{m22:Y}=new window.DOMMatrixReadOnly(C.transform),ee=[];for(const be of w){const we=be,$e=d(we.id);if($e){const _e=Ai(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=md("source",we.nodeElement,Te,Y,$e.id),$e.handleBounds.target=md("target",we.nodeElement,Te,Y,$e.id),ee.push({id:$e.id,type:"dimensions",dimensions:_e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),ee.length&&e.hooks.nodesChange.trigger(ee)},p=(w,S)=>{const C=new Set,Y=new Set;for(const we of w)sn(we)?C.add(we.id):Gt(we)&&Y.add(we.id);const ee=Wt(t.value,C,!0),be=Wt(o.value,Y);if(e.multiSelectionActive){for(const we of C)ee.push(Yt(we,S));for(const we of Y)be.push(Yt(we,S))}ee.length&&e.hooks.nodesChange.trigger(ee),be.length&&e.hooks.edgesChange.trigger(be)},m=w=>{if(e.multiSelectionActive){const S=w.map(C=>Yt(C.id,!0));e.hooks.nodesChange.trigger(S);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(w.map(S=>S.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},g=w=>{if(e.multiSelectionActive){const S=w.map(C=>Yt(C.id,!0));e.hooks.edgesChange.trigger(S);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(w.map(S=>S.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},y=w=>{p(w,!0)},_=w=>{const C=(w||e.nodes).map(Y=>(Y.selected=!1,Yt(Y.id,!1)));e.hooks.nodesChange.trigger(C)},A=w=>{const C=(w||e.edges).map(Y=>(Y.selected=!1,Yt(Y.id,!1)));e.hooks.edgesChange.trigger(C)},b=w=>{if(!w||!w.length)return p([],!1);const S=w.reduce((C,Y)=>{const ee=Yt(Y.id,!1);return sn(Y)?C.nodes.push(ee):C.edges.push(ee),C},{nodes:[],edges:[]});S.nodes.length&&e.hooks.nodesChange.trigger(S.nodes),S.edges.length&&e.hooks.edgesChange.trigger(S.edges)},v=w=>{var S;(S=e.d3Zoom)==null||S.scaleExtent([w,e.maxZoom]),e.minZoom=w},te=w=>{var S;(S=e.d3Zoom)==null||S.scaleExtent([e.minZoom,w]),e.maxZoom=w},I=w=>{var S;(S=e.d3Zoom)==null||S.translateExtent(w),e.translateExtent=w},P=w=>{e.nodeExtent=w,a()},x=w=>{var S;(S=e.d3Zoom)==null||S.clickDistance(w)},O=w=>{e.nodesDraggable=w,e.nodesConnectable=w,e.elementsSelectable=w},H=w=>{const S=w instanceof Function?w(e.nodes):w;!e.initialized&&!S.length||(e.nodes=pd(S,d,e.hooks.error.trigger))},de=w=>{const S=w instanceof Function?w(e.edges):w;if(!e.initialized&&!S.length)return;const C=_l(S,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);bl(e.connectionLookup,o.value,C),e.edges=C},z=w=>{const S=w instanceof Function?w([...e.nodes,...e.edges]):w;!e.initialized&&!S.length||(H(S.filter(sn)),de(S.filter(Gt)))},oe=w=>{let S=w instanceof Function?w(e.nodes):w;S=Array.isArray(S)?S:[S];const C=pd(S,d,e.hooks.error.trigger),Y=[];for(const ee of C)Y.push(td(ee));Y.length&&e.hooks.nodesChange.trigger(Y)},k=w=>{let S=w instanceof Function?w(e.edges):w;S=Array.isArray(S)?S:[S];const C=_l(S,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Y=[];for(const ee of C)Y.push(td(ee));Y.length&&e.hooks.edgesChange.trigger(Y)},W=(w,S=!0,C=!1)=>{const Y=w instanceof Function?w(e.nodes):w,ee=Array.isArray(Y)?Y:[Y],be=[],we=[];function $e(Ce){const Te=s(Ce);for(const Be of Te)(!Xe(Be.deletable)||Be.deletable)&&we.push(od(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(nd(Be.id));S&&$e(Te);for(const Be of Te)_e(Be.id)}}for(const Ce of ee){const Te=typeof Ce=="string"?d(Ce):Ce;Te&&(Xe(Te.deletable)&&!Te.deletable||(be.push(nd(Te.id)),S&&$e([Te]),C&&_e(Te.id)))}we.length&&e.hooks.edgesChange.trigger(we),be.length&&e.hooks.nodesChange.trigger(be)},R=w=>{const S=w instanceof Function?w(e.edges):w,C=Array.isArray(S)?S:[S],Y=[];for(const ee of C){const be=typeof ee=="string"?u(ee):ee;be&&(Xe(be.deletable)&&!be.deletable||Y.push(od(typeof ee=="string"?ee:ee.id,be.source,be.target,be.sourceHandle,be.targetHandle)))}e.hooks.edgesChange.trigger(Y)},G=(w,S,C=!0)=>{const Y=u(w.id);if(!Y)return!1;const ee=e.edges.indexOf(Y),be=Yb(w,S,Y,C,e.hooks.error.trigger);if(be){const[we]=_l([be],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map(($e,_e)=>_e===ee?we:$e),bl(e.connectionLookup,o.value,[we]),we}return!1},F=(w,S,C={replace:!1})=>{const Y=u(w);if(!Y)return;const ee=typeof S=="function"?S(Y):S;Y.data=C.replace?ee:{...Y.data,...ee}},le=w=>ed(w,e.nodes),$=w=>{const S=ed(w,e.edges);return bl(e.connectionLookup,o.value,S),S},X=(w,S,C={replace:!1})=>{const Y=d(w);if(!Y)return;const ee=typeof S=="function"?S(Y):S;C.replace?e.nodes.splice(e.nodes.indexOf(Y),1,ee):Object.assign(Y,ee)},re=(w,S,C={replace:!1})=>{const Y=d(w);if(!Y)return;const ee=typeof S=="function"?S(Y):S;Y.data=C.replace?ee:{...Y.data,...ee}},pe=(w,S,C=!1)=>{C?e.connectionClickStartHandle=w:e.connectionStartHandle=w,e.connectionEndHandle=null,e.connectionStatus=null,S&&(e.connectionPosition=S)},ye=(w,S=null,C=null)=>{e.connectionStartHandle&&(e.connectionPosition=w,e.connectionEndHandle=S,e.connectionStatus=C)},ue=(w,S)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,S?e.connectionClickStartHandle=null:e.connectionStartHandle=null},fe=w=>{const S=kb(w),C=S?null:go(w)?w:d(w.id);return!S&&!C?[null,null,S]:[S?w:Ri(C),C,S]},ge=(w,S=!0,C=e.nodes)=>{const[Y,ee,be]=fe(w);if(!Y)return[];const we=[];for(const $e of C||e.nodes){if(!be&&($e.id===ee.id||!$e.computedPosition))continue;const _e=Ri($e),Ce=Vi(_e,Y);(S&&Ce>0||Ce>=_e.width*_e.height||Ce>=Number(Y.width)*Number(Y.height))&&we.push($e)}return we},Ee=(w,S,C=!0)=>{const[Y]=fe(w);if(!Y)return!1;const ee=Vi(Y,S);return C&&ee>0||ee>=Number(Y.width)*Number(Y.height)},Re=w=>{const{viewport:S,dimensions:C,d3Zoom:Y,d3Selection:ee,translateExtent:be}=e;if(!Y||!ee||!w.x&&!w.y)return!1;const we=Tn.translate(S.x+w.x,S.y+w.y).scale(S.zoom),$e=[[0,0],[C.width,C.height]],_e=Y.constrain()(we,$e,be),Ce=e.viewport.x!==_e.x||e.viewport.y!==_e.y||e.viewport.zoom!==_e.k;return Y.transform(ee,_e),Ce},Ie=w=>{const S=w instanceof Function?w(e):w,C=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(S.defaultEdgeOptions)&&(e.defaultEdgeOptions=S.defaultEdgeOptions);const Y=S.modelValue||S.nodes||S.edges?[]:void 0;Y&&(S.modelValue&&Y.push(...S.modelValue),S.nodes&&Y.push(...S.nodes),S.edges&&Y.push(...S.edges),z(Y));const ee=()=>{Xe(S.maxZoom)&&te(S.maxZoom),Xe(S.minZoom)&&v(S.minZoom),Xe(S.translateExtent)&&I(S.translateExtent)};for(const be of Object.keys(S)){const we=be,$e=S[we];![...r0,...C].includes(we)&&Xe($e)&&(e[we]=$e)}Pa(()=>e.d3Zoom).not.toBeNull().then(ee),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:z,setNodes:H,setEdges:de,addNodes:oe,addEdges:k,removeNodes:W,removeEdges:R,findNode:d,findEdge:u,updateEdge:G,updateEdgeData:F,updateNode:X,updateNodeData:re,applyEdgeChanges:$,applyNodeChanges:le,addSelectedElements:y,addSelectedNodes:m,addSelectedEdges:g,setMinZoom:v,setMaxZoom:te,setTranslateExtent:I,setNodeExtent:P,setPaneClickDistance:x,removeSelectedElements:b,removeSelectedNodes:_,removeSelectedEdges:A,startConnection:pe,updateConnection:ye,endConnection:ue,setInteractive:O,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,S)=>i.value.zoomTo(w,S),setViewport:(w,S)=>i.value.setViewport(w,S),setTransform:(w,S)=>i.value.setTransform(w,S),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(w,S,C)=>i.value.setCenter(w,S,C),fitBounds:(w,S)=>i.value.fitBounds(w,S),project:w=>i.value.project(w),screenToFlowCoordinate:w=>i.value.screenToFlowCoordinate(w),flowToScreenCoordinate:w=>i.value.flowToScreenCoordinate(w),toObject:()=>{const w=[],S=[];for(const C of e.nodes){const{computedPosition:Y,handleBounds:ee,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:Y,sourceNode:ee,targetNode:be,events:we,...$e}=C;S.push($e)}return JSON.parse(JSON.stringify({nodes:w,edges:S,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:w=>new Promise(S=>{const{nodes:C,edges:Y,position:ee,zoom:be,viewport:we}=w;C&&H(C),Y&&de(Y);const[$e,_e]=we!=null&&we.x&&(we!=null&&we.y)?[we.x,we.y]:ee??[null,null];if($e&&_e){const Ce=(we==null?void 0:we.zoom)||be||e.viewport.zoom;return Pa(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:$e,y:_e,zoom:Ce}).then(()=>{S(!0)})})}else S(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const w=Nd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const S=Tn.translate(w.defaultViewport.x??0,w.defaultViewport.y??0).scale(rn(w.defaultViewport.zoom??1,w.minZoom,w.maxZoom)),C=e.viewportRef.getBoundingClientRect(),Y=[[0,0],[C.width,C.height]],ee=e.d3Zoom.constrain()(S,Y,w.translateExtent);e.d3Zoom.transform(e.d3Selection,ee)}Ie(w)},$destroy:()=>{}}}const c0=["data-id","data-handleid","data-nodeid","data-handlepos"],d0={name:"Handle",compatConfig:{MODE:3}},dn=n.defineComponent({...d0,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:g,connectedEdges:y}=Ed(),_=n.ref(),A=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),b=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),v=n.toRef(()=>{var de,z,oe,k,W,R;return((de=r.value)==null?void 0:de.nodeId)===p&&((z=r.value)==null?void 0:z.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===p&&((W=c.value)==null?void 0:W.id)===e.id&&((R=c.value)==null?void 0:R.type)===i.value}),te=n.toRef(()=>{var de,z,oe;return((de=s.value)==null?void 0:de.nodeId)===p&&((z=s.value)==null?void 0:z.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:I,handleClick:P}=wd({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),x=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!y.value.some(de=>{const z=de[`${i.value}Handle`];return de[i.value]!==p?!1:z?z===e.id:!0}):typeof e.connectable=="number"?y.value.filter(de=>{const z=de[`${i.value}Handle`];return de[i.value]!==p?!1:z?z===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 de;if(!m.dimensions.width||!m.dimensions.height)return;const z=(de=m.handleBounds[i.value])==null?void 0:de.find(le=>le.id===e.id);if(!d.value||z)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!_.value||!oe||!e.id)return;const k=g.value.getBoundingClientRect(),W=_.value.getBoundingClientRect(),R=window.getComputedStyle(oe),{m22:G}=new window.DOMMatrixReadOnly(R.transform),F={id:e.id,position:e.position,x:(W.left-k.left)/G,y:(W.top-k.top)/G,type:i.value,nodeId:p,...Ai(_.value)};m.handleBounds[i.value]=[...m.handleBounds[i.value]??[],F]});function O(de){const z=pl(de);x.value&&A.value&&(z&&de.button===0||!z)&&I(de)}function H(de){!p||!s.value&&!A.value||x.value&&P(de)}return t({handleClick:P,handlePointerDown:I,onClick:H,onPointerDown:O}),(de,z)=>(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":de.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${de.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(h),i.value,{connectable:x.value,connecting:te.value,connectablestart:A.value,connectableend:b.value,connectionindicator:x.value&&(A.value&&!v.value||b.value&&v.value)}]]),onMousedown:O,onTouchstartPassive:O,onClick:H},[n.renderSlot(de.$slots,"default",{id:de.id})],42,c0))}}),Pi=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})]};Pi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Pi.inheritAttrs=!1,Pi.compatConfig={MODE:3};const u0=Pi,zi=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])]};zi.props=["targetPosition","label","isValidTargetPos","connectable","data"],zi.inheritAttrs=!1,zi.compatConfig={MODE:3};const f0=zi,Ui=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})]};Ui.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ui.inheritAttrs=!1,Ui.compatConfig={MODE:3};const m0=Ui,p0=["transform"],h0=["width","height","x","y","rx","ry"],y0=["y"],g0={name:"EdgeText",compatConfig:{MODE:3}},b0=n.defineComponent({...g0,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,h0)):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,y0)],8,p0))}}),_0=["id","d","marker-end","marker-start"],k0=["d","stroke-width"],w0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Fi=n.defineComponent({...w0,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,_0),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,k0)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(b0,{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 xd({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 Hi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Id({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Se.Left:r=t-Hi(t-i,l),s=o;break;case Se.Right:r=t+Hi(i-t,l),s=o;break;case Se.Top:r=t,s=o-Hi(o-a,l);break;case Se.Bottom:r=t,s=o+Hi(a-o,l);break}return[r,s]}function Sd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,curvature:s=.25}=e,[c,d]=Id({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=Id({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[h,p,m,g]=xd({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,g]}function Cd({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 Rd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top}=e,[s,c]=Cd({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=Cd({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,h,p,m]=xd({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 Vd={[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 E0({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 Ad(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function v0({source:e,sourcePosition:t=Se.Bottom,target:o,targetPosition:i=Se.Top,center:a,offset:l}){const r=Vd[t],s=Vd[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=E0({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let p,m,g;const y={x:0,y:0},_={x:0,y:0},[A,b,v,te]=$d({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){m=a.x??A,g=a.y??b;const P=[{x:m,y:c.y},{x:m,y:d.y}],x=[{x:c.x,y:g},{x:d.x,y:g}];r[f]===h?p=f==="x"?P:x:p=f==="x"?x:P}else{const P=[{x:c.x,y:d.y}],x=[{x:d.x,y:c.y}];if(f==="x"?p=r.x===h?x:P:p=r.y===h?P:x,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],W=c[oe]>d[oe],R=c[oe]<d[oe];(r[f]===1&&(!k&&W||k&&R)||r[f]!==1&&(!k&&R||k&&W))&&(p=f==="x"?P:x)}const O={x:c.x+y.x,y:c.y+y.y},H={x:d.x+_.x,y:d.y+_.y},de=Math.max(Math.abs(O.x-p[0].x),Math.abs(H.x-p[0].x)),z=Math.max(Math.abs(O.y-p[0].y),Math.abs(H.y-p[0].y));de>=z?(m=(O.x+H.x)/2,g=p[0].y):(m=p[0].x,g=(O.y+H.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,g,v,te]}function N0(e,t,o,i){const a=Math.min(Ad(e,t)/2,Ad(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 wl(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,g]=v0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((_,A,b)=>{let v;return b>0&&b<f.length-1?v=N0(f[b-1],A,f[b+1],s):v=`${b===0?"M":"L"}${A.x} ${A.y}`,_+=v,_},""),h,p,m,g]}function $0(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 x0=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]=$0(e);return n.h(Fi,{path:o,labelX:i,labelY:a,...t,...e})}}}),Td=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]=wl({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Fi,{path:o,labelX:i,labelY:a,...t,...e})}}}),I0=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(Td,{...e,...t,borderRadius:0})}}),S0=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]=Sd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Fi,{path:o,labelX:i,labelY:a,...t,...e})}}}),C0=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]=Rd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Fi,{path:o,labelX:i,labelY:a,...t,...e})}}}),R0={input:m0,default:u0,output:f0},V0={default:S0,straight:x0,step:I0,smoothstep:Td,simplebezier:C0};function A0(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},y=Object.keys(g);for(const _ of e.edges)_.type&&!y.includes(_.type)&&(g[_.type]=_.type);return g}),r=n.computed(()=>{const g={...R0,...e.nodeTypes},y=Object.keys(g);for(const _ of e.nodes)_.type&&!y.includes(_.type)&&(g[_.type]=_.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?Xc(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 y of e.edges){const _=t.value.get(y.source),A=t.value.get(y.target);Tb({sourcePos:_.computedPosition||{x:0,y:0},targetPos:A.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:A.dimensions.width,targetHeight:A.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(y)}return g}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const g=[];for(const y of e.nodes)y.selected&&g.push(y);return g}),f=n.computed(()=>{const g=[];for(const y of e.edges)y.selected&&g.push(y);return g}),h=n.computed(()=>[...u.value,...f.value]),p=n.computed(()=>{const g=[];for(const y of e.nodes)y.dimensions.width&&y.dimensions.height&&y.handleBounds!==void 0&&g.push(y);return g}),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=Nd(),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=A0(a,s,c),u=s0(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...Cp(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(gd,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)},g=y=>{d.applyEdgeChanges(y)};f?(d.onNodesChange(m),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(m),d.hooks.value.edgesChange.off(g)),p(()=>{d.hooks.value.nodesChange.off(m),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),no(()=>{if(s){const f=t.get(s.id);f?f.$destroy():Eo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(gd,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 T0(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=Ai(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 M0={name:"UserSelection",compatConfig:{MODE:3}},B0=n.defineComponent({...M0,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))}}),D0=["tabIndex"],O0={name:"NodesSelection",compatConfig:{MODE:3}},L0=n.defineComponent({...O0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=ze(),s=vd(),c=n.ref(null),d=kd({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(()=>cl(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||Mn[m.key]&&(m.preventDefault(),s({x:Mn[m.key].x,y:Mn[m.key].y},m.shiftKey))}return(m,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:p},null,46,D0)],6)):n.createCommentVNode("",!0)}});function P0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const z0={name:"Pane",compatConfig:{MODE:3}},U0=n.defineComponent({...z0,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:g,multiSelectionKeyCode:y,multiSelectionActive:_,edgeLookup:A,nodeLookup:b,connectionLookup:v,defaultEdgeOptions:te,connectionStartHandle:I,panOnDrag:P}=ze(),x=n.shallowRef(null),O=n.shallowRef(new Set),H=n.shallowRef(new Set),de=n.shallowRef(null),z=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>I.value!==null);let k=!1,W=!1;const R=yo(g,{actInsideInputWithModifier:!1}),G=yo(y);n.watch(R,ue=>{ue&&(h(f.value),p(u.value),d.value=!1)}),n.watch(G,ue=>{_.value=ue});function F(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 $(ue){var fe;if(Array.isArray(P.value)&&((fe=P.value)!=null&&fe.includes(2))){ue.preventDefault();return}a.paneContextMenu(ue)}function X(ue){a.paneScroll(ue)}function re(ue){var fe,ge,Ee;if(de.value=((fe=t.value)==null?void 0:fe.getBoundingClientRect())??null,!c.value||!e.isSelecting||ue.button!==0||ue.target!==x.value||!de.value)return;(Ee=(ge=ue.target)==null?void 0:ge.setPointerCapture)==null||Ee.call(ge,ue.pointerId);const{x:Re,y:Ie}=P0(ue,de.value);W=!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(!de.value||!s.value)return;k=!0;const{x:ge,y:Ee}=xt(ue,de.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)},Z=O.value,K=H.value;O.value=new Set(Xc(o.value,he,i.value,m.value===ll.Partial,!0).map(S=>S.id)),H.value=new Set;const w=((fe=te.value)==null?void 0:fe.selectable)??!0;for(const S of O.value){const C=v.value.get(S);if(C)for(const{edgeId:Y}of C.values()){const ee=A.value.get(Y);ee&&(ee.selectable??w)&&H.value.add(Y)}}if(!yd(Z,O.value)){const S=Wt(b.value,O.value,!0);a.nodesChange(S)}if(!yd(K,H.value)){const S=Wt(A.value,H.value);a.edgesChange(S)}s.value=he,l.value=!0,d.value=!1}function ye(ue){var fe;ue.button!==0||!W||((fe=ue.target)==null||fe.releasePointerCapture(ue.pointerId),!l.value&&s.value&&ue.target===x.value&&le(ue),l.value=!1,s.value=null,d.value=O.value.size>0,a.selectionEnd(ue),e.selectionKeyPressed&&(k=!1),W=!1)}return(ue,fe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:x,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:ue.isSelecting}]),onClick:fe[0]||(fe[0]=ge=>z.value?void 0:F(le,x.value)(ge)),onContextmenu:fe[1]||(fe[1]=ge=>F($,x.value)(ge)),onWheelPassive:fe[2]||(fe[2]=ge=>F(X,x.value)(ge)),onPointerenter:fe[3]||(fe[3]=ge=>z.value?void 0:n.unref(a).paneMouseEnter(ge)),onPointerdown:fe[4]||(fe[4]=ge=>z.value?re(ge):n.unref(a).paneMouseMove(ge)),onPointermove:fe[5]||(fe[5]=ge=>z.value?pe(ge):n.unref(a).paneMouseMove(ge)),onPointerup:fe[6]||(fe[6]=ge=>z.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(B0,{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(L0,{key:1})):n.createCommentVNode("",!0)],34))}}),F0={name:"Transform",compatConfig:{MODE:3}},H0=n.defineComponent({...F0,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))}}),G0={name:"Viewport",compatConfig:{MODE:3}},Y0=n.defineComponent({...G0,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:g,noWheelClassName:y,noPanClassName:_,emits:A,connectionStartHandle:b,userSelectionActive:v,paneDragging:te,d3Zoom:I,d3Selection:P,d3ZoomHandler:x,viewport:O,viewportRef:H,paneClickDistance:de}=ze();T0(H);const z=n.shallowRef(!1),oe=n.shallowRef(!1);let k=null,W=!1,R=0,G={x:0,y:0,zoom:0};const F=yo(s),le=yo(r),$=yo(l),X=n.toRef(()=>(!le.value||le.value&&r.value===!0)&&(F.value||f.value)),re=n.toRef(()=>F.value||c.value),pe=n.toRef(()=>r.value===!0&&X.value!==!0),ye=n.toRef(()=>le.value&&r.value!==!0||v.value||pe.value),ue=n.toRef(()=>b.value!==null);n.onMounted(()=>{if(!H.value){Eo("Viewport element is missing");return}const Ie=H.value,he=Ie.getBoundingClientRect(),Z=mb().clickDistance(de.value).scaleExtent([t.value,o.value]).translateExtent(a.value),K=ht(Ie).call(Z),w=K.on("wheel.zoom"),S=Tn.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]],Y=Z.constrain()(S,C,a.value);Z.transform(K,Y),Z.wheelDelta(dl),I.value=Z,P.value=K,x.value=w,O.value={x:Y.x,y:Y.y,zoom:Y.k},Z.on("start",ee=>{var be;if(!ee.sourceEvent)return null;R=ee.sourceEvent.button,z.value=!0;const we=Ee(ee.transform);((be=ee.sourceEvent)==null?void 0:be.type)==="mousedown"&&(te.value=!0),G=we,A.viewportChangeStart(we),A.moveStart({event:ee,flowTransform:we})}),Z.on("end",ee=>{if(!ee.sourceEvent)return null;if(z.value=!1,te.value=!1,fe(X.value,R??0)&&!W&&A.paneContextMenu(ee.sourceEvent),W=!1,ge(G,ee.transform)){const be=Ee(ee.transform);G=be,A.viewportChangeEnd(be),A.moveEnd({event:ee,flowTransform:be})}}),Z.filter(ee=>{var be;const we=$.value||m.value,$e=p.value&&ee.ctrlKey,_e=ee.button,Ce=ee.type==="wheel";if(_e===1&&ee.type==="mousedown"&&(Re(ee,"vue-flow__node")||Re(ee,"vue-flow__edge")))return!0;if(!X.value&&!we&&!re.value&&!h.value&&!p.value||v.value||ue.value&&!Ce||!h.value&&ee.type==="dblclick"||Re(ee,y.value)&&Ce||Re(ee,_.value)&&(!Ce||re.value&&Ce&&!$.value)||!p.value&&ee.ctrlKey&&Ce||!we&&!re.value&&!$e&&Ce)return!1;if(!p&&ee.type==="touchstart"&&((be=ee.touches)==null?void 0:be.length)>1)return ee.preventDefault(),!1;if(!X.value&&(ee.type==="mousedown"||ee.type==="touchstart")||pe.value&&Array.isArray(f.value)&&f.value.includes(0)&&_e===0||Array.isArray(f.value)&&!f.value.includes(_e)&&(ee.type==="mousedown"||ee.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(!ee.ctrlKey||F.value||Ce)&&Te}),n.watch([v,X],()=>{v.value&&!z.value?Z.on("zoom",null):v.value||Z.on("zoom",ee=>{O.value={x:ee.transform.x,y:ee.transform.y,zoom:ee.transform.k};const be=Ee(ee.transform);W=fe(X.value,R??0),A.viewportChange(be),A.move({event:ee,flowTransform:be})})},{immediate:!0}),n.watch([v,re,d,$,p,g,y],()=>{re.value&&!$.value&&!v.value?K.on("wheel.zoom",ee=>{if(Re(ee,y.value))return!1;const be=$.value||m.value,we=p.value&&ee.ctrlKey;if(!(!g.value||re.value||be||we))return!1;ee.preventDefault(),ee.stopImmediatePropagation();const _e=K.property("__zoom").k||1,Ce=wo();if(!F.value&&ee.ctrlKey&&p.value&&Ce){const ie=Et(ee),T=dl(ee),U=_e*2**T;Z.scaleTo(K,U,ie,ee);return}const Te=ee.deltaMode===1?20:1;let Be=d.value===ho.Vertical?0:ee.deltaX*Te,N=d.value===ho.Horizontal?0:ee.deltaY*Te;!Ce&&ee.shiftKey&&d.value!==ho.Vertical&&!Be&&N&&(Be=N,N=0),Z.translateBy(K,-(Be/_e)*u.value,-(N/_e)*u.value);const M=Ee(K.property("__zoom"));k&&clearTimeout(k),oe.value?(A.move({event:ee,flowTransform:M}),A.viewportChange(M),k=setTimeout(()=>{A.moveEnd({event:ee,flowTransform:M}),A.viewportChangeEnd(M),oe.value=!1},150)):(oe.value=!0,A.moveStart({event:ee,flowTransform:M}),A.viewportChangeStart(M))},{passive:!1}):typeof w<"u"&&K.on("wheel.zoom",function(ee,be){const we=!g.value&&ee.type==="wheel"&&!ee.ctrlKey,$e=$.value||m.value,_e=p.value&&ee.ctrlKey;if(!$e&&!c.value&&!_e&&ee.type==="wheel"||we||Re(ee,y.value))return null;ee.preventDefault(),w.call(this,ee,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:H,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(U0,{"is-selecting":ye.value,"selection-key-pressed":n.unref(le),class:n.normalizeClass({connecting:ue.value,dragging:n.unref(te),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(H0,null,{default:n.withCtx(()=>[n.renderSlot(Ie.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),W0=["id"],K0=["id"],q0=["id"],X0={name:"A11yDescriptions",compatConfig:{MODE:3}},j0=n.defineComponent({...X0,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(Pc)}-${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,W0),n.createElementVNode("div",{id:`${n.unref(zc)}-${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,K0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(_b)}-${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,q0))],64))}});function Z0(){const e=ze();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function J0(e,t,o){return o===Se.Left?e-t:o===Se.Right?e+t:e}function Q0(e,t,o){return o===Se.Top?e-t:o===Se.Bottom?e+t:e}const El=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:J0(t,e,i),cy:Q0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};El.props=["radius","centerX","centerY","position","type"],El.compatConfig={MODE:3};const Md=El,e1=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:g,edgesUpdatable:y,edgesFocusable:_,hooks:A}=ze(),b=n.computed(()=>u(e.id)),{emit:v,on:te}=Xb(b.value,l),I=n.inject(Di),P=n.getCurrentInstance(),x=n.ref(!1),O=n.ref(!1),H=n.ref(""),de=n.ref(null),z=n.ref("source"),oe=n.ref(null),k=n.toRef(()=>typeof b.value.selectable>"u"?g.value:b.value.selectable),W=n.toRef(()=>typeof b.value.updatable>"u"?y.value:b.value.updatable),R=n.toRef(()=>typeof b.value.focusable>"u"?_.value:b.value.focusable);n.provide(Wb,e.id),n.provide(Kb,oe);const G=n.computed(()=>b.value.class instanceof Function?b.value.class(b.value):b.value.class),F=n.computed(()=>b.value.style instanceof Function?b.value.style(b.value):b.value.style),le=n.computed(()=>{const S=b.value.type||"default",C=I==null?void 0:I[`edge-${S}`];if(C)return C;let Y=b.value.template??c.value[S];if(typeof Y=="string"&&P){const ee=Object.keys(P.appContext.components);ee&&ee.includes(S)&&(Y=n.resolveComponent(S,!1))}return Y&&typeof Y!="string"?Y:(l.error(new Qe(qe.EDGE_TYPE_MISSING,Y)),!1)}),{handlePointerDown:$}=wd({nodeId:H,handleId:de,type:z,isValidConnection:h,edgeUpdaterType:z,onEdgeUpdate:pe,onEdgeUpdateEnd:ye});return()=>{const S=f(b.value.source),C=f(b.value.target),Y="pathOptions"in b.value?b.value.pathOptions:{};if(!S&&!C)return l.error(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,b.value.id,b.value.source,b.value.target)),null;if(!S)return l.error(new Qe(qe.EDGE_SOURCE_MISSING,b.value.id,b.value.source)),null;if(!C)return l.error(new Qe(qe.EDGE_TARGET_MISSING,b.value.id,b.value.target)),null;if(!b.value||b.value.hidden||S.hidden||C.hidden)return null;let ee;i.value===Dt.Strict?ee=S.handleBounds.source:ee=[...S.handleBounds.source||[],...S.handleBounds.target||[]];const be=rd(ee,b.value.sourceHandle);let we;i.value===Dt.Strict?we=C.handleBounds.target:we=[...C.handleBounds.target||[],...C.handleBounds.source||[]];const $e=rd(we,b.value.targetHandle),_e=(be==null?void 0:be.position)||Se.Bottom,Ce=($e==null?void 0:$e.position)||Se.Top,{x:Te,y:Be}=Dn(S,be,_e),{x:N,y:M}=Dn(C,$e,Ce);return b.value.sourceX=Te,b.value.sourceY=Be,b.value.targetX=N,b.value.targetY=M,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${le.value===!1?"default":b.value.type||"default"}`,s.value,G.value,{updating:x.value,selected:b.value.selected,animated:b.value.animated,inactive:!k.value&&!A.value.edgeClick.hasListeners()}],tabIndex:R.value?0:void 0,"aria-label":b.value.ariaLabel===null?void 0:b.value.ariaLabel??`Edge from ${b.value.source} to ${b.value.target}`,"aria-describedby":R.value?`${zc}-${t}`:void 0,"aria-roledescription":"edge",role:R.value?"group":"img",...b.value.domAttributes,onClick:fe,onContextmenu:ge,onDblclick:Ee,onMouseenter:Re,onMousemove:Ie,onMouseleave:he,onKeyDown:R.value?w:void 0},[O.value?null:n.h(le.value===!1?c.value.default:le.value,{id:e.id,sourceNode:S,targetNode:C,source:b.value.source,target:b.value.target,type:b.value.type,updatable:W.value,selected:b.value.selected,animated:b.value.animated,label:b.value.label,labelStyle:b.value.labelStyle,labelShowBg:b.value.labelShowBg,labelBgStyle:b.value.labelBgStyle,labelBgPadding:b.value.labelBgPadding,labelBgBorderRadius:b.value.labelBgBorderRadius,data:b.value.data,events:{...b.value.events,...te},style:F.value,markerStart:`url('#${ko(b.value.markerStart,t)}')`,markerEnd:`url('#${ko(b.value.markerEnd,t)}')`,sourcePosition:_e,targetPosition:Ce,sourceX:Te,sourceY:Be,targetX:N,targetY:M,sourceHandleId:b.value.sourceHandle,targetHandleId:b.value.targetHandle,interactionWidth:b.value.interactionWidth,...Y}),[W.value==="source"||W.value===!0?[n.h("g",{onMousedown:Z,onMouseenter:X,onMouseout:re},n.h(Md,{position:_e,centerX:Te,centerY:Be,radius:a.value,type:"source","data-type":"source"}))]:null,W.value==="target"||W.value===!0?[n.h("g",{onMousedown:K,onMouseenter:X,onMouseout:re},n.h(Md,{position:Ce,centerX:N,centerY:M,radius:a.value,type:"target","data-type":"target"}))]:null]])};function X(){x.value=!0}function re(){x.value=!1}function pe(S,C){v.update({event:S,edge:b.value,connection:C})}function ye(S){v.updateEnd({event:S,edge:b.value}),O.value=!1}function ue(S,C){S.button===0&&(O.value=!0,H.value=C?b.value.target:b.value.source,de.value=(C?b.value.targetHandle:b.value.sourceHandle)??null,z.value=C?"target":"source",v.updateStart({event:S,edge:b.value}),$(S))}function fe(S){var C;const Y={event:S,edge:b.value};k.value&&(r.value=!1,b.value.selected&&p.value?(d([b.value]),(C=oe.value)==null||C.blur()):o([b.value])),v.click(Y)}function ge(S){v.contextMenu({event:S,edge:b.value})}function Ee(S){v.doubleClick({event:S,edge:b.value})}function Re(S){v.mouseEnter({event:S,edge:b.value})}function Ie(S){v.mouseMove({event:S,edge:b.value})}function he(S){v.mouseLeave({event:S,edge:b.value})}function Z(S){ue(S,!0)}function K(S){ue(S,!1)}function w(S){var C;!m.value&&Uc.includes(S.key)&&k.value&&(S.key==="Escape"?((C=oe.value)==null||C.blur(),d([u(e.id)])):o([u(e.id)]))}}}),t1=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(Di))==null?void 0:e["connection-line"],p=n.computed(()=>{var A;return f((A=i.value)==null?void 0:A.nodeId)}),m=n.computed(()=>{var A;return f((A=a.value)==null?void 0:A.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})),y=n.computed(()=>c.value.markerStart?`url(#${ko(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${ko(c.value.markerEnd,t)})`:"");return()=>{var A,b,v;if(!p.value||!i.value)return null;const te=i.value.id,I=i.value.type,P=p.value.handleBounds;let x=(P==null?void 0:P[I])??[];if(o.value===Dt.Loose){const F=(P==null?void 0:P[I==="source"?"target":"source"])??[];x=[...x,...F]}if(!x)return null;const O=(te?x.find(F=>F.id===te):x[0])??null,H=(O==null?void 0:O.position)??Se.Top,{x:de,y:z}=Dn(p.value,O,H);let oe=null;m.value&&(o.value===Dt.Strict?oe=((A=m.value.handleBounds[I==="source"?"target":"source"])==null?void 0:A.find(F=>{var le;return F.id===((le=a.value)==null?void 0:le.id)}))||null:oe=((b=[...m.value.handleBounds.source??[],...m.value.handleBounds.target??[]])==null?void 0:b.find(F=>{var le;return F.id===((le=a.value)==null?void 0:le.id)}))||null);const k=((v=a.value)==null?void 0:v.position)??(H?yl[H]:null);if(!H||!k)return null;const W=r.value??c.value.type??ln.Bezier;let R="";const G={sourceX:de,sourceY:z,sourcePosition:H,targetX:g.value.x,targetY:g.value.y,targetPosition:k};return W===ln.Bezier?[R]=Sd(G):W===ln.Step?[R]=wl({...G,borderRadius:0}):W===ln.SmoothStep?[R]=wl(G):W===ln.SimpleBezier?[R]=Rd(G):R=`M${de},${z} ${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:de,sourceY:z,sourcePosition:H,targetX:g.value.x,targetY:g.value.y,targetPosition:k,sourceNode:p.value,sourceHandle:O,targetNode:m.value,targetHandle:oe,markerEnd:_.value,markerStart:y.value,connectionStatus:d.value}):n.h("path",{d:R,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":y.value})))}}}),n1=["id","markerWidth","markerHeight","markerUnits","orient"],o1={name:"MarkerType",compatConfig:{MODE:3}},i1=n.defineComponent({...o1,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(rl).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(rl).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,n1))}}),a1={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},l1={name:"MarkerDefinitions",compatConfig:{MODE:3}},r1=n.defineComponent({...l1,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=ko(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",a1,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(i1,{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))])]))}}),s1={name:"Edges",compatConfig:{MODE:3}},c1=n.defineComponent({...s1,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=ze();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(r1),(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(Mb)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(e1),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(t1))],64))}}),d1=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:g,snapToGrid:y,snapGrid:_,nodeDragThreshold:A,nodesDraggable:b,elementsSelectable:v,nodesConnectable:te,nodesFocusable:I,hooks:P}=ze(),x=n.ref(null);n.provide(_d,x),n.provide(bd,e.id);const O=n.inject(Di),H=n.getCurrentInstance(),de=vd(),{node:z,parentNode:oe}=Ed(e.id),{emit:k,on:W}=Qb(z,r),R=n.toRef(()=>typeof z.draggable>"u"?b.value:z.draggable),G=n.toRef(()=>typeof z.selectable>"u"?v.value:z.selectable),F=n.toRef(()=>typeof z.connectable>"u"?te.value:z.connectable),le=n.toRef(()=>typeof z.focusable>"u"?I.value:z.focusable),$=n.computed(()=>G.value||R.value||P.value.nodeClick.hasListeners()||P.value.nodeDoubleClick.hasListeners()||P.value.nodeMouseEnter.hasListeners()||P.value.nodeMouseMove.hasListeners()||P.value.nodeMouseLeave.hasListeners()),X=n.toRef(()=>!!z.dimensions.width&&!!z.dimensions.height),re=n.computed(()=>{const C=z.type||"default",Y=O==null?void 0:O[`node-${C}`];if(Y)return Y;let ee=z.template||f.value[C];if(typeof ee=="string"&&H){const be=Object.keys(H.appContext.components);be&&be.includes(C)&&(ee=n.resolveComponent(C,!1))}return ee&&typeof ee!="string"?ee:(r.error(new Qe(qe.NODE_TYPE_MISSING,ee)),!1)}),pe=kd({id:e.id,el:x,disabled:()=>!R.value,selectable:G,dragHandle:()=>z.dragHandle,onStart(C){k.dragStart(C)},onDrag(C){k.drag(C)},onStop(C){k.dragStop(C)},onClick(C){w(C)}}),ye=n.computed(()=>z.class instanceof Function?z.class(z):z.class),ue=n.computed(()=>{const C=(z.style instanceof Function?z.style(z):z.style)||{},Y=z.width instanceof Function?z.width(z):z.width,ee=z.height instanceof Function?z.height(z):z.height;return!C.width&&Y&&(C.width=typeof Y=="string"?Y:`${Y}px`),!C.height&&ee&&(C.height=typeof ee=="string"?ee:`${ee}px`),C}),fe=n.toRef(()=>Number(z.zIndex??ue.value.zIndex??0));return u(C=>{(C.includes(e.id)||!C.length)&&Ee()}),n.onMounted(()=>{n.watch(()=>z.hidden,(C=!1,Y,ee)=>{!C&&x.value&&(e.resizeObserver.observe(x.value),ee(()=>{x.value&&e.resizeObserver.unobserve(x.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>z.type,()=>z.sourcePosition,()=>z.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:x.value,forceUpdate:!0}])})}),n.watch([()=>z.position.x,()=>z.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,()=>z.selected,()=>z.dimensions.height,()=>z.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,Y,ee,be,we,$e])=>{const _e={x:C,y:Y,z:$e+(p.value&&z.selected?1e3:0)};typeof ee<"u"&&typeof be<"u"?z.computedPosition=Sb({x:ee,y:be,z:we},_e):z.computedPosition=_e},{flush:"post",immediate:!0}),n.watch([()=>z.extent,h],([C,Y],[ee,be])=>{(C!==ee||Y!==be)&&ge()}),z.extent==="parent"||typeof z.extent=="object"&&"range"in z.extent&&z.extent.range==="parent"?Pa(()=>X).toBe(!0).then(ge):ge(),()=>z.hidden?null:n.h("div",{ref:x,"data-id":z.id,class:["vue-flow__node",`vue-flow__node-${re.value===!1?"default":z.type||"default"}`,{[o.value]:R.value,dragging:pe==null?void 0:pe.value,draggable:R.value,selected:z.selected,selectable:G.value,parent:z.isParent},ye.value],style:{visibility:X.value?"visible":"hidden",zIndex:z.computedPosition.z??fe.value,transform:`translate(${z.computedPosition.x}px,${z.computedPosition.y}px)`,pointerEvents:$.value?"all":"none",...ue.value},tabIndex:le.value?0:void 0,role:le.value?"group":void 0,"aria-describedby":m.value?void 0:`${Pc}-${t}`,"aria-label":z.ariaLabel,"aria-roledescription":"node",...z.domAttributes,onMouseenter:Re,onMousemove:Ie,onMouseleave:he,onContextmenu:Z,onClick:w,onDblclick:K,onKeydown:S},[n.h(re.value===!1?f.value.default:re.value,{id:z.id,type:z.type,data:z.data,events:{...z.events,...W},selected:z.selected,resizing:z.resizing,dragging:pe.value,connectable:F.value,position:z.computedPosition,dimensions:z.dimensions,isValidTargetPos:z.isValidTargetPos,isValidSourcePos:z.isValidSourcePos,parent:z.parentNode,parentNodeId:z.parentNode,zIndex:z.computedPosition.z??fe.value,targetPosition:z.targetPosition,sourcePosition:z.sourcePosition,label:z.label,dragHandle:z.dragHandle,onUpdateNodeInternals:Ee})]);function ge(){const C=z.computedPosition,{computedPosition:Y,position:ee}=ml(z,y.value?Bi(C,_.value):C,r.error,h.value,oe.value);(z.computedPosition.x!==Y.x||z.computedPosition.y!==Y.y)&&(z.computedPosition={...z.computedPosition,...Y}),(z.position.x!==ee.x||z.position.y!==ee.y)&&(z.position=ee)}function Ee(){x.value&&d([{id:e.id,nodeElement:x.value,forceUpdate:!0}])}function Re(C){pe!=null&&pe.value||k.mouseEnter({event:C,node:z})}function Ie(C){pe!=null&&pe.value||k.mouseMove({event:C,node:z})}function he(C){pe!=null&&pe.value||k.mouseLeave({event:C,node:z})}function Z(C){return k.contextMenu({event:C,node:z})}function K(C){return k.doubleClick({event:C,node:z})}function w(C){G.value&&(!i.value||!R.value||A.value>0)&&gl(z,l.value,c,s,a,!1,x.value),k.click({event:C,node:z})}function S(C){if(!(sl(C)||m.value))if(Uc.includes(C.key)&&G.value){const Y=C.key==="Escape";gl(z,l.value,c,s,a,Y,x.value)}else R.value&&z.selected&&Mn[C.key]&&(C.preventDefault(),g.value=`Moved selected node ${C.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~z.position.x}, y: ${~~z.position.y}`,de({x:Mn[C.key].x,y:Mn[C.key].y},C.shiftKey))}}});function u1(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 f1={class:"vue-flow__nodes vue-flow__container"},m1={name:"Nodes",compatConfig:{MODE:3}},p1=n.defineComponent({...m1,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=ze(),a=u1(),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",f1,[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(d1),{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 h1(){const{emits:e}=ze();n.onMounted(()=>{if(fd()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Qe(qe.MISSING_STYLES))}})}const y1=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),g1={name:"VueFlow",compatConfig:{MODE:3}},b1=n.defineComponent({...g1,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=za(i,"modelValue",o),r=za(i,"nodes",o),s=za(i,"edges",o),c=ze(i),d=o0({modelValue:l,nodes:r,edges:s},i,c);return a0(o,c.hooks),Z0(),h1(),n.provide(Di,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(Y0,null,{default:n.withCtx(()=>[n.createVNode(c1),y1,n.createVNode(p1),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(j0)],512))}}),_1={name:"Panel",compatConfig:{MODE:3}},Bd=n.defineComponent({..._1,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"],Dd={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function k1(e){return typeof e=="string"&&e in Dd}const w1={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},E1=.15;function v1(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 N1(e){if(typeof e!="string")return null;const t=v1(e);if(!t||t.s<E1)return null;let o=null,i=1/0;for(const a of fn){const l=Math.abs(t.h-w1[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(k1(t))return t;const o=e==null?void 0:e.properties;return N1((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function vl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const $1={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)"},x1={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 Od(e,t=!1){return e?t?x1[e]:$1[e]:null}function On(e){return Dd[e]}function Ln(e){return`var(--em-swatch-${e}-bar)`}const I1=["width","height","innerHTML"],S1=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,I1))}}),Ue=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ue(S1,[["__scopeId","data-v-92c1dba8"]]),C1={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",C1,[(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"]]),R1={class:"em-mlang"},V1={class:"em-mlang__tabs",role:"tablist"},A1=["aria-selected","onClick"],T1={key:0,class:"em-mlang__dot"},Nl=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",R1,[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",T1,"•")):n.createCommentVNode("",!0)],10,A1))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ae.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(ae.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"]]),M1=["disabled"],B1={class:"em-panel__sub-label"},D1={class:"em-field"},O1={class:"em-field"},L1={class:"em-field"},P1={class:"em-class"},z1={class:"em-field"},U1={class:"em-field"},F1={class:"em-field"},H1={class:"em-field"},G1={class:"em-multilang"},Y1={class:"em-multilang"},W1={class:"em-jpa"},K1={class:"em-field"},q1={class:"em-field"},X1={class:"em-field"},j1={class:"em-swatch"},Z1={class:"em-swatch__row"},J1=["title","onClick"],Ld=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(z=>z.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(z=>z.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var z;return at(((z=r.value)==null?void 0:z.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=z=>z;function h(z){return z==="inherit"?"기본(따름)":z}function p(z){l.value&&a.updateEntity(l.value.modelId,z)}function m(z,oe,k){var R;const W=((R=l.value)==null?void 0:R.table)??{physicalName:""};p(z==="physicalName"?{table:{...W,physicalName:k}}:{table:{...W,logicalName:{...W.logicalName,[oe]:k}}})}function g(z){p({description:Object.keys(z).length?z:void 0})}function y(z,oe){var k;p({jpaAttrs:{...(k=l.value)==null?void 0:k.jpaAttrs,[z]:oe}})}function _(z,oe){y(z,oe)}const A=n.computed(()=>{var z,oe;return((oe=(z=l.value)==null?void 0:z.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),b=n.computed(()=>{var z,oe;return!((oe=(z=l.value)==null?void 0:z.jpaAttrs)!=null&&oe.useDiscriminator)});function v(z){y("discriminatorType",z==="inherit"?void 0:z)}function te(z){p({hasPersonalInfo:z})}function I(z){p({superClass:z.trim()||void 0})}function P(z){p({schema:z.trim()||void 0})}function x(z){p({abstractClass:z})}const O=n.computed(()=>{var z,oe;return((oe=(z=l.value)==null?void 0:z.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function H(z){const oe=z.split(",").map(k=>k.trim()).filter(Boolean);p({declarationOfInterfaces:oe.length?oe:void 0})}function de(z){l.value&&a.setEntitySwatch(l.value.modelId,z)}return(z,oe)=>{var k,W,R;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]=G=>i("toggle"))},[n.createElementVNode("span",B1,[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",D1,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=G=>p({name:G}))},null,8,["model-value"])]),n.createElementVNode("label",O1,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=G=>p({stereotype:G}))},null,8,["model-value"])]),n.createElementVNode("label",L1,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=G=>p({packageName:G}))},null,8,["model-value"])]),n.createElementVNode("fieldset",P1,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",z1,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=G=>I(G))},null,8,["model-value"])]),n.createElementVNode("label",U1,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":O.value,"onUpdate:modelValue":oe[5]||(oe[5]=G=>H(G))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=G=>x(G))},null,8,["model-value"])]),n.createElementVNode("label",F1,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-table",width:"100%","model-value":((k=l.value.table)==null?void 0:k.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=G=>m("physicalName",null,G))},null,8,["model-value"])]),n.createElementVNode("label",H1,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=G=>P(G))},null,8,["model-value"])]),n.createElementVNode("fieldset",G1,[oe[21]||(oe[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,G=>{var F,le;return n.openBlock(),n.createElementBlock("label",{key:G,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(G),1),n.createVNode(n.unref(ae.BSTextInput),{name:`ent-logical-${G}`,width:"100%","model-value":((le=(F=l.value.table)==null?void 0:F.logicalName)==null?void 0:le[G])??"","onUpdate:modelValue":$=>m("logicalName",G,$)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",Y1,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Nl,{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",W1,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,G=>{var F;return n.createVNode(n.unref(ae.BSCheckbox),{key:G.key,name:`jpa-${G.key}`,class:"em-check",label:G.label,"model-value":!!((F=l.value.jpaAttrs)!=null&&F[G.key]),"onUpdate:modelValue":le=>_(G.key,le)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",K1,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:b.value,"model-value":((W=l.value.jpaAttrs)==null?void 0:W.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=G=>y("discriminatorColumnName",G.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",q1,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ae.BSSelect),{disabled:b.value,"model-value":A.value,items:u,"value-provider":f,"label-provider":h,"onUpdate:modelValue":oe[10]||(oe[10]=G=>G&&v(G))},null,8,["disabled","model-value"])]),n.createElementVNode("label",X1,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:b.value,"model-value":(R=l.value.jpaAttrs)==null?void 0:R.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=G=>y("discriminatorLength",G||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!l.value.hasPersonalInfo,"onUpdate:modelValue":te},null,8,["model-value"]),n.createElementVNode("fieldset",j1,[oe[27]||(oe[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",Z1,[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]=G=>de(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),G=>(n.openBlock(),n.createElementBlock("button",{key:G,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===G}]),style:n.normalizeStyle({background:n.unref(Ln)(G)}),title:n.unref(On)(G),onClick:F=>de(G)},null,14,J1))),128))])])],64)):n.createCommentVNode("",!0)],8,M1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),Pd=["ko","en","ja","zh"];function Q1(e){if(e)for(const t of Pd){const o=e[t];if(o)return o}}function $l(e){const t=Q1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function e_(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Pd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const t_=["aria-expanded"],n_=["aria-selected","onClick","onMouseenter"],o_={key:0,class:"gcc__opt gcc__opt--empty"},zd=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(x=>x.groupCode===o.modelValue)),h=n.computed(()=>f.value?$l(f.value):"");n.watch(h,x=>{c.value||(s.value=x)},{immediate:!0});const p=n.computed(()=>s.value===h.value?o.items:e_(o.items,s.value));function m(){var O;const x=(O=a.value)==null?void 0:O.getBoundingClientRect();x&&(u.value={left:`${x.left}px`,top:`${x.bottom}px`,width:`${x.width}px`})}function g(){c.value=!0,m(),d.value=Math.max(0,p.value.findIndex(x=>x.groupCode===o.modelValue)),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),document.addEventListener("mousedown",P)}function y(){c.value=!1,window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m),document.removeEventListener("mousedown",P)}n.onBeforeUnmount(y);function _(){g(),n.nextTick(()=>{var x;return(x=l.value)==null?void 0:x.select()})}function A(){c.value||g(),d.value=0}function b(x){i("update:modelValue",x.groupCode),s.value=$l(x),y()}function v(){i("update:modelValue",void 0),s.value="",y()}function te(){s.value.trim()===""?v():(s.value=h.value,y())}function I(x){var O;if(x.key==="ArrowDown")c.value||g(),d.value=Math.min(d.value+1,p.value.length-1),x.preventDefault();else if(x.key==="ArrowUp")d.value=Math.max(d.value-1,0),x.preventDefault();else if(x.key==="Enter"){const H=p.value[d.value];H&&b(H),x.preventDefault()}else x.key==="Escape"&&(s.value=h.value,y(),(O=l.value)==null||O.blur())}function P(x){var H,de;const O=x.target;!((H=a.value)!=null&&H.contains(O))&&!((de=r.value)!=null&&de.contains(O))&&te()}return(x,O)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":O[0]||(O[0]=H=>s.value=H),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:A,onKeydown:I},null,40,t_),[[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:O[1]||(O[1]=n.withModifiers(()=>{},["prevent"])),onClick:v},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,(H,de)=>(n.openBlock(),n.createElementBlock("li",{key:H.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":de===d.value,"is-selected":H.groupCode===e.modelValue}]),role:"option","aria-selected":H.groupCode===e.modelValue,onMousedown:O[2]||(O[2]=n.withModifiers(()=>{},["prevent"])),onClick:z=>b(H),onMouseenter:z=>d.value=de},n.toDisplayString(n.unref($l)(H)),43,n_))),128)),p.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",o_,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),i_=["disabled"],a_={class:"em-aw__toolbar"},l_={class:"em-aw__count"},r_={class:"em-aw__scroll"},s_={class:"em-aw__table"},c_={key:0,class:"c-code"},d_=["colspan"],u_={class:"c-del"},f_={class:"c-flag"},m_={class:"c-flag"},p_={class:"c-flag"},h_={class:"c-flag"},y_={class:"c-flag"},g_={class:"c-flag"},b_={class:"c-flag"},__={class:"c-flag"},k_={key:0},w_=["title"],E_=["colspan"],v_={class:"c-del"},N_={class:"em-aw__embed-label"},$_={class:"em-aw__ro"},x_={class:"em-aw__ro"},I_={class:"em-aw__ro"},S_={class:"em-aw__ro"},C_={colspan:"8"},R_=["colspan"],V_={key:0},A_="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Gi="__OWN__",T_=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(U=>U.attrType!=="DIVIDER").length}),s=n.computed(()=>W.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,U){i.value&&o.updateAttribute(i.value.modelId,T.modelId,U)}function h(T){return!!i.value&&!!ri(o.state.logical,i.value.modelId,T.modelId)}function p(T,U){f(T,{naturalId:U||void 0,naturalIdMutable:U?T.naturalIdMutable:void 0})}function m(){return{naturalId:void 0,naturalIdMutable:void 0}}function g(T,U){f(T,{identifier:U,...U?m():{}})}function y(T,U){f(T,{transient:U||void 0,...U?m():{}})}function _(T){return!!T.transient}const A=T=>T.value,b=T=>T.label;function v(T,U){if(!U)return;const L=de.value.find(me=>me.type===U);if(L){const me=T.dbAttrs[0]??{modelId:T.modelId+".c",physicalName:T.name,dataType:"VARCHAR"};f(T,{type:U,customType:void 0,dbAttrs:[{...me,dataType:L.dataType,length:L.length,scale:L.scale}]});return}f(T,U===Ct?{type:U}:{type:U,customType:void 0})}function te(T,U){f(T,{customType:U.trim()===""?void 0:U})}function I(T,U){const me={...T.dbAttrs[0]??{modelId:T.modelId+".c",physicalName:T.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!Yo.has(me.dataType)&&(me.scale=void 0),f(T,{dbAttrs:[me]})}function P(T){var U;return Yo.has(((U=T.dbAttrs[0])==null?void 0:U.dataType)??"")}function x(T,U,L){var me;I(T,{logicalName:{...(me=T.dbAttrs[0])==null?void 0:me.logicalName,[U]:L}})}function O(T){return T.personalInfoAttributeType??"none"}function H(T,U){f(T,{personalInfoAttributeType:U==="none"?void 0:U})}const de=n.computed(()=>o.predefinedCustomTypeCatalog.value),z=n.computed(()=>o.embeddableCatalog.value);function oe(T){var U,L;return((U=T.label)==null?void 0:U.ko)??((L=T.label)==null?void 0:L.en)??T.type}function k(T){!T||!i.value||o.addPredefinedEmbed(i.value.modelId,T)}const W=n.computed(()=>o.groupCodeCatalog.value);function R(T){var U;return((U=W.value.find(L=>L.groupCode===T.groupCode))==null?void 0:U.codes)??[]}function G(T){return["none",...R(T)]}function F(T){return T==="none"?"none":T.code}function le(T){var L,me;if(T==="none")return"(없음)";const U=((L=T.label)==null?void 0:L.ko)??((me=T.label)==null?void 0:me.en);return U?`${T.code} (${U})`:T.code}function $(T,U){i.value&&o.setAttributeGroupCode(i.value.modelId,T.modelId,U)}function X(T,U){f(T,{defaultValue:U==="none"?void 0:U})}function re(T,U){f(T,{defaultValue:U.trim()===""?void 0:U})}function pe(T){return T.attrType.startsWith("EMBED")&&T.dbAttrs.length>0}function ye(T,U,L){const me=T.dbAttrs.map((J,Q)=>{if(Q!==U)return J;const ne={...J,...L};for(const se of Object.keys(L))L[se]===void 0&&delete ne[se];return ne});i.value&&o.setEmbedColumns(i.value.modelId,T.modelId,me)}function ue(T,U,L,me){var J;ye(T,U,{logicalName:{...(J=T.dbAttrs[U])==null?void 0:J.logicalName,[L]:me}})}function fe(T,U){var J,Q,ne;if(T.attrType==="EMBED_PREDEF"){const se=(J=o.embeddableCatalog.value.find(E=>E.type===T.type))==null?void 0:J.fields[U];return se?{name:se.name,physicalName:se.physicalName,dataType:se.dataType,length:se.length,shareable:se.shareable,logicalName:se.logicalName}:void 0}const L=(Q=T.embedded)==null?void 0:Q.embeddableRef;if(!L)return;const me=(ne=o.state.logical.entities.find(se=>se.modelId===L))==null?void 0:ne.attributes.flatMap(se=>se.dbAttrs)[U];return me?{physicalName:me.physicalName,dataType:me.dataType,length:me.length,scale:me.scale,logicalName:me.logicalName}:void 0}function ge(T,U){var L,me;return((L=fe(T,U))==null?void 0:L.dataType)||((me=T.dbAttrs[U])==null?void 0:me.dataType)||""}function Ee(T,U){var L,me;return((L=fe(T,U))==null?void 0:L.length)??((me=T.dbAttrs[U])==null?void 0:me.length)}function Re(T,U){var L,me;return((L=fe(T,U))==null?void 0:L.scale)??((me=T.dbAttrs[U])==null?void 0:me.scale)}const Ie=["inherit","true","false"];function he(T){return T==="inherit"?"기본(따름)":T}function Z(T){return(T==null?void 0:T.updatable)===void 0?"inherit":T.updatable?"true":"false"}function K(T,U,L){ye(T,U,{updatable:L==="inherit"?void 0:L==="true"})}function w(T,U){I(T,{updatable:U==="inherit"?void 0:U==="true"})}const S=["inherit","true","false"];function C(T){return T==="inherit"?"기본(따름)":T}function Y(T){return(T==null?void 0:T.insertable)===void 0?"inherit":T.insertable?"true":"false"}function ee(T,U,L){ye(T,U,{insertable:L==="inherit"?void 0:L==="true"})}function be(T,U){I(T,{insertable:U==="inherit"?void 0:U==="true"})}const we=n.computed(()=>i.value?Wo(i.value,o.state.logical.entities):[]),$e=n.computed(()=>Xn(we.value.flatMap(T=>T.attributes.flatMap(U=>U.dbAttrs)))),_e=n.computed(()=>we.value.flatMap(T=>T.attributes.filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>{var L;return{modelId:U.dbAttrs[0].modelId,physical:U.dbAttrs[0].physicalName||U.name,isCurrency:U.type==="Currency",ownerName:T.modelId===((L=i.value)==null?void 0:L.modelId)?void 0:T.name}})));function Ce(){const T=[..._e.value].sort((U,L)=>Number(L.isCurrency)-Number(U.isCurrency));return[Gi,...T.map(U=>U.modelId)]}function Te(T){if(T===Gi)return"전용 컬럼(OWN)";const U=_e.value.find(me=>me.modelId===T);return U?`↗ ${U.ownerName?`${U.ownerName}.`:""}${U.physical} (${U.isCurrency?"통화":"공유"})`:T}function Be(T){return(T==null?void 0:T.sharedColumnRef)??Gi}function N(T,U,L){ye(T,U,{sharedColumnRef:L===Gi?void 0:L})}function M(T){return(T==null?void 0:T.sharedColumnRef)!=null}function ie(T){var U;return((U=qo(T,$e.value))==null?void 0:U.physicalName)??""}return(T,U)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",a_,[n.createElementVNode("span",l_,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:U[0]||(U[0]=L=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"구분선",onClick:U[1]||(U[1]=L=>n.unref(o).addDivider(i.value.modelId))}),z.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:z.value,"value-provider":L=>L.type,"label-provider":oe,"onUpdate:modelValue":k},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",r_,[n.createElementVNode("table",s_,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[U[2]||(U[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),U[3]||(U[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),U[4]||(U[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),U[5]||(U[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),U[6]||(U[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),U[7]||(U[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),U[8]||(U[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),U[9]||(U[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),U[10]||(U[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),U[11]||(U[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),U[12]||(U[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),U[13]||(U[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),U[14]||(U[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),U[15]||(U[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),U[16]||(U[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),U[17]||(U[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),U[18]||(U[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),U[19]||(U[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),W.value.length?(n.openBlock(),n.createElementBlock("th",c_,"코드그룹")):n.createCommentVNode("",!0),U[20]||(U[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),U[21]||(U[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,L=>{var me,J,Q,ne,se,E,D,ce,V,q,B;return n.openBlock(),n.createElementBlock(n.Fragment,{key:L.modelId},[L.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(L.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-divlabel-${L.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":L.name,"onUpdate:modelValue":j=>f(L,{name:j})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,d_),n.createElementVNode("td",u_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:j=>n.unref(o).removeAttribute(i.value.modelId,L.modelId)},null,8,["onClick"])])],2)):pe(L)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(L.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${L.modelId}`,width:"100%",placeholder:"이름","model-value":L.name,"onUpdate:modelValue":j=>f(L,{name:j})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-type-${L.modelId}`,width:"100%",disabled:"","model-value":L.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:W.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(L.dbAttrs.length)+"개",9,E_),n.createElementVNode("td",v_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:j=>n.unref(o).removeAttribute(i.value.modelId,L.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(L.dbAttrs,(j,ke)=>{var De,Le,Pe,Fe,et,Ye,Ke;return n.openBlock(),n.createElementBlock("tr",{key:j.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",N_,"↳ "+n.toDisplayString(((De=fe(L,ke))==null?void 0:De.name)??((Le=fe(L,ke))==null?void 0:Le.physicalName)??`컬럼 ${ke+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",$_,n.toDisplayString(ge(L,ke)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-logical-${j.modelId}`,width:"100%",placeholder:((Fe=(Pe=fe(L,ke))==null?void 0:Pe.logicalName)==null?void 0:Fe.ko)??"논리명","model-value":((et=j.logicalName)==null?void 0:et.ko)??"","onUpdate:modelValue":je=>ue(L,ke,"ko",je)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-col-${j.modelId}`,width:"100%",disabled:M(j),placeholder:((Ye=fe(L,ke))==null?void 0:Ye.physicalName)??"컬럼","model-value":M(j)?ie(j):j.physicalName,"onUpdate:modelValue":je=>ye(L,ke,{physicalName:je})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":j.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",x_,n.toDisplayString(ge(L,ke)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",I_,n.toDisplayString(Ee(L,ke)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",S_,n.toDisplayString(Re(L,ke)??""),1)]),n.createElementVNode("td",C_,[(Ke=fe(L,ke))!=null&&Ke.shareable?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":Be(j),items:Ce(),"value-provider":u,"label-provider":Te,"onUpdate:modelValue":je=>je&&N(L,ke,je)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:M(j),"model-value":M(j)?"false":Y(j),items:S,"value-provider":u,"label-provider":C,"onUpdate:modelValue":je=>je&&ee(L,ke,je)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:M(j),"model-value":M(j)?"false":Z(j),items:Ie,"value-provider":u,"label-provider":he,"onUpdate:modelValue":je=>je&&K(L,ke,je)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:W.value.length?4:3},null,8,R_)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(L.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${L.modelId}`,width:"100%",placeholder:"이름","model-value":L.name,"onUpdate:modelValue":j=>f(L,{name:j})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-type-${L.modelId}`,width:"100%",placeholder:"타입",disabled:!!L.groupCode,items:n.unref(yr)(L.type,de.value),"value-provider":A,"label-provider":b,"model-value":L.type,"onUpdate:modelValue":j=>v(L,j)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),L.type===n.unref(Ct)?(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:0,name:`aw-customtype-${L.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":L.customType??"","onUpdate:modelValue":j=>te(L,j)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-logical-${L.modelId}`,width:"100%",placeholder:"논리명","model-value":((J=(me=L.dbAttrs[0])==null?void 0:me.logicalName)==null?void 0:J.ko)??"","onUpdate:modelValue":j=>x(L,"ko",j)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-col-${L.modelId}`,width:"100%",placeholder:"컬럼",disabled:_(L),"model-value":((Q=L.dbAttrs[0])==null?void 0:Q.physicalName)??"","onUpdate:modelValue":j=>I(L,{physicalName:j})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(ne=L.dbAttrs[0])==null?void 0:ne.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-dtype-${L.modelId}`,width:"100%",placeholder:"dataType",disabled:_(L),items:n.unref(pr)(((se=L.dbAttrs[0])==null?void 0:se.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref($a),"model-value":((E=L.dbAttrs[0])==null?void 0:E.dataType)??"","onUpdate:modelValue":j=>j&&I(L,{dataType:j})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-len-${L.modelId}`,width:"100%",placeholder:"len",disabled:_(L),"model-value":(D=L.dbAttrs[0])==null?void 0:D.length,"onUpdate:modelValue":j=>I(L,{length:j||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-scale-${L.modelId}`,width:"100%",placeholder:"scale",disabled:_(L)||!P(L),"model-value":(ce=L.dbAttrs[0])==null?void 0:ce.scale,"onUpdate:modelValue":j=>I(L,{scale:j||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",f_,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-pk-${L.modelId}`,"model-value":L.identifier,disabled:a.value||_(L),"onUpdate:modelValue":j=>g(L,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",m_,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nn-${L.modelId}`,"model-value":L.notNull,disabled:_(L),"onUpdate:modelValue":j=>f(L,{notNull:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",p_,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-uq-${L.modelId}`,"model-value":!!((V=L.dbAttrs[0])!=null&&V.unique),disabled:_(L),"onUpdate:modelValue":j=>I(L,{unique:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",h_,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-ai-${L.modelId}`,"model-value":!!((q=L.dbAttrs[0])!=null&&q.autoIncrement),disabled:_(L)||!L.identifier,"onUpdate:modelValue":j=>I(L,{autoIncrement:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",y_,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-tr-${L.modelId}`,"model-value":!!L.transient,disabled:L.identifier,"onUpdate:modelValue":j=>y(L,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",g_,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nid-${L.modelId}`,"model-value":!!L.naturalId,disabled:L.identifier||_(L),"onUpdate:modelValue":j=>p(L,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",b_,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nidm-${L.modelId}`,"model-value":!!L.naturalIdMutable,disabled:_(L)||!L.naturalId,"onUpdate:modelValue":j=>f(L,{naturalIdMutable:j||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",__,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-mv-${L.modelId}`,"model-value":!!((B=L.dbAttrs[0])!=null&&B.multiValue),disabled:_(L),"onUpdate:modelValue":j=>I(L,{multiValue:j||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-ins-${L.modelId}`,width:"100%",disabled:_(L),"model-value":Y(L.dbAttrs[0]),items:S,"value-provider":u,"label-provider":C,"onUpdate:modelValue":j=>j&&be(L,j)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-upd-${L.modelId}`,width:"100%",disabled:_(L),"model-value":Z(L.dbAttrs[0]),items:Ie,"value-provider":u,"label-provider":he,"onUpdate:modelValue":j=>j&&w(L,j)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":O(L),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":j=>j&&H(L,j)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("td",k_,[n.createVNode(zd,{"model-value":L.groupCode,items:W.value,"onUpdate:modelValue":j=>$(L,j)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[R(L).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":L.defaultValue??"none",items:G(L),"value-provider":F,"label-provider":le,"onUpdate:modelValue":j=>j&&X(L,j)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`aw-default-${L.modelId}`,width:"100%",placeholder:"기본값","model-value":L.defaultValue??"","onUpdate:modelValue":j=>re(L,j)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",{class:"c-del",title:h(L)?A_:void 0},[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:j=>n.unref(o).removeAttribute(i.value.modelId,L.modelId)},null,8,["onClick"])],8,w_)],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",V_,[...U[22]||(U[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,i_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-79ca2048"]]),M_=["disabled"],B_={class:"em-idxw__list"},D_={class:"em-idxw__list-head"},O_=["onClick"],L_={class:"em-idxw__item-name"},P_={key:0,class:"em-idxw__badge"},z_={class:"em-idxw__item-cnt"},U_={key:0,class:"em-idxw__empty"},F_={key:0,class:"em-idxw__edit"},H_={class:"em-idxw__form"},G_={class:"em-field em-idxw__name"},Y_={class:"em-field"},W_=["value"],K_={class:"em-idxw__transfer"},q_={class:"em-idxw__pane"},X_={class:"em-idxw__pane-head"},j_={class:"em-idxw__cols"},Z_=["onClick"],J_={key:0,class:"em-idxw__empty"},Q_={class:"em-idxw__arrows"},ek={class:"em-idxw__pane"},tk={class:"em-idxw__pane-head"},nk={class:"em-idxw__cols"},ok={class:"em-idxw__col-name"},ik={class:"em-idxw__col-ops"},ak=["disabled","onClick"],lk=["disabled","onClick"],rk=["onClick"],sk={key:0,class:"em-idxw__empty"},ck={key:1,class:"em-idxw__edit em-idxw__edit--empty"},dk=Ue(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(I=>I.modelId===t.entityId)??null),a=n.computed(()=>{var I;return((I=i.value)==null?void 0:I.indexes)??[]}),l=n.computed(()=>{var I;return((I=i.value)==null?void 0:I.attributes)??[]}),r=n.ref(null);n.watch(a,I=>{var P;I.some(x=>x.modelId===r.value)||(r.value=((P=I[0])==null?void 0:P.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(I=>I.modelId===r.value)??null),c=n.computed(()=>{var I;return new Set(((I=s.value)==null?void 0:I.columns.map(P=>P.columnRef))??[])}),d=n.computed(()=>l.value.filter(I=>!c.value.has(I.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(I){var x;const P=(x=I.dbAttrs[0])==null?void 0:x.physicalName;return P&&P!==I.name?`${I.name} (${P})`:I.name}function h(I){const P=l.value.find(x=>x.modelId===I);return P?f(P):I}function p(I,P){i.value&&o.updateIndex(i.value.modelId,I,P)}function m(){var P;if(!i.value)return;const I=Oe();o.addIndex(i.value.modelId,{modelId:I,name:`idx_${(((P=i.value.indexes)==null?void 0:P.length)??0)+1}`,unique:!1,columns:[]}),r.value=I}function g(I){i.value&&o.removeIndex(i.value.modelId,I)}function y(I){s.value&&p(s.value.modelId,{parameters:I.trim()===""?void 0:I})}function _(I){const P=new Set(u.value);P.has(I)?P.delete(I):P.add(I),u.value=P}function A(){const I=s.value;if(!I||!u.value.size)return;const P=[...u.value].map(x=>({columnRef:x,descending:!1}));p(I.modelId,{columns:[...I.columns,...P]}),u.value=new Set}function b(I){const P=s.value;P&&p(P.modelId,{columns:P.columns.filter((x,O)=>O!==I)})}function v(I,P){const x=s.value;x&&p(x.modelId,{columns:x.columns.map((O,H)=>H===I?{...O,descending:P}:O)})}function te(I,P){const x=s.value;if(!x)return;const O=I+P;if(O<0||O>=x.columns.length)return;const H=[...x.columns];[H[I],H[O]]=[H[O],H[I]],p(x.modelId,{columns:H})}return(I,P)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",B_,[n.createElementVNode("div",D_,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:m})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,x=>(n.openBlock(),n.createElementBlock("li",{key:x.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":x.modelId===r.value}]),onClick:O=>r.value=x.modelId},[n.createElementVNode("span",L_,n.toDisplayString(x.name||"(이름 없음)"),1),x.unique?(n.openBlock(),n.createElementBlock("span",P_,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",z_,n.toDisplayString(x.columns.length),1)],10,O_))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",U_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",F_,[n.createElementVNode("div",H_,[n.createElementVNode("label",G_,[P[4]||(P[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":P[0]||(P[0]=x=>p(s.value.modelId,{name:x}))},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(ae.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":P[1]||(P[1]=x=>p(s.value.modelId,{unique:x}))},null,8,["model-value"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:P[2]||(P[2]=x=>g(s.value.modelId))})]),n.createElementVNode("label",Y_,[P[5]||(P[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:P[3]||(P[3]=x=>y(x.target.value))},null,40,W_)]),n.createElementVNode("div",K_,[n.createElementVNode("div",q_,[n.createElementVNode("div",X_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",j_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,x=>(n.openBlock(),n.createElementBlock("li",{key:x.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(x.modelId)}]),onClick:O=>_(x.modelId)},n.toDisplayString(f(x)),11,Z_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",J_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",Q_,[n.createVNode(n.unref(ae.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:A},null,8,["disabled"])]),n.createElementVNode("div",ek,[n.createElementVNode("div",tk,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",nk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(x,O)=>(n.openBlock(),n.createElementBlock("li",{key:O,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",ok,n.toDisplayString(h(x.columnRef)),1),n.createVNode(n.unref(ae.BSCheckbox),{name:`idxw-desc-${O}`,class:"em-check",label:"DESC","model-value":x.descending,"onUpdate:modelValue":H=>v(O,H)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",ik,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:O===0,onClick:H=>te(O,-1)},"↑",8,ak),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:O===s.value.columns.length-1,onClick:H=>te(O,1)},"↓",8,lk),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:H=>b(O)},"✕",8,rk)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",sk,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",ck,"인덱스를 선택하거나 추가하세요."))],8,M_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),uk={class:"em-op-src"},fk={class:"em-op-src__actions"},Ud=Ue(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ae.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",uk,[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",fk,[n.createVNode(n.unref(ae.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-2150d2fc"]]),mk=["disabled"],pk={class:"em-ow__toolbar"},hk={class:"em-ow__count"},yk={class:"em-ow__scroll"},gk={class:"em-ow__table"},bk={class:"c-del"},_k={key:0},kk=Ue(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.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,g){a.value&&o.updateOperation(a.value.modelId,m.modelId,g)}function u(m,g,y){d(m,{description:{...m.description,[g]:y}})}function f(m){return m.personalInfoAttributeType??"none"}function h(m,g){d(m,{personalInfoAttributeType:g==="none"?void 0:g})}function p(m){i.openModal({component:Ud,bind:{operationName:m.name,sourceCode:m.sourceCode??"",onSave:g=>d(m,{sourceCode:g})}})}return(m,g)=>{var y,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",pk,[n.createElementVNode("span",hk,"오퍼레이션 ("+n.toDisplayString(((y=a.value.operations)==null?void 0:y.length)??0)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:g[0]||(g[0]=A=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",yk,[n.createElementVNode("table",gk,[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??[],A=>{var b;return n.openBlock(),n.createElementBlock("tr",{key:A.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-name-${A.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":A.name,"onUpdate:modelValue":v=>d(A,{name:v})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":A.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":v=>v&&d(A,{visibility:v})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-desc-${A.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((b=A.description)==null?void 0:b.ko)??"","onUpdate:modelValue":v=>u(A,"ko",v)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":f(A),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":v=>v&&h(A,v)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:A.sourceCode?"본문 ●":"본문",onClick:v=>p(A)},null,8,["caption","onClick"])]),n.createElementVNode("td",bk,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:v=>n.unref(o).removeOperation(a.value.modelId,A.modelId)},null,8,["onClick"])])])}),128)),(_=a.value.operations)!=null&&_.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",_k,[...g[1]||(g[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,mk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),wk={class:"em-detail__tabs"},Ek=["onClick"],vk=Ue(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.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(ae.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",wk,[(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,Ek)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(Ld,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(T_,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(dk,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(kk,{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 Yi(e,t,o){e.openModal({component:vk,bind:{controller:n.markRaw(t),entityId:o}})}const Fd="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function Nk(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 $k=220;function xk(e,t){let i=-1/0;for(const l of e.entityLayouts)i=Math.max(i,l.geo.location.x+(l.geo.size.width||$k));for(const l of e.groupLayouts)i=Math.max(i,l.geo.location.x+l.geo.size.width);let a=1/0;for(const l of t.entityLayouts)a=Math.min(a,l.geo.location.x);for(const l of t.groupLayouts)a=Math.min(a,l.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const xl=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),pn=Symbol("editorController");function Hd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Wi(e,t){const o=[];for(const i of t.remove)o.push(xn(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 Pn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function zn(e,t){const o=[];for(const[i,a]of vm(e,t,Oe))o.push(...Wi(i,a));return o}function Gd(e,t,o){const i=new Set(o.remove);return Pn(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 Il(e,t){const o=to(e,t,Oe),i=Wi(t,o),a=Gd(e,t,o);return i.push(...zn(a,t)),i}function Yd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Oe()}))}function Ik(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,g=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: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=to(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(xn(u.ownerId,u.dispId)),i.push(oi(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Wi(t,s));const c=Gd(r,t,s);return i.push(...zn(c,t)),i}function Sk(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(b=>b.modelId===c);if(!d||d.attributes.some(b=>{var v;return((v=b.embedded)==null?void 0:v.associationRef)===l.modelId}))continue;const u=Oe(),f=d.attributes.reduce((b,v)=>Math.max(b,v.order),-1)+1,h=new Set(d.attributes.map(b=>b.name)),p=a(o.name);let m=p;for(let b=2;h.has(m);b++)m=`${p}${b}`;const g=o.attributes.filter(b=>!b.identifier&&!b.derivedFrom).flatMap(b=>b.dbAttrs).map(b=>({...b,modelId:Oe()})),y={modelId:u,name:m,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:g,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(Vt(c,y));const _=r?"end2":"end1",A=r?"end1":"end2";i.push(oi(l.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Oe()},[A]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Ck(e=Hd(),t={}){var Te,Be;const o=n.reactive(e);let i=new Ma(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),g=n.ref(!1),y=n.ref(0),_=n.ref(null);let A=0;const b=N=>{if(t.onNotice){t.onNotice(N);return}_.value={text:N,id:++A}},v=n.ref(((Te=t.meta)==null?void 0:Te.schemaVersion)??1),te=n.ref(((Be=t.meta)==null?void 0:Be.opWriteEnabled)??!1),I=n.computed(()=>v.value>=2&&te.value),P=t.historyTransport,x=n.computed(()=>I.value&&P!==void 0),O=t.restoreTransport,H=n.ref(0),de=n.computed(()=>I.value&&oe.value&&O!==void 0);async function z(N){if(!O||!oe.value)return{ok:!1,reason:"unavailable"};const M=await O(N);return M.ok&&H.value++,M}const oe=n.ref(!(v.value>=2&&te.value===!1)),k=n.ref("LOGICAL_PHYSICAL"),W=n.ref("straight"),R=n.ref(!0),G=n.ref(!0),F=n.ref(null),le=n.computed(()=>{var N;return((N=F.value)==null?void 0:N.kind)==="attribute"?{entityId:F.value.entityId,attrId:F.value.anchor}:null}),$=n.computed(()=>{var N;return((N=F.value)==null?void 0:N.kind)==="attribute"?F.value.ids:[]}),X=n.computed(()=>{var N,M;return((N=F.value)==null?void 0:N.kind)==="entity"?F.value.id:((M=F.value)==null?void 0:M.kind)==="attribute"?F.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,g.value=i.isDirty,y.value++})}ge();let Ee=null,Re=null;function Ie(){Re==null||Re(),Re=null,Ee=null}function he(){if(Ie(),!I.value||!t.opTransport)return;const N=new bs({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:M=>{oe.value=!1,ue.value=M},onError:t.onOpError});N.seed((fe==null?void 0:fe.revSeed)??{}),Re=N.attach(i),Ee=N}he();const Z=n.computed(()=>tr(o.logical,o.layout)),K=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:h.value,embeddableCatalog:a.value})),w=n.computed(()=>_r(o.logical,K.value)),S=n.computed(()=>{const N=new Map;for(const M of w.value){if(!M.targetRef)continue;const ie=N.get(M.targetRef);ie?ie.push(M):N.set(M.targetRef,[M])}return N}),C=N=>{oe.value&&i.execute(N)},Y=N=>o.layout.entityLayouts.some(M=>M.entityRef===N&&!!M.locked),ee=N=>o.layout.groupLayouts.some(M=>M.groupRef===N&&!!M.locked),be=N=>{const M=o.logical.associations.find(ie=>ie.modelId===N);return!!M&&(Y(M.end1.entityRef)||Y(M.end2.entityRef))},we=(N,M,ie)=>{if(Y(N))return;const T=en(N,M,ie),U=Pn(o.logical,N,me=>me.map(J=>J.modelId===M?{...J,...ie}:J)),L=zn(U,N);C(L.length?Ge("속성 수정",[T,...L]):T)};function $e(N){const M=N.map(Q=>o.layout.entityLayouts.find(ne=>ne.entityRef===Q)).filter(Q=>!!Q);if(!M.length)return{location:{x:40,y:40},size:{width:400,height:300}};let ie=1/0,T=1/0,U=-1/0,L=-1/0;for(const Q of M){const ne=Q.geo.size.width||220,se=Q.geo.size.height||140;ie=Math.min(ie,Q.geo.location.x),T=Math.min(T,Q.geo.location.y),U=Math.max(U,Q.geo.location.x+ne),L=Math.max(L,Q.geo.location.y+se)}const me=40,J=28;return{location:{x:ie-me,y:T-me-J},size:{width:U-ie+me*2,height:L-T+me*2+J}}}function _e(N,M,ie){var Q;const T=o.layout.groupLayouts.find(ne=>ne.groupRef===N),U=(T==null?void 0:T.geo.location)??M,L=M.x-U.x,me=M.y-U.y,J=[zr(N,M),...ie.map(ne=>$n(ne.id,ne.location))];if(L||me){const ne=new Set(((Q=o.logical.groups.find(se=>se.modelId===N))==null?void 0:Q.memberEntityRefs)??[]);for(const se of o.logical.associations){if(!ne.has(se.end1.entityRef)||!ne.has(se.end2.entityRef))continue;const E=o.layout.associationLayouts.find(D=>D.associationRef===se.modelId);E&&E.waypoints.length&&J.push(ts(se.modelId,L,me))}for(const se of(T==null?void 0:T.memberNoteRefs)??[]){const E=o.layout.notes.find(D=>D.modelId===se);E&&J.push(eo(se,{x:E.geo.location.x+L,y:E.geo.location.y+me}))}}return J}const Ce={state:o,resolved:Z,issues:w,issuesByRef:S,flagEntitiesWithoutRelations:h,canUndo:p,canRedo:m,dirty:g,revision:y,notice:_,editable:oe,schemaVersion:v,opWriteEnabled:te,opMode:I,opConflict:ue,historyTransport:P,historyAvailable:x,restoreTransport:O,restoreAvailable:de,restoreToSeq:z,reloadRequest:H,displayMode:k,routingMode:W,showGrid:R,showMinimap:G,selection:F,selectedAttr:le,selectedAttrIds:$,inspectedEntityId:X,focusRequest:re,clipboard:ye,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(N){oe.value=N&&I.value},setEmbeddableCatalog(N){a.value=N},setGroupCodeCatalog(N){l.value=N},setPredefinedCustomTypeCatalog(N){r.value=N},selectAttribute(N,M,ie="replace"){const T=F.value,U=(T==null?void 0:T.kind)==="attribute"&&T.entityId===N;if(ie==="replace"||!U){F.value={kind:"attribute",entityId:N,ids:[M],anchor:M};return}if(ie==="toggle"){const E=T.ids.includes(M),D=E?T.ids.filter(V=>V!==M):[...T.ids,M];if(!D.length){F.value=null;return}const ce=E&&T.anchor===M?D[D.length-1]:E?T.anchor:M;F.value={kind:"attribute",entityId:N,ids:D,anchor:ce};return}const L=o.logical.entities.find(E=>E.modelId===N),me=[...(L==null?void 0:L.attributes)??[]].sort((E,D)=>E.order-D.order).map(E=>E.modelId),J=me.indexOf(T.anchor),Q=me.indexOf(M);if(J<0||Q<0){F.value={kind:"attribute",entityId:N,ids:[M],anchor:M};return}const[ne,se]=J<=Q?[J,Q]:[Q,J];F.value={kind:"attribute",entityId:N,ids:me.slice(ne,se+1),anchor:T.anchor}},moveAttributeFocus(N){const M=F.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const ie=o.logical.entities.find(me=>me.modelId===M.entityId);if(!ie||!ie.attributes.length)return!1;const T=ie.attributes.findIndex(me=>me.modelId===M.anchor);if(T<0)return!1;const U=Math.min(Math.max(T+N,0),ie.attributes.length-1);if(U===T)return!0;const L=ie.attributes[U].modelId;return F.value={kind:"attribute",entityId:M.entityId,ids:[L],anchor:L},!0},nudgeSelectedAttributes(N){const M=F.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const ie=o.logical.entities.find(E=>E.modelId===M.entityId);if(!ie)return!1;const T=ie.attributes,U=new Set(M.ids),L=T.map((E,D)=>U.has(E.modelId)?D:-1).filter(E=>E>=0);if(!L.length)return!1;const me=Math.min(...L),J=T.filter(E=>!U.has(E.modelId)),Q=T.slice(0,me).filter(E=>!U.has(E.modelId)).length;let ne;if(N<0){if(Q<=0)return!0;ne=Q-1}else{if(J.length-Q<=0)return!0;ne=Q+1}if(Y(M.entityId))return!0;const se=T.filter(E=>U.has(E.modelId)).map(E=>E.modelId);return C(Da(M.entityId,se,ne)),!0},deleteSelection(){if(!oe.value)return!1;const N=F.value;if(!N)return!1;if(N.kind==="attribute"){if(Y(N.entityId))return!1;const M=N.ids;if(!M.length)return!1;M.length===1?Ce.removeAttribute(N.entityId,M[0]):Ce.removeAttributes(N.entityId,M)}else if(N.kind==="entity"){if(Y(N.id))return!1;Ce.removeEntity(N.id)}else if(N.kind==="note")Ce.removeNote(N.id);else if(N.kind==="group"){if(ee(N.id))return!1;Ce.removeGroup(N.id)}else Ce.removeAssociation(N.id);return F.value=null,!0},nudgeNodes(N,M,ie){if(!N.length||M===0&&ie===0)return!1;const T=new Set(o.logical.entities.map(ne=>ne.modelId)),U=new Set(o.logical.groups.map(ne=>ne.modelId)),L=new Set(o.layout.notes.map(ne=>ne.modelId)),me=new Set;for(const ne of N){if(!U.has(ne))continue;const se=o.logical.groups.find(E=>E.modelId===ne);for(const E of(se==null?void 0:se.memberEntityRefs)??[])me.add(E)}const J=[],Q=[];for(const ne of N)if(U.has(ne)){if(ee(ne))continue;const se=o.layout.groupLayouts.find(V=>V.groupRef===ne);if(!se)continue;const E=o.logical.groups.find(V=>V.modelId===ne),D=((E==null?void 0:E.memberEntityRefs)??[]).map(V=>{var B;const q=((B=o.layout.entityLayouts.find(j=>j.entityRef===V))==null?void 0:B.geo.location)??{x:0,y:0};return{id:V,location:{x:q.x+M,y:q.y+ie}}}),ce={x:se.geo.location.x+M,y:se.geo.location.y+ie};J.push(Ge("그룹 이동",_e(ne,ce,D))),Q.push("g:"+ne)}else if(T.has(ne)){if(me.has(ne)||Y(ne))continue;const se=o.layout.entityLayouts.find(E=>E.entityRef===ne);if(!se)continue;J.push($n(ne,{x:se.geo.location.x+M,y:se.geo.location.y+ie})),Q.push("e:"+ne)}else if(L.has(ne)){const se=o.layout.notes.find(E=>E.modelId===ne);if(!se)continue;J.push(eo(ne,{x:se.geo.location.x+M,y:se.geo.location.y+ie})),Q.push("n:"+ne)}return J.length?(C(Ge("이동",J,"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,M){Ie(),o.logical=N.logical,o.layout=N.layout,i=new Ma(o),ge(),v.value=(M==null?void 0:M.schemaVersion)??1,te.value=(M==null?void 0:M.opWriteEnabled)??!1,oe.value=!(v.value>=2&&te.value===!1),fe=M,ue.value=null,F.value=null,p.value=i.canUndo,m.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",M={x:80,y:80}){const ie=Oe(),T={modelId:ie,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(Jo(T,{location:{...M},size:{width:220,height:140}})),ie},renameEntity(N,M){Y(N)||C(Ar(N,M))},updateEntity(N,M){if(Y(N))return;const ie=Vr(N,M),T=o.logical.entities.find(me=>me.modelId===N),U=M.stereotype==="JPA_EMBEDDABLE"&&!!T&&T.stereotype!=="JPA_EMBEDDABLE",L=!!M.stereotype&&M.stereotype!=="JPA_EMBEDDABLE"&&!!T&&T.stereotype==="JPA_EMBEDDABLE";if(U&&T){const me=T.attributes.filter(E=>E.identifier&&!E.derivedFrom).map(E=>en(N,E.modelId,{identifier:!1})),J=Pn({...o.logical,entities:o.logical.entities.map(E=>E.modelId===N?{...E,stereotype:"JPA_EMBEDDABLE"}:E)},N,E=>E.map(D=>D.identifier&&!D.derivedFrom?{...D,identifier:!1}:D)),Q=Il(J,N),ne=Sk(o.logical,N),se=[ie,...me,...Q,...ne];C(se.length>1?Ge("임베더블 변환",se):ie);return}if(L){const me=Ik(o.logical,N),J=[ie,...me];C(J.length>1?Ge("엔터티 전환",J):ie);return}C(ie)},moveEntity(N,M){Y(N)||C($n(N,M))},resizeEntity(N,M){Y(N)||C(Tr(N,M))},removeEntity(N){Y(N)||C(Rr(N))},setEntitySwatch(N,M){C(Mr(N,M))},setEntityCollapsed(N,M){C(Br(N,M))},setEntityLocked(N,M){C(Dr(N,M))},isEntityLocked(N){return Y(N)},collapseAll(){C(Ba(!0))},expandAll(){C(Ba(!1))},setAttributeSwatch(N,M,ie){C(Qo(N,M,ie))},dragGroup(N,M,ie){ee(N)||C(Ge("그룹 이동",_e(N,M,ie)))},resizeGroup(N,M){ee(N)||C(Ur(N,M))},setGroupSwatch(N,M){C(Fr(N,M))},setGroupLocked(N,M){C(Hr(N,M))},isGroupLocked(N){return ee(N)},updateGroup(N,M){ee(N)||C(Or(N,M))},createGroup(N,M){if(!N.length)return null;const ie=[];for(const L of o.logical.groups)for(const me of N)L.memberEntityRefs.includes(me)&&ie.push(ti(L.modelId,me));const T=Oe(),U={modelId:T,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...N]};return ie.push(ei(U,$e(N))),C(Ge("그룹 생성",ie)),F.value=null,T},addEmptyGroup(N,M){const ie=Oe();return C(ei({modelId:ie,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...N},size:{width:360,height:260}})),ie},removeGroup(N){ee(N)||C(Lr(N))},dropEntity(N,M,ie){var L;if(Y(N))return;const T=((L=o.logical.groups.find(me=>me.memberEntityRefs.includes(N)))==null?void 0:L.modelId)??null,U=[$n(N,M)];T!==ie&&(T&&U.push(ti(T,N)),ie&&U.push(Pr(ie,N))),C(Ge("이동",U))},ungroupEntity(N){const M=o.logical.groups.find(ie=>ie.memberEntityRefs.includes(N));M&&C(ti(M.modelId,N))},dropNote(N,M,ie){var L;const T=((L=o.layout.groupLayouts.find(me=>{var J;return(J=me.memberNoteRefs)==null?void 0:J.includes(N)}))==null?void 0:L.groupRef)??null,U=[eo(N,M)];T!==ie&&(T&&U.push(ds(T,N)),ie&&U.push(cs(ie,N))),C(Ge("이동",U))},addPredefinedEmbed(N,M){if(Y(N))return;const ie=a.value.find(Q=>Q.type===M),T=o.logical.entities.find(Q=>Q.modelId===N);if(!ie||!T)return;const U=T.attributes.reduce((Q,ne)=>Math.max(Q,ne.order),-1)+1,L=Oe(),me=ie.fields.map(()=>({modelId:Oe(),physicalName:"",dataType:""})),J={modelId:L,name:ie.defaultName,type:ie.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:U,dbAttrs:me};return C(Vt(N,J)),L},addAttribute(N,M={}){if(Y(N))return M.modelId??"";const ie=o.logical.entities.find(se=>se.modelId===N),T=ie?ie.attributes.length:0,U=M.modelId??Oe(),L=M.name??`field${T}`,me={modelId:U,name:L,type:M.type??xa,attrType:M.attrType??"NORMAL",identifier:M.identifier??!1,notNull:M.notNull??!1,order:T,dbAttrs:M.dbAttrs??[{modelId:Oe(),physicalName:L,dataType:"VARCHAR",length:255}],...M},J=Vt(N,me),Q=Pn(o.logical,N,se=>[...se,me]),ne=zn(Q,N);return C(ne.length?Ge("속성 추가",[J,...ne]):J),U},addDivider(N){if(Y(N))return"";const M=o.logical.entities.find(L=>L.modelId===N),ie=M?M.attributes.length:0,T=Oe();return C(Vt(N,{modelId:T,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:ie,dbAttrs:[]})),T},updateAttribute(N,M,ie){we(N,M,ie)},setAttributeGroupCode(N,M,ie){we(N,M,{groupCode:ie,type:ie?qn:xa})},setEmbedColumns(N,M,ie){var Q,ne;if(Y(N))return;const T=en(N,M,{dbAttrs:ie}),U=(Q=o.logical.entities.find(se=>se.modelId===N))==null?void 0:Q.attributes.find(se=>se.modelId===M),L=(ne=U==null?void 0:U.embedded)==null?void 0:ne.associationRef,me=L?o.logical.associations.find(se=>se.modelId===L):void 0,J=[];me&&L&&(me.end1.legacyEmbedRaw&&J.push(In(L,"end1",{legacyEmbedRaw:void 0})),me.end2.legacyEmbedRaw&&J.push(In(L,"end2",{legacyEmbedRaw:void 0}))),C(J.length?Ge("임베드 컬럼 수정",[T,...J]):T)},removeAttribute(N,M){if(Y(N))return;if(ri(o.logical,N,M)){b(Fd);return}const ie=xn(N,M),T=Pn(o.logical,N,L=>L.filter(me=>me.modelId!==M)),U=zn(T,N);C(U.length?Ge("속성 삭제",[ie,...U]):ie)},removeAttributes(N,M){var J;if(!M.length||Y(N))return;const ie=M.filter(Q=>!ri(o.logical,N,Q));if(ie.length<M.length&&b(Fd),!ie.length)return;const T=ie.map(Q=>xn(N,Q)),U=new Set(ie),L=Pn(o.logical,N,Q=>Q.filter(ne=>!U.has(ne.modelId))),me=[...T,...zn(L,N)];C(me.length===1?me[0]:Ge("속성 삭제",me)),((J=F.value)==null?void 0:J.kind)==="attribute"&&F.value.entityId===N&&(F.value=null)},setAttributeSwatches(N,M,ie){M.length&&(M.length===1?C(Qo(N,M[0],ie)):C(Ge("속성 색상",M.map(T=>Qo(N,T,ie)))))},reorderAttributes(N,M,ie){!M.length||Y(N)||C(Da(N,M,ie))},addIndex(N,M){Y(N)||C(jr(N,M))},updateIndex(N,M,ie){Y(N)||C(Zr(N,M,ie))},removeIndex(N,M){Y(N)||C(Jr(N,M))},addOperation(N,M={}){var me;if(Y(N))return M.modelId??"";const ie=o.logical.entities.find(J=>J.modelId===N),T=((me=ie==null?void 0:ie.operations)==null?void 0:me.length)??0,U=M.modelId??Oe(),L={modelId:U,name:M.name??`method${T}`,visibility:M.visibility??"PACKAGE",order:T,...M};return C(Gr(N,L)),U},updateOperation(N,M,ie){Y(N)||C(Yr(N,M,ie))},removeOperation(N,M){Y(N)||C(Wr(N,M))},reorderOperations(N,M,ie){!M.length||Y(N)||C(Kr(N,M,ie))},setOperationSwatch(N,M,ie){C(qr(N,M,ie))},addAssociation(N,M,ie,T){if(Y(N)||Y(M))return"";const U=Oe(),L={modelId:U,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:ie},end2:{entityRef:M,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},me={...o.logical,associations:[...o.logical.associations,L]},J=to(me,M,Oe),Q=J.add[0];Q&&(L.end2.attributeRef=Q.modelId);const ne={associationRef:U,waypoints:[],sourceColumnRef:ie,targetColumnRef:(Q==null?void 0:Q.modelId)??T},se=ni(L,ne),E=Wi(M,J);return C(E.length?Ge("관계 추가",[se,...E]):se),U},addEmbedAssociation(N,M){if(Y(N))return;const ie=o.logical.entities.find(B=>B.modelId===N),T=o.logical.entities.find(B=>B.modelId===M);if(!ie||!T||T.stereotype!=="JPA_EMBEDDABLE")return;const U=Oe(),L=Oe(),me=Oe(),J=ie.attributes.reduce((B,j)=>Math.max(B,j.order),-1)+1,Q=Yd(T),ne=B=>B&&B.charAt(0).toLowerCase()+B.slice(1),se=new Set(ie.attributes.map(B=>B.name)),E=ne(T.name);let D=E;for(let B=2;se.has(D);B++)D=`${E}${B}`;const ce={modelId:L,name:D,type:T.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:J,dbAttrs:Q,embedded:{associationRef:U,embeddableRef:M}},V={modelId:U,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:me},end2:{entityRef:M,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:L}},q={associationRef:U,waypoints:[],sourceColumnRef:L,targetColumnRef:void 0};return C(Ge("임베드 추가",[Vt(N,ce),ni(V,q)])),U},setEmbedCollectionMode(N,M){if(be(N))return;const ie=o.logical.associations.find(ne=>ne.modelId===N);if(!ie)return;let T,U;for(const ne of o.logical.entities){const se=ne.attributes.find(E=>{var D;return((D=E.embedded)==null?void 0:D.associationRef)===N&&E.attrType==="EMBED_OWN"});if(se){T=ne.modelId,U=se;break}}if(!T||!U)return;const L=U.embedded.embeddableRef,me=ie.end2.entityRef===L?"end2":"end1",J=ie[me],Q=J.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(M==="COLLECTION"?Q:!Q))if(M==="COLLECTION")C(Ge("임베드 컬렉션 전환",[en(T,U.modelId,{dbAttrs:[]}),In(N,me,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...J.jpa,collectionType:"LIST"}})]));else{const ne=o.logical.entities.find(se=>se.modelId===L);if(!ne)return;C(Ge("임베드 단일 전환",[en(T,U.modelId,{dbAttrs:Yd(ne)}),In(N,me,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...J.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(N){if(be(N))return;const M=o.logical.associations.find(me=>me.modelId===N),ie=Xr(N);if(!M){C(ie);return}for(const me of o.logical.entities){const J=me.attributes.find(Q=>{var ne;return((ne=Q.embedded)==null?void 0:ne.associationRef)===N});if(J){C(Ge("임베드 삭제",[ie,xn(me.modelId,J.modelId)]));return}}const T=M.end2.entityRef,U={...o.logical,associations:o.logical.associations.filter(me=>me.modelId!==N)},L=Il(U,T);C(L.length?Ge("관계 삭제",[ie,...L]):ie)},setAssociationIdentifying(N,M){if(be(N))return;const ie=o.logical.associations.find(J=>J.modelId===N),T=oi(N,{identifying:M});if(!ie||ie.identifying===M){C(T);return}const U=ie.end2.entityRef,L={...o.logical,associations:o.logical.associations.map(J=>J.modelId===N?{...J,identifying:M}:J)},me=Il(L,U);C(me.length?Ge("식별 관계 변경",[T,...me]):T)},updateAssociationEnd(N,M,ie){be(N)||C(In(N,M,ie))},moveWaypoint(N,M,ie){C(Qr(N,M,ie))},addWaypoint(N,M,ie){C(os(N,M,ie))},removeWaypoint(N,M){C(es(N,M))},clearWaypoints(N){C(ns(N))},addNote(N="메모",M={x:80,y:80}){const ie=Oe();return C(is({modelId:ie,memo:N,geo:{location:{...M},size:{width:200,height:120}}})),ie},removeNote(N){C(as(N))},moveNote(N,M){C(eo(N,M))},resizeNote(N,M){C(ls(N,M))},setNoteMemo(N,M){C(rs(N,M))},setNoteSwatch(N,M){C(ss(N,M))},addNoteConnection(N,M){C(us(N,M))},removeNoteConnection(N,M){C(fs(N,M))},moveNoteConnectionWaypoint(N,M,ie,T){C(ms(N,M,ie,T))},addNoteConnectionWaypoint(N,M,ie,T){C(ps(N,M,ie,T))},removeNoteConnectionWaypoint(N,M,ie){C(hs(N,M,ie))},clearNoteConnectionWaypoints(N,M){C(ys(N,M))},autoLayout(){const N=ir(o.logical,o.layout);N.length&&C(Ge("자동 배치",N.map(M=>$n(M.id,M.location))))},copy(){const N=F.value;if((N==null?void 0:N.kind)==="attribute"){const L=o.logical.entities.find(J=>J.modelId===N.entityId);if(!L)return;const me=[...L.attributes].sort((J,Q)=>J.order-Q.order).filter(J=>N.ids.includes(J.modelId));if(!me.length)return;ye.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:me}));return}const M=X.value;if(!M)return;const ie=o.logical.entities.find(L=>L.modelId===M),T=o.layout.entityLayouts.find(L=>L.entityRef===M);if(!ie)return;const U=(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:ie,geo:U}))},paste(){if(!oe.value)return;const N=ye.value;if(!N)return;if(N.kind==="attribute"){const T=X.value;if(!T)return;const U=o.logical.entities.find(se=>se.modelId===T);if(!U)return;const L=new Set(U.attributes.map(se=>se.name)),me=new Set(U.attributes.flatMap(se=>se.dbAttrs.map(E=>E.physicalName))),J=U.attributes.length,Q=[],ne=N.attributes.map((se,E)=>{const D=JSON.parse(JSON.stringify(se));D.modelId=Oe();for(const ce of D.dbAttrs)ce.modelId=Oe();L.has(D.name)&&(D.name=`${D.name}_copy`);for(const ce of D.dbAttrs)ce.physicalName&&me.has(ce.physicalName)&&(ce.physicalName=`${ce.physicalName}_copy`);return D.order=J+E,Q.push(D.modelId),Vt(T,D)});C(ne.length===1?ne[0]:Ge("속성 붙여넣기",ne)),F.value={kind:"attribute",entityId:T,ids:Q,anchor:Q[Q.length-1]};return}const M=Nk(N.entity),ie={location:{x:N.geo.location.x+40,y:N.geo.location.y+40},size:{...N.geo.size}};C(Jo(M,ie)),F.value={kind:"entity",id:M.modelId}},importEntities(N,M,ie){if(!oe.value)return;const T=Er(N,M,{existing:o.logical,includeRelated:ie==null?void 0:ie.includeRelated});if(T.logical.entities.length===0)return;const U=xk(o.layout,T.layout),L=new Map(T.layout.entityLayouts.map(se=>[se.entityRef,se])),me=new Map(T.layout.associationLayouts.map(se=>[se.associationRef,se])),J=new Map(T.layout.groupLayouts.map(se=>[se.groupRef,se])),Q=[];let ne=80;for(const se of T.logical.entities){const E=L.get(se.modelId),D=E?{location:xl(E.geo.location,U),size:{...E.geo.size}}:{location:{x:ne+=40,y:80},size:{width:220,height:140}};let ce;if(E){const{entityRef:V,geo:q,locked:B,...j}=E;ce=j}Q.push(Jo(se,D,ce))}for(const se of T.logical.associations){const E=me.get(se.modelId),D=E?{...E,waypoints:E.waypoints.map(ce=>xl(ce,U))}:{associationRef:se.modelId,waypoints:[]};Q.push(ni(se,D))}for(const se of T.logical.groups){const E=J.get(se.modelId),D=E?{location:xl(E.geo.location,U),size:{...E.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let ce;if(E){const{groupRef:V,geo:q,locked:B,memberNoteRefs:j,...ke}=E;ce=ke}Q.push(ei(se,D,ce))}C(Ge("다이어그램 가져오기",Q)),F.value={kind:"entity",id:T.logical.entities[0].modelId}}};return Ce}const Ki=Symbol("groupHover"),Wd=Symbol("groupDrag"),Un=Symbol("relationHighlight"),Rk={key:0,class:"em-sel","aria-hidden":"true"},Vk=["title","aria-expanded","disabled"],Ak={class:"em-entity__stereotype"},Tk={key:1,class:"em-entity__name"},Mk=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Bk=["onPointerdown"],Dk={key:1,class:"em-entity__divider-label"},Ok=["title"],Lk={class:"em-key-slot"},Pk={class:"em-key-slot"},zk={key:0,class:"em-entity__type"},Uk=["onClick"],Fk={class:"em-entity__attrname"},Hk={class:"em-entity__type"},Gk=["data-op"],Yk=["onPointerdown"],Wk={class:"em-entity__op-vis","aria-hidden":"true"},Kk=["title"],qk={key:4,class:"em-entity__footer"},Kd=Ue(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=ae.useModal();function a(){o&&Yi(i,o,t.id)}const l=n.inject(Ki,null),r=n.inject(Un,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 J;return((J=o==null?void 0:o.selection.value)==null?void 0:J.kind)==="entity"&&o.selection.value.id===t.id}),m=n.computed(()=>!!t.selected&&!p.value),g=n.computed(()=>{var J;return o&&((J=o.selectedAttr.value)==null?void 0:J.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),y=n.computed(()=>g.value.size>0);function _(J,Q){const ne=Q.shiftKey?"range":Q.metaKey||Q.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,J.modelId,ne)}const A=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!p.value),b=n.computed(()=>t.data.entity),v=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),te=n.computed(()=>t.data.collapsed??!1),I=n.computed(()=>t.data.locked??!1);function P(){s.value&&(o==null||o.setEntityCollapsed(t.id,!te.value))}const x=n.computed(()=>v.value==="PHYSICAL"||v.value==="LOGICAL_PHYSICAL"),O=n.computed(()=>{const J=v.value==="PHYSICAL"||v.value==="LOGICAL_PHYSICAL",Q={};for(const ne of b.value.attributes){const se=ne.attrType.startsWith("RELATION")&&ne.dbAttrs.length>0;Q[ne.modelId]={pk:ne.identifier,fk:se&&J,required:ne.notNull&&!ne.identifier}}return Q});function H(J){if(!J)return"";const Q=[];return J.pk&&J.fk?Q.push("PFK (식별 외래키)"):J.pk?Q.push("PK (기본키)"):J.fk&&Q.push("FK (외래키)"),J.required&&Q.push("필수 (NOT NULL)"),Q.join(" · ")}const de=n.computed(()=>{const J=vl(at(t.data.style)),Q={};return J&&(Q["--em-header-bg"]=J.bar,Q["--em-header-fg"]=J.barOn),Q});function z(J){var Q,ne;return(ne=vl(at((Q=t.data.attributeStyles)==null?void 0:Q[J.modelId])))==null?void 0:ne.text}const oe=n.computed(()=>[...b.value.operations??[]].sort((J,Q)=>J.order-Q.order)),k=n.computed(()=>v.value==="CLASS"&&oe.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function R(J){return J?W[J]:"~"}function G(J){var Q,ne;return(ne=vl(at((Q=t.data.operationStyles)==null?void 0:Q[J.modelId])))==null?void 0:ne.text}function F(J,Q,ne){switch(v.value){case"CLASS":return[{text:J}];case"PHYSICAL":return[{text:ne||J}];case"LOGICAL":return[Q?{text:Q}:{text:"(논리명)",missing:!0}];default:{const se=Q?{text:Q}:{text:"(논리명)",missing:!0};return ne?[se,{text:` · ${ne}`}]:[se]}}}function le(J){var Q,ne,se;return $(J)?[{text:J.name}]:F(J.name,(ne=(Q=J.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:ne.ko,((se=J.dbAttrs[0])==null?void 0:se.physicalName)??"")}function $(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}function X(J){return J.attrType==="DIVIDER"}function re(J){if(J.attrType!=="EMBED_PREDEF")return J.dbAttrs;const Q=o==null?void 0:o.embeddableCatalog.value.find(se=>se.type===J.type);if(!Q)return J.dbAttrs;const ne=Xn(Ko(b.value,(o==null?void 0:o.state.logical.entities)??[]));return J.dbAttrs.map((se,E)=>{const D=Q.fields[E],ce=qo(se,ne);return ce?{...se,physicalName:ce.physicalName,logicalName:se.logicalName??(D==null?void 0:D.logicalName),dataType:se.dataType||(D==null?void 0:D.dataType)||""}:D?{...se,physicalName:se.physicalName||D.physicalName,logicalName:se.logicalName??D.logicalName,dataType:se.dataType||D.dataType,length:se.length??D.length}:se})}function pe(J){var Q;return F(J.physicalName,(Q=J.logicalName)==null?void 0:Q.ko,J.physicalName)}function ye(J){const Q=gr(J,(o==null?void 0:o.state.logical.associations)??[]);return Sa(v.value,J,Q)}const ue=n.computed(()=>{var J,Q,ne;return F(b.value.name,(Q=(J=b.value.table)==null?void 0:J.logicalName)==null?void 0:Q.ko,((ne=b.value.table)==null?void 0:ne.physicalName)??"")}),fe=n.ref(!1),ge=n.ref(""),Ee=n.ref(null);async function Re(){var J,Q;s.value&&(ge.value=b.value.name,fe.value=!0,await n.nextTick(),(J=Ee.value)==null||J.focus(),(Q=Ee.value)==null||Q.select())}function Ie(){if(!fe.value)return;fe.value=!1;const J=ge.value.trim();J&&J!==b.value.name&&(o==null||o.renameEntity(t.id,J))}function he(){o==null||o.addAttribute(t.id)}function Z(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:K,findNode:w}=ze(),S=n.ref(null),C=n.computed(()=>{const J=S.value??t.data.size;return J?{width:`${J.width}px`,minHeight:`${J.height}px`}:void 0});let Y=null;function ee(J){var se,E,D;if(!s.value)return;J.stopPropagation();const Q=(se=w(t.id))==null?void 0:se.dimensions,ne=K({x:J.clientX,y:J.clientY});Y={fx:ne.x,fy:ne.y,w:(Q==null?void 0:Q.width)??((E=t.data.size)==null?void 0:E.width)??200,h:(Q==null?void 0:Q.height)??((D=t.data.size)==null?void 0:D.height)??120},J.target.setPointerCapture(J.pointerId)}function be(J){if(!Y)return;const Q=K({x:J.clientX,y:J.clientY});S.value={width:Math.max(40,Y.w+(Q.x-Y.fx)),height:Math.max(40,Y.h+(Q.y-Y.fy))}}function we(J){var Q,ne,se;if(Y&&S.value&&o){const E=(Q=w(t.id))==null?void 0:Q.dimensions;o.resizeEntity(t.id,{width:Math.round((E==null?void 0:E.width)??S.value.width),height:Math.round((E==null?void 0:E.height)??S.value.height)})}Y=null,S.value=null,(se=(ne=J.target).releasePointerCapture)==null||se.call(ne,J.pointerId)}const $e=n.ref(null),_e=n.ref(null);function Ce(J,Q){if(!s.value)return;Q.stopPropagation(),Q.preventDefault();const ne=g.value,se=ne.has(J.modelId)?new Set(ne):new Set([J.modelId]);_e.value={ids:se,dropIndex:-1,lineY:0},Q.target.setPointerCapture(Q.pointerId)}function Te(J){if(!_e.value||!$e.value)return;const Q=Array.from($e.value.querySelectorAll(".em-entity__row"));if(!Q.length)return;let ne=Q.length;for(let D=0;D<Q.length;D++){const ce=Q[D].getBoundingClientRect();if(J.clientY<ce.top+ce.height/2){ne=D;break}}const se=Q[Q.length-1],E=ne<Q.length?Q[ne].offsetTop:se.offsetTop+se.offsetHeight;_e.value={..._e.value,dropIndex:ne,lineY:E}}function Be(){const J=_e.value;if(_e.value=null,!J||J.dropIndex<0)return;const Q=b.value.attributes,ne=Q.filter(V=>J.ids.has(V.modelId)).map(V=>V.modelId),se=Q.filter((V,q)=>J.ids.has(V.modelId)&&q<J.dropIndex).length,E=J.dropIndex-se,D=Q.filter(V=>!J.ids.has(V.modelId)).map(V=>V.modelId);[...D.slice(0,E),...ne,...D.slice(E)].join(",")!==Q.map(V=>V.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,ne,E))}function N(){_e.value=null}const M=n.ref(null),ie=n.ref(null);function T(J,Q){s.value&&(Q.stopPropagation(),Q.preventDefault(),ie.value={id:J.modelId,dropIndex:-1,lineY:0},Q.target.setPointerCapture(Q.pointerId))}function U(J){if(!ie.value||!M.value)return;const Q=Array.from(M.value.querySelectorAll(".em-entity__op-row"));if(!Q.length)return;let ne=Q.length;for(let D=0;D<Q.length;D++){const ce=Q[D].getBoundingClientRect();if(J.clientY<ce.top+ce.height/2){ne=D;break}}const se=Q[Q.length-1],E=ne<Q.length?Q[ne].offsetTop:se.offsetTop+se.offsetHeight;ie.value={...ie.value,dropIndex:ne,lineY:E}}function L(){const J=ie.value;if(ie.value=null,!J||J.dropIndex<0)return;const ne=oe.value.findIndex(E=>E.modelId===J.id);if(ne<0)return;const se=J.dropIndex-(ne<J.dropIndex?1:0);se!==ne&&(o==null||o.reorderOperations(t.id,[J.id],se))}function me(){ie.value=null}return(J,Q)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":h.value,"is-dimmed":A.value,"is-selected":p.value,"is-multi-selected":m.value,"has-focused-attr":y.value,"is-locked":I.value}]),style:n.normalizeStyle(C.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[p.value?(n.openBlock(),n.createElementBlock("div",Rk,[...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(de.value),onDblclick:n.withModifiers(Re,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:te.value?"펼치기":"접기","aria-expanded":!te.value,disabled:!s.value,onClick:n.withModifiers(P,["stop"]),onPointerdown:Q[0]||(Q[0]=n.withModifiers(()=>{},["stop"])),onDblclick:Q[1]||(Q[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(te.value?"▸":"▾"),41,Vk),n.createElementVNode("span",Ak,"«"+n.toDisplayString(b.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]=ne=>ge.value=ne),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Ie,["enter"]),Q[3]||(Q[3]=n.withKeys(ne=>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",Tk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ue.value,(ne,se)=>(n.openBlock(),n.createElementBlock("span",{key:se,class:n.normalizeClass({"em-entity__missing":ne.missing})},n.toDisplayString(ne.text),3))),128))])),I.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)],36),te.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(b.value.attributes,ne=>{var se,E,D,ce;return n.openBlock(),n.createElementBlock(n.Fragment,{key:ne.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":g.value.has(ne.modelId),"is-dragging":(se=_e.value)==null?void 0:se.ids.has(ne.modelId),"is-embed":$(ne),"is-divider":X(ne),nodrag:X(ne)&&s.value}]),"data-attr":ne.modelId,onClick:n.withModifiers(V=>_(ne,V),["stop"]),onPointerdown:V=>X(ne)?Ce(ne,V):void 0,onPointermove:V=>X(ne)?Te(V):void 0,onPointerup:V=>X(ne)?Be():void 0,onPointercancel:V=>X(ne)?N():void 0},[s.value&&!X(ne)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:V=>Ce(ne,V),onPointermove:Te,onPointerup:Be,onPointercancel:N,onClick:Q[5]||(Q[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Bk)):n.createCommentVNode("",!0),X(ne)?(n.openBlock(),n.createElementBlock("span",Dk,n.toDisplayString(ne.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(dn),{id:`l:${ne.modelId}`,type:"target",position:n.unref(Se).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:H(O.value[ne.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Lk,[(E=O.value[ne.modelId])!=null&&E.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(D=O.value[ne.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",Pk,[$(ne)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(ce=O.value[ne.modelId])!=null&&ce.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Ok),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:z(ne)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le(ne),(V,q)=>(n.openBlock(),n.createElementBlock("span",{key:q,class:n.normalizeClass({"em-entity__missing":V.missing})},n.toDisplayString(V.text),3))),128))],4),ye(ne)?(n.openBlock(),n.createElementBlock("span",zk,n.toDisplayString(ye(ne)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(dn),{id:`r:${ne.modelId}`,type:"source",position:n.unref(Se).Right,class:"em-handle"},null,8,["id","position"])],64))],42,Mk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($(ne)&&x.value?re(ne):[],V=>(n.openBlock(),n.createElementBlock("li",{key:`${ne.modelId}:${V.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":g.value.has(ne.modelId)}]),onClick:n.withModifiers(q=>_(ne,q),["stop"])},[Q[8]||(Q[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",Fk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe(V),(q,B)=>(n.openBlock(),n.createElementBlock("span",{key:B,class:n.normalizeClass({"em-entity__missing":q.missing})},n.toDisplayString(q.text),3))),128))]),n.createElementVNode("span",Hk,n.toDisplayString(V.dataType),1)],10,Uk))),128))],64)}),128))],512)),!te.value&&k.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:M,class:"em-entity__ops"},[ie.value&&ie.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${ie.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,ne=>{var se;return n.openBlock(),n.createElementBlock("li",{key:ne.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((se=ie.value)==null?void 0:se.id)===ne.modelId}]),"data-op":ne.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:E=>T(ne,E),onPointermove:U,onPointerup:L,onPointercancel:me,onClick:Q[6]||(Q[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Yk)):n.createCommentVNode("",!0),n.createElementVNode("span",Wk,n.toDisplayString(R(ne.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:G(ne)})},n.toDisplayString(ne.name)+"()",5)],10,Gk)}),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,Kk)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",qk,[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:Z},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!fe.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:ee,onPointermove:be,onPointerup:we},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3a3c0b9d"]]),Xk={key:0,class:"em-sel","aria-hidden":"true"},jk={class:"em-group__label"},Zk={class:"em-group__name"},Jk={key:0,class:"em-group__pkg"},Qk={key:1,class:"em-group__flag"},qd=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 O;return!!t.id&&((O=r==null?void 0:r.selection.value)==null?void 0:O.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(Ki,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),h=n.inject(Un,null);function p(){t.id&&(h==null||h.setGroupHover(t.id))}function m(){h==null||h.setGroupHover(null)}const g=n.computed(()=>!!h&&h.hoverGroupId.value===t.id),y=n.computed(()=>!!h&&h.hoverGroupId.value!==null&&h.hoverGroupId.value!==t.id),{screenToFlowCoordinate:_,findNode:A}=ze();let b=null,v=null;function te(O){var z;if(!t.id||!s.value)return;O.stopPropagation();const H=((z=A(t.id))==null?void 0:z.dimensions)??{width:400,height:300},de=_({x:O.clientX,y:O.clientY});b={fx:de.x,fy:de.y,w:H.width,h:H.height},O.target.setPointerCapture(O.pointerId)}function I(O){if(!b||!t.id)return;const H=_({x:O.clientX,y:O.clientY});v={width:Math.max(160,b.w+(H.x-b.fx)),height:Math.max(120,b.h+(H.y-b.fy))};const de=A(t.id);de&&(de.style={width:`${v.width}px`,height:`${v.height}px`})}function P(O){var H,de;b&&v&&t.id&&r&&r.resizeGroup(t.id,v),b=null,v=null,(de=(H=O.target).releasePointerCapture)==null||de.call(H,O.pointerId)}const x=n.computed(()=>{const O=o.value.name;return(O==null?void 0:O.ko)||(O==null?void 0:O.en)||(O==null?void 0:O.ja)||(O==null?void 0:O.zh)||o.value.packageName||"그룹"});return(O,H)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":g.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",Xk,[...H[0]||(H[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",jk,[n.createElementVNode("span",Zk,n.toDisplayString(x.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Jk,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",Qk,"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:te,onPointermove:I,onPointerup:P},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),ew={key:0,class:"em-sel","aria-hidden":"true"},tw={key:2,class:"em-note__text"},Xd=Ue(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=n.inject(Ki,null),a=n.inject(Un,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}),g=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}],A=n.ref(!1),b=n.ref(""),v=n.ref(null);async function te(){var k;r.value&&(b.value=l.value.memo,A.value=!0,await n.nextTick(),(k=v.value)==null||k.focus())}function I(){A.value&&(A.value=!1,b.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,b.value)))}const{screenToFlowCoordinate:P,findNode:x}=ze();let O=null,H=null;function de(k){var G;if(!r.value)return;k.stopPropagation();const W=((G=x(t.id))==null?void 0:G.dimensions)??l.value.geo.size,R=P({x:k.clientX,y:k.clientY});O={fx:R.x,fy:R.y,w:W.width,h:W.height},k.target.setPointerCapture(k.pointerId)}function z(k){if(!O)return;const W=P({x:k.clientX,y:k.clientY});H={width:Math.max(140,O.w+(W.x-O.fx)),height:Math.max(60,O.h+(W.y-O.fy))};const R=x(t.id);R&&(R.style={width:`${H.width}px`,height:`${H.height}px`})}function oe(k){var W,R;O&&H&&o&&o.resizeNote(t.id,H),O=null,H=null,(R=(W=k.target).releasePointerCapture)==null||R.call(W,k.pointerId)}return(k,W)=>(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":g.value}]),style:n.normalizeStyle(c.value),onDblclick:te,onPointerdown:d,onMouseenter:u,onMouseleave:f},[m.value?(n.openBlock(),n.createElementBlock("div",ew,[...W[4]||(W[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),A.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:v,"onUpdate:modelValue":W[0]||(W[0]=R=>b.value=R),class:"em-note__edit nodrag",onBlur:I,onKeydown:W[1]||(W[1]=n.withKeys(R=>A.value=!1,["esc"])),onPointerdown:W[2]||(W[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,b.value]]):(n.openBlock(),n.createElementBlock("div",tw,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,R=>n.createVNode(n.unref(dn),{id:R.id,key:R.id,type:"source",position:R.pos,class:"em-note-handle",onPointerdown:W[3]||(W[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!A.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:de,onPointermove:z,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),nw=20,ow=22,iw=7,aw=22,jd=31,Zd=7,lw=20,Jd=11,Qd=11,rw=jd+Zd;function sw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function cw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function qi(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 eu(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Xi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function tu(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:eu(e,t);return[Xi(o,a,l-Math.PI/2),Xi(o,a,l+Math.PI/2)]}function nu(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 ou(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=qi(e,t,nw),[d,u]=tu(e,t,c,ow);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}),sw(o.multiplicity)){const f=qi(e,t,jd);l.push({cx:f.x,cy:f.y,r:Zd})}if(cw(o.multiplicity)){const f=qi(e,t,iw),[h,p]=tu(e,t,f,aw);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=qi(e,t,lw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=eu(e,t),f=Xi(d,Jd/2,u-Math.PI/2),h=Xi(d,Jd/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=nu(s,c,Qd,!0),u=nu(s,c,Qd,!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 iu=200,au=120,Sl=24;function lu(e){var a,l;if(!e)return{x:0,y:0,width:iu,height:au};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||iu,i=((l=e.dimensions)==null?void 0:l.height)||au;return{x:t.x,y:t.y,width:o,height:i}}function ru(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function su(e){const t=n.computed(()=>lu(e.sourceNode())),o=n.computed(()=>lu(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)<Sl){const g=(f+h)/2;f=g-Sl/2,h=g+Sl/2}return{source:{x:u,y:f},target:{x:u,y:h}}}),l=n.computed(()=>e.waypoints()[0]??ru(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??ru(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ka(t.value,d,l.value.x):_a(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ka(o.value,d,r.value.x):_a(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 Cl=Symbol("waypointController"),dw=["d"],uw=["d"],fw=["d"],mw=["x1","y1","x2","y2"],pw=["cx","cy","r"],hw=["x","y"],yw=["x","y"],gw=["cx","cy","onDblclick"],bw=["x","y","onPointerdown","onDblclick"],cu=Ue(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=ze(),i=n.inject(Cl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Wd,null),s=n.inject(Un,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 Z=a.resolved.value.entities,K=S=>{var C;return(C=Z.find(Y=>Y.entity.modelId===S))==null?void 0:C.groupRef},w=t.data.association;return K(w.end1.entityRef)===he.groupId&&K(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}),g=n.computed(()=>{const he=f.value;return h.value.map((Z,K)=>K===p.value?m.value:he?{x:Z.x+he.dx,y:Z.y+he.dy}:Z)}),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:A,target:b,sourceSide:v,targetSide:te,isSelf:I}=su({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!y.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),P=rw+4,x=n.computed(()=>I.value?or(A.value,b.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?ya(A.value,v.value,g.value,b.value,te.value,P):ba(A.value,g.value,b.value)),O=n.computed(()=>I.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ga(A.value,v.value,g.value,b.value,te.value,P):wa(A.value,g.value,b.value).map((he,Z)=>({point:he,segIndex:Z}))),H=n.computed(()=>I.value||!l.value?[]:g.value);function de(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 z(he,Z){p.value=he,m.value={...h.value[he]},Z.target.setPointerCapture(Z.pointerId),Z.stopPropagation()}function oe(he){if(p.value<0)return;const Z=o({x:he.clientX,y:he.clientY});m.value={x:Z.x,y:Z.y}}function k(he){var Z,K;p.value>=0&&i&&i.movePoint(t.id,p.value,{...m.value}),p.value=-1,(K=(Z=he.target).releasePointerCapture)==null||K.call(Z,he.pointerId)}function W(he,Z){Z.stopPropagation(),i==null||i.removePoint(t.id,he)}function R(he,Z){if(!i)return;const K=o({x:Z.clientX,y:Z.clientY});i.insertPoint(t.id,he,{x:K.x,y:K.y})}const G=n.computed(()=>de(t.data.association.end1.multiplicity)),F=n.computed(()=>de(t.data.association.end2.multiplicity)),le=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),$=n.computed(()=>le.value==="class"),X=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const he=Wn(v.value);return{x:A.value.x+he.x*10,y:A.value.y+he.y*10}}return g.value[0]??b.value}),re=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const Z=Wn(te.value);return{x:b.value.x+Z.x*10,y:b.value.y+Z.y*10}}const he=g.value;return he[he.length-1]??A.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(()=>ou(A.value,X.value,pe.value,le.value)),fe=n.computed(()=>ou(b.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(Z=>`${Z.x},${Z.y}`).join(" L")} Z`)),Ie=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(he,Z)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:x.value,fill:"none",class:"em-edge__hit"},null,8,dw),n.createElementVNode("path",{d:x.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,uw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Re.value,(K,w)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${w}`,d:K,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ie.value])},null,10,fw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ge.value,(K,w)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${w}`,x1:K.x1,y1:K.y1,x2:K.x2,y2:K.y2,class:n.normalizeClass(["em-edge__marker",Ie.value])},null,10,mw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ee.value,(K,w)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${w}`,cx:K.cx,cy:K.cy,r:K.r,class:n.normalizeClass(["em-edge__marker",Ie.value])},null,10,pw))),128)),$.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(A).x+8,y:n.unref(A).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(G.value),11,hw),n.createElementVNode("text",{x:n.unref(b).x-8,y:n.unref(b).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(F.value),11,yw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(O.value,(K,w)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${w}`,cx:K.point.x,cy:K.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(S=>R(K.segIndex,S),["stop"])},null,42,gw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(H.value,(K,w)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${w}`,x:K.x-5,y:K.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:S=>z(w,S),onPointermove:oe,onPointerup:k,onDblclick:S=>W(w,S)},null,42,bw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Ot=(e=>(e.Lines="lines",e.Dots="dots",e))(Ot||{});const du=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]}`})},uu=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Ot.Lines+"",Ot.Dots+"";const _w={[Ot.Dots]:"#81818a",[Ot.Lines]:"#eee"},kw=["id","x","y","width","height","patternTransform"],ww={key:2,height:"100",width:"100"},Ew=["fill"],vw=["x","y","fill"],Nw={name:"Background",compatConfig:{MODE:3}},$w=n.defineComponent({...Nw,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||_w[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(du),{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(uu),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",ww,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Ew)])):n.createCommentVNode("",!0)])],8,kw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,vw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),xw={name:"ControlButton",compatConfig:{MODE:3}},Iw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Sw={type:"button",class:"vue-flow__controls-button"};function Cw(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",Sw,[n.renderSlot(e.$slots,"default")])}const hn=Iw(xw,[["render",Cw]]),Rw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Vw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Aw(e,t){return n.openBlock(),n.createElementBlock("svg",Rw,Vw)}const Tw={render:Aw},Mw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Bw=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Dw(e,t){return n.openBlock(),n.createElementBlock("svg",Mw,Bw)}const Ow={render:Dw},Lw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Pw=[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 zw(e,t){return n.openBlock(),n.createElementBlock("svg",Lw,Pw)}const Uw={render:zw},Fw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Hw=[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 Gw(e,t){return n.openBlock(),n.createElementBlock("svg",Fw,Hw)}const Yw={render:Gw},Ww={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Kw=[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 qw(e,t){return n.openBlock(),n.createElementBlock("svg",Ww,Kw)}const Xw={render:qw},jw={name:"Controls",compatConfig:{MODE:3}},Zw=n.defineComponent({...jw,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Oc.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 g(){r(),t("zoomIn")}function y(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function A(){l(!h.value),t("interactionChange",!h.value)}return(b,v)=>(n.openBlock(),n.createBlock(n.unref(Bd),{class:"vue-flow__controls",position:b.position},{default:n.withCtx(()=>[n.renderSlot(b.$slots,"top"),b.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(b.$slots,"control-zoom-in",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomin",disabled:m.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(b.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Tw))))])]),_:3},8,["disabled"])]),n.renderSlot(b.$slots,"control-zoom-out",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:y},{default:n.withCtx(()=>[n.renderSlot(b.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Ow))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),b.showFitView?n.renderSlot(b.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hn,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(b.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Uw))))])]),_:3})]):n.createCommentVNode("",!0),b.showInteractive?n.renderSlot(b.$slots,"control-interactive",{key:2},()=>[b.showInteractive?(n.openBlock(),n.createBlock(hn,{key:0,class:"vue-flow__controls-interactive",onClick:A},{default:n.withCtx(()=>[h.value?n.renderSlot(b.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Xw))))]):n.createCommentVNode("",!0),h.value?n.createCommentVNode("",!0):n.renderSlot(b.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Yw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(b.$slots,"default")]),_:3},8,["position"]))}});var Jw={value:()=>{}};function Rl(){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 ji(o)}function ji(e){this._=e}function Qw(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}})}ji.prototype=Rl.prototype={constructor:ji,on:function(e,t){var o=this._,i=Qw(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=eE(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]=fu(o[a],e.name,t);else if(t==null)for(a in o)o[a]=fu(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 ji(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 eE(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function fu(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Jw,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Vl="http://www.w3.org/1999/xhtml";const mu={svg:"http://www.w3.org/2000/svg",xhtml:Vl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),mu.hasOwnProperty(t)?{space:mu[t],local:e}:e}function tE(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Vl&&t.documentElement.namespaceURI===Vl?t.createElement(e):t.createElementNS(o,e)}}function nE(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pu(e){var t=Zi(e);return(t.local?nE:tE)(t)}function oE(){}function Al(e){return e==null?oE:function(){return this.querySelector(e)}}function iE(e){typeof e!="function"&&(e=Al(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 aE(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function lE(){return[]}function hu(e){return e==null?lE:function(){return this.querySelectorAll(e)}}function rE(e){return function(){return aE(e.apply(this,arguments))}}function sE(e){typeof e=="function"?e=rE(e):e=hu(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 yu(e){return function(){return this.matches(e)}}function gu(e){return function(t){return t.matches(e)}}var cE=Array.prototype.find;function dE(e){return function(){return cE.call(this.children,e)}}function uE(){return this.firstElementChild}function fE(e){return this.select(e==null?uE:dE(typeof e=="function"?e:gu(e)))}var mE=Array.prototype.filter;function pE(){return Array.from(this.children)}function hE(e){return function(){return mE.call(this.children,e)}}function yE(e){return this.selectAll(e==null?pE:hE(typeof e=="function"?e:gu(e)))}function gE(e){typeof e!="function"&&(e=yu(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 bu(e){return new Array(e.length)}function bE(){return new ft(this._enter||this._groups.map(bu),this._parents)}function Ji(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ji.prototype={constructor:Ji,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 _E(e){return function(){return e}}function kE(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 Ji(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function wE(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 Ji(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function EE(e){return e.__data__}function vE(e,t){if(!arguments.length)return Array.from(this,EE);var o=t?wE:kE,i=this._parents,a=this._groups;typeof e!="function"&&(e=_E(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=NE(e.call(u,u&&u.__data__,d,i)),m=p.length,g=s[d]=new Array(m),y=r[d]=new Array(m),_=c[d]=new Array(h);o(u,f,g,y,_,p,t);for(var A=0,b=0,v,te;A<m;++A)if(v=g[A]){for(A>=b&&(b=A+1);!(te=y[b])&&++b<m;);v._next=te||null}}return r=new ft(r,i),r._enter=s,r._exit=c,r}function NE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $E(){return new ft(this._exit||this._groups.map(bu),this._parents)}function xE(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 IE(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 SE(){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 CE(e){e||(e=RE);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 RE(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function VE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function AE(){return Array.from(this)}function TE(){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 ME(){let e=0;for(const t of this)++e;return e}function BE(){return!this.node()}function DE(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 OE(e){return function(){this.removeAttribute(e)}}function LE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function PE(e,t){return function(){this.setAttribute(e,t)}}function zE(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function UE(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function FE(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 HE(e,t){var o=Zi(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?LE:OE:typeof t=="function"?o.local?FE:UE:o.local?zE:PE)(o,t))}function _u(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function GE(e){return function(){this.style.removeProperty(e)}}function YE(e,t,o){return function(){this.style.setProperty(e,t,o)}}function WE(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function KE(e,t,o){return arguments.length>1?this.each((t==null?GE:typeof t=="function"?WE:YE)(e,t,o??"")):Fn(this.node(),e)}function Fn(e,t){return e.style.getPropertyValue(t)||_u(e).getComputedStyle(e,null).getPropertyValue(t)}function qE(e){return function(){delete this[e]}}function XE(e,t){return function(){this[e]=t}}function jE(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function ZE(e,t){return arguments.length>1?this.each((t==null?qE:typeof t=="function"?jE:XE)(e,t)):this.node()[e]}function ku(e){return e.trim().split(/^|\s+/)}function Tl(e){return e.classList||new wu(e)}function wu(e){this._node=e,this._names=ku(e.getAttribute("class")||"")}wu.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 Eu(e,t){for(var o=Tl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function vu(e,t){for(var o=Tl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function JE(e){return function(){Eu(this,e)}}function QE(e){return function(){vu(this,e)}}function ev(e,t){return function(){(t.apply(this,arguments)?Eu:vu)(this,e)}}function tv(e,t){var o=ku(e+"");if(arguments.length<2){for(var i=Tl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?ev:t?JE:QE)(o,t))}function nv(){this.textContent=""}function ov(e){return function(){this.textContent=e}}function iv(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function av(e){return arguments.length?this.each(e==null?nv:(typeof e=="function"?iv:ov)(e)):this.node().textContent}function lv(){this.innerHTML=""}function rv(e){return function(){this.innerHTML=e}}function sv(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function cv(e){return arguments.length?this.each(e==null?lv:(typeof e=="function"?sv:rv)(e)):this.node().innerHTML}function dv(){this.nextSibling&&this.parentNode.appendChild(this)}function uv(){return this.each(dv)}function fv(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mv(){return this.each(fv)}function pv(e){var t=typeof e=="function"?e:pu(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function hv(){return null}function yv(e,t){var o=typeof e=="function"?e:pu(e),i=t==null?hv:typeof t=="function"?t:Al(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function gv(){var e=this.parentNode;e&&e.removeChild(this)}function bv(){return this.each(gv)}function _v(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kv(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function wv(e){return this.select(e?kv:_v)}function Ev(e){return arguments.length?this.property("__data__",e):this.node().__data__}function vv(e){return function(t){e.call(this,t,this.__data__)}}function Nv(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 $v(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 xv(e,t,o){return function(){var i=this.__on,a,l=vv(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 Iv(e,t,o){var i=Nv(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?xv:$v,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Nu(e,t,o){var i=_u(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 Sv(e,t){return function(){return Nu(this,e,t)}}function Cv(e,t){return function(){return Nu(this,e,t.apply(this,arguments))}}function Rv(e,t){return this.each((typeof t=="function"?Cv:Sv)(e,t))}function*Vv(){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 vo(){return new ft([[document.documentElement]],$u)}function Av(){return this}ft.prototype=vo.prototype={constructor:ft,select:iE,selectAll:sE,selectChild:fE,selectChildren:yE,filter:gE,data:vE,enter:bE,exit:$E,join:xE,merge:IE,selection:Av,order:SE,sort:CE,call:VE,nodes:AE,node:TE,size:ME,empty:BE,each:DE,attr:HE,style:KE,property:ZE,classed:tv,text:av,html:cv,raise:uv,lower:mv,append:pv,insert:yv,remove:bv,clone:wv,datum:Ev,on:Iv,dispatch:Rv,[Symbol.iterator]:Vv};function qt(e){return typeof e=="string"?new ft([[document.querySelector(e)]],[document.documentElement]):new ft([[e]],$u)}function Tv(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=Tv(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 Ml={capture:!0,passive:!1};function Bl(e){e.preventDefault(),e.stopImmediatePropagation()}function Mv(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",Bl,Ml);"onselectstart"in t?o.on("selectstart.drag",Bl,Ml):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Bv(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Bl,Ml),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 Dl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function xu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function No(){}var $o=.7,Qi=1/$o,Hn="\\s*([+-]?\\d+)\\s*",xo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",It="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Dv=/^#([0-9a-f]{3,8})$/,Ov=new RegExp(`^rgb\\(${Hn},${Hn},${Hn}\\)$`),Lv=new RegExp(`^rgb\\(${It},${It},${It}\\)$`),Pv=new RegExp(`^rgba\\(${Hn},${Hn},${Hn},${xo}\\)$`),zv=new RegExp(`^rgba\\(${It},${It},${It},${xo}\\)$`),Uv=new RegExp(`^hsl\\(${xo},${It},${It}\\)$`),Fv=new RegExp(`^hsla\\(${xo},${It},${It},${xo}\\)$`),Iu={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};Dl(No,Io,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Su,formatHex:Su,formatHex8:Hv,formatHsl:Gv,formatRgb:Cu,toString:Cu});function Su(){return this.rgb().formatHex()}function Hv(){return this.rgb().formatHex8()}function Gv(){return Mu(this).formatHsl()}function Cu(){return this.rgb().formatRgb()}function Io(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Dv.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Ru(t):o===3?new ct(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?ea(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ea(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=Ov.exec(e))?new ct(t[1],t[2],t[3],1):(t=Lv.exec(e))?new ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Pv.exec(e))?ea(t[1],t[2],t[3],t[4]):(t=zv.exec(e))?ea(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Uv.exec(e))?Tu(t[1],t[2]/100,t[3]/100,1):(t=Fv.exec(e))?Tu(t[1],t[2]/100,t[3]/100,t[4]):Iu.hasOwnProperty(e)?Ru(Iu[e]):e==="transparent"?new ct(NaN,NaN,NaN,0):null}function Ru(e){return new ct(e>>16&255,e>>8&255,e&255,1)}function ea(e,t,o,i){return i<=0&&(e=t=o=NaN),new ct(e,t,o,i)}function Yv(e){return e instanceof No||(e=Io(e)),e?(e=e.rgb(),new ct(e.r,e.g,e.b,e.opacity)):new ct}function Ol(e,t,o,i){return arguments.length===1?Yv(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}Dl(ct,Ol,xu(No,{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?$o:Math.pow($o,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),ta(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:Vu,formatHex:Vu,formatHex8:Wv,formatRgb:Au,toString:Au}));function Vu(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function Wv(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Au(){const e=ta(this.opacity);return`${e===1?"rgb(":"rgba("}${yn(this.r)}, ${yn(this.g)}, ${yn(this.b)}${e===1?")":`, ${e})`}`}function ta(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 Tu(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 Mu(e){if(e instanceof bt)return new bt(e.h,e.s,e.l,e.opacity);if(e instanceof No||(e=Io(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 Kv(e,t,o,i){return arguments.length===1?Mu(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}Dl(bt,Kv,xu(No,{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?$o:Math.pow($o,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(Ll(e>=240?e-240:e+120,a,i),Ll(e,a,i),Ll(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new bt(Bu(this.h),na(this.s),na(this.l),ta(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=ta(this.opacity);return`${e===1?"hsl(":"hsla("}${Bu(this.h)}, ${na(this.s)*100}%, ${na(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bu(e){return e=(e||0)%360,e<0?e+360:e}function na(e){return Math.max(0,Math.min(1,e||0))}function Ll(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 Du=e=>()=>e;function qv(e,t){return function(o){return e+o*t}}function Xv(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 jv(e){return(e=+e)==1?Ou:function(t,o){return o-t?Xv(t,o,e):Du(isNaN(t)?o:t)}}function Ou(e,t){var o=t-e;return o?qv(e,o):Du(isNaN(e)?t:e)}const Lu=(function e(t){var o=jv(t);function i(a,l){var r=o((a=Ol(a)).r,(l=Ol(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Ou(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 Pl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zl=new RegExp(Pl.source,"g");function Zv(e){return function(){return e}}function Jv(e){return function(t){return e(t)+""}}function Qv(e,t){var o=Pl.lastIndex=zl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Pl.exec(e))&&(a=zl.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=zl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Jv(c[0].x):Zv(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 Pu=180/Math.PI,Ul={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zu(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)*Pu,skewX:Math.atan(c)*Pu,scaleX:r,scaleY:s}}var oa;function eN(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ul:zu(t.a,t.b,t.c,t.d,t.e,t.f)}function tN(e){return e==null||(oa||(oa=document.createElementNS("http://www.w3.org/2000/svg","g")),oa.setAttribute("transform",e),!(e=oa.transform.baseVal.consolidate()))?Ul:(e=e.matrix,zu(e.a,e.b,e.c,e.d,e.e,e.f))}function Uu(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 g=p.push("translate(",null,t,null,o);m.push({i:g-4,x:jt(d,f)},{i:g-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 g=p.push(a(p)+"scale(",null,",",null,")");m.push({i:g-4,x:jt(d,f)},{i:g-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,g=h.length,y;++m<g;)f[(y=h[m]).i]=y.x(p);return f.join("")}}}var nN=Uu(eN,"px, ","px)","deg)"),oN=Uu(tN,", ",")",")"),iN=1e-12;function Fu(e){return((e=Math.exp(e))+1/e)/2}function aN(e){return((e=Math.exp(e))-1/e)/2}function lN(e){return((e=Math.exp(2*e))-1)/(e+1)}const rN=(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,g=p*p+m*m,y,_;if(g<iN)_=Math.log(h/d)/t,y=function(P){return[s+P*p,c+P*m,d*Math.exp(t*P*_)]};else{var A=Math.sqrt(g),b=(h*h-d*d+i*g)/(2*d*o*A),v=(h*h-d*d-i*g)/(2*h*o*A),te=Math.log(Math.sqrt(b*b+1)-b),I=Math.log(Math.sqrt(v*v+1)-v);_=(I-te)/t,y=function(P){var x=P*_,O=Fu(te),H=d/(o*A)*(O*lN(t*x+te)-aN(te));return[s+H*p,c+H*m,d*O/Fu(t*x+te)]}}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 Gn=0,So=0,Co=0,Hu=1e3,ia,Ro,aa=0,bn=0,la=0,Vo=typeof performance=="object"&&performance.now?performance:Date,Gu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fl(){return bn||(Gu(sN),bn=Vo.now()+la)}function sN(){bn=0}function ra(){this._call=this._time=this._next=null}ra.prototype=Yu.prototype={constructor:ra,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Fl():+o)+(t==null?0:+t),!this._next&&Ro!==this&&(Ro?Ro._next=this:ia=this,Ro=this),this._call=e,this._time=o,Hl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Hl())}};function Yu(e,t,o){var i=new ra;return i.restart(e,t,o),i}function cN(){Fl(),++Gn;for(var e=ia,t;e;)(t=bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Gn}function Wu(){bn=(aa=Vo.now())+la,Gn=So=0;try{cN()}finally{Gn=0,uN(),bn=0}}function dN(){var e=Vo.now(),t=e-aa;t>Hu&&(la-=t,aa=e)}function uN(){for(var e,t=ia,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:ia=o);Ro=e,Hl(i)}function Hl(e){if(!Gn){So&&(So=clearTimeout(So));var t=e-bn;t>24?(e<1/0&&(So=setTimeout(Wu,e-Vo.now()-la)),Co&&(Co=clearInterval(Co))):(Co||(aa=Vo.now(),Co=setInterval(dN,Hu)),Gn=1,Gu(Wu))}}function Ku(e,t,o){var i=new ra;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var fN=Rl("start","end","cancel","interrupt"),mN=[],qu=0,Xu=1,Gl=2,sa=3,ju=4,Yl=5,ca=6;function da(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;pN(e,o,{name:t,index:i,group:a,on:fN,tween:mN,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:qu})}function Wl(e,t){var o=_t(e,t);if(o.state>qu)throw new Error("too late; already scheduled");return o}function St(e,t){var o=_t(e,t);if(o.state>sa)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 pN(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Yu(l,0,o.time);function l(d){o.state=Xu,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!==Xu)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===sa)return Ku(r);p.state===ju?(p.state=ca,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=ca,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Ku(function(){o.state===sa&&(o.state=ju,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Gl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Gl){for(o.state=sa,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=Yl,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Yl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ca,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function ua(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>Gl&&i.state<Yl,i.state=ca,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function hN(e){return this.each(function(){ua(this,e)})}function yN(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 gN(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 bN(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?yN:gN)(o,e,t))}function Kl(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 Zu(e,t){var o;return(typeof t=="number"?jt:t instanceof Io?Lu:(o=Io(t))?(t=o,Lu):Qv)(e,t)}function _N(e){return function(){this.removeAttribute(e)}}function kN(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wN(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 EN(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 vN(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 NN(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 $N(e,t){var o=Zi(e),i=o==="transform"?oN:Zu;return this.attrTween(e,typeof t=="function"?(o.local?NN:vN)(o,i,Kl(this,"attr."+e,t)):t==null?(o.local?kN:_N)(o):(o.local?EN:wN)(o,i,t))}function xN(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function IN(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function SN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&IN(e,l)),o}return a._value=t,a}function CN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&xN(e,l)),o}return a._value=t,a}function RN(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=Zi(e);return this.tween(o,(i.local?SN:CN)(i,t))}function VN(e,t){return function(){Wl(this,e).delay=+t.apply(this,arguments)}}function AN(e,t){return t=+t,function(){Wl(this,e).delay=t}}function TN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?VN:AN)(t,e)):_t(this.node(),t).delay}function MN(e,t){return function(){St(this,e).duration=+t.apply(this,arguments)}}function BN(e,t){return t=+t,function(){St(this,e).duration=t}}function DN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?MN:BN)(t,e)):_t(this.node(),t).duration}function ON(e,t){if(typeof t!="function")throw new Error;return function(){St(this,e).ease=t}}function LN(e){var t=this._id;return arguments.length?this.each(ON(t,e)):_t(this.node(),t).ease}function PN(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;St(this,e).ease=o}}function zN(e){if(typeof e!="function")throw new Error;return this.each(PN(this._id,e))}function UN(e){typeof e!="function"&&(e=yu(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 FN(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 HN(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 GN(e,t,o){var i,a,l=HN(t)?Wl:St;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function YN(e,t){var o=this._id;return arguments.length<2?_t(this.node(),o).on.on(e):this.each(GN(o,e,t))}function WN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function KN(){return this.on("end.remove",WN(this._id))}function qN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Al(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,da(d[h],t,o,h,d,_t(u,o)));return new Lt(l,this._parents,t,o)}function XN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=hu(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),g=0,y=h.length;g<y;++g)(p=h[g])&&da(p,t,o,g,h,m);l.push(h),r.push(u)}return new Lt(l,r,t,o)}var jN=vo.prototype.constructor;function ZN(){return new jN(this._groups,this._parents)}function JN(e,t){var o,i,a;return function(){var l=Fn(this,e),r=(this.style.removeProperty(e),Fn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Ju(e){return function(){this.style.removeProperty(e)}}function QN(e,t,o){var i,a=o+"",l;return function(){var r=Fn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function e$(e,t,o){var i,a,l;return function(){var r=Fn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Fn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function t$(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=Ju(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function n$(e,t,o){var i=(e+="")=="transform"?nN:Zu;return t==null?this.styleTween(e,JN(e,i)).on("end.style."+e,Ju(e)):typeof t=="function"?this.styleTween(e,e$(e,i,Kl(this,"style."+e,t))).each(t$(this._id,e)):this.styleTween(e,QN(e,i,t),o).on("end.style."+e,null)}function o$(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function i$(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&o$(e,r,o)),i}return l._value=t,l}function a$(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,i$(e,t,o??""))}function l$(e){return function(){this.textContent=e}}function r$(e){return function(){var t=e(this);this.textContent=t??""}}function s$(e){return this.tween("text",typeof e=="function"?r$(Kl(this,"text",e)):l$(e==null?"":e+""))}function c$(e){return function(t){this.textContent=e.call(this,t)}}function d$(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&c$(a)),t}return i._value=e,i}function u$(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,d$(e))}function f$(){for(var e=this._name,t=this._id,o=Qu(),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);da(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 m$(){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 p$=0;function Lt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Qu(){return++p$}var Pt=vo.prototype;Lt.prototype={constructor:Lt,select:qN,selectAll:XN,selectChild:Pt.selectChild,selectChildren:Pt.selectChildren,filter:UN,merge:FN,selection:ZN,transition:f$,call:Pt.call,nodes:Pt.nodes,node:Pt.node,size:Pt.size,empty:Pt.empty,each:Pt.each,on:YN,attr:$N,attrTween:RN,style:n$,styleTween:a$,text:s$,textTween:u$,remove:KN,tween:bN,delay:TN,duration:DN,ease:LN,easeVarying:zN,end:m$,[Symbol.iterator]:Pt[Symbol.iterator]};function h$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var y$={time:null,delay:0,duration:250,ease:h$};function g$(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 b$(e){var t,o;e instanceof Lt?(t=e._id,e=e._name):(t=Qu(),(o=y$).time=Fl(),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])&&da(c,e,t,d,r,o||g$(c,t));return new Lt(i,this._parents,e,t)}vo.prototype.interrupt=hN,vo.prototype.transition=b$;const fa=e=>()=>e;function _$(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 ql=new zt(1,0,0);zt.prototype;function Xl(e){e.stopImmediatePropagation()}function Ao(e){e.preventDefault(),e.stopImmediatePropagation()}function k$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function w$(){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 ef(){return this.__zoom||ql}function E$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function v$(){return navigator.maxTouchPoints||"ontouchstart"in this}function N$(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 $$(){var e=k$,t=w$,o=N$,i=E$,a=v$,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=rN,d=Rl("start","zoom","end"),u,f,h,p=500,m=150,g=0,y=10;function _(k){k.property("__zoom",ef).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",H).filter(a).on("touchstart.zoom",de).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,W,R,G){var F=k.selection?k.selection():k;F.property("__zoom",ef),k!==F?te(k,W,R,G):F.interrupt().each(function(){I(this,arguments).event(G).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},_.scaleBy=function(k,W,R,G){_.scaleTo(k,function(){var F=this.__zoom.k,le=typeof W=="function"?W.apply(this,arguments):W;return F*le},R,G)},_.scaleTo=function(k,W,R,G){_.transform(k,function(){var F=t.apply(this,arguments),le=this.__zoom,$=R==null?v(F):typeof R=="function"?R.apply(this,arguments):R,X=le.invert($),re=typeof W=="function"?W.apply(this,arguments):W;return o(b(A(le,re),$,X),F,r)},R,G)},_.translateBy=function(k,W,R,G){_.transform(k,function(){return o(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof R=="function"?R.apply(this,arguments):R),t.apply(this,arguments),r)},null,G)},_.translateTo=function(k,W,R,G,F){_.transform(k,function(){var le=t.apply(this,arguments),$=this.__zoom,X=G==null?v(le):typeof G=="function"?G.apply(this,arguments):G;return o(ql.translate(X[0],X[1]).scale($.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof R=="function"?-R.apply(this,arguments):-R),le,r)},G,F)};function A(k,W){return W=Math.max(l[0],Math.min(l[1],W)),W===k.k?k:new zt(W,k.x,k.y)}function b(k,W,R){var G=W[0]-R[0]*k.k,F=W[1]-R[1]*k.k;return G===k.x&&F===k.y?k:new zt(k.k,G,F)}function v(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function te(k,W,R,G){k.on("start.zoom",function(){I(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(G).end()}).tween("zoom",function(){var F=this,le=arguments,$=I(F,le).event(G),X=t.apply(F,le),re=R==null?v(X):typeof R=="function"?R.apply(F,le):R,pe=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),ye=F.__zoom,ue=typeof W=="function"?W.apply(F,le):W,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)}$.zoom(null,ge)}})}function I(k,W,R){return!R&&k.__zooming||new P(k,W)}function P(k,W){this.that=k,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,W),this.taps=0}P.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,W){return this.mouse&&k!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var W=qt(this.that).datum();d.call(k,this.that,new _$(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),W)}};function x(k,...W){if(!e.apply(this,arguments))return;var R=I(this,W).event(k),G=this.__zoom,F=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,i.apply(this,arguments)))),le=Xt(k);if(R.wheel)(R.mouse[0][0]!==le[0]||R.mouse[0][1]!==le[1])&&(R.mouse[1]=G.invert(R.mouse[0]=le)),clearTimeout(R.wheel);else{if(G.k===F)return;R.mouse=[le,G.invert(le)],ua(this),R.start()}Ao(k),R.wheel=setTimeout($,m),R.zoom("mouse",o(b(A(G,F),R.mouse[0],R.mouse[1]),R.extent,r));function $(){R.wheel=null,R.end()}}function O(k,...W){if(h||!e.apply(this,arguments))return;var R=k.currentTarget,G=I(this,W,!0).event(k),F=qt(k.view).on("mousemove.zoom",re,!0).on("mouseup.zoom",pe,!0),le=Xt(k,R),$=k.clientX,X=k.clientY;Mv(k.view),Xl(k),G.mouse=[le,this.__zoom.invert(le)],ua(this),G.start();function re(ye){if(Ao(ye),!G.moved){var ue=ye.clientX-$,fe=ye.clientY-X;G.moved=ue*ue+fe*fe>g}G.event(ye).zoom("mouse",o(b(G.that.__zoom,G.mouse[0]=Xt(ye,R),G.mouse[1]),G.extent,r))}function pe(ye){F.on("mousemove.zoom mouseup.zoom",null),Bv(ye.view,G.moved),Ao(ye),G.event(ye).end()}}function H(k,...W){if(e.apply(this,arguments)){var R=this.__zoom,G=Xt(k.changedTouches?k.changedTouches[0]:k,this),F=R.invert(G),le=R.k*(k.shiftKey?.5:2),$=o(b(A(R,le),G,F),t.apply(this,W),r);Ao(k),s>0?qt(this).transition().duration(s).call(te,$,G,k):qt(this).call(_.transform,$,G,k)}}function de(k,...W){if(e.apply(this,arguments)){var R=k.touches,G=R.length,F=I(this,W,k.changedTouches.length===G).event(k),le,$,X,re;for(Xl(k),$=0;$<G;++$)X=R[$],re=Xt(X,this),re=[re,this.__zoom.invert(re),X.identifier],F.touch0?!F.touch1&&F.touch0[2]!==re[2]&&(F.touch1=re,F.taps=0):(F.touch0=re,le=!0,F.taps=1+!!u);u&&(u=clearTimeout(u)),le&&(F.taps<2&&(f=re[0],u=setTimeout(function(){u=null},p)),ua(this),F.start())}}function z(k,...W){if(this.__zooming){var R=I(this,W).event(k),G=k.changedTouches,F=G.length,le,$,X,re;for(Ao(k),le=0;le<F;++le)$=G[le],X=Xt($,this),R.touch0&&R.touch0[2]===$.identifier?R.touch0[0]=X:R.touch1&&R.touch1[2]===$.identifier&&(R.touch1[0]=X);if($=R.that.__zoom,R.touch1){var pe=R.touch0[0],ye=R.touch0[1],ue=R.touch1[0],fe=R.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;$=A($,Math.sqrt(ge/Ee)),X=[(pe[0]+ue[0])/2,(pe[1]+ue[1])/2],re=[(ye[0]+fe[0])/2,(ye[1]+fe[1])/2]}else if(R.touch0)X=R.touch0[0],re=R.touch0[1];else return;R.zoom("touch",o(b($,X,re),R.extent,r))}}function oe(k,...W){if(this.__zooming){var R=I(this,W).event(k),G=k.changedTouches,F=G.length,le,$;for(Xl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),le=0;le<F;++le)$=G[le],R.touch0&&R.touch0[2]===$.identifier?delete R.touch0:R.touch1&&R.touch1[2]===$.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&($=Xt($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<y)){var X=qt(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:fa(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:fa(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:fa(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:fa([[+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?(y=+k,_):y},_}const tf=Symbol("MiniMapSlots"),x$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],I$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},S$=n.defineComponent({...I$,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(tf),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,x$))],64)):n.createCommentVNode("",!0)}}),C$=["width","height","viewBox","aria-labelledby"],R$=["id"],V$=["d","fill","stroke","stroke-width"],A$={name:"MiniMap",compatConfig:{MODE:3}},T$=n.defineComponent({...A$,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(),g=n.ref();n.provide(tf,o);const y=n.toRef(()=>{var F;return e.width??((F=i.style)==null?void 0:F.width)??a}),_=n.toRef(()=>{var F;return e.height??((F=i.style)==null?void 0:F.height)??l}),A=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",b=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),v=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),te=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),I=n.computed(()=>cl(m.value.filter(F=>!F.hidden))),P=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})),x=n.computed(()=>m.value&&m.value.length?$b(I.value,P.value):P.value),O=n.computed(()=>{const F=x.value.width/y.value,le=x.value.height/_.value;return Math.max(F,le)}),H=n.computed(()=>{const F=O.value*y.value,le=O.value*_.value,$=e.offsetScale*O.value;return{offset:$,x:x.value.x-(F-x.value.width)/2-$,y:x.value.y-(le-x.value.height)/2-$,width:F+$*2,height:le+$*2}}),de=n.computed(()=>!H.value.x||!H.value.y?"":`
30
- M${H.value.x-H.value.offset},${H.value.y-H.value.offset}
31
- h${H.value.width+H.value.offset*2}
32
- v${H.value.height+H.value.offset*2}
33
- h${-H.value.width-H.value.offset*2}z
34
- M${P.value.x+e.maskBorderRadius},${P.value.y}
35
- h${P.value.width-2*e.maskBorderRadius}
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 Je extends Error{constructor(t,...o){var i;super((i=md[t])==null?void 0:i.call(md,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function bl(e){return"clientX"in e}function zb(e){return"sourceEvent"in e}function It(e,t){const o=bl(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 vo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ub(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 Li(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Fb=()=>!0;function _l(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Hb(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())Mi(a,Ti(l))>0&&i.push(l);return i}const Gb=250;function Yb(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Hb(e,o,t+Gb);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:m,y:p}=On(d,f,f.position,!0),y=Math.sqrt((m-e.x)**2+(p-e.y)**2);y>t||(y<s?(r=[{...f,x:m,y:p}],s=y):y===s&&r.push({...f,x:m,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 pd(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=Fb},u,f,m,p){const y=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:g,y:_}=It(e),C=r.elementFromPoint(g,_),h=C!=null&&C.classList.contains(`${s}-flow__handle`)?C:b,E={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const Z=hd(void 0,h),L=h.getAttribute("data-nodeid"),G=h.getAttribute("data-handleid"),T=h.classList.contains("connectable"),S=h.classList.contains("connectableend");if(!L||!Z)return E;const O={source:y?L:i,sourceHandle:y?G:a,target:y?i:L,targetHandle:y?a:G};E.connection=O;const M=T&&S&&(o===Dt.Strict?y&&Z==="source"||!y&&Z==="target":L!==i||G!==a);E.isValid=M&&d(O,{nodes:f,edges:u,sourceNode:m(O.source),targetNode:m(O.target)}),E.toHandle=yd(L,Z,G,p,o,!0)}return E}function hd(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Wb(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Kb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function yd(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(m=>m.id===o):u==null?void 0:u[0])??null;return f&&l?{...f,...On(d,f,f.position,!0)}:f}const wl={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top},qb=["production","prod"];function No(e,...t){gd()&&console.warn(`[Vue Flow]: ${e}`,...t)}function gd(){return!qb.includes(process.env.NODE_ENV||"")}function bd(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,...Bi(r)}}):null}function kl(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 Xb(e,t,o,i){if(!e||!e.source||!e.target)return o(new Je(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=Xc(a,void 0,i),Cb(a,t)?!1:a}function jb(e,t,o,i,a){if(!t.source||!t.target)return a(new Je(qe.EDGE_INVALID,e.id)),!1;if(!o)return a(new Je(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 _d(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!cn(r)){o(new Je(qe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=$b(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 Je(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 wd(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 El(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}`;wd("source",c,u,e,a,r),wd("target",c,d,e,l,s)}}function kd(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function vl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Gt(d)?d:Xb(d,s,a,l);if(!u)continue;const f=o(u.source),m=o(u.target);if(!f||!m){a(new Je(qe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Je(qe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!m){a(new Je(qe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:m})){a(new Je(qe.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...Xc(u,p,l),sourceNode:f,targetNode:m})}return c}const Ed=Symbol("vueFlow"),vd=Symbol("nodeId"),Nd=Symbol("nodeRef"),Zb=Symbol("edgeId"),Jb=Symbol("edgeRef"),Pi=Symbol("slots");function Id(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:m,findNode:p,multiSelectionActive:y,nodesSelectionActive:b,selectNodesOnDrag:g,removeSelectedElements:_,addSelectedNodes:C,updateNodePositions:h,emits:E}=Pe(),{onStart:Z,onDrag:L,onStop:G,onClick:T,el:S,disabled:O,id:te,selectable:M,dragHandle:oe}=e,w=n.shallowRef(!1);let j=[],A,W=null,Q={x:void 0,y:void 0},ee={x:0,y:0},x=null,X=!1,le=!1,pe=0,be=!1;const de=t0(),me=({x:J,y:q})=>{Q={x:J,y:q};let v=!1;if(j=j.map(V=>{const Y={x:J-V.distance.x,y:q-V.distance.y},{computedPosition:D}=gl(V,o.value?Li(Y,i.value):Y,E.error,r.value,V.parentNode?p(V.parentNode):void 0);return v=v||V.position.x!==D.x||V.position.y!==D.y,V.position=D,V}),le=le||v,!!v&&(h(j,!0,!0),w.value=!0,x)){const[V,Y]=yl({id:te,dragItems:j,findNode:p});L({event:x,node:V,nodes:Y})}},ye=()=>{if(!W)return;const[J,q]=id(ee,W,u.value);if(J!==0||q!==0){const v={x:(Q.x??0)-J/c.value.zoom,y:(Q.y??0)-q/c.value.zoom};m({x:J,y:q})&&me(v)}pe=requestAnimationFrame(ye)},ve=(J,q)=>{X=!0;const v=p(te);!g.value&&!y.value&&v&&(v.selected||_()),v&&n.toValue(M)&&g.value&&kl(v,y.value,C,_,b,!1,q);const V=de(J.sourceEvent);if(Q=V,j=Mb(l.value,f.value,V,te),j.length){const[Y,D]=yl({id:te,dragItems:j,findNode:p});Z({event:J.sourceEvent,node:Y,nodes:D})}},Ce=(J,q)=>{var v;J.sourceEvent.type==="touchmove"&&J.sourceEvent.touches.length>1||(le=!1,s.value===0&&ve(J,q),Q=de(J.sourceEvent),W=((v=t.value)==null?void 0:v.getBoundingClientRect())||null,ee=It(J.sourceEvent,W))},xe=(J,q)=>{const v=de(J.sourceEvent);if(!be&&X&&d.value&&(be=!0,ye()),!X){const V=v.xSnapped-(Q.x??0),Y=v.ySnapped-(Q.y??0);Math.sqrt(V*V+Y*Y)>s.value&&ve(J,q)}(Q.x!==v.xSnapped||Q.y!==v.ySnapped)&&j.length&&X&&(x=J.sourceEvent,ee=It(J.sourceEvent,W),me(v))},ge=J=>{let q=!1;if(!X&&!w.value&&!y.value){const v=J.sourceEvent,V=de(v),Y=V.xSnapped-(Q.x??0),D=V.ySnapped-(Q.y??0),K=Math.sqrt(Y*Y+D*D);K!==0&&K<=s.value&&(T==null||T(v),q=!0)}if(j.length&&!q){le&&(h(j,!1,!1),le=!1);const[v,V]=yl({id:te,dragItems:j,findNode:p});G({event:J.sourceEvent,node:v,nodes:V})}j=[],w.value=!1,be=!1,X=!1,Q={x:void 0,y:void 0},cancelAnimationFrame(pe)};return n.watch([()=>n.toValue(O),S],([J,q],v,V)=>{if(q){const Y=pt(q);J||(A=Iy().on("start",D=>Ce(D,q)).on("drag",D=>xe(D,q)).on("end",D=>ge(D)).filter(D=>{const K=D.target,he=n.toValue(oe);return!D.button&&(!a.value||!dd(K,`.${a.value}`,q)&&(!he||dd(K,he,q)))}),Y.call(A)),V(()=>{Y.on(".drag",null),A&&(A.on("start",null),A.on("drag",null),A.on("end",null))})}}),w}function Qb(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),updateStart:$e(),update:$e(),updateEnd:$e()}}function e0(e,t){const o=Qb();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 t0(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Pe();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=zb(a)?a.sourceEvent:a,{x:c,y:d}=It(s,r),u=ko({x:c,y:d},e.value),{x:f,y:m}=o.value?Li(u,t.value):u;return{xSnapped:f,ySnapped:m,...u}}}function zi(){return!0}function $d({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:m,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:b,findNode:g,panBy:_,startConnection:C,updateConnection:h,endConnection:E,emits:Z,viewport:L,edges:G,nodes:T,isValidConnection:S,nodeLookup:O}=Pe();let te=null,M=!1,oe=null;function w(A){var W;const Q=n.toValue(o)==="target",ee=bl(A),x=qc(A.target),X=A.currentTarget;if(X&&(ee&&A.button===0||!ee)){let le=function(we){v=It(we,ge),me=Yb(ko(v,L.value,!1,[1,1]),u.value,O.value,D),V||(Y(),V=!0);const Re=pd(we,{handle:me,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:Q?"target":"source",isValidConnection:de,doc:x,lib:"vue",flowId:s,nodeLookup:O.value},G.value,T.value,g,O.value);oe=Re.handleDomNode,te=Re.connection,M=Kb(!!me,Re.isValid);const Ae={...Ie,isValid:M,to:Re.toHandle&&M?wo({x:Re.toHandle.x,y:Re.toHandle.y},L.value):v,toHandle:Re.toHandle,toPosition:M&&Re.toHandle?Re.toHandle.position:wl[D.position],toNode:Re.toHandle?O.value.get(Re.toHandle.nodeId):null};if(M&&me&&(Ie!=null&&Ie.toHandle)&&Ae.toHandle&&Ie.toHandle.type===Ae.toHandle.type&&Ie.toHandle.nodeId===Ae.toHandle.nodeId&&Ie.toHandle.id===Ae.toHandle.id&&Ie.to.x===Ae.to.x&&Ie.to.y===Ae.to.y)return;const De=me??Re.toHandle;if(h(De&&M?wo({x:De.x,y:De.y},L.value):v,De,Wb(!!De,M)),Ie=Ae,!me&&!M&&!oe)return _l(q);te&&te.source!==te.target&&oe&&(_l(q),q=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!M),oe.classList.toggle("vue-flow__handle-valid",!!M))},pe=function(we){"touches"in we&&we.touches.length>0||((me||oe)&&te&&M&&(l?l(we,te):Z.connect(te)),Z.connectEnd(we),a&&(r==null||r(we)),_l(q),cancelAnimationFrame(ye),E(we),V=!1,M=!1,te=null,oe=null,x.removeEventListener("mousemove",le),x.removeEventListener("mouseup",pe),x.removeEventListener("touchmove",le),x.removeEventListener("touchend",pe))};const be=g(n.toValue(t));let de=n.toValue(i)||S.value||zi;!de&&be&&(de=(Q?be.isValidSourcePos:be.isValidTargetPos)||zi);let me,ye=0;const{x:ve,y:Ce}=It(A),xe=hd(n.toValue(a),X),ge=(W=c.value)==null?void 0:W.getBoundingClientRect();if(!ge||!xe)return;const J=yd(n.toValue(t),xe,n.toValue(e),O.value,d.value);if(!J)return;let q,v=It(A,ge),V=!1;const Y=()=>{if(!y.value)return;const[we,Re]=id(v,ge,b.value);_({x:we,y:Re}),ye=requestAnimationFrame(Y)},D={...J,nodeId:n.toValue(t),type:xe,position:J.position},K=O.value.get(n.toValue(t)),Ee={inProgress:!0,isValid:null,from:On(K,D,Se.Left,!0),fromHandle:D,fromPosition:D.position,fromNode:K,to:v,toHandle:null,toPosition:wl[D.position],toNode:null};C({nodeId:n.toValue(t),id:n.toValue(e),type:xe,position:(X==null?void 0:X.getAttribute("data-handlepos"))||Se.Top,...v},{x:ve-ge.left,y:Ce-ge.top}),Z.connectStart({event:A,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:xe});let Ie=Ee;x.addEventListener("mousemove",le),x.addEventListener("mouseup",pe),x.addEventListener("touchmove",le),x.addEventListener("touchend",pe)}}function j(A){var W,Q;if(!f.value)return;const ee=n.toValue(o)==="target";if(!m.value){Z.clickConnectStart({event:A,nodeId:n.toValue(t),handleId:n.toValue(e)}),C({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Se.Top,...It(A)},void 0,!0);return}let x=n.toValue(i)||S.value||zi;const X=g(n.toValue(t));if(!x&&X&&(x=(ee?X.isValidSourcePos:X.isValidTargetPos)||zi),X&&(typeof X.connectable>"u"?p.value:X.connectable)===!1)return;const le=qc(A.target),pe=pd(A,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Se.Top,...It(A)},connectionMode:d.value,fromNodeId:m.value.nodeId,fromHandleId:m.value.id??null,fromType:m.value.type,isValidConnection:x,doc:le,lib:"vue",flowId:s,nodeLookup:O.value},G.value,T.value,g,O.value),be=((W=pe.connection)==null?void 0:W.source)===((Q=pe.connection)==null?void 0:Q.target);pe.isValid&&pe.connection&&!be&&Z.connect(pe.connection),Z.clickConnectEnd(A),E(A,!0)}return{handlePointerDown:w,handleClick:j}}function n0(){return n.inject(vd,"")}function xd(e){const t=e??n0()??"",o=n.inject(Nd,n.ref(null)),{findNode:i,edges:a,emits:l}=Pe(),r=i(t);return r||l.error(new Je(qe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>dn([r],a.value))}}function o0(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),dragStart:$e(),drag:$e(),dragStop:$e()}}function i0(e,t){const o=o0();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 Sd(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Pe();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,m=d?4:1,p=c.x*u*m,y=c.y*f*m,b=[];for(const g of e.value)if(g.draggable||r&&typeof g.draggable>"u"){const _={x:g.computedPosition.x+p,y:g.computedPosition.y+y},{position:C}=gl(g,_,s.error,t.value,g.parentNode?i(g.parentNode):void 0);b.push({id:g.id,position:C,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(b,!0,!1)}}const Ui=.1,a0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kt(){return No("Viewport not initialized yet."),Promise.resolve(!1)}const l0={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 r0(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?uo:vi).scaleBy(Nl(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}=Kc({x:-i,y:-a},e.translateExtent),f=Mn.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?uo:vi).transform(Nl(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"?uo:vi).scaleTo(Nl(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:Ui,includeHiddenNodes:!1,duration:0})=>{var l,r;const s=[];for(const m of e.nodes)m.dimensions.width&&m.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!m.hidden)&&(!((l=a.nodes)!=null&&l.length)||(r=a.nodes)!=null&&r.length&&a.nodes.includes(m.id))&&s.push(m);if(!s.length)return Promise.resolve(!1);const c=ml(s),{x:d,y:u,zoom:f}=td(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ui);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:Ui})=>{const{x:r,y:s,zoom:c}=td(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Ui);return o(r,s,c,l)},project:a=>ko(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 ko(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 wo(s,e.viewport)}return{x:0,y:0}}}:l0)}function Nl(e,t=0,o=a0,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function s0(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,g,_=!!(o.nodes.value.length||o.edges.value.length);b=Cn([e.modelValue,()=>{var C,h;return(h=(C=e.modelValue)==null?void 0:C.value)==null?void 0:h.length}],([C])=>{C&&Array.isArray(C)&&(g==null||g.pause(),o.setElements(C),!g&&!_&&C.length?_=!0:g==null||g.resume())}),g=Cn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([C,h])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...C,...h],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let b,g,_=!!o.nodes.value.length;b=Cn([e.nodes,()=>{var C,h;return(h=(C=e.nodes)==null?void 0:C.value)==null?void 0:h.length}],([C])=>{C&&Array.isArray(C)&&(g==null||g.pause(),o.setNodes(C),!g&&!_&&C.length?_=!0:g==null||g.resume())}),g=Cn([o.nodes,()=>o.nodes.value.length],([C])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...C],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let b,g,_=!!o.edges.value.length;b=Cn([e.edges,()=>{var C,h;return(h=(C=e.edges)==null?void 0:C.value)==null?void 0:h.length}],([C])=>{C&&Array.isArray(C)&&(g==null||g.pause(),o.setEdges(C),!g&&!_&&C.length?_=!0:g==null||g.resume())}),g=Cn([o.edges,()=>o.edges.value.length],([C])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...C],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.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})})},m=()=>{i.run(()=>{const b=async g=>{let _=g;typeof t.autoConnect=="function"&&(_=await t.autoConnect(g)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{Xe(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(g,_,C)=>{g?o.onConnect(b):o.hooks.value.connect.off(b),C(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},p=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(t)){const _=g;if(!b.includes(_)){const C=n.toRef(()=>t[_]),h=o[_];n.isRef(h)&&i.run(()=>{n.watch(C,E=>{Xe(E)&&(h.value=E)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),m(),p()})()}),()=>i.stop()}function c0(){return{edgesChange:$e(),nodesChange:$e(),nodeDoubleClick:$e(),nodeClick:$e(),nodeMouseEnter:$e(),nodeMouseMove:$e(),nodeMouseLeave:$e(),nodeContextMenu:$e(),nodeDragStart:$e(),nodeDrag:$e(),nodeDragStop:$e(),nodesInitialized:$e(),miniMapNodeClick:$e(),miniMapNodeDoubleClick:$e(),miniMapNodeMouseEnter:$e(),miniMapNodeMouseMove:$e(),miniMapNodeMouseLeave:$e(),connect:$e(),connectStart:$e(),connectEnd:$e(),clickConnectStart:$e(),clickConnectEnd:$e(),paneReady:$e(),init:$e(),move:$e(),moveStart:$e(),moveEnd:$e(),selectionDragStart:$e(),selectionDrag:$e(),selectionDragStop:$e(),selectionContextMenu:$e(),selectionStart:$e(),selectionEnd:$e(),viewportChangeStart:$e(),viewportChange:$e(),viewportChangeEnd:$e(),paneScroll:$e(),paneClick:$e(),paneContextMenu:$e(),paneMouseEnter:$e(),paneMouseMove:$e(),paneMouseLeave:$e(),edgeContextMenu:$e(),edgeMouseEnter:$e(),edgeMouseMove:$e(),edgeMouseLeave:$e(),edgeDoubleClick:$e(),edgeClick:$e(),edgeUpdateStart:$e(),edgeUpdate:$e(),edgeUpdateEnd:$e(),updateNodeInternals:$e(),error:$e(e=>No(e.message))}}function d0(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),io(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),io(l.removeHasEmitListeners)}});function i(a){var l;const r=u0(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function u0(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Cd(){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:dl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:go.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:rn.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:vo()?"Meta":"Control",zoomActivationKeyCode:vo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:c0(),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 f0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function m0(e,t,o){const i=r0(e),a=v=>{const V=v??[];e.hooks.updateNodeInternals.trigger(V)},l=v=>Sb(v,e.nodes,e.edges),r=v=>xb(v,e.nodes,e.edges),s=v=>dn(v,e.edges),c=({id:v,type:V,nodeId:Y})=>{var D;const K=v?`-${V}-${v}`:`-${V}`;return Array.from(((D=e.connectionLookup.get(`${Y}${K}`))==null?void 0:D.values())??[])},d=v=>{if(v)return t.value.get(v)},u=v=>{if(v)return o.value.get(v)},f=(v,V,Y)=>{var D,K;const he=[];for(const Ee of v){const Ie={id:Ee.id,type:"position",dragging:Y,from:Ee.from};if(V&&(Ie.position=Ee.position,Ee.parentNode)){const we=d(Ee.parentNode);Ie.position={x:Ie.position.x-(((D=we==null?void 0:we.computedPosition)==null?void 0:D.x)??0),y:Ie.position.y-(((K=we==null?void 0:we.computedPosition)==null?void 0:K.y)??0)}}he.push(Ie)}he!=null&&he.length&&e.hooks.nodesChange.trigger(he)},m=v=>{if(!e.vueFlowRef)return;const V=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!V)return;const Y=window.getComputedStyle(V),{m22:D}=new window.DOMMatrixReadOnly(Y.transform),K=[];for(const he of v){const Ee=he,Ie=d(Ee.id);if(Ie){const we=Bi(Ee.nodeElement);if(!!(we.width&&we.height&&(Ie.dimensions.width!==we.width||Ie.dimensions.height!==we.height||Ee.forceUpdate))){const Ae=Ee.nodeElement.getBoundingClientRect();Ie.dimensions=we,Ie.handleBounds.source=bd("source",Ee.nodeElement,Ae,D,Ie.id),Ie.handleBounds.target=bd("target",Ee.nodeElement,Ae,D,Ie.id),K.push({id:Ie.id,type:"dimensions",dimensions:we})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),K.length&&e.hooks.nodesChange.trigger(K)},p=(v,V)=>{const Y=new Set,D=new Set;for(const Ee of v)cn(Ee)?Y.add(Ee.id):Gt(Ee)&&D.add(Ee.id);const K=Wt(t.value,Y,!0),he=Wt(o.value,D);if(e.multiSelectionActive){for(const Ee of Y)K.push(Yt(Ee,V));for(const Ee of D)he.push(Yt(Ee,V))}K.length&&e.hooks.nodesChange.trigger(K),he.length&&e.hooks.edgesChange.trigger(he)},y=v=>{if(e.multiSelectionActive){const V=v.map(Y=>Yt(Y.id,!0));e.hooks.nodesChange.trigger(V);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(v.map(V=>V.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},b=v=>{if(e.multiSelectionActive){const V=v.map(Y=>Yt(Y.id,!0));e.hooks.edgesChange.trigger(V);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(v.map(V=>V.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},g=v=>{p(v,!0)},_=v=>{const Y=(v||e.nodes).map(D=>(D.selected=!1,Yt(D.id,!1)));e.hooks.nodesChange.trigger(Y)},C=v=>{const Y=(v||e.edges).map(D=>(D.selected=!1,Yt(D.id,!1)));e.hooks.edgesChange.trigger(Y)},h=v=>{if(!v||!v.length)return p([],!1);const V=v.reduce((Y,D)=>{const K=Yt(D.id,!1);return cn(D)?Y.nodes.push(K):Y.edges.push(K),Y},{nodes:[],edges:[]});V.nodes.length&&e.hooks.nodesChange.trigger(V.nodes),V.edges.length&&e.hooks.edgesChange.trigger(V.edges)},E=v=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([v,e.maxZoom]),e.minZoom=v},Z=v=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([e.minZoom,v]),e.maxZoom=v},L=v=>{var V;(V=e.d3Zoom)==null||V.translateExtent(v),e.translateExtent=v},G=v=>{e.nodeExtent=v,a()},T=v=>{var V;(V=e.d3Zoom)==null||V.clickDistance(v)},S=v=>{e.nodesDraggable=v,e.nodesConnectable=v,e.elementsSelectable=v},O=v=>{const V=v instanceof Function?v(e.nodes):v;!e.initialized&&!V.length||(e.nodes=_d(V,d,e.hooks.error.trigger))},te=v=>{const V=v instanceof Function?v(e.edges):v;if(!e.initialized&&!V.length)return;const Y=vl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);El(e.connectionLookup,o.value,Y),e.edges=Y},M=v=>{const V=v instanceof Function?v([...e.nodes,...e.edges]):v;!e.initialized&&!V.length||(O(V.filter(cn)),te(V.filter(Gt)))},oe=v=>{let V=v instanceof Function?v(e.nodes):v;V=Array.isArray(V)?V:[V];const Y=_d(V,d,e.hooks.error.trigger),D=[];for(const K of Y)D.push(ld(K));D.length&&e.hooks.nodesChange.trigger(D)},w=v=>{let V=v instanceof Function?v(e.edges):v;V=Array.isArray(V)?V:[V];const Y=vl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),D=[];for(const K of Y)D.push(ld(K));D.length&&e.hooks.edgesChange.trigger(D)},j=(v,V=!0,Y=!1)=>{const D=v instanceof Function?v(e.nodes):v,K=Array.isArray(D)?D:[D],he=[],Ee=[];function Ie(Re){const Ae=s(Re);for(const De of Ae)(!Xe(De.deletable)||De.deletable)&&Ee.push(sd(De.id,De.source,De.target,De.sourceHandle,De.targetHandle))}function we(Re){const Ae=[];for(const De of e.nodes)De.parentNode===Re&&Ae.push(De);if(Ae.length){for(const De of Ae)he.push(rd(De.id));V&&Ie(Ae);for(const De of Ae)we(De.id)}}for(const Re of K){const Ae=typeof Re=="string"?d(Re):Re;Ae&&(Xe(Ae.deletable)&&!Ae.deletable||(he.push(rd(Ae.id)),V&&Ie([Ae]),Y&&we(Ae.id)))}Ee.length&&e.hooks.edgesChange.trigger(Ee),he.length&&e.hooks.nodesChange.trigger(he)},A=v=>{const V=v instanceof Function?v(e.edges):v,Y=Array.isArray(V)?V:[V],D=[];for(const K of Y){const he=typeof K=="string"?u(K):K;he&&(Xe(he.deletable)&&!he.deletable||D.push(sd(typeof K=="string"?K:K.id,he.source,he.target,he.sourceHandle,he.targetHandle)))}e.hooks.edgesChange.trigger(D)},W=(v,V,Y=!0)=>{const D=u(v.id);if(!D)return!1;const K=e.edges.indexOf(D),he=jb(v,V,D,Y,e.hooks.error.trigger);if(he){const[Ee]=vl([he],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ie,we)=>we===K?Ee:Ie),El(e.connectionLookup,o.value,[Ee]),Ee}return!1},Q=(v,V,Y={replace:!1})=>{const D=u(v);if(!D)return;const K=typeof V=="function"?V(D):V;D.data=Y.replace?K:{...D.data,...K}},ee=v=>ad(v,e.nodes),x=v=>{const V=ad(v,e.edges);return El(e.connectionLookup,o.value,V),V},X=(v,V,Y={replace:!1})=>{const D=d(v);if(!D)return;const K=typeof V=="function"?V(D):V;Y.replace?e.nodes.splice(e.nodes.indexOf(D),1,K):Object.assign(D,K)},le=(v,V,Y={replace:!1})=>{const D=d(v);if(!D)return;const K=typeof V=="function"?V(D):V;D.data=Y.replace?K:{...D.data,...K}},pe=(v,V,Y=!1)=>{Y?e.connectionClickStartHandle=v:e.connectionStartHandle=v,e.connectionEndHandle=null,e.connectionStatus=null,V&&(e.connectionPosition=V)},be=(v,V=null,Y=null)=>{e.connectionStartHandle&&(e.connectionPosition=v,e.connectionEndHandle=V,e.connectionStatus=Y)},de=(v,V)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,V?e.connectionClickStartHandle=null:e.connectionStartHandle=null},me=v=>{const V=Ib(v),Y=V?null:_o(v)?v:d(v.id);return!V&&!Y?[null,null,V]:[V?v:Ti(Y),Y,V]},ye=(v,V=!0,Y=e.nodes)=>{const[D,K,he]=me(v);if(!D)return[];const Ee=[];for(const Ie of Y||e.nodes){if(!he&&(Ie.id===K.id||!Ie.computedPosition))continue;const we=Ti(Ie),Re=Mi(we,D);(V&&Re>0||Re>=we.width*we.height||Re>=Number(D.width)*Number(D.height))&&Ee.push(Ie)}return Ee},ve=(v,V,Y=!0)=>{const[D]=me(v);if(!D)return!1;const K=Mi(D,V);return Y&&K>0||K>=Number(D.width)*Number(D.height)},Ce=v=>{const{viewport:V,dimensions:Y,d3Zoom:D,d3Selection:K,translateExtent:he}=e;if(!D||!K||!v.x&&!v.y)return!1;const Ee=Mn.translate(V.x+v.x,V.y+v.y).scale(V.zoom),Ie=[[0,0],[Y.width,Y.height]],we=D.constrain()(Ee,Ie,he),Re=e.viewport.x!==we.x||e.viewport.y!==we.y||e.viewport.zoom!==we.k;return D.transform(K,we),Re},xe=v=>{const V=v instanceof Function?v(e):v,Y=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(V.defaultEdgeOptions)&&(e.defaultEdgeOptions=V.defaultEdgeOptions);const D=V.modelValue||V.nodes||V.edges?[]:void 0;D&&(V.modelValue&&D.push(...V.modelValue),V.nodes&&D.push(...V.nodes),V.edges&&D.push(...V.edges),M(D));const K=()=>{Xe(V.maxZoom)&&Z(V.maxZoom),Xe(V.minZoom)&&E(V.minZoom),Xe(V.translateExtent)&&L(V.translateExtent)};for(const he of Object.keys(V)){const Ee=he,Ie=V[Ee];![...f0,...Y].includes(Ee)&&Xe(Ie)&&(e[Ee]=Ie)}Ha(()=>e.d3Zoom).not.toBeNull().then(K),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:m,setElements:M,setNodes:O,setEdges:te,addNodes:oe,addEdges:w,removeNodes:j,removeEdges:A,findNode:d,findEdge:u,updateEdge:W,updateEdgeData:Q,updateNode:X,updateNodeData:le,applyEdgeChanges:x,applyNodeChanges:ee,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:E,setMaxZoom:Z,setTranslateExtent:L,setNodeExtent:G,setPaneClickDistance:T,removeSelectedElements:h,removeSelectedNodes:_,removeSelectedEdges:C,startConnection:pe,updateConnection:be,endConnection:de,setInteractive:S,setState:xe,getIntersectingNodes:ye,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:ve,panBy:Ce,fitView:v=>i.value.fitView(v),zoomIn:v=>i.value.zoomIn(v),zoomOut:v=>i.value.zoomOut(v),zoomTo:(v,V)=>i.value.zoomTo(v,V),setViewport:(v,V)=>i.value.setViewport(v,V),setTransform:(v,V)=>i.value.setTransform(v,V),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(v,V,Y)=>i.value.setCenter(v,V,Y),fitBounds:(v,V)=>i.value.fitBounds(v,V),project:v=>i.value.project(v),screenToFlowCoordinate:v=>i.value.screenToFlowCoordinate(v),flowToScreenCoordinate:v=>i.value.flowToScreenCoordinate(v),toObject:()=>{const v=[],V=[];for(const Y of e.nodes){const{computedPosition:D,handleBounds:K,selected:he,dimensions:Ee,isParent:Ie,resizing:we,dragging:Re,events:Ae,...De}=Y;v.push(De)}for(const Y of e.edges){const{selected:D,sourceNode:K,targetNode:he,events:Ee,...Ie}=Y;V.push(Ie)}return JSON.parse(JSON.stringify({nodes:v,edges:V,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:v=>new Promise(V=>{const{nodes:Y,edges:D,position:K,zoom:he,viewport:Ee}=v;Y&&O(Y),D&&te(D);const[Ie,we]=Ee!=null&&Ee.x&&(Ee!=null&&Ee.y)?[Ee.x,Ee.y]:K??[null,null];if(Ie&&we){const Re=(Ee==null?void 0:Ee.zoom)||he||e.viewport.zoom;return Ha(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ie,y:we,zoom:Re}).then(()=>{V(!0)})})}else V(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const v=Cd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const V=Mn.translate(v.defaultViewport.x??0,v.defaultViewport.y??0).scale(sn(v.defaultViewport.zoom??1,v.minZoom,v.maxZoom)),Y=e.viewportRef.getBoundingClientRect(),D=[[0,0],[Y.width,Y.height]],K=e.d3Zoom.constrain()(V,D,v.translateExtent);e.d3Zoom.transform(e.d3Selection,K)}xe(v)},$destroy:()=>{}}}const p0=["data-id","data-handleid","data-nodeid","data-handlepos"],h0={name:"Handle",compatConfig:{MODE:3}},un=n.defineComponent({...h0,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:m}=Pe(),{id:p,node:y,nodeEl:b,connectedEdges:g}=xd(),_=n.ref(),C=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),E=n.toRef(()=>{var te,M,oe,w,j,A;return((te=r.value)==null?void 0:te.nodeId)===p&&((M=r.value)==null?void 0:M.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((w=c.value)==null?void 0:w.nodeId)===p&&((j=c.value)==null?void 0:j.id)===e.id&&((A=c.value)==null?void 0:A.type)===i.value}),Z=n.toRef(()=>{var te,M,oe;return((te=s.value)==null?void 0:te.nodeId)===p&&((M=s.value)==null?void 0:M.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:L,handleClick:G}=$d({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),T=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(te=>{const M=te[`${i.value}Handle`];return te[i.value]!==p?!1:M?M===e.id:!0}):typeof e.connectable=="number"?g.value.filter(te=>{const M=te[`${i.value}Handle`];return te[i.value]!==p?!1:M?M===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,g.value):Xe(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var te;if(!y.dimensions.width||!y.dimensions.height)return;const M=(te=y.handleBounds[i.value])==null?void 0:te.find(ee=>ee.id===e.id);if(!d.value||M)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!_.value||!oe||!e.id)return;const w=b.value.getBoundingClientRect(),j=_.value.getBoundingClientRect(),A=window.getComputedStyle(oe),{m22:W}=new window.DOMMatrixReadOnly(A.transform),Q={id:e.id,position:e.position,x:(j.left-w.left)/W,y:(j.top-w.top)/W,type:i.value,nodeId:p,...Bi(_.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],Q]});function S(te){const M=bl(te);T.value&&C.value&&(M&&te.button===0||!M)&&L(te)}function O(te){!p||!s.value&&!C.value||T.value&&G(te)}return t({handleClick:G,handlePointerDown:L,onClick:O,onPointerDown:S}),(te,M)=>(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":te.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${te.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(m),i.value,{connectable:T.value,connecting:Z.value,connectablestart:C.value,connectableend:h.value,connectionindicator:T.value&&(C.value&&!E.value||h.value&&E.value)}]]),onMousedown:S,onTouchstartPassive:S,onClick:O},[n.renderSlot(te.$slots,"default",{id:te.id})],42,p0))}}),Fi=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(un,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(un,{type:"source",position:e,connectable:i,isValidConnection:l})]};Fi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Fi.inheritAttrs=!1,Fi.compatConfig={MODE:3};const y0=Fi,Hi=function({targetPosition:e=Se.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(un,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Hi.props=["targetPosition","label","isValidTargetPos","connectable","data"],Hi.inheritAttrs=!1,Hi.compatConfig={MODE:3};const g0=Hi,Gi=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(un,{type:"source",position:e,connectable:o,isValidConnection:i})]};Gi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Gi.inheritAttrs=!1,Gi.compatConfig={MODE:3};const b0=Gi,_0=["transform"],w0=["width","height","x","y","rx","ry"],k0=["y"],E0={name:"EdgeText",compatConfig:{MODE:3}},v0=n.defineComponent({...E0,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,w0)):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,k0)],8,_0))}}),N0=["id","d","marker-end","marker-start"],I0=["d","stroke-width"],$0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Yi=n.defineComponent({...$0,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,N0),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,I0)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(v0,{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 Rd({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 Vd({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 Wi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ad({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Se.Left:r=t-Wi(t-i,l),s=o;break;case Se.Right:r=t+Wi(i-t,l),s=o;break;case Se.Top:r=t,s=o-Wi(o-a,l);break;case Se.Bottom:r=t,s=o+Wi(a-o,l);break}return[r,s]}function Td(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,curvature:s=.25}=e,[c,d]=Ad({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=Ad({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[m,p,y,b]=Vd({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}`,m,p,y,b]}function Md({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 Bd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top}=e,[s,c]=Md({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=Md({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,m,p,y]=Vd({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,m,p,y]}const Dd={[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 x0({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 Od(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function S0({source:e,sourcePosition:t=Se.Bottom,target:o,targetPosition:i=Se.Top,center:a,offset:l}){const r=Dd[t],s=Dd[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=x0({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",m=u[f];let p,y,b;const g={x:0,y:0},_={x:0,y:0},[C,h,E,Z]=Rd({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){y=a.x??C,b=a.y??h;const G=[{x:y,y:c.y},{x:y,y:d.y}],T=[{x:c.x,y:b},{x:d.x,y:b}];r[f]===m?p=f==="x"?G:T:p=f==="x"?T:G}else{const G=[{x:c.x,y:d.y}],T=[{x:d.x,y:c.y}];if(f==="x"?p=r.x===m?T:G:p=r.y===m?G:T,t===i){const oe=Math.abs(e[f]-o[f]);if(oe<=l){const w=Math.min(l-1,l-oe);r[f]===m?g[f]=(c[f]>e[f]?-1:1)*w:_[f]=(d[f]>o[f]?-1:1)*w}}if(t!==i){const oe=f==="x"?"y":"x",w=r[f]===s[oe],j=c[oe]>d[oe],A=c[oe]<d[oe];(r[f]===1&&(!w&&j||w&&A)||r[f]!==1&&(!w&&A||w&&j))&&(p=f==="x"?G:T)}const S={x:c.x+g.x,y:c.y+g.y},O={x:d.x+_.x,y:d.y+_.y},te=Math.max(Math.abs(S.x-p[0].x),Math.abs(O.x-p[0].x)),M=Math.max(Math.abs(S.y-p[0].y),Math.abs(O.y-p[0].y));te>=M?(y=(S.x+O.x)/2,b=p[0].y):(y=p[0].x,b=(S.y+O.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:d.x+_.x,y:d.y+_.y},o],y,b,E,Z]}function C0(e,t,o,i){const a=Math.min(Od(e,t)/2,Od(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 Il(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,m,p,y,b]=S0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((_,C,h)=>{let E;return h>0&&h<f.length-1?E=C0(f[h-1],C,f[h+1],s):E=`${h===0?"M":"L"}${C.x} ${C.y}`,_+=E,_},""),m,p,y,b]}function R0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=Rd({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const V0=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]=R0(e);return n.h(Yi,{path:o,labelX:i,labelY:a,...t,...e})}}}),Ld=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]=Il({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Yi,{path:o,labelX:i,labelY:a,...t,...e})}}}),A0=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(Ld,{...e,...t,borderRadius:0})}}),T0=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]=Td({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Yi,{path:o,labelX:i,labelY:a,...t,...e})}}}),M0=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]=Bd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Yi,{path:o,labelX:i,labelY:a,...t,...e})}}}),B0={input:b0,default:y0,output:g0},D0={default:T0,straight:V0,step:A0,smoothstep:Ld,simplebezier:M0};function O0(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={...D0,...e.edgeTypes},g=Object.keys(b);for(const _ of e.edges)_.type&&!g.includes(_.type)&&(b[_.type]=_.type);return b}),r=n.computed(()=>{const b={...B0,...e.nodeTypes},g=Object.keys(b);for(const _ of e.nodes)_.type&&!g.includes(_.type)&&(b[_.type]=_.type);return b}),s=n.computed(()=>e.onlyRenderVisibleElements?ed(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 g of e.edges){const _=t.value.get(g.source),C=t.value.get(g.target);Lb({sourcePos:_.computedPosition||{x:0,y:0},targetPos:C.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:C.dimensions.width,targetHeight:C.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(g)}return b}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const b=[];for(const g of e.nodes)g.selected&&b.push(g);return b}),f=n.computed(()=>{const b=[];for(const g of e.edges)g.selected&&b.push(g);return b}),m=n.computed(()=>[...u.value,...f.value]),p=n.computed(()=>{const b=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&b.push(g);return b}),y=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:m,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:y}}class fn{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)??fn.instance;return fn.instance=i??new fn,o&&(o.config.globalProperties.$vueFlowStorage=fn.instance),fn.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=Cd(),a=n.reactive(i),l={};for(const[m,p]of Object.entries(a.hooks)){const y=`on${m.charAt(0).toUpperCase()+m.slice(1)}`;l[y]=p.on}const r={};for(const[m,p]of Object.entries(a.hooks))r[m]=p.trigger;const s=n.computed(()=>{const m=new Map;for(const p of a.nodes)m.set(p.id,p);return m}),c=n.computed(()=>{const m=new Map;for(const p of a.edges)m.set(p.id,p);return m}),d=O0(a,s,c),u=m0(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...Mp(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 Pe(e){const t=fn.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(Ed,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,m,p)=>{const y=g=>{d.applyNodeChanges(g)},b=g=>{d.applyEdgeChanges(g)};f?(d.onNodesChange(y),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),io(()=>{if(s){const f=t.get(s.id);f?f.$destroy():No(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(Ed,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Je(qe.USEVUEFLOW_OPTIONS))}return s}function L0(e){const{emits:t,dimensions:o}=Pe();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=Bi(e.value);(s.width===0||s.height===0)&&t.error(new Je(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 P0={name:"UserSelection",compatConfig:{MODE:3}},z0=n.defineComponent({...P0,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))}}),U0=["tabIndex"],F0={name:"NodesSelection",compatConfig:{MODE:3}},H0=n.defineComponent({...F0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Pe(),s=Sd(),c=n.ref(null),d=Id({el:c,onStart(y){t.selectionDragStart(y),t.nodeDragStart(y)},onDrag(y){t.selectionDrag(y),t.nodeDrag(y)},onStop(y){t.selectionDragStop(y),t.nodeDragStop(y)}});n.onMounted(()=>{var y;l.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=n.computed(()=>ml(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 m(y){t.selectionContextMenu({event:y,nodes:i.value})}function p(y){l.value||Bn[y.key]&&(y.preventDefault(),s({x:Bn[y.key].x,y:Bn[y.key].y},y.shiftKey))}return(y,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:m,onKeydown:p},null,46,U0)],6)):n.createCommentVNode("",!0)}});function G0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Y0={name:"Pane",compatConfig:{MODE:3}},W0=n.defineComponent({...Y0,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:m,removeEdges:p,selectionMode:y,deleteKeyCode:b,multiSelectionKeyCode:g,multiSelectionActive:_,edgeLookup:C,nodeLookup:h,connectionLookup:E,defaultEdgeOptions:Z,connectionStartHandle:L,panOnDrag:G}=Pe(),T=n.shallowRef(null),S=n.shallowRef(new Set),O=n.shallowRef(new Set),te=n.shallowRef(null),M=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>L.value!==null);let w=!1,j=!1;const A=bo(b,{actInsideInputWithModifier:!1}),W=bo(g);n.watch(A,de=>{de&&(m(f.value),p(u.value),d.value=!1)}),n.watch(W,de=>{_.value=de});function Q(de,me){return ye=>{ye.target===me&&(de==null||de(ye))}}function ee(de){if(w||oe.value){w=!1;return}a.paneClick(de),r(),d.value=!1}function x(de){var me;if(Array.isArray(G.value)&&((me=G.value)!=null&&me.includes(2))){de.preventDefault();return}a.paneContextMenu(de)}function X(de){a.paneScroll(de)}function le(de){var me,ye,ve;if(te.value=((me=t.value)==null?void 0:me.getBoundingClientRect())??null,!c.value||!e.isSelecting||de.button!==0||de.target!==T.value||!te.value)return;(ve=(ye=de.target)==null?void 0:ye.setPointerCapture)==null||ve.call(ye,de.pointerId);const{x:Ce,y:xe}=G0(de,te.value);j=!0,w=!1,r(),s.value={width:0,height:0,startX:Ce,startY:xe,x:Ce,y:xe},a.selectionStart(de)}function pe(de){var me;if(!te.value||!s.value)return;w=!0;const{x:ye,y:ve}=It(de,te.value),{startX:Ce=0,startY:xe=0}=s.value,ge={startX:Ce,startY:xe,x:ye<Ce?ye:Ce,y:ve<xe?ve:xe,width:Math.abs(ye-Ce),height:Math.abs(ve-xe)},J=S.value,q=O.value;S.value=new Set(ed(o.value,ge,i.value,y.value===dl.Partial,!0).map(V=>V.id)),O.value=new Set;const v=((me=Z.value)==null?void 0:me.selectable)??!0;for(const V of S.value){const Y=E.value.get(V);if(Y)for(const{edgeId:D}of Y.values()){const K=C.value.get(D);K&&(K.selectable??v)&&O.value.add(D)}}if(!kd(J,S.value)){const V=Wt(h.value,S.value,!0);a.nodesChange(V)}if(!kd(q,O.value)){const V=Wt(C.value,O.value);a.edgesChange(V)}s.value=ge,l.value=!0,d.value=!1}function be(de){var me;de.button!==0||!j||((me=de.target)==null||me.releasePointerCapture(de.pointerId),!l.value&&s.value&&de.target===T.value&&ee(de),l.value=!1,s.value=null,d.value=S.value.size>0,a.selectionEnd(de),e.selectionKeyPressed&&(w=!1),j=!1)}return(de,me)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:T,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:de.isSelecting}]),onClick:me[0]||(me[0]=ye=>M.value?void 0:Q(ee,T.value)(ye)),onContextmenu:me[1]||(me[1]=ye=>Q(x,T.value)(ye)),onWheelPassive:me[2]||(me[2]=ye=>Q(X,T.value)(ye)),onPointerenter:me[3]||(me[3]=ye=>M.value?void 0:n.unref(a).paneMouseEnter(ye)),onPointerdown:me[4]||(me[4]=ye=>M.value?le(ye):n.unref(a).paneMouseMove(ye)),onPointermove:me[5]||(me[5]=ye=>M.value?pe(ye):n.unref(a).paneMouseMove(ye)),onPointerup:me[6]||(me[6]=ye=>M.value?be(ye):void 0),onPointerleave:me[7]||(me[7]=ye=>n.unref(a).paneMouseLeave(ye))},[n.renderSlot(de.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(z0,{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(H0,{key:1})):n.createCommentVNode("",!0)],34))}}),K0={name:"Transform",compatConfig:{MODE:3}},q0=n.defineComponent({...K0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Pe(),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))}}),X0={name:"Viewport",compatConfig:{MODE:3}},j0=n.defineComponent({...X0,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:m,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:b,noWheelClassName:g,noPanClassName:_,emits:C,connectionStartHandle:h,userSelectionActive:E,paneDragging:Z,d3Zoom:L,d3Selection:G,d3ZoomHandler:T,viewport:S,viewportRef:O,paneClickDistance:te}=Pe();L0(O);const M=n.shallowRef(!1),oe=n.shallowRef(!1);let w=null,j=!1,A=0,W={x:0,y:0,zoom:0};const Q=bo(s),ee=bo(r),x=bo(l),X=n.toRef(()=>(!ee.value||ee.value&&r.value===!0)&&(Q.value||f.value)),le=n.toRef(()=>Q.value||c.value),pe=n.toRef(()=>r.value===!0&&X.value!==!0),be=n.toRef(()=>ee.value&&r.value!==!0||E.value||pe.value),de=n.toRef(()=>h.value!==null);n.onMounted(()=>{if(!O.value){No("Viewport element is missing");return}const xe=O.value,ge=xe.getBoundingClientRect(),J=bb().clickDistance(te.value).scaleExtent([t.value,o.value]).translateExtent(a.value),q=pt(xe).call(J),v=q.on("wheel.zoom"),V=Mn.translate(i.value.x??0,i.value.y??0).scale(sn(i.value.zoom??1,t.value,o.value)),Y=[[0,0],[ge.width,ge.height]],D=J.constrain()(V,Y,a.value);J.transform(q,D),J.wheelDelta(pl),L.value=J,G.value=q,T.value=v,S.value={x:D.x,y:D.y,zoom:D.k},J.on("start",K=>{var he;if(!K.sourceEvent)return null;A=K.sourceEvent.button,M.value=!0;const Ee=ve(K.transform);((he=K.sourceEvent)==null?void 0:he.type)==="mousedown"&&(Z.value=!0),W=Ee,C.viewportChangeStart(Ee),C.moveStart({event:K,flowTransform:Ee})}),J.on("end",K=>{if(!K.sourceEvent)return null;if(M.value=!1,Z.value=!1,me(X.value,A??0)&&!j&&C.paneContextMenu(K.sourceEvent),j=!1,ye(W,K.transform)){const he=ve(K.transform);W=he,C.viewportChangeEnd(he),C.moveEnd({event:K,flowTransform:he})}}),J.filter(K=>{var he;const Ee=x.value||y.value,Ie=p.value&&K.ctrlKey,we=K.button,Re=K.type==="wheel";if(we===1&&K.type==="mousedown"&&(Ce(K,"vue-flow__node")||Ce(K,"vue-flow__edge")))return!0;if(!X.value&&!Ee&&!le.value&&!m.value&&!p.value||E.value||de.value&&!Re||!m.value&&K.type==="dblclick"||Ce(K,g.value)&&Re||Ce(K,_.value)&&(!Re||le.value&&Re&&!x.value)||!p.value&&K.ctrlKey&&Re||!Ee&&!le.value&&!Ie&&Re)return!1;if(!p&&K.type==="touchstart"&&((he=K.touches)==null?void 0:he.length)>1)return K.preventDefault(),!1;if(!X.value&&(K.type==="mousedown"||K.type==="touchstart")||pe.value&&Array.isArray(f.value)&&f.value.includes(0)&&we===0||Array.isArray(f.value)&&!f.value.includes(we)&&(K.type==="mousedown"||K.type==="touchstart"))return!1;const Ae=Array.isArray(f.value)&&f.value.includes(we)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!we||we<=1;return(!K.ctrlKey||Q.value||Re)&&Ae}),n.watch([E,X],()=>{E.value&&!M.value?J.on("zoom",null):E.value||J.on("zoom",K=>{S.value={x:K.transform.x,y:K.transform.y,zoom:K.transform.k};const he=ve(K.transform);j=me(X.value,A??0),C.viewportChange(he),C.move({event:K,flowTransform:he})})},{immediate:!0}),n.watch([E,le,d,x,p,b,g],()=>{le.value&&!x.value&&!E.value?q.on("wheel.zoom",K=>{if(Ce(K,g.value))return!1;const he=x.value||y.value,Ee=p.value&&K.ctrlKey;if(!(!b.value||le.value||he||Ee))return!1;K.preventDefault(),K.stopImmediatePropagation();const we=q.property("__zoom").k||1,Re=vo();if(!Q.value&&K.ctrlKey&&p.value&&Re){const B=kt(K),re=pl(K),ue=we*2**re;J.scaleTo(q,ue,B,K);return}const Ae=K.deltaMode===1?20:1;let De=d.value===go.Vertical?0:K.deltaX*Ae,We=d.value===go.Horizontal?0:K.deltaY*Ae;!Re&&K.shiftKey&&d.value!==go.Vertical&&!De&&We&&(De=We,We=0),J.translateBy(q,-(De/we)*u.value,-(We/we)*u.value);const I=ve(q.property("__zoom"));w&&clearTimeout(w),oe.value?(C.move({event:K,flowTransform:I}),C.viewportChange(I),w=setTimeout(()=>{C.moveEnd({event:K,flowTransform:I}),C.viewportChangeEnd(I),oe.value=!1},150)):(oe.value=!0,C.moveStart({event:K,flowTransform:I}),C.viewportChangeStart(I))},{passive:!1}):typeof v<"u"&&q.on("wheel.zoom",function(K,he){const Ee=!b.value&&K.type==="wheel"&&!K.ctrlKey,Ie=x.value||y.value,we=p.value&&K.ctrlKey;if(!Ie&&!c.value&&!we&&K.type==="wheel"||Ee||Ce(K,g.value))return null;K.preventDefault(),v.call(this,K,he)},{passive:!1})},{immediate:!0})});function me(xe,ge){return ge===2&&Array.isArray(xe)&&xe.includes(2)}function ye(xe,ge){return xe.x!==ge.x&&!Number.isNaN(ge.x)||xe.y!==ge.y&&!Number.isNaN(ge.y)||xe.zoom!==ge.k&&!Number.isNaN(ge.k)}function ve(xe){return{x:xe.x,y:xe.y,zoom:xe.k}}function Ce(xe,ge){return xe.target.closest(`.${ge}`)}return(xe,ge)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:O,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(W0,{"is-selecting":be.value,"selection-key-pressed":n.unref(ee),class:n.normalizeClass({connecting:de.value,dragging:n.unref(Z),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(q0,null,{default:n.withCtx(()=>[n.renderSlot(xe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Z0=["id"],J0=["id"],Q0=["id"],e1={name:"A11yDescriptions",compatConfig:{MODE:3}},t1=n.defineComponent({...e1,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Pe();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Gc)}-${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,Z0),n.createElementVNode("div",{id:`${n.unref(Yc)}-${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,J0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(Nb)}-${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,Q0))],64))}});function n1(){const e=Pe();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function o1(e,t,o){return o===Se.Left?e-t:o===Se.Right?e+t:e}function i1(e,t,o){return o===Se.Top?e-t:o===Se.Bottom?e+t:e}const $l=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:o1(t,e,i),cy:i1(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};$l.props=["radius","centerX","centerY","position","type"],$l.compatConfig={MODE:3};const Pd=$l,a1=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:m,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:b,edgesUpdatable:g,edgesFocusable:_,hooks:C}=Pe(),h=n.computed(()=>u(e.id)),{emit:E,on:Z}=e0(h.value,l),L=n.inject(Pi),G=n.getCurrentInstance(),T=n.ref(!1),S=n.ref(!1),O=n.ref(""),te=n.ref(null),M=n.ref("source"),oe=n.ref(null),w=n.toRef(()=>typeof h.value.selectable>"u"?b.value:h.value.selectable),j=n.toRef(()=>typeof h.value.updatable>"u"?g.value:h.value.updatable),A=n.toRef(()=>typeof h.value.focusable>"u"?_.value:h.value.focusable);n.provide(Zb,e.id),n.provide(Jb,oe);const W=n.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),Q=n.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),ee=n.computed(()=>{const V=h.value.type||"default",Y=L==null?void 0:L[`edge-${V}`];if(Y)return Y;let D=h.value.template??c.value[V];if(typeof D=="string"&&G){const K=Object.keys(G.appContext.components);K&&K.includes(V)&&(D=n.resolveComponent(V,!1))}return D&&typeof D!="string"?D:(l.error(new Je(qe.EDGE_TYPE_MISSING,D)),!1)}),{handlePointerDown:x}=$d({nodeId:O,handleId:te,type:M,isValidConnection:m,edgeUpdaterType:M,onEdgeUpdate:pe,onEdgeUpdateEnd:be});return()=>{const V=f(h.value.source),Y=f(h.value.target),D="pathOptions"in h.value?h.value.pathOptions:{};if(!V&&!Y)return l.error(new Je(qe.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!V)return l.error(new Je(qe.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!Y)return l.error(new Je(qe.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||V.hidden||Y.hidden)return null;let K;i.value===Dt.Strict?K=V.handleBounds.source:K=[...V.handleBounds.source||[],...V.handleBounds.target||[]];const he=fd(K,h.value.sourceHandle);let Ee;i.value===Dt.Strict?Ee=Y.handleBounds.target:Ee=[...Y.handleBounds.target||[],...Y.handleBounds.source||[]];const Ie=fd(Ee,h.value.targetHandle),we=(he==null?void 0:he.position)||Se.Bottom,Re=(Ie==null?void 0:Ie.position)||Se.Top,{x:Ae,y:De}=On(V,he,we),{x:We,y:I}=On(Y,Ie,Re);return h.value.sourceX=Ae,h.value.sourceY=De,h.value.targetX=We,h.value.targetY=I,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ee.value===!1?"default":h.value.type||"default"}`,s.value,W.value,{updating:T.value,selected:h.value.selected,animated:h.value.animated,inactive:!w.value&&!C.value.edgeClick.hasListeners()}],tabIndex:A.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":A.value?`${Yc}-${t}`:void 0,"aria-roledescription":"edge",role:A.value?"group":"img",...h.value.domAttributes,onClick:me,onContextmenu:ye,onDblclick:ve,onMouseenter:Ce,onMousemove:xe,onMouseleave:ge,onKeyDown:A.value?v:void 0},[S.value?null:n.h(ee.value===!1?c.value.default:ee.value,{id:e.id,sourceNode:V,targetNode:Y,source:h.value.source,target:h.value.target,type:h.value.type,updatable:j.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...Z},style:Q.value,markerStart:`url('#${Eo(h.value.markerStart,t)}')`,markerEnd:`url('#${Eo(h.value.markerEnd,t)}')`,sourcePosition:we,targetPosition:Re,sourceX:Ae,sourceY:De,targetX:We,targetY:I,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...D}),[j.value==="source"||j.value===!0?[n.h("g",{onMousedown:J,onMouseenter:X,onMouseout:le},n.h(Pd,{position:we,centerX:Ae,centerY:De,radius:a.value,type:"source","data-type":"source"}))]:null,j.value==="target"||j.value===!0?[n.h("g",{onMousedown:q,onMouseenter:X,onMouseout:le},n.h(Pd,{position:Re,centerX:We,centerY:I,radius:a.value,type:"target","data-type":"target"}))]:null]])};function X(){T.value=!0}function le(){T.value=!1}function pe(V,Y){E.update({event:V,edge:h.value,connection:Y})}function be(V){E.updateEnd({event:V,edge:h.value}),S.value=!1}function de(V,Y){V.button===0&&(S.value=!0,O.value=Y?h.value.target:h.value.source,te.value=(Y?h.value.targetHandle:h.value.sourceHandle)??null,M.value=Y?"target":"source",E.updateStart({event:V,edge:h.value}),x(V))}function me(V){var Y;const D={event:V,edge:h.value};w.value&&(r.value=!1,h.value.selected&&p.value?(d([h.value]),(Y=oe.value)==null||Y.blur()):o([h.value])),E.click(D)}function ye(V){E.contextMenu({event:V,edge:h.value})}function ve(V){E.doubleClick({event:V,edge:h.value})}function Ce(V){E.mouseEnter({event:V,edge:h.value})}function xe(V){E.mouseMove({event:V,edge:h.value})}function ge(V){E.mouseLeave({event:V,edge:h.value})}function J(V){de(V,!0)}function q(V){de(V,!1)}function v(V){var Y;!y.value&&Wc.includes(V.key)&&w.value&&(V.key==="Escape"?((Y=oe.value)==null||Y.blur(),d([u(e.id)])):o([u(e.id)]))}}}),l1=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}=Pe(),m=(e=n.inject(Pi))==null?void 0:e["connection-line"],p=n.computed(()=>{var C;return f((C=i.value)==null?void 0:C.nodeId)}),y=n.computed(()=>{var C;return f((C=a.value)==null?void 0:C.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})),g=n.computed(()=>c.value.markerStart?`url(#${Eo(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${Eo(c.value.markerEnd,t)})`:"");return()=>{var C,h,E;if(!p.value||!i.value)return null;const Z=i.value.id,L=i.value.type,G=p.value.handleBounds;let T=(G==null?void 0:G[L])??[];if(o.value===Dt.Loose){const Q=(G==null?void 0:G[L==="source"?"target":"source"])??[];T=[...T,...Q]}if(!T)return null;const S=(Z?T.find(Q=>Q.id===Z):T[0])??null,O=(S==null?void 0:S.position)??Se.Top,{x:te,y:M}=On(p.value,S,O);let oe=null;y.value&&(o.value===Dt.Strict?oe=((C=y.value.handleBounds[L==="source"?"target":"source"])==null?void 0:C.find(Q=>{var ee;return Q.id===((ee=a.value)==null?void 0:ee.id)}))||null:oe=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(Q=>{var ee;return Q.id===((ee=a.value)==null?void 0:ee.id)}))||null);const w=((E=a.value)==null?void 0:E.position)??(O?wl[O]:null);if(!O||!w)return null;const j=r.value??c.value.type??rn.Bezier;let A="";const W={sourceX:te,sourceY:M,sourcePosition:O,targetX:b.value.x,targetY:b.value.y,targetPosition:w};return j===rn.Bezier?[A]=Td(W):j===rn.Step?[A]=Il({...W,borderRadius:0}):j===rn.SmoothStep?[A]=Il(W):j===rn.SimpleBezier?[A]=Bd(W):A=`M${te},${M} ${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"},m?n.h(m,{sourceX:te,sourceY:M,sourcePosition:O,targetX:b.value.x,targetY:b.value.y,targetPosition:w,sourceNode:p.value,sourceHandle:S,targetNode:y.value,targetHandle:oe,markerEnd:_.value,markerStart:g.value,connectionStatus:d.value}):n.h("path",{d:A,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":g.value})))}}}),r1=["id","markerWidth","markerHeight","markerUnits","orient"],s1={name:"MarkerType",compatConfig:{MODE:3}},c1=n.defineComponent({...s1,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(ul).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(ul).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,r1))}}),d1={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},u1={name:"MarkerDefinitions",compatConfig:{MODE:3}},f1=n.defineComponent({...u1,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Pe(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=Eo(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",d1,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(c1,{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))])]))}}),m1={name:"Edges",compatConfig:{MODE:3}},p1=n.defineComponent({...m1,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Pe();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(f1),(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(Pb)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(a1),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(l1))],64))}}),h1=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:m,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:b,snapToGrid:g,snapGrid:_,nodeDragThreshold:C,nodesDraggable:h,elementsSelectable:E,nodesConnectable:Z,nodesFocusable:L,hooks:G}=Pe(),T=n.ref(null);n.provide(Nd,T),n.provide(vd,e.id);const S=n.inject(Pi),O=n.getCurrentInstance(),te=Sd(),{node:M,parentNode:oe}=xd(e.id),{emit:w,on:j}=i0(M,r),A=n.toRef(()=>typeof M.draggable>"u"?h.value:M.draggable),W=n.toRef(()=>typeof M.selectable>"u"?E.value:M.selectable),Q=n.toRef(()=>typeof M.connectable>"u"?Z.value:M.connectable),ee=n.toRef(()=>typeof M.focusable>"u"?L.value:M.focusable),x=n.computed(()=>W.value||A.value||G.value.nodeClick.hasListeners()||G.value.nodeDoubleClick.hasListeners()||G.value.nodeMouseEnter.hasListeners()||G.value.nodeMouseMove.hasListeners()||G.value.nodeMouseLeave.hasListeners()),X=n.toRef(()=>!!M.dimensions.width&&!!M.dimensions.height),le=n.computed(()=>{const Y=M.type||"default",D=S==null?void 0:S[`node-${Y}`];if(D)return D;let K=M.template||f.value[Y];if(typeof K=="string"&&O){const he=Object.keys(O.appContext.components);he&&he.includes(Y)&&(K=n.resolveComponent(Y,!1))}return K&&typeof K!="string"?K:(r.error(new Je(qe.NODE_TYPE_MISSING,K)),!1)}),pe=Id({id:e.id,el:T,disabled:()=>!A.value,selectable:W,dragHandle:()=>M.dragHandle,onStart(Y){w.dragStart(Y)},onDrag(Y){w.drag(Y)},onStop(Y){w.dragStop(Y)},onClick(Y){v(Y)}}),be=n.computed(()=>M.class instanceof Function?M.class(M):M.class),de=n.computed(()=>{const Y=(M.style instanceof Function?M.style(M):M.style)||{},D=M.width instanceof Function?M.width(M):M.width,K=M.height instanceof Function?M.height(M):M.height;return!Y.width&&D&&(Y.width=typeof D=="string"?D:`${D}px`),!Y.height&&K&&(Y.height=typeof K=="string"?K:`${K}px`),Y}),me=n.toRef(()=>Number(M.zIndex??de.value.zIndex??0));return u(Y=>{(Y.includes(e.id)||!Y.length)&&ve()}),n.onMounted(()=>{n.watch(()=>M.hidden,(Y=!1,D,K)=>{!Y&&T.value&&(e.resizeObserver.observe(T.value),K(()=>{T.value&&e.resizeObserver.unobserve(T.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>M.type,()=>M.sourcePosition,()=>M.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])})}),n.watch([()=>M.position.x,()=>M.position.y,()=>{var Y;return(Y=oe.value)==null?void 0:Y.computedPosition.x},()=>{var Y;return(Y=oe.value)==null?void 0:Y.computedPosition.y},()=>{var Y;return(Y=oe.value)==null?void 0:Y.computedPosition.z},me,()=>M.selected,()=>M.dimensions.height,()=>M.dimensions.width,()=>{var Y;return(Y=oe.value)==null?void 0:Y.dimensions.height},()=>{var Y;return(Y=oe.value)==null?void 0:Y.dimensions.width}],([Y,D,K,he,Ee,Ie])=>{const we={x:Y,y:D,z:Ie+(p.value&&M.selected?1e3:0)};typeof K<"u"&&typeof he<"u"?M.computedPosition=Tb({x:K,y:he,z:Ee},we):M.computedPosition=we},{flush:"post",immediate:!0}),n.watch([()=>M.extent,m],([Y,D],[K,he])=>{(Y!==K||D!==he)&&ye()}),M.extent==="parent"||typeof M.extent=="object"&&"range"in M.extent&&M.extent.range==="parent"?Ha(()=>X).toBe(!0).then(ye):ye(),()=>M.hidden?null:n.h("div",{ref:T,"data-id":M.id,class:["vue-flow__node",`vue-flow__node-${le.value===!1?"default":M.type||"default"}`,{[o.value]:A.value,dragging:pe==null?void 0:pe.value,draggable:A.value,selected:M.selected,selectable:W.value,parent:M.isParent},be.value],style:{visibility:X.value?"visible":"hidden",zIndex:M.computedPosition.z??me.value,transform:`translate(${M.computedPosition.x}px,${M.computedPosition.y}px)`,pointerEvents:x.value?"all":"none",...de.value},tabIndex:ee.value?0:void 0,role:ee.value?"group":void 0,"aria-describedby":y.value?void 0:`${Gc}-${t}`,"aria-label":M.ariaLabel,"aria-roledescription":"node",...M.domAttributes,onMouseenter:Ce,onMousemove:xe,onMouseleave:ge,onContextmenu:J,onClick:v,onDblclick:q,onKeydown:V},[n.h(le.value===!1?f.value.default:le.value,{id:M.id,type:M.type,data:M.data,events:{...M.events,...j},selected:M.selected,resizing:M.resizing,dragging:pe.value,connectable:Q.value,position:M.computedPosition,dimensions:M.dimensions,isValidTargetPos:M.isValidTargetPos,isValidSourcePos:M.isValidSourcePos,parent:M.parentNode,parentNodeId:M.parentNode,zIndex:M.computedPosition.z??me.value,targetPosition:M.targetPosition,sourcePosition:M.sourcePosition,label:M.label,dragHandle:M.dragHandle,onUpdateNodeInternals:ve})]);function ye(){const Y=M.computedPosition,{computedPosition:D,position:K}=gl(M,g.value?Li(Y,_.value):Y,r.error,m.value,oe.value);(M.computedPosition.x!==D.x||M.computedPosition.y!==D.y)&&(M.computedPosition={...M.computedPosition,...D}),(M.position.x!==K.x||M.position.y!==K.y)&&(M.position=K)}function ve(){T.value&&d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])}function Ce(Y){pe!=null&&pe.value||w.mouseEnter({event:Y,node:M})}function xe(Y){pe!=null&&pe.value||w.mouseMove({event:Y,node:M})}function ge(Y){pe!=null&&pe.value||w.mouseLeave({event:Y,node:M})}function J(Y){return w.contextMenu({event:Y,node:M})}function q(Y){return w.doubleClick({event:Y,node:M})}function v(Y){W.value&&(!i.value||!A.value||C.value>0)&&kl(M,l.value,c,s,a,!1,T.value),w.click({event:Y,node:M})}function V(Y){if(!(fl(Y)||y.value))if(Wc.includes(Y.key)&&W.value){const D=Y.key==="Escape";kl(M,l.value,c,s,a,D,T.value)}else A.value&&M.selected&&Bn[Y.key]&&(Y.preventDefault(),b.value=`Moved selected node ${Y.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.position.x}, y: ${~~M.position.y}`,te({x:Bn[Y.key].x,y:Bn[Y.key].y},Y.shiftKey))}}});function y1(e={includeHiddenNodes:!1}){const{nodes:t}=Pe();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 g1={class:"vue-flow__nodes vue-flow__container"},b1={name:"Nodes",compatConfig:{MODE:3}},_1=n.defineComponent({...b1,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Pe(),a=y1(),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",g1,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const m=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,m))return f;const p=(n.openBlock(),n.createBlock(n.unref(h1),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return p.memo=m,p},s,0),128)):n.createCommentVNode("",!0)]))}});function w1(){const{emits:e}=Pe();n.onMounted(()=>{if(gd()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Je(qe.MISSING_STYLES))}})}const k1=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),E1={name:"VueFlow",compatConfig:{MODE:3}},v1=n.defineComponent({...E1,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=Ga(i,"modelValue",o),r=Ga(i,"nodes",o),s=Ga(i,"edges",o),c=Pe(i),d=s0({modelValue:l,nodes:r,edges:s},i,c);return d0(o,c.hooks),n1(),w1(),n.provide(Pi,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(j0,null,{default:n.withCtx(()=>[n.createVNode(p1),k1,n.createVNode(_1),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(t1)],512))}}),N1={name:"Panel",compatConfig:{MODE:3}},zd=n.defineComponent({...N1,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Pe(),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))}}),mn=["red","amber","green","teal","blue","indigo","violet","pink"],Ud={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function I1(e){return typeof e=="string"&&e in Ud}const $1={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},x1=.15;function S1(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 C1(e){if(typeof e!="string")return null;const t=S1(e);if(!t||t.s<x1)return null;let o=null,i=1/0;for(const a of mn){const l=Math.abs(t.h-$1[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function it(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(I1(t))return t;const o=e==null?void 0:e.properties;return C1((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function xl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const R1={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)"},V1={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 Fd(e,t=!1){return e?t?V1[e]:R1[e]:null}function Ln(e){return Ud[e]}function Pn(e){return`var(--em-swatch-${e}-bar)`}const A1=["width","height","innerHTML"],T1=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,A1))}}),ze=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=ze(T1,[["__scopeId","data-v-92c1dba8"]]),M1={class:"em-inline-issue__msgs"},pn=ze(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",M1,[(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"]]),B1={class:"em-mlang"},D1={class:"em-mlang__tabs",role:"tablist"},O1=["aria-selected","onClick"],L1={key:0,class:"em-mlang__dot"},Sl=ze(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",B1,[n.createElementVNode("div",D1,[(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:m=>l.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",L1,"•")):n.createCommentVNode("",!0)],10,O1))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ae.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(ae.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"]]),P1=["disabled"],z1={class:"em-panel__sub-label"},U1={class:"em-field"},F1={class:"em-field"},H1={class:"em-field"},G1={class:"em-class"},Y1={class:"em-field"},W1={class:"em-field"},K1={class:"em-field"},q1={class:"em-field"},X1={class:"em-multilang"},j1={class:"em-multilang"},Z1={class:"em-jpa"},J1={class:"em-field"},Q1={class:"em-field"},e_={class:"em-field"},t_={class:"em-swatch"},n_={class:"em-swatch__row"},o_=["title","onClick"],Hd=ze(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(M=>M.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(M=>M.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var M;return it(((M=r.value)==null?void 0:M.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=M=>M;function m(M){return M==="inherit"?"기본(따름)":M}function p(M){l.value&&a.updateEntity(l.value.modelId,M)}function y(M,oe,w){var A;const j=((A=l.value)==null?void 0:A.table)??{physicalName:""};p(M==="physicalName"?{table:{...j,physicalName:w}}:{table:{...j,logicalName:{...j.logicalName,[oe]:w}}})}function b(M){p({description:Object.keys(M).length?M:void 0})}function g(M,oe){var w;p({jpaAttrs:{...(w=l.value)==null?void 0:w.jpaAttrs,[M]:oe}})}function _(M,oe){g(M,oe)}const C=n.computed(()=>{var M,oe;return((oe=(M=l.value)==null?void 0:M.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),h=n.computed(()=>{var M,oe;return!((oe=(M=l.value)==null?void 0:M.jpaAttrs)!=null&&oe.useDiscriminator)});function E(M){g("discriminatorType",M==="inherit"?void 0:M)}function Z(M){p({hasPersonalInfo:M})}function L(M){p({superClass:M.trim()||void 0})}function G(M){p({schema:M.trim()||void 0})}function T(M){p({abstractClass:M})}const S=n.computed(()=>{var M,oe;return((oe=(M=l.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function O(M){const oe=M.split(",").map(w=>w.trim()).filter(Boolean);p({declarationOfInterfaces:oe.length?oe:void 0})}function te(M){l.value&&a.setEntitySwatch(l.value.modelId,M)}return(M,oe)=>{var w,j,A;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]=W=>i("toggle"))},[n.createElementVNode("span",z1,[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(pn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",U1,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=W=>p({name:W}))},null,8,["model-value"])]),n.createElementVNode("label",F1,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=W=>p({stereotype:W}))},null,8,["model-value"])]),n.createElementVNode("label",H1,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=W=>p({packageName:W}))},null,8,["model-value"])]),n.createElementVNode("fieldset",G1,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",Y1,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=W=>L(W))},null,8,["model-value"])]),n.createElementVNode("label",W1,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":S.value,"onUpdate:modelValue":oe[5]||(oe[5]=W=>O(W))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=W=>T(W))},null,8,["model-value"])]),n.createElementVNode("label",K1,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-table",width:"100%","model-value":((w=l.value.table)==null?void 0:w.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=W=>y("physicalName",null,W))},null,8,["model-value"])]),n.createElementVNode("label",q1,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=W=>G(W))},null,8,["model-value"])]),n.createElementVNode("fieldset",X1,[oe[21]||(oe[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,W=>{var Q,ee;return n.openBlock(),n.createElementBlock("label",{key:W,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(W),1),n.createVNode(n.unref(ae.BSTextInput),{name:`ent-logical-${W}`,width:"100%","model-value":((ee=(Q=l.value.table)==null?void 0:Q.logicalName)==null?void 0:ee[W])??"","onUpdate:modelValue":x=>y("logicalName",W,x)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",j1,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Sl,{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",Z1,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,W=>{var Q;return n.createVNode(n.unref(ae.BSCheckbox),{key:W.key,name:`jpa-${W.key}`,class:"em-check",label:W.label,"model-value":!!((Q=l.value.jpaAttrs)!=null&&Q[W.key]),"onUpdate:modelValue":ee=>_(W.key,ee)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",J1,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:h.value,"model-value":((j=l.value.jpaAttrs)==null?void 0:j.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=W=>g("discriminatorColumnName",W.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",Q1,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ae.BSSelect),{disabled:h.value,"model-value":C.value,items:u,"value-provider":f,"label-provider":m,"onUpdate:modelValue":oe[10]||(oe[10]=W=>W&&E(W))},null,8,["disabled","model-value"])]),n.createElementVNode("label",e_,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:h.value,"model-value":(A=l.value.jpaAttrs)==null?void 0:A.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=W=>g("discriminatorLength",W||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!l.value.hasPersonalInfo,"onUpdate:modelValue":Z},null,8,["model-value"]),n.createElementVNode("fieldset",t_,[oe[27]||(oe[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",n_,[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]=W=>te(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),W=>(n.openBlock(),n.createElementBlock("button",{key:W,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===W}]),style:n.normalizeStyle({background:n.unref(Pn)(W)}),title:n.unref(Ln)(W),onClick:Q=>te(W)},null,14,o_))),128))])])],64)):n.createCommentVNode("",!0)],8,P1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),Gd=["ko","en","ja","zh"];function i_(e){if(e)for(const t of Gd){const o=e[t];if(o)return o}}function Cl(e){const t=i_(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function a_(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Gd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const l_=["aria-expanded"],r_=["aria-selected","onClick","onMouseenter"],s_={key:0,class:"gcc__opt gcc__opt--empty"},Yd=ze(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(T=>T.groupCode===o.modelValue)),m=n.computed(()=>f.value?Cl(f.value):"");n.watch(m,T=>{c.value||(s.value=T)},{immediate:!0});const p=n.computed(()=>s.value===m.value?o.items:a_(o.items,s.value));function y(){var S;const T=(S=a.value)==null?void 0:S.getBoundingClientRect();T&&(u.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function b(){c.value=!0,y(),d.value=Math.max(0,p.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),document.addEventListener("mousedown",G)}function g(){c.value=!1,window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),document.removeEventListener("mousedown",G)}n.onBeforeUnmount(g);function _(){b(),n.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function C(){c.value||b(),d.value=0}function h(T){i("update:modelValue",T.groupCode),s.value=Cl(T),g()}function E(){i("update:modelValue",void 0),s.value="",g()}function Z(){s.value.trim()===""?E():(s.value=m.value,g())}function L(T){var S;if(T.key==="ArrowDown")c.value||b(),d.value=Math.min(d.value+1,p.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")d.value=Math.max(d.value-1,0),T.preventDefault();else if(T.key==="Enter"){const O=p.value[d.value];O&&h(O),T.preventDefault()}else T.key==="Escape"&&(s.value=m.value,g(),(S=l.value)==null||S.blur())}function G(T){var O,te;const S=T.target;!((O=a.value)!=null&&O.contains(S))&&!((te=r.value)!=null&&te.contains(S))&&Z()}return(T,S)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":S[0]||(S[0]=O=>s.value=O),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:C,onKeydown:L},null,40,l_),[[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:S[1]||(S[1]=n.withModifiers(()=>{},["prevent"])),onClick:E},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,(O,te)=>(n.openBlock(),n.createElementBlock("li",{key:O.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":te===d.value,"is-selected":O.groupCode===e.modelValue}]),role:"option","aria-selected":O.groupCode===e.modelValue,onMousedown:S[2]||(S[2]=n.withModifiers(()=>{},["prevent"])),onClick:M=>h(O),onMouseenter:M=>d.value=te},n.toDisplayString(n.unref(Cl)(O)),43,r_))),128)),p.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",s_,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),c_=["disabled"],d_={class:"em-aw__toolbar"},u_={class:"em-aw__count"},f_={class:"em-aw__scroll"},m_={class:"em-aw__table"},p_={class:"c-del"},h_={class:"c-expand"},y_=["title","onClick","onKeydown"],g_={class:"c-constraints"},b_={class:"em-aw__cflags"},__=["title"],w_={colspan:"8"},k_={class:"em-aw__detail"},E_={class:"em-aw__dgroup"},v_={class:"em-aw__df"},N_={class:"em-aw__df"},I_={class:"em-aw__df"},$_={class:"em-aw__dgroup"},x_={class:"em-aw__dgroup"},S_={class:"em-aw__df"},C_={key:0,class:"em-aw__df"},R_={class:"em-aw__df"},V_={class:"c-expand"},A_={class:"em-aw__caret is-static","aria-hidden":"true"},T_={class:"c-del"},M_={class:"c-expand"},B_=["title","onClick","onKeydown"],D_={class:"em-aw__embed-label"},O_={class:"em-aw__ro"},L_={class:"em-aw__ro"},P_={class:"c-constraints"},z_={class:"em-aw__ro"},U_={key:0,class:"em-aw__detail-row em-aw__embed-detail"},F_={colspan:"8"},H_={class:"em-aw__detail"},G_={class:"em-aw__dgroup"},Y_={key:0,class:"em-aw__df"},W_={class:"em-aw__df"},K_={class:"em-aw__df"},q_={key:0},X_=6,j_=5,Z_="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Ki="__OWN__",J_=ze(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(z=>z.modelId===t.entityId)??null),a=n.computed(()=>{var z;return((z=i.value)==null?void 0:z.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var z;return(((z=i.value)==null?void 0:z.attributes)??[]).filter(U=>U.attrType!=="DIVIDER").length}),s=n.ref(new Set);function c(z){return s.value.has(z)}function d(z){const U=new Set(s.value);U.has(z)?U.delete(z):U.add(z),s.value=U}const u=["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 f(z){return z==="none"?"(없음)":z}const m=z=>z;function p(z,U){i.value&&o.updateAttribute(i.value.modelId,z.modelId,U)}function y(z){return!!i.value&&!!di(o.state.logical,i.value.modelId,z.modelId)}function b(z,U){p(z,{naturalId:U||void 0,naturalIdMutable:U?z.naturalIdMutable:void 0})}function g(){return{naturalId:void 0,naturalIdMutable:void 0}}function _(z,U){p(z,{identifier:U,...U?g():{}})}function C(z,U){p(z,{transient:U||void 0,...U?g():{}})}function h(z){return!!z.transient}const E=z=>z.value,Z=z=>z.label;function L(z,U){if(!U)return;const k=oe.value.find(F=>F.type===U);if(k){const F=z.dbAttrs[0]??{modelId:z.modelId+".c",physicalName:z.name,dataType:"VARCHAR"};p(z,{type:U,customType:void 0,dbAttrs:[{...F,dataType:k.dataType,length:k.length,scale:k.scale}]});return}p(z,U===Ct?{type:U}:{type:U,customType:void 0})}function G(z,U){p(z,{customType:U.trim()===""?void 0:U})}function T(z,U){const F={...z.dbAttrs[0]??{modelId:z.modelId+".c",physicalName:z.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!qo.has(F.dataType)&&(F.scale=void 0),p(z,{dbAttrs:[F]})}function S(z){var U;return qo.has(((U=z.dbAttrs[0])==null?void 0:U.dataType)??"")}function O(z,U,k){var F;T(z,{logicalName:{...(F=z.dbAttrs[0])==null?void 0:F.logicalName,[U]:k}})}function te(z){return z.personalInfoAttributeType??"none"}function M(z,U){p(z,{personalInfoAttributeType:U==="none"?void 0:U})}const oe=n.computed(()=>o.predefinedCustomTypeCatalog.value),w=n.computed(()=>o.embeddableCatalog.value);function j(z){var U,k;return((U=z.label)==null?void 0:U.ko)??((k=z.label)==null?void 0:k.en)??z.type}function A(z){!z||!i.value||o.addPredefinedEmbed(i.value.modelId,z)}const W=n.computed(()=>o.groupCodeCatalog.value);function Q(z){var U;return((U=W.value.find(k=>k.groupCode===z.groupCode))==null?void 0:U.codes)??[]}function ee(z){return["none",...Q(z)]}function x(z){return z==="none"?"none":z.code}function X(z){var k,F;if(z==="none")return"(없음)";const U=((k=z.label)==null?void 0:k.ko)??((F=z.label)==null?void 0:F.en);return U?`${z.code} (${U})`:z.code}function le(z,U){i.value&&o.setAttributeGroupCode(i.value.modelId,z.modelId,U)}function pe(z,U){p(z,{defaultValue:U==="none"?void 0:U})}function be(z,U){p(z,{defaultValue:U.trim()===""?void 0:U})}function de(z){return z.attrType.startsWith("EMBED")&&z.dbAttrs.length>0}function me(z,U,k){const F=z.dbAttrs.map((ne,ce)=>{if(ce!==U)return ne;const N={...ne,...k};for(const $ of Object.keys(k))k[$]===void 0&&delete N[$];return N});i.value&&o.setEmbedColumns(i.value.modelId,z.modelId,F)}function ye(z,U,k,F){var ne;me(z,U,{logicalName:{...(ne=z.dbAttrs[U])==null?void 0:ne.logicalName,[k]:F}})}function ve(z,U){var ne,ce,N;if(z.attrType==="EMBED_PREDEF"){const $=(ne=o.embeddableCatalog.value.find(ie=>ie.type===z.type))==null?void 0:ne.fields[U];return $?{name:$.name,physicalName:$.physicalName,dataType:$.dataType,length:$.length,shareable:$.shareable,logicalName:$.logicalName}:void 0}const k=(ce=z.embedded)==null?void 0:ce.embeddableRef;if(!k)return;const F=(N=o.state.logical.entities.find($=>$.modelId===k))==null?void 0:N.attributes.flatMap($=>$.dbAttrs)[U];return F?{physicalName:F.physicalName,dataType:F.dataType,length:F.length,scale:F.scale,logicalName:F.logicalName}:void 0}function Ce(z,U){var k,F;return((k=ve(z,U))==null?void 0:k.dataType)||((F=z.dbAttrs[U])==null?void 0:F.dataType)||""}function xe(z,U){var k,F;return((k=ve(z,U))==null?void 0:k.length)??((F=z.dbAttrs[U])==null?void 0:F.length)}function ge(z,U){var k,F;return((k=ve(z,U))==null?void 0:k.scale)??((F=z.dbAttrs[U])==null?void 0:F.scale)}const J=["inherit","true","false"];function q(z){return z==="inherit"?"기본(따름)":z}function v(z){return(z==null?void 0:z.updatable)===void 0?"inherit":z.updatable?"true":"false"}function V(z,U,k){me(z,U,{updatable:k==="inherit"?void 0:k==="true"})}function Y(z,U){T(z,{updatable:U==="inherit"?void 0:U==="true"})}const D=["inherit","true","false"];function K(z){return z==="inherit"?"기본(따름)":z}function he(z){return(z==null?void 0:z.insertable)===void 0?"inherit":z.insertable?"true":"false"}function Ee(z,U,k){me(z,U,{insertable:k==="inherit"?void 0:k==="true"})}function Ie(z,U){T(z,{insertable:U==="inherit"?void 0:U==="true"})}const we=n.computed(()=>i.value?Xo(i.value,o.state.logical.entities):[]),Re=n.computed(()=>Zn(we.value.flatMap(z=>z.attributes.flatMap(U=>U.dbAttrs)))),Ae=n.computed(()=>we.value.flatMap(z=>z.attributes.filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>{var k;return{modelId:U.dbAttrs[0].modelId,physical:U.dbAttrs[0].physicalName||U.name,isCurrency:U.type==="Currency",ownerName:z.modelId===((k=i.value)==null?void 0:k.modelId)?void 0:z.name}})));function De(){const z=[...Ae.value].sort((U,k)=>Number(k.isCurrency)-Number(U.isCurrency));return[Ki,...z.map(U=>U.modelId)]}function We(z){if(z===Ki)return"전용 컬럼(OWN)";const U=Ae.value.find(F=>F.modelId===z);return U?`↗ ${U.ownerName?`${U.ownerName}.`:""}${U.physical} (${U.isCurrency?"통화":"공유"})`:z}function I(z){return(z==null?void 0:z.sharedColumnRef)??Ki}function B(z,U,k){me(z,U,{sharedColumnRef:k===Ki?void 0:k})}function re(z){return(z==null?void 0:z.sharedColumnRef)!=null}function ue(z){var U;return((U=Zo(z,Re.value))==null?void 0:U.physicalName)??""}return(z,U)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",d_,[n.createElementVNode("span",u_,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:U[0]||(U[0]=k=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"구분선",onClick:U[1]||(U[1]=k=>n.unref(o).addDivider(i.value.modelId))}),w.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:w.value,"value-provider":k=>k.type,"label-provider":j,"onUpdate:modelValue":A},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",f_,[n.createElementVNode("table",m_,[U[21]||(U[21]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-expand"}),n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-type"},"타입"),n.createElementVNode("th",{class:"c-logical"},"논리명"),n.createElementVNode("th",{class:"c-col"},"컬럼(물리)"),n.createElementVNode("th",{class:"c-dtype"},"dataType"),n.createElementVNode("th",{class:"c-len"},"len"),n.createElementVNode("th",{class:"c-constraints"},"제약"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,k=>{var F,ne,ce,N,$,ie,R,H,P,se,Ne;return n.openBlock(),n.createElementBlock(n.Fragment,{key:k.modelId},[k.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(k.modelId)}])},[U[2]||(U[2]=n.createElementVNode("td",{class:"c-expand"},null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-divlabel-${k.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":k.name,"onUpdate:modelValue":fe=>p(k,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:X_,class:"em-aw__divider-note"},"── 시각 구획 ──"),n.createElementVNode("td",p_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,k.modelId)},null,8,["onClick"])])],2)):de(k)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(k.modelId)}])},[n.createElementVNode("td",V_,[n.createElementVNode("span",A_,[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${k.modelId}`,width:"100%",placeholder:"이름","model-value":k.name,"onUpdate:modelValue":fe=>p(k,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-type-${k.modelId}`,width:"100%",disabled:"","model-value":k.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:j_,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(k.dbAttrs.length)+"개",1),n.createElementVNode("td",T_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,k.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(k.dbAttrs,(fe,Me)=>{var Le,Ue,Qe,Ge,Ke,St,Zt;return n.openBlock(),n.createElementBlock(n.Fragment,{key:fe.modelId},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-col",{"em-aw__open":c(fe.modelId)}])},[n.createElementVNode("td",M_,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(fe.modelId)}]),role:"button",tabindex:"0",title:c(fe.modelId)?"오버라이드 접기":"오버라이드 펼치기",onClick:_e=>d(fe.modelId),onKeydown:[n.withKeys(n.withModifiers(_e=>d(fe.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(_e=>d(fe.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,B_)]),n.createElementVNode("td",D_,"↳ "+n.toDisplayString(((Le=ve(k,Me))==null?void 0:Le.name)??((Ue=ve(k,Me))==null?void 0:Ue.physicalName)??`컬럼 ${Me+1}`),1),U[13]||(U[13]=n.createElementVNode("td",null,null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-logical-${fe.modelId}`,width:"100%",placeholder:((Ge=(Qe=ve(k,Me))==null?void 0:Qe.logicalName)==null?void 0:Ge.ko)??"논리명","model-value":((Ke=fe.logicalName)==null?void 0:Ke.ko)??"","onUpdate:modelValue":_e=>ye(k,Me,"ko",_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-col-${fe.modelId}`,width:"100%",disabled:re(fe),placeholder:((St=ve(k,Me))==null?void 0:St.physicalName)??"컬럼","model-value":re(fe)?ue(fe):fe.physicalName,"onUpdate:modelValue":_e=>me(k,Me,{physicalName:_e})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(pn,{controller:n.unref(o),"ref-id":fe.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",O_,n.toDisplayString(Ce(k,Me)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",L_,n.toDisplayString(xe(k,Me)??""),1)]),n.createElementVNode("td",P_,[n.createElementVNode("span",z_,n.toDisplayString(ge(k,Me)!=null?`scale ${ge(k,Me)}`:""),1)]),U[14]||(U[14]=n.createElementVNode("td",null,null,-1))],2),c(fe.modelId)?(n.openBlock(),n.createElementBlock("tr",U_,[U[19]||(U[19]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",F_,[n.createElementVNode("div",H_,[n.createElementVNode("fieldset",G_,[U[18]||(U[18]=n.createElementVNode("legend",null,"컬럼 오버라이드",-1)),(Zt=ve(k,Me))!=null&&Zt.shareable?(n.openBlock(),n.createElementBlock("label",Y_,[U[15]||(U[15]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"150px","model-value":I(fe),items:De(),"value-provider":m,"label-provider":We,"onUpdate:modelValue":_e=>_e&&B(k,Me,_e)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",W_,[U[16]||(U[16]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:re(fe),"model-value":re(fe)?"false":he(fe),items:D,"value-provider":m,"label-provider":K,"onUpdate:modelValue":_e=>_e&&Ee(k,Me,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",K_,[U[17]||(U[17]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:re(fe),"model-value":re(fe)?"false":v(fe),items:J,"value-provider":m,"label-provider":q,"onUpdate:modelValue":_e=>_e&&V(k,Me,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])])])])])])):n.createCommentVNode("",!0)],64)}),128))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("tr",{class:n.normalizeClass({"is-focused":l.value.has(k.modelId),"em-aw__open":c(k.modelId)})},[n.createElementVNode("td",h_,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(k.modelId)}]),role:"button",tabindex:"0",title:c(k.modelId)?"상세 접기":"상세 펼치기",onClick:fe=>d(k.modelId),onKeydown:[n.withKeys(n.withModifiers(fe=>d(k.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(fe=>d(k.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,y_)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${k.modelId}`,width:"100%",placeholder:"이름","model-value":k.name,"onUpdate:modelValue":fe=>p(k,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-type-${k.modelId}`,width:"100%",placeholder:"타입",disabled:!!k.groupCode,items:n.unref(kr)(k.type,oe.value),"value-provider":E,"label-provider":Z,"model-value":k.type,"onUpdate:modelValue":fe=>L(k,fe)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),k.type===n.unref(Ct)?(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:0,name:`aw-customtype-${k.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":k.customType??"","onUpdate:modelValue":fe=>G(k,fe)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-logical-${k.modelId}`,width:"100%",placeholder:"논리명","model-value":((ne=(F=k.dbAttrs[0])==null?void 0:F.logicalName)==null?void 0:ne.ko)??"","onUpdate:modelValue":fe=>O(k,"ko",fe)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-col-${k.modelId}`,width:"100%",placeholder:"컬럼",disabled:h(k),"model-value":((ce=k.dbAttrs[0])==null?void 0:ce.physicalName)??"","onUpdate:modelValue":fe=>T(k,{physicalName:fe})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(pn,{controller:n.unref(o),"ref-id":(N=k.dbAttrs[0])==null?void 0:N.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-dtype-${k.modelId}`,width:"100%",placeholder:"dataType",disabled:h(k),items:n.unref(_r)((($=k.dbAttrs[0])==null?void 0:$.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":m,"label-provider":n.unref(Ca),"model-value":((ie=k.dbAttrs[0])==null?void 0:ie.dataType)??"","onUpdate:modelValue":fe=>fe&&T(k,{dataType:fe})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-len-${k.modelId}`,width:"100%",placeholder:"len",disabled:h(k),"model-value":(R=k.dbAttrs[0])==null?void 0:R.length,"onUpdate:modelValue":fe=>T(k,{length:fe||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",g_,[n.createElementVNode("div",b_,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-pk-${k.modelId}`,label:"PK","model-value":k.identifier,disabled:a.value||h(k),"onUpdate:modelValue":fe=>_(k,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nn-${k.modelId}`,label:"NN","model-value":k.notNull,disabled:h(k),"onUpdate:modelValue":fe=>p(k,{notNull:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-uq-${k.modelId}`,label:"UQ","model-value":!!((H=k.dbAttrs[0])!=null&&H.unique),disabled:h(k),"onUpdate:modelValue":fe=>T(k,{unique:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])]),n.createElementVNode("td",{class:"c-del",title:y(k)?Z_:void 0},[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,k.modelId)},null,8,["onClick"])],8,__)],2),c(k.modelId)?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__detail-row",{"is-focused":l.value.has(k.modelId)}])},[U[12]||(U[12]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",w_,[n.createElementVNode("div",k_,[n.createElementVNode("fieldset",E_,[U[6]||(U[6]=n.createElementVNode("legend",null,"DB",-1)),n.createElementVNode("label",v_,[U[3]||(U[3]=n.createElementVNode("span",null,"scale",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-scale-${k.modelId}`,width:"72px",placeholder:"scale",disabled:h(k)||!S(k),"model-value":(P=k.dbAttrs[0])==null?void 0:P.scale,"onUpdate:modelValue":fe=>T(k,{scale:fe||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-ai-${k.modelId}`,label:"Auto Increment","model-value":!!((se=k.dbAttrs[0])!=null&&se.autoIncrement),disabled:h(k)||!k.identifier,"onUpdate:modelValue":fe=>T(k,{autoIncrement:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createElementVNode("label",N_,[U[4]||(U[4]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{name:`aw-ins-${k.modelId}`,width:"110px",disabled:h(k),"model-value":he(k.dbAttrs[0]),items:D,"value-provider":m,"label-provider":K,"onUpdate:modelValue":fe=>fe&&Ie(k,fe)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",I_,[U[5]||(U[5]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{name:`aw-upd-${k.modelId}`,width:"110px",disabled:h(k),"model-value":v(k.dbAttrs[0]),items:J,"value-provider":m,"label-provider":q,"onUpdate:modelValue":fe=>fe&&Y(k,fe)},null,8,["name","disabled","model-value","onUpdate:modelValue"])])]),n.createElementVNode("fieldset",$_,[U[7]||(U[7]=n.createElementVNode("legend",null,"JPA",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-tr-${k.modelId}`,label:"@Transient","model-value":!!k.transient,disabled:k.identifier,"onUpdate:modelValue":fe=>C(k,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nid-${k.modelId}`,label:"@NaturalId","model-value":!!k.naturalId,disabled:k.identifier||h(k),"onUpdate:modelValue":fe=>b(k,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${k.modelId}`,label:"mutable","model-value":!!k.naturalIdMutable,disabled:h(k)||!k.naturalId,"onUpdate:modelValue":fe=>p(k,{naturalIdMutable:fe||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-mv-${k.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ne=k.dbAttrs[0])!=null&&Ne.multiValue),disabled:h(k),"onUpdate:modelValue":fe=>T(k,{multiValue:fe||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("fieldset",x_,[U[11]||(U[11]=n.createElementVNode("legend",null,"의미",-1)),n.createElementVNode("label",S_,[U[8]||(U[8]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"150px","model-value":te(k),items:u,"value-provider":m,"label-provider":f,"onUpdate:modelValue":fe=>fe&&M(k,fe)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("label",C_,[U[9]||(U[9]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Yd,{"model-value":k.groupCode,items:W.value,"onUpdate:modelValue":fe=>le(k,fe)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",R_,[U[10]||(U[10]=n.createElementVNode("span",null,"기본값",-1)),Q(k).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"150px","model-value":k.defaultValue??"none",items:ee(k),"value-provider":x,"label-provider":X,"onUpdate:modelValue":fe=>fe&&pe(k,fe)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`aw-default-${k.modelId}`,width:"150px",placeholder:"기본값","model-value":k.defaultValue??"","onUpdate:modelValue":fe=>be(k,fe)},null,8,["name","model-value","onUpdate:modelValue"]))])])])])],2)):n.createCommentVNode("",!0)],64))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",q_,[...U[20]||(U[20]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,c_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-e52d4460"]]),Q_=["disabled"],ew={class:"em-idxw__list"},tw={class:"em-idxw__list-head"},nw=["onClick"],ow={class:"em-idxw__item-name"},iw={key:0,class:"em-idxw__badge"},aw={class:"em-idxw__item-cnt"},lw={key:0,class:"em-idxw__empty"},rw={key:0,class:"em-idxw__edit"},sw={class:"em-idxw__form"},cw={class:"em-field em-idxw__name"},dw={class:"em-field"},uw=["value"],fw={class:"em-idxw__transfer"},mw={class:"em-idxw__pane"},pw={class:"em-idxw__pane-head"},hw={class:"em-idxw__cols"},yw=["onClick"],gw={key:0,class:"em-idxw__inh",title:"슈퍼클래스 상속 컬럼"},bw={key:0,class:"em-idxw__empty"},_w={class:"em-idxw__arrows"},ww={class:"em-idxw__pane"},kw={class:"em-idxw__pane-head"},Ew={class:"em-idxw__cols"},vw={class:"em-idxw__col-name"},Nw={key:0,class:"em-idxw__inh",title:"슈퍼클래스 상속 컬럼"},Iw={class:"em-idxw__col-ops"},$w=["disabled","onClick"],xw=["disabled","onClick"],Sw=["onClick"],Cw={key:0,class:"em-idxw__empty"},Rw={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Vw=ze(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(S=>S.modelId===t.entityId)??null),a=n.computed(()=>{var S;return((S=i.value)==null?void 0:S.indexes)??[]}),l=n.computed(()=>{var S;return((S=i.value)==null?void 0:S.attributes)??[]}),r=n.ref(null);n.watch(a,S=>{var O;S.some(te=>te.modelId===r.value)||(r.value=((O=S[0])==null?void 0:O.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(S=>S.modelId===r.value)??null),c=n.computed(()=>i.value?Wo(i.value,o.superClassCatalog.value):[]),d=n.computed(()=>{var S;return new Set(((S=s.value)==null?void 0:S.columns.map(O=>O.columnRef))??[])}),u=n.computed(()=>[...l.value.filter(S=>!d.value.has(S.modelId)).map(S=>({ref:S.modelId,label:m(S),inherited:!1})),...c.value.filter(S=>!d.value.has(S.modelId)).map(S=>({ref:S.modelId,label:p(S),inherited:!0}))]),f=n.ref(new Set);n.watch(r,()=>f.value=new Set);function m(S){var te;const O=(te=S.dbAttrs[0])==null?void 0:te.physicalName;return O&&O!==S.name?`${S.name} (${O})`:S.name}function p(S){return S.physicalName&&S.physicalName!==S.field?`${S.field} (${S.physicalName})`:S.field}function y(S){const O=l.value.find(M=>M.modelId===S);if(O)return m(O);const te=c.value.find(M=>M.modelId===S);return te?p(te):S}function b(S){return qn(S)}function g(S,O){i.value&&o.updateIndex(i.value.modelId,S,O)}function _(){var O;if(!i.value)return;const S=Oe();o.addIndex(i.value.modelId,{modelId:S,name:`idx_${(((O=i.value.indexes)==null?void 0:O.length)??0)+1}`,unique:!1,columns:[]}),r.value=S}function C(S){i.value&&o.removeIndex(i.value.modelId,S)}function h(S){s.value&&g(s.value.modelId,{parameters:S.trim()===""?void 0:S})}function E(S){const O=new Set(f.value);O.has(S)?O.delete(S):O.add(S),f.value=O}function Z(){const S=s.value;if(!S||!f.value.size)return;const O=[...f.value].map(te=>({columnRef:te,descending:!1}));g(S.modelId,{columns:[...S.columns,...O]}),f.value=new Set}function L(S){const O=s.value;O&&g(O.modelId,{columns:O.columns.filter((te,M)=>M!==S)})}function G(S,O){const te=s.value;te&&g(te.modelId,{columns:te.columns.map((M,oe)=>oe===S?{...M,descending:O}:M)})}function T(S,O){const te=s.value;if(!te)return;const M=S+O;if(M<0||M>=te.columns.length)return;const oe=[...te.columns];[oe[S],oe[M]]=[oe[M],oe[S]],g(te.modelId,{columns:oe})}return(S,O)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",ew,[n.createElementVNode("div",tw,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:_})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,te=>(n.openBlock(),n.createElementBlock("li",{key:te.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":te.modelId===r.value}]),onClick:M=>r.value=te.modelId},[n.createElementVNode("span",ow,n.toDisplayString(te.name||"(이름 없음)"),1),te.unique?(n.openBlock(),n.createElementBlock("span",iw,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",aw,n.toDisplayString(te.columns.length),1)],10,nw))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",lw,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",rw,[n.createElementVNode("div",sw,[n.createElementVNode("label",cw,[O[4]||(O[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":O[0]||(O[0]=te=>g(s.value.modelId,{name:te}))},null,8,["model-value"]),n.createVNode(pn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":O[1]||(O[1]=te=>g(s.value.modelId,{unique:te}))},null,8,["model-value"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:O[2]||(O[2]=te=>C(s.value.modelId))})]),n.createElementVNode("label",dw,[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]=te=>h(te.target.value))},null,40,uw)]),n.createElementVNode("div",fw,[n.createElementVNode("div",mw,[n.createElementVNode("div",pw,"가용 컬럼 ("+n.toDisplayString(u.value.length)+")",1),n.createElementVNode("ul",hw,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,te=>(n.openBlock(),n.createElementBlock("li",{key:te.ref,class:n.normalizeClass(["em-idxw__col",{"is-sel":f.value.has(te.ref)}]),onClick:M=>E(te.ref)},[n.createTextVNode(n.toDisplayString(te.label),1),te.inherited?(n.openBlock(),n.createElementBlock("span",gw,"상속")):n.createCommentVNode("",!0)],10,yw))),128)),u.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",bw,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",_w,[n.createVNode(n.unref(ae.BSButton),{caption:"추가 →",disabled:!f.value.size,onClick:Z},null,8,["disabled"])]),n.createElementVNode("div",ww,[n.createElementVNode("div",kw,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",Ew,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(te,M)=>(n.openBlock(),n.createElementBlock("li",{key:M,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",vw,[n.createTextVNode(n.toDisplayString(y(te.columnRef)),1),b(te.columnRef)?(n.openBlock(),n.createElementBlock("span",Nw,"상속")):n.createCommentVNode("",!0)]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idxw-desc-${M}`,class:"em-check",label:"DESC","model-value":te.descending,"onUpdate:modelValue":oe=>G(M,oe)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",Iw,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:M===0,onClick:oe=>T(M,-1)},"↑",8,$w),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:M===s.value.columns.length-1,onClick:oe=>T(M,1)},"↓",8,xw),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:oe=>L(M)},"✕",8,Sw)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Cw,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",Rw,"인덱스를 선택하거나 추가하세요."))],8,Q_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-bb582869"]]),Aw={class:"em-op-src"},Tw={class:"em-op-src__actions"},Wd=ze(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ae.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",Aw,[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",Tw,[n.createVNode(n.unref(ae.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-2150d2fc"]]),Mw=["disabled"],Bw={class:"em-ow__toolbar"},Dw={class:"em-ow__count"},Ow={class:"em-ow__scroll"},Lw={class:"em-ow__table"},Pw={class:"c-del"},zw={key:0},Uw=ze(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.useModal(),a=n.computed(()=>o.state.logical.entities.find(y=>y.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(y){return y==="none"?"(없음)":y}const c=y=>y;function d(y,b){a.value&&o.updateOperation(a.value.modelId,y.modelId,b)}function u(y,b,g){d(y,{description:{...y.description,[b]:g}})}function f(y){return y.personalInfoAttributeType??"none"}function m(y,b){d(y,{personalInfoAttributeType:b==="none"?void 0:b})}function p(y){i.openModal({component:Wd,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:b=>d(y,{sourceCode:b})}})}return(y,b)=>{var g,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",Bw,[n.createElementVNode("span",Dw,"오퍼레이션 ("+n.toDisplayString(((g=a.value.operations)==null?void 0:g.length)??0)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:b[0]||(b[0]=C=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",Ow,[n.createElementVNode("table",Lw,[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??[],C=>{var h;return n.openBlock(),n.createElementBlock("tr",{key:C.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-name-${C.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":C.name,"onUpdate:modelValue":E=>d(C,{name:E})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":C.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":E=>E&&d(C,{visibility:E})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-desc-${C.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((h=C.description)==null?void 0:h.ko)??"","onUpdate:modelValue":E=>u(C,"ko",E)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":f(C),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":E=>E&&m(C,E)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:C.sourceCode?"본문 ●":"본문",onClick:E=>p(C)},null,8,["caption","onClick"])]),n.createElementVNode("td",Pw,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:E=>n.unref(o).removeOperation(a.value.modelId,C.modelId)},null,8,["onClick"])])])}),128)),(_=a.value.operations)!=null&&_.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",zw,[...b[1]||(b[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,Mw)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),Fw={class:"em-detail__tabs"},Hw=["onClick"],Gw={key:0,class:"em-detail__narrow"},Yw=ze(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.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(ae.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",Fw,[(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,Hw)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createElementBlock("div",Gw,[n.createVNode(Hd,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])])):r.value==="columns"?(n.openBlock(),n.createBlock(J_,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(Vw,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(Uw,{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-e761e204"]]);function qi(e,t,o){e.openModal({component:Yw,bind:{controller:n.markRaw(t),entityId:o}})}const Kd="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function Ww(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 Kw=220;function qw(e,t){let i=-1/0;for(const l of e.entityLayouts)i=Math.max(i,l.geo.location.x+(l.geo.size.width||Kw));for(const l of e.groupLayouts)i=Math.max(i,l.geo.location.x+l.geo.size.width);let a=1/0;for(const l of t.entityLayouts)a=Math.min(a,l.geo.location.x);for(const l of t.groupLayouts)a=Math.min(a,l.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const Rl=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),hn=Symbol("editorController");function qd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Xi(e,t){const o=[];for(const i of t.remove)o.push(xn(e,i));for(const i of t.update)o.push(tn(e,i.attributeId,i.patch));for(const i of t.add)o.push(Vt(e,i));return o}function zn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Un(e,t){const o=[];for(const[i,a]of Sm(e,t,Oe))o.push(...Xi(i,a));return o}function Xd(e,t,o){const i=new Set(o.remove);return zn(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 Vl(e,t){const o=oo(e,t,Oe),i=Xi(t,o),a=Xd(e,t,o);return i.push(...Un(a,t)),i}function jd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Oe()}))}function Xw(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,y)=>Math.max(p,y.order),-1)+1,f=new Set(o.attributes.map(p=>p.name));let m="id";for(let p=2;f.has(m);p++)m=`id${p}`;a={modelId:Oe(),name:m,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Oe(),physicalName:m.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 m=e.associations.find(g=>g.modelId===f.embedded.associationRef);if(!m)continue;const p=m.end1.entityRef===u.modelId,y=p?m.end1:m.end2,b=p?m.end2:m.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:m.modelId,end1:{entityRef:u.modelId,multiplicity:y.multiplicity,navigable:y.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(m=>m.ownerId===u.modelId).map(m=>m.dispId));return f.size?{...u,attributes:u.attributes.filter(m=>!f.has(m.modelId))}:u}),associations:e.associations.map(u=>{const f=l.find(m=>m.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=oo(r,t,Oe);for(const u of l){const f=s.add.find(m=>{var p;return((p=m.derivedFrom)==null?void 0:p.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push(xn(u.ownerId,u.dispId)),i.push(li(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Xi(t,s));const c=Xd(r,t,s);return i.push(...Un(c,t)),i}function jw(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(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var E;return((E=h.embedded)==null?void 0:E.associationRef)===l.modelId}))continue;const u=Oe(),f=d.attributes.reduce((h,E)=>Math.max(h,E.order),-1)+1,m=new Set(d.attributes.map(h=>h.name)),p=a(o.name);let y=p;for(let h=2;m.has(y);h++)y=`${p}${h}`;const b=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:Oe()})),g={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:b,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(Vt(c,g));const _=r?"end2":"end1",C=r?"end1":"end2";i.push(li(l.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Oe()},[C]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Zw(e=qd(),t={}){var De,We;const o=n.reactive(e);let i=new La(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.superClassCatalog??[]),c=n.ref(t.languages??["ko","en","ja","zh"]),d=n.ref(t.userLanguage??"ko"),u=n.ref(t.reservedWords),f=n.ref(t.selectableDataTypes),m=n.ref(t.largeEntityThreshold),p=n.ref(t.flagEntitiesWithoutRelations??!1),y=n.ref(!1),b=n.ref(!1),g=n.ref(!1),_=n.ref(0),C=n.ref(null);let h=0;const E=I=>{if(t.onNotice){t.onNotice(I);return}C.value={text:I,id:++h}},Z=n.ref(((De=t.meta)==null?void 0:De.schemaVersion)??1),L=n.ref(((We=t.meta)==null?void 0:We.opWriteEnabled)??!1),G=n.computed(()=>Z.value>=2&&L.value),T=t.historyTransport,S=n.computed(()=>G.value&&T!==void 0),O=t.restoreTransport,te=n.ref(0),M=n.computed(()=>G.value&&w.value&&O!==void 0);async function oe(I){if(!O||!w.value)return{ok:!1,reason:"unavailable"};const B=await O(I);return B.ok&&te.value++,B}const w=n.ref(!(Z.value>=2&&L.value===!1)),j=n.ref("LOGICAL_PHYSICAL"),A=n.ref("straight"),W=n.ref(!0),Q=n.ref(!0),ee=n.ref(null),x=n.computed(()=>{var I;return((I=ee.value)==null?void 0:I.kind)==="attribute"?{entityId:ee.value.entityId,attrId:ee.value.anchor}:null}),X=n.computed(()=>{var I;return((I=ee.value)==null?void 0:I.kind)==="attribute"?ee.value.ids:[]}),le=n.computed(()=>{var I,B;return((I=ee.value)==null?void 0:I.kind)==="entity"?ee.value.id:((B=ee.value)==null?void 0:B.kind)==="attribute"?ee.value.entityId:null}),pe=n.ref(null);let be=0;const de=n.ref(null),me=n.ref(null);let ye=t.meta;function ve(){i.onChange(()=>{y.value=i.canUndo,b.value=i.canRedo,g.value=i.isDirty,_.value++})}ve();let Ce=null,xe=null;function ge(){xe==null||xe(),xe=null,Ce=null}function J(){if(ge(),!G.value||!t.opTransport)return;const I=new vs({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:B=>{w.value=!1,me.value=B},onError:t.onOpError});I.seed((ye==null?void 0:ye.revSeed)??{}),xe=I.attach(i),Ce=I}J();const q=n.computed(()=>ar(o.logical,o.layout)),v=n.computed(()=>({reservedWords:u.value,selectableDataTypes:f.value,largeEntityThreshold:m.value,flagEntitiesWithoutRelations:p.value,embeddableCatalog:a.value,superClassCatalog:s.value})),V=n.computed(()=>Nr(o.logical,v.value)),Y=n.computed(()=>{const I=new Map;for(const B of V.value){if(!B.targetRef)continue;const re=I.get(B.targetRef);re?re.push(B):I.set(B.targetRef,[B])}return I}),D=I=>{w.value&&i.execute(I)},K=I=>o.layout.entityLayouts.some(B=>B.entityRef===I&&!!B.locked),he=I=>o.layout.groupLayouts.some(B=>B.groupRef===I&&!!B.locked),Ee=I=>{const B=o.logical.associations.find(re=>re.modelId===I);return!!B&&(K(B.end1.entityRef)||K(B.end2.entityRef))},Ie=(I,B,re)=>{if(K(I))return;const ue=tn(I,B,re),z=zn(o.logical,I,k=>k.map(F=>F.modelId===B?{...F,...re}:F)),U=Un(z,I);D(U.length?He("속성 수정",[ue,...U]):ue)};function we(I){const B=I.map(ne=>o.layout.entityLayouts.find(ce=>ce.entityRef===ne)).filter(ne=>!!ne);if(!B.length)return{location:{x:40,y:40},size:{width:400,height:300}};let re=1/0,ue=1/0,z=-1/0,U=-1/0;for(const ne of B){const ce=ne.geo.size.width||220,N=ne.geo.size.height||140;re=Math.min(re,ne.geo.location.x),ue=Math.min(ue,ne.geo.location.y),z=Math.max(z,ne.geo.location.x+ce),U=Math.max(U,ne.geo.location.y+N)}const k=40,F=28;return{location:{x:re-k,y:ue-k-F},size:{width:z-re+k*2,height:U-ue+k*2+F}}}function Re(I,B,re){var ne;const ue=o.layout.groupLayouts.find(ce=>ce.groupRef===I),z=(ue==null?void 0:ue.geo.location)??B,U=B.x-z.x,k=B.y-z.y,F=[Yr(I,B),...re.map(ce=>$n(ce.id,ce.location))];if(U||k){const ce=new Set(((ne=o.logical.groups.find(N=>N.modelId===I))==null?void 0:ne.memberEntityRefs)??[]);for(const N of o.logical.associations){if(!ce.has(N.end1.entityRef)||!ce.has(N.end2.entityRef))continue;const $=o.layout.associationLayouts.find(ie=>ie.associationRef===N.modelId);$&&$.waypoints.length&&F.push(ls(N.modelId,U,k))}for(const N of(ue==null?void 0:ue.memberNoteRefs)??[]){const $=o.layout.notes.find(ie=>ie.modelId===N);$&&F.push(no(N,{x:$.geo.location.x+U,y:$.geo.location.y+k}))}}return F}const Ae={state:o,resolved:q,issues:V,issuesByRef:Y,flagEntitiesWithoutRelations:p,canUndo:y,canRedo:b,dirty:g,revision:_,notice:C,editable:w,schemaVersion:Z,opWriteEnabled:L,opMode:G,opConflict:me,historyTransport:T,historyAvailable:S,restoreTransport:O,restoreAvailable:M,restoreToSeq:oe,reloadRequest:te,displayMode:j,routingMode:A,showGrid:W,showMinimap:Q,selection:ee,selectedAttr:x,selectedAttrIds:X,inspectedEntityId:le,focusRequest:pe,clipboard:de,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,superClassCatalog:s,languages:c,userLanguage:d,selectableDataTypes:f,setEditable(I){w.value=I&&G.value},setEmbeddableCatalog(I){a.value=I},setGroupCodeCatalog(I){l.value=I},setPredefinedCustomTypeCatalog(I){r.value=I},setSuperClassCatalog(I){s.value=I},selectAttribute(I,B,re="replace"){const ue=ee.value,z=(ue==null?void 0:ue.kind)==="attribute"&&ue.entityId===I;if(re==="replace"||!z){ee.value={kind:"attribute",entityId:I,ids:[B],anchor:B};return}if(re==="toggle"){const $=ue.ids.includes(B),ie=$?ue.ids.filter(H=>H!==B):[...ue.ids,B];if(!ie.length){ee.value=null;return}const R=$&&ue.anchor===B?ie[ie.length-1]:$?ue.anchor:B;ee.value={kind:"attribute",entityId:I,ids:ie,anchor:R};return}const U=o.logical.entities.find($=>$.modelId===I),k=[...(U==null?void 0:U.attributes)??[]].sort(($,ie)=>$.order-ie.order).map($=>$.modelId),F=k.indexOf(ue.anchor),ne=k.indexOf(B);if(F<0||ne<0){ee.value={kind:"attribute",entityId:I,ids:[B],anchor:B};return}const[ce,N]=F<=ne?[F,ne]:[ne,F];ee.value={kind:"attribute",entityId:I,ids:k.slice(ce,N+1),anchor:ue.anchor}},moveAttributeFocus(I){const B=ee.value;if((B==null?void 0:B.kind)!=="attribute")return!1;const re=o.logical.entities.find(k=>k.modelId===B.entityId);if(!re||!re.attributes.length)return!1;const ue=re.attributes.findIndex(k=>k.modelId===B.anchor);if(ue<0)return!1;const z=Math.min(Math.max(ue+I,0),re.attributes.length-1);if(z===ue)return!0;const U=re.attributes[z].modelId;return ee.value={kind:"attribute",entityId:B.entityId,ids:[U],anchor:U},!0},nudgeSelectedAttributes(I){const B=ee.value;if((B==null?void 0:B.kind)!=="attribute")return!1;const re=o.logical.entities.find($=>$.modelId===B.entityId);if(!re)return!1;const ue=re.attributes,z=new Set(B.ids),U=ue.map(($,ie)=>z.has($.modelId)?ie:-1).filter($=>$>=0);if(!U.length)return!1;const k=Math.min(...U),F=ue.filter($=>!z.has($.modelId)),ne=ue.slice(0,k).filter($=>!z.has($.modelId)).length;let ce;if(I<0){if(ne<=0)return!0;ce=ne-1}else{if(F.length-ne<=0)return!0;ce=ne+1}if(K(B.entityId))return!0;const N=ue.filter($=>z.has($.modelId)).map($=>$.modelId);return D(za(B.entityId,N,ce)),!0},deleteSelection(){if(!w.value)return!1;const I=ee.value;if(!I)return!1;if(I.kind==="attribute"){if(K(I.entityId))return!1;const B=I.ids;if(!B.length)return!1;B.length===1?Ae.removeAttribute(I.entityId,B[0]):Ae.removeAttributes(I.entityId,B)}else if(I.kind==="entity"){if(K(I.id))return!1;Ae.removeEntity(I.id)}else if(I.kind==="note")Ae.removeNote(I.id);else if(I.kind==="group"){if(he(I.id))return!1;Ae.removeGroup(I.id)}else Ae.removeAssociation(I.id);return ee.value=null,!0},nudgeNodes(I,B,re){if(!I.length||B===0&&re===0)return!1;const ue=new Set(o.logical.entities.map(ce=>ce.modelId)),z=new Set(o.logical.groups.map(ce=>ce.modelId)),U=new Set(o.layout.notes.map(ce=>ce.modelId)),k=new Set;for(const ce of I){if(!z.has(ce))continue;const N=o.logical.groups.find($=>$.modelId===ce);for(const $ of(N==null?void 0:N.memberEntityRefs)??[])k.add($)}const F=[],ne=[];for(const ce of I)if(z.has(ce)){if(he(ce))continue;const N=o.layout.groupLayouts.find(H=>H.groupRef===ce);if(!N)continue;const $=o.logical.groups.find(H=>H.modelId===ce),ie=(($==null?void 0:$.memberEntityRefs)??[]).map(H=>{var se;const P=((se=o.layout.entityLayouts.find(Ne=>Ne.entityRef===H))==null?void 0:se.geo.location)??{x:0,y:0};return{id:H,location:{x:P.x+B,y:P.y+re}}}),R={x:N.geo.location.x+B,y:N.geo.location.y+re};F.push(He("그룹 이동",Re(ce,R,ie))),ne.push("g:"+ce)}else if(ue.has(ce)){if(k.has(ce)||K(ce))continue;const N=o.layout.entityLayouts.find($=>$.entityRef===ce);if(!N)continue;F.push($n(ce,{x:N.geo.location.x+B,y:N.geo.location.y+re})),ne.push("e:"+ce)}else if(U.has(ce)){const N=o.layout.notes.find($=>$.modelId===ce);if(!N)continue;F.push(no(ce,{x:N.geo.location.x+B,y:N.geo.location.y+re})),ne.push("n:"+ce)}return F.length?(D(He("이동",F,"nudge:"+ne.sort().join(","))),!0):!1},requestFocus(I){pe.value={id:I,nonce:++be}},undo:()=>{w.value&&i.undo()},redo:()=>{w.value&&i.redo()},markSaved:()=>{w.value&&(Ce==null||Ce.flush(),i.markSavePoint())},loadDiagram(I,B){ge(),o.logical=I.logical,o.layout=I.layout,i=new La(o),ve(),Z.value=(B==null?void 0:B.schemaVersion)??1,L.value=(B==null?void 0:B.opWriteEnabled)??!1,w.value=!(Z.value>=2&&L.value===!1),ye=B,me.value=null,ee.value=null,y.value=i.canUndo,b.value=i.canRedo,g.value=i.isDirty,J()},flush(){Ce==null||Ce.flush()},whenOpsSettled(){return(Ce==null?void 0:Ce.whenSettled())??Promise.resolve()},addEntity(I="NewEntity",B={x:80,y:80}){const re=Oe(),ue={modelId:re,name:I,stereotype:"JPA_ENTITY",table:{physicalName:I.toLowerCase()},attributes:[{modelId:Oe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Oe(),physicalName:"id",dataType:"BIGINT"}]}]};return D(ti(ue,{location:{...B},size:{width:220,height:140}})),re},renameEntity(I,B){K(I)||D(Or(I,B))},updateEntity(I,B){if(K(I))return;const re=Dr(I,B),ue=o.logical.entities.find(k=>k.modelId===I),z=B.stereotype==="JPA_EMBEDDABLE"&&!!ue&&ue.stereotype!=="JPA_EMBEDDABLE",U=!!B.stereotype&&B.stereotype!=="JPA_EMBEDDABLE"&&!!ue&&ue.stereotype==="JPA_EMBEDDABLE";if(z&&ue){const k=ue.attributes.filter($=>$.identifier&&!$.derivedFrom).map($=>tn(I,$.modelId,{identifier:!1})),F=zn({...o.logical,entities:o.logical.entities.map($=>$.modelId===I?{...$,stereotype:"JPA_EMBEDDABLE"}:$)},I,$=>$.map(ie=>ie.identifier&&!ie.derivedFrom?{...ie,identifier:!1}:ie)),ne=Vl(F,I),ce=jw(o.logical,I),N=[re,...k,...ne,...ce];D(N.length>1?He("임베더블 변환",N):re);return}if(U){const k=Xw(o.logical,I),F=[re,...k];D(F.length>1?He("엔터티 전환",F):re);return}D(re)},moveEntity(I,B){K(I)||D($n(I,B))},resizeEntity(I,B){K(I)||D(Lr(I,B))},removeEntity(I){K(I)||D(Br(I))},setEntitySwatch(I,B){D(Pr(I,B))},setEntityCollapsed(I,B){D(zr(I,B))},setEntityLocked(I,B){D(Ur(I,B))},isEntityLocked(I){return K(I)},collapseAll(){D(Pa(!0))},expandAll(){D(Pa(!1))},setAttributeSwatch(I,B,re){D(ni(I,B,re))},dragGroup(I,B,re){he(I)||D(He("그룹 이동",Re(I,B,re)))},resizeGroup(I,B){he(I)||D(Wr(I,B))},setGroupSwatch(I,B){D(Kr(I,B))},setGroupLocked(I,B){D(qr(I,B))},isGroupLocked(I){return he(I)},updateGroup(I,B){he(I)||D(Fr(I,B))},createGroup(I,B){if(!I.length)return null;const re=[];for(const U of o.logical.groups)for(const k of I)U.memberEntityRefs.includes(k)&&re.push(ii(U.modelId,k));const ue=Oe(),z={modelId:ue,name:B?{ko:B}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...I]};return re.push(oi(z,we(I))),D(He("그룹 생성",re)),ee.value=null,ue},addEmptyGroup(I,B){const re=Oe();return D(oi({modelId:re,name:B?{ko:B}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...I},size:{width:360,height:260}})),re},removeGroup(I){he(I)||D(Hr(I))},dropEntity(I,B,re){var U;if(K(I))return;const ue=((U=o.logical.groups.find(k=>k.memberEntityRefs.includes(I)))==null?void 0:U.modelId)??null,z=[$n(I,B)];ue!==re&&(ue&&z.push(ii(ue,I)),re&&z.push(Gr(re,I))),D(He("이동",z))},ungroupEntity(I){const B=o.logical.groups.find(re=>re.memberEntityRefs.includes(I));B&&D(ii(B.modelId,I))},dropNote(I,B,re){var U;const ue=((U=o.layout.groupLayouts.find(k=>{var F;return(F=k.memberNoteRefs)==null?void 0:F.includes(I)}))==null?void 0:U.groupRef)??null,z=[no(I,B)];ue!==re&&(ue&&z.push(hs(ue,I)),re&&z.push(ps(re,I))),D(He("이동",z))},addPredefinedEmbed(I,B){if(K(I))return;const re=a.value.find(ne=>ne.type===B),ue=o.logical.entities.find(ne=>ne.modelId===I);if(!re||!ue)return;const z=ue.attributes.reduce((ne,ce)=>Math.max(ne,ce.order),-1)+1,U=Oe(),k=re.fields.map(()=>({modelId:Oe(),physicalName:"",dataType:""})),F={modelId:U,name:re.defaultName,type:re.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:z,dbAttrs:k};return D(Vt(I,F)),U},addAttribute(I,B={}){if(K(I))return B.modelId??"";const re=o.logical.entities.find(N=>N.modelId===I),ue=re?re.attributes.length:0,z=B.modelId??Oe(),U=B.name??`field${ue}`,k={modelId:z,name:U,type:B.type??Ra,attrType:B.attrType??"NORMAL",identifier:B.identifier??!1,notNull:B.notNull??!1,order:ue,dbAttrs:B.dbAttrs??[{modelId:Oe(),physicalName:U,dataType:"VARCHAR",length:255}],...B},F=Vt(I,k),ne=zn(o.logical,I,N=>[...N,k]),ce=Un(ne,I);return D(ce.length?He("속성 추가",[F,...ce]):F),z},addDivider(I){if(K(I))return"";const B=o.logical.entities.find(U=>U.modelId===I),re=B?B.attributes.length:0,ue=Oe();return D(Vt(I,{modelId:ue,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:re,dbAttrs:[]})),ue},updateAttribute(I,B,re){Ie(I,B,re)},setAttributeGroupCode(I,B,re){Ie(I,B,{groupCode:re,type:re?jn:Ra})},setEmbedColumns(I,B,re){var ne,ce;if(K(I))return;const ue=tn(I,B,{dbAttrs:re}),z=(ne=o.logical.entities.find(N=>N.modelId===I))==null?void 0:ne.attributes.find(N=>N.modelId===B),U=(ce=z==null?void 0:z.embedded)==null?void 0:ce.associationRef,k=U?o.logical.associations.find(N=>N.modelId===U):void 0,F=[];k&&U&&(k.end1.legacyEmbedRaw&&F.push(Sn(U,"end1",{legacyEmbedRaw:void 0})),k.end2.legacyEmbedRaw&&F.push(Sn(U,"end2",{legacyEmbedRaw:void 0}))),D(F.length?He("임베드 컬럼 수정",[ue,...F]):ue)},removeAttribute(I,B){if(K(I))return;if(di(o.logical,I,B)){E(Kd);return}const re=xn(I,B),ue=zn(o.logical,I,U=>U.filter(k=>k.modelId!==B)),z=Un(ue,I);D(z.length?He("속성 삭제",[re,...z]):re)},removeAttributes(I,B){var F;if(!B.length||K(I))return;const re=B.filter(ne=>!di(o.logical,I,ne));if(re.length<B.length&&E(Kd),!re.length)return;const ue=re.map(ne=>xn(I,ne)),z=new Set(re),U=zn(o.logical,I,ne=>ne.filter(ce=>!z.has(ce.modelId))),k=[...ue,...Un(U,I)];D(k.length===1?k[0]:He("속성 삭제",k)),((F=ee.value)==null?void 0:F.kind)==="attribute"&&ee.value.entityId===I&&(ee.value=null)},setAttributeSwatches(I,B,re){B.length&&(B.length===1?D(ni(I,B[0],re)):D(He("속성 색상",B.map(ue=>ni(I,ue,re)))))},reorderAttributes(I,B,re){!B.length||K(I)||D(za(I,B,re))},addIndex(I,B){K(I)||D(ts(I,B))},updateIndex(I,B,re){K(I)||D(ns(I,B,re))},removeIndex(I,B){K(I)||D(os(I,B))},addOperation(I,B={}){var k;if(K(I))return B.modelId??"";const re=o.logical.entities.find(F=>F.modelId===I),ue=((k=re==null?void 0:re.operations)==null?void 0:k.length)??0,z=B.modelId??Oe(),U={modelId:z,name:B.name??`method${ue}`,visibility:B.visibility??"PACKAGE",order:ue,...B};return D(Xr(I,U)),z},updateOperation(I,B,re){K(I)||D(jr(I,B,re))},removeOperation(I,B){K(I)||D(Zr(I,B))},reorderOperations(I,B,re){!B.length||K(I)||D(Jr(I,B,re))},setOperationSwatch(I,B,re){D(Qr(I,B,re))},addAssociation(I,B,re,ue){if(K(I)||K(B))return"";const z=Oe(),U={modelId:z,end1:{entityRef:I,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:re},end2:{entityRef:B,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},k={...o.logical,associations:[...o.logical.associations,U]},F=oo(k,B,Oe),ne=F.add[0];ne&&(U.end2.attributeRef=ne.modelId);const ce={associationRef:z,waypoints:[],sourceColumnRef:re,targetColumnRef:(ne==null?void 0:ne.modelId)??ue},N=ai(U,ce),$=Xi(B,F);return D($.length?He("관계 추가",[N,...$]):N),z},addEmbedAssociation(I,B){if(K(I))return;const re=o.logical.entities.find(se=>se.modelId===I),ue=o.logical.entities.find(se=>se.modelId===B);if(!re||!ue||ue.stereotype!=="JPA_EMBEDDABLE")return;const z=Oe(),U=Oe(),k=Oe(),F=re.attributes.reduce((se,Ne)=>Math.max(se,Ne.order),-1)+1,ne=jd(ue),ce=se=>se&&se.charAt(0).toLowerCase()+se.slice(1),N=new Set(re.attributes.map(se=>se.name)),$=ce(ue.name);let ie=$;for(let se=2;N.has(ie);se++)ie=`${$}${se}`;const R={modelId:U,name:ie,type:ue.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:F,dbAttrs:ne,embedded:{associationRef:z,embeddableRef:B}},H={modelId:z,end1:{entityRef:I,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:k},end2:{entityRef:B,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:U}},P={associationRef:z,waypoints:[],sourceColumnRef:U,targetColumnRef:void 0};return D(He("임베드 추가",[Vt(I,R),ai(H,P)])),z},setEmbedCollectionMode(I,B){if(Ee(I))return;const re=o.logical.associations.find(ce=>ce.modelId===I);if(!re)return;let ue,z;for(const ce of o.logical.entities){const N=ce.attributes.find($=>{var ie;return((ie=$.embedded)==null?void 0:ie.associationRef)===I&&$.attrType==="EMBED_OWN"});if(N){ue=ce.modelId,z=N;break}}if(!ue||!z)return;const U=z.embedded.embeddableRef,k=re.end2.entityRef===U?"end2":"end1",F=re[k],ne=F.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(B==="COLLECTION"?ne:!ne))if(B==="COLLECTION")D(He("임베드 컬렉션 전환",[tn(ue,z.modelId,{dbAttrs:[]}),Sn(I,k,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...F.jpa,collectionType:"LIST"}})]));else{const ce=o.logical.entities.find(N=>N.modelId===U);if(!ce)return;D(He("임베드 단일 전환",[tn(ue,z.modelId,{dbAttrs:jd(ce)}),Sn(I,k,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...F.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(I){if(Ee(I))return;const B=o.logical.associations.find(k=>k.modelId===I),re=es(I);if(!B){D(re);return}for(const k of o.logical.entities){const F=k.attributes.find(ne=>{var ce;return((ce=ne.embedded)==null?void 0:ce.associationRef)===I});if(F){D(He("임베드 삭제",[re,xn(k.modelId,F.modelId)]));return}}const ue=B.end2.entityRef,z={...o.logical,associations:o.logical.associations.filter(k=>k.modelId!==I)},U=Vl(z,ue);D(U.length?He("관계 삭제",[re,...U]):re)},setAssociationIdentifying(I,B){if(Ee(I))return;const re=o.logical.associations.find(F=>F.modelId===I),ue=li(I,{identifying:B});if(!re||re.identifying===B){D(ue);return}const z=re.end2.entityRef,U={...o.logical,associations:o.logical.associations.map(F=>F.modelId===I?{...F,identifying:B}:F)},k=Vl(U,z);D(k.length?He("식별 관계 변경",[ue,...k]):ue)},updateAssociationEnd(I,B,re){Ee(I)||D(Sn(I,B,re))},moveWaypoint(I,B,re){D(is(I,B,re))},addWaypoint(I,B,re){D(ss(I,B,re))},removeWaypoint(I,B){D(as(I,B))},clearWaypoints(I){D(rs(I))},addNote(I="메모",B={x:80,y:80}){const re=Oe();return D(cs({modelId:re,memo:I,geo:{location:{...B},size:{width:200,height:120}}})),re},removeNote(I){D(ds(I))},moveNote(I,B){D(no(I,B))},resizeNote(I,B){D(us(I,B))},setNoteMemo(I,B){D(fs(I,B))},setNoteSwatch(I,B){D(ms(I,B))},addNoteConnection(I,B){D(ys(I,B))},removeNoteConnection(I,B){D(gs(I,B))},moveNoteConnectionWaypoint(I,B,re,ue){D(bs(I,B,re,ue))},addNoteConnectionWaypoint(I,B,re,ue){D(_s(I,B,re,ue))},removeNoteConnectionWaypoint(I,B,re){D(ws(I,B,re))},clearNoteConnectionWaypoints(I,B){D(ks(I,B))},autoLayout(){const I=sr(o.logical,o.layout);I.length&&D(He("자동 배치",I.map(B=>$n(B.id,B.location))))},copy(){const I=ee.value;if((I==null?void 0:I.kind)==="attribute"){const U=o.logical.entities.find(F=>F.modelId===I.entityId);if(!U)return;const k=[...U.attributes].sort((F,ne)=>F.order-ne.order).filter(F=>I.ids.includes(F.modelId));if(!k.length)return;de.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:k}));return}const B=le.value;if(!B)return;const re=o.logical.entities.find(U=>U.modelId===B),ue=o.layout.entityLayouts.find(U=>U.entityRef===B);if(!re)return;const z=(ue==null?void 0:ue.geo)??{location:{x:80,y:80},size:{width:220,height:140}};de.value=JSON.parse(JSON.stringify({kind:"entity",entity:re,geo:z}))},paste(){if(!w.value)return;const I=de.value;if(!I)return;if(I.kind==="attribute"){const ue=le.value;if(!ue)return;const z=o.logical.entities.find(N=>N.modelId===ue);if(!z)return;const U=new Set(z.attributes.map(N=>N.name)),k=new Set(z.attributes.flatMap(N=>N.dbAttrs.map($=>$.physicalName))),F=z.attributes.length,ne=[],ce=I.attributes.map((N,$)=>{const ie=JSON.parse(JSON.stringify(N));ie.modelId=Oe();for(const R of ie.dbAttrs)R.modelId=Oe();U.has(ie.name)&&(ie.name=`${ie.name}_copy`);for(const R of ie.dbAttrs)R.physicalName&&k.has(R.physicalName)&&(R.physicalName=`${R.physicalName}_copy`);return ie.order=F+$,ne.push(ie.modelId),Vt(ue,ie)});D(ce.length===1?ce[0]:He("속성 붙여넣기",ce)),ee.value={kind:"attribute",entityId:ue,ids:ne,anchor:ne[ne.length-1]};return}const B=Ww(I.entity),re={location:{x:I.geo.location.x+40,y:I.geo.location.y+40},size:{...I.geo.size}};D(ti(B,re)),ee.value={kind:"entity",id:B.modelId}},importEntities(I,B,re){if(!w.value)return;const ue=xr(I,B,{existing:o.logical,includeRelated:re==null?void 0:re.includeRelated});if(ue.logical.entities.length===0)return;const z=qw(o.layout,ue.layout),U=new Map(ue.layout.entityLayouts.map(N=>[N.entityRef,N])),k=new Map(ue.layout.associationLayouts.map(N=>[N.associationRef,N])),F=new Map(ue.layout.groupLayouts.map(N=>[N.groupRef,N])),ne=[];let ce=80;for(const N of ue.logical.entities){const $=U.get(N.modelId),ie=$?{location:Rl($.geo.location,z),size:{...$.geo.size}}:{location:{x:ce+=40,y:80},size:{width:220,height:140}};let R;if($){const{entityRef:H,geo:P,locked:se,...Ne}=$;R=Ne}ne.push(ti(N,ie,R))}for(const N of ue.logical.associations){const $=k.get(N.modelId),ie=$?{...$,waypoints:$.waypoints.map(R=>Rl(R,z))}:{associationRef:N.modelId,waypoints:[]};ne.push(ai(N,ie))}for(const N of ue.logical.groups){const $=F.get(N.modelId),ie=$?{location:Rl($.geo.location,z),size:{...$.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let R;if($){const{groupRef:H,geo:P,locked:se,memberNoteRefs:Ne,...fe}=$;R=fe}ne.push(oi(N,ie,R))}D(He("다이어그램 가져오기",ne)),ee.value={kind:"entity",id:ue.logical.entities[0].modelId}}};return Ae}const ji=Symbol("groupHover"),Zd=Symbol("groupDrag"),Fn=Symbol("relationHighlight"),Jw={key:0,class:"em-sel","aria-hidden":"true"},Qw=["title","aria-expanded","disabled"],ek={class:"em-entity__stereotype"},tk={key:1,class:"em-entity__name"},nk=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],ok=["onPointerdown"],ik={key:1,class:"em-entity__divider-label"},ak=["title"],lk={class:"em-key-slot"},rk={class:"em-key-slot"},sk={key:0,class:"em-entity__type"},ck=["onClick"],dk={class:"em-entity__attrname"},uk={class:"em-entity__type"},fk=["data-op"],mk=["onPointerdown"],pk={class:"em-entity__op-vis","aria-hidden":"true"},hk=["title"],yk={key:4,class:"em-entity__footer"},Jd=ze(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(hn,null),i=ae.useModal();function a(){o&&qi(i,o,t.id)}const l=n.inject(ji,null),r=n.inject(Fn,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)),m=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),p=n.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="entity"&&o.selection.value.id===t.id}),y=n.computed(()=>!!t.selected&&!p.value),b=n.computed(()=>{var k;return o&&((k=o.selectedAttr.value)==null?void 0:k.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),g=n.computed(()=>b.value.size>0);function _(k,F){const ne=F.shiftKey?"range":F.metaKey||F.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,k.modelId,ne)}const C=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!p.value),h=n.computed(()=>t.data.entity),E=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),Z=n.computed(()=>t.data.collapsed??!1),L=n.computed(()=>t.data.locked??!1);function G(){s.value&&(o==null||o.setEntityCollapsed(t.id,!Z.value))}const T=n.computed(()=>E.value==="PHYSICAL"||E.value==="LOGICAL_PHYSICAL"),S=n.computed(()=>{const k=E.value==="PHYSICAL"||E.value==="LOGICAL_PHYSICAL",F={};for(const ne of h.value.attributes){const ce=ne.attrType.startsWith("RELATION")&&ne.dbAttrs.length>0;F[ne.modelId]={pk:ne.identifier,fk:ce&&k,required:ne.notNull&&!ne.identifier}}return F});function O(k){if(!k)return"";const F=[];return k.pk&&k.fk?F.push("PFK (식별 외래키)"):k.pk?F.push("PK (기본키)"):k.fk&&F.push("FK (외래키)"),k.required&&F.push("필수 (NOT NULL)"),F.join(" · ")}const te=n.computed(()=>{const k=xl(it(t.data.style)),F={};return k&&(F["--em-header-bg"]=k.bar,F["--em-header-fg"]=k.barOn),F});function M(k){var F,ne;return(ne=xl(it((F=t.data.attributeStyles)==null?void 0:F[k.modelId])))==null?void 0:ne.text}const oe=n.computed(()=>[...h.value.operations??[]].sort((k,F)=>k.order-F.order)),w=n.computed(()=>E.value==="CLASS"&&oe.value.length>0),j={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function A(k){return k?j[k]:"~"}function W(k){var F,ne;return(ne=xl(it((F=t.data.operationStyles)==null?void 0:F[k.modelId])))==null?void 0:ne.text}function Q(k,F,ne){switch(E.value){case"CLASS":return[{text:k}];case"PHYSICAL":return[{text:ne||k}];case"LOGICAL":return[F?{text:F}:{text:"(논리명)",missing:!0}];default:{const ce=F?{text:F}:{text:"(논리명)",missing:!0};return ne?[ce,{text:` · ${ne}`}]:[ce]}}}function ee(k){var F,ne,ce;return x(k)?[{text:k.name}]:Q(k.name,(ne=(F=k.dbAttrs[0])==null?void 0:F.logicalName)==null?void 0:ne.ko,((ce=k.dbAttrs[0])==null?void 0:ce.physicalName)??"")}function x(k){return k.attrType.startsWith("EMBED")&&k.dbAttrs.length>0}function X(k){return k.attrType==="DIVIDER"}function le(k){if(k.attrType!=="EMBED_PREDEF")return k.dbAttrs;const F=o==null?void 0:o.embeddableCatalog.value.find(ce=>ce.type===k.type);if(!F)return k.dbAttrs;const ne=Zn(jo(h.value,(o==null?void 0:o.state.logical.entities)??[]));return k.dbAttrs.map((ce,N)=>{const $=F.fields[N],ie=Zo(ce,ne);return ie?{...ce,physicalName:ie.physicalName,logicalName:ce.logicalName??($==null?void 0:$.logicalName),dataType:ce.dataType||($==null?void 0:$.dataType)||""}:$?{...ce,physicalName:ce.physicalName||$.physicalName,logicalName:ce.logicalName??$.logicalName,dataType:ce.dataType||$.dataType,length:ce.length??$.length}:ce})}function pe(k){var F;return Q(k.physicalName,(F=k.logicalName)==null?void 0:F.ko,k.physicalName)}function be(k){const F=Er(k,(o==null?void 0:o.state.logical.associations)??[]);return Aa(E.value,k,F)}const de=n.computed(()=>{var k,F,ne;return Q(h.value.name,(F=(k=h.value.table)==null?void 0:k.logicalName)==null?void 0:F.ko,((ne=h.value.table)==null?void 0:ne.physicalName)??"")}),me=n.ref(!1),ye=n.ref(""),ve=n.ref(null);async function Ce(){var k,F;s.value&&(ye.value=h.value.name,me.value=!0,await n.nextTick(),(k=ve.value)==null||k.focus(),(F=ve.value)==null||F.select())}function xe(){if(!me.value)return;me.value=!1;const k=ye.value.trim();k&&k!==h.value.name&&(o==null||o.renameEntity(t.id,k))}function ge(){o==null||o.addAttribute(t.id)}function J(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:q,findNode:v}=Pe(),V=n.ref(null),Y=n.computed(()=>{const k=V.value??t.data.size;return k?{width:`${k.width}px`,minHeight:`${k.height}px`}:void 0});let D=null;function K(k){var ce,N,$;if(!s.value)return;k.stopPropagation();const F=(ce=v(t.id))==null?void 0:ce.dimensions,ne=q({x:k.clientX,y:k.clientY});D={fx:ne.x,fy:ne.y,w:(F==null?void 0:F.width)??((N=t.data.size)==null?void 0:N.width)??200,h:(F==null?void 0:F.height)??(($=t.data.size)==null?void 0:$.height)??120},k.target.setPointerCapture(k.pointerId)}function he(k){if(!D)return;const F=q({x:k.clientX,y:k.clientY});V.value={width:Math.max(40,D.w+(F.x-D.fx)),height:Math.max(40,D.h+(F.y-D.fy))}}function Ee(k){var F,ne,ce;if(D&&V.value&&o){const N=(F=v(t.id))==null?void 0:F.dimensions;o.resizeEntity(t.id,{width:Math.round((N==null?void 0:N.width)??V.value.width),height:Math.round((N==null?void 0:N.height)??V.value.height)})}D=null,V.value=null,(ce=(ne=k.target).releasePointerCapture)==null||ce.call(ne,k.pointerId)}const Ie=n.ref(null),we=n.ref(null);function Re(k,F){if(!s.value)return;F.stopPropagation(),F.preventDefault();const ne=b.value,ce=ne.has(k.modelId)?new Set(ne):new Set([k.modelId]);we.value={ids:ce,dropIndex:-1,lineY:0},F.target.setPointerCapture(F.pointerId)}function Ae(k){if(!we.value||!Ie.value)return;const F=Array.from(Ie.value.querySelectorAll(".em-entity__row"));if(!F.length)return;let ne=F.length;for(let $=0;$<F.length;$++){const ie=F[$].getBoundingClientRect();if(k.clientY<ie.top+ie.height/2){ne=$;break}}const ce=F[F.length-1],N=ne<F.length?F[ne].offsetTop:ce.offsetTop+ce.offsetHeight;we.value={...we.value,dropIndex:ne,lineY:N}}function De(){const k=we.value;if(we.value=null,!k||k.dropIndex<0)return;const F=h.value.attributes,ne=F.filter(R=>k.ids.has(R.modelId)).map(R=>R.modelId),ce=F.filter((R,H)=>k.ids.has(R.modelId)&&H<k.dropIndex).length,N=k.dropIndex-ce,$=F.filter(R=>!k.ids.has(R.modelId)).map(R=>R.modelId);[...$.slice(0,N),...ne,...$.slice(N)].join(",")!==F.map(R=>R.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,ne,N))}function We(){we.value=null}const I=n.ref(null),B=n.ref(null);function re(k,F){s.value&&(F.stopPropagation(),F.preventDefault(),B.value={id:k.modelId,dropIndex:-1,lineY:0},F.target.setPointerCapture(F.pointerId))}function ue(k){if(!B.value||!I.value)return;const F=Array.from(I.value.querySelectorAll(".em-entity__op-row"));if(!F.length)return;let ne=F.length;for(let $=0;$<F.length;$++){const ie=F[$].getBoundingClientRect();if(k.clientY<ie.top+ie.height/2){ne=$;break}}const ce=F[F.length-1],N=ne<F.length?F[ne].offsetTop:ce.offsetTop+ce.offsetHeight;B.value={...B.value,dropIndex:ne,lineY:N}}function z(){const k=B.value;if(B.value=null,!k||k.dropIndex<0)return;const ne=oe.value.findIndex(N=>N.modelId===k.id);if(ne<0)return;const ce=k.dropIndex-(ne<k.dropIndex?1:0);ce!==ne&&(o==null||o.reorderOperations(t.id,[k.id],ce))}function U(){B.value=null}return(k,F)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":m.value,"is-dimmed":C.value,"is-selected":p.value,"is-multi-selected":y.value,"has-focused-attr":g.value,"is-locked":L.value}]),style:n.normalizeStyle(Y.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[p.value?(n.openBlock(),n.createElementBlock("div",Jw,[...F[7]||(F[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(te.value),onDblclick:n.withModifiers(Ce,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:Z.value?"펼치기":"접기","aria-expanded":!Z.value,disabled:!s.value,onClick:n.withModifiers(G,["stop"]),onPointerdown:F[0]||(F[0]=n.withModifiers(()=>{},["stop"])),onDblclick:F[1]||(F[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(Z.value?"▸":"▾"),41,Qw),n.createElementVNode("span",ek,"«"+n.toDisplayString(h.value.stereotype)+"»",1),me.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ve,"onUpdate:modelValue":F[2]||(F[2]=ne=>ye.value=ne),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(xe,["enter"]),F[3]||(F[3]=n.withKeys(ne=>me.value=!1,["esc"]))],onBlur:xe,onPointerdown:F[4]||(F[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ye.value]]):(n.openBlock(),n.createElementBlock("span",tk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(de.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("span",{key:ce,class:n.normalizeClass({"em-entity__missing":ne.missing})},n.toDisplayString(ne.text),3))),128))])),L.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)],36),Z.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:Ie,class:"em-entity__attrs"},[we.value&&we.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${we.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.attributes,ne=>{var ce,N,$,ie;return n.openBlock(),n.createElementBlock(n.Fragment,{key:ne.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(ne.modelId),"is-dragging":(ce=we.value)==null?void 0:ce.ids.has(ne.modelId),"is-embed":x(ne),"is-divider":X(ne),nodrag:X(ne)&&s.value}]),"data-attr":ne.modelId,onClick:n.withModifiers(R=>_(ne,R),["stop"]),onPointerdown:R=>X(ne)?Re(ne,R):void 0,onPointermove:R=>X(ne)?Ae(R):void 0,onPointerup:R=>X(ne)?De():void 0,onPointercancel:R=>X(ne)?We():void 0},[s.value&&!X(ne)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:R=>Re(ne,R),onPointermove:Ae,onPointerup:De,onPointercancel:We,onClick:F[5]||(F[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,ok)):n.createCommentVNode("",!0),X(ne)?(n.openBlock(),n.createElementBlock("span",ik,n.toDisplayString(ne.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(un),{id:`l:${ne.modelId}`,type:"target",position:n.unref(Se).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:O(S.value[ne.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",lk,[(N=S.value[ne.modelId])!=null&&N.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):($=S.value[ne.modelId])!=null&&$.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",rk,[x(ne)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(ie=S.value[ne.modelId])!=null&&ie.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,ak),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:M(ne)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ee(ne),(R,H)=>(n.openBlock(),n.createElementBlock("span",{key:H,class:n.normalizeClass({"em-entity__missing":R.missing})},n.toDisplayString(R.text),3))),128))],4),be(ne)?(n.openBlock(),n.createElementBlock("span",sk,n.toDisplayString(be(ne)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(un),{id:`r:${ne.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(x(ne)&&T.value?le(ne):[],R=>(n.openBlock(),n.createElementBlock("li",{key:`${ne.modelId}:${R.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(ne.modelId)}]),onClick:n.withModifiers(H=>_(ne,H),["stop"])},[F[8]||(F[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",dk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe(R),(H,P)=>(n.openBlock(),n.createElementBlock("span",{key:P,class:n.normalizeClass({"em-entity__missing":H.missing})},n.toDisplayString(H.text),3))),128))]),n.createElementVNode("span",uk,n.toDisplayString(R.dataType),1)],10,ck))),128))],64)}),128))],512)),!Z.value&&w.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:I,class:"em-entity__ops"},[B.value&&B.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${B.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,ne=>{var ce;return n.openBlock(),n.createElementBlock("li",{key:ne.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((ce=B.value)==null?void 0:ce.id)===ne.modelId}]),"data-op":ne.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:N=>re(ne,N),onPointermove:ue,onPointerup:z,onPointercancel:U,onClick:F[6]||(F[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,mk)):n.createCommentVNode("",!0),n.createElementVNode("span",pk,n.toDisplayString(A(ne.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:W(ne)})},n.toDisplayString(ne.name)+"()",5)],10,fk)}),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,hk)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",yk,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:ge},"+ 속성"),F[9]||(F[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&&!me.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:K,onPointermove:he,onPointerup:Ee},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3a3c0b9d"]]),gk={key:0,class:"em-sel","aria-hidden":"true"},bk={class:"em-group__label"},_k={class:"em-group__name"},wk={key:0,class:"em-group__pkg"},kk={key:1,class:"em-group__flag"},Qd=ze(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(()=>it(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(hn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var S;return!!t.id&&((S=r==null?void 0:r.selection.value)==null?void 0:S.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(ji,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),m=n.inject(Fn,null);function p(){t.id&&(m==null||m.setGroupHover(t.id))}function y(){m==null||m.setGroupHover(null)}const b=n.computed(()=>!!m&&m.hoverGroupId.value===t.id),g=n.computed(()=>!!m&&m.hoverGroupId.value!==null&&m.hoverGroupId.value!==t.id),{screenToFlowCoordinate:_,findNode:C}=Pe();let h=null,E=null;function Z(S){var M;if(!t.id||!s.value)return;S.stopPropagation();const O=((M=C(t.id))==null?void 0:M.dimensions)??{width:400,height:300},te=_({x:S.clientX,y:S.clientY});h={fx:te.x,fy:te.y,w:O.width,h:O.height},S.target.setPointerCapture(S.pointerId)}function L(S){if(!h||!t.id)return;const O=_({x:S.clientX,y:S.clientY});E={width:Math.max(160,h.w+(O.x-h.fx)),height:Math.max(120,h.h+(O.y-h.fy))};const te=C(t.id);te&&(te.style={width:`${E.width}px`,height:`${E.height}px`})}function G(S){var O,te;h&&E&&t.id&&r&&r.resizeGroup(t.id,E),h=null,E=null,(te=(O=S.target).releasePointerCapture)==null||te.call(O,S.pointerId)}const T=n.computed(()=>{const S=o.value.name;return(S==null?void 0:S.ko)||(S==null?void 0:S.en)||(S==null?void 0:S.ja)||(S==null?void 0:S.zh)||o.value.packageName||"그룹"});return(S,O)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":b.value,"is-dimmed":g.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:p,onMouseleave:y},[c.value?(n.openBlock(),n.createElementBlock("div",gk,[...O[0]||(O[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",bk,[n.createElementVNode("span",_k,n.toDisplayString(T.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",wk,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",kk,"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:Z,onPointermove:L,onPointerup:G},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),Ek={key:0,class:"em-sel","aria-hidden":"true"},vk={key:2,class:"em-note__text"},eu=ze(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(hn,null),i=n.inject(ji,null),a=n.inject(Fn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>it(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 m=n.computed(()=>{var w;return((w=a==null?void 0:a.source.value)==null?void 0:w.kind)==="note"&&a.source.value.id===t.id}),p=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!m.value),y=n.computed(()=>{var w;return((w=o==null?void 0:o.selection.value)==null?void 0:w.kind)==="note"&&o.selection.value.id===t.id}),b=n.computed(()=>!!t.selected&&!y.value),g=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!y.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}],C=n.ref(!1),h=n.ref(""),E=n.ref(null);async function Z(){var w;r.value&&(h.value=l.value.memo,C.value=!0,await n.nextTick(),(w=E.value)==null||w.focus())}function L(){C.value&&(C.value=!1,h.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,h.value)))}const{screenToFlowCoordinate:G,findNode:T}=Pe();let S=null,O=null;function te(w){var W;if(!r.value)return;w.stopPropagation();const j=((W=T(t.id))==null?void 0:W.dimensions)??l.value.geo.size,A=G({x:w.clientX,y:w.clientY});S={fx:A.x,fy:A.y,w:j.width,h:j.height},w.target.setPointerCapture(w.pointerId)}function M(w){if(!S)return;const j=G({x:w.clientX,y:w.clientY});O={width:Math.max(140,S.w+(j.x-S.fx)),height:Math.max(60,S.h+(j.y-S.fy))};const A=T(t.id);A&&(A.style={width:`${O.width}px`,height:`${O.height}px`})}function oe(w){var j,A;S&&O&&o&&o.resizeNote(t.id,O),S=null,O=null,(A=(j=w.target).releasePointerCapture)==null||A.call(j,w.pointerId)}return(w,j)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":m.value,"is-related":p.value,"is-dimmed":g.value,"is-selected":y.value,"is-multi-selected":b.value}]),style:n.normalizeStyle(c.value),onDblclick:Z,onPointerdown:d,onMouseenter:u,onMouseleave:f},[y.value?(n.openBlock(),n.createElementBlock("div",Ek,[...j[4]||(j[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),C.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:E,"onUpdate:modelValue":j[0]||(j[0]=A=>h.value=A),class:"em-note__edit nodrag",onBlur:L,onKeydown:j[1]||(j[1]=n.withKeys(A=>C.value=!1,["esc"])),onPointerdown:j[2]||(j[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,h.value]]):(n.openBlock(),n.createElementBlock("div",vk,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,A=>n.createVNode(n.unref(un),{id:A.id,key:A.id,type:"source",position:A.pos,class:"em-note-handle",onPointerdown:j[3]||(j[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!C.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:te,onPointermove:M,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Nk=20,Ik=22,$k=7,xk=22,tu=31,nu=7,Sk=20,ou=11,iu=11,Ck=tu+nu;function Rk(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Vk(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Zi(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 au(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Ji(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function lu(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:au(e,t);return[Ji(o,a,l-Math.PI/2),Ji(o,a,l+Math.PI/2)]}function ru(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 su(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=Zi(e,t,Nk),[d,u]=lu(e,t,c,Ik);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}),Rk(o.multiplicity)){const f=Zi(e,t,tu);l.push({cx:f.x,cy:f.y,r:nu})}if(Vk(o.multiplicity)){const f=Zi(e,t,$k),[m,p]=lu(e,t,f,xk);a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.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=Zi(e,t,Sk),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=au(e,t),f=Ji(d,ou/2,u-Math.PI/2),m=Ji(d,ou/2,u+Math.PI/2);r.push({points:[e,f,c,m]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=ru(s,c,iu,!0),u=ru(s,c,iu,!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 cu=200,du=120,Al=24;function uu(e){var a,l;if(!e)return{x:0,y:0,width:cu,height:du};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||cu,i=((l=e.dimensions)==null?void 0:l.height)||du;return{x:t.x,y:t.y,width:o,height:i}}function fu(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function mu(e){const t=n.computed(()=>uu(e.sourceNode())),o=n.computed(()=>uu(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var p,y;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,m=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(m-f)<Al){const b=(f+m)/2;f=b-Al/2,m=b+Al/2}return{source:{x:u,y:f},target:{x:u,y:m}}}),l=n.computed(()=>e.waypoints()[0]??fu(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??fu(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?va(t.value,d,l.value.x):Ea(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?va(o.value,d,r.value.x):Ea(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 Tl=Symbol("waypointController"),Ak=["d"],Tk=["d"],Mk=["d"],Bk=["x1","y1","x2","y2"],Dk=["cx","cy","r"],Ok=["x","y"],Lk=["x","y"],Pk=["cx","cy","onDblclick"],zk=["x","y","onPointerdown","onDblclick"],pu=ze(n.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Pe(),i=n.inject(Tl),a=n.inject(hn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Zd,null),s=n.inject(Fn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var ge;return((ge=a==null?void 0:a.selection.value)==null?void 0:ge.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 ge=r==null?void 0:r.value;if(!ge||!a)return null;const J=a.resolved.value.entities,q=V=>{var Y;return(Y=J.find(D=>D.entity.modelId===V))==null?void 0:Y.groupRef},v=t.data.association;return q(v.end1.entityRef)===ge.groupId&&q(v.end2.entityRef)===ge.groupId?{dx:ge.dx,dy:ge.dy}:null}),m=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),p=n.ref(-1),y=n.ref({x:0,y:0}),b=n.computed(()=>{const ge=f.value;return m.value.map((J,q)=>q===p.value?y.value:ge?{x:J.x+ge.dx,y:J.y+ge.dy}:J)}),g=n.computed(()=>{var ge;return!!((ge=t.sourceNode.data)!=null&&ge.collapsed)}),_=n.computed(()=>{var ge;return!!((ge=t.targetNode.data)!=null&&ge.collapsed)}),{source:C,target:h,sourceSide:E,targetSide:Z,isSelf:L}=mu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>b.value,sourceRowY:()=>t.data.sourceColumnRef&&!g.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),G=Ck+4,T=n.computed(()=>L.value?rr(C.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?_a(C.value,E.value,b.value,h.value,Z.value,G):ka(C.value,b.value,h.value)),S=n.computed(()=>L.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?wa(C.value,E.value,b.value,h.value,Z.value,G):Na(C.value,b.value,h.value).map((ge,J)=>({point:ge,segIndex:J}))),O=n.computed(()=>L.value||!l.value?[]:b.value);function te(ge){switch(ge){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 M(ge,J){p.value=ge,y.value={...m.value[ge]},J.target.setPointerCapture(J.pointerId),J.stopPropagation()}function oe(ge){if(p.value<0)return;const J=o({x:ge.clientX,y:ge.clientY});y.value={x:J.x,y:J.y}}function w(ge){var J,q;p.value>=0&&i&&i.movePoint(t.id,p.value,{...y.value}),p.value=-1,(q=(J=ge.target).releasePointerCapture)==null||q.call(J,ge.pointerId)}function j(ge,J){J.stopPropagation(),i==null||i.removePoint(t.id,ge)}function A(ge,J){if(!i)return;const q=o({x:J.clientX,y:J.clientY});i.insertPoint(t.id,ge,{x:q.x,y:q.y})}const W=n.computed(()=>te(t.data.association.end1.multiplicity)),Q=n.computed(()=>te(t.data.association.end2.multiplicity)),ee=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),x=n.computed(()=>ee.value==="class"),X=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ge=Kn(E.value);return{x:C.value.x+ge.x*10,y:C.value.y+ge.y*10}}return b.value[0]??h.value}),le=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const J=Kn(Z.value);return{x:h.value.x+J.x*10,y:h.value.y+J.y*10}}const ge=b.value;return ge[ge.length-1]??C.value}),pe=n.computed(()=>{const ge=t.data.association;return{multiplicity:ge.end1.multiplicity,navigable:ge.end1.navigable,composition:ge.end1.composition,otherNavigable:ge.end2.navigable}}),be=n.computed(()=>{const ge=t.data.association;return{multiplicity:ge.end2.multiplicity,navigable:ge.end2.navigable,composition:ge.end2.composition,otherNavigable:ge.end1.navigable}}),de=n.computed(()=>su(C.value,X.value,pe.value,ee.value)),me=n.computed(()=>su(h.value,le.value,be.value,ee.value)),ye=n.computed(()=>[...de.value.lines,...me.value.lines]),ve=n.computed(()=>[...de.value.circles,...me.value.circles]),Ce=n.computed(()=>[...de.value.polygons,...me.value.polygons].map(ge=>`M${ge.points.map(J=>`${J.x},${J.y}`).join(" L")} Z`)),xe=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ge,J)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:T.value,fill:"none",class:"em-edge__hit"},null,8,Ak),n.createElementVNode("path",{d:T.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,Tk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ce.value,(q,v)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${v}`,d:q,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",xe.value])},null,10,Mk))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ye.value,(q,v)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${v}`,x1:q.x1,y1:q.y1,x2:q.x2,y2:q.y2,class:n.normalizeClass(["em-edge__marker",xe.value])},null,10,Bk))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ve.value,(q,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${v}`,cx:q.cx,cy:q.cy,r:q.r,class:n.normalizeClass(["em-edge__marker",xe.value])},null,10,Dk))),128)),x.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(C).x+8,y:n.unref(C).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(W.value),11,Ok),n.createElementVNode("text",{x:n.unref(h).x-8,y:n.unref(h).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(Q.value),11,Lk)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(S.value,(q,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${v}`,cx:q.point.x,cy:q.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(V=>A(q.segIndex,V),["stop"])},null,42,Pk))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(O.value,(q,v)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${v}`,x:q.x-5,y:q.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:V=>M(v,V),onPointermove:oe,onPointerup:w,onDblclick:V=>j(v,V)},null,42,zk))),128))],64))}}),[["__scopeId","data-v-208ecd02"]]);var Ot=(e=>(e.Lines="lines",e.Dots="dots",e))(Ot||{});const hu=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]}`})},yu=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Ot.Lines+"",Ot.Dots+"";const Uk={[Ot.Dots]:"#81818a",[Ot.Lines]:"#eee"},Fk=["id","x","y","width","height","patternTransform"],Hk={key:2,height:"100",width:"100"},Gk=["fill"],Yk=["x","y","fill"],Wk={name:"Background",compatConfig:{MODE:3}},Kk=n.defineComponent({...Wk,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}=Pe(),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,m]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[f*r||1+d[0]/2,m*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||Uk[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(hu),{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(yu),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",Hk,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Gk)])):n.createCommentVNode("",!0)])],8,Fk)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Yk),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),qk={name:"ControlButton",compatConfig:{MODE:3}},Xk=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},jk={type:"button",class:"vue-flow__controls-button"};function Zk(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",jk,[n.renderSlot(e.$slots,"default")])}const yn=Xk(qk,[["render",Zk]]),Jk={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Qk=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function eE(e,t){return n.openBlock(),n.createElementBlock("svg",Jk,Qk)}const tE={render:eE},nE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},oE=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function iE(e,t){return n.openBlock(),n.createElementBlock("svg",nE,oE)}const aE={render:iE},lE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},rE=[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 sE(e,t){return n.openBlock(),n.createElementBlock("svg",lE,rE)}const cE={render:sE},dE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},uE=[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 fE(e,t){return n.openBlock(),n.createElementBlock("svg",dE,uE)}const mE={render:fE},pE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},hE=[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 yE(e,t){return n.openBlock(),n.createElementBlock("svg",pE,hE)}const gE={render:yE},bE={name:"Controls",compatConfig:{MODE:3}},_E=n.defineComponent({...bE,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Fc.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}=Pe(),m=n.toRef(()=>o.value||i.value||a.value),p=n.toRef(()=>d.value.zoom<=u.value),y=n.toRef(()=>d.value.zoom>=f.value);function b(){r(),t("zoomIn")}function g(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function C(){l(!m.value),t("interactionChange",!m.value)}return(h,E)=>(n.openBlock(),n.createBlock(n.unref(zd),{class:"vue-flow__controls",position:h.position},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"top"),h.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(h.$slots,"control-zoom-in",{},()=>[n.createVNode(yn,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(tE))))])]),_:3},8,["disabled"])]),n.renderSlot(h.$slots,"control-zoom-out",{},()=>[n.createVNode(yn,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(aE))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),h.showFitView?n.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[n.createVNode(yn,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(cE))))])]),_:3})]):n.createCommentVNode("",!0),h.showInteractive?n.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(n.openBlock(),n.createBlock(yn,{key:0,class:"vue-flow__controls-interactive",onClick:C},{default:n.withCtx(()=>[m.value?n.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(gE))))]):n.createCommentVNode("",!0),m.value?n.createCommentVNode("",!0):n.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(mE))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var wE={value:()=>{}};function Ml(){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 Qi(o)}function Qi(e){this._=e}function kE(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}})}Qi.prototype=Ml.prototype={constructor:Qi,on:function(e,t){var o=this._,i=kE(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=EE(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]=gu(o[a],e.name,t);else if(t==null)for(a in o)o[a]=gu(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 Qi(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 EE(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function gu(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=wE,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Bl="http://www.w3.org/1999/xhtml";const bu={svg:"http://www.w3.org/2000/svg",xhtml:Bl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ea(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),bu.hasOwnProperty(t)?{space:bu[t],local:e}:e}function vE(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Bl&&t.documentElement.namespaceURI===Bl?t.createElement(e):t.createElementNS(o,e)}}function NE(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _u(e){var t=ea(e);return(t.local?NE:vE)(t)}function IE(){}function Dl(e){return e==null?IE:function(){return this.querySelector(e)}}function $E(e){typeof e!="function"&&(e=Dl(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 xE(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function SE(){return[]}function wu(e){return e==null?SE:function(){return this.querySelectorAll(e)}}function CE(e){return function(){return xE(e.apply(this,arguments))}}function RE(e){typeof e=="function"?e=CE(e):e=wu(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 ku(e){return function(){return this.matches(e)}}function Eu(e){return function(t){return t.matches(e)}}var VE=Array.prototype.find;function AE(e){return function(){return VE.call(this.children,e)}}function TE(){return this.firstElementChild}function ME(e){return this.select(e==null?TE:AE(typeof e=="function"?e:Eu(e)))}var BE=Array.prototype.filter;function DE(){return Array.from(this.children)}function OE(e){return function(){return BE.call(this.children,e)}}function LE(e){return this.selectAll(e==null?DE:OE(typeof e=="function"?e:Eu(e)))}function PE(e){typeof e!="function"&&(e=ku(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 vu(e){return new Array(e.length)}function zE(){return new ut(this._enter||this._groups.map(vu),this._parents)}function ta(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ta.prototype={constructor:ta,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 UE(e){return function(){return e}}function FE(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 ta(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function HE(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,m=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(m[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 ta(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(m[s])===c&&(a[s]=c)}function GE(e){return e.__data__}function YE(e,t){if(!arguments.length)return Array.from(this,GE);var o=t?HE:FE,i=this._parents,a=this._groups;typeof e!="function"&&(e=UE(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],m=f.length,p=WE(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),g=r[d]=new Array(y),_=c[d]=new Array(m);o(u,f,b,g,_,p,t);for(var C=0,h=0,E,Z;C<y;++C)if(E=b[C]){for(C>=h&&(h=C+1);!(Z=g[h])&&++h<y;);E._next=Z||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function WE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function KE(){return new ut(this._exit||this._groups.map(vu),this._parents)}function qE(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 XE(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,m=s[c]=new Array(f),p,y=0;y<f;++y)(p=d[y]||u[y])&&(m[y]=p);for(;c<a;++c)s[c]=o[c];return new ut(s,this._parents)}function jE(){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 ZE(e){e||(e=JE);function t(f,m){return f&&m?e(f.__data__,m.__data__):!f-!m}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 JE(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function QE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ev(){return Array.from(this)}function tv(){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 nv(){let e=0;for(const t of this)++e;return e}function ov(){return!this.node()}function iv(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 av(e){return function(){this.removeAttribute(e)}}function lv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rv(e,t){return function(){this.setAttribute(e,t)}}function sv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function dv(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 uv(e,t){var o=ea(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?lv:av:typeof t=="function"?o.local?dv:cv:o.local?sv:rv)(o,t))}function Nu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fv(e){return function(){this.style.removeProperty(e)}}function mv(e,t,o){return function(){this.style.setProperty(e,t,o)}}function pv(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function hv(e,t,o){return arguments.length>1?this.each((t==null?fv:typeof t=="function"?pv:mv)(e,t,o??"")):Hn(this.node(),e)}function Hn(e,t){return e.style.getPropertyValue(t)||Nu(e).getComputedStyle(e,null).getPropertyValue(t)}function yv(e){return function(){delete this[e]}}function gv(e,t){return function(){this[e]=t}}function bv(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function _v(e,t){return arguments.length>1?this.each((t==null?yv:typeof t=="function"?bv:gv)(e,t)):this.node()[e]}function Iu(e){return e.trim().split(/^|\s+/)}function Ol(e){return e.classList||new $u(e)}function $u(e){this._node=e,this._names=Iu(e.getAttribute("class")||"")}$u.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 xu(e,t){for(var o=Ol(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Su(e,t){for(var o=Ol(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function wv(e){return function(){xu(this,e)}}function kv(e){return function(){Su(this,e)}}function Ev(e,t){return function(){(t.apply(this,arguments)?xu:Su)(this,e)}}function vv(e,t){var o=Iu(e+"");if(arguments.length<2){for(var i=Ol(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Ev:t?wv:kv)(o,t))}function Nv(){this.textContent=""}function Iv(e){return function(){this.textContent=e}}function $v(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function xv(e){return arguments.length?this.each(e==null?Nv:(typeof e=="function"?$v:Iv)(e)):this.node().textContent}function Sv(){this.innerHTML=""}function Cv(e){return function(){this.innerHTML=e}}function Rv(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Vv(e){return arguments.length?this.each(e==null?Sv:(typeof e=="function"?Rv:Cv)(e)):this.node().innerHTML}function Av(){this.nextSibling&&this.parentNode.appendChild(this)}function Tv(){return this.each(Av)}function Mv(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bv(){return this.each(Mv)}function Dv(e){var t=typeof e=="function"?e:_u(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ov(){return null}function Lv(e,t){var o=typeof e=="function"?e:_u(e),i=t==null?Ov:typeof t=="function"?t:Dl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Pv(){var e=this.parentNode;e&&e.removeChild(this)}function zv(){return this.each(Pv)}function Uv(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fv(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hv(e){return this.select(e?Fv:Uv)}function Gv(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Yv(e){return function(t){e.call(this,t,this.__data__)}}function Wv(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 Kv(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 qv(e,t,o){return function(){var i=this.__on,a,l=Yv(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 Xv(e,t,o){var i=Wv(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?qv:Kv,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Cu(e,t,o){var i=Nu(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 jv(e,t){return function(){return Cu(this,e,t)}}function Zv(e,t){return function(){return Cu(this,e,t.apply(this,arguments))}}function Jv(e,t){return this.each((typeof t=="function"?Zv:jv)(e,t))}function*Qv(){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 Ru=[null];function ut(e,t){this._groups=e,this._parents=t}function Io(){return new ut([[document.documentElement]],Ru)}function eN(){return this}ut.prototype=Io.prototype={constructor:ut,select:$E,selectAll:RE,selectChild:ME,selectChildren:LE,filter:PE,data:YE,enter:zE,exit:KE,join:qE,merge:XE,selection:eN,order:jE,sort:ZE,call:QE,nodes:ev,node:tv,size:nv,empty:ov,each:iv,attr:uv,style:hv,property:_v,classed:vv,text:xv,html:Vv,raise:Tv,lower:Bv,append:Dv,insert:Lv,remove:zv,clone:Hv,datum:Gv,on:Xv,dispatch:Jv,[Symbol.iterator]:Qv};function qt(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],Ru)}function tN(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=tN(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 Ll={capture:!0,passive:!1};function Pl(e){e.preventDefault(),e.stopImmediatePropagation()}function nN(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",Pl,Ll);"onselectstart"in t?o.on("selectstart.drag",Pl,Ll):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function oN(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Pl,Ll),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 zl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Vu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function $o(){}var xo=.7,na=1/xo,Gn="\\s*([+-]?\\d+)\\s*",So="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",$t="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",iN=/^#([0-9a-f]{3,8})$/,aN=new RegExp(`^rgb\\(${Gn},${Gn},${Gn}\\)$`),lN=new RegExp(`^rgb\\(${$t},${$t},${$t}\\)$`),rN=new RegExp(`^rgba\\(${Gn},${Gn},${Gn},${So}\\)$`),sN=new RegExp(`^rgba\\(${$t},${$t},${$t},${So}\\)$`),cN=new RegExp(`^hsl\\(${So},${$t},${$t}\\)$`),dN=new RegExp(`^hsla\\(${So},${$t},${$t},${So}\\)$`),Au={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};zl($o,Co,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Tu,formatHex:Tu,formatHex8:uN,formatHsl:fN,formatRgb:Mu,toString:Mu});function Tu(){return this.rgb().formatHex()}function uN(){return this.rgb().formatHex8()}function fN(){return Pu(this).formatHsl()}function Mu(){return this.rgb().formatRgb()}function Co(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=iN.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Bu(t):o===3?new st(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?oa(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?oa(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=aN.exec(e))?new st(t[1],t[2],t[3],1):(t=lN.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=rN.exec(e))?oa(t[1],t[2],t[3],t[4]):(t=sN.exec(e))?oa(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cN.exec(e))?Lu(t[1],t[2]/100,t[3]/100,1):(t=dN.exec(e))?Lu(t[1],t[2]/100,t[3]/100,t[4]):Au.hasOwnProperty(e)?Bu(Au[e]):e==="transparent"?new st(NaN,NaN,NaN,0):null}function Bu(e){return new st(e>>16&255,e>>8&255,e&255,1)}function oa(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function mN(e){return e instanceof $o||(e=Co(e)),e?(e=e.rgb(),new st(e.r,e.g,e.b,e.opacity)):new st}function Ul(e,t,o,i){return arguments.length===1?mN(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}zl(st,Ul,Vu($o,{brighter(e){return e=e==null?na:Math.pow(na,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xo:Math.pow(xo,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new st(gn(this.r),gn(this.g),gn(this.b),ia(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:Du,formatHex:Du,formatHex8:pN,formatRgb:Ou,toString:Ou}));function Du(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}`}function pN(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}${bn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ou(){const e=ia(this.opacity);return`${e===1?"rgb(":"rgba("}${gn(this.r)}, ${gn(this.g)}, ${gn(this.b)}${e===1?")":`, ${e})`}`}function ia(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bn(e){return e=gn(e),(e<16?"0":"")+e.toString(16)}function Lu(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new gt(e,t,o,i)}function Pu(e){if(e instanceof gt)return new gt(e.h,e.s,e.l,e.opacity);if(e instanceof $o||(e=Co(e)),!e)return new gt;if(e instanceof gt)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 gt(r,s,c,e.opacity)}function hN(e,t,o,i){return arguments.length===1?Pu(e):new gt(e,t,o,i??1)}function gt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}zl(gt,hN,Vu($o,{brighter(e){return e=e==null?na:Math.pow(na,e),new gt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xo:Math.pow(xo,e),new gt(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(Fl(e>=240?e-240:e+120,a,i),Fl(e,a,i),Fl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new gt(zu(this.h),aa(this.s),aa(this.l),ia(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=ia(this.opacity);return`${e===1?"hsl(":"hsla("}${zu(this.h)}, ${aa(this.s)*100}%, ${aa(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zu(e){return e=(e||0)%360,e<0?e+360:e}function aa(e){return Math.max(0,Math.min(1,e||0))}function Fl(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 Uu=e=>()=>e;function yN(e,t){return function(o){return e+o*t}}function gN(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 bN(e){return(e=+e)==1?Fu:function(t,o){return o-t?gN(t,o,e):Uu(isNaN(t)?o:t)}}function Fu(e,t){var o=t-e;return o?yN(e,o):Uu(isNaN(e)?t:e)}const Hu=(function e(t){var o=bN(t);function i(a,l){var r=o((a=Ul(a)).r,(l=Ul(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Fu(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 Hl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gl=new RegExp(Hl.source,"g");function _N(e){return function(){return e}}function wN(e){return function(t){return e(t)+""}}function kN(e,t){var o=Hl.lastIndex=Gl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Hl.exec(e))&&(a=Gl.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=Gl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?wN(c[0].x):_N(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 Gu=180/Math.PI,Yl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yu(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)*Gu,skewX:Math.atan(c)*Gu,scaleX:r,scaleY:s}}var la;function EN(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Yl:Yu(t.a,t.b,t.c,t.d,t.e,t.f)}function vN(e){return e==null||(la||(la=document.createElementNS("http://www.w3.org/2000/svg","g")),la.setAttribute("transform",e),!(e=la.transform.baseVal.consolidate()))?Yl:(e=e.matrix,Yu(e.a,e.b,e.c,e.d,e.e,e.f))}function Wu(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,m,p,y){if(d!==f||u!==m){var b=p.push("translate(",null,t,null,o);y.push({i:b-4,x:jt(d,f)},{i:b-2,x:jt(u,m)})}else(f||m)&&p.push("translate("+f+t+m+o)}function r(d,u,f,m){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),m.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,m){d!==u?m.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,m,p,y){if(d!==f||u!==m){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:jt(d,f)},{i:b-2,x:jt(u,m)})}else(f!==1||m!==1)&&p.push(a(p)+"scale("+f+","+m+")")}return function(d,u){var f=[],m=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,m),r(d.rotate,u.rotate,f,m),s(d.skewX,u.skewX,f,m),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,m),d=u=null,function(p){for(var y=-1,b=m.length,g;++y<b;)f[(g=m[y]).i]=g.x(p);return f.join("")}}}var NN=Wu(EN,"px, ","px)","deg)"),IN=Wu(vN,", ",")",")"),$N=1e-12;function Ku(e){return((e=Math.exp(e))+1/e)/2}function xN(e){return((e=Math.exp(e))-1/e)/2}function SN(e){return((e=Math.exp(2*e))-1)/(e+1)}const CN=(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],m=r[2],p=u-s,y=f-c,b=p*p+y*y,g,_;if(b<$N)_=Math.log(m/d)/t,g=function(G){return[s+G*p,c+G*y,d*Math.exp(t*G*_)]};else{var C=Math.sqrt(b),h=(m*m-d*d+i*b)/(2*d*o*C),E=(m*m-d*d-i*b)/(2*m*o*C),Z=Math.log(Math.sqrt(h*h+1)-h),L=Math.log(Math.sqrt(E*E+1)-E);_=(L-Z)/t,g=function(G){var T=G*_,S=Ku(Z),O=d/(o*C)*(S*SN(t*T+Z)-xN(Z));return[s+O*p,c+O*y,d*S/Ku(t*T+Z)]}}return g.duration=_*1e3*t/Math.SQRT2,g}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 Yn=0,Ro=0,Vo=0,qu=1e3,ra,Ao,sa=0,_n=0,ca=0,To=typeof performance=="object"&&performance.now?performance:Date,Xu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Wl(){return _n||(Xu(RN),_n=To.now()+ca)}function RN(){_n=0}function da(){this._call=this._time=this._next=null}da.prototype=ju.prototype={constructor:da,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Wl():+o)+(t==null?0:+t),!this._next&&Ao!==this&&(Ao?Ao._next=this:ra=this,Ao=this),this._call=e,this._time=o,Kl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kl())}};function ju(e,t,o){var i=new da;return i.restart(e,t,o),i}function VN(){Wl(),++Yn;for(var e=ra,t;e;)(t=_n-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Yn}function Zu(){_n=(sa=To.now())+ca,Yn=Ro=0;try{VN()}finally{Yn=0,TN(),_n=0}}function AN(){var e=To.now(),t=e-sa;t>qu&&(ca-=t,sa=e)}function TN(){for(var e,t=ra,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:ra=o);Ao=e,Kl(i)}function Kl(e){if(!Yn){Ro&&(Ro=clearTimeout(Ro));var t=e-_n;t>24?(e<1/0&&(Ro=setTimeout(Zu,e-To.now()-ca)),Vo&&(Vo=clearInterval(Vo))):(Vo||(sa=To.now(),Vo=setInterval(AN,qu)),Yn=1,Xu(Zu))}}function Ju(e,t,o){var i=new da;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var MN=Ml("start","end","cancel","interrupt"),BN=[],Qu=0,ef=1,ql=2,ua=3,tf=4,Xl=5,fa=6;function ma(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;DN(e,o,{name:t,index:i,group:a,on:MN,tween:BN,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Qu})}function jl(e,t){var o=bt(e,t);if(o.state>Qu)throw new Error("too late; already scheduled");return o}function xt(e,t){var o=bt(e,t);if(o.state>ua)throw new Error("too late; already running");return o}function bt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function DN(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=ju(l,0,o.time);function l(d){o.state=ef,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,m,p;if(o.state!==ef)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===ua)return Ju(r);p.state===tf?(p.state=fa,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=fa,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Ju(function(){o.state===ua&&(o.state=tf,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ql,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ql){for(o.state=ua,a=new Array(m=o.tween.length),u=0,f=-1;u<m;++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=Xl,1),f=-1,m=a.length;++f<m;)a[f].call(e,u);o.state===Xl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=fa,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function pa(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>ql&&i.state<Xl,i.state=fa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function ON(e){return this.each(function(){pa(this,e)})}function LN(e,t){var o,i;return function(){var a=xt(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 PN(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=xt(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 zN(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=bt(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:PN)(o,e,t))}function Zl(e,t,o){var i=e._id;return e.each(function(){var a=xt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return bt(a,i).value[t]}}function nf(e,t){var o;return(typeof t=="number"?jt:t instanceof Co?Hu:(o=Co(t))?(t=o,Hu):kN)(e,t)}function UN(e){return function(){this.removeAttribute(e)}}function FN(e){return function(){this.removeAttributeNS(e.space,e.local)}}function HN(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 GN(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 YN(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 WN(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 KN(e,t){var o=ea(e),i=o==="transform"?IN:nf;return this.attrTween(e,typeof t=="function"?(o.local?WN:YN)(o,i,Zl(this,"attr."+e,t)):t==null?(o.local?FN:UN)(o):(o.local?GN:HN)(o,i,t))}function qN(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function XN(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function jN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&XN(e,l)),o}return a._value=t,a}function ZN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&qN(e,l)),o}return a._value=t,a}function JN(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=ea(e);return this.tween(o,(i.local?jN:ZN)(i,t))}function QN(e,t){return function(){jl(this,e).delay=+t.apply(this,arguments)}}function eI(e,t){return t=+t,function(){jl(this,e).delay=t}}function tI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?QN:eI)(t,e)):bt(this.node(),t).delay}function nI(e,t){return function(){xt(this,e).duration=+t.apply(this,arguments)}}function oI(e,t){return t=+t,function(){xt(this,e).duration=t}}function iI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nI:oI)(t,e)):bt(this.node(),t).duration}function aI(e,t){if(typeof t!="function")throw new Error;return function(){xt(this,e).ease=t}}function lI(e){var t=this._id;return arguments.length?this.each(aI(t,e)):bt(this.node(),t).ease}function rI(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;xt(this,e).ease=o}}function sI(e){if(typeof e!="function")throw new Error;return this.each(rI(this._id,e))}function cI(e){typeof e!="function"&&(e=ku(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 dI(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),m,p=0;p<u;++p)(m=c[p]||d[p])&&(f[p]=m);for(;s<i;++s)r[s]=t[s];return new Lt(r,this._parents,this._name,this._id)}function uI(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 fI(e,t,o){var i,a,l=uI(t)?jl:xt;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function mI(e,t){var o=this._id;return arguments.length<2?bt(this.node(),o).on.on(e):this.each(fI(o,e,t))}function pI(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function hI(){return this.on("end.remove",pI(this._id))}function yI(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Dl(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,m=0;m<c;++m)(u=s[m])&&(f=e.call(u,u.__data__,m,s))&&("__data__"in u&&(f.__data__=u.__data__),d[m]=f,ma(d[m],t,o,m,d,bt(u,o)));return new Lt(l,this._parents,t,o)}function gI(e){var t=this._name,o=this._id;typeof e!="function"&&(e=wu(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 m=e.call(u,u.__data__,f,c),p,y=bt(u,o),b=0,g=m.length;b<g;++b)(p=m[b])&&ma(p,t,o,b,m,y);l.push(m),r.push(u)}return new Lt(l,r,t,o)}var bI=Io.prototype.constructor;function _I(){return new bI(this._groups,this._parents)}function wI(e,t){var o,i,a;return function(){var l=Hn(this,e),r=(this.style.removeProperty(e),Hn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function of(e){return function(){this.style.removeProperty(e)}}function kI(e,t,o){var i,a=o+"",l;return function(){var r=Hn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function EI(e,t,o){var i,a,l;return function(){var r=Hn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Hn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function vI(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=xt(this,e),d=c.on,u=c.value[l]==null?s||(s=of(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function NI(e,t,o){var i=(e+="")=="transform"?NN:nf;return t==null?this.styleTween(e,wI(e,i)).on("end.style."+e,of(e)):typeof t=="function"?this.styleTween(e,EI(e,i,Zl(this,"style."+e,t))).each(vI(this._id,e)):this.styleTween(e,kI(e,i,t),o).on("end.style."+e,null)}function II(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function $I(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&II(e,r,o)),i}return l._value=t,l}function xI(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,$I(e,t,o??""))}function SI(e){return function(){this.textContent=e}}function CI(e){return function(){var t=e(this);this.textContent=t??""}}function RI(e){return this.tween("text",typeof e=="function"?CI(Zl(this,"text",e)):SI(e==null?"":e+""))}function VI(e){return function(t){this.textContent=e.call(this,t)}}function AI(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&VI(a)),t}return i._value=e,i}function TI(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,AI(e))}function MI(){for(var e=this._name,t=this._id,o=af(),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=bt(c,t);ma(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 BI(){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=xt(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 DI=0;function Lt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function af(){return++DI}var Pt=Io.prototype;Lt.prototype={constructor:Lt,select:yI,selectAll:gI,selectChild:Pt.selectChild,selectChildren:Pt.selectChildren,filter:cI,merge:dI,selection:_I,transition:MI,call:Pt.call,nodes:Pt.nodes,node:Pt.node,size:Pt.size,empty:Pt.empty,each:Pt.each,on:mI,attr:KN,attrTween:JN,style:NI,styleTween:xI,text:RI,textTween:TI,remove:hI,tween:zN,delay:tI,duration:iI,ease:lI,easeVarying:sI,end:BI,[Symbol.iterator]:Pt[Symbol.iterator]};function OI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var LI={time:null,delay:0,duration:250,ease:OI};function PI(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 zI(e){var t,o;e instanceof Lt?(t=e._id,e=e._name):(t=af(),(o=LI).time=Wl(),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])&&ma(c,e,t,d,r,o||PI(c,t));return new Lt(i,this._parents,e,t)}Io.prototype.interrupt=ON,Io.prototype.transition=zI;const ha=e=>()=>e;function UI(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 Jl=new zt(1,0,0);zt.prototype;function Ql(e){e.stopImmediatePropagation()}function Mo(e){e.preventDefault(),e.stopImmediatePropagation()}function FI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function HI(){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 lf(){return this.__zoom||Jl}function GI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function YI(){return navigator.maxTouchPoints||"ontouchstart"in this}function WI(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 KI(){var e=FI,t=HI,o=WI,i=GI,a=YI,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=CN,d=Ml("start","zoom","end"),u,f,m,p=500,y=150,b=0,g=10;function _(w){w.property("__zoom",lf).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",O).filter(a).on("touchstart.zoom",te).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,j,A,W){var Q=w.selection?w.selection():w;Q.property("__zoom",lf),w!==Q?Z(w,j,A,W):Q.interrupt().each(function(){L(this,arguments).event(W).start().zoom(null,typeof j=="function"?j.apply(this,arguments):j).end()})},_.scaleBy=function(w,j,A,W){_.scaleTo(w,function(){var Q=this.__zoom.k,ee=typeof j=="function"?j.apply(this,arguments):j;return Q*ee},A,W)},_.scaleTo=function(w,j,A,W){_.transform(w,function(){var Q=t.apply(this,arguments),ee=this.__zoom,x=A==null?E(Q):typeof A=="function"?A.apply(this,arguments):A,X=ee.invert(x),le=typeof j=="function"?j.apply(this,arguments):j;return o(h(C(ee,le),x,X),Q,r)},A,W)},_.translateBy=function(w,j,A,W){_.transform(w,function(){return o(this.__zoom.translate(typeof j=="function"?j.apply(this,arguments):j,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),r)},null,W)},_.translateTo=function(w,j,A,W,Q){_.transform(w,function(){var ee=t.apply(this,arguments),x=this.__zoom,X=W==null?E(ee):typeof W=="function"?W.apply(this,arguments):W;return o(Jl.translate(X[0],X[1]).scale(x.k).translate(typeof j=="function"?-j.apply(this,arguments):-j,typeof A=="function"?-A.apply(this,arguments):-A),ee,r)},W,Q)};function C(w,j){return j=Math.max(l[0],Math.min(l[1],j)),j===w.k?w:new zt(j,w.x,w.y)}function h(w,j,A){var W=j[0]-A[0]*w.k,Q=j[1]-A[1]*w.k;return W===w.x&&Q===w.y?w:new zt(w.k,W,Q)}function E(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function Z(w,j,A,W){w.on("start.zoom",function(){L(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){L(this,arguments).event(W).end()}).tween("zoom",function(){var Q=this,ee=arguments,x=L(Q,ee).event(W),X=t.apply(Q,ee),le=A==null?E(X):typeof A=="function"?A.apply(Q,ee):A,pe=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),be=Q.__zoom,de=typeof j=="function"?j.apply(Q,ee):j,me=c(be.invert(le).concat(pe/be.k),de.invert(le).concat(pe/de.k));return function(ye){if(ye===1)ye=de;else{var ve=me(ye),Ce=pe/ve[2];ye=new zt(Ce,le[0]-ve[0]*Ce,le[1]-ve[1]*Ce)}x.zoom(null,ye)}})}function L(w,j,A){return!A&&w.__zooming||new G(w,j)}function G(w,j){this.that=w,this.args=j,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,j),this.taps=0}G.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,j){return this.mouse&&w!=="mouse"&&(this.mouse[1]=j.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=j.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=j.invert(this.touch1[0])),this.that.__zoom=j,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var j=qt(this.that).datum();d.call(w,this.that,new UI(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),j)}};function T(w,...j){if(!e.apply(this,arguments))return;var A=L(this,j).event(w),W=this.__zoom,Q=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,i.apply(this,arguments)))),ee=Xt(w);if(A.wheel)(A.mouse[0][0]!==ee[0]||A.mouse[0][1]!==ee[1])&&(A.mouse[1]=W.invert(A.mouse[0]=ee)),clearTimeout(A.wheel);else{if(W.k===Q)return;A.mouse=[ee,W.invert(ee)],pa(this),A.start()}Mo(w),A.wheel=setTimeout(x,y),A.zoom("mouse",o(h(C(W,Q),A.mouse[0],A.mouse[1]),A.extent,r));function x(){A.wheel=null,A.end()}}function S(w,...j){if(m||!e.apply(this,arguments))return;var A=w.currentTarget,W=L(this,j,!0).event(w),Q=qt(w.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",pe,!0),ee=Xt(w,A),x=w.clientX,X=w.clientY;nN(w.view),Ql(w),W.mouse=[ee,this.__zoom.invert(ee)],pa(this),W.start();function le(be){if(Mo(be),!W.moved){var de=be.clientX-x,me=be.clientY-X;W.moved=de*de+me*me>b}W.event(be).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=Xt(be,A),W.mouse[1]),W.extent,r))}function pe(be){Q.on("mousemove.zoom mouseup.zoom",null),oN(be.view,W.moved),Mo(be),W.event(be).end()}}function O(w,...j){if(e.apply(this,arguments)){var A=this.__zoom,W=Xt(w.changedTouches?w.changedTouches[0]:w,this),Q=A.invert(W),ee=A.k*(w.shiftKey?.5:2),x=o(h(C(A,ee),W,Q),t.apply(this,j),r);Mo(w),s>0?qt(this).transition().duration(s).call(Z,x,W,w):qt(this).call(_.transform,x,W,w)}}function te(w,...j){if(e.apply(this,arguments)){var A=w.touches,W=A.length,Q=L(this,j,w.changedTouches.length===W).event(w),ee,x,X,le;for(Ql(w),x=0;x<W;++x)X=A[x],le=Xt(X,this),le=[le,this.__zoom.invert(le),X.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==le[2]&&(Q.touch1=le,Q.taps=0):(Q.touch0=le,ee=!0,Q.taps=1+!!u);u&&(u=clearTimeout(u)),ee&&(Q.taps<2&&(f=le[0],u=setTimeout(function(){u=null},p)),pa(this),Q.start())}}function M(w,...j){if(this.__zooming){var A=L(this,j).event(w),W=w.changedTouches,Q=W.length,ee,x,X,le;for(Mo(w),ee=0;ee<Q;++ee)x=W[ee],X=Xt(x,this),A.touch0&&A.touch0[2]===x.identifier?A.touch0[0]=X:A.touch1&&A.touch1[2]===x.identifier&&(A.touch1[0]=X);if(x=A.that.__zoom,A.touch1){var pe=A.touch0[0],be=A.touch0[1],de=A.touch1[0],me=A.touch1[1],ye=(ye=de[0]-pe[0])*ye+(ye=de[1]-pe[1])*ye,ve=(ve=me[0]-be[0])*ve+(ve=me[1]-be[1])*ve;x=C(x,Math.sqrt(ye/ve)),X=[(pe[0]+de[0])/2,(pe[1]+de[1])/2],le=[(be[0]+me[0])/2,(be[1]+me[1])/2]}else if(A.touch0)X=A.touch0[0],le=A.touch0[1];else return;A.zoom("touch",o(h(x,X,le),A.extent,r))}}function oe(w,...j){if(this.__zooming){var A=L(this,j).event(w),W=w.changedTouches,Q=W.length,ee,x;for(Ql(w),m&&clearTimeout(m),m=setTimeout(function(){m=null},p),ee=0;ee<Q;++ee)x=W[ee],A.touch0&&A.touch0[2]===x.identifier?delete A.touch0:A.touch1&&A.touch1[2]===x.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(x=Xt(x,this),Math.hypot(f[0]-x[0],f[1]-x[1])<g)){var X=qt(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:ha(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:ha(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:ha(!!w),_):a},_.extent=function(w){return arguments.length?(t=typeof w=="function"?w:ha([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):t},_.scaleExtent=function(w){return arguments.length?(l[0]=+w[0],l[1]=+w[1],_):[l[0],l[1]]},_.translateExtent=function(w){return arguments.length?(r[0][0]=+w[0][0],r[1][0]=+w[1][0],r[0][1]=+w[0][1],r[1][1]=+w[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,_):Math.sqrt(b)},_.tapDistance=function(w){return arguments.length?(g=+w,_):g},_}const rf=Symbol("MiniMapSlots"),qI=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],XI={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},jI=n.defineComponent({...XI,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(rf),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,m)=>!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,qI))],64)):n.createCommentVNode("",!0)}}),ZI=["width","height","viewBox","aria-labelledby"],JI=["id"],QI=["d","fill","stroke","stroke-width"],e$={name:"MiniMap",compatConfig:{MODE:3}},t$=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:m,d3Zoom:p,getNodesInitialized:y}=Pe(),b=n.ref();n.provide(rf,o);const g=n.toRef(()=>{var Q;return e.width??((Q=i.style)==null?void 0:Q.width)??a}),_=n.toRef(()=>{var Q;return e.height??((Q=i.style)==null?void 0:Q.height)??l}),C=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),E=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),Z=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),L=n.computed(()=>ml(y.value.filter(Q=>!Q.hidden))),G=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})),T=n.computed(()=>y.value&&y.value.length?Rb(L.value,G.value):G.value),S=n.computed(()=>{const Q=T.value.width/g.value,ee=T.value.height/_.value;return Math.max(Q,ee)}),O=n.computed(()=>{const Q=S.value*g.value,ee=S.value*_.value,x=e.offsetScale*S.value;return{offset:x,x:T.value.x-(Q-T.value.width)/2-x,y:T.value.y-(ee-T.value.height)/2-x,width:Q+x*2,height:ee+x*2}}),te=n.computed(()=>!O.value.x||!O.value.y?"":`
30
+ M${O.value.x-O.value.offset},${O.value.y-O.value.offset}
31
+ h${O.value.width+O.value.offset*2}
32
+ v${O.value.height+O.value.offset*2}
33
+ h${-O.value.width-O.value.offset*2}z
34
+ M${G.value.x+e.maskBorderRadius},${G.value.y}
35
+ h${G.value.width-2*e.maskBorderRadius}
36
36
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
37
- v${P.value.height-2*e.maskBorderRadius}
37
+ v${G.value.height-2*e.maskBorderRadius}
38
38
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
39
- h${-(P.value.width-2*e.maskBorderRadius)}
39
+ h${-(G.value.width-2*e.maskBorderRadius)}
40
40
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
41
- v${-(P.value.height-2*e.maskBorderRadius)}
42
- a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(F=>{if(g.value){const le=qt(g.value),$=pe=>{if(pe.sourceEvent.type!=="wheel"||!h.value||!p.value)return;const ye=pe.sourceEvent.ctrlKey&&wo()?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)},X=pe=>{if(pe.sourceEvent.type!=="mousemove"||!h.value||!p.value)return;const ye=O.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=ql.translate(ue.x,ue.y).scale(c.value.zoom),Ee=p.value.constrain()(ge,fe,d.value);p.value.transform(h.value,Ee)},re=$$().wheelDelta(pe=>dl(pe)*(e.zoomStep/10)).on("zoom",e.pannable?X:()=>{}).on("zoom.wheel",e.zoomable?$:()=>{});le.call(re),F(()=>{le.on("zoom",null)})}},{flush:"post"});function z(F){const[le,$]=Xt(F);t("click",{event:F,position:{x:le,y:$}})}function oe(F,le){const $={event:F,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeClick($),t("nodeClick",$)}function k(F,le){const $={event:F,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeDoubleClick($),t("nodeDblclick",$)}function W(F,le){const $={event:F,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseEnter($),t("nodeMouseenter",$)}function R(F,le){const $={event:F,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseMove($),t("nodeMousemove",$)}function G(F,le){const $={event:F,node:le,connectedEdges:cn([le],s.value)};f.miniMapNodeMouseLeave($),t("nodeMouseleave",$)}return(F,le)=>(n.openBlock(),n.createBlock(n.unref(Bd),{position:F.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:F.pannable,zoomable:F.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:y.value,height:_.value,viewBox:[H.value.x,H.value.y,H.value.width,H.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:z},[F.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(F.ariaLabel),9,R$)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(m),$=>(n.openBlock(),n.createBlock(S$,{id:$.id,key:$.id,f:"",position:$.computedPosition,dimensions:$.dimensions,selected:$.selected,dragging:$.dragging,style:n.normalizeStyle($.style),class:n.normalizeClass(te.value($)),color:b.value($),"border-radius":F.nodeBorderRadius,"stroke-color":v.value($),"stroke-width":F.nodeStrokeWidth,"shape-rendering":n.unref(A),type:$.type,hidden:$.hidden,onClick:X=>oe(X,$),onDblclick:X=>k(X,$),onMouseenter:X=>W(X,$),onMousemove:X=>R(X,$),onMouseleave:X=>G(X,$)},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:de.value,fill:F.maskColor,stroke:F.maskStrokeColor,"stroke-width":F.maskStrokeWidth,"fill-rule":"evenodd"},null,8,V$)],8,C$))]),_:1},8,["position","class"]))}}),M$=["d"],B$=["cx","cy","onDblclick"],D$=["x","y","onPointerdown","onDblclick"],O$=Ue(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=ze(),i=n.inject(Cl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Un,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((x,O)=>O===d.value?u.value:x)),{source:h,target:p,sourceSide:m,targetSide:g}=su({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),y=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?ya(h.value,m.value,f.value,p.value,g.value):ba(h.value,f.value,p.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ga(h.value,m.value,f.value,p.value,g.value):wa(h.value,f.value,p.value).map((x,O)=>({point:x,segIndex:O})):[]),A=n.computed(()=>l.value?f.value:[]);function b(x,O){d.value=x,u.value={...c.value[x]},O.target.setPointerCapture(O.pointerId),O.stopPropagation()}function v(x){if(d.value<0)return;const O=o({x:x.clientX,y:x.clientY});u.value={x:O.x,y:O.y}}function te(x){var O,H;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(H=(O=x.target).releasePointerCapture)==null||H.call(O,x.pointerId)}function I(x,O){O.stopPropagation(),i==null||i.removePoint(t.id,x)}function P(x,O){if(!i)return;const H=o({x:O.clientX,y:O.clientY});i.insertPoint(t.id,x,{x:H.x,y:H.y})}return(x,O)=>(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,M$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(H,de)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${de}`,cx:H.point.x,cy:H.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(z=>P(H.segIndex,z),["stop"])},null,42,B$))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(A.value,(H,de)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${de}`,x:H.x-5,y:H.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:z=>b(de,z),onPointermove:v,onPointerup:te,onDblclick:z=>I(de,z)},null,42,D$))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),L$=["data-theme"],P$={key:0,class:"em-ctx__sep",role:"separator"},z$={key:1,class:"em-ctx__swatches"},U$={class:"em-ctx__swatches-label"},F$={class:"em-ctx__chips"},H$=["onClick"],G$=["title","onClick"],Y$=["disabled","onClick"],W$={class:"em-ctx__icon"},K$={class:"em-ctx__caption"},q$=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 g=l.value;if(!g)return;const y=g.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,(g,y)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:y},[g.type==="separator"?(n.openBlock(),n.createElementBlock("div",P$)):g.type==="swatches"?(n.openBlock(),n.createElementBlock("div",z$,[n.createElementVNode("span",U$,n.toDisplayString(g.caption),1),n.createElementVNode("div",F$,[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,H$),(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(Ln)(_)}),title:n.unref(On)(_),onClick:A=>h(g,_)},null,14,G$))),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",W$,[g.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:g.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",K$,n.toDisplayString(g.caption),1)],10,Y$))],64))),128))],36)],8,L$)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),jl=[".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 Yn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function X$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function j$(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 g=t(m.left,m.top+m.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 p=()=>{const m=d.trim();if(m){const g=t(f,(u+h)/2);c.push({...i,x:g.x,y:g.y,text:m})}d=""};for(let m=0;m<s.length;m++){a.setStart(l,m),a.setEnd(l,m+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(p(),u=g.top,f=g.left,h=g.bottom,d=s[m]):(d+=s[m],h=Math.max(h,g.bottom))}return p(),c}function ma(e,t){const o=[];for(const i of e.querySelectorAll("*"))X$(i)&&(i.closest(jl)||Yn(i)&&o.push(...j$(i,t)));return o}function To(e){return Math.round(e*100)/100}function Z$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(jl)||!Yn(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="${To(l.x)}" y="${To(l.y)}" width="${To(r.x-l.x)}" height="${To(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 J$(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Yn(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=>To(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 nf(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(jl)||!Yn(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 Mo(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 Zl(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 Q$(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||!Yn(m))continue;const g=m.firstElementChild;if(g)if(p.type==="group"){const y=Mo(g,o);Zl(s,y),i.push({...y,texts:[]});const _=g.querySelector(".em-group__label");_&&i.push({...Mo(_,o),stroke:"none",texts:[]}),i.push({...y,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ma(g,o)})}else if(p.type==="note"){const y={...Mo(g,o),texts:ma(g,o),lines:nf(g,g,o)};Zl(s,y),l.push(y)}else{const y=Mo(g,o);Zl(s,y);const _=y.radius??{tl:0,tr:0};a.push({...y,stroke:"none",texts:[]});const A=g.querySelector(".em-entity__header");if(A){const b=Mo(A,o);a.push({x:y.x,y:y.y,w:y.w,h:b.y+b.h-y.y,fill:b.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:ma(g,o),lines:nf(g,g,o),icons:Z$(g,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||!Yn(m))continue;const g=m.getAttribute("d");if(!g)continue;const y=getComputedStyle(m),_=y.strokeDasharray,A=J$(p);r.push({d:g,stroke:y.stroke,strokeWidth:parseFloat(y.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:ma(p,o),markers:A.length?A: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 Jl(e){return mr(Q$(e))}function of(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 af(e,t="diagram.svg"){const o=Jl(e);of(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function ex(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 lf(e,t="diagram.png",o=2){const i=Jl(e),{w:a,h:l}=ex(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 변환 실패");of(u,t)}finally{URL.revokeObjectURL(r)}}const tx={class:"em-shortcuts"},nx={class:"em-shortcuts__title"},ox={class:"em-shortcuts__keys"},ix={class:"em-shortcuts__kbd"},ax={key:0,class:"em-shortcuts__plus"},lx={class:"em-shortcuts__desc"},rx={class:"em-shortcuts__actions"},rf=Ue(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ae.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(ae.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",tx,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",nx,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",ox,[(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",ix,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",ax,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",lx,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",rx,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function sx(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const cx={key:0,class:"em-canvas__empty","aria-hidden":"true"},dx={key:1,class:"em-canvas__empty-title"},ux={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},fx={class:"em-conflict-banner__body"},mx={class:"em-conflict-banner__title"},px={class:"em-conflict-banner__detail"},hx={key:0,class:"em-toast",role:"status","aria-live":"polite"},Ql="nc:",sf=Ue(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,E=>{E&&(l.value=E.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>sx(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f(E){u.x=E.clientX,u.y=E.clientY}const h=n.ref(null);n.provide(Ki,h);const p=n.ref(null);n.provide(Wd,p);const m=n.ref(null),g=n.computed(()=>{const E=m.value,D=new Set;if(!E)return D;if(E.kind==="entity")D.add(E.id);else if(E.kind==="group"){const ce=i.resolved.value.groups.find(V=>V.group.modelId===E.id);for(const V of(ce==null?void 0:ce.group.memberEntityRefs)??[])D.add(V)}return D}),y=n.computed(()=>{const E=m.value,D=new Set(g.value),ce=new Set,V=new Set;if(!E)return{related:D,edges:ce,notes:V};if(E.kind==="note"){V.add(E.id);for(const B of i.resolved.value.noteConnections)B.noteRef===E.id&&D.add(B.targetRef);return{related:D,edges:ce,notes:V}}const q=g.value;if(!q.size)return{related:D,edges:ce,notes:V};for(const B of i.resolved.value.associations){const{end1:j,end2:ke}=B.association;(q.has(j.entityRef)||q.has(ke.entityRef))&&(ce.add(B.association.modelId),D.add(j.entityRef),D.add(ke.entityRef))}for(const B of i.resolved.value.noteConnections)D.has(B.targetRef)&&V.add(B.noteRef);return{related:D,edges:ce,notes:V}});n.provide(Un,{source:m,active:n.computed(()=>m.value!==null),primaryEntityIds:g,relatedEntityIds:n.computed(()=>y.value.related),relatedEdgeIds:n.computed(()=>y.value.edges),relatedNoteIds:n.computed(()=>y.value.notes),hoverGroupId:n.computed(()=>{var E;return((E=m.value)==null?void 0:E.kind)==="group"?m.value.id:null}),setEntityHover:E=>{p.value||d.value||(m.value=E?{kind:"entity",id:E}:null)},setGroupHover:E=>{p.value||d.value||(m.value=E?{kind:"group",id:E}:null)},setNoteHover:E=>{p.value||d.value||(m.value=E?{kind:"note",id:E}:null)}}),n.provide(pn,i);function _(E,D){return`${Ql}${E}:${D}`}function A(E){if(!E.startsWith(Ql))return null;const[D,ce]=E.slice(Ql.length).split(":");return D&&ce?{noteRef:D,targetRef:ce}:null}n.provide(Cl,{points:E=>{var ce,V;const D=A(E);return D?((ce=i.resolved.value.noteConnections.find(q=>q.noteRef===D.noteRef&&q.targetRef===D.targetRef))==null?void 0:ce.waypoints)??[]:((V=i.resolved.value.associations.find(q=>q.association.modelId===E))==null?void 0:V.waypoints)??[]},movePoint:(E,D,ce)=>{const V=A(E);V?i.moveNoteConnectionWaypoint(V.noteRef,V.targetRef,D,ce):i.moveWaypoint(E,D,ce)},insertPoint:(E,D,ce)=>{const V=A(E);V?i.addNoteConnectionWaypoint(V.noteRef,V.targetRef,D,ce):i.addWaypoint(E,D,ce)},removePoint:(E,D)=>{const ce=A(E);ce?i.removeNoteConnectionWaypoint(ce.noteRef,ce.targetRef,D):i.removeWaypoint(E,D)}});const b=ze(),{nodes:v,edges:te,findNode:I,findEdge:P,addNodes:x,addEdges:O,removeNodes:H,removeEdges:de,fitView:z,setCenter:oe,getViewport:k,screenToFlowCoordinate:W,getSelectedNodes:R,updateNodeInternals:G}=b,F=n.ref(!1);async function le(E){F.value=!0,await n.nextTick(),await new Promise(D=>requestAnimationFrame(()=>D(null)));try{return await E()}finally{F.value=!1}}function $(){return le(()=>af(b))}function X(){return le(()=>lf(b))}t({exportSvg:$,exportPng:X});const re=n.computed(()=>i.resolved.value.entities.length===0);function pe(){const E=k(),{width:D,height:ce}=b.dimensions.value;return{x:(D/2-E.x)/E.zoom,y:(ce/2-E.y)/E.zoom}}function ye(){const E=pe();i.addEntity("NewEntity",{x:E.x,y:E.y})}function ue(){const E=pe();i.addNote("메모",{x:E.x,y:E.y})}function fe(E){for(const D of i.resolved.value.groups){const{location:ce,size:V}=D.geo;if(E.x>=ce.x&&E.x<=ce.x+V.width&&E.y>=ce.y&&E.y<=ce.y+V.height)return D.group.modelId}return null}function ge(){const E=i.resolved.value,D=new Map(E.groups.map(j=>[j.group.modelId,j.geo])),ce=new Set(E.groups.map(j=>j.group.modelId)),V=new Set([...ce,...E.entities.map(j=>j.entity.modelId),...E.notes.map(j=>j.note.modelId)]);for(const j of[...v.value])V.has(j.id)||H([j.id]);for(const j of E.groups){const ke=j.group.modelId,De={width:`${j.geo.size.width}px`,height:`${j.geo.size.height}px`},Le={group:j.group,style:j.style,locked:j.locked},Pe=j.locked?!1:void 0,Fe=I(ke);Fe?(Fe.position={...j.geo.location},Fe.data=Le,Fe.style=De,Fe.draggable=Pe):x([{id:ke,type:"group",position:{...j.geo.location},draggable:Pe,style:De,data:Le}])}for(const j of E.entities){const ke=j.entity.modelId,De=j.groupRef&&ce.has(j.groupRef)?j.groupRef:void 0,Le={entity:j.entity,displayMode:i.displayMode.value,collapsed:j.collapsed,locked:j.locked,groupRef:De,size:j.geo.size,style:j.style,attributeStyles:j.attributeStyles,operationStyles:j.operationStyles},Pe=j.locked?!1:void 0,Fe=De?D.get(De):void 0,et=Fe?{x:j.geo.location.x-Fe.location.x,y:j.geo.location.y-Fe.location.y}:{...j.geo.location},Ye=I(ke);Ye?(Ye.position=et,Ye.data=Le,Ye.parentNode=De,Ye.draggable=Pe):x([{id:ke,type:"entity",position:et,parentNode:De,draggable:Pe,data:Le}])}for(const j of E.notes){const ke=j.note,De=ke.modelId,Le=j.groupRef&&ce.has(j.groupRef)?j.groupRef:void 0,Pe={note:ke,groupRef:Le},Fe={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=I(De);Ke?(Ke.position=Ye,Ke.data=Pe,Ke.style=Fe,Ke.parentNode=Le):x([{id:De,type:"note",position:Ye,parentNode:Le,style:Fe,data:Pe}])}const q=new Map(E.associations.map(j=>[j.association.modelId,j])),B=new Set(E.noteConnections.map(j=>_(j.noteRef,j.targetRef)));for(const j of[...te.value])!q.has(j.id)&&!B.has(j.id)&&de([j.id]);for(const[j,ke]of q){const De={id:j,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=P(j);Le?(Le.data=De.data,Le.sourceHandle=De.sourceHandle,Le.targetHandle=De.targetHandle):O([De])}for(const j of E.noteConnections){const ke=_(j.noteRef,j.targetRef),De={noteRef:j.noteRef,targetRef:j.targetRef},Le=P(ke);Le?Le.data=De:O([{id:ke,type:"note-connection",source:j.noteRef,target:j.targetRef,data:De}])}Ee()}function Ee(){n.nextTick(()=>requestAnimationFrame(()=>G()))}function Re(){const E=R.value.map(ce=>ce.id);if(E.length)return E;const D=i.selection.value;return D&&(D.kind==="entity"||D.kind==="note"||D.kind==="group")?[D.id]:[]}function Ie(E){var q;const D=E.target;if(D&&(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable))return;if(E.key==="?"){a.openModal({component:rf}),E.preventDefault();return}if(!i.editable.value){(E.metaKey||E.ctrlKey)&&E.key.toLowerCase()==="c"&&(i.copy(),E.preventDefault());return}if(E.key==="Delete"||E.key==="Backspace"){i.deleteSelection()&&E.preventDefault();return}if(E.key==="ArrowUp"||E.key==="ArrowDown"||E.key==="ArrowLeft"||E.key==="ArrowRight"){if(((q=i.selection.value)==null?void 0:q.kind)==="attribute"){if(E.key==="ArrowUp"||E.key==="ArrowDown"){const De=E.key==="ArrowDown"?1:-1;(E.altKey?i.nudgeSelectedAttributes(De):i.moveAttributeFocus(De))&&E.preventDefault()}return}const B=E.shiftKey?10:1,j=E.key==="ArrowLeft"?-B:E.key==="ArrowRight"?B:0,ke=E.key==="ArrowUp"?-B:E.key==="ArrowDown"?B:0;i.nudgeNodes(Re(),j,ke)&&E.preventDefault();return}if(!(E.metaKey||E.ctrlKey))return;const V=E.key.toLowerCase();V==="c"?(i.copy(),E.preventDefault()):V==="v"?(i.paste(),E.preventDefault()):V==="z"&&(E.shiftKey?i.redo():i.undo(),E.preventDefault())}n.onMounted(async()=>{ge(),await n.nextTick(),z(),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 Z(){d.value=!0,m.value=null}function K(){var V;d.value=!1;const E=(V=document.elementFromPoint(u.x,u.y))==null?void 0:V.closest(".vue-flow__node"),D=E==null?void 0:E.dataset.id;if(!D){m.value=null;return}const ce=E.classList.contains("vue-flow__node-group")?"group":E.classList.contains("vue-flow__node-note")?"note":"entity";m.value={kind:ce,id:D}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ge),n.watch(()=>i.revision.value,Ee),n.watch(()=>i.resolved.value,E=>{const D=m.value;if(!D)return;(D.kind==="entity"?E.entities.some(V=>V.entity.modelId===D.id):D.kind==="group"?E.groups.some(V=>V.group.modelId===D.id):E.notes.some(V=>V.note.modelId===D.id))||(m.value=null)});function w(E){const D=E.computedPosition??E.position,ce=E.dimensions??{width:0,height:0};return{x:D.x+ce.width/2,y:D.y+ce.height/2}}function S(E){const D=E.node;if(D){if(m.value=null,D.type==="group"){const ce=i.resolved.value.groups.find(V=>V.group.modelId===D.id);p.value=ce?{groupId:D.id,dx:D.position.x-ce.geo.location.x,dy:D.position.y-ce.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(E){var V;h.value=null,p.value=null;const D=(V=E.nodes)!=null&&V.length?E.nodes:[E.node],ce=D.filter(q=>(q==null?void 0:q.type)==="group");if(ce.length){for(const q of ce){if(!q)continue;const B=i.resolved.value.entities.filter(j=>j.groupRef===q.id).map(j=>{const ke=I(j.entity.modelId),De=(ke==null?void 0:ke.computedPosition)??(ke==null?void 0:ke.position)??{x:0,y:0};return{id:j.entity.modelId,location:{x:De.x,y:De.y}}});i.dragGroup(q.id,{x:q.position.x,y:q.position.y},B)}return}for(const q of D){if(!q||q.type==="group")continue;const B=q.computedPosition??q.position,j=q.dimensions??{width:0,height:0},ke={x:B.x+j.width/2,y:B.y+j.height/2};q.type==="note"?i.dropNote(q.id,{x:B.x,y:B.y},fe(ke)):i.dropEntity(q.id,{x:B.x,y:B.y},fe(ke))}}function Y(E){var De,Le,Pe,Fe,et;if(!i.editable.value||!E.source||!E.target)return;const D=((De=I(E.source))==null?void 0:De.type)==="note",ce=((Le=I(E.target))==null?void 0:Le.type)==="note";if(D||ce){if(D&&ce)return;const Ye=D?E.source:E.target,Ke=D?E.target:E.source;((Pe=I(Ke))==null?void 0:Pe.type)==="entity"&&i.addNoteConnection(Ye,Ke);return}const V=Ye=>{var Ke;return(Ke=i.state.logical.entities.find(je=>je.modelId===Ye))==null?void 0:Ke.stereotype},q=V(E.source)==="JPA_EMBEDDABLE",B=V(E.target)==="JPA_EMBEDDABLE";if(q||B){if(q&&B)return;const Ye=q?E.source:E.target,Ke=q?E.target:E.source;i.addEmbedAssociation(Ke,Ye);return}const j=(Fe=E.sourceHandle)!=null&&Fe.startsWith("r:")?E.sourceHandle.slice(2):void 0,ke=(et=E.targetHandle)!=null&&et.startsWith("l:")?E.targetHandle.slice(2):void 0;i.addAssociation(E.source,E.target,j,ke)}const ee=n.ref(null);function be(E,D){var V;const ce=i.state.layout.entityLayouts.find(q=>q.entityRef===E);return at((V=ce==null?void 0:ce.attributeStyles)==null?void 0:V[D])}function we(E,D){var V;const ce=i.state.layout.entityLayouts.find(q=>q.entityRef===E);return at((V=ce==null?void 0:ce.operationStyles)==null?void 0:V[D])}function $e(E){var D;return at((D=i.state.layout.groupLayouts.find(ce=>ce.groupRef===E))==null?void 0:D.style)}function _e(E){var D;return at((D=i.state.layout.notes.find(ce=>ce.modelId===E))==null?void 0:D.style)}function Ce(E){var V,q;if(E.preventDefault(),!i.editable.value)return;const D=()=>W({x:E.clientX,y:E.clientY}),ce=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const B=D();i.addEntity("NewEntity",{x:B.x,y:B.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const B=D();i.addNote("메모",{x:B.x,y:B.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const B=D();i.addEmptyGroup({x:B.x,y:B.y})}}];((V=i.clipboard.value)==null?void 0:V.kind)==="entity"&&ce.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&ce.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(q=ee.value)==null||q.open(E,ce)}function Te({event:E,node:D}){var De,Le,Pe,Fe,et,Ye,Ke,je,Bo,ve,tt,Do,Oo,Lo,Po,zo,Uo,Fo;const ce=E;if(ce.preventDefault(),!i.editable.value){if(D.type==="group"||D.type==="note")return;const Me=(Le=(De=ce.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];(Fe=ee.value)==null||Fe.open(ce,[{caption:_n.length>1?`복사 (${_n.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(et=ee.value)==null||et.open(ce,[{caption:"상세 편집…",icon:"pencil",handler:()=>Yi(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=ee.value)==null||Ye.open(ce,Ze);return}if(D.type==="note"){(Ke=ee.value)==null||Ke.open(ce,[{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 V=(Bo=(je=ce.target)==null?void 0:je.closest("[data-attr]"))==null?void 0:Bo.dataset.attr;if(V){const Me=i.selection.value;(Me==null?void 0:Me.kind)==="attribute"&&Me.entityId===D.id&&Me.ids.includes(V)||i.selectAttribute(D.id,V);const ot=((ve=i.selection.value)==null?void 0:ve.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[V];if(i.isEntityLocked(D.id)){(tt=ee.value)==null||tt.open(ce,[{caption:ot.length>1?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const _n=ot.length>1,er=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{type:"swatches",caption:_n?`색상 (${ot.length})`:"색상",current:_n?null:be(D.id,V),onPick:pC=>i.setAttributeSwatches(D.id,ot,pC)},{type:"separator"},{caption:_n?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Ho=i.clipboard.value;(Ho==null?void 0:Ho.kind)==="attribute"&&er.push({caption:Ho.attributes.length>1?`속성 붙여넣기 (${Ho.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),er.push({type:"separator"},{caption:_n?`속성 삭제 (${ot.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(D.id,ot)}),(Do=ee.value)==null||Do.open(ce,er);return}const q=(Lo=(Oo=ce.target)==null?void 0:Oo.closest("[data-op]"))==null?void 0:Lo.dataset.op;if(q){if(i.isEntityLocked(D.id))return;(Po=ee.value)==null||Po.open(ce,[{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 B=i.resolved.value.entities.find(Me=>Me.entity.modelId===D.id),j=!!(B!=null&&B.locked),ke=[{caption:j?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>Yi(a,i,D.id)}];if(!j){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=R.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=((zo=Ze.label)==null?void 0:zo.ko)??((Uo=Ze.label)==null?void 0:Uo.en)??Ze.type;ke.push({caption:`임베더블 추가: ${ot}`,icon:"link",handler:()=>i.addPredefinedEmbed(D.id,Ze.type)})}}}if(ke.push({type:"separator"}),ke.push({caption:B!=null&&B.collapsed?"펼치기":"접기",icon:B!=null&&B.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(D.id,!(B!=null&&B.collapsed))}),B!=null&&B.groupRef&&!j&&ke.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(D.id)}),ke.push({caption:j?"잠금 해제":"잠금",icon:j?"unlock":"lock",handler:()=>i.setEntityLocked(D.id,!j)}),ke.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}),!j){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)})}(Fo=ee.value)==null||Fo.open(ce,ke)}function Be({event:E,edge:D}){var q,B;const ce=E;if(ce.preventDefault(),!i.editable.value)return;const V=A(D.id);if(V){(q=ee.value)==null||q.open(ce,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(V.noteRef,V.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(V.noteRef,V.targetRef)}]);return}(B=ee.value)==null||B.open(ce,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(D.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(D.id)}])}function N(E){return E==="group"?"group":E==="note"?"note":"entity"}function M({node:E}){if(R.value.length>1){i.selection.value=null;return}i.selection.value={kind:N(E.type),id:E.id}}function ie({nodes:E}){E.length>1&&(i.selection.value=null)}function T({edge:E}){const D=A(E.id);i.selection.value=D?{kind:"note",id:D.noteRef}:{kind:"association",id:E.id}}function U(E){const D=i.selection.value;return!!D&&D.kind!=="attribute"&&D.id===E.id}function L(E){var D,ce;return U(E)?E.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":E.type==="note"?"var(--em-note-soft)":E.type==="group"?Od(at((D=E.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":Od(at((ce=E.data)==null?void 0:ce.style))??"var(--em-mm-entity)"}function me(E){return U(E)?"var(--em-selection)":E.type==="note"?"var(--em-note-accent)":E.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function J(E,D){oe(E,D,{zoom:k().zoom,duration:350})}n.watch(()=>i.focusRequest.value,E=>{if(!E)return;const D=I(E.id);if(!D)return;const ce=D.computedPosition??D.position,V=D.dimensions??{width:0,height:0};J(ce.x+V.width/2,ce.y+V.height/2)});function Q({position:E}){J(E.x,E.y)}function ne({node:E}){i.selection.value={kind:N(E.type),id:E.id};const D=E.computedPosition??E.position,ce=E.dimensions??{width:0,height:0};J(D.x+ce.width/2,D.y+ce.height/2)}function se({node:E}){z({nodes:[E.id],duration:350,maxZoom:1.2,padding:.6})}return(E,D)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(b1),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!F.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:Z,onMoveEnd:K,onConnect:Y,onConnectStart:D[1]||(D[1]=ce=>c.value=!0),onConnectEnd:D[2]||(D[2]=ce=>c.value=!1),onNodeDrag:S,onNodeDragStop:C,onNodeClick:M,onEdgeClick:T,onSelectionChange:ie,onPaneClick:D[3]||(D[3]=ce=>n.unref(i).selection.value=null),onPaneContextMenu:Ce,onNodeContextMenu:Te,onEdgeContextMenu:Be},{"node-group":n.withCtx(ce=>[n.createVNode(qd,n.normalizeProps(n.guardReactiveProps(ce)),null,16)]),"node-entity":n.withCtx(ce=>[n.createVNode(Kd,n.normalizeProps(n.guardReactiveProps(ce)),null,16)]),"node-note":n.withCtx(ce=>[n.createVNode(Xd,n.normalizeProps(n.guardReactiveProps(ce)),null,16)]),"edge-association":n.withCtx(ce=>[n.createVNode(cu,n.normalizeProps(n.guardReactiveProps(ce)),null,16)]),"edge-note-connection":n.withCtx(ce=>[n.createVNode(O$,n.normalizeProps(n.guardReactiveProps(ce)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref($w),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Zw),{"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]=ce=>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(T$),{key:1,pannable:"",width:224,height:160,"node-color":L,"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:ne,onNodeDblclick:se})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),re.value?(n.openBlock(),n.createElementBlock("div",cx,[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",dx,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",ux,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",fx,[n.createElementVNode("strong",mx,n.toDisplayString(s.value.title),1),n.createElementVNode("span",px,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(q$,{ref_key:"menuRef",ref:ee},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",hx,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function pa(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function yx(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 gx={class:"em-explorer em-scroll-overlay"},bx={class:"em-explorer__search"},_x={key:0,class:"em-explorer__empty"},kx={class:"em-explorer__rows"},wx=["data-key","onClick","onDblclick"],Ex=["onClick"],vx=["title"],Nx={class:"em-key-slot"},$x={class:"em-key-slot"},xx={class:"em-explorer__label"},cf=Ue(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.computed(()=>{var le;const I=i.resolved.value,P=i.displayMode.value,x=$=>{var X,re,pe;return Go(P,$.name,(re=(X=$.table)==null?void 0:X.logicalName)==null?void 0:re.ko,(pe=$.table)==null?void 0:pe.physicalName)},O=P==="PHYSICAL"||P==="LOGICAL_PHYSICAL",H=$=>{const X=$.attrType.startsWith("RELATION")&&$.dbAttrs.length>0;return{icon:$.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:$.identifier,fk:X&&O}}},de=$=>$.attrType.startsWith("EMBED")&&$.dbAttrs.length>0,z=P==="PHYSICAL"||P==="LOGICAL_PHYSICAL",oe=$=>{if($.attrType!=="EMBED_PREDEF")return $.dbAttrs;const X=i.embeddableCatalog.value.find(re=>re.type===$.type);return X?$.dbAttrs.map((re,pe)=>{const ye=X.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}):$.dbAttrs},k=($,X)=>{var ue,fe,ge,Ee,Re,Ie,he,Z,K;const re={entityId:X,attrId:$.modelId};if(de($)){const w=Sa(P,$);return{key:`attr:${$.modelId}`,label:$.name+(w?` : ${w}`:""),icon:"table",attrRef:re,focusId:X,matchText:pa($.name,(fe=(ue=$.dbAttrs[0])==null?void 0:ue.logicalName)==null?void 0:fe.ko,(ge=$.dbAttrs[0])==null?void 0:ge.physicalName),children:z?oe($).map(S=>{var C,Y;return{key:`attr:${$.modelId}:col:${S.modelId}`,label:Go(P,S.physicalName,(C=S.logicalName)==null?void 0:C.ko,S.physicalName)+(S.dataType?` : ${S.dataType}`:""),icon:"field",attrRef:re,focusId:X,matchText:pa(S.physicalName,(Y=S.logicalName)==null?void 0:Y.ko),children:[]}}):[]}}const pe=gr($,i.state.logical.associations),ye=Sa(P,$,pe);return{key:`attr:${$.modelId}`,label:Go(P,$.name,(Re=(Ee=$.dbAttrs[0])==null?void 0:Ee.logicalName)==null?void 0:Re.ko,(Ie=$.dbAttrs[0])==null?void 0:Ie.physicalName)+(ye?` : ${ye}`:""),...H($),attrRef:re,focusId:X,matchText:pa($.name,(Z=(he=$.dbAttrs[0])==null?void 0:he.logicalName)==null?void 0:Z.ko,(K=$.dbAttrs[0])==null?void 0:K.physicalName),children:[]}},W=$=>{var pe,ye,ue;const X=$.entity,re=[...X.attributes].sort((fe,ge)=>fe.order-ge.order);return{key:`entity:${X.modelId}`,label:x(X),icon:"table",selectKind:"entity",selectId:X.modelId,focusId:X.modelId,matchText:pa(X.name,(ye=(pe=X.table)==null?void 0:pe.logicalName)==null?void 0:ye.ko,(ue=X.table)==null?void 0:ue.physicalName),children:re.map(fe=>k(fe,X.modelId))}},R=new Map,G=[];for(const $ of I.entities)if($.groupRef){const X=R.get($.groupRef)??[];X.push($),R.set($.groupRef,X)}else G.push($);const F=[];for(const $ of I.groups){const X=$.group;F.push({key:`group:${X.modelId}`,label:((le=X.name)==null?void 0:le.ko)||X.packageName||"(그룹)",icon:"folder",focusId:X.modelId,children:(R.get(X.modelId)??[]).map(W)})}for(const $ of G)F.push(W($));if(I.associations.length){const $=new Map(I.entities.map(X=>[X.entity.modelId,x(X.entity)]));F.push({key:"section:associations",label:`관계 (${I.associations.length})`,icon:"arrow-lr",children:I.associations.map(X=>{const re=X.association,pe=$.get(re.end1.entityRef)??re.end1.entityRef,ye=$.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 I.notes.length&&F.push({key:"section:notes",label:`노트 (${I.notes.length})`,icon:"note",children:I.notes.map(({note:$})=>{var X;return{key:`note:${$.modelId}`,label:((X=$.memo.split(`
43
- `)[0])==null?void 0:X.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:$.modelId,focusId:$.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:F}});function r(I){return I?I.pk&&I.fk?"PFK (식별 외래키)":I.pk?"PK (기본키)":I.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(I){const P=new Set(s.value);P.has(I)?P.delete(I):P.add(I),s.value=P}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),h=n.computed(()=>{const I=[];if(f.value){const x=yx(l.value,d.value.trim().toLowerCase()),O=(H,de)=>{if(x.has(H.key)){I.push({node:H,depth:de});for(const z of H.children)O(z,de+1)}};return O(l.value,0),I}const P=(x,O)=>{if(I.push({node:x,depth:O}),!s.value.has(x.key))for(const H of x.children)P(H,O+1)};return P(l.value,0),I}),p=n.computed(()=>f.value&&h.value.length<=1);function m(I){var O;if(I.key!=="/"||I.metaKey||I.ctrlKey||I.altKey||I.shiftKey)return;const P=I.target,x=P==null?void 0:P.tagName;x==="INPUT"||x==="TEXTAREA"||x==="SELECT"||P!=null&&P.isContentEditable||(I.preventDefault(),(O=u.value)==null||O.focus())}n.onMounted(()=>window.addEventListener("keydown",m)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",m));const g=n.computed(()=>{const I=[],P=x=>{if(x.children.length){x.key!=="root"&&I.push(x.key);for(const O of x.children)P(O)}};return P(l.value),I}),y=n.computed(()=>!g.value.some(I=>s.value.has(I)));function _(){s.value=y.value?new Set(g.value):new Set}t({toggleAll:_,allExpanded:y,hasExpandable:n.computed(()=>g.value.length>0)});function A(I){const P=i.selection.value;return I.attrRef?(P==null?void 0:P.kind)==="attribute"&&P.entityId===I.attrRef.entityId&&P.ids.includes(I.attrRef.attrId):!!P&&P.kind!=="attribute"&&!!I.selectId&&I.selectKind===P.kind&&I.selectId===P.id}function b(I){const P=i.selection.value;return I.selectKind==="entity"&&(P==null?void 0:P.kind)==="attribute"&&P.entityId===I.selectId}function v(I,P){if(I.attrRef){const x=P.shiftKey?"range":P.metaKey||P.ctrlKey?"toggle":"replace";i.selectAttribute(I.attrRef.entityId,I.attrRef.attrId,x)}else I.selectKind&&I.selectId&&(i.selection.value={kind:I.selectKind,id:I.selectId});I.focusId&&i.requestFocus(I.focusId)}function te(I){I.selectKind==="entity"&&I.selectId&&Yi(a,i,I.selectId)}return(I,P)=>(n.openBlock(),n.createElementBlock("section",gx,[n.createElementVNode("div",bx,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":P[0]||(P[0]=x=>d.value=x),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:P[1]||(P[1]=n.withKeys(x=>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:P[2]||(P[2]=x=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),p.value?(n.openBlock(),n.createElementBlock("p",_x,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",kx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,({node:x,depth:O})=>(n.openBlock(),n.createElementBlock("div",{key:x.key,class:n.normalizeClass(["em-explorer__row",{"is-active":A(x),"is-focus-parent":b(x),"is-selectable":!!x.selectKind||!!x.attrRef||!!x.focusId}]),"data-key":x.key,style:n.normalizeStyle({paddingLeft:4+O*14+"px"}),onClick:H=>v(x,H),onDblclick:H=>te(x)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!x.children.length,"is-open":!s.value.has(x.key)}]),onClick:n.withModifiers(H=>x.children.length&&c(x.key),["stop"])},[x.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,Ex),x.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(x.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",Nx,[x.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):x.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:x.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",$x,[x.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,vx)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:x.icon,size:15},null,8,["name"])),n.createElementVNode("span",xx,n.toDisplayString(x.label),1)],46,wx))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),Ix={class:"em-text-export"},Sx={key:0,class:"em-text-export__tabs",role:"tablist"},Cx=["aria-selected","onClick"],Rx={class:"em-text-export__pre"},Vx={class:"em-text-export__actions"},Ax=Ue(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ae.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),ae.showNotification("클립보드에 복사되었습니다.","info")}catch{ae.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(ae.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",Ix,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",Sx,[(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,Cx))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",Rx,n.toDisplayString(a().content),1),n.createElementVNode("div",Vx,[n.createVNode(n.unref(ae.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ae.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),Tx={class:"em-toolbar"},Mx={class:"em-toolbar__mode"},df=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=ae.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:Ax,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:sr(p),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:Ea(p,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:Ea(p,"class"),filename:"diagram.class.mmd"}]}})}function h(){l.openModal({component:rf})}return(p,m)=>(n.openBlock(),n.createElementBlock("div",Tx,[n.createVNode(n.unref(ae.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]=g=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ae.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]=g=>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",Mx,[m[8]||(m[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:s.value,"onUpdate:modelValue":m[2]||(m[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(ae.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(ae.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]=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(ae.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]=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(ae.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(ae.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(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:m[5]||(m[5]=g=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:m[6]||(m[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},[m[9]||(m[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:m[7]||(m[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(ae.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"]]),Bx={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},Dx=["title"],Ox=["disabled","aria-pressed"],Lx=["disabled","aria-pressed"],Px=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",Bx,[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,Ox),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,Lx)],10,Dx))}}),[["__scopeId","data-v-44f7d737"]]),zx=["disabled"],Ux={class:"em-panel__sub"},Fx={class:"em-nav"},Hx={key:0,class:"em-nav__divider","aria-hidden":"true"},Gx={key:1},Yx=["onClick","onKeydown"],Wx={class:"em-nav__name"},Kx=["title"],qx={key:0,class:"em-panel__note"},Xx=["data-attr-block"],jx={class:"em-attr__row"},Zx=["title"],Jx={key:0,class:"em-attr__row"},Qx={class:"em-attr__row"},eI={class:"em-attr__row"},tI={class:"em-attr__flags"},nI={class:"em-attr__pii"},oI={class:"em-attr__pii"},iI={class:"em-attr__pii"},aI={key:0,class:"em-attr__pii em-attr__codetop"},lI={class:"em-multilang"},rI={key:2,class:"em-embed-cols"},sI={class:"em-embed-col__label"},cI={class:"em-attr__row"},dI={class:"em-attr__row"},uI={key:0,class:"em-embed-upd"},fI={class:"em-embed-upd"},mI={class:"em-embed-upd"},pI={class:"em-swatch__row em-attr__swatch"},hI=["onClick"],yI=["title","onClick"],gI={key:0,class:"em-attr__swatch-hint"},bI="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",ha="__OWN__",_I=Ue(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(V=>V.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(V=>V.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var V;return((V=i.value)==null?void 0:V.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var V;return((V=i.value)==null?void 0:V.attributes.filter(q=>q.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var V;return((V=i.value)==null?void 0:V.attributes)??[]}),d=n.computed(()=>s.value.filter(V=>r.value.has(V.modelId)));function u(V){return{pk:V.identifier,fk:V.attrType.startsWith("RELATION")&&V.dbAttrs.length>0,required:V.notNull&&!V.identifier}}function f(V){return!!i.value&&!!ri(o.state.logical,i.value.modelId,V.modelId)}function h(V){const q=u(V),B=[q.pk&&"PK",q.fk&&"FK",q.required&&"NOT NULL"].filter(Boolean);return B.length?B.join(" · "):void 0}function p(V,q){i.value&&o.selectAttribute(i.value.modelId,V.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 g(V){return V==="none"?"(없음)":V}const y=V=>V;function _(V){var q,B;return at((B=(q=a.value)==null?void 0:q.attributeStyles)==null?void 0:B[V.modelId])}function A(V){return r.value.size>1&&r.value.has(V.modelId)}function b(V,q){if(!i.value)return;const B=A(V)?o.selectedAttrIds.value:[V.modelId];o.setAttributeSwatches(i.value.modelId,B,q)}function v(V,q){i.value&&o.updateAttribute(i.value.modelId,V.modelId,q)}function te(V,q){v(V,{naturalId:q||void 0,naturalIdMutable:q?V.naturalIdMutable:void 0})}function I(){return{naturalId:void 0,naturalIdMutable:void 0}}function P(V,q){v(V,{identifier:q,...q?I():{}})}function x(V,q){v(V,{transient:q||void 0,...q?I():{}})}function O(V){return!!V.transient}const H=V=>V.value,de=V=>V.label;function z(V,q){if(!q)return;const B=$.value.find(j=>j.type===q);if(B){const j=V.dbAttrs[0]??{modelId:V.modelId+".c",physicalName:V.name,dataType:"VARCHAR"};v(V,{type:q,customType:void 0,dbAttrs:[{...j,dataType:B.dataType,length:B.length,scale:B.scale}]});return}v(V,q===Ct?{type:q}:{type:q,customType:void 0})}function oe(V,q){v(V,{customType:q.trim()===""?void 0:q})}function k(V,q){const j={...V.dbAttrs[0]??{modelId:V.modelId+".c",physicalName:V.name,dataType:"VARCHAR"},...q};q.dataType!==void 0&&!Yo.has(j.dataType)&&(j.scale=void 0),v(V,{dbAttrs:[j]})}function W(V){var q;return Yo.has(((q=V.dbAttrs[0])==null?void 0:q.dataType)??"")}function R(V,q,B){var j;k(V,{logicalName:{...(j=V.dbAttrs[0])==null?void 0:j.logicalName,[q]:B}})}function G(V,q){v(V,{description:Object.keys(q).length?q:void 0})}function F(V){return V.personalInfoAttributeType??"none"}function le(V,q){v(V,{personalInfoAttributeType:q==="none"?void 0:q})}const $=n.computed(()=>o.predefinedCustomTypeCatalog.value),X=n.computed(()=>o.embeddableCatalog.value),re=n.ref(void 0);function pe(V){var q,B;return((q=V.label)==null?void 0:q.ko)??((B=V.label)==null?void 0:B.en)??V.type}function ye(V){if(!V||!i.value)return;const q=o.addPredefinedEmbed(i.value.modelId,V);q&&o.selectAttribute(i.value.modelId,q),re.value=void 0}function ue(){if(!i.value)return;const V=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,V)}const fe=n.computed(()=>o.groupCodeCatalog.value);function ge(V){var q;return((q=fe.value.find(B=>B.groupCode===V.groupCode))==null?void 0:q.codes)??[]}function Ee(V){return["none",...ge(V)]}function Re(V){return V==="none"?"none":V.code}function Ie(V){var B,j;if(V==="none")return"(없음)";const q=((B=V.label)==null?void 0:B.ko)??((j=V.label)==null?void 0:j.en);return q?`${V.code} (${q})`:V.code}function he(V,q){i.value&&o.setAttributeGroupCode(i.value.modelId,V.modelId,q)}function Z(V,q){v(V,{defaultValue:q==="none"?void 0:q})}function K(V,q){v(V,{defaultValue:q.trim()===""?void 0:q})}function w(V){return V.attrType.startsWith("EMBED")&&V.dbAttrs.length>0}function S(V,q,B){const j=V.dbAttrs.map((ke,De)=>{if(De!==q)return ke;const Le={...ke,...B};for(const Pe of Object.keys(B))B[Pe]===void 0&&delete Le[Pe];return Le});i.value&&o.setEmbedColumns(i.value.modelId,V.modelId,j)}function C(V,q,B,j){var ke;S(V,q,{logicalName:{...(ke=V.dbAttrs[q])==null?void 0:ke.logicalName,[B]:j}})}function Y(V,q){var ke,De,Le;if(V.attrType==="EMBED_PREDEF"){const Pe=(ke=o.embeddableCatalog.value.find(Fe=>Fe.type===V.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 B=(De=V.embedded)==null?void 0:De.embeddableRef;if(!B)return;const j=(Le=o.state.logical.entities.find(Pe=>Pe.modelId===B))==null?void 0:Le.attributes.flatMap(Pe=>Pe.dbAttrs)[q];return j?{physicalName:j.physicalName,dataType:j.dataType,length:j.length,scale:j.scale,logicalName:j.logicalName}:void 0}function ee(V,q){var B,j;return((B=Y(V,q))==null?void 0:B.dataType)||((j=V.dbAttrs[q])==null?void 0:j.dataType)||""}function be(V,q){var B,j;return((B=Y(V,q))==null?void 0:B.length)??((j=V.dbAttrs[q])==null?void 0:j.length)}function we(V,q){var B,j;return((B=Y(V,q))==null?void 0:B.scale)??((j=V.dbAttrs[q])==null?void 0:j.scale)}const $e=["inherit","true","false"];function _e(V){return V==="inherit"?"기본(따름)":V}function Ce(V){return(V==null?void 0:V.updatable)===void 0?"inherit":V.updatable?"true":"false"}function Te(V,q,B){S(V,q,{updatable:B==="inherit"?void 0:B==="true"})}function Be(V,q){k(V,{updatable:q==="inherit"?void 0:q==="true"})}const N=["inherit","true","false"];function M(V){return V==="inherit"?"기본(따름)":V}function ie(V){return(V==null?void 0:V.insertable)===void 0?"inherit":V.insertable?"true":"false"}function T(V,q,B){S(V,q,{insertable:B==="inherit"?void 0:B==="true"})}function U(V,q){k(V,{insertable:q==="inherit"?void 0:q==="true"})}const L=n.computed(()=>i.value?Wo(i.value,o.state.logical.entities):[]),me=n.computed(()=>Xn(L.value.flatMap(V=>V.attributes.flatMap(q=>q.dbAttrs)))),J=n.computed(()=>L.value.flatMap(V=>V.attributes.filter(q=>q.attrType==="NORMAL"&&q.dbAttrs.length===1&&q.dbAttrs[0]).map(q=>{var B;return{modelId:q.dbAttrs[0].modelId,physical:q.dbAttrs[0].physicalName||q.name,isCurrency:q.type==="Currency",ownerName:V.modelId===((B=i.value)==null?void 0:B.modelId)?void 0:V.name}})));function Q(){const V=[...J.value].sort((q,B)=>Number(B.isCurrency)-Number(q.isCurrency));return[ha,...V.map(q=>q.modelId)]}function ne(V){if(V===ha)return"전용 컬럼(OWN)";const q=J.value.find(j=>j.modelId===V);return q?`↗ ${q.ownerName?`${q.ownerName}.`:""}${q.physical} (${q.isCurrency?"통화":"공유"})`:V}function se(V){return(V==null?void 0:V.sharedColumnRef)??ha}function E(V,q,B){S(V,q,{sharedColumnRef:B===ha?void 0:B})}function D(V){return(V==null?void 0:V.sharedColumnRef)!=null}function ce(V){var q;return((q=qo(V,me.value))==null?void 0:q.physicalName)??""}return(V,q)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",Ux,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:ue}),X.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":re.value,items:X.value,"value-provider":B=>B.type,"label-provider":pe,"onUpdate:modelValue":ye},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",Fx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,B=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",Hx,[...q[0]||(q[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",Gx,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(B.modelId)}]),role:"button",tabindex:"0",onClick:j=>p(B,j),onKeydown:[n.withKeys(n.withModifiers(j=>p(B,j),["prevent"]),["enter"]),n.withKeys(n.withModifiers(j=>p(B,j),["prevent"]),["space"])]},[n.createElementVNode("span",Wx,n.toDisplayString(B.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:h(B)},[u(B).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(B).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(B).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,Kx)],42,Yx)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",qx," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,B=>{var j,ke,De,Le,Pe,Fe,et,Ye,Ke,je,Bo;return n.openBlock(),n.createElementBlock("div",{key:B.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(B.modelId)}]),"data-attr-block":B.modelId},[n.createElementVNode("div",jx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":ve=>v(B,{name:ve})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-type-${B.modelId}`,width:"84px",placeholder:"타입",disabled:B.attrType.startsWith("EMBED")||!!B.groupCode,items:n.unref(yr)(B.type,$.value),"value-provider":H,"label-provider":de,"model-value":B.type,"onUpdate:modelValue":ve=>z(B,ve)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(B)?bI:void 0},[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ve=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,Zx)]),B.type===n.unref(Ct)?(n.openBlock(),n.createElementBlock("div",Jx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-customtype-${B.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":B.customType??"","onUpdate:modelValue":ve=>oe(B,ve)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),w(B)?(n.openBlock(),n.createElementBlock("div",rI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(ve,tt)=>{var Do,Oo,Lo,Po,zo,Uo,Fo;return n.openBlock(),n.createElementBlock("div",{key:ve.modelId,class:"em-embed-col"},[n.createElementVNode("span",sI,n.toDisplayString(((Do=Y(B,tt))==null?void 0:Do.name)??((Oo=Y(B,tt))==null?void 0:Oo.physicalName)??`컬럼 ${tt+1}`),1),n.createElementVNode("div",cI,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-col-${ve.modelId}`,width:"100%",disabled:D(ve),placeholder:((Lo=Y(B,tt))==null?void 0:Lo.physicalName)??"컬럼","model-value":D(ve)?ce(ve):ve.physicalName,"onUpdate:modelValue":Me=>S(B,tt,{physicalName:Me})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSTextInput),{name:`embed-dtype-${ve.modelId}`,width:"84px",disabled:"","model-value":ee(B,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-len-${ve.modelId}`,width:"48px",disabled:"","model-value":be(B,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-scale-${ve.modelId}`,width:"48px",disabled:"","model-value":we(B,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",dI,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-logical-${ve.modelId}`,width:"100%",placeholder:((zo=(Po=Y(B,tt))==null?void 0:Po.logicalName)==null?void 0:zo.ko)??"논리명","model-value":((Uo=ve.logicalName)==null?void 0:Uo.ko)??"","onUpdate:modelValue":Me=>C(B,tt,"ko",Me)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Fo=Y(B,tt))!=null&&Fo.shareable?(n.openBlock(),n.createElementBlock("label",uI,[q[7]||(q[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px","model-value":se(ve),items:Q(),"value-provider":y,"label-provider":ne,"onUpdate:modelValue":Me=>Me&&E(B,tt,Me)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",fI,[q[8]||(q[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:D(ve),"model-value":D(ve)?"false":ie(ve),items:N,"value-provider":y,"label-provider":M,"onUpdate:modelValue":Me=>Me&&T(B,tt,Me)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",mI,[q[9]||(q[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.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(B,tt,Me)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",Qx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-logical-${B.modelId}`,width:"100%",placeholder:"논리명","model-value":((ke=(j=B.dbAttrs[0])==null?void 0:j.logicalName)==null?void 0:ke.ko)??"","onUpdate:modelValue":ve=>R(B,"ko",ve)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",eI,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-col-${B.modelId}`,width:"100%",placeholder:"컬럼",disabled:O(B),"model-value":((De=B.dbAttrs[0])==null?void 0:De.physicalName)??"","onUpdate:modelValue":ve=>k(B,{physicalName:ve})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-dtype-${B.modelId}`,width:"84px",placeholder:"dataType",disabled:O(B),items:n.unref(pr)(((Le=B.dbAttrs[0])==null?void 0:Le.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":y,"label-provider":n.unref($a),"model-value":((Pe=B.dbAttrs[0])==null?void 0:Pe.dataType)??"","onUpdate:modelValue":ve=>ve&&k(B,{dataType:ve})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-len-${B.modelId}`,width:"48px",placeholder:"len",disabled:O(B),"model-value":(Fe=B.dbAttrs[0])==null?void 0:Fe.length,"onUpdate:modelValue":ve=>k(B,{length:ve||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-scale-${B.modelId}`,width:"48px",placeholder:"scale",disabled:O(B)||!W(B),"model-value":(et=B.dbAttrs[0])==null?void 0:et.scale,"onUpdate:modelValue":ve=>k(B,{scale:ve||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Ye=B.dbAttrs[0])==null?void 0:Ye.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",tI,[n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-pk-${B.modelId}`,label:"Primary Key","model-value":B.identifier,disabled:l.value||O(B),"onUpdate:modelValue":ve=>P(B,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nn-${B.modelId}`,label:"Not Null","model-value":B.notNull,disabled:O(B),"onUpdate:modelValue":ve=>v(B,{notNull:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-uq-${B.modelId}`,label:"Unique","model-value":!!((Ke=B.dbAttrs[0])!=null&&Ke.unique),disabled:O(B),"onUpdate:modelValue":ve=>k(B,{unique:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-ai-${B.modelId}`,label:"Auto Increment","model-value":!!((je=B.dbAttrs[0])!=null&&je.autoIncrement),disabled:O(B)||!B.identifier,"onUpdate:modelValue":ve=>k(B,{autoIncrement:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-tr-${B.modelId}`,label:"@Transient","model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":ve=>x(B,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nid-${B.modelId}`,label:"@NaturalId","model-value":!!B.naturalId,disabled:B.identifier||O(B),"onUpdate:modelValue":ve=>te(B,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${B.modelId}`,label:"mutable","model-value":!!B.naturalIdMutable,disabled:O(B)||!B.naturalId,"onUpdate:modelValue":ve=>v(B,{naturalIdMutable:ve||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-mv-${B.modelId}`,label:"Multi-Value (Set)","model-value":!!((Bo=B.dbAttrs[0])!=null&&Bo.multiValue),disabled:O(B),"onUpdate:modelValue":ve=>k(B,{multiValue:ve||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",nI,[q[1]||(q[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:O(B),"model-value":ie(B.dbAttrs[0]),items:N,"value-provider":y,"label-provider":M,"onUpdate:modelValue":ve=>ve&&U(B,ve)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",oI,[q[2]||(q[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:O(B),"model-value":Ce(B.dbAttrs[0]),items:$e,"value-provider":y,"label-provider":_e,"onUpdate:modelValue":ve=>ve&&Be(B,ve)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",iI,[q[3]||(q[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":F(B),items:m,"value-provider":y,"label-provider":g,"onUpdate:modelValue":ve=>ve&&le(B,ve)},null,8,["model-value","onUpdate:modelValue"])]),fe.value.length?(n.openBlock(),n.createElementBlock("label",aI,[q[4]||(q[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(zd,{"model-value":B.groupCode,items:fe.value,"onUpdate:modelValue":ve=>he(B,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(B).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":B.defaultValue??"none",items:Ee(B),"value-provider":Re,"label-provider":Ie,"onUpdate:modelValue":ve=>ve&&Z(B,ve)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`attr-default-${B.modelId}`,width:"100%",placeholder:"기본값","model-value":B.defaultValue??"","onUpdate:modelValue":ve=>K(B,ve)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",lI,[q[6]||(q[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Nl,{multiline:"",name:`attr-desc-${B.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":B.description,"onUpdate:modelValue":ve=>G(B,ve)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",pI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(B)===null}]),title:"없음",onClick:ve=>b(B,null)},"∅",10,hI),(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":_(B)===ve}]),style:n.normalizeStyle({background:n.unref(Ln)(ve)}),title:n.unref(On)(ve),onClick:tt=>b(B,ve)},null,14,yI))),128)),A(B)?(n.openBlock(),n.createElementBlock("span",gI,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,Xx)}),128))],8,zx)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4d527728"]]),kI=["disabled"],wI={class:"em-panel__sub-label"},EI={class:"em-attr__row"},vI={class:"em-field em-idx-params"},NI=["value","onChange"],$I=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 g;const m=(g=l.value)==null?void 0:g.attributes[0];m&&s(p.modelId,{columns:[...p.columns,{columnRef:m.modelId,descending:!1}]})}function d(p,m,g){s(p.modelId,{columns:p.columns.map((y,_)=>_===m?{...y,columnRef:g}:y)})}function u(p,m,g){s(p.modelId,{columns:p.columns.map((y,_)=>_===m?{...y,descending:g}:y)})}function f(p,m){s(p.modelId,{columns:p.columns.filter((g,y)=>y!==m)})}function h(p,m){s(p.modelId,{parameters:m.trim()===""?void 0:m})}return(p,m)=>{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:m[0]||(m[0]=y=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",wI,[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(ae.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",EI,[n.createVNode(n.unref(ae.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(ae.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(ae.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,(_,A)=>(n.openBlock(),n.createElementBlock("div",{key:A,class:"em-attr__row"},[n.createVNode(n.unref(ae.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":b=>b.modelId,"label-provider":b=>b.name,"onUpdate:modelValue":b=>b&&d(y,A,b)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-${y.modelId}-desc-${A}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":b=>u(y,A,b)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"−",onClick:b=>f(y,A)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(y)},null,8,["onClick"]),n.createElementVNode("label",vI,[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,NI)])]))),128)):n.createCommentVNode("",!0)],8,kI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),xI=["disabled"],II={class:"em-panel__sub-label"},SI={class:"em-attr__row"},CI={class:"em-attr__row"},RI={class:"em-multilang"},VI={class:"em-attr__pii"},AI={class:"em-swatch__row em-attr__swatch"},TI=["onClick"],MI=["title","onClick"],BI=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=ae.useModal(),r=n.computed(()=>a.state.logical.entities.find(b=>b.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(b=>b.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(b){return b==="none"?"(없음)":b}const f=b=>b;function h(b,v){r.value&&a.updateOperation(r.value.modelId,b.modelId,v)}function p(b,v){h(b,{description:Object.keys(v).length?v:void 0})}function m(b){return b.personalInfoAttributeType??"none"}function g(b,v){h(b,{personalInfoAttributeType:v==="none"?void 0:v})}function y(b){var v,te;return at((te=(v=s.value)==null?void 0:v.operationStyles)==null?void 0:te[b.modelId])}function _(b,v){r.value&&a.setOperationSwatch(r.value.modelId,b.modelId,v)}function A(b){l.openModal({component:Ud,bind:{operationName:b.name,sourceCode:b.sourceCode??"",onSave:v=>h(b,{sourceCode:v})}})}return(b,v)=>{var te;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]=I=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",II,[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(((te=r.value.operations)==null?void 0:te.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:v[0]||(v[0]=n.withModifiers(I=>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??[],I=>(n.openBlock(),n.createElementBlock("div",{key:I.modelId,class:"em-attr"},[n.createElementVNode("div",SI,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`op-name-${I.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":I.name,"onUpdate:modelValue":P=>h(I,{name:P})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{width:"96px","model-value":I.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":P=>P&&h(I,{visibility:P})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:P=>n.unref(a).removeOperation(r.value.modelId,I.modelId)},null,8,["onClick"])]),n.createElementVNode("div",CI,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:I.sourceCode?"본문 편집 ●":"본문 편집",onClick:P=>A(I)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",RI,[v[2]||(v[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Nl,{multiline:"",name:`op-desc-${I.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":I.description,"onUpdate:modelValue":P=>p(I,P)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",VI,[v[3]||(v[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":m(I),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":P=>P&&g(I,P)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",AI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":y(I)===null}]),title:"없음",onClick:P=>_(I,null)},"∅",10,TI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),P=>(n.openBlock(),n.createElementBlock("button",{key:P,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":y(I)===P}]),style:n.normalizeStyle({background:n.unref(Ln)(P)}),title:n.unref(On)(P),onClick:x=>_(I,P)},null,14,MI))),128))])]))),128)):n.createCommentVNode("",!0)],8,xI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),DI={class:"em-panel__head"},OI={class:"em-panel__head-row"},LI={class:"em-panel__context"},PI={key:0,class:"em-panel__lock"},zI=["disabled"],UI={key:0,class:"em-panel__note"},FI={key:1,class:"em-panel__note"},HI={key:2,class:"em-jpa"},GI={class:"em-field"},YI={class:"em-field"},WI={key:0,class:"em-field"},KI={class:"em-panel__sub"},qI={class:"em-field"},XI={class:"em-jpa"},jI={key:0,class:"em-panel__note"},ZI={class:"em-jpa"},JI={class:"em-field"},QI={key:0,class:"em-panel__note"},eS={class:"em-field"},tS={class:"em-multilang"},nS={class:"em-field"},oS=["value"],iS={class:"em-field"},aS={class:"em-swatch"},lS={class:"em-swatch__row"},rS=["title","onClick"],sS={class:"em-panel__note"},cS={class:"em-field"},dS=["value"],uS={class:"em-swatch"},fS={class:"em-swatch__row"},mS=["title","onClick"],uf=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 Z=r.value;return Z?a.state.logical.entities.find(K=>K.modelId===Z)??null:null}),c=n.computed(()=>{const Z=l.value;if((Z==null?void 0:Z.kind)==="association"){const w=a.state.logical.associations.find(S=>S.modelId===Z.id);return!!w&&(a.isEntityLocked(w.end1.entityRef)||a.isEntityLocked(w.end2.entityRef))}const K=r.value;return!!K&&a.isEntityLocked(K)}),d=n.computed(()=>{var Z;return((Z=a.selectedAttr.value)==null?void 0:Z.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(Z){return h.value[Z]??f.value}function m(Z){h.value={...h.value,[Z]:!p(Z)}}const g=n.computed(()=>{var w;const Z=s.value;if(!Z)return"엔티티";const K=(w=Z.table)==null?void 0:w.physicalName;return K?`${Z.name} (${K})`:Z.name}),y=n.computed(()=>{const Z=l.value;return(Z==null?void 0:Z.kind)==="association"?a.state.logical.associations.find(K=>K.modelId===Z.id)??null:null}),_=n.computed(()=>{const Z=l.value;return(Z==null?void 0:Z.kind)==="group"?a.state.logical.groups.find(K=>K.modelId===Z.id)??null:null}),A=n.computed(()=>{const Z=l.value;return(Z==null?void 0:Z.kind)==="note"?a.state.layout.notes.find(K=>K.modelId===Z.id)??null:null}),b=n.computed(()=>{var K,w;const Z=(K=_.value)==null?void 0:K.name;return(Z==null?void 0:Z.ko)||(Z==null?void 0:Z.en)||(Z==null?void 0:Z.ja)||(Z==null?void 0:Z.zh)||((w=_.value)==null?void 0:w.packageName)||"그룹"}),v=n.computed(()=>{if(s.value){const Z=u.value.size;if(Z>1)return`엔티티 · ${s.value.name} › 속성 · ${Z}개`;if(d.value){const K=s.value.attributes.find(w=>w.modelId===d.value);return(K==null?void 0:K.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(K==null?void 0:K.name)??""}`}return`엔티티 · ${s.value.name}`}if(y.value){const Z=K=>{var w;return((w=a.state.logical.entities.find(S=>S.modelId===K))==null?void 0:w.name)??K};return`관계 · ${Z(y.value.end1.entityRef)} — ${Z(y.value.end2.entityRef)}`}return _.value?`그룹 · ${b.value}`:A.value?"노트":"선택된 항목 없음"}),te=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],I=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],P=["LIST","SET"],x=["inherit","LAZY","EAGER"],O=Z=>Z;function H(Z){return Z==="inherit"?"기본(따름)":Z}const de=n.computed(()=>!!y.value&&y.value.end1.entityRef===y.value.end2.entityRef);function z(Z,K){y.value&&a.updateAssociationEnd(y.value.modelId,Z,K)}function oe(Z){y.value&&!de.value&&a.setAssociationIdentifying(y.value.modelId,Z)}function k(Z){var K,w,S;return!!((S=(w=(K=y.value)==null?void 0:K[Z].jpa)==null?void 0:w.cascadeTypes)!=null&&S.includes("ALL"))}function W(Z,K,w){var Y,ee;const S=(Y=y.value)==null?void 0:Y[Z];if(K==="ALL"&&w){z(Z,{jpa:{...S==null?void 0:S.jpa,cascadeTypes:["ALL"]}});return}const C=new Set(((ee=S==null?void 0:S.jpa)==null?void 0:ee.cascadeTypes)??[]);w?C.add(K):C.delete(K),z(Z,{jpa:{...S==null?void 0:S.jpa,cascadeTypes:[...C]}})}function R(Z,K){var S;const w=(S=y.value)==null?void 0:S[Z];z(Z,{jpa:{...w==null?void 0:w.jpa,...K}})}function G(Z){var K,w;return((w=(K=y.value)==null?void 0:K[Z].jpa)==null?void 0:w.fetchType)??"inherit"}function F(Z,K){R(Z,{fetchType:K==="inherit"?void 0:K})}function le(Z){var w;const K=(w=y.value)==null?void 0:w[Z==="end1"?"end2":"end1"];return(K==null?void 0:K.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(K==null?void 0:K.multiplicity)==="ONE_OR_MORE_INSTANCES"}const $=n.computed(()=>{const Z=y.value;if(!Z)return null;for(const K of a.state.logical.entities){const w=K.attributes.find(Y=>{var ee;return((ee=Y.embedded)==null?void 0:ee.associationRef)===Z.modelId&&Y.attrType==="EMBED_OWN"});if(!w)continue;const S=Z.end2.entityRef===w.embedded.embeddableRef?"end2":"end1",C=Z[S].jpa;return{which:S,isCollection:Z[S].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 X(Z){y.value&&a.setEmbedCollectionMode(y.value.modelId,Z?"COLLECTION":"SINGLE")}function re(Z){const K=$.value;K&&R(K.which,Z==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function pe(Z){const K=$.value;K&&R(K.which,{collectionTable:Z.trim()||void 0})}function ye(Z){const K=$.value;K&&R(K.which,{orderColumn:Z.trim()||void 0})}function ue(Z){_.value&&a.updateGroup(_.value.modelId,Z)}function fe(Z,K){var w;ue({name:{...(w=_.value)==null?void 0:w.name,[Z]:K}})}const ge=n.computed(()=>{var Z;return _.value?at((Z=a.state.layout.groupLayouts.find(K=>K.groupRef===_.value.modelId))==null?void 0:Z.style):null});function Ee(Z){_.value&&a.setGroupSwatch(_.value.modelId,Z)}function Re(Z){A.value&&a.setNoteMemo(A.value.modelId,Z)}const Ie=n.computed(()=>{var Z;return at((Z=A.value)==null?void 0:Z.style)});function he(Z){A.value&&a.setNoteSwatch(A.value.modelId,Z)}return(Z,K)=>(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:K[0]||(K[0]=(...w)=>e.startResize&&e.startResize(...w))},null,34),n.createElementVNode("header",DI,[n.createElementVNode("div",OI,[K[13]||(K[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:K[1]||(K[1]=w=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",LI,n.toDisplayString(v.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",PI,[n.createVNode(Ve,{name:"lock",size:13}),K[14]||(K[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:K[2]||(K[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(Ld,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:g.value,onToggle:K[3]||(K[3]=w=>m("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(_I,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode($I,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:K[4]||(K[4]=w=>m("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(BI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:K[5]||(K[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(ae.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!y.value.identifying,disabled:de.value||!!$.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),de.value?(n.openBlock(),n.createElementBlock("p",UI,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):$.value?(n.openBlock(),n.createElementBlock("p",FI,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),$.value?(n.openBlock(),n.createElementBlock("fieldset",HI,[K[18]||(K[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":$.value.isCollection,"onUpdate:modelValue":X},null,8,["model-value"]),$.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",GI,[K[15]||(K[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":$.value.collectionType,items:P,"value-provider":O,"label-provider":O,"onUpdate:modelValue":K[6]||(K[6]=w=>w&&re(w))},null,8,["model-value"])]),n.createElementVNode("label",YI,[K[16]||(K[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":$.value.collectionTable,"onUpdate:modelValue":pe},null,8,["model-value"])]),$.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",WI,[K[17]||(K[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":$.value.orderColumn,"onUpdate:modelValue":ye},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),K[19]||(K[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 S,C,Y,ee;return n.createElementVNode("div",{key:w,class:"em-end"},[n.createElementVNode("h4",KI,n.toDisplayString(w)+" → "+n.toDisplayString(y.value[w].entityRef),1),n.createElementVNode("label",qI,[K[20]||(K[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":y.value[w].multiplicity,items:te,"value-provider":O,"label-provider":O,disabled:((S=$.value)==null?void 0:S.which)===w,"onUpdate:modelValue":be=>z(w,{multiplicity:be})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${w}-navigable`,class:"em-check",label:"navigable","model-value":y.value[w].navigable,"onUpdate:modelValue":be=>z(w,{navigable:be})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${w}-composition`,class:"em-check",label:"composition","model-value":y.value[w].composition,"onUpdate:modelValue":be=>z(w,{composition:be})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",XI,[K[21]||(K[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(I,be=>{var we,$e;return n.createVNode(n.unref(ae.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=>W(w,be,_e)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),k(w)?(n.openBlock(),n.createElementBlock("p",jI,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",ZI,[K[24]||(K[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",JI,[K[22]||(K[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":G(w),items:x,"value-provider":O,"label-provider":H,"onUpdate:modelValue":be=>be&&F(w,be)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.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=>R(w,{orphanRemoval:be})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),le(w)&&((Y=y.value[w].jpa)!=null&&Y.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",QI,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",eS,[K[23]||(K[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:`${w}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((ee=y.value[w].jpa)==null?void 0:ee.orderBy)??"","onUpdate:modelValue":be=>R(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",tS,[K[25]||(K[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,w=>{var S;return n.openBlock(),n.createElementBlock("label",{key:w,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(w),1),n.createVNode(n.unref(ae.BSTextInput),{name:`grp-name-${w}`,width:"100%","model-value":((S=_.value.name)==null?void 0:S[w])??"","onUpdate:modelValue":C=>fe(w,C)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",nS,[K[26]||(K[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:K[7]||(K[7]=w=>ue({description:w.target.value}))},null,40,oS)]),n.createElementVNode("label",iS,[K[27]||(K[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":K[8]||(K[8]=w=>ue({packageName:w}))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":K[9]||(K[9]=w=>ue({excludeDDLGeneration:w}))},null,8,["model-value"]),n.createElementVNode("fieldset",aS,[K[28]||(K[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",lS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ge.value===null}]),title:"없음",onClick:K[10]||(K[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(Ln)(w)}),title:n.unref(On)(w),onClick:S=>Ee(w)},null,14,rS))),128))])]),n.createElementVNode("p",sS,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),A.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",cS,[K[29]||(K[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:A.value.memo,rows:"6",onChange:K[11]||(K[11]=w=>Re(w.target.value))},null,40,dS)]),n.createElementVNode("fieldset",uS,[K[30]||(K[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",fS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ie.value===null}]),title:"없음",onClick:K[12]||(K[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(Ln)(w)}),title:n.unref(On)(w),onClick:S=>he(w)},null,14,mS))),128))])])],64)):n.createCommentVNode("",!0)],8,zI)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),pS={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function hS(e){const t=e.split("-")[1];return t?pS[t]??t:e}function yS(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const gS=["title"],bS=["title","onClick"],_S={key:0,class:"em-validation__body"},kS={class:"em-validation__opt"},wS={key:0,class:"em-validation__empty"},ES={key:1,class:"em-validation__empty"},vS={key:2,class:"em-validation__list"},NS=["onClick"],$S={class:"em-validation__item-msg"},xS={key:0,class:"em-validation__item-entity"},IS=["title"],SS=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 y of o.state.logical.entities)g.set(y.modelId,y.name);return g});function l(g){const y=yS(g);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 g={error:0,warning:0,info:0};for(const y of i.value)g[y.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,y)=>r[g.severity].order-r[y.severity].order)),u=n.computed(()=>d.value.map(g=>({issue:g,entityName:l(g),category:hS(g.ruleId)}))),f=n.ref(!1);function h(g){c.value[g]=!c.value[g]}function p(g){if(!f.value){f.value=!0;return}h(g)}function m(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,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,gS),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:A=>p(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,bS)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",_S,[n.createElementVNode("label",kS,[n.createVNode(n.unref(ae.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",wS,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",ES," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",vS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:A,category:b},v)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${v}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:te=>m(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",$S,[A?(n.openBlock(),n.createElementBlock("span",xS,n.toDisplayString(A),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(_.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},n.toDisplayString(b),9,IS)],10,NS))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),CS={class:"em-history"},RS={class:"em-history__head"},VS={class:"em-history__title"},AS={class:"em-history__head-actions"},TS=["disabled"],MS={class:"em-history__filters"},BS={class:"em-history__filter"},DS={class:"em-history__body"},OS={key:0,class:"em-history__empty"},LS={key:1,class:"em-history__empty is-error"},PS={key:2,class:"em-history__empty"},zS={key:3,class:"em-history__list"},US=["onClick"],FS={class:"em-history__summary"},HS={class:"em-history__seq"},GS={class:"em-history__gmeta"},YS={class:"em-history__who"},WS={key:0,class:"em-history__time"},KS={key:1,class:"em-history__restored-from"},qS={key:0,class:"em-history__detail"},XS={class:"em-history__action-head"},jS={class:"em-history__action-name"},ZS={key:0,class:"em-history__fields"},JS={class:"em-history__fname"},QS={key:0,class:"em-history__old"},eC={class:"em-history__val"},tC={key:1,class:"em-history__restore"},nC=["disabled","onClick"],oC=["disabled"],iC=["onClick"],aC=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($){s.value=$ instanceof Error?$.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,$=>{$&&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($=>[$.modelId,$]))),p=n.computed(()=>new Map(a.state.logical.associations.map($=>[$.modelId,$]))),m=n.computed(()=>new Map((a.state.logical.groups??[]).map($=>{var X;return[$.modelId,$.packageName||((X=$.name)==null?void 0:X.ko)||$.modelId]})));function g($){var ye,ue,fe,ge,Ee,Re,Ie;const X=p.value.get($);if(!X)return"연관";if((ye=X.description)!=null&&ye.trim())return X.description.trim();const re=(ge=(fe=h.value.get((ue=X.end1)==null?void 0:ue.entityRef))==null?void 0:fe.name)==null?void 0:ge.trim(),pe=(Ie=(Re=h.value.get((Ee=X.end2)==null?void 0:Ee.entityRef))==null?void 0:Re.name)==null?void 0:Ie.trim();return re&&pe?`${re}→${pe}`:"연관"}function y($){var X,re,pe,ye;if($.kind==="entity")return((re=(X=h.value.get($.ref))==null?void 0:X.name)==null?void 0:re.trim())||"(이름 없음)";if($.kind==="attribute"||$.kind==="operation"||$.kind==="index"){const ue=$.entityRef?h.value.get($.entityRef):void 0,ge=(($.kind==="attribute"?ue==null?void 0:ue.attributes:$.kind==="operation"?ue==null?void 0:ue.operations:ue==null?void 0:ue.indexes)??[]).find(Re=>Re.modelId===$.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())||$.ref}`}return $.kind==="association"?g($.ref):$.kind==="associationEnd"?`${g($.ref)}(${$.end})`:$.kind==="group"?`그룹 ${m.value.get($.ref)??$.ref}`:$.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},A={add:"추가",update:"수정",remove:"삭제"},b=n.ref("all"),v=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],te=n.computed({get:()=>b.value,set:$=>{$&&(b.value=$)}}),I=n.computed(()=>Sr(l.value)),P=n.computed(()=>I.value.length?I.value[0].seq:null),x=n.computed(()=>b.value==="all"?I.value:I.value.filter($=>($.kind??"edit")===b.value));function O($){return $===void 0?"—":$===null?"(비움)":typeof $=="object"?JSON.stringify($):String($)}function H($){const X=y($.subject);if($.verb==="add")return`${X} 추가`;if($.verb==="remove")return`${X} 삭제`;if($.fields.length===1){const re=$.fields[0];return`${X}.${re.field} ${re.oldValue!==void 0?O(re.oldValue)+"→":""}${O(re.value)}`}return`${X} ${$.fields.length}개 변경`}function de($){return $.actions.length===0?"변경 없음":$.actions.length===1?H($.actions[0]):`${H($.actions[0])} 외 ${$.actions.length-1}건`}const z=n.ref(new Set);function oe($){const X=new Set(z.value);X.has($)?X.delete($):X.add($),z.value=X}function k($){if($==null)return"";const X=new Date($);return isNaN(X.getTime())?String($):X.toLocaleString()}function W($){const X=$.author,re=$.origin;return X&&re?`${X}(${re})`:X||(re?`(${re})`:"—")}const R=n.ref(null),G=n.ref(!1);function F($){R.value=$}async function le($){G.value=!0;try{const X=await a.restoreToSeq($);X.ok||(s.value=`복원 실패: ${X.reason??"알 수 없음"}`)}finally{G.value=!1,R.value=null}}return($,X)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",CS,[n.createElementVNode("header",RS,[n.createElementVNode("div",VS,[n.createVNode(Ve,{name:"undo",size:15}),X[4]||(X[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",AS,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:X[0]||(X[0]=re=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,TS),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:X[1]||(X[1]=re=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",MS,[n.createElementVNode("label",BS,[X[5]||(X[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:te.value,"onUpdate:modelValue":X[2]||(X[2]=re=>te.value=re),items:v,"value-provider":re=>re.v,"label-provider":re=>re.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",DS,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",OS,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",LS,n.toDisplayString(s.value),1)):x.value.length===0?(n.openBlock(),n.createElementBlock("p",PS,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",zS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(x.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":z.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",FS,n.toDisplayString(de(re)),1),n.createElementVNode("span",HS,"#"+n.toDisplayString(re.seq),1)],8,US),n.createElementVNode("div",GS,[n.createElementVNode("span",YS,n.toDisplayString(W(re)),1),re.ts?(n.openBlock(),n.createElementBlock("span",WS,n.toDisplayString(k(re.ts)),1)):n.createCommentVNode("",!0),re.kind==="restore"&&re.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",KS,"← #"+n.toDisplayString(re.restoredFromSeq),1)):n.createCommentVNode("",!0)]),z.value.has(re.seq)?(n.openBlock(),n.createElementBlock("div",qS,[(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",XS,[n.createVNode(Ve,{name:_[pe.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",jS,n.toDisplayString(y(pe.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${pe.verb}`])},n.toDisplayString(A[pe.verb]),3)]),pe.fields.length?(n.openBlock(),n.createElementBlock("ul",ZS,[(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",JS,n.toDisplayString(ue.field),1),ue.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",QS,n.toDisplayString(O(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",eC,n.toDisplayString(O(ue.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&re.seq!==P.value?(n.openBlock(),n.createElementBlock("div",tC,[R.value===re.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[X[6]||(X[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:G.value,onClick:pe=>le(re.seq)},"복원",8,nC),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:G.value,onClick:X[3]||(X[3]=pe=>R.value=null)},"취소",8,oC)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:pe=>F(re.seq)},[n.createVNode(Ve,{name:"undo",size:12}),X[7]||(X[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,iC))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function lC(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 ff(e){const t=n.ref(lC(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 rC={class:"em-modeler"},sC={class:"em-modeler__body"},cC={class:"em-drawer__inner"},dC={class:"em-drawer__head"},uC={class:"em-drawer__actions"},fC=["title"],mC=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}=ff({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=ff({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(h,p)=>{var m,g,y;return n.openBlock(),n.createElementBlock("div",rC,[n.createVNode(df,{controller:e.controller,"history-open":i.value,onExportSvg:p[0]||(p[0]=_=>{var A;return(A=u.value)==null?void 0:A.exportSvg()}),onExportPng:p[1]||(p[1]=_=>{var A;return(A=u.value)==null?void 0:A.exportPng()}),onToggleHistory:p[2]||(p[2]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",sC,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",cC,[n.createElementVNode("header",dC,[p[10]||(p[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",uC,[(m=f.value)!=null&&m.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(g=f.value)!=null&&g.allExpanded?"모두 접기":"모두 펼치기",onClick:p[3]||(p[3]=_=>{var A;return(A=f.value)==null?void 0:A.toggleAll()})},[n.createVNode(Ve,{name:(y=f.value)!=null&&y.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,fC)):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(cf,{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(sf,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(uf,{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(aC,{controller:e.controller,open:i.value,onClose:p[9]||(p[9]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(SS,{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=Gm,Ne.AssociationEdge=cu,Ne.CUSTOM_TYPE_VALUE=Ct,Ne.CommandStack=Ma,Ne.DEFAULT_JAVA_TYPE=xa,Ne.DiagramCanvas=sf,Ne.DiagramExplorer=cf,Ne.EDITOR=pn,Ne.EditModeToggle=Px,Ne.EditorToolbar=df,Ne.EntityModeler=mC,Ne.EntityNode=Kd,Ne.GROUP_CODE_ENUM_VALUE=qn,Ne.GroupNode=qd,Ne.JAVA_TYPES=Ia,Ne.NoteNode=Xd,Ne.OpSyncAdapter=bs,Ne.PHYSICAL_NAME_MAX_LENGTH=Ca,Ne.PropertyPanel=uf,Ne.RevCache=gs,Ne.SELECTABLE_JAVA_TYPES=hr,Ne.SYMBOLIC_OP_KINDS=_s,Ne.SYMBOLIC_OP_SCHEMA=Cs,Ne.anchoredEdgePoint=ka,Ne.buildAgentBatch=Ym,Ne.buildDiagramSvg=Jl,Ne.buildOrthogonalPath=ya,Ne.buildSelfLoopPath=or,Ne.buildStraightPath=ba,Ne.collectSharedColumns=Ko,Ne.commands=fm,Ne.computeAutoLayout=ir,Ne.createEditorController=Ck,Ne.defaultMermaidDialect=kf,Ne.displayLabel=Go,Ne.emptyState=Hd,Ne.entityModelToMermaid=Ea,Ne.entityModelToText=sr,Ne.estimateEntityHeight=lr,Ne.exportDiagramPng=lf,Ne.exportDiagramSvg=af,Ne.fromPersisted=ap,Ne.indexColumnsByModelId=Xn,Ne.javaTypeLabel=wn,Ne.mergeDiagram=Er,Ne.migrateLegacyMoney=Wf,Ne.newId=Oe,Ne.orthogonalMidpoints=ga,Ne.packEntityBoxes=_f,Ne.physicalNameWarning=Xo,Ne.projectActionLog=Sr,Ne.projectEntityAudit=xr,Ne.projectFieldAudit=Ut,Ne.rectExitPoint=_a,Ne.renderDiagramSvg=mr,Ne.resolveDiagram=tr,Ne.resolveSharedColumn=qo,Ne.resolveSymbolicOps=Mm,Ne.restoreDeepEqual=vn,Ne.segmentMidpoints=wa,Ne.sharedColumnScopeEntities=Wo,Ne.sideDir=Wn,Ne.synthesizeRestoreOps=om,Ne.toPersisted=_p,Ne.toPersistedV2=kp,Ne.validateModel=_r,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
41
+ v${-(G.value.height-2*e.maskBorderRadius)}
42
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(Q=>{if(b.value){const ee=qt(b.value),x=pe=>{if(pe.sourceEvent.type!=="wheel"||!m.value||!p.value)return;const be=pe.sourceEvent.ctrlKey&&vo()?10:1,de=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*e.zoomStep,me=c.value.zoom*2**(de*be);p.value.scaleTo(m.value,me)},X=pe=>{if(pe.sourceEvent.type!=="mousemove"||!m.value||!p.value)return;const be=S.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),de={x:c.value.x-pe.sourceEvent.movementX*be,y:c.value.y-pe.sourceEvent.movementY*be},me=[[0,0],[u.value.width,u.value.height]],ye=Jl.translate(de.x,de.y).scale(c.value.zoom),ve=p.value.constrain()(ye,me,d.value);p.value.transform(m.value,ve)},le=KI().wheelDelta(pe=>pl(pe)*(e.zoomStep/10)).on("zoom",e.pannable?X:()=>{}).on("zoom.wheel",e.zoomable?x:()=>{});ee.call(le),Q(()=>{ee.on("zoom",null)})}},{flush:"post"});function M(Q){const[ee,x]=Xt(Q);t("click",{event:Q,position:{x:ee,y:x}})}function oe(Q,ee){const x={event:Q,node:ee,connectedEdges:dn([ee],s.value)};f.miniMapNodeClick(x),t("nodeClick",x)}function w(Q,ee){const x={event:Q,node:ee,connectedEdges:dn([ee],s.value)};f.miniMapNodeDoubleClick(x),t("nodeDblclick",x)}function j(Q,ee){const x={event:Q,node:ee,connectedEdges:dn([ee],s.value)};f.miniMapNodeMouseEnter(x),t("nodeMouseenter",x)}function A(Q,ee){const x={event:Q,node:ee,connectedEdges:dn([ee],s.value)};f.miniMapNodeMouseMove(x),t("nodeMousemove",x)}function W(Q,ee){const x={event:Q,node:ee,connectedEdges:dn([ee],s.value)};f.miniMapNodeMouseLeave(x),t("nodeMouseleave",x)}return(Q,ee)=>(n.openBlock(),n.createBlock(n.unref(zd),{position:Q.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:Q.pannable,zoomable:Q.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:b,width:g.value,height:_.value,viewBox:[O.value.x,O.value.y,O.value.width,O.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:M},[Q.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(Q.ariaLabel),9,JI)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(y),x=>(n.openBlock(),n.createBlock(jI,{id:x.id,key:x.id,f:"",position:x.computedPosition,dimensions:x.dimensions,selected:x.selected,dragging:x.dragging,style:n.normalizeStyle(x.style),class:n.normalizeClass(Z.value(x)),color:h.value(x),"border-radius":Q.nodeBorderRadius,"stroke-color":E.value(x),"stroke-width":Q.nodeStrokeWidth,"shape-rendering":n.unref(C),type:x.type,hidden:x.hidden,onClick:X=>oe(X,x),onDblclick:X=>w(X,x),onMouseenter:X=>j(X,x),onMousemove:X=>A(X,x),onMouseleave:X=>W(X,x)},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:te.value,fill:Q.maskColor,stroke:Q.maskStrokeColor,"stroke-width":Q.maskStrokeWidth,"fill-rule":"evenodd"},null,8,QI)],8,ZI))]),_:1},8,["position","class"]))}}),n$=["d"],o$=["cx","cy","onDblclick"],i$=["x","y","onPointerdown","onDblclick"],a$=ze(n.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Pe(),i=n.inject(Tl),a=n.inject(hn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Fn,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((T,S)=>S===d.value?u.value:T)),{source:m,target:p,sourceSide:y,targetSide:b}=mu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),g=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?_a(m.value,y.value,f.value,p.value,b.value):ka(m.value,f.value,p.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?wa(m.value,y.value,f.value,p.value,b.value):Na(m.value,f.value,p.value).map((T,S)=>({point:T,segIndex:S})):[]),C=n.computed(()=>l.value?f.value:[]);function h(T,S){d.value=T,u.value={...c.value[T]},S.target.setPointerCapture(S.pointerId),S.stopPropagation()}function E(T){if(d.value<0)return;const S=o({x:T.clientX,y:T.clientY});u.value={x:S.x,y:S.y}}function Z(T){var S,O;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(O=(S=T.target).releasePointerCapture)==null||O.call(S,T.pointerId)}function L(T,S){S.stopPropagation(),i==null||i.removePoint(t.id,T)}function G(T,S){if(!i)return;const O=o({x:S.clientX,y:S.clientY});i.insertPoint(t.id,T,{x:O.x,y:O.y})}return(T,S)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:g.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,(O,te)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${te}`,cx:O.point.x,cy:O.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(M=>G(O.segIndex,M),["stop"])},null,42,o$))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(C.value,(O,te)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${te}`,x:O.x-5,y:O.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:M=>h(te,M),onPointermove:E,onPointerup:Z,onDblclick:M=>L(te,M)},null,42,i$))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),l$=["data-theme"],r$={key:0,class:"em-ctx__sep",role:"separator"},s$={key:1,class:"em-ctx__swatches"},c$={class:"em-ctx__swatches-label"},d$={class:"em-ctx__chips"},u$=["onClick"],f$=["title","onClick"],m$=["disabled","onClick"],p$={class:"em-ctx__icon"},h$={class:"em-ctx__caption"},y$=ze(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,y){var _;i.value=y,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 g=b.getBoundingClientRect();r.x+g.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-g.width)),r.y+g.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-g.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 m(p,y){p.onPick(y),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(p,y)=>(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:y[0]||(y[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(b,g)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:g},[b.type==="separator"?(n.openBlock(),n.createElementBlock("div",r$)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",s$,[n.createElementVNode("span",c$,n.toDisplayString(b.caption),1),n.createElementVNode("div",d$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:"없음",onClick:_=>m(b,null)},null,10,u$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),_=>(n.openBlock(),n.createElementBlock("button",{key:_,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":b.current===_}]),style:n.normalizeStyle({background:n.unref(Pn)(_)}),title:n.unref(Ln)(_),onClick:C=>m(b,_)},null,14,f$))),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",p$,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",h$,n.toDisplayString(b.caption),1)],10,m$))],64))),128))],36)],8,l$)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),er=[".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 Wn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function g$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function b$(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 y=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const b=t(y.left,y.top+y.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,m=0;const p=()=>{const y=d.trim();if(y){const b=t(f,(u+m)/2);c.push({...i,x:b.x,y:b.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(l,y),a.setEnd(l,y+1);const b=a.getBoundingClientRect();u===null||Math.abs(b.top-u)>1?(p(),u=b.top,f=b.left,m=b.bottom,d=s[y]):(d+=s[y],m=Math.max(m,b.bottom))}return p(),c}function ya(e,t){const o=[];for(const i of e.querySelectorAll("*"))g$(i)&&(i.closest(er)||Wn(i)&&o.push(...b$(i,t)));return o}function Bo(e){return Math.round(e*100)/100}function _$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(er)||!Wn(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="${Bo(l.x)}" y="${Bo(l.y)}" width="${Bo(r.x-l.x)}" height="${Bo(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 w$(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Wn(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=>Bo(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 sf(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(er)||!Wn(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 Do(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 tr(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 k$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(p,y)=>e.screenToFlowCoordinate({x:p,y}),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 y=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(p.id)}"]`);if(!y||!Wn(y))continue;const b=y.firstElementChild;if(b)if(p.type==="group"){const g=Do(b,o);tr(s,g),i.push({...g,texts:[]});const _=b.querySelector(".em-group__label");_&&i.push({...Do(_,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ya(b,o)})}else if(p.type==="note"){const g={...Do(b,o),texts:ya(b,o),lines:sf(b,b,o)};tr(s,g),l.push(g)}else{const g=Do(b,o);tr(s,g);const _=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const C=b.querySelector(".em-entity__header");if(C){const h=Do(C,o);a.push({x:g.x,y:g.y,w:g.w,h:h.y+h.h-g.y,fill:h.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ya(b,o),lines:sf(b,b,o),icons:_$(b,o)}),a.push({...g,fill:"none",texts:[]})}}for(const p of t.querySelectorAll(".vue-flow__edge")){const y=p.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!Wn(y))continue;const b=y.getAttribute("d");if(!b)continue;const g=getComputedStyle(y),_=g.strokeDasharray,C=w$(p);r.push({d:b,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:ya(p,o),markers:C.length?C: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 nr(e){return br(k$(e))}function cf(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 df(e,t="diagram.svg"){const o=nr(e);cf(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function E$(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 uf(e,t="diagram.png",o=2){const i=nr(e),{w:a,h:l}=E$(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,m)=>{s.onload=()=>f(),s.onerror=()=>m(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 변환 실패");cf(u,t)}finally{URL.revokeObjectURL(r)}}const v$={class:"em-shortcuts"},N$={class:"em-shortcuts__title"},I$={class:"em-shortcuts__keys"},$$={class:"em-shortcuts__kbd"},x$={key:0,class:"em-shortcuts__plus"},S$={class:"em-shortcuts__desc"},C$={class:"em-shortcuts__actions"},ff=ze(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ae.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(ae.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",v$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",N$,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",I$,[(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",$$,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",x$,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",S$,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",C$,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function R$(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const V$={key:0,class:"em-canvas__empty","aria-hidden":"true"},A$={key:1,class:"em-canvas__empty-title"},T$={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},M$={class:"em-conflict-banner__body"},B$={class:"em-conflict-banner__title"},D$={class:"em-conflict-banner__detail"},O$={key:0,class:"em-toast",role:"status","aria-live":"polite"},or="nc:",mf=ze(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,N=>{N&&(l.value=N.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>R$(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f(N){u.x=N.clientX,u.y=N.clientY}const m=n.ref(null);n.provide(ji,m);const p=n.ref(null);n.provide(Zd,p);const y=n.ref(null),b=n.computed(()=>{const N=y.value,$=new Set;if(!N)return $;if(N.kind==="entity")$.add(N.id);else if(N.kind==="group"){const ie=i.resolved.value.groups.find(R=>R.group.modelId===N.id);for(const R of(ie==null?void 0:ie.group.memberEntityRefs)??[])$.add(R)}return $}),g=n.computed(()=>{const N=y.value,$=new Set(b.value),ie=new Set,R=new Set;if(!N)return{related:$,edges:ie,notes:R};if(N.kind==="note"){R.add(N.id);for(const P of i.resolved.value.noteConnections)P.noteRef===N.id&&$.add(P.targetRef);return{related:$,edges:ie,notes:R}}const H=b.value;if(!H.size)return{related:$,edges:ie,notes:R};for(const P of i.resolved.value.associations){const{end1:se,end2:Ne}=P.association;(H.has(se.entityRef)||H.has(Ne.entityRef))&&(ie.add(P.association.modelId),$.add(se.entityRef),$.add(Ne.entityRef))}for(const P of i.resolved.value.noteConnections)$.has(P.targetRef)&&R.add(P.noteRef);return{related:$,edges:ie,notes:R}});n.provide(Fn,{source:y,active:n.computed(()=>y.value!==null),primaryEntityIds:b,relatedEntityIds:n.computed(()=>g.value.related),relatedEdgeIds:n.computed(()=>g.value.edges),relatedNoteIds:n.computed(()=>g.value.notes),hoverGroupId:n.computed(()=>{var N;return((N=y.value)==null?void 0:N.kind)==="group"?y.value.id:null}),setEntityHover:N=>{p.value||d.value||(y.value=N?{kind:"entity",id:N}:null)},setGroupHover:N=>{p.value||d.value||(y.value=N?{kind:"group",id:N}:null)},setNoteHover:N=>{p.value||d.value||(y.value=N?{kind:"note",id:N}:null)}}),n.provide(hn,i);function _(N,$){return`${or}${N}:${$}`}function C(N){if(!N.startsWith(or))return null;const[$,ie]=N.slice(or.length).split(":");return $&&ie?{noteRef:$,targetRef:ie}:null}n.provide(Tl,{points:N=>{var ie,R;const $=C(N);return $?((ie=i.resolved.value.noteConnections.find(H=>H.noteRef===$.noteRef&&H.targetRef===$.targetRef))==null?void 0:ie.waypoints)??[]:((R=i.resolved.value.associations.find(H=>H.association.modelId===N))==null?void 0:R.waypoints)??[]},movePoint:(N,$,ie)=>{const R=C(N);R?i.moveNoteConnectionWaypoint(R.noteRef,R.targetRef,$,ie):i.moveWaypoint(N,$,ie)},insertPoint:(N,$,ie)=>{const R=C(N);R?i.addNoteConnectionWaypoint(R.noteRef,R.targetRef,$,ie):i.addWaypoint(N,$,ie)},removePoint:(N,$)=>{const ie=C(N);ie?i.removeNoteConnectionWaypoint(ie.noteRef,ie.targetRef,$):i.removeWaypoint(N,$)}});const h=Pe(),{nodes:E,edges:Z,findNode:L,findEdge:G,addNodes:T,addEdges:S,removeNodes:O,removeEdges:te,fitView:M,setCenter:oe,getViewport:w,screenToFlowCoordinate:j,getSelectedNodes:A,updateNodeInternals:W}=h,Q=n.ref(!1);async function ee(N){Q.value=!0,await n.nextTick(),await new Promise($=>requestAnimationFrame(()=>$(null)));try{return await N()}finally{Q.value=!1}}function x(){return ee(()=>df(h))}function X(){return ee(()=>uf(h))}t({exportSvg:x,exportPng:X});const le=n.computed(()=>i.resolved.value.entities.length===0);function pe(){const N=w(),{width:$,height:ie}=h.dimensions.value;return{x:($/2-N.x)/N.zoom,y:(ie/2-N.y)/N.zoom}}function be(){const N=pe();i.addEntity("NewEntity",{x:N.x,y:N.y})}function de(){const N=pe();i.addNote("메모",{x:N.x,y:N.y})}function me(N){for(const $ of i.resolved.value.groups){const{location:ie,size:R}=$.geo;if(N.x>=ie.x&&N.x<=ie.x+R.width&&N.y>=ie.y&&N.y<=ie.y+R.height)return $.group.modelId}return null}function ye(){const N=i.resolved.value,$=new Map(N.groups.map(se=>[se.group.modelId,se.geo])),ie=new Set(N.groups.map(se=>se.group.modelId)),R=new Set([...ie,...N.entities.map(se=>se.entity.modelId),...N.notes.map(se=>se.note.modelId)]);for(const se of[...E.value])R.has(se.id)||O([se.id]);for(const se of N.groups){const Ne=se.group.modelId,fe={width:`${se.geo.size.width}px`,height:`${se.geo.size.height}px`},Me={group:se.group,style:se.style,locked:se.locked},Le=se.locked?!1:void 0,Ue=L(Ne);Ue?(Ue.position={...se.geo.location},Ue.data=Me,Ue.style=fe,Ue.draggable=Le):T([{id:Ne,type:"group",position:{...se.geo.location},draggable:Le,style:fe,data:Me}])}for(const se of N.entities){const Ne=se.entity.modelId,fe=se.groupRef&&ie.has(se.groupRef)?se.groupRef:void 0,Me={entity:se.entity,displayMode:i.displayMode.value,collapsed:se.collapsed,locked:se.locked,groupRef:fe,size:se.geo.size,style:se.style,attributeStyles:se.attributeStyles,operationStyles:se.operationStyles},Le=se.locked?!1:void 0,Ue=fe?$.get(fe):void 0,Qe=Ue?{x:se.geo.location.x-Ue.location.x,y:se.geo.location.y-Ue.location.y}:{...se.geo.location},Ge=L(Ne);Ge?(Ge.position=Qe,Ge.data=Me,Ge.parentNode=fe,Ge.draggable=Le):T([{id:Ne,type:"entity",position:Qe,parentNode:fe,draggable:Le,data:Me}])}for(const se of N.notes){const Ne=se.note,fe=Ne.modelId,Me=se.groupRef&&ie.has(se.groupRef)?se.groupRef:void 0,Le={note:Ne,groupRef:Me},Ue={width:`${Ne.geo.size.width}px`,height:`${Ne.geo.size.height}px`},Qe=Me?$.get(Me):void 0,Ge=Qe?{x:Ne.geo.location.x-Qe.location.x,y:Ne.geo.location.y-Qe.location.y}:{...Ne.geo.location},Ke=L(fe);Ke?(Ke.position=Ge,Ke.data=Le,Ke.style=Ue,Ke.parentNode=Me):T([{id:fe,type:"note",position:Ge,parentNode:Me,style:Ue,data:Le}])}const H=new Map(N.associations.map(se=>[se.association.modelId,se])),P=new Set(N.noteConnections.map(se=>_(se.noteRef,se.targetRef)));for(const se of[...Z.value])!H.has(se.id)&&!P.has(se.id)&&te([se.id]);for(const[se,Ne]of H){const fe={id:se,type:"association",source:Ne.association.end1.entityRef,target:Ne.association.end2.entityRef,sourceHandle:Ne.sourceColumnRef?`r:${Ne.sourceColumnRef}`:void 0,targetHandle:Ne.targetColumnRef?`l:${Ne.targetColumnRef}`:void 0,data:{association:Ne.association,sourceColumnRef:Ne.sourceColumnRef,targetColumnRef:Ne.targetColumnRef}},Me=G(se);Me?(Me.data=fe.data,Me.sourceHandle=fe.sourceHandle,Me.targetHandle=fe.targetHandle):S([fe])}for(const se of N.noteConnections){const Ne=_(se.noteRef,se.targetRef),fe={noteRef:se.noteRef,targetRef:se.targetRef},Me=G(Ne);Me?Me.data=fe:S([{id:Ne,type:"note-connection",source:se.noteRef,target:se.targetRef,data:fe}])}ve()}function ve(){n.nextTick(()=>requestAnimationFrame(()=>W()))}function Ce(){const N=A.value.map(ie=>ie.id);if(N.length)return N;const $=i.selection.value;return $&&($.kind==="entity"||$.kind==="note"||$.kind==="group")?[$.id]:[]}function xe(N){var H;const $=N.target;if($&&($.tagName==="INPUT"||$.tagName==="TEXTAREA"||$.isContentEditable))return;if(N.key==="?"){a.openModal({component:ff}),N.preventDefault();return}if(!i.editable.value){(N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="c"&&(i.copy(),N.preventDefault());return}if(N.key==="Delete"||N.key==="Backspace"){i.deleteSelection()&&N.preventDefault();return}if(N.key==="ArrowUp"||N.key==="ArrowDown"||N.key==="ArrowLeft"||N.key==="ArrowRight"){if(((H=i.selection.value)==null?void 0:H.kind)==="attribute"){if(N.key==="ArrowUp"||N.key==="ArrowDown"){const fe=N.key==="ArrowDown"?1:-1;(N.altKey?i.nudgeSelectedAttributes(fe):i.moveAttributeFocus(fe))&&N.preventDefault()}return}const P=N.shiftKey?10:1,se=N.key==="ArrowLeft"?-P:N.key==="ArrowRight"?P:0,Ne=N.key==="ArrowUp"?-P:N.key==="ArrowDown"?P:0;i.nudgeNodes(Ce(),se,Ne)&&N.preventDefault();return}if(!(N.metaKey||N.ctrlKey))return;const R=N.key.toLowerCase();R==="c"?(i.copy(),N.preventDefault()):R==="v"?(i.paste(),N.preventDefault()):R==="z"&&(N.shiftKey?i.redo():i.undo(),N.preventDefault())}n.onMounted(async()=>{ye(),await n.nextTick(),M(),window.addEventListener("keydown",xe),window.addEventListener("pointerup",ge),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",xe),window.removeEventListener("pointerup",ge),window.removeEventListener("pointermove",f)});function ge(){m.value=null}function J(){d.value=!0,y.value=null}function q(){var R;d.value=!1;const N=(R=document.elementFromPoint(u.x,u.y))==null?void 0:R.closest(".vue-flow__node"),$=N==null?void 0:N.dataset.id;if(!$){y.value=null;return}const ie=N.classList.contains("vue-flow__node-group")?"group":N.classList.contains("vue-flow__node-note")?"note":"entity";y.value={kind:ie,id:$}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ye),n.watch(()=>i.revision.value,ve),n.watch(()=>i.resolved.value,N=>{const $=y.value;if(!$)return;($.kind==="entity"?N.entities.some(R=>R.entity.modelId===$.id):$.kind==="group"?N.groups.some(R=>R.group.modelId===$.id):N.notes.some(R=>R.note.modelId===$.id))||(y.value=null)});function v(N){const $=N.computedPosition??N.position,ie=N.dimensions??{width:0,height:0};return{x:$.x+ie.width/2,y:$.y+ie.height/2}}function V(N){const $=N.node;if($){if(y.value=null,$.type==="group"){const ie=i.resolved.value.groups.find(R=>R.group.modelId===$.id);p.value=ie?{groupId:$.id,dx:$.position.x-ie.geo.location.x,dy:$.position.y-ie.geo.location.y}:null,m.value=null;return}if($.type!=="entity"&&$.type!=="note"){m.value=null;return}m.value=me(v($))}}function Y(N){var R;m.value=null,p.value=null;const $=(R=N.nodes)!=null&&R.length?N.nodes:[N.node],ie=$.filter(H=>(H==null?void 0:H.type)==="group");if(ie.length){for(const H of ie){if(!H)continue;const P=i.resolved.value.entities.filter(se=>se.groupRef===H.id).map(se=>{const Ne=L(se.entity.modelId),fe=(Ne==null?void 0:Ne.computedPosition)??(Ne==null?void 0:Ne.position)??{x:0,y:0};return{id:se.entity.modelId,location:{x:fe.x,y:fe.y}}});i.dragGroup(H.id,{x:H.position.x,y:H.position.y},P)}return}for(const H of $){if(!H||H.type==="group")continue;const P=H.computedPosition??H.position,se=H.dimensions??{width:0,height:0},Ne={x:P.x+se.width/2,y:P.y+se.height/2};H.type==="note"?i.dropNote(H.id,{x:P.x,y:P.y},me(Ne)):i.dropEntity(H.id,{x:P.x,y:P.y},me(Ne))}}function D(N){var fe,Me,Le,Ue,Qe;if(!i.editable.value||!N.source||!N.target)return;const $=((fe=L(N.source))==null?void 0:fe.type)==="note",ie=((Me=L(N.target))==null?void 0:Me.type)==="note";if($||ie){if($&&ie)return;const Ge=$?N.source:N.target,Ke=$?N.target:N.source;((Le=L(Ke))==null?void 0:Le.type)==="entity"&&i.addNoteConnection(Ge,Ke);return}const R=Ge=>{var Ke;return(Ke=i.state.logical.entities.find(St=>St.modelId===Ge))==null?void 0:Ke.stereotype},H=R(N.source)==="JPA_EMBEDDABLE",P=R(N.target)==="JPA_EMBEDDABLE";if(H||P){if(H&&P)return;const Ge=H?N.source:N.target,Ke=H?N.target:N.source;i.addEmbedAssociation(Ke,Ge);return}const se=(Ue=N.sourceHandle)!=null&&Ue.startsWith("r:")?N.sourceHandle.slice(2):void 0,Ne=(Qe=N.targetHandle)!=null&&Qe.startsWith("l:")?N.targetHandle.slice(2):void 0;i.addAssociation(N.source,N.target,se,Ne)}const K=n.ref(null);function he(N,$){var R;const ie=i.state.layout.entityLayouts.find(H=>H.entityRef===N);return it((R=ie==null?void 0:ie.attributeStyles)==null?void 0:R[$])}function Ee(N,$){var R;const ie=i.state.layout.entityLayouts.find(H=>H.entityRef===N);return it((R=ie==null?void 0:ie.operationStyles)==null?void 0:R[$])}function Ie(N){var $;return it(($=i.state.layout.groupLayouts.find(ie=>ie.groupRef===N))==null?void 0:$.style)}function we(N){var $;return it(($=i.state.layout.notes.find(ie=>ie.modelId===N))==null?void 0:$.style)}function Re(N){var R,H;if(N.preventDefault(),!i.editable.value)return;const $=()=>j({x:N.clientX,y:N.clientY}),ie=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const P=$();i.addEntity("NewEntity",{x:P.x,y:P.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const P=$();i.addNote("메모",{x:P.x,y:P.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const P=$();i.addEmptyGroup({x:P.x,y:P.y})}}];((R=i.clipboard.value)==null?void 0:R.kind)==="entity"&&ie.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&ie.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(H=K.value)==null||H.open(N,ie)}function Ae({event:N,node:$}){var fe,Me,Le,Ue,Qe,Ge,Ke,St,Zt,_e,et,Oo,Lo,Po,zo,Uo,Fo,Ho;const ie=N;if(ie.preventDefault(),!i.editable.value){if($.type==="group"||$.type==="note")return;const Be=(Me=(fe=ie.target)==null?void 0:fe.closest("[data-attr]"))==null?void 0:Me.dataset.attr;if(Be){const je=i.selection.value;(je==null?void 0:je.kind)==="attribute"&&je.entityId===$.id&&je.ids.includes(Be)||i.selectAttribute($.id,Be);const wn=((Le=i.selection.value)==null?void 0:Le.kind)==="attribute"&&i.selection.value.entityId===$.id?[...i.selection.value.ids]:[Be];(Ue=K.value)==null||Ue.open(ie,[{caption:wn.length>1?`복사 (${wn.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Qe=K.value)==null||Qe.open(ie,[{caption:"상세 편집…",icon:"pencil",handler:()=>qi(a,i,$.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:$.id},i.copy()}}]);return}if($.type==="group"){const Be=i.isGroupLocked($.id),je=[];Be||je.push({type:"swatches",caption:"색상",current:Ie($.id),onPick:nt=>i.setGroupSwatch($.id,nt)},{type:"separator"}),je.push({caption:Be?"잠금 해제":"잠금",icon:Be?"unlock":"lock",handler:()=>i.setGroupLocked($.id,!Be)}),Be||je.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup($.id)}),(Ge=K.value)==null||Ge.open(ie,je);return}if($.type==="note"){(Ke=K.value)==null||Ke.open(ie,[{type:"swatches",caption:"색상",current:we($.id),onPick:Be=>i.setNoteSwatch($.id,Be)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote($.id)}]);return}const R=(Zt=(St=ie.target)==null?void 0:St.closest("[data-attr]"))==null?void 0:Zt.dataset.attr;if(R){const Be=i.selection.value;(Be==null?void 0:Be.kind)==="attribute"&&Be.entityId===$.id&&Be.ids.includes(R)||i.selectAttribute($.id,R);const nt=((_e=i.selection.value)==null?void 0:_e.kind)==="attribute"&&i.selection.value.entityId===$.id?[...i.selection.value.ids]:[R];if(i.isEntityLocked($.id)){(et=K.value)==null||et.open(ie,[{caption:nt.length>1?`복사 (${nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const wn=nt.length>1,ir=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute($.id)},{type:"swatches",caption:wn?`색상 (${nt.length})`:"색상",current:wn?null:he($.id,R),onPick:DC=>i.setAttributeSwatches($.id,nt,DC)},{type:"separator"},{caption:wn?`복사 (${nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Go=i.clipboard.value;(Go==null?void 0:Go.kind)==="attribute"&&ir.push({caption:Go.attributes.length>1?`속성 붙여넣기 (${Go.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:$.id},i.paste()}}),ir.push({type:"separator"},{caption:wn?`속성 삭제 (${nt.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes($.id,nt)}),(Oo=K.value)==null||Oo.open(ie,ir);return}const H=(Po=(Lo=ie.target)==null?void 0:Lo.closest("[data-op]"))==null?void 0:Po.dataset.op;if(H){if(i.isEntityLocked($.id))return;(zo=K.value)==null||zo.open(ie,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation($.id)},{type:"swatches",caption:"색상",current:Ee($.id,H),onPick:Be=>i.setOperationSwatch($.id,H,Be)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation($.id,H)}]);return}const P=i.resolved.value.entities.find(Be=>Be.entity.modelId===$.id),se=!!(P!=null&&P.locked),Ne=[{caption:se?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>qi(a,i,$.id)}];if(!se){Ne.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute($.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation($.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const je=A.value.filter(nt=>nt.type==="entity").map(nt=>nt.id);i.createGroup(je.includes($.id)&&je.length?je:[$.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation($.id,$.id)});const Be=i.embeddableCatalog.value;if(Be.length){Ne.push({type:"separator"});for(const je of Be){const nt=((Uo=je.label)==null?void 0:Uo.ko)??((Fo=je.label)==null?void 0:Fo.en)??je.type;Ne.push({caption:`임베더블 추가: ${nt}`,icon:"link",handler:()=>i.addPredefinedEmbed($.id,je.type)})}}}if(Ne.push({type:"separator"}),Ne.push({caption:P!=null&&P.collapsed?"펼치기":"접기",icon:P!=null&&P.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed($.id,!(P!=null&&P.collapsed))}),P!=null&&P.groupRef&&!se&&Ne.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity($.id)}),Ne.push({caption:se?"잠금 해제":"잠금",icon:se?"unlock":"lock",handler:()=>i.setEntityLocked($.id,!se)}),Ne.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:$.id},i.copy()}}),!se){const Be=i.clipboard.value;(Be==null?void 0:Be.kind)==="attribute"&&Ne.push({caption:Be.attributes.length>1?`속성 붙여넣기 (${Be.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:$.id},i.paste()}}),Ne.push({type:"separator"}),Ne.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity($.id)})}(Ho=K.value)==null||Ho.open(ie,Ne)}function De({event:N,edge:$}){var H,P;const ie=N;if(ie.preventDefault(),!i.editable.value)return;const R=C($.id);if(R){(H=K.value)==null||H.open(ie,[{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}(P=K.value)==null||P.open(ie,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints($.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation($.id)}])}function We(N){return N==="group"?"group":N==="note"?"note":"entity"}function I({node:N}){if(A.value.length>1){i.selection.value=null;return}i.selection.value={kind:We(N.type),id:N.id}}function B({nodes:N}){N.length>1&&(i.selection.value=null)}function re({edge:N}){const $=C(N.id);i.selection.value=$?{kind:"note",id:$.noteRef}:{kind:"association",id:N.id}}function ue(N){const $=i.selection.value;return!!$&&$.kind!=="attribute"&&$.id===N.id}function z(N){var $,ie;return ue(N)?N.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":N.type==="note"?"var(--em-note-soft)":N.type==="group"?Fd(it(($=N.data)==null?void 0:$.style),!0)??"var(--em-mm-group)":Fd(it((ie=N.data)==null?void 0:ie.style))??"var(--em-mm-entity)"}function U(N){return ue(N)?"var(--em-selection)":N.type==="note"?"var(--em-note-accent)":N.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function k(N,$){oe(N,$,{zoom:w().zoom,duration:350})}n.watch(()=>i.focusRequest.value,N=>{if(!N)return;const $=L(N.id);if(!$)return;const ie=$.computedPosition??$.position,R=$.dimensions??{width:0,height:0};k(ie.x+R.width/2,ie.y+R.height/2)});function F({position:N}){k(N.x,N.y)}function ne({node:N}){i.selection.value={kind:We(N.type),id:N.id};const $=N.computedPosition??N.position,ie=N.dimensions??{width:0,height:0};k($.x+ie.width/2,$.y+ie.height/2)}function ce({node:N}){M({nodes:[N.id],duration:350,maxZoom:1.2,padding:.6})}return(N,$)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(v1),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!Q.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:q,onConnect:D,onConnectStart:$[1]||($[1]=ie=>c.value=!0),onConnectEnd:$[2]||($[2]=ie=>c.value=!1),onNodeDrag:V,onNodeDragStop:Y,onNodeClick:I,onEdgeClick:re,onSelectionChange:B,onPaneClick:$[3]||($[3]=ie=>n.unref(i).selection.value=null),onPaneContextMenu:Re,onNodeContextMenu:Ae,onEdgeContextMenu:De},{"node-group":n.withCtx(ie=>[n.createVNode(Qd,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"node-entity":n.withCtx(ie=>[n.createVNode(Jd,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"node-note":n.withCtx(ie=>[n.createVNode(eu,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"edge-association":n.withCtx(ie=>[n.createVNode(pu,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"edge-note-connection":n.withCtx(ie=>[n.createVNode(a$,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Kk),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(_E),{"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(yn),{class:"em-palette__group-start",title:"엔티티 추가",onClick:be},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(yn),{title:"노트 추가",onClick:de},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(yn),{title:"자동 배치",onClick:$[0]||($[0]=ie=>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(t$),{key:1,pannable:"",width:224,height:160,"node-color":z,"node-stroke-color":U,"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:F,onNodeClick:ne,onNodeDblclick:ce})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),le.value?(n.openBlock(),n.createElementBlock("div",V$,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[$[4]||($[4]=n.createElementVNode("p",{class:"em-canvas__empty-title"},"빈 다이어그램입니다",-1)),$[5]||($[5]=n.createElementVNode("p",{class:"em-canvas__empty-hint"},[n.createTextVNode(" 캔버스를 "),n.createElementVNode("strong",null,"우클릭"),n.createTextVNode("하거나 좌하단 "),n.createElementVNode("strong",null,"+"),n.createTextVNode(" 버튼으로 첫 엔티티를 추가하세요. ")],-1)),$[6]||($[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",A$,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",T$,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",M$,[n.createElementVNode("strong",B$,n.toDisplayString(s.value.title),1),n.createElementVNode("span",D$,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(y$,{ref_key:"menuRef",ref:K},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",O$,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function ga(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function L$(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 P$={class:"em-explorer em-scroll-overlay"},z$={class:"em-explorer__search"},U$={key:0,class:"em-explorer__empty"},F$={class:"em-explorer__rows"},H$=["data-key","onClick","onDblclick"],G$=["onClick"],Y$=["title"],W$={class:"em-key-slot"},K$={class:"em-key-slot"},q$={class:"em-explorer__label"},pf=ze(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.computed(()=>{var ee;const L=i.resolved.value,G=i.displayMode.value,T=x=>{var X,le,pe;return Ko(G,x.name,(le=(X=x.table)==null?void 0:X.logicalName)==null?void 0:le.ko,(pe=x.table)==null?void 0:pe.physicalName)},S=G==="PHYSICAL"||G==="LOGICAL_PHYSICAL",O=x=>{const X=x.attrType.startsWith("RELATION")&&x.dbAttrs.length>0;return{icon:x.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:x.identifier,fk:X&&S}}},te=x=>x.attrType.startsWith("EMBED")&&x.dbAttrs.length>0,M=G==="PHYSICAL"||G==="LOGICAL_PHYSICAL",oe=x=>{if(x.attrType!=="EMBED_PREDEF")return x.dbAttrs;const X=i.embeddableCatalog.value.find(le=>le.type===x.type);return X?x.dbAttrs.map((le,pe)=>{const be=X.fields[pe];return be?{...le,physicalName:le.physicalName||be.physicalName,logicalName:le.logicalName??be.logicalName,dataType:le.dataType||be.dataType,length:le.length??be.length}:le}):x.dbAttrs},w=(x,X)=>{var de,me,ye,ve,Ce,xe,ge,J,q;const le={entityId:X,attrId:x.modelId};if(te(x)){const v=Aa(G,x);return{key:`attr:${x.modelId}`,label:x.name+(v?` : ${v}`:""),icon:"table",attrRef:le,focusId:X,matchText:ga(x.name,(me=(de=x.dbAttrs[0])==null?void 0:de.logicalName)==null?void 0:me.ko,(ye=x.dbAttrs[0])==null?void 0:ye.physicalName),children:M?oe(x).map(V=>{var Y,D;return{key:`attr:${x.modelId}:col:${V.modelId}`,label:Ko(G,V.physicalName,(Y=V.logicalName)==null?void 0:Y.ko,V.physicalName)+(V.dataType?` : ${V.dataType}`:""),icon:"field",attrRef:le,focusId:X,matchText:ga(V.physicalName,(D=V.logicalName)==null?void 0:D.ko),children:[]}}):[]}}const pe=Er(x,i.state.logical.associations),be=Aa(G,x,pe);return{key:`attr:${x.modelId}`,label:Ko(G,x.name,(Ce=(ve=x.dbAttrs[0])==null?void 0:ve.logicalName)==null?void 0:Ce.ko,(xe=x.dbAttrs[0])==null?void 0:xe.physicalName)+(be?` : ${be}`:""),...O(x),attrRef:le,focusId:X,matchText:ga(x.name,(J=(ge=x.dbAttrs[0])==null?void 0:ge.logicalName)==null?void 0:J.ko,(q=x.dbAttrs[0])==null?void 0:q.physicalName),children:[]}},j=x=>{var pe,be,de;const X=x.entity,le=[...X.attributes].sort((me,ye)=>me.order-ye.order);return{key:`entity:${X.modelId}`,label:T(X),icon:"table",selectKind:"entity",selectId:X.modelId,focusId:X.modelId,matchText:ga(X.name,(be=(pe=X.table)==null?void 0:pe.logicalName)==null?void 0:be.ko,(de=X.table)==null?void 0:de.physicalName),children:le.map(me=>w(me,X.modelId))}},A=new Map,W=[];for(const x of L.entities)if(x.groupRef){const X=A.get(x.groupRef)??[];X.push(x),A.set(x.groupRef,X)}else W.push(x);const Q=[];for(const x of L.groups){const X=x.group;Q.push({key:`group:${X.modelId}`,label:((ee=X.name)==null?void 0:ee.ko)||X.packageName||"(그룹)",icon:"folder",focusId:X.modelId,children:(A.get(X.modelId)??[]).map(j)})}for(const x of W)Q.push(j(x));if(L.associations.length){const x=new Map(L.entities.map(X=>[X.entity.modelId,T(X.entity)]));Q.push({key:"section:associations",label:`관계 (${L.associations.length})`,icon:"arrow-lr",children:L.associations.map(X=>{const le=X.association,pe=x.get(le.end1.entityRef)??le.end1.entityRef,be=x.get(le.end2.entityRef)??le.end2.entityRef;return{key:`assoc:${le.modelId}`,label:`${pe} — ${be}`,icon:"arrow-lr",selectKind:"association",selectId:le.modelId,children:[]}})})}return L.notes.length&&Q.push({key:"section:notes",label:`노트 (${L.notes.length})`,icon:"note",children:L.notes.map(({note:x})=>{var X;return{key:`note:${x.modelId}`,label:((X=x.memo.split(`
43
+ `)[0])==null?void 0:X.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:x.modelId,focusId:x.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:Q}});function r(L){return L?L.pk&&L.fk?"PFK (식별 외래키)":L.pk?"PK (기본키)":L.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(L){const G=new Set(s.value);G.has(L)?G.delete(L):G.add(L),s.value=G}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),m=n.computed(()=>{const L=[];if(f.value){const T=L$(l.value,d.value.trim().toLowerCase()),S=(O,te)=>{if(T.has(O.key)){L.push({node:O,depth:te});for(const M of O.children)S(M,te+1)}};return S(l.value,0),L}const G=(T,S)=>{if(L.push({node:T,depth:S}),!s.value.has(T.key))for(const O of T.children)G(O,S+1)};return G(l.value,0),L}),p=n.computed(()=>f.value&&m.value.length<=1);function y(L){var S;if(L.key!=="/"||L.metaKey||L.ctrlKey||L.altKey||L.shiftKey)return;const G=L.target,T=G==null?void 0:G.tagName;T==="INPUT"||T==="TEXTAREA"||T==="SELECT"||G!=null&&G.isContentEditable||(L.preventDefault(),(S=u.value)==null||S.focus())}n.onMounted(()=>window.addEventListener("keydown",y)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",y));const b=n.computed(()=>{const L=[],G=T=>{if(T.children.length){T.key!=="root"&&L.push(T.key);for(const S of T.children)G(S)}};return G(l.value),L}),g=n.computed(()=>!b.value.some(L=>s.value.has(L)));function _(){s.value=g.value?new Set(b.value):new Set}t({toggleAll:_,allExpanded:g,hasExpandable:n.computed(()=>b.value.length>0)});function C(L){const G=i.selection.value;return L.attrRef?(G==null?void 0:G.kind)==="attribute"&&G.entityId===L.attrRef.entityId&&G.ids.includes(L.attrRef.attrId):!!G&&G.kind!=="attribute"&&!!L.selectId&&L.selectKind===G.kind&&L.selectId===G.id}function h(L){const G=i.selection.value;return L.selectKind==="entity"&&(G==null?void 0:G.kind)==="attribute"&&G.entityId===L.selectId}function E(L,G){if(L.attrRef){const T=G.shiftKey?"range":G.metaKey||G.ctrlKey?"toggle":"replace";i.selectAttribute(L.attrRef.entityId,L.attrRef.attrId,T)}else L.selectKind&&L.selectId&&(i.selection.value={kind:L.selectKind,id:L.selectId});L.focusId&&i.requestFocus(L.focusId)}function Z(L){L.selectKind==="entity"&&L.selectId&&qi(a,i,L.selectId)}return(L,G)=>(n.openBlock(),n.createElementBlock("section",P$,[n.createElementVNode("div",z$,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":G[0]||(G[0]=T=>d.value=T),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:G[1]||(G[1]=n.withKeys(T=>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:G[2]||(G[2]=T=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),p.value?(n.openBlock(),n.createElementBlock("p",U$,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",F$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,({node:T,depth:S})=>(n.openBlock(),n.createElementBlock("div",{key:T.key,class:n.normalizeClass(["em-explorer__row",{"is-active":C(T),"is-focus-parent":h(T),"is-selectable":!!T.selectKind||!!T.attrRef||!!T.focusId}]),"data-key":T.key,style:n.normalizeStyle({paddingLeft:4+S*14+"px"}),onClick:O=>E(T,O),onDblclick:O=>Z(T)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!T.children.length,"is-open":!s.value.has(T.key)}]),onClick:n.withModifiers(O=>T.children.length&&c(T.key),["stop"])},[T.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,G$),T.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(T.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",W$,[T.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):T.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:T.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",K$,[T.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Y$)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:T.icon,size:15},null,8,["name"])),n.createElementVNode("span",q$,n.toDisplayString(T.label),1)],46,H$))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),X$={class:"em-text-export"},j$={key:0,class:"em-text-export__tabs",role:"tablist"},Z$=["aria-selected","onClick"],J$={class:"em-text-export__pre"},Q$={class:"em-text-export__actions"},ex=ze(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ae.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),ae.showNotification("클립보드에 복사되었습니다.","info")}catch{ae.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(ae.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",X$,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",j$,[(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,Z$))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",J$,n.toDisplayString(a().content),1),n.createElementVNode("div",Q$,[n.createVNode(n.unref(ae.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ae.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),tx={class:"em-toolbar"},nx={class:"em-toolbar__mode"},hf=ze(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ae.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(y=>y.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){const p=i.state.logical;l.openModal({component:ex,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:mr(p),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:$a(p,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:$a(p,"class"),filename:"diagram.class.mmd"}]}})}function m(){l.openModal({component:ff})}return(p,y)=>(n.openBlock(),n.createElementBlock("div",tx,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:y[0]||(y[0]=b=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:y[1]||(y[1]=b=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),y[10]||(y[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",nx,[y[8]||(y[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:s.value,"onUpdate:modelValue":y[2]||(y[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(ae.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(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:y[3]||(y[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(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:y[4]||(y[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(ae.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"]),y[11]||(y[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.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(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:y[5]||(y[5]=b=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:y[6]||(y[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},[y[9]||(y[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:y[7]||(y[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(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:"키보드 단축키 (?)",onClick:m},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1})]))}}),[["__scopeId","data-v-aea19e30"]]),ox={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},ix=["title"],ax=["disabled","aria-pressed"],lx=["disabled","aria-pressed"],rx=ze(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",ox,[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,ax),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,lx)],10,ix))}}),[["__scopeId","data-v-44f7d737"]]),sx=["disabled"],cx={class:"em-panel__sub"},dx={class:"em-nav"},ux={key:0,class:"em-nav__divider","aria-hidden":"true"},fx={key:1},mx=["onClick","onKeydown"],px={class:"em-nav__name"},hx=["title"],yx={key:0,class:"em-panel__note"},gx=["data-attr-block"],bx={class:"em-attr__row"},_x=["title"],wx={key:0,class:"em-attr__row"},kx={class:"em-attr__row"},Ex={class:"em-attr__row"},vx={class:"em-attr__flags"},Nx={class:"em-attr__pii"},Ix={class:"em-attr__pii"},$x={class:"em-attr__pii"},xx={key:0,class:"em-attr__pii em-attr__codetop"},Sx={class:"em-multilang"},Cx={key:2,class:"em-embed-cols"},Rx={class:"em-embed-col__label"},Vx={class:"em-attr__row"},Ax={class:"em-attr__row"},Tx={key:0,class:"em-embed-upd"},Mx={class:"em-embed-upd"},Bx={class:"em-embed-upd"},Dx={class:"em-swatch__row em-attr__swatch"},Ox=["onClick"],Lx=["title","onClick"],Px={key:0,class:"em-attr__swatch-hint"},zx="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",ba="__OWN__",Ux=ze(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(H=>H.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&&!!di(o.state.logical,i.value.modelId,R.modelId)}function m(R){const H=u(R),P=[H.pk&&"PK",H.fk&&"FK",H.required&&"NOT NULL"].filter(Boolean);return P.length?P.join(" · "):void 0}function p(R,H){i.value&&o.selectAttribute(i.value.modelId,R.modelId,H.shiftKey?"range":H.metaKey||H.ctrlKey?"toggle":"replace")}const y=["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 g=R=>R;function _(R){var H,P;return it((P=(H=a.value)==null?void 0:H.attributeStyles)==null?void 0:P[R.modelId])}function C(R){return r.value.size>1&&r.value.has(R.modelId)}function h(R,H){if(!i.value)return;const P=C(R)?o.selectedAttrIds.value:[R.modelId];o.setAttributeSwatches(i.value.modelId,P,H)}function E(R,H){i.value&&o.updateAttribute(i.value.modelId,R.modelId,H)}function Z(R,H){E(R,{naturalId:H||void 0,naturalIdMutable:H?R.naturalIdMutable:void 0})}function L(){return{naturalId:void 0,naturalIdMutable:void 0}}function G(R,H){E(R,{identifier:H,...H?L():{}})}function T(R,H){E(R,{transient:H||void 0,...H?L():{}})}function S(R){return!!R.transient}const O=R=>R.value,te=R=>R.label;function M(R,H){if(!H)return;const P=x.value.find(se=>se.type===H);if(P){const se=R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"};E(R,{type:H,customType:void 0,dbAttrs:[{...se,dataType:P.dataType,length:P.length,scale:P.scale}]});return}E(R,H===Ct?{type:H}:{type:H,customType:void 0})}function oe(R,H){E(R,{customType:H.trim()===""?void 0:H})}function w(R,H){const se={...R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"},...H};H.dataType!==void 0&&!qo.has(se.dataType)&&(se.scale=void 0),E(R,{dbAttrs:[se]})}function j(R){var H;return qo.has(((H=R.dbAttrs[0])==null?void 0:H.dataType)??"")}function A(R,H,P){var se;w(R,{logicalName:{...(se=R.dbAttrs[0])==null?void 0:se.logicalName,[H]:P}})}function W(R,H){E(R,{description:Object.keys(H).length?H:void 0})}function Q(R){return R.personalInfoAttributeType??"none"}function ee(R,H){E(R,{personalInfoAttributeType:H==="none"?void 0:H})}const x=n.computed(()=>o.predefinedCustomTypeCatalog.value),X=n.computed(()=>o.embeddableCatalog.value),le=n.ref(void 0);function pe(R){var H,P;return((H=R.label)==null?void 0:H.ko)??((P=R.label)==null?void 0:P.en)??R.type}function be(R){if(!R||!i.value)return;const H=o.addPredefinedEmbed(i.value.modelId,R);H&&o.selectAttribute(i.value.modelId,H),le.value=void 0}function de(){if(!i.value)return;const R=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,R)}const me=n.computed(()=>o.groupCodeCatalog.value);function ye(R){var H;return((H=me.value.find(P=>P.groupCode===R.groupCode))==null?void 0:H.codes)??[]}function ve(R){return["none",...ye(R)]}function Ce(R){return R==="none"?"none":R.code}function xe(R){var P,se;if(R==="none")return"(없음)";const H=((P=R.label)==null?void 0:P.ko)??((se=R.label)==null?void 0:se.en);return H?`${R.code} (${H})`:R.code}function ge(R,H){i.value&&o.setAttributeGroupCode(i.value.modelId,R.modelId,H)}function J(R,H){E(R,{defaultValue:H==="none"?void 0:H})}function q(R,H){E(R,{defaultValue:H.trim()===""?void 0:H})}function v(R){return R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0}function V(R,H,P){const se=R.dbAttrs.map((Ne,fe)=>{if(fe!==H)return Ne;const Me={...Ne,...P};for(const Le of Object.keys(P))P[Le]===void 0&&delete Me[Le];return Me});i.value&&o.setEmbedColumns(i.value.modelId,R.modelId,se)}function Y(R,H,P,se){var Ne;V(R,H,{logicalName:{...(Ne=R.dbAttrs[H])==null?void 0:Ne.logicalName,[P]:se}})}function D(R,H){var Ne,fe,Me;if(R.attrType==="EMBED_PREDEF"){const Le=(Ne=o.embeddableCatalog.value.find(Ue=>Ue.type===R.type))==null?void 0:Ne.fields[H];return Le?{name:Le.name,physicalName:Le.physicalName,dataType:Le.dataType,length:Le.length,shareable:Le.shareable,logicalName:Le.logicalName}:void 0}const P=(fe=R.embedded)==null?void 0:fe.embeddableRef;if(!P)return;const se=(Me=o.state.logical.entities.find(Le=>Le.modelId===P))==null?void 0:Me.attributes.flatMap(Le=>Le.dbAttrs)[H];return se?{physicalName:se.physicalName,dataType:se.dataType,length:se.length,scale:se.scale,logicalName:se.logicalName}:void 0}function K(R,H){var P,se;return((P=D(R,H))==null?void 0:P.dataType)||((se=R.dbAttrs[H])==null?void 0:se.dataType)||""}function he(R,H){var P,se;return((P=D(R,H))==null?void 0:P.length)??((se=R.dbAttrs[H])==null?void 0:se.length)}function Ee(R,H){var P,se;return((P=D(R,H))==null?void 0:P.scale)??((se=R.dbAttrs[H])==null?void 0:se.scale)}const Ie=["inherit","true","false"];function we(R){return R==="inherit"?"기본(따름)":R}function Re(R){return(R==null?void 0:R.updatable)===void 0?"inherit":R.updatable?"true":"false"}function Ae(R,H,P){V(R,H,{updatable:P==="inherit"?void 0:P==="true"})}function De(R,H){w(R,{updatable:H==="inherit"?void 0:H==="true"})}const We=["inherit","true","false"];function I(R){return R==="inherit"?"기본(따름)":R}function B(R){return(R==null?void 0:R.insertable)===void 0?"inherit":R.insertable?"true":"false"}function re(R,H,P){V(R,H,{insertable:P==="inherit"?void 0:P==="true"})}function ue(R,H){w(R,{insertable:H==="inherit"?void 0:H==="true"})}const z=n.computed(()=>i.value?Xo(i.value,o.state.logical.entities):[]),U=n.computed(()=>Zn(z.value.flatMap(R=>R.attributes.flatMap(H=>H.dbAttrs)))),k=n.computed(()=>z.value.flatMap(R=>R.attributes.filter(H=>H.attrType==="NORMAL"&&H.dbAttrs.length===1&&H.dbAttrs[0]).map(H=>{var P;return{modelId:H.dbAttrs[0].modelId,physical:H.dbAttrs[0].physicalName||H.name,isCurrency:H.type==="Currency",ownerName:R.modelId===((P=i.value)==null?void 0:P.modelId)?void 0:R.name}})));function F(){const R=[...k.value].sort((H,P)=>Number(P.isCurrency)-Number(H.isCurrency));return[ba,...R.map(H=>H.modelId)]}function ne(R){if(R===ba)return"전용 컬럼(OWN)";const H=k.value.find(se=>se.modelId===R);return H?`↗ ${H.ownerName?`${H.ownerName}.`:""}${H.physical} (${H.isCurrency?"통화":"공유"})`:R}function ce(R){return(R==null?void 0:R.sharedColumnRef)??ba}function N(R,H,P){V(R,H,{sharedColumnRef:P===ba?void 0:P})}function $(R){return(R==null?void 0:R.sharedColumnRef)!=null}function ie(R){var H;return((H=Zo(R,U.value))==null?void 0:H.physicalName)??""}return(R,H)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",cx,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:de}),X.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":le.value,items:X.value,"value-provider":P=>P.type,"label-provider":pe,"onUpdate:modelValue":be},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",dx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,P=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:P.modelId},[P.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",ux,[...H[0]||(H[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",fx,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(P.modelId)}]),role:"button",tabindex:"0",onClick:se=>p(P,se),onKeydown:[n.withKeys(n.withModifiers(se=>p(P,se),["prevent"]),["enter"]),n.withKeys(n.withModifiers(se=>p(P,se),["prevent"]),["space"])]},[n.createElementVNode("span",px,n.toDisplayString(P.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:m(P)},[u(P).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(P).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(P).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,hx)],42,mx)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",yx," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>{var se,Ne,fe,Me,Le,Ue,Qe,Ge,Ke,St,Zt;return n.openBlock(),n.createElementBlock("div",{key:P.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(P.modelId)}]),"data-attr-block":P.modelId},[n.createElementVNode("div",bx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-name-${P.modelId}`,width:"100%",placeholder:"이름","model-value":P.name,"onUpdate:modelValue":_e=>E(P,{name:_e})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-type-${P.modelId}`,width:"84px",placeholder:"타입",disabled:P.attrType.startsWith("EMBED")||!!P.groupCode,items:n.unref(kr)(P.type,x.value),"value-provider":O,"label-provider":te,"model-value":P.type,"onUpdate:modelValue":_e=>M(P,_e)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(P)?zx:void 0},[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>n.unref(o).removeAttribute(i.value.modelId,P.modelId)},null,8,["onClick"])],8,_x)]),P.type===n.unref(Ct)?(n.openBlock(),n.createElementBlock("div",wx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-customtype-${P.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":P.customType??"","onUpdate:modelValue":_e=>oe(P,_e)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),v(P)?(n.openBlock(),n.createElementBlock("div",Cx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.dbAttrs,(_e,et)=>{var Oo,Lo,Po,zo,Uo,Fo,Ho;return n.openBlock(),n.createElementBlock("div",{key:_e.modelId,class:"em-embed-col"},[n.createElementVNode("span",Rx,n.toDisplayString(((Oo=D(P,et))==null?void 0:Oo.name)??((Lo=D(P,et))==null?void 0:Lo.physicalName)??`컬럼 ${et+1}`),1),n.createElementVNode("div",Vx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-col-${_e.modelId}`,width:"100%",disabled:$(_e),placeholder:((Po=D(P,et))==null?void 0:Po.physicalName)??"컬럼","model-value":$(_e)?ie(_e):_e.physicalName,"onUpdate:modelValue":Be=>V(P,et,{physicalName:Be})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSTextInput),{name:`embed-dtype-${_e.modelId}`,width:"84px",disabled:"","model-value":K(P,et)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-len-${_e.modelId}`,width:"48px",disabled:"","model-value":he(P,et)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-scale-${_e.modelId}`,width:"48px",disabled:"","model-value":Ee(P,et)},null,8,["name","model-value"])]),n.createVNode(pn,{controller:n.unref(o),"ref-id":_e.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",Ax,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-logical-${_e.modelId}`,width:"100%",placeholder:((Uo=(zo=D(P,et))==null?void 0:zo.logicalName)==null?void 0:Uo.ko)??"논리명","model-value":((Fo=_e.logicalName)==null?void 0:Fo.ko)??"","onUpdate:modelValue":Be=>Y(P,et,"ko",Be)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Ho=D(P,et))!=null&&Ho.shareable?(n.openBlock(),n.createElementBlock("label",Tx,[H[7]||(H[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px","model-value":ce(_e),items:F(),"value-provider":g,"label-provider":ne,"onUpdate:modelValue":Be=>Be&&N(P,et,Be)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",Mx,[H[8]||(H[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:$(_e),"model-value":$(_e)?"false":B(_e),items:We,"value-provider":g,"label-provider":I,"onUpdate:modelValue":Be=>Be&&re(P,et,Be)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Bx,[H[9]||(H[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:$(_e),"model-value":$(_e)?"false":Re(_e),items:Ie,"value-provider":g,"label-provider":we,"onUpdate:modelValue":Be=>Be&&Ae(P,et,Be)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",kx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-logical-${P.modelId}`,width:"100%",placeholder:"논리명","model-value":((Ne=(se=P.dbAttrs[0])==null?void 0:se.logicalName)==null?void 0:Ne.ko)??"","onUpdate:modelValue":_e=>A(P,"ko",_e)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Ex,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-col-${P.modelId}`,width:"100%",placeholder:"컬럼",disabled:S(P),"model-value":((fe=P.dbAttrs[0])==null?void 0:fe.physicalName)??"","onUpdate:modelValue":_e=>w(P,{physicalName:_e})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-dtype-${P.modelId}`,width:"84px",placeholder:"dataType",disabled:S(P),items:n.unref(_r)(((Me=P.dbAttrs[0])==null?void 0:Me.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":g,"label-provider":n.unref(Ca),"model-value":((Le=P.dbAttrs[0])==null?void 0:Le.dataType)??"","onUpdate:modelValue":_e=>_e&&w(P,{dataType:_e})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-len-${P.modelId}`,width:"48px",placeholder:"len",disabled:S(P),"model-value":(Ue=P.dbAttrs[0])==null?void 0:Ue.length,"onUpdate:modelValue":_e=>w(P,{length:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-scale-${P.modelId}`,width:"48px",placeholder:"scale",disabled:S(P)||!j(P),"model-value":(Qe=P.dbAttrs[0])==null?void 0:Qe.scale,"onUpdate:modelValue":_e=>w(P,{scale:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(pn,{controller:n.unref(o),"ref-id":(Ge=P.dbAttrs[0])==null?void 0:Ge.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",vx,[n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-pk-${P.modelId}`,label:"Primary Key","model-value":P.identifier,disabled:l.value||S(P),"onUpdate:modelValue":_e=>G(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nn-${P.modelId}`,label:"Not Null","model-value":P.notNull,disabled:S(P),"onUpdate:modelValue":_e=>E(P,{notNull:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-uq-${P.modelId}`,label:"Unique","model-value":!!((Ke=P.dbAttrs[0])!=null&&Ke.unique),disabled:S(P),"onUpdate:modelValue":_e=>w(P,{unique:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-ai-${P.modelId}`,label:"Auto Increment","model-value":!!((St=P.dbAttrs[0])!=null&&St.autoIncrement),disabled:S(P)||!P.identifier,"onUpdate:modelValue":_e=>w(P,{autoIncrement:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-tr-${P.modelId}`,label:"@Transient","model-value":!!P.transient,disabled:P.identifier,"onUpdate:modelValue":_e=>T(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nid-${P.modelId}`,label:"@NaturalId","model-value":!!P.naturalId,disabled:P.identifier||S(P),"onUpdate:modelValue":_e=>Z(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${P.modelId}`,label:"mutable","model-value":!!P.naturalIdMutable,disabled:S(P)||!P.naturalId,"onUpdate:modelValue":_e=>E(P,{naturalIdMutable:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-mv-${P.modelId}`,label:"Multi-Value (Set)","model-value":!!((Zt=P.dbAttrs[0])!=null&&Zt.multiValue),disabled:S(P),"onUpdate:modelValue":_e=>w(P,{multiValue:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",Nx,[H[1]||(H[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:S(P),"model-value":B(P.dbAttrs[0]),items:We,"value-provider":g,"label-provider":I,"onUpdate:modelValue":_e=>_e&&ue(P,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Ix,[H[2]||(H[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:S(P),"model-value":Re(P.dbAttrs[0]),items:Ie,"value-provider":g,"label-provider":we,"onUpdate:modelValue":_e=>_e&&De(P,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",$x,[H[3]||(H[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":Q(P),items:y,"value-provider":g,"label-provider":b,"onUpdate:modelValue":_e=>_e&&ee(P,_e)},null,8,["model-value","onUpdate:modelValue"])]),me.value.length?(n.openBlock(),n.createElementBlock("label",xx,[H[4]||(H[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Yd,{"model-value":P.groupCode,items:me.value,"onUpdate:modelValue":_e=>ge(P,_e)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!me.value.length}])},[H[5]||(H[5]=n.createElementVNode("span",null,"기본값",-1)),ye(P).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":P.defaultValue??"none",items:ve(P),"value-provider":Ce,"label-provider":xe,"onUpdate:modelValue":_e=>_e&&J(P,_e)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`attr-default-${P.modelId}`,width:"100%",placeholder:"기본값","model-value":P.defaultValue??"","onUpdate:modelValue":_e=>q(P,_e)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",Sx,[H[6]||(H[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Sl,{multiline:"",name:`attr-desc-${P.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":P.description,"onUpdate:modelValue":_e=>W(P,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",Dx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(P)===null}]),title:"없음",onClick:_e=>h(P,null)},"∅",10,Ox),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),_e=>(n.openBlock(),n.createElementBlock("button",{key:_e,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(P)===_e}]),style:n.normalizeStyle({background:n.unref(Pn)(_e)}),title:n.unref(Ln)(_e),onClick:et=>h(P,_e)},null,14,Lx))),128)),C(P)?(n.openBlock(),n.createElementBlock("span",Px,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,gx)}),128))],8,sx)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4d527728"]]),Fx=["disabled"],Hx={class:"em-panel__sub-label"},Gx={class:"em-attr__row"},Yx={class:"em-field em-idx-params"},Wx=["value","onChange"],Kx=ze(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(b=>b.modelId===o.entityId)??null),r=n.computed(()=>l.value?Wo(l.value,a.superClassCatalog.value):[]),s=n.computed(()=>{var b;return[...(((b=l.value)==null?void 0:b.attributes)??[]).map(g=>({value:g.modelId,label:g.name})),...r.value.map(g=>({value:g.modelId,label:`${g.field} (상속)`}))]});function c(){var g;if(!l.value)return;const b=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:Oe(),name:`idx_${(((g=l.value.indexes)==null?void 0:g.length)??0)+1}`,unique:!1,columns:b?[{columnRef:b.modelId,descending:!1}]:[]})}function d(b,g){l.value&&a.updateIndex(l.value.modelId,b,g)}function u(b){var _;const g=(_=l.value)==null?void 0:_.attributes[0];g&&d(b.modelId,{columns:[...b.columns,{columnRef:g.modelId,descending:!1}]})}function f(b,g,_){d(b.modelId,{columns:b.columns.map((C,h)=>h===g?{...C,columnRef:_}:C)})}function m(b,g,_){d(b.modelId,{columns:b.columns.map((C,h)=>h===g?{...C,descending:_}:C)})}function p(b,g){d(b.modelId,{columns:b.columns.filter((_,C)=>C!==g)})}function y(b,g){d(b.modelId,{parameters:g.trim()===""?void 0:g})}return(b,g)=>{var _;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:g[0]||(g[0]=C=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",Hx,[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(((_=l.value.indexes)==null?void 0:_.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(c,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],C=>(n.openBlock(),n.createElementBlock("div",{key:C.modelId,class:"em-attr"},[n.createElementVNode("div",Gx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`idx-name-${C.modelId}`,width:"100%",placeholder:"인덱스명","model-value":C.name,"onUpdate:modelValue":h=>d(C.modelId,{name:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-uq-${C.modelId}`,class:"em-check",label:"UQ","model-value":C.unique,"onUpdate:modelValue":h=>d(C.modelId,{unique:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:h=>n.unref(a).removeIndex(l.value.modelId,C.modelId)},null,8,["onClick"])]),n.createVNode(pn,{controller:n.unref(a),"ref-id":C.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(C.columns,(h,E)=>(n.openBlock(),n.createElementBlock("div",{key:E,class:"em-attr__row"},[n.createVNode(n.unref(ae.BSSelect),{class:"grow","model-value":h.columnRef,items:s.value,"value-provider":Z=>Z.value,"label-provider":Z=>Z.label,"onUpdate:modelValue":Z=>Z&&f(C,E,Z)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-${C.modelId}-desc-${E}`,class:"em-check",label:"DESC","model-value":h.descending,"onUpdate:modelValue":Z=>m(C,E,Z)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"−",onClick:Z=>p(C,E)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"컬럼",onClick:h=>u(C)},null,8,["onClick"]),n.createElementVNode("label",Yx,[g[1]||(g[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:C.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:h=>y(C,h.target.value)},null,40,Wx)])]))),128)):n.createCommentVNode("",!0)],8,Fx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-8c0c5afc"]]),qx=["disabled"],Xx={class:"em-panel__sub-label"},jx={class:"em-attr__row"},Zx={class:"em-attr__row"},Jx={class:"em-multilang"},Qx={class:"em-attr__pii"},eS={class:"em-swatch__row em-attr__swatch"},tS=["onClick"],nS=["title","onClick"],oS=ze(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=ae.useModal(),r=n.computed(()=>a.state.logical.entities.find(h=>h.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(h=>h.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(h){return h==="none"?"(없음)":h}const f=h=>h;function m(h,E){r.value&&a.updateOperation(r.value.modelId,h.modelId,E)}function p(h,E){m(h,{description:Object.keys(E).length?E:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function b(h,E){m(h,{personalInfoAttributeType:E==="none"?void 0:E})}function g(h){var E,Z;return it((Z=(E=s.value)==null?void 0:E.operationStyles)==null?void 0:Z[h.modelId])}function _(h,E){r.value&&a.setOperationSwatch(r.value.modelId,h.modelId,E)}function C(h){l.openModal({component:Wd,bind:{operationName:h.name,sourceCode:h.sourceCode??"",onSave:E=>m(h,{sourceCode:E})}})}return(h,E)=>{var Z;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:E[1]||(E[1]=L=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",Xx,[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(((Z=r.value.operations)==null?void 0:Z.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:E[0]||(E[0]=n.withModifiers(L=>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??[],L=>(n.openBlock(),n.createElementBlock("div",{key:L.modelId,class:"em-attr"},[n.createElementVNode("div",jx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`op-name-${L.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":L.name,"onUpdate:modelValue":G=>m(L,{name:G})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{width:"96px","model-value":L.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":G=>G&&m(L,{visibility:G})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:G=>n.unref(a).removeOperation(r.value.modelId,L.modelId)},null,8,["onClick"])]),n.createElementVNode("div",Zx,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:L.sourceCode?"본문 편집 ●":"본문 편집",onClick:G=>C(L)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",Jx,[E[2]||(E[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Sl,{multiline:"",name:`op-desc-${L.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":L.description,"onUpdate:modelValue":G=>p(L,G)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Qx,[E[3]||(E[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":y(L),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":G=>G&&b(L,G)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",eS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(L)===null}]),title:"없음",onClick:G=>_(L,null)},"∅",10,tS),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),G=>(n.openBlock(),n.createElementBlock("button",{key:G,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":g(L)===G}]),style:n.normalizeStyle({background:n.unref(Pn)(G)}),title:n.unref(Ln)(G),onClick:T=>_(L,G)},null,14,nS))),128))])]))),128)):n.createCommentVNode("",!0)],8,qx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),iS={class:"em-panel__head"},aS={class:"em-panel__head-row"},lS={class:"em-panel__context"},rS={key:0,class:"em-panel__lock"},sS=["disabled"],cS={key:0,class:"em-panel__note"},dS={key:1,class:"em-panel__note"},uS={key:2,class:"em-jpa"},fS={class:"em-field"},mS={class:"em-field"},pS={key:0,class:"em-field"},hS={class:"em-panel__sub"},yS={class:"em-field"},gS={class:"em-jpa"},bS={key:0,class:"em-panel__note"},_S={class:"em-jpa"},wS={class:"em-field"},kS={key:0,class:"em-panel__note"},ES={class:"em-field"},vS={class:"em-multilang"},NS={class:"em-field"},IS=["value"],$S={class:"em-field"},xS={class:"em-swatch"},SS={class:"em-swatch__row"},CS=["title","onClick"],RS={class:"em-panel__note"},VS={class:"em-field"},AS=["value"],TS={class:"em-swatch"},MS={class:"em-swatch__row"},BS=["title","onClick"],yf=ze(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(q=>q.modelId===J)??null:null}),c=n.computed(()=>{const J=l.value;if((J==null?void 0:J.kind)==="association"){const v=a.state.logical.associations.find(V=>V.modelId===J.id);return!!v&&(a.isEntityLocked(v.end1.entityRef)||a.isEntityLocked(v.end2.entityRef))}const q=r.value;return!!q&&a.isEntityLocked(q)}),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),m=n.ref({});n.watch(f,()=>{m.value={}});function p(J){return m.value[J]??f.value}function y(J){m.value={...m.value,[J]:!p(J)}}const b=n.computed(()=>{var v;const J=s.value;if(!J)return"엔티티";const q=(v=J.table)==null?void 0:v.physicalName;return q?`${J.name} (${q})`:J.name}),g=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="association"?a.state.logical.associations.find(q=>q.modelId===J.id)??null:null}),_=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="group"?a.state.logical.groups.find(q=>q.modelId===J.id)??null:null}),C=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="note"?a.state.layout.notes.find(q=>q.modelId===J.id)??null:null}),h=n.computed(()=>{var q,v;const J=(q=_.value)==null?void 0:q.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)||((v=_.value)==null?void 0:v.packageName)||"그룹"}),E=n.computed(()=>{if(s.value){const J=u.value.size;if(J>1)return`엔티티 · ${s.value.name} › 속성 · ${J}개`;if(d.value){const q=s.value.attributes.find(v=>v.modelId===d.value);return(q==null?void 0:q.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(q==null?void 0:q.name)??""}`}return`엔티티 · ${s.value.name}`}if(g.value){const J=q=>{var v;return((v=a.state.logical.entities.find(V=>V.modelId===q))==null?void 0:v.name)??q};return`관계 · ${J(g.value.end1.entityRef)} — ${J(g.value.end2.entityRef)}`}return _.value?`그룹 · ${h.value}`:C.value?"노트":"선택된 항목 없음"}),Z=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],L=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],G=["LIST","SET"],T=["inherit","LAZY","EAGER"],S=J=>J;function O(J){return J==="inherit"?"기본(따름)":J}const te=n.computed(()=>!!g.value&&g.value.end1.entityRef===g.value.end2.entityRef);function M(J,q){g.value&&a.updateAssociationEnd(g.value.modelId,J,q)}function oe(J){g.value&&!te.value&&a.setAssociationIdentifying(g.value.modelId,J)}function w(J){var q,v,V;return!!((V=(v=(q=g.value)==null?void 0:q[J].jpa)==null?void 0:v.cascadeTypes)!=null&&V.includes("ALL"))}function j(J,q,v){var D,K;const V=(D=g.value)==null?void 0:D[J];if(q==="ALL"&&v){M(J,{jpa:{...V==null?void 0:V.jpa,cascadeTypes:["ALL"]}});return}const Y=new Set(((K=V==null?void 0:V.jpa)==null?void 0:K.cascadeTypes)??[]);v?Y.add(q):Y.delete(q),M(J,{jpa:{...V==null?void 0:V.jpa,cascadeTypes:[...Y]}})}function A(J,q){var V;const v=(V=g.value)==null?void 0:V[J];M(J,{jpa:{...v==null?void 0:v.jpa,...q}})}function W(J){var q,v;return((v=(q=g.value)==null?void 0:q[J].jpa)==null?void 0:v.fetchType)??"inherit"}function Q(J,q){A(J,{fetchType:q==="inherit"?void 0:q})}function ee(J){var v;const q=(v=g.value)==null?void 0:v[J==="end1"?"end2":"end1"];return(q==null?void 0:q.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(q==null?void 0:q.multiplicity)==="ONE_OR_MORE_INSTANCES"}const x=n.computed(()=>{const J=g.value;if(!J)return null;for(const q of a.state.logical.entities){const v=q.attributes.find(D=>{var K;return((K=D.embedded)==null?void 0:K.associationRef)===J.modelId&&D.attrType==="EMBED_OWN"});if(!v)continue;const V=J.end2.entityRef===v.embedded.embeddableRef?"end2":"end1",Y=J[V].jpa;return{which:V,isCollection:J[V].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(Y==null?void 0:Y.collectionType)??"LIST",collectionTable:(Y==null?void 0:Y.collectionTable)??"",orderColumn:(Y==null?void 0:Y.orderColumn)??""}}return null});function X(J){g.value&&a.setEmbedCollectionMode(g.value.modelId,J?"COLLECTION":"SINGLE")}function le(J){const q=x.value;q&&A(q.which,J==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function pe(J){const q=x.value;q&&A(q.which,{collectionTable:J.trim()||void 0})}function be(J){const q=x.value;q&&A(q.which,{orderColumn:J.trim()||void 0})}function de(J){_.value&&a.updateGroup(_.value.modelId,J)}function me(J,q){var v;de({name:{...(v=_.value)==null?void 0:v.name,[J]:q}})}const ye=n.computed(()=>{var J;return _.value?it((J=a.state.layout.groupLayouts.find(q=>q.groupRef===_.value.modelId))==null?void 0:J.style):null});function ve(J){_.value&&a.setGroupSwatch(_.value.modelId,J)}function Ce(J){C.value&&a.setNoteMemo(C.value.modelId,J)}const xe=n.computed(()=>{var J;return it((J=C.value)==null?void 0:J.style)});function ge(J){C.value&&a.setNoteSwatch(C.value.modelId,J)}return(J,q)=>(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:q[0]||(q[0]=(...v)=>e.startResize&&e.startResize(...v))},null,34),n.createElementVNode("header",iS,[n.createElementVNode("div",aS,[q[13]||(q[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:q[1]||(q[1]=v=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",lS,n.toDisplayString(E.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",rS,[n.createVNode(Ve,{name:"lock",size:13}),q[14]||(q[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:q[2]||(q[2]=v=>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(Hd,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:b.value,onToggle:q[3]||(q[3]=v=>y("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(Ux,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Kx,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:q[4]||(q[4]=v=>y("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(oS,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:q[5]||(q[5]=v=>y("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),g.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ae.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!g.value.identifying,disabled:te.value||!!x.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),te.value?(n.openBlock(),n.createElementBlock("p",cS,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):x.value?(n.openBlock(),n.createElementBlock("p",dS,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),x.value?(n.openBlock(),n.createElementBlock("fieldset",uS,[q[18]||(q[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":x.value.isCollection,"onUpdate:modelValue":X},null,8,["model-value"]),x.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",fS,[q[15]||(q[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":x.value.collectionType,items:G,"value-provider":S,"label-provider":S,"onUpdate:modelValue":q[6]||(q[6]=v=>v&&le(v))},null,8,["model-value"])]),n.createElementVNode("label",mS,[q[16]||(q[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":x.value.collectionTable,"onUpdate:modelValue":pe},null,8,["model-value"])]),x.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",pS,[q[17]||(q[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":x.value.orderColumn,"onUpdate:modelValue":be},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),q[19]||(q[19]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],v=>{var V,Y,D,K;return n.createElementVNode("div",{key:v,class:"em-end"},[n.createElementVNode("h4",hS,n.toDisplayString(v)+" → "+n.toDisplayString(g.value[v].entityRef),1),n.createElementVNode("label",yS,[q[20]||(q[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":g.value[v].multiplicity,items:Z,"value-provider":S,"label-provider":S,disabled:((V=x.value)==null?void 0:V.which)===v,"onUpdate:modelValue":he=>M(v,{multiplicity:he})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-navigable`,class:"em-check",label:"navigable","model-value":g.value[v].navigable,"onUpdate:modelValue":he=>M(v,{navigable:he})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-composition`,class:"em-check",label:"composition","model-value":g.value[v].composition,"onUpdate:modelValue":he=>M(v,{composition:he})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",gS,[q[21]||(q[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(L,he=>{var Ee,Ie;return n.createVNode(n.unref(ae.BSCheckbox),{key:he,name:`${v}-cascade-${he}`,class:"em-check",label:he,"model-value":!!((Ie=(Ee=g.value[v].jpa)==null?void 0:Ee.cascadeTypes)!=null&&Ie.includes(he)),disabled:he!=="ALL"&&w(v),"onUpdate:modelValue":we=>j(v,he,we)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),w(v)?(n.openBlock(),n.createElementBlock("p",bS,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",_S,[q[24]||(q[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",wS,[q[22]||(q[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":W(v),items:T,"value-provider":S,"label-provider":O,"onUpdate:modelValue":he=>he&&Q(v,he)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Y=g.value[v].jpa)!=null&&Y.orphanRemoval),disabled:ee(v),"onUpdate:modelValue":he=>A(v,{orphanRemoval:he})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ee(v)&&((D=g.value[v].jpa)!=null&&D.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",kS,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",ES,[q[23]||(q[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:`${v}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((K=g.value[v].jpa)==null?void 0:K.orderBy)??"","onUpdate:modelValue":he=>A(v,{orderBy:he.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",vS,[q[25]||(q[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,v=>{var V;return n.openBlock(),n.createElementBlock("label",{key:v,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(v),1),n.createVNode(n.unref(ae.BSTextInput),{name:`grp-name-${v}`,width:"100%","model-value":((V=_.value.name)==null?void 0:V[v])??"","onUpdate:modelValue":Y=>me(v,Y)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",NS,[q[26]||(q[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:q[7]||(q[7]=v=>de({description:v.target.value}))},null,40,IS)]),n.createElementVNode("label",$S,[q[27]||(q[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":q[8]||(q[8]=v=>de({packageName:v}))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":q[9]||(q[9]=v=>de({excludeDDLGeneration:v}))},null,8,["model-value"]),n.createElementVNode("fieldset",xS,[q[28]||(q[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",SS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ye.value===null}]),title:"없음",onClick:q[10]||(q[10]=v=>ve(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),v=>(n.openBlock(),n.createElementBlock("button",{key:v,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ye.value===v}]),style:n.normalizeStyle({background:n.unref(Pn)(v)}),title:n.unref(Ln)(v),onClick:V=>ve(v)},null,14,CS))),128))])]),n.createElementVNode("p",RS,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),C.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",VS,[q[29]||(q[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:C.value.memo,rows:"6",onChange:q[11]||(q[11]=v=>Ce(v.target.value))},null,40,AS)]),n.createElementVNode("fieldset",TS,[q[30]||(q[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",MS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":xe.value===null}]),title:"없음",onClick:q[12]||(q[12]=v=>ge(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),v=>(n.openBlock(),n.createElementBlock("button",{key:v,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":xe.value===v}]),style:n.normalizeStyle({background:n.unref(Pn)(v)}),title:n.unref(Ln)(v),onClick:V=>ge(v)},null,14,BS))),128))])])],64)):n.createCommentVNode("",!0)],8,sS)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),DS={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function OS(e){const t=e.split("-")[1];return t?DS[t]??t:e}function LS(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const PS=["title"],zS=["title","onClick"],US={key:0,class:"em-validation__body"},FS={class:"em-validation__opt"},HS={key:0,class:"em-validation__empty"},GS={key:1,class:"em-validation__empty"},YS={key:2,class:"em-validation__list"},WS=["onClick"],KS={class:"em-validation__item-msg"},qS={key:0,class:"em-validation__item-entity"},XS=["title"],jS=ze(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 g of o.state.logical.entities)b.set(g.modelId,g.name);return b});function l(b){const g=LS(b);if(!g)return null;const _=a.value.get(g);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 g of i.value)b[g.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,g)=>r[b.severity].order-r[g.severity].order)),u=n.computed(()=>d.value.map(b=>({issue:b,entityName:l(b),category:OS(b.ruleId)}))),f=n.ref(!1);function m(b){c.value[b]=!c.value[b]}function p(b){if(!f.value){f.value=!0;return}m(b)}function y(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,g)=>(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:g[1]||(g[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"]),g[3]||(g[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,PS),n.createElementVNode("div",{class:"em-validation__counts",onClick:g[0]||(g[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:C=>p(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,zS)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",US,[n.createElementVNode("label",FS,[n.createVNode(n.unref(ae.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":g[2]||(g[2]=_=>n.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",HS,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",GS," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",YS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:C,category:h},E)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${E}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:Z=>y(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",KS,[C?(n.openBlock(),n.createElementBlock("span",qS,n.toDisplayString(C),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(_.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},n.toDisplayString(h),9,XS)],10,WS))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),ZS={class:"em-history"},JS={class:"em-history__head"},QS={class:"em-history__title"},eC={class:"em-history__head-actions"},tC=["disabled"],nC={class:"em-history__filters"},oC={class:"em-history__filter"},iC={class:"em-history__body"},aC={key:0,class:"em-history__empty"},lC={key:1,class:"em-history__empty is-error"},rC={key:2,class:"em-history__empty"},sC={key:3,class:"em-history__list"},cC=["onClick"],dC={class:"em-history__summary"},uC={class:"em-history__seq"},fC={class:"em-history__gmeta"},mC={class:"em-history__who"},pC={key:0,class:"em-history__time"},hC={key:1,class:"em-history__restored-from"},yC={key:0,class:"em-history__detail"},gC={class:"em-history__action-head"},bC={class:"em-history__action-name"},_C={key:0,class:"em-history__fields"},wC={class:"em-history__fname"},kC={key:0,class:"em-history__old"},EC={class:"em-history__val"},vC={key:1,class:"em-history__restore"},NC=["disabled","onClick"],IC=["disabled"],$C=["onClick"],xC=ze(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(x){s.value=x instanceof Error?x.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,x=>{x&&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 m=n.computed(()=>new Map(a.state.logical.entities.map(x=>[x.modelId,x]))),p=n.computed(()=>new Map(a.state.logical.associations.map(x=>[x.modelId,x]))),y=n.computed(()=>new Map((a.state.logical.groups??[]).map(x=>{var X;return[x.modelId,x.packageName||((X=x.name)==null?void 0:X.ko)||x.modelId]})));function b(x){var be,de,me,ye,ve,Ce,xe;const X=p.value.get(x);if(!X)return"연관";if((be=X.description)!=null&&be.trim())return X.description.trim();const le=(ye=(me=m.value.get((de=X.end1)==null?void 0:de.entityRef))==null?void 0:me.name)==null?void 0:ye.trim(),pe=(xe=(Ce=m.value.get((ve=X.end2)==null?void 0:ve.entityRef))==null?void 0:Ce.name)==null?void 0:xe.trim();return le&&pe?`${le}→${pe}`:"연관"}function g(x){var X,le,pe,be;if(x.kind==="entity")return((le=(X=m.value.get(x.ref))==null?void 0:X.name)==null?void 0:le.trim())||"(이름 없음)";if(x.kind==="attribute"||x.kind==="operation"||x.kind==="index"){const de=x.entityRef?m.value.get(x.entityRef):void 0,ye=((x.kind==="attribute"?de==null?void 0:de.attributes:x.kind==="operation"?de==null?void 0:de.operations:de==null?void 0:de.indexes)??[]).find(Ce=>Ce.modelId===x.ref),ve=(pe=de==null?void 0:de.name)==null?void 0:pe.trim();return`${ve?ve+".":""}${((be=ye==null?void 0:ye.name)==null?void 0:be.trim())||x.ref}`}return x.kind==="association"?b(x.ref):x.kind==="associationEnd"?`${b(x.ref)}(${x.end})`:x.kind==="group"?`그룹 ${y.value.get(x.ref)??x.ref}`:x.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},C={add:"추가",update:"수정",remove:"삭제"},h=n.ref("all"),E=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],Z=n.computed({get:()=>h.value,set:x=>{x&&(h.value=x)}}),L=n.computed(()=>Tr(l.value)),G=n.computed(()=>L.value.length?L.value[0].seq:null),T=n.computed(()=>h.value==="all"?L.value:L.value.filter(x=>(x.kind??"edit")===h.value));function S(x){return x===void 0?"—":x===null?"(비움)":typeof x=="object"?JSON.stringify(x):String(x)}function O(x){const X=g(x.subject);if(x.verb==="add")return`${X} 추가`;if(x.verb==="remove")return`${X} 삭제`;if(x.fields.length===1){const le=x.fields[0];return`${X}.${le.field} ${le.oldValue!==void 0?S(le.oldValue)+"→":""}${S(le.value)}`}return`${X} ${x.fields.length}개 변경`}function te(x){return x.actions.length===0?"변경 없음":x.actions.length===1?O(x.actions[0]):`${O(x.actions[0])} 외 ${x.actions.length-1}건`}const M=n.ref(new Set);function oe(x){const X=new Set(M.value);X.has(x)?X.delete(x):X.add(x),M.value=X}function w(x){if(x==null)return"";const X=new Date(x);return isNaN(X.getTime())?String(x):X.toLocaleString()}function j(x){const X=x.author,le=x.origin;return X&&le?`${X}(${le})`:X||(le?`(${le})`:"—")}const A=n.ref(null),W=n.ref(!1);function Q(x){A.value=x}async function ee(x){W.value=!0;try{const X=await a.restoreToSeq(x);X.ok||(s.value=`복원 실패: ${X.reason??"알 수 없음"}`)}finally{W.value=!1,A.value=null}}return(x,X)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",ZS,[n.createElementVNode("header",JS,[n.createElementVNode("div",QS,[n.createVNode(Ve,{name:"undo",size:15}),X[4]||(X[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",eC,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:X[0]||(X[0]=le=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,tC),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:X[1]||(X[1]=le=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",nC,[n.createElementVNode("label",oC,[X[5]||(X[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:Z.value,"onUpdate:modelValue":X[2]||(X[2]=le=>Z.value=le),items:E,"value-provider":le=>le.v,"label-provider":le=>le.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",iC,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",aC,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",lC,n.toDisplayString(s.value),1)):T.value.length===0?(n.openBlock(),n.createElementBlock("p",rC,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",sC,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T.value,le=>(n.openBlock(),n.createElementBlock("li",{key:le.seq,class:n.normalizeClass(["em-history__group",[`is-${le.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:pe=>oe(le.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":M.value.has(le.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${le.kind??"edit"}`])},n.toDisplayString(le.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",dC,n.toDisplayString(te(le)),1),n.createElementVNode("span",uC,"#"+n.toDisplayString(le.seq),1)],8,cC),n.createElementVNode("div",fC,[n.createElementVNode("span",mC,n.toDisplayString(j(le)),1),le.ts?(n.openBlock(),n.createElementBlock("span",pC,n.toDisplayString(w(le.ts)),1)):n.createCommentVNode("",!0),le.kind==="restore"&&le.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",hC,"← #"+n.toDisplayString(le.restoredFromSeq),1)):n.createCommentVNode("",!0)]),M.value.has(le.seq)?(n.openBlock(),n.createElementBlock("div",yC,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le.actions,(pe,be)=>(n.openBlock(),n.createElementBlock("div",{key:be,class:"em-history__action"},[n.createElementVNode("div",gC,[n.createVNode(Ve,{name:_[pe.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",bC,n.toDisplayString(g(pe.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${pe.verb}`])},n.toDisplayString(C[pe.verb]),3)]),pe.fields.length?(n.openBlock(),n.createElementBlock("ul",_C,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe.fields,(de,me)=>(n.openBlock(),n.createElementBlock("li",{key:me,class:"em-history__field"},[n.createElementVNode("span",wC,n.toDisplayString(de.field),1),de.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",kC,n.toDisplayString(S(de.oldValue)),1)):n.createCommentVNode("",!0),de.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",EC,n.toDisplayString(S(de.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&le.seq!==G.value?(n.openBlock(),n.createElementBlock("div",vC,[A.value===le.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[X[6]||(X[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:pe=>ee(le.seq)},"복원",8,NC),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:X[3]||(X[3]=pe=>A.value=null)},"취소",8,IC)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:pe=>Q(le.seq)},[n.createVNode(Ve,{name:"undo",size:12}),X[7]||(X[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,$C))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function SC(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 gf(e){const t=n.ref(SC(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 CC={class:"em-modeler"},RC={class:"em-modeler__body"},VC={class:"em-drawer__inner"},AC={class:"em-drawer__head"},TC={class:"em-drawer__actions"},MC=["title"],BC=ze(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}=gf({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=gf({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(m,p)=>{var y,b,g;return n.openBlock(),n.createElementBlock("div",CC,[n.createVNode(hf,{controller:e.controller,"history-open":i.value,onExportSvg:p[0]||(p[0]=_=>{var C;return(C=u.value)==null?void 0:C.exportSvg()}),onExportPng:p[1]||(p[1]=_=>{var C;return(C=u.value)==null?void 0:C.exportPng()}),onToggleHistory:p[2]||(p[2]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",RC,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",VC,[n.createElementVNode("header",AC,[p[10]||(p[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",TC,[(y=f.value)!=null&&y.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 C;return(C=f.value)==null?void 0:C.toggleAll()})},[n.createVNode(Ve,{name:(g=f.value)!=null&&g.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,MC)):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(pf,{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(mf,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(yf,{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(xC,{controller:e.controller,open:i.value,onClose:p[9]||(p[9]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(jS,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1bc07cae"]]);ke.APPLY_MODEL_OPS_INPUT_SCHEMA=Xm,ke.AssociationEdge=pu,ke.CUSTOM_TYPE_VALUE=Ct,ke.CommandStack=La,ke.DEFAULT_JAVA_TYPE=Ra,ke.DiagramCanvas=mf,ke.DiagramExplorer=pf,ke.EDITOR=hn,ke.EditModeToggle=rx,ke.EditorToolbar=hf,ke.EntityModeler=BC,ke.EntityNode=Jd,ke.GROUP_CODE_ENUM_VALUE=jn,ke.GroupNode=Qd,ke.INHERITED_REF_PREFIX=Yo,ke.JAVA_TYPES=Va,ke.NoteNode=eu,ke.OpSyncAdapter=vs,ke.PHYSICAL_NAME_MAX_LENGTH=Ta,ke.PropertyPanel=yf,ke.RevCache=Es,ke.SELECTABLE_JAVA_TYPES=wr,ke.SYMBOLIC_OP_KINDS=Ns,ke.SYMBOLIC_OP_SCHEMA=Ms,ke.anchoredEdgePoint=va,ke.buildAgentBatch=jm,ke.buildDiagramSvg=nr,ke.buildOrthogonalPath=_a,ke.buildSelfLoopPath=rr,ke.buildStraightPath=ka,ke.collectSharedColumns=jo,ke.commands=gm,ke.computeAutoLayout=sr,ke.createEditorController=Zw,ke.defaultMermaidDialect=If,ke.displayLabel=Ko,ke.emptyState=qd,ke.entityModelToMermaid=$a,ke.entityModelToText=mr,ke.estimateEntityHeight=dr,ke.exportDiagramPng=uf,ke.exportDiagramSvg=df,ke.fromPersisted=dp,ke.indexColumnsByModelId=Zn,ke.isInheritedColumnRef=qn,ke.javaTypeLabel=En,ke.makeInheritedColumnRef=ur,ke.mergeDiagram=xr,ke.migrateLegacyMoney=Zf,ke.newId=Oe,ke.orthogonalMidpoints=wa,ke.packEntityBoxes=Nf,ke.parseInheritedColumnRef=Ia,ke.physicalNameWarning=Jo,ke.projectActionLog=Tr,ke.projectEntityAudit=Vr,ke.projectFieldAudit=Ut,ke.projectInheritedColumns=Wo,ke.rectExitPoint=Ea,ke.renderDiagramSvg=br,ke.resolveDiagram=ar,ke.resolveSharedColumn=Zo,ke.resolveSymbolicOps=Pm,ke.restoreDeepEqual=Nn,ke.segmentMidpoints=Na,ke.sharedColumnScopeEntities=Xo,ke.sideDir=Kn,ke.synthesizeRestoreOps=sm,ke.toPersisted=Np,ke.toPersistedV2=Ip,ke.validateModel=Nr,Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"})}));