@g1cloud/entity-modeler-next 5.0.0-alpha.16 → 5.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entity-modeler.js +2291 -2288
- package/dist/entity-modeler.umd.cjs +8 -8
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(ve,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):(ve=typeof globalThis<"u"?globalThis:ve||self,n(ve.EntityModeler={},ve.Vue,ve.OpenBlueseaCore))})(this,(function(ve,n,ie){"use strict";var
|
|
2
|
-
`).trim()}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function gf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const bf=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function dt(e){return e.replace(bf,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ae(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function rr(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 _f(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 kf(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 wf(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 ba(e){const t=kf(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="${wf(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(_f(r));for(const r of e.texts)l.push(rr(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Ef(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(rr(i));return`<g>${o.join("")}</g>`}function sr(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(ba(r));for(const r of e.edges)l.push(Ef(r));for(const r of e.entities)l.push(ba(r));for(const r of e.notes)l.push(ba(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 vf=["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"],Nf=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"]),$f=vf.filter(e=>!Nf.has(e)),xf={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function _a(e){return xf[e]??e}const If=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Go=new Set(["NUMERIC","DECIMAL"]);function cr(e,t=$f){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const zt="CustomType",qn="GroupCodeEnum",ka="String",wa=[{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:"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:zt,label:"CustomType"}],Sf=new Map(wa.map(e=>[e.value,e.label]));function En(e){return Sf.get(e)??e}const Cf=new Set([qn,"CustomMoneyType"]),dr=wa.filter(e=>!Cf.has(e.value)).map(e=>e.value===zt?{...e,label:"CustomType (사용자정의)"}:e);function ur(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=[...dr,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:En(e)},...i]:i}function Rf(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function fr(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 Ea(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${En(t.type)}>`:Rf(t)?En(t.type):e==="CLASS"?t.type===zt&&t.customType||En(t.type):_a(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Xn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Yo(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 va=63;function Wo(e){if(!e)return null;const t=e.length;return t<=va?null:`물리명이 ${va}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function mr(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 Vf(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,a=2,l=new Map,r=[],s=[],c=new Set,d=u=>{l.set(u,i),r.push(u);for(const f of t.get(u)??[]){const h=l.get(f)??o;if(h===o)d(f);else if(h===i){const m=r.slice(r.indexOf(f)),p=[...m].sort().join(" ");c.has(p)||(c.add(p),s.push(m))}}r.pop(),l.set(u,a)};for(const u of e.entities)(l.get(u.modelId)??o)===o&&d(u.modelId);return s}function Af(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 Na(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 pr(e,t){var l,r,s;const o=[];for(const c of Na(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(p=>p.attrType!=="DIVIDER");if(mt(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(p=>p.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),mt((l=c.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const p of d.filter(y=>y.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${p.name}"`});for(const p of d.filter(y=>y.identifier&&y.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${p.name}"`});for(const p of d)if(!p.identifier)for(const y of p.dbAttrs)!y.autoIncrement&&mt(y.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:y.modelId,contextRef:c.modelId,message:`채번(${y.autoIncrement?"auto increment":`시퀀스 "${y.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${p.name}"에 설정되어 있습니다`});for(const p of d.filter(y=>y.naturalId&&y.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${p.name}"`});for(const p of d.filter(y=>y.naturalId&&y.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${p.name}"`});for(const p of d.filter(y=>y.naturalId&&!y.notNull&&!y.identifier&&!y.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${p.name}"`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const p of Na(d,y=>y.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${p.name}"`});for(const p of d)mt(p.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(p=>p.dbAttrs).filter(p=>p.sharedColumnRef==null),f=d.flatMap(p=>p.dbAttrs.map((y,b)=>({col:y,name:Af(p,y,b,e,t)})).filter(y=>y.col.sharedColumnRef==null));for(const p of Na(f,y=>y.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:p.col.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${p.name}"`});for(const p of u){const y=Wo(p.physicalName);y&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:y}),t!=null&&t.reservedWords&&!mt(p.physicalName)&&t.reservedWords.has(p.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${p.physicalName}"`}),t!=null&&t.selectableDataTypes&&!mt(p.dataType)&&!t.selectableDataTypes.has(p.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${p.dataType}"`}),!mt(p.dataType)&&If.has(p.dataType)&&!p.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`${p.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const p=Xn(d.flatMap(y=>y.dbAttrs));for(const y of d){if(y.attrType!=="EMBED_PREDEF")continue;const b=t.embeddableCatalog.find(_=>_.type===y.type);b&&y.dbAttrs.forEach((_,A)=>{if(_.sharedColumnRef==null)return;const g=b.fields[A],N=p.get(_.sharedColumnRef);if(!g||!N)return;(N.dataType!==g.dataType||(N.length??null)!==(g.length??null)||(N.scale??null)!==(g.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${mr(N)})이 ${g.name??"컬럼"} 정의(${mr(g)})와 다릅니다`})})}}for(const p of d){const y=p.dbAttrs[0];if(!(y!=null&&y.multiValue))continue;p.type===qn&&y.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:y.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${p.type||"타입 미지정"} / ${y.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const h=(s=c.table)==null?void 0:s.physicalName,m=Wo(h);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!mt(h)&&t.reservedWords.has(h.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${h}"`});for(const p of c.indexes??[]){const y=Wo(p.name);y&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:y}),t!=null&&t.reservedWords&&!mt(p.name)&&t.reservedWords.has(p.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${p.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){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"),m=f.includes("REMOVE");h&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||h)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${h?"ALL":"REMOVE"}와 의미가 겹칩니다`}),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 Vf(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 Tf="CustomMoneyType",Mf="Money";function Bf(e){return!(e.type!==Tf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Df(e){const t=e.dbAttrs[0]??{modelId:Oe(),physicalName:"",dataType:""},o={modelId:Oe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Mf,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Of(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>Bf(r)?(a=!0,t=!0,Df(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function $a(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 Lf(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 Pf=new Set(["attributes","operations","indexes","rev"]),zf=new Set(["end1","end2","rev"]),Uf=new Set(["memberEntityRefs","rev"]),hr=new Set(["modelId"]),Hf=new Set(["modelId","columns"]),Ff=new Set([]);function Gf(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,hr);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,hr);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,Hf);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Yf(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:$a(r)});for(const{cur:r,tgt:s}of i.common){const c=Zt(r,s,Pf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),Gf(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:$a(r)});for(const{cur:r,tgt:s}of a.common){const c=Zt(r,s,zf);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]??{},Ff);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:$a(r)});for(const{cur:r,tgt:s}of l.common){const c=Zt(r,s,Uf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=Lf(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 Ko(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 Wf(e,t,o){Ko(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Ko(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Ko(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Ko(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Kf(e,t){const o=[];return Yf(e.logical,t.logical,o),Wf(e.layout,t.layout,o),o}function qf(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 Xf={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class jf{constructor(t){We(this,"out",[]);We(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...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=Xf[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 xa(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=qf(t),i=new jf(t.field),a=[...e].sort((m,p)=>m.seq-p.seq);for(const m of a)for(const p of m.ops)switch(o){case"entity":if(p.entityRef!==t.entityRef)break;p.kind==="entity.add"?kt(i,m,p.value,"entity"):p.kind==="entity.update"?Qt(i,m,p.patch):p.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((l=p.value)==null?void 0:l.attributes,t.attributeRef);y&&kt(i,m,y,"attribute")}else p.kind==="attribute.add"&&((r=p.value)==null?void 0:r.modelId)===t.attributeRef?kt(i,m,p.value,"attribute"):p.kind==="attribute.update"&&p.attributeRef===t.attributeRef?Qt(i,m,p.patch):(p.kind==="attribute.remove"&&p.attributeRef===t.attributeRef||p.kind==="entity.remove")&&i.remove(m);break;case"operation":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((s=p.value)==null?void 0:s.operations,t.operationRef);y&&kt(i,m,y,"operation")}else p.kind==="operation.add"&&((c=p.value)==null?void 0:c.modelId)===t.operationRef?kt(i,m,p.value,"operation"):p.kind==="operation.update"&&p.operationRef===t.operationRef?Qt(i,m,p.patch):(p.kind==="operation.remove"&&p.operationRef===t.operationRef||p.kind==="entity.remove")&&i.remove(m);break;case"index":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((d=p.value)==null?void 0:d.indexes,t.indexRef);y&&kt(i,m,y,"index")}else p.kind==="index.add"&&((u=p.value)==null?void 0:u.modelId)===t.indexRef?kt(i,m,p.value,"index"):p.kind==="index.update"&&p.indexRef===t.indexRef?Qt(i,m,p.patch):(p.kind==="index.remove"&&p.indexRef===t.indexRef||p.kind==="entity.remove")&&i.remove(m);break;case"association":if(p.associationRef!==t.associationRef)break;p.kind==="association.add"?kt(i,m,p.value,"association"):p.kind==="association.update"?Qt(i,m,p.patch):p.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(p.associationRef!==t.associationRef)break;if(p.kind==="association.add"){const y=(f=p.value)==null?void 0:f[t.end];kt(i,m,y,"associationEnd")}else p.kind==="associationEnd.update"&&p.end===t.end?Qt(i,m,p.patch):p.kind==="association.remove"&&i.remove(m);break;case"group":if(p.groupRef!==t.groupRef)break;if(p.kind==="group.add"){kt(i,m,p.value,"group");const y=(h=p.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(y))for(const b of y)i.member(m,b,!1)}else p.kind==="group.update"?Qt(i,m,p.patch):p.kind==="group.remove"?i.remove(m):p.kind==="group.addMember"&&p.entityRef!=null?i.member(m,p.entityRef,!1):p.kind==="group.removeMember"&&p.entityRef!=null&&i.member(m,p.entityRef,!0);break}return i.result()}function Zf(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 Jf(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 qo(e,t){return e.map(o=>({...o,subject:t}))}function yr(e,t){const o=e.filter(s=>s.ops.some(c=>Zf(c,t))),{attributes:i,operations:a,indexes:l}=Jf(o,t),r=[...qo(Ut(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...qo(Ut(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...qo(Ut(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...qo(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 gr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Qf(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 em(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 tm(e){const{entities:t,associations:o,groups:i}=em(e),a=[];for(const l of t)for(const r of yr(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 br(e){const t=tm(e),o=Qf(e),i=new Map;for(const r of t){const s=gr(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=gr(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 Ia{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 _r(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 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 Ct(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 Sa(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=_r(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=Ze(o,e.modelId);a>=0&&o.layout.entityLayouts.splice(a,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function kr(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=_r(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(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 wr(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 Er(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=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 vr(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 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 Nr(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=Jn(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 $r(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 xr(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 Ca(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 Xo(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=Jn(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 Ra(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);a>=0&&o.layout.groupLayouts.splice(a,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Ir(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 Sr(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 Cr(e,t){let o=!1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에 편입",apply(a){const l=i(a);l&&!l.memberEntityRefs.includes(t)&&(l.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const l=i(a),r=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1;r>=0&&l.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function jo(e,t){let o=-1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에서 제외",apply(a){const l=i(a);o=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1,o>=0&&l.memberEntityRefs.splice(o,1)},invert(a){var l;o<0||(l=i(a))==null||l.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function Rr(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 Vr(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 Ar(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 Tr(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 Rt(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 Va(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 Mr(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 Br(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 Dr(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 Or(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,m)=>h.order=m),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 Lr(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=Jn(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 Aa(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 Pr(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 Zo(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 zr(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 Ur(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 Hr(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 Fr(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 Gr(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 Yr(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 Wr(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 Kr(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 qr(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 Xr(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 jr(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Zr(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 Jr(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 Qr(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 es(e,t){let o=-1;const i=a=>a.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var r;const l=i(a);o=((r=l==null?void 0:l.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&l.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const l=i(a);l&&(l.memberNoteRefs||(l.memberNoteRefs=[]),l.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const Ht=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Jo=(e,t,o)=>{var i;return((i=Ct(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function ts(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 ns(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 os(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=Ct(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=Ct(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Jo(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Ht(e,t,r)],invert:[Ht(e,t,s)]}}}}function is(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=Ct(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=Ct(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Jo(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function as(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=Ct(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=Ct(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Jo(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function ls(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Ct(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=Ct(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Ht(e,t,Jo(i,e,t))],invert:[Ht(e,t,o??[])]}}}}function Fe(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 nm=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Aa,addAttribute:Rt,addEntity:Sa,addEntityToGroup:Cr,addGroup:Ra,addIndex:zr,addNote:qr,addNoteConnection:ts,addNoteConnectionWaypoint:is,addNoteToGroup:Qr,addOperation:Mr,addWaypoint:Kr,clearNoteConnectionWaypoints:ls,clearWaypoints:Wr,composite:Fe,moveEntity:$n,moveGroup:Rr,moveNote:eo,moveNoteConnectionWaypoint:os,moveWaypoint:Fr,removeAssociation:Pr,removeAttribute:xn,removeEntity:kr,removeEntityFromGroup:jo,removeGroup:Sr,removeIndex:Hr,removeNote:Xr,removeNoteConnection:ns,removeNoteConnectionWaypoint:as,removeNoteFromGroup:es,removeOperation:Dr,removeWaypoint:Gr,renameEntity:Er,reorderAttributes:Va,reorderOperations:Or,resizeEntity:vr,resizeGroup:Vr,resizeNote:jr,setAllEntitiesCollapsed:Ca,setAttributeSwatch:Xo,setEntityCollapsed:$r,setEntityLocked:xr,setEntitySwatch:Nr,setGroupLocked:Tr,setGroupSwatch:Ar,setNoteMemo:Zr,setNoteSwatch:Jr,setOperationSwatch:Lr,translateWaypoints:Yr,updateAssociation:Zo,updateAssociationEnd:In,updateAttribute:en,updateEntity:wr,updateGroup:Ir,updateIndex:Ur,updateOperation:Br},Symbol.toStringTag,{value:"Module"}));class rs{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 ss{constructor(t){We(this,"cache",new rs);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 cs=["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"],ds=()=>crypto.randomUUID(),om=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,im=e=>e&&e[0].toLowerCase()+e.slice(1),am=e=>e&&e[0].toUpperCase()+e.slice(1),lm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function rm(e,t){return im(e)+am(t)}function sm(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=rm(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:lm(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Qo=(e,t)=>`${e}::${t}`,ei=e=>e??void 0;function cm(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||ei(s.length)!==ei(l.length)||ei(s.scale)!==ei(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 dm(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=ds){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=>sm(e,f)),s=new Map(r.map(f=>[Qo(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Qo(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=Qo(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=Qo(f.associationRef,f.sourceAttributeRef),m=d.get(h);if(!m)i.add.push(dm(f,u++,o));else{const p=cm(m,f,o);p&&i.update.push({attributeId:m.modelId,patch:p})}}return i}function um(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 fm(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function mm(e,t,o=ds){const i=new Map,a=fm(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(om(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(h=>h.modelId===d);f&&um(f,u),l.has(d)||r.push(d)}}return i}function ti(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 pm(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 hm(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 us(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=pm(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 ym(e,t){const o=hm(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 gm(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 fs(e,t){const o=gm(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function bm(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function _m(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function km(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 wm(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 ms(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 ps(e,t,o,i,a,l,r,s){const c=s(),d=new Map((e.embeddableOverrides??[]).map(h=>[h.field,h])),u=[];let f=!1;for(const h of t.fields){const m=d.get(h.name);if(m!=null&&m.sharedColumnPhysicalName){const p={ref:m.sharedColumnPhysicalName,by:"physicalName"},y=fs(i,p);if(!y.ok){r.push(y.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:a,entity:l,handle:p}:{code:"shared-column-target-ambiguous",opIndex:a,entity:l,handle:p,matches:y.matches}),f=!0;continue}u.push({modelId:s(),physicalName:"",dataType:"",sharedColumnRef:y.value.modelId});continue}u.push({modelId:s(),physicalName:(m==null?void 0:m.physicalName)??"",dataType:"",...m!=null&&m.length?{length:m.length}:{},...m!=null&&m.scale?{scale:m.scale}:{},...(m==null?void 0:m.insertable)!=null?{insertable:m.insertable}:{},...(m==null?void 0:m.updatable)!=null?{updatable:m.updatable}:{}})}return f?null:{modelId:c,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:u}}function hs(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 ys(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=fs(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 Em(e,t,o={}){const i=o.mkId??Oe,a=o.embeddableCatalog??[],l=f=>a.find(h=>h.type===f),r=[],s=[],c=new Map,d=new Map,u=new Set;for(const f of t)f.kind==="entity.add"&&(u.add(f.spec.name),f.spec.physicalName&&u.add(f.spec.physicalName));return t.forEach((f,h)=>{var m,p,y;switch(f.kind){case"entity.add":{const b=i(),_={modelId:b,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},A={ref:f.spec.name};let g=!1;for(const[S,O]of(f.spec.attributes??[]).entries()){if(O.type==="GroupCodeEnum"&&!O.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:A,handle:{ref:O.name}}),g=!0;continue}const z=l(O.type);if(z){const F=ps(O,z,S,_,h,A,s,i);F?_.attributes.push(F):g=!0}else(m=O.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:h,entity:A,handle:{ref:O.name}}),g=!0):_.attributes.push(ms(O,S,i))}const N=(f.spec.operations??[]).map((S,O)=>hs(S,O,i));N.length&&(_.operations=N);const te=[];for(const S of f.spec.indexes??[]){const O=ys(_,S,h,A,s,i);O?te.push(O):g=!0}if(te.length&&(_.indexes=te),g)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:_});break}case"entity.update":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:f.patch});break}case"entity.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}const _=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,_+1);const A=l(f.spec.type);let g;if(A)g=ps(f.spec,A,_,b.value,h,f.entity,s,i);else if((p=f.spec.embeddableOverrides)!=null&&p.length){s.push({code:"embeddable-type-unresolved",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}else g=ms(f.spec,_,i);if(!g)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:g});break}case"attribute.update":case"attribute.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=ym(b.value,f.attribute);if(!_.ok){s.push(_.reason==="not-found"?{code:"attribute-not-found",opIndex:h,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:h,entity:f.entity,handle:f.attribute,matches:_.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:_.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:_.value.modelId});break}case"association.add":{const b=at(e,f.spec.from),_=at(e,f.spec.to);if(b.ok||s.push(lt(b.reason,h,f.spec.from,b.matches,u)),_.ok||s.push(lt(_.reason,h,f.spec.to,_.matches,u)),!b.ok||!_.ok)break;if(f.spec.identifying&&b.value.modelId===_.value.modelId){s.push({code:"self-identifying",opIndex:h,handle:{from:f.spec.from,to:f.spec.to}});break}const A=i(),g={modelId:A,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:_.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},N={...e,associations:[...e.associations,g]},te=to(N,_.value.modelId,i);te.add[0]&&(g.end2.attributeRef=te.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:A,value:g});for(const S of te.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:S});break}case"association.remove":{const b=at(e,f.association.from),_=at(e,f.association.to);if(b.ok||s.push(lt(b.reason,h,f.association.from,b.matches,u)),_.ok||s.push(lt(_.reason,h,f.association.to,_.matches,u)),!b.ok||!_.ok)break;const A=us(e,b.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(g=>g.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:A[0].modelId});break}case"association.update":{const b=gs(e,f.association,h,s,u);if(!b)break;r.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:f.patch});break}case"associationEnd.update":{const b=gs(e,f.association,h,s,u);if(!b)break;const _=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:_,patch:f.patch});break}case"index.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=ys(b.value,f.spec,h,f.entity,s,i);if(!_)break;r.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.modelId,value:_});break}case"index.update":case"index.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=km(b.value,f.index);if(!_.ok){s.push(_.reason==="not-found"?{code:"index-not-found",opIndex:h,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:h,entity:f.entity,handle:f.index,matches:_.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:h,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.value.modelId});break}case"operation.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=d.get(b.value.modelId)??((y=b.value.operations)==null?void 0:y.length)??0;d.set(b.value.modelId,_+1);const A=hs(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:A.modelId,value:A});break}case"operation.update":case"operation.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=wm(b.value,f.operation);if(!_.ok){s.push(_.reason==="not-found"?{code:"operation-not-found",opIndex:h,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:h,entity:f.entity,handle:f.operation,matches:_.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:_.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:_.value.modelId});break}case"group.add":{const b=[];let _=!1;for(const N of f.spec.members){const te=at(e,N);if(!te.ok){s.push(lt(te.reason,h,N,te.matches,u)),_=!0;continue}b.push(te.value.modelId)}if(_)break;const A=i(),g={modelId:A,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};r.push({kind:"group.add",casUnit:"logical",groupRef:A,value:g});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 gs(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=us(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 bs={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},vm={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Nm={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},ni={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},$m={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:{...ni,description:"속성 설명(다국어)."},columnLogicalName:{...ni,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},_s={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},xm={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{..._s,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{..._s,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},Im={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...bs,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},Sm={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...ni,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Cm={type:"object",properties:{name:{...ni,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},Rm={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function tt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Vm={"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"]})},ks={anyOf:cs.map(e=>Vm[e])},Am={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:bs,assocHandle:vm,entitySpec:Nm,attrSpec:$m,assocSpec:xm,indexSpec:Im,operationSpec:Sm,groupSpec:Cm,patch:Rm,symbolicOp:ks}};function Tm(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 ws={location:{x:0,y:0},size:{width:220,height:140}};function Es(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 Mm=/^[-=_*~\s]{3,}$/;function Bm(e){return e.attrType&&e.attrType!=="NORMAL"||!Mm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Dm(e,t){return e.attrType==="DIVIDER"||Bm(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{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??t,dbAttrs:e.dbAttrs.map(Es)}}function Om(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 Lm(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 Pm(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(Dm),operations:(t=e.operations)==null?void 0:t.map(Om),indexes:(o=e.indexes)==null?void 0:o.map(Lm),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function zm(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??{...ws},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 vs(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 Ta(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:vs(e)}}function Um(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Ta(e.end1),end2:Ta(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 Ns(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function $s(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function xs(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 Is(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(Es)}}function Hm(e,t,o){var b,_;const i=Ns(e.end1.attribute),a=Ns(e.end2.attribute);if(i===a)return Um(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(_=(b=s.dbAttrs)==null?void 0:b[0])==null?void 0:_.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((A,g)=>Math.max(A,g.order),-1)+1:s.order??0,h={...Is(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const m=(A,g)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:g?d:h.modelId,legacyNavRaw:g?void 0:A.attribute,jpa:vs(A)}),p={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},y={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p.end1.attributeRef,targetColumnRef:p.end2.attributeRef,style:e.style};return{assoc:p,layout:y}}function Fm(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 Gm(e,t,o){var p;const i=((p=e.end1.attribute)==null?void 0:p.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,l=i?e.end2:e.end1,r=a.attribute,s=t.get(l.endModel.refId),c=s?s.attributes.reduce((y,b)=>Math.max(y,b.order),-1)+1:r.order??0,d={...Is(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(y=>Fm(y,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=y=>({...Ta(y),legacyEmbedRaw:y.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:f,layout:m}}function Ym(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 Ss(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=Ym(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 Cs(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 Wm(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(s=>s.derivedFrom&&s.identifier);if(!i.length)continue;const a=o.filter(s=>!(s.derivedFrom&&s.identifier));let l=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(l=c+1)}),[...a.slice(0,l),...i,...a.slice(l)].forEach((s,c)=>s.order=c)}}function Km(e){return(e.schemaVersion??1)>=2&&"logical"in e?qm(e):Xm(e)}function qm(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:h,...m}=f;return h!=null&&(o[f.modelId]=h),m},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout;Cs(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 Xm(e){var _,A;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(g,N)=>{o.push(Pm(g));const te=zm(g);te.geo={location:{x:te.geo.location.x+N.x,y:te.geo.location.y+N.y},size:te.geo.size},i.push(te);for(const S of g.ownedAssociations??[])c.push(S)},u={x:0,y:0};for(const g of e.entities??[])d(g,u);const f=[];for(const g of e.groups??[]){const N=g.entities??[];r.push({modelId:g.modelId,name:g.name,description:g.description,packageName:g.packageName,excludeDDLGeneration:g.excludeDDLGeneration??!1,memberEntityRefs:N.map(S=>S.modelId)});const te=((_=g.geo)==null?void 0:_.location)??u;if(g.geo){const S=(g.notes??[]).map(O=>O.modelId);s.push({groupRef:g.modelId,geo:g.geo,style:g.style,locked:g.locked,memberNoteRefs:S.length?S:void 0})}for(const S of N)d(S,te);for(const S of g.notes??[])f.push(Ss(S,te))}const h=new Map(o.map(g=>[g.modelId,g])),m=new Map,p=new Map;for(const g of o)for(const N of g.attributes)for(const te of N.dbAttrs)m.set(te.modelId,N.modelId),p.set(te.modelId,te);for(const g of c)for(const N of[g.end1,g.end2]){const te=N.attribute;if(te&&(((A=te.dbAttrs)==null?void 0:A.length)??0)>0)for(const S of te.dbAttrs)S.modelId&&m.set(S.modelId,te.modelId)}for(const g of c){const N=$s(g.end1.attribute),te=$s(g.end2.attribute),S=xs(g.end1)||xs(g.end2),{assoc:O,layout:z}=N!==te||S?Gm(g,h,p):Hm(g,h,m);a.push(O),l.push(z)}Cs(o,a,l),Wm(o);const y={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(g=>Ss(g)),...f]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:y,meta:b}}function Rs(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 jm(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(Rs),style:t}}function Zm(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 Jm(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function Ft(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function Qm(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{...Rs(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function ep(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 tp(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 np(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function op(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:np(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 ip(e,t,o){let i;for(const f of t.logical.entities){const h=f.attributes.find(m=>{var p;return((p=m.embedded)==null?void 0:p.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,l=t.logical.entities.find(f=>f.modelId===a);if(!l)return;const r=l.attributes.flatMap(f=>f.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((f,h)=>op(f,r[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Ft(e.end1,c?s:u),end2:Ft(e.end2,c?u:s)}}function ap(e,t,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:Ft(e.end1,e.end1.legacyEmbedRaw),end2:Ft(e.end2,e.end2.legacyEmbedRaw)};const a=ip(e,t,i);if(a)return a;const l=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(l!==r){const s=l?e.end1:e.end2,c=l?e.end2:e.end1,d=t.logical.entities.find(p=>p.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(p=>p.modelId===s.attributeRef),f=t.logical.entities.find(p=>p.modelId===c.entityRef),h=u?Qm(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ft(e.end1,l?m:h),end2:Ft(e.end2,r?m:h)}}return{...i,end1:Ft(e.end1),end2:Ft(e.end2)}}function Vs(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(h=>h.entityRef===e.modelId),r=t.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>t.layout.associationLayouts.find(m=>m.associationRef===h),c=(l==null?void 0:l.geo)??{...ws},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var m;return jm(h,(m=l==null?void 0:l.attributeStyles)==null?void 0:m[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var m;return Zm(h,(m=l==null?void 0:l.operationStyles)==null?void 0:m[h.modelId])}),ownedAssociations:r.map(h=>ap(h,t,s(h.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(Jm),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 lp(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=>As(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>Vs(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 As(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 rp(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=ep(e),l=tp(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=>Vs(s,e,a,l)),groups:e.logical.groups.map(s=>lp(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>As(s))}}function sp(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 Vt(e){return typeof e=="function"?e():n.unref(e)}const cp=typeof window<"u"&&typeof document<"u",dp=e=>typeof e<"u",up=Object.prototype.toString,fp=e=>up.call(e)==="[object Object]",mp=()=>{};function pp(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 Ts=e=>e();function hp(e=Ts){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 Ms(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function yp(e,t,o={}){const{eventFilter:i=Ts,...a}=o;return n.watch(e,pp(i,t),a)}function Sn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=hp(i);return{stop:yp(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function gp(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=Vt(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 Ma(e,t=!1){function o(f,{flush:h="sync",deep:m=!1,timeout:p,throwOnTimeout:y}={}){let b=null;const A=[new Promise(g=>{b=n.watch(e,N=>{f(N)!==t&&(b==null||b(),g(N))},{flush:h,deep:m,immediate:!0})})];return p!=null&&A.push(Ms(p,y).then(()=>Vt(e)).finally(()=>b==null?void 0:b())),Promise.race(A)}function i(f,h){if(!n.isRef(f))return o(N=>N===f,h);const{flush:m="sync",deep:p=!1,timeout:y,throwOnTimeout:b}=h??{};let _=null;const g=[new Promise(N=>{_=n.watch([e,f],([te,S])=>{t!==(te===S)&&(_==null||_(),N(te))},{flush:m,deep:p,immediate:!0})})];return y!=null&&g.push(Ms(y,b).then(()=>Vt(e)).finally(()=>(_==null||_(),Vt(e)))),Promise.race(g)}function a(f){return o(h=>!!h,f)}function l(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,h){return o(m=>{const p=Array.from(m);return p.includes(f)||p.includes(Vt(f))},h)}function d(f){return u(1,f)}function u(f=1,h){let m=-1;return o(()=>(m+=1,m>=f),h)}return Array.isArray(Vt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Ma(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Ma(e,!t)}}}function Ba(e){return Ma(e)}function bp(e){var t;const o=Vt(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Bs=cp?window:void 0;function Ds(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Bs):[t,o,i,a]=e,!t)return mp;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,h,m)=>(u.addEventListener(f,h,m),()=>u.removeEventListener(f,h,m)),c=n.watch(()=>[bp(t),Vt(a)],([u,f])=>{if(r(),!u)return;const h=fp(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(p=>s(u,m,p,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return no(d),d}function _p(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Os(...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=Bs,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=_p(t);return Ds(a,l,u=>{u.repeat&&Vt(s)||c(u)&&o(u)},r)}function kp(e){return JSON.parse(JSON.stringify(e))}function Da(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:h}=i,m=n.getCurrentInstance(),p=o||(m==null?void 0:m.emit)||((a=m==null?void 0:m.$emit)==null?void 0:a.bind(m))||((r=(l=m==null?void 0:m.proxy)==null?void 0:l.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let y=d;t||(t="modelValue"),y=y||`update:${t.toString()}`;const b=g=>s?typeof s=="function"?s(g):kp(g):g,_=()=>dp(e[t])?b(e[t]):f,A=g=>{h?h(g)&&p(y,g):p(y,g)};if(c){const g=_(),N=n.ref(g);let te=!1;return n.watch(()=>e[t],S=>{te||(te=!0,N.value=b(S),n.nextTick(()=>te=!1))}),n.watch(N,S=>{!te&&(S!==e[t]||u)&&A(S)},{deep:u}),N}else return n.computed({get(){return _()},set(g){A(g)}})}var wp={value:()=>{}};function oi(){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 ii(o)}function ii(e){this._=e}function Ep(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}})}ii.prototype=oi.prototype={constructor:ii,on:function(e,t){var o=this._,i=Ep(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=vp(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]=Ls(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Ls(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 ii(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 vp(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Ls(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=wp,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Oa="http://www.w3.org/1999/xhtml";const Ps={svg:"http://www.w3.org/2000/svg",xhtml:Oa,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ai(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ps.hasOwnProperty(t)?{space:Ps[t],local:e}:e}function Np(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Oa&&t.documentElement.namespaceURI===Oa?t.createElement(e):t.createElementNS(o,e)}}function $p(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function zs(e){var t=ai(e);return(t.local?$p:Np)(t)}function xp(){}function La(e){return e==null?xp:function(){return this.querySelector(e)}}function Ip(e){typeof e!="function"&&(e=La(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 Sp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Cp(){return[]}function Us(e){return e==null?Cp:function(){return this.querySelectorAll(e)}}function Rp(e){return function(){return Sp(e.apply(this,arguments))}}function Vp(e){typeof e=="function"?e=Rp(e):e=Us(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 Hs(e){return function(){return this.matches(e)}}function Fs(e){return function(t){return t.matches(e)}}var Ap=Array.prototype.find;function Tp(e){return function(){return Ap.call(this.children,e)}}function Mp(){return this.firstElementChild}function Bp(e){return this.select(e==null?Mp:Tp(typeof e=="function"?e:Fs(e)))}var Dp=Array.prototype.filter;function Op(){return Array.from(this.children)}function Lp(e){return function(){return Dp.call(this.children,e)}}function Pp(e){return this.selectAll(e==null?Op:Lp(typeof e=="function"?e:Fs(e)))}function zp(e){typeof e!="function"&&(e=Hs(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 Gs(e){return new Array(e.length)}function Up(){return new ut(this._enter||this._groups.map(Gs),this._parents)}function li(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}li.prototype={constructor:li,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 Hp(e){return function(){return e}}function Fp(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 li(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Gp(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(h[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new li(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function Yp(e){return e.__data__}function Wp(e,t){if(!arguments.length)return Array.from(this,Yp);var o=t?Gp:Fp,i=this._parents,a=this._groups;typeof e!="function"&&(e=Hp(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],h=f.length,m=Kp(e.call(u,u&&u.__data__,d,i)),p=m.length,y=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,y,b,_,m,t);for(var A=0,g=0,N,te;A<p;++A)if(N=y[A]){for(A>=g&&(g=A+1);!(te=b[g])&&++g<p;);N._next=te||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function Kp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qp(){return new ut(this._exit||this._groups.map(Gs),this._parents)}function Xp(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 jp(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,h=s[c]=new Array(f),m,p=0;p<f;++p)(m=d[p]||u[p])&&(h[p]=m);for(;c<a;++c)s[c]=o[c];return new ut(s,this._parents)}function Zp(){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 Jp(e){e||(e=Qp);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 Qp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function eh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function th(){return Array.from(this)}function nh(){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 oh(){let e=0;for(const t of this)++e;return e}function ih(){return!this.node()}function ah(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 lh(e){return function(){this.removeAttribute(e)}}function rh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sh(e,t){return function(){this.setAttribute(e,t)}}function ch(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function dh(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function uh(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 fh(e,t){var o=ai(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?rh:lh:typeof t=="function"?o.local?uh:dh:o.local?ch:sh)(o,t))}function Ys(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function mh(e){return function(){this.style.removeProperty(e)}}function ph(e,t,o){return function(){this.style.setProperty(e,t,o)}}function hh(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function yh(e,t,o){return arguments.length>1?this.each((t==null?mh:typeof t=="function"?hh:ph)(e,t,o??"")):Cn(this.node(),e)}function Cn(e,t){return e.style.getPropertyValue(t)||Ys(e).getComputedStyle(e,null).getPropertyValue(t)}function gh(e){return function(){delete this[e]}}function bh(e,t){return function(){this[e]=t}}function _h(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function kh(e,t){return arguments.length>1?this.each((t==null?gh:typeof t=="function"?_h:bh)(e,t)):this.node()[e]}function Ws(e){return e.trim().split(/^|\s+/)}function Pa(e){return e.classList||new Ks(e)}function Ks(e){this._node=e,this._names=Ws(e.getAttribute("class")||"")}Ks.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 qs(e,t){for(var o=Pa(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Xs(e,t){for(var o=Pa(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function wh(e){return function(){qs(this,e)}}function Eh(e){return function(){Xs(this,e)}}function vh(e,t){return function(){(t.apply(this,arguments)?qs:Xs)(this,e)}}function Nh(e,t){var o=Ws(e+"");if(arguments.length<2){for(var i=Pa(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?vh:t?wh:Eh)(o,t))}function $h(){this.textContent=""}function xh(e){return function(){this.textContent=e}}function Ih(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Sh(e){return arguments.length?this.each(e==null?$h:(typeof e=="function"?Ih:xh)(e)):this.node().textContent}function Ch(){this.innerHTML=""}function Rh(e){return function(){this.innerHTML=e}}function Vh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ah(e){return arguments.length?this.each(e==null?Ch:(typeof e=="function"?Vh:Rh)(e)):this.node().innerHTML}function Th(){this.nextSibling&&this.parentNode.appendChild(this)}function Mh(){return this.each(Th)}function Bh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dh(){return this.each(Bh)}function Oh(e){var t=typeof e=="function"?e:zs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Lh(){return null}function Ph(e,t){var o=typeof e=="function"?e:zs(e),i=t==null?Lh:typeof t=="function"?t:La(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function zh(){var e=this.parentNode;e&&e.removeChild(this)}function Uh(){return this.each(zh)}function Hh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Gh(e){return this.select(e?Fh:Hh)}function Yh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Wh(e){return function(t){e.call(this,t,this.__data__)}}function Kh(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function qh(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function Xh(e,t,o){return function(){var i=this.__on,a,l=Wh(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 jh(e,t,o){var i=Kh(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?Xh:qh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function js(e,t,o){var i=Ys(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 Zh(e,t){return function(){return js(this,e,t)}}function Jh(e,t){return function(){return js(this,e,t.apply(this,arguments))}}function Qh(e,t){return this.each((typeof t=="function"?Jh:Zh)(e,t))}function*ey(){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 Zs=[null];function ut(e,t){this._groups=e,this._parents=t}function oo(){return new ut([[document.documentElement]],Zs)}function ty(){return this}ut.prototype=oo.prototype={constructor:ut,select:Ip,selectAll:Vp,selectChild:Bp,selectChildren:Pp,filter:zp,data:Wp,enter:Up,exit:qp,join:Xp,merge:jp,selection:ty,order:Zp,sort:Jp,call:eh,nodes:th,node:nh,size:oh,empty:ih,each:ah,attr:fh,style:yh,property:kh,classed:Nh,text:Sh,html:Ah,raise:Mh,lower:Dh,append:Oh,insert:Ph,remove:Uh,clone:Gh,datum:Yh,on:jh,dispatch:Qh,[Symbol.iterator]:ey};function ht(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],Zs)}function ny(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Et(e,t){if(e=ny(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 oy={passive:!1},io={capture:!0,passive:!1};function za(e){e.stopImmediatePropagation()}function Rn(e){e.preventDefault(),e.stopImmediatePropagation()}function Js(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 Qs(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 ri=e=>()=>e;function Ua(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}})}Ua.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function iy(e){return!e.ctrlKey&&!e.button}function ay(){return this.parentNode}function ly(e,t){return t??{x:e.x,y:e.y}}function ry(){return navigator.maxTouchPoints||"ontouchstart"in this}function sy(){var e=iy,t=ay,o=ly,i=ry,a={},l=oi("start","drag","end"),r=0,s,c,d,u,f=0;function h(N){N.on("mousedown.drag",m).filter(i).on("touchstart.drag",b).on("touchmove.drag",_,oy).on("touchend.drag touchcancel.drag",A).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(N,te){if(!(u||!e.call(this,N,te))){var S=g(this,t.call(this,N,te),N,te,"mouse");S&&(ht(N.view).on("mousemove.drag",p,io).on("mouseup.drag",y,io),Js(N.view),za(N),d=!1,s=N.clientX,c=N.clientY,S("start",N))}}function p(N){if(Rn(N),!d){var te=N.clientX-s,S=N.clientY-c;d=te*te+S*S>f}a.mouse("drag",N)}function y(N){ht(N.view).on("mousemove.drag mouseup.drag",null),Qs(N.view,d),Rn(N),a.mouse("end",N)}function b(N,te){if(e.call(this,N,te)){var S=N.changedTouches,O=t.call(this,N,te),z=S.length,F,ne;for(F=0;F<z;++F)(ne=g(this,O,N,te,S[F].identifier,S[F]))&&(za(N),ne("start",N,S[F]))}}function _(N){var te=N.changedTouches,S=te.length,O,z;for(O=0;O<S;++O)(z=a[te[O].identifier])&&(Rn(N),z("drag",N,te[O]))}function A(N){var te=N.changedTouches,S=te.length,O,z;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),O=0;O<S;++O)(z=a[te[O].identifier])&&(za(N),z("end",N,te[O]))}function g(N,te,S,O,z,F){var ne=l.copy(),re=Et(F||S,te),L,oe,k;if((k=o.call(N,new Ua("beforestart",{sourceEvent:S,target:h,identifier:z,active:r,x:re[0],y:re[1],dx:0,dy:0,dispatch:ne}),O))!=null)return L=k.x-re[0]||0,oe=k.y-re[1]||0,function W(R,G,H){var ae=re,v;switch(R){case"start":a[z]=W,v=r++;break;case"end":delete a[z],--r;case"drag":re=Et(H||G,te),v=r;break}ne.call(R,N,new Ua(R,{sourceEvent:G,subject:k,target:h,identifier:z,active:v,x:re[0]+L,y:re[1]+oe,dx:re[0]-ae[0],dy:re[1]-ae[1],dispatch:ne}),O)}}return h.filter=function(N){return arguments.length?(e=typeof N=="function"?N:ri(!!N),h):e},h.container=function(N){return arguments.length?(t=typeof N=="function"?N:ri(N),h):t},h.subject=function(N){return arguments.length?(o=typeof N=="function"?N:ri(N),h):o},h.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:ri(!!N),h):i},h.on=function(){var N=l.on.apply(l,arguments);return N===l?h:N},h.clickDistance=function(N){return arguments.length?(f=(N=+N)*N,h):Math.sqrt(f)},h}function Ha(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function ec(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function ao(){}var lo=.7,si=1/lo,Vn="\\s*([+-]?\\d+)\\s*",ro="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",cy=/^#([0-9a-f]{3,8})$/,dy=new RegExp(`^rgb\\(${Vn},${Vn},${Vn}\\)$`),uy=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),fy=new RegExp(`^rgba\\(${Vn},${Vn},${Vn},${ro}\\)$`),my=new RegExp(`^rgba\\(${vt},${vt},${vt},${ro}\\)$`),py=new RegExp(`^hsl\\(${ro},${vt},${vt}\\)$`),hy=new RegExp(`^hsla\\(${ro},${vt},${vt},${ro}\\)$`),tc={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};Ha(ao,tn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:nc,formatHex:nc,formatHex8:yy,formatHsl:gy,formatRgb:oc,toString:oc});function nc(){return this.rgb().formatHex()}function yy(){return this.rgb().formatHex8()}function gy(){return sc(this).formatHsl()}function oc(){return this.rgb().formatRgb()}function tn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=cy.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?ic(t):o===3?new st(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?ci(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ci(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=dy.exec(e))?new st(t[1],t[2],t[3],1):(t=uy.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=fy.exec(e))?ci(t[1],t[2],t[3],t[4]):(t=my.exec(e))?ci(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=py.exec(e))?rc(t[1],t[2]/100,t[3]/100,1):(t=hy.exec(e))?rc(t[1],t[2]/100,t[3]/100,t[4]):tc.hasOwnProperty(e)?ic(tc[e]):e==="transparent"?new st(NaN,NaN,NaN,0):null}function ic(e){return new st(e>>16&255,e>>8&255,e&255,1)}function ci(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function by(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 Fa(e,t,o,i){return arguments.length===1?by(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}Ha(st,Fa,ec(ao,{brighter(e){return e=e==null?si:Math.pow(si,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),di(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:ac,formatHex:ac,formatHex8:_y,formatRgb:lc,toString:lc}));function ac(){return`#${on(this.r)}${on(this.g)}${on(this.b)}`}function _y(){return`#${on(this.r)}${on(this.g)}${on(this.b)}${on((isNaN(this.opacity)?1:this.opacity)*255)}`}function lc(){const e=di(this.opacity);return`${e===1?"rgb(":"rgba("}${nn(this.r)}, ${nn(this.g)}, ${nn(this.b)}${e===1?")":`, ${e})`}`}function di(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 rc(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 sc(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 ky(e,t,o,i){return arguments.length===1?sc(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}Ha(yt,ky,ec(ao,{brighter(e){return e=e==null?si:Math.pow(si,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(Ga(e>=240?e-240:e+120,a,i),Ga(e,a,i),Ga(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new yt(cc(this.h),ui(this.s),ui(this.l),di(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=di(this.opacity);return`${e===1?"hsl(":"hsla("}${cc(this.h)}, ${ui(this.s)*100}%, ${ui(this.l)*100}%${e===1?")":`, ${e})`}`}}));function cc(e){return e=(e||0)%360,e<0?e+360:e}function ui(e){return Math.max(0,Math.min(1,e||0))}function Ga(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 Ya=e=>()=>e;function wy(e,t){return function(o){return e+o*t}}function Ey(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 vy(e){return(e=+e)==1?dc:function(t,o){return o-t?Ey(t,o,e):Ya(isNaN(t)?o:t)}}function dc(e,t){var o=t-e;return o?wy(e,o):Ya(isNaN(e)?t:e)}const fi=(function e(t){var o=vy(t);function i(a,l){var r=o((a=Fa(a)).r,(l=Fa(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=dc(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 Ny(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 $y(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xy(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 Iy(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 Sy(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 Wa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ka=new RegExp(Wa.source,"g");function Cy(e){return function(){return e}}function Ry(e){return function(t){return e(t)+""}}function uc(e,t){var o=Wa.lastIndex=Ka.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Wa.exec(e))&&(a=Ka.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=Ka.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Ry(c[0].x):Cy(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"?Ya(t):(o==="number"?Nt:o==="string"?(i=tn(t))?(t=i,fi):uc:t instanceof tn?fi:t instanceof Date?Iy:$y(t)?Ny:Array.isArray(t)?xy:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Sy:Nt)(e,t)}var fc=180/Math.PI,qa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mc(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)*fc,skewX:Math.atan(c)*fc,scaleX:r,scaleY:s}}var mi;function Vy(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?qa:mc(t.a,t.b,t.c,t.d,t.e,t.f)}function Ay(e){return e==null||(mi||(mi=document.createElementNS("http://www.w3.org/2000/svg","g")),mi.setAttribute("transform",e),!(e=mi.transform.baseVal.consolidate()))?qa:(e=e.matrix,mc(e.a,e.b,e.c,e.d,e.e,e.f))}function pc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push("translate(",null,t,null,o);p.push({i:y-4,x:Nt(d,f)},{i:y-2,x:Nt(u,h)})}else(f||h)&&m.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:Nt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:Nt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push(a(m)+"scale(",null,",",null,")");p.push({i:y-4,x:Nt(d,f)},{i:y-2,x:Nt(u,h)})}else(f!==1||h!==1)&&m.push(a(m)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(m){for(var p=-1,y=h.length,b;++p<y;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var Ty=pc(Vy,"px, ","px)","deg)"),My=pc(Ay,", ",")",")"),By=1e-12;function hc(e){return((e=Math.exp(e))+1/e)/2}function Dy(e){return((e=Math.exp(e))-1/e)/2}function Oy(e){return((e=Math.exp(2*e))-1)/(e+1)}const pi=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],h=r[2],m=u-s,p=f-c,y=m*m+p*p,b,_;if(y<By)_=Math.log(h/d)/t,b=function(O){return[s+O*m,c+O*p,d*Math.exp(t*O*_)]};else{var A=Math.sqrt(y),g=(h*h-d*d+i*y)/(2*d*o*A),N=(h*h-d*d-i*y)/(2*h*o*A),te=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(N*N+1)-N);_=(S-te)/t,b=function(O){var z=O*_,F=hc(te),ne=d/(o*A)*(F*Oy(t*z+te)-Dy(te));return[s+ne*m,c+ne*p,d*F/hc(t*z+te)]}}return b.duration=_*1e3*t/Math.SQRT2,b}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var An=0,co=0,uo=0,yc=1e3,hi,fo,yi=0,an=0,gi=0,mo=typeof performance=="object"&&performance.now?performance:Date,gc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xa(){return an||(gc(Ly),an=mo.now()+gi)}function Ly(){an=0}function bi(){this._call=this._time=this._next=null}bi.prototype=bc.prototype={constructor:bi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Xa():+o)+(t==null?0:+t),!this._next&&fo!==this&&(fo?fo._next=this:hi=this,fo=this),this._call=e,this._time=o,ja()},stop:function(){this._call&&(this._call=null,this._time=1/0,ja())}};function bc(e,t,o){var i=new bi;return i.restart(e,t,o),i}function Py(){Xa(),++An;for(var e=hi,t;e;)(t=an-e._time)>=0&&e._call.call(void 0,t),e=e._next;--An}function _c(){an=(yi=mo.now())+gi,An=co=0;try{Py()}finally{An=0,Uy(),an=0}}function zy(){var e=mo.now(),t=e-yi;t>yc&&(gi-=t,yi=e)}function Uy(){for(var e,t=hi,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:hi=o);fo=e,ja(i)}function ja(e){if(!An){co&&(co=clearTimeout(co));var t=e-an;t>24?(e<1/0&&(co=setTimeout(_c,e-mo.now()-gi)),uo&&(uo=clearInterval(uo))):(uo||(yi=mo.now(),uo=setInterval(zy,yc)),An=1,gc(_c))}}function kc(e,t,o){var i=new bi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Hy=oi("start","end","cancel","interrupt"),Fy=[],wc=0,Ec=1,Za=2,_i=3,vc=4,Ja=5,ki=6;function wi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Gy(e,o,{name:t,index:i,group:a,on:Hy,tween:Fy,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:wc})}function Qa(e,t){var o=gt(e,t);if(o.state>wc)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 Gy(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=bc(l,0,o.time);function l(d){o.state=Ec,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,m;if(o.state!==Ec)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===_i)return kc(r);m.state===vc?(m.state=ki,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=ki,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(kc(function(){o.state===_i&&(o.state=vc,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Za,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Za){for(o.state=_i,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Ja,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Ja&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ki,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ei(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>Za&&i.state<Ja,i.state=ki,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function Yy(e){return this.each(function(){Ei(this,e)})}function Wy(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 Ky(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=$t(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function qy(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=gt(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?Wy:Ky)(o,e,t))}function el(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 Nc(e,t){var o;return(typeof t=="number"?Nt:t instanceof tn?fi:(o=tn(t))?(t=o,fi):uc)(e,t)}function Xy(e){return function(){this.removeAttribute(e)}}function jy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zy(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 Jy(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 Qy(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 eg(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 tg(e,t){var o=ai(e),i=o==="transform"?My:Nc;return this.attrTween(e,typeof t=="function"?(o.local?eg:Qy)(o,i,el(this,"attr."+e,t)):t==null?(o.local?jy:Xy)(o):(o.local?Jy:Zy)(o,i,t))}function ng(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function og(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function ig(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&og(e,l)),o}return a._value=t,a}function ag(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ng(e,l)),o}return a._value=t,a}function lg(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=ai(e);return this.tween(o,(i.local?ig:ag)(i,t))}function rg(e,t){return function(){Qa(this,e).delay=+t.apply(this,arguments)}}function sg(e,t){return t=+t,function(){Qa(this,e).delay=t}}function cg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rg:sg)(t,e)):gt(this.node(),t).delay}function dg(e,t){return function(){$t(this,e).duration=+t.apply(this,arguments)}}function ug(e,t){return t=+t,function(){$t(this,e).duration=t}}function fg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?dg:ug)(t,e)):gt(this.node(),t).duration}function mg(e,t){if(typeof t!="function")throw new Error;return function(){$t(this,e).ease=t}}function pg(e){var t=this._id;return arguments.length?this.each(mg(t,e)):gt(this.node(),t).ease}function hg(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;$t(this,e).ease=o}}function yg(e){if(typeof e!="function")throw new Error;return this.each(hg(this._id,e))}function gg(e){typeof e!="function"&&(e=Hs(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 At(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),h,m=0;m<u;++m)(h=c[m]||d[m])&&(f[m]=h);for(;s<i;++s)r[s]=t[s];return new At(r,this._parents,this._name,this._id)}function _g(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 kg(e,t,o){var i,a,l=_g(t)?Qa:$t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function wg(e,t){var o=this._id;return arguments.length<2?gt(this.node(),o).on.on(e):this.each(kg(o,e,t))}function Eg(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function vg(){return this.on("end.remove",Eg(this._id))}function Ng(e){var t=this._name,o=this._id;typeof e!="function"&&(e=La(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,wi(d[h],t,o,h,d,gt(u,o)));return new At(l,this._parents,t,o)}function $g(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Us(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),m,p=gt(u,o),y=0,b=h.length;y<b;++y)(m=h[y])&&wi(m,t,o,y,h,p);l.push(h),r.push(u)}return new At(l,r,t,o)}var xg=oo.prototype.constructor;function Ig(){return new xg(this._groups,this._parents)}function Sg(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 $c(e){return function(){this.style.removeProperty(e)}}function Cg(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 Rg(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 Vg(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=$c(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Ag(e,t,o){var i=(e+="")=="transform"?Ty:Nc;return t==null?this.styleTween(e,Sg(e,i)).on("end.style."+e,$c(e)):typeof t=="function"?this.styleTween(e,Rg(e,i,el(this,"style."+e,t))).each(Vg(this._id,e)):this.styleTween(e,Cg(e,i,t),o).on("end.style."+e,null)}function Tg(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Mg(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Tg(e,r,o)),i}return l._value=t,l}function Bg(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,Mg(e,t,o??""))}function Dg(e){return function(){this.textContent=e}}function Og(e){return function(){var t=e(this);this.textContent=t??""}}function Lg(e){return this.tween("text",typeof e=="function"?Og(el(this,"text",e)):Dg(e==null?"":e+""))}function Pg(e){return function(t){this.textContent=e.call(this,t)}}function zg(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Pg(a)),t}return i._value=e,i}function Ug(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,zg(e))}function Hg(){for(var e=this._name,t=this._id,o=xc(),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);wi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new At(i,this._parents,e,o)}function Fg(){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 Gg=0;function At(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function xc(){return++Gg}var Tt=oo.prototype;At.prototype={constructor:At,select:Ng,selectAll:$g,selectChild:Tt.selectChild,selectChildren:Tt.selectChildren,filter:gg,merge:bg,selection:Ig,transition:Hg,call:Tt.call,nodes:Tt.nodes,node:Tt.node,size:Tt.size,empty:Tt.empty,each:Tt.each,on:wg,attr:tg,attrTween:lg,style:Ag,styleTween:Bg,text:Lg,textTween:Ug,remove:vg,tween:qy,delay:cg,duration:fg,ease:pg,easeVarying:yg,end:Fg,[Symbol.iterator]:Tt[Symbol.iterator]};function Yg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Wg={time:null,delay:0,duration:250,ease:Yg};function Kg(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function qg(e){var t,o;e instanceof At?(t=e._id,e=e._name):(t=xc(),(o=Wg).time=Xa(),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])&&wi(c,e,t,d,r,o||Kg(c,t));return new At(i,this._parents,e,t)}oo.prototype.interrupt=Yy,oo.prototype.transition=qg;const vi=e=>()=>e;function Xg(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 Mt(e,t,o){this.k=e,this.x=t,this.y=o}Mt.prototype={constructor:Mt,scale:function(e){return e===1?this:new Mt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Mt(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 Mt(1,0,0);Mt.prototype;function tl(e){e.stopImmediatePropagation()}function po(e){e.preventDefault(),e.stopImmediatePropagation()}function jg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zg(){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 Ic(){return this.__zoom||Tn}function Jg(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Qg(){return navigator.maxTouchPoints||"ontouchstart"in this}function eb(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 tb(){var e=jg,t=Zg,o=eb,i=Jg,a=Qg,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=pi,d=oi("start","zoom","end"),u,f,h,m=500,p=150,y=0,b=10;function _(k){k.property("__zoom",Ic).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",re).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,W,R,G){var H=k.selection?k.selection():k;H.property("__zoom",Ic),k!==H?te(k,W,R,G):H.interrupt().each(function(){S(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 H=this.__zoom.k,ae=typeof W=="function"?W.apply(this,arguments):W;return H*ae},R,G)},_.scaleTo=function(k,W,R,G){_.transform(k,function(){var H=t.apply(this,arguments),ae=this.__zoom,v=R==null?N(H):typeof R=="function"?R.apply(this,arguments):R,q=ae.invert(v),le=typeof W=="function"?W.apply(this,arguments):W;return o(g(A(ae,le),v,q),H,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,H){_.transform(k,function(){var ae=t.apply(this,arguments),v=this.__zoom,q=G==null?N(ae):typeof G=="function"?G.apply(this,arguments):G;return o(Tn.translate(q[0],q[1]).scale(v.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof R=="function"?-R.apply(this,arguments):-R),ae,r)},G,H)};function A(k,W){return W=Math.max(l[0],Math.min(l[1],W)),W===k.k?k:new Mt(W,k.x,k.y)}function g(k,W,R){var G=W[0]-R[0]*k.k,H=W[1]-R[1]*k.k;return G===k.x&&H===k.y?k:new Mt(k.k,G,H)}function N(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(){S(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,ae=arguments,v=S(H,ae).event(G),q=t.apply(H,ae),le=R==null?N(q):typeof R=="function"?R.apply(H,ae):R,me=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),he=H.__zoom,se=typeof W=="function"?W.apply(H,ae):W,ce=c(he.invert(le).concat(me/he.k),se.invert(le).concat(me/se.k));return function(ye){if(ye===1)ye=se;else{var ke=ce(ye),Re=me/ke[2];ye=new Mt(Re,le[0]-ke[0]*Re,le[1]-ke[1]*Re)}v.zoom(null,ye)}})}function S(k,W,R){return!R&&k.__zooming||new O(k,W)}function O(k,W){this.that=k,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,W),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,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 Xg(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),W)}};function z(k,...W){if(!e.apply(this,arguments))return;var R=S(this,W).event(k),G=this.__zoom,H=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,i.apply(this,arguments)))),ae=Et(k);if(R.wheel)(R.mouse[0][0]!==ae[0]||R.mouse[0][1]!==ae[1])&&(R.mouse[1]=G.invert(R.mouse[0]=ae)),clearTimeout(R.wheel);else{if(G.k===H)return;R.mouse=[ae,G.invert(ae)],Ei(this),R.start()}po(k),R.wheel=setTimeout(v,p),R.zoom("mouse",o(g(A(G,H),R.mouse[0],R.mouse[1]),R.extent,r));function v(){R.wheel=null,R.end()}}function F(k,...W){if(h||!e.apply(this,arguments))return;var R=k.currentTarget,G=S(this,W,!0).event(k),H=ht(k.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",me,!0),ae=Et(k,R),v=k.clientX,q=k.clientY;Js(k.view),tl(k),G.mouse=[ae,this.__zoom.invert(ae)],Ei(this),G.start();function le(he){if(po(he),!G.moved){var se=he.clientX-v,ce=he.clientY-q;G.moved=se*se+ce*ce>y}G.event(he).zoom("mouse",o(g(G.that.__zoom,G.mouse[0]=Et(he,R),G.mouse[1]),G.extent,r))}function me(he){H.on("mousemove.zoom mouseup.zoom",null),Qs(he.view,G.moved),po(he),G.event(he).end()}}function ne(k,...W){if(e.apply(this,arguments)){var R=this.__zoom,G=Et(k.changedTouches?k.changedTouches[0]:k,this),H=R.invert(G),ae=R.k*(k.shiftKey?.5:2),v=o(g(A(R,ae),G,H),t.apply(this,W),r);po(k),s>0?ht(this).transition().duration(s).call(te,v,G,k):ht(this).call(_.transform,v,G,k)}}function re(k,...W){if(e.apply(this,arguments)){var R=k.touches,G=R.length,H=S(this,W,k.changedTouches.length===G).event(k),ae,v,q,le;for(tl(k),v=0;v<G;++v)q=R[v],le=Et(q,this),le=[le,this.__zoom.invert(le),q.identifier],H.touch0?!H.touch1&&H.touch0[2]!==le[2]&&(H.touch1=le,H.taps=0):(H.touch0=le,ae=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),ae&&(H.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),Ei(this),H.start())}}function L(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v,q,le;for(po(k),ae=0;ae<H;++ae)v=G[ae],q=Et(v,this),R.touch0&&R.touch0[2]===v.identifier?R.touch0[0]=q:R.touch1&&R.touch1[2]===v.identifier&&(R.touch1[0]=q);if(v=R.that.__zoom,R.touch1){var me=R.touch0[0],he=R.touch0[1],se=R.touch1[0],ce=R.touch1[1],ye=(ye=se[0]-me[0])*ye+(ye=se[1]-me[1])*ye,ke=(ke=ce[0]-he[0])*ke+(ke=ce[1]-he[1])*ke;v=A(v,Math.sqrt(ye/ke)),q=[(me[0]+se[0])/2,(me[1]+se[1])/2],le=[(he[0]+ce[0])/2,(he[1]+ce[1])/2]}else if(R.touch0)q=R.touch0[0],le=R.touch0[1];else return;R.zoom("touch",o(g(v,q,le),R.extent,r))}}function oe(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v;for(tl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),ae=0;ae<H;++ae)v=G[ae],R.touch0&&R.touch0[2]===v.identifier?delete R.touch0:R.touch1&&R.touch1[2]===v.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&&(v=Et(v,this),Math.hypot(f[0]-v[0],f[1]-v[1])<b)){var q=ht(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:vi(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:vi(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:vi(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:vi([[+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?(y=(k=+k)*k,_):Math.sqrt(y)},_.tapDistance=function(k){return arguments.length?(b=+k,_):b},_}var Se=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Se||{}),nl=(e=>(e.Partial="partial",e.Full="full",e))(nl||{}),ln=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ln||{}),Bt=(e=>(e.Strict="strict",e.Loose="loose",e))(Bt||{}),ol=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(ol||{}),ho=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ho||{}),Sc=(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))(Sc||{});const nb=["INPUT","SELECT","TEXTAREA"],ob=typeof document<"u"?document:null;function il(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 nb.includes(i==null?void 0:i.nodeName)||a||!!l}function ib(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Cc(e,t,o,i){const a=t.replace("+",`
|
|
1
|
+
(function(ve,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):(ve=typeof globalThis<"u"?globalThis:ve||self,n(ve.EntityModeler={},ve.Vue,ve.OpenBlueseaCore))})(this,(function(ve,n,ie){"use strict";var nC=Object.defineProperty;var oC=(ve,n,ie)=>n in ve?nC(ve,n,{enumerable:!0,configurable:!0,writable:!0,value:ie}):ve[n]=ie;var We=(ve,n,ie)=>oC(ve,typeof n!="symbol"?n+"":n,ie);const af={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function lf(e,t){const o=e%t.perRow,i=Math.floor(e/t.perRow);return{location:{x:t.startX+o*t.columnGap,y:t.startY+i*t.rowGap},size:{...t.defaultSize}}}function jl(e,t,o={}){const i={...af,...o},a=new Map(e.entities.map(g=>[g.modelId,g])),l=new Map(e.associations.map(g=>[g.modelId,g])),r=new Map(t.entityLayouts.map(g=>[g.entityRef,g])),s=new Map(t.associationLayouts.map(g=>[g.associationRef,g])),c=t.entityLayouts.map(g=>g.entityRef).filter(g=>!a.has(g)),d=t.associationLayouts.map(g=>g.associationRef).filter(g=>!l.has(g)),u=new Map;for(const g of e.groups)for(const N of g.memberEntityRefs)u.set(N,g.modelId);const f=new Map;for(const g of t.groupLayouts)for(const N of g.memberNoteRefs??[])f.set(N,g.groupRef);let h=0;const m=e.entities.map(g=>{const N=u.get(g.modelId),te=r.get(g.modelId);if(te){const O={location:{x:te.geo.location.x,y:te.geo.location.y},size:{width:te.geo.size.width,height:te.geo.size.height}};return{entity:g,geo:O,collapsed:te.collapsed??!1,locked:te.locked??!1,groupRef:N,style:te.style,attributeStyles:te.attributeStyles,operationStyles:te.operationStyles}}const S=lf(h++,i);return{entity:g,geo:S,collapsed:!1,locked:!1,groupRef:N}}),p=new Map(t.groupLayouts.map(g=>[g.groupRef,g])),y=e.groups.map(g=>{const N=p.get(g.modelId),te=N?{location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:te,style:N==null?void 0:N.style,locked:(N==null?void 0:N.locked)??!1}}),b=e.associations.map(g=>{const N=s.get(g.modelId);return{association:g,waypoints:(N==null?void 0:N.waypoints)??[],sourceColumnRef:N==null?void 0:N.sourceColumnRef,targetColumnRef:N==null?void 0:N.targetColumnRef}}),_=t.notes.map(g=>({note:{...g,geo:{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}},groupRef:f.get(g.modelId)})),A=[];for(const g of t.notes)for(const N of g.connections??[])a.has(N.targetRef)&&A.push({noteRef:g.modelId,targetRef:N.targetRef,waypoints:N.waypoints.map(te=>({x:te.x,y:te.y}))});return{entities:m,associations:b,groups:y,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 wn=.5;function Zl(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 m=(b,_)=>{(Math.abs(b.x-h.x)>=wn||Math.abs(b.y-h.y)>=wn)&&(f.push({a:h,b,seg:_}),h=b)};m(c,0);let p=r.x!==0,y=c;for(let b=1;b<u.length;b++){const _=u[b],A=b<=o.length?b-1:o.length,g=Math.abs(_.x-y.x)<wn,N=Math.abs(_.y-y.y)<wn;g&&N||(g?(m(_,A),p=!1):N?(m(_,A),p=!0):p?(m({x:y.x,y:_.y},A),m(_,A),p=!0):(m({x:_.x,y:y.y},A),m(_,A),p=!1),y=_)}return m(i,o.length),f}function da(e,t,o,i,a,l=20){const r=Zl(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 rf=14;function ua(e,t,o,i,a,l=20){return Zl(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=rf).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 sf=36;function Jl(e,t,o=sf){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 fa(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 cf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ma(e,t){const o=cf(e),i=e.width/2,a=e.height/2,l=t.x-o.x,r=t.y-o.y;if(Math.abs(l)<wn&&Math.abs(r)<wn)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 pa(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 ha(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 df={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ql(e,t,o={}){const i={...df,...o},a=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),l=[];let r=0;for(const u of e.groups){const f=a.get(u.modelId),h=f?f.location:{x:0,y:0},m=f?f.size.width:800;f&&(r=Math.max(r,f.location.y+f.size.height));const p=Math.max(1,Math.floor((m-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((y,b)=>{const _=b%p,A=Math.floor(b/p);l.push({id:y,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,m=Math.floor(f/i.ungroupedCols);l.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+m*i.cellHeight}})}),l}const er={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function tr(e,t={}){const o={...er,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function uf(e,t={}){const o={...er,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=tr(l.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:l.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Fo(e,t,o,i){switch(e){case"CLASS":return t;case"PHYSICAL":return i||t;case"LOGICAL":return o||"(논리명)";default:return i?`${o||"(논리명)"} · ${i}`:o||"(논리명)"}}function nr(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 or(e){var l,r,s;const t=new Map(e.entities.map(c=>[c.modelId,c.name])),o=new Map;for(const c of e.entities)for(const d of c.attributes)o.set(d.modelId,d.name);const i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((l=c.name)==null?void 0:l.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(r=c.table)!=null&&r.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const f=[...c.attributes].sort((m,p)=>m.order-p.order);for(const m of f){if(m.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${m.name?` ${m.name} ${"─".repeat(8)}`:""}`);continue}const p=m.dbAttrs[0],y=p!=null&&p.length?`(${p.length}${p.scale!=null?`,${p.scale}`:""})`:"",b=p?` → ${p.physicalName} ${p.dataType}${y}`:"",_=[m.identifier?"PK":"",m.notNull?"NOT NULL":"",p!=null&&p.unique?"UNIQUE":"",p!=null&&p.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${m.name}: ${m.type}${b}${_.length?` {${_.join(", ")}}`:""}`)}for(const m of c.indexes??[]){const p=m.columns.map(y=>`${o.get(y.columnRef)??y.columnRef}${y.descending?" DESC":""}`).join(", ");a.push(` index ${m.name}${m.unique?" UNIQUE":""}: ${p}`)}const h=[...c.operations??[]].sort((m,p)=>m.order-p.order);for(const m of h){const p=m.visibility?` {${m.visibility}}`:"",y=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";a.push(` method ${m.name}()${p}${y}`)}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} ${nr(c.end1.multiplicity)} —— ${nr(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
|
|
2
|
+
`).trim()}function ff(e){return e==="CLASS"?"class":"er"}function ya(e,t){return t==="class"?gf(e):pf(e)}function Kn(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function ga(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function ir(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 mf(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function ar(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 lr(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 pf(e){var i,a;const t=ir(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":"",mf(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),m=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",p=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,y=ga([p,m].filter(Boolean).join(" ")),b=[` ${u} ${f}`];h&&b.push(h);let _=b.join(" ");y&&(_+=` "${y}"`),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=`${lr(l.end1.multiplicity,"left")}--${lr(l.end2.multiplicity,"right")}`,d=ga(l.description);o.push(` ${r} ${c} ${s} : "${d}"`)}return o.join(`
|
|
3
|
+
`)}function hf(e){return e&&e!=="UNDEFINED"?e:null}function yf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function gf(e){const t=ir(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),l=[],r=hf(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(` +${yf(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=bf(i),s=ga(i.description),c=` ${a} "${ar(i.end1.multiplicity)}" ${r} "${ar(i.end2.multiplicity)}" ${l}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function bf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const _f=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function dt(e){return e.replace(_f,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ae(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function rr(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 kf(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 wf(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 Ef(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 ba(e){const t=wf(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="${Ef(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(kf(r));for(const r of e.texts)l.push(rr(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(rr(i));return`<g>${o.join("")}</g>`}function sr(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(ba(r));for(const r of e.edges)l.push(vf(r));for(const r of e.entities)l.push(ba(r));for(const r of e.notes)l.push(ba(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 Nf=["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"],$f=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"]),xf=Nf.filter(e=>!$f.has(e)),If={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function _a(e){return If[e]??e}const Sf=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Go=new Set(["NUMERIC","DECIMAL"]);function cr(e,t=xf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const zt="CustomType",qn="GroupCodeEnum",ka="String",wa=[{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:"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:zt,label:"CustomType"}],Cf=new Map(wa.map(e=>[e.value,e.label]));function En(e){return Cf.get(e)??e}const Rf=new Set([qn,"CustomMoneyType"]),dr=wa.filter(e=>!Rf.has(e.value)).map(e=>e.value===zt?{...e,label:"CustomType (사용자정의)"}:e);function ur(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=[...dr,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:En(e)},...i]:i}function Vf(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function fr(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 Ea(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${En(t.type)}>`:Vf(t)?En(t.type):e==="CLASS"?t.type===zt&&t.customType||En(t.type):_a(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Xn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Yo(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 va=63;function Wo(e){if(!e)return null;const t=e.length;return t<=va?null:`물리명이 ${va}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function mr(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 Af(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,a=2,l=new Map,r=[],s=[],c=new Set,d=u=>{l.set(u,i),r.push(u);for(const f of t.get(u)??[]){const h=l.get(f)??o;if(h===o)d(f);else if(h===i){const m=r.slice(r.indexOf(f)),p=[...m].sort().join(" ");c.has(p)||(c.add(p),s.push(m))}}r.pop(),l.set(u,a)};for(const u of e.entities)(l.get(u.modelId)??o)===o&&d(u.modelId);return s}function Tf(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 Na(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 pr(e,t){var l,r,s;const o=[];for(const c of Na(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(p=>p.attrType!=="DIVIDER");if(mt(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(p=>p.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),mt((l=c.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const p of d.filter(y=>y.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${p.name}"`});for(const p of d.filter(y=>y.identifier&&y.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${p.name}"`});for(const p of d)if(!p.identifier)for(const y of p.dbAttrs)!y.autoIncrement&&mt(y.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:y.modelId,contextRef:c.modelId,message:`채번(${y.autoIncrement?"auto increment":`시퀀스 "${y.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${p.name}"에 설정되어 있습니다`});for(const p of d.filter(y=>y.naturalId&&y.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${p.name}"`});for(const p of d.filter(y=>y.naturalId&&y.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${p.name}"`});for(const p of d.filter(y=>y.naturalId&&!y.notNull&&!y.identifier&&!y.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${p.name}"`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const p of Na(d,y=>y.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${p.name}"`});for(const p of d)mt(p.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(p=>p.dbAttrs).filter(p=>p.sharedColumnRef==null),f=d.flatMap(p=>p.dbAttrs.map((y,b)=>({col:y,name:Tf(p,y,b,e,t)})).filter(y=>y.col.sharedColumnRef==null));for(const p of Na(f,y=>y.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:p.col.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${p.name}"`});for(const p of u){const y=Wo(p.physicalName);y&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:y}),t!=null&&t.reservedWords&&!mt(p.physicalName)&&t.reservedWords.has(p.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${p.physicalName}"`}),t!=null&&t.selectableDataTypes&&!mt(p.dataType)&&!t.selectableDataTypes.has(p.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${p.dataType}"`}),!mt(p.dataType)&&Sf.has(p.dataType)&&!p.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`${p.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const p=Xn(d.flatMap(y=>y.dbAttrs));for(const y of d){if(y.attrType!=="EMBED_PREDEF")continue;const b=t.embeddableCatalog.find(_=>_.type===y.type);b&&y.dbAttrs.forEach((_,A)=>{if(_.sharedColumnRef==null)return;const g=b.fields[A],N=p.get(_.sharedColumnRef);if(!g||!N)return;(N.dataType!==g.dataType||(N.length??null)!==(g.length??null)||(N.scale??null)!==(g.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${mr(N)})이 ${g.name??"컬럼"} 정의(${mr(g)})와 다릅니다`})})}}for(const p of d){const y=p.dbAttrs[0];if(!(y!=null&&y.multiValue))continue;p.type===qn&&y.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:y.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${p.type||"타입 미지정"} / ${y.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const h=(s=c.table)==null?void 0:s.physicalName,m=Wo(h);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!mt(h)&&t.reservedWords.has(h.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${h}"`});for(const p of c.indexes??[]){const y=Wo(p.name);y&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:y}),t!=null&&t.reservedWords&&!mt(p.name)&&t.reservedWords.has(p.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${p.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){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"),m=f.includes("REMOVE");h&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||h)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${h?"ALL":"REMOVE"}와 의미가 겹칩니다`}),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 Af(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 Mf="CustomMoneyType",Bf="Money";function Df(e){return!(e.type!==Mf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Of(e){const t=e.dbAttrs[0]??{modelId:Oe(),physicalName:"",dataType:""},o={modelId:Oe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Bf,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Lf(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>Df(r)?(a=!0,t=!0,Of(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function $a(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 Pf(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 zf=new Set(["attributes","operations","indexes","rev"]),Uf=new Set(["end1","end2","rev"]),Hf=new Set(["memberEntityRefs","rev"]),hr=new Set(["modelId"]),Ff=new Set(["modelId","columns"]),Gf=new Set([]);function Yf(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,hr);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,hr);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,Ff);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Wf(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:$a(r)});for(const{cur:r,tgt:s}of i.common){const c=Zt(r,s,zf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),Yf(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:$a(r)});for(const{cur:r,tgt:s}of a.common){const c=Zt(r,s,Uf);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]??{},Gf);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:$a(r)});for(const{cur:r,tgt:s}of l.common){const c=Zt(r,s,Hf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=Pf(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 Ko(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 Kf(e,t,o){Ko(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Ko(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Ko(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Ko(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function qf(e,t){const o=[];return Wf(e.logical,t.logical,o),Kf(e.layout,t.layout,o),o}function Xf(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const jf={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class Zf{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=jf[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function Qt(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function xa(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=Xf(t),i=new Zf(t.field),a=[...e].sort((m,p)=>m.seq-p.seq);for(const m of a)for(const p of m.ops)switch(o){case"entity":if(p.entityRef!==t.entityRef)break;p.kind==="entity.add"?kt(i,m,p.value,"entity"):p.kind==="entity.update"?Qt(i,m,p.patch):p.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((l=p.value)==null?void 0:l.attributes,t.attributeRef);y&&kt(i,m,y,"attribute")}else p.kind==="attribute.add"&&((r=p.value)==null?void 0:r.modelId)===t.attributeRef?kt(i,m,p.value,"attribute"):p.kind==="attribute.update"&&p.attributeRef===t.attributeRef?Qt(i,m,p.patch):(p.kind==="attribute.remove"&&p.attributeRef===t.attributeRef||p.kind==="entity.remove")&&i.remove(m);break;case"operation":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((s=p.value)==null?void 0:s.operations,t.operationRef);y&&kt(i,m,y,"operation")}else p.kind==="operation.add"&&((c=p.value)==null?void 0:c.modelId)===t.operationRef?kt(i,m,p.value,"operation"):p.kind==="operation.update"&&p.operationRef===t.operationRef?Qt(i,m,p.patch):(p.kind==="operation.remove"&&p.operationRef===t.operationRef||p.kind==="entity.remove")&&i.remove(m);break;case"index":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((d=p.value)==null?void 0:d.indexes,t.indexRef);y&&kt(i,m,y,"index")}else p.kind==="index.add"&&((u=p.value)==null?void 0:u.modelId)===t.indexRef?kt(i,m,p.value,"index"):p.kind==="index.update"&&p.indexRef===t.indexRef?Qt(i,m,p.patch):(p.kind==="index.remove"&&p.indexRef===t.indexRef||p.kind==="entity.remove")&&i.remove(m);break;case"association":if(p.associationRef!==t.associationRef)break;p.kind==="association.add"?kt(i,m,p.value,"association"):p.kind==="association.update"?Qt(i,m,p.patch):p.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(p.associationRef!==t.associationRef)break;if(p.kind==="association.add"){const y=(f=p.value)==null?void 0:f[t.end];kt(i,m,y,"associationEnd")}else p.kind==="associationEnd.update"&&p.end===t.end?Qt(i,m,p.patch):p.kind==="association.remove"&&i.remove(m);break;case"group":if(p.groupRef!==t.groupRef)break;if(p.kind==="group.add"){kt(i,m,p.value,"group");const y=(h=p.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(y))for(const b of y)i.member(m,b,!1)}else p.kind==="group.update"?Qt(i,m,p.patch):p.kind==="group.remove"?i.remove(m):p.kind==="group.addMember"&&p.entityRef!=null?i.member(m,p.entityRef,!1):p.kind==="group.removeMember"&&p.entityRef!=null&&i.member(m,p.entityRef,!0);break}return i.result()}function Jf(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 Qf(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 qo(e,t){return e.map(o=>({...o,subject:t}))}function yr(e,t){const o=e.filter(s=>s.ops.some(c=>Jf(c,t))),{attributes:i,operations:a,indexes:l}=Qf(o,t),r=[...qo(Ut(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...qo(Ut(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...qo(Ut(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...qo(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 gr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function em(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 tm(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 nm(e){const{entities:t,associations:o,groups:i}=tm(e),a=[];for(const l of t)for(const r of yr(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 br(e){const t=nm(e),o=em(e),i=new Map;for(const r of t){const s=gr(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=gr(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 Ia{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 _r(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 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 Ct(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 Sa(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=_r(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=Ze(o,e.modelId);a>=0&&o.layout.entityLayouts.splice(a,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function kr(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=_r(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(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 wr(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 Er(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=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 vr(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 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 Nr(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=Jn(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 $r(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 xr(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 Ca(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 Xo(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=Jn(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 Ra(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);a>=0&&o.layout.groupLayouts.splice(a,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Ir(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 Sr(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 Cr(e,t){let o=!1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에 편입",apply(a){const l=i(a);l&&!l.memberEntityRefs.includes(t)&&(l.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const l=i(a),r=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1;r>=0&&l.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function jo(e,t){let o=-1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에서 제외",apply(a){const l=i(a);o=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1,o>=0&&l.memberEntityRefs.splice(o,1)},invert(a){var l;o<0||(l=i(a))==null||l.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function Rr(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 Vr(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 Ar(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 Tr(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 Rt(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 Va(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 Mr(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 Br(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 Dr(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 Or(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,m)=>h.order=m),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 Lr(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=Jn(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 Aa(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 Pr(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 Zo(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 zr(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 Ur(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 Hr(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 Fr(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 Gr(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 Yr(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 Wr(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 Kr(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 qr(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 Xr(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 jr(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Zr(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 Jr(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 Qr(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 es(e,t){let o=-1;const i=a=>a.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var r;const l=i(a);o=((r=l==null?void 0:l.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&l.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const l=i(a);l&&(l.memberNoteRefs||(l.memberNoteRefs=[]),l.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const Ht=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Jo=(e,t,o)=>{var i;return((i=Ct(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function ts(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 ns(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 os(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=Ct(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=Ct(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Jo(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Ht(e,t,r)],invert:[Ht(e,t,s)]}}}}function is(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=Ct(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=Ct(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Jo(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function as(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=Ct(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=Ct(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Jo(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function ls(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Ct(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=Ct(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Ht(e,t,Jo(i,e,t))],invert:[Ht(e,t,o??[])]}}}}function Fe(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 om=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Aa,addAttribute:Rt,addEntity:Sa,addEntityToGroup:Cr,addGroup:Ra,addIndex:zr,addNote:qr,addNoteConnection:ts,addNoteConnectionWaypoint:is,addNoteToGroup:Qr,addOperation:Mr,addWaypoint:Kr,clearNoteConnectionWaypoints:ls,clearWaypoints:Wr,composite:Fe,moveEntity:$n,moveGroup:Rr,moveNote:eo,moveNoteConnectionWaypoint:os,moveWaypoint:Fr,removeAssociation:Pr,removeAttribute:xn,removeEntity:kr,removeEntityFromGroup:jo,removeGroup:Sr,removeIndex:Hr,removeNote:Xr,removeNoteConnection:ns,removeNoteConnectionWaypoint:as,removeNoteFromGroup:es,removeOperation:Dr,removeWaypoint:Gr,renameEntity:Er,reorderAttributes:Va,reorderOperations:Or,resizeEntity:vr,resizeGroup:Vr,resizeNote:jr,setAllEntitiesCollapsed:Ca,setAttributeSwatch:Xo,setEntityCollapsed:$r,setEntityLocked:xr,setEntitySwatch:Nr,setGroupLocked:Tr,setGroupSwatch:Ar,setNoteMemo:Zr,setNoteSwatch:Jr,setOperationSwatch:Lr,translateWaypoints:Yr,updateAssociation:Zo,updateAssociationEnd:In,updateAttribute:en,updateEntity:wr,updateGroup:Ir,updateIndex:Ur,updateOperation:Br},Symbol.toStringTag,{value:"Module"}));class rs{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 ss{constructor(t){We(this,"cache",new rs);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 cs=["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"],ds=()=>crypto.randomUUID(),im=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,am=e=>e&&e[0].toLowerCase()+e.slice(1),lm=e=>e&&e[0].toUpperCase()+e.slice(1),rm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function sm(e,t){return am(e)+lm(t)}function cm(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=sm(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:rm(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Qo=(e,t)=>`${e}::${t}`,ei=e=>e??void 0;function dm(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||ei(s.length)!==ei(l.length)||ei(s.scale)!==ei(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 um(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=ds){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=>cm(e,f)),s=new Map(r.map(f=>[Qo(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Qo(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=Qo(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=Qo(f.associationRef,f.sourceAttributeRef),m=d.get(h);if(!m)i.add.push(um(f,u++,o));else{const p=dm(m,f,o);p&&i.update.push({attributeId:m.modelId,patch:p})}}return i}function fm(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 mm(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function pm(e,t,o=ds){const i=new Map,a=mm(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(im(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(h=>h.modelId===d);f&&fm(f,u),l.has(d)||r.push(d)}}return i}function ti(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 hm(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 ym(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 us(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=hm(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 gm(e,t){const o=ym(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function bm(e,t){const o=()=>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 fs(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 _m(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function km(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function wm(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 Em(e,t){const o=km(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function ms(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 ps(e,t,o,i,a,l,r,s){const c=s(),d=new Map((e.embeddableOverrides??[]).map(h=>[h.field,h])),u=[];let f=!1;for(const h of t.fields){const m=d.get(h.name);if(m!=null&&m.sharedColumnPhysicalName){const p={ref:m.sharedColumnPhysicalName,by:"physicalName"},y=fs(i,p);if(!y.ok){r.push(y.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:a,entity:l,handle:p}:{code:"shared-column-target-ambiguous",opIndex:a,entity:l,handle:p,matches:y.matches}),f=!0;continue}u.push({modelId:s(),physicalName:"",dataType:"",sharedColumnRef:y.value.modelId});continue}u.push({modelId:s(),physicalName:(m==null?void 0:m.physicalName)??"",dataType:"",...m!=null&&m.length?{length:m.length}:{},...m!=null&&m.scale?{scale:m.scale}:{},...(m==null?void 0:m.insertable)!=null?{insertable:m.insertable}:{},...(m==null?void 0:m.updatable)!=null?{updatable:m.updatable}:{}})}return f?null:{modelId:c,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:u}}function hs(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 ys(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=fs(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 vm(e,t,o={}){const i=o.mkId??Oe,a=o.embeddableCatalog??[],l=f=>a.find(h=>h.type===f),r=[],s=[],c=new Map,d=new Map,u=new Set;for(const f of t)f.kind==="entity.add"&&(u.add(f.spec.name),f.spec.physicalName&&u.add(f.spec.physicalName));return t.forEach((f,h)=>{var m,p,y;switch(f.kind){case"entity.add":{const b=i(),_={modelId:b,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},A={ref:f.spec.name};let g=!1;for(const[S,O]of(f.spec.attributes??[]).entries()){if(O.type==="GroupCodeEnum"&&!O.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:A,handle:{ref:O.name}}),g=!0;continue}const z=l(O.type);if(z){const F=ps(O,z,S,_,h,A,s,i);F?_.attributes.push(F):g=!0}else(m=O.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:h,entity:A,handle:{ref:O.name}}),g=!0):_.attributes.push(ms(O,S,i))}const N=(f.spec.operations??[]).map((S,O)=>hs(S,O,i));N.length&&(_.operations=N);const te=[];for(const S of f.spec.indexes??[]){const O=ys(_,S,h,A,s,i);O?te.push(O):g=!0}if(te.length&&(_.indexes=te),g)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:_});break}case"entity.update":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:f.patch});break}case"entity.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}const _=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,_+1);const A=l(f.spec.type);let g;if(A)g=ps(f.spec,A,_,b.value,h,f.entity,s,i);else if((p=f.spec.embeddableOverrides)!=null&&p.length){s.push({code:"embeddable-type-unresolved",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}else g=ms(f.spec,_,i);if(!g)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:g});break}case"attribute.update":case"attribute.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=gm(b.value,f.attribute);if(!_.ok){s.push(_.reason==="not-found"?{code:"attribute-not-found",opIndex:h,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:h,entity:f.entity,handle:f.attribute,matches:_.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:_.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:_.value.modelId});break}case"association.add":{const b=at(e,f.spec.from),_=at(e,f.spec.to);if(b.ok||s.push(lt(b.reason,h,f.spec.from,b.matches,u)),_.ok||s.push(lt(_.reason,h,f.spec.to,_.matches,u)),!b.ok||!_.ok)break;if(f.spec.identifying&&b.value.modelId===_.value.modelId){s.push({code:"self-identifying",opIndex:h,handle:{from:f.spec.from,to:f.spec.to}});break}const A=i(),g={modelId:A,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:_.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},N={...e,associations:[...e.associations,g]},te=to(N,_.value.modelId,i);te.add[0]&&(g.end2.attributeRef=te.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:A,value:g});for(const S of te.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:S});break}case"association.remove":{const b=at(e,f.association.from),_=at(e,f.association.to);if(b.ok||s.push(lt(b.reason,h,f.association.from,b.matches,u)),_.ok||s.push(lt(_.reason,h,f.association.to,_.matches,u)),!b.ok||!_.ok)break;const A=us(e,b.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(g=>g.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:A[0].modelId});break}case"association.update":{const b=gs(e,f.association,h,s,u);if(!b)break;r.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:f.patch});break}case"associationEnd.update":{const b=gs(e,f.association,h,s,u);if(!b)break;const _=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:_,patch:f.patch});break}case"index.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=ys(b.value,f.spec,h,f.entity,s,i);if(!_)break;r.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.modelId,value:_});break}case"index.update":case"index.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=wm(b.value,f.index);if(!_.ok){s.push(_.reason==="not-found"?{code:"index-not-found",opIndex:h,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:h,entity:f.entity,handle:f.index,matches:_.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:h,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.value.modelId});break}case"operation.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=d.get(b.value.modelId)??((y=b.value.operations)==null?void 0:y.length)??0;d.set(b.value.modelId,_+1);const A=hs(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:A.modelId,value:A});break}case"operation.update":case"operation.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=Em(b.value,f.operation);if(!_.ok){s.push(_.reason==="not-found"?{code:"operation-not-found",opIndex:h,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:h,entity:f.entity,handle:f.operation,matches:_.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:_.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:_.value.modelId});break}case"group.add":{const b=[];let _=!1;for(const N of f.spec.members){const te=at(e,N);if(!te.ok){s.push(lt(te.reason,h,N,te.matches,u)),_=!0;continue}b.push(te.value.modelId)}if(_)break;const A=i(),g={modelId:A,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};r.push({kind:"group.add",casUnit:"logical",groupRef:A,value:g});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 gs(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=us(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 bs={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Nm={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},$m={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},ni={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},xm={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:{...ni,description:"속성 설명(다국어)."},columnLogicalName:{...ni,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},_s={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Im={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{..._s,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{..._s,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},Sm={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...bs,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},Cm={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...ni,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Rm={type:"object",properties:{name:{...ni,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},Vm={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function tt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Am={"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"]})},ks={anyOf:cs.map(e=>Am[e])},Tm={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:bs,assocHandle:Nm,entitySpec:$m,attrSpec:xm,assocSpec:Im,indexSpec:Sm,operationSpec:Cm,groupSpec:Rm,patch:Vm,symbolicOp:ks}};function Mm(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 ws={location:{x:0,y:0},size:{width:220,height:140}};function Es(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 Bm=/^[-=_*~\s]{3,}$/;function Dm(e){return e.attrType&&e.attrType!=="NORMAL"||!Bm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Om(e,t){return e.attrType==="DIVIDER"||Dm(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{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??t,dbAttrs:e.dbAttrs.map(Es)}}function Lm(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 Pm(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 zm(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(Om),operations:(t=e.operations)==null?void 0:t.map(Lm),indexes:(o=e.indexes)==null?void 0:o.map(Pm),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Um(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??{...ws},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 vs(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 Ta(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:vs(e)}}function Hm(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Ta(e.end1),end2:Ta(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 Ns(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function $s(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function xs(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 Is(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(Es)}}function Fm(e,t,o){var b,_;const i=Ns(e.end1.attribute),a=Ns(e.end2.attribute);if(i===a)return Hm(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(_=(b=s.dbAttrs)==null?void 0:b[0])==null?void 0:_.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((A,g)=>Math.max(A,g.order),-1)+1:s.order??0,h={...Is(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const m=(A,g)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:g?d:h.modelId,legacyNavRaw:g?void 0:A.attribute,jpa:vs(A)}),p={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},y={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p.end1.attributeRef,targetColumnRef:p.end2.attributeRef,style:e.style};return{assoc:p,layout:y}}function Gm(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 Ym(e,t,o){var p;const i=((p=e.end1.attribute)==null?void 0:p.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,l=i?e.end2:e.end1,r=a.attribute,s=t.get(l.endModel.refId),c=s?s.attributes.reduce((y,b)=>Math.max(y,b.order),-1)+1:r.order??0,d={...Is(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(y=>Gm(y,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=y=>({...Ta(y),legacyEmbedRaw:y.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:f,layout:m}}function Wm(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 Ss(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=Wm(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 Cs(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 Rs(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Km(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Rs);if(!i.length)continue;const a=o.filter(s=>!Rs(s));let l=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(l=c+1)}),[...a.slice(0,l),...i,...a.slice(l)].forEach((s,c)=>s.order=c)}}function qm(e){return(e.schemaVersion??1)>=2&&"logical"in e?Xm(e):jm(e)}function Xm(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:h,...m}=f;return h!=null&&(o[f.modelId]=h),m},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout;Cs(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 jm(e){var _,A;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(g,N)=>{o.push(zm(g));const te=Um(g);te.geo={location:{x:te.geo.location.x+N.x,y:te.geo.location.y+N.y},size:te.geo.size},i.push(te);for(const S of g.ownedAssociations??[])c.push(S)},u={x:0,y:0};for(const g of e.entities??[])d(g,u);const f=[];for(const g of e.groups??[]){const N=g.entities??[];r.push({modelId:g.modelId,name:g.name,description:g.description,packageName:g.packageName,excludeDDLGeneration:g.excludeDDLGeneration??!1,memberEntityRefs:N.map(S=>S.modelId)});const te=((_=g.geo)==null?void 0:_.location)??u;if(g.geo){const S=(g.notes??[]).map(O=>O.modelId);s.push({groupRef:g.modelId,geo:g.geo,style:g.style,locked:g.locked,memberNoteRefs:S.length?S:void 0})}for(const S of N)d(S,te);for(const S of g.notes??[])f.push(Ss(S,te))}const h=new Map(o.map(g=>[g.modelId,g])),m=new Map,p=new Map;for(const g of o)for(const N of g.attributes)for(const te of N.dbAttrs)m.set(te.modelId,N.modelId),p.set(te.modelId,te);for(const g of c)for(const N of[g.end1,g.end2]){const te=N.attribute;if(te&&(((A=te.dbAttrs)==null?void 0:A.length)??0)>0)for(const S of te.dbAttrs)S.modelId&&m.set(S.modelId,te.modelId)}for(const g of c){const N=$s(g.end1.attribute),te=$s(g.end2.attribute),S=xs(g.end1)||xs(g.end2),{assoc:O,layout:z}=N!==te||S?Ym(g,h,p):Fm(g,h,m);a.push(O),l.push(z)}Cs(o,a,l),Km(o);const y={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(g=>Ss(g)),...f]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:y,meta:b}}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}}function Zm(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(Vs),style:t}}function Jm(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 Qm(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function Ft(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function ep(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{...Vs(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function tp(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 np(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 op(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function ip(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:op(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 ap(e,t,o){let i;for(const f of t.logical.entities){const h=f.attributes.find(m=>{var p;return((p=m.embedded)==null?void 0:p.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,l=t.logical.entities.find(f=>f.modelId===a);if(!l)return;const r=l.attributes.flatMap(f=>f.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((f,h)=>ip(f,r[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Ft(e.end1,c?s:u),end2:Ft(e.end2,c?u:s)}}function lp(e,t,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:Ft(e.end1,e.end1.legacyEmbedRaw),end2:Ft(e.end2,e.end2.legacyEmbedRaw)};const a=ap(e,t,i);if(a)return a;const l=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(l!==r){const s=l?e.end1:e.end2,c=l?e.end2:e.end1,d=t.logical.entities.find(p=>p.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(p=>p.modelId===s.attributeRef),f=t.logical.entities.find(p=>p.modelId===c.entityRef),h=u?ep(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ft(e.end1,l?m:h),end2:Ft(e.end2,r?m:h)}}return{...i,end1:Ft(e.end1),end2:Ft(e.end2)}}function As(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(h=>h.entityRef===e.modelId),r=t.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>t.layout.associationLayouts.find(m=>m.associationRef===h),c=(l==null?void 0:l.geo)??{...ws},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var m;return Zm(h,(m=l==null?void 0:l.attributeStyles)==null?void 0:m[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var m;return Jm(h,(m=l==null?void 0:l.operationStyles)==null?void 0:m[h.modelId])}),ownedAssociations:r.map(h=>lp(h,t,s(h.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(Qm),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 rp(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=>Ts(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>As(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 Ts(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 sp(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=tp(e),l=np(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=>As(s,e,a,l)),groups:e.logical.groups.map(s=>rp(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>Ts(s))}}function cp(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 Vt(e){return typeof e=="function"?e():n.unref(e)}const dp=typeof window<"u"&&typeof document<"u",up=e=>typeof e<"u",fp=Object.prototype.toString,mp=e=>fp.call(e)==="[object Object]",pp=()=>{};function hp(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 Ms=e=>e();function yp(e=Ms){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 Bs(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function gp(e,t,o={}){const{eventFilter:i=Ms,...a}=o;return n.watch(e,hp(i,t),a)}function Sn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=yp(i);return{stop:gp(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function bp(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=Vt(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 Ma(e,t=!1){function o(f,{flush:h="sync",deep:m=!1,timeout:p,throwOnTimeout:y}={}){let b=null;const A=[new Promise(g=>{b=n.watch(e,N=>{f(N)!==t&&(b==null||b(),g(N))},{flush:h,deep:m,immediate:!0})})];return p!=null&&A.push(Bs(p,y).then(()=>Vt(e)).finally(()=>b==null?void 0:b())),Promise.race(A)}function i(f,h){if(!n.isRef(f))return o(N=>N===f,h);const{flush:m="sync",deep:p=!1,timeout:y,throwOnTimeout:b}=h??{};let _=null;const g=[new Promise(N=>{_=n.watch([e,f],([te,S])=>{t!==(te===S)&&(_==null||_(),N(te))},{flush:m,deep:p,immediate:!0})})];return y!=null&&g.push(Bs(y,b).then(()=>Vt(e)).finally(()=>(_==null||_(),Vt(e)))),Promise.race(g)}function a(f){return o(h=>!!h,f)}function l(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,h){return o(m=>{const p=Array.from(m);return p.includes(f)||p.includes(Vt(f))},h)}function d(f){return u(1,f)}function u(f=1,h){let m=-1;return o(()=>(m+=1,m>=f),h)}return Array.isArray(Vt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Ma(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Ma(e,!t)}}}function Ba(e){return Ma(e)}function _p(e){var t;const o=Vt(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Ds=dp?window:void 0;function Os(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Ds):[t,o,i,a]=e,!t)return pp;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,h,m)=>(u.addEventListener(f,h,m),()=>u.removeEventListener(f,h,m)),c=n.watch(()=>[_p(t),Vt(a)],([u,f])=>{if(r(),!u)return;const h=mp(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(p=>s(u,m,p,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return no(d),d}function kp(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Ls(...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=Ds,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=kp(t);return Os(a,l,u=>{u.repeat&&Vt(s)||c(u)&&o(u)},r)}function wp(e){return JSON.parse(JSON.stringify(e))}function Da(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:h}=i,m=n.getCurrentInstance(),p=o||(m==null?void 0:m.emit)||((a=m==null?void 0:m.$emit)==null?void 0:a.bind(m))||((r=(l=m==null?void 0:m.proxy)==null?void 0:l.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let y=d;t||(t="modelValue"),y=y||`update:${t.toString()}`;const b=g=>s?typeof s=="function"?s(g):wp(g):g,_=()=>up(e[t])?b(e[t]):f,A=g=>{h?h(g)&&p(y,g):p(y,g)};if(c){const g=_(),N=n.ref(g);let te=!1;return n.watch(()=>e[t],S=>{te||(te=!0,N.value=b(S),n.nextTick(()=>te=!1))}),n.watch(N,S=>{!te&&(S!==e[t]||u)&&A(S)},{deep:u}),N}else return n.computed({get(){return _()},set(g){A(g)}})}var Ep={value:()=>{}};function oi(){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 ii(o)}function ii(e){this._=e}function vp(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}})}ii.prototype=oi.prototype={constructor:ii,on:function(e,t){var o=this._,i=vp(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Np(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]=Ps(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Ps(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 ii(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 Np(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Ps(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Ep,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Oa="http://www.w3.org/1999/xhtml";const zs={svg:"http://www.w3.org/2000/svg",xhtml:Oa,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ai(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),zs.hasOwnProperty(t)?{space:zs[t],local:e}:e}function $p(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Oa&&t.documentElement.namespaceURI===Oa?t.createElement(e):t.createElementNS(o,e)}}function xp(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Us(e){var t=ai(e);return(t.local?xp:$p)(t)}function Ip(){}function La(e){return e==null?Ip:function(){return this.querySelector(e)}}function Sp(e){typeof e!="function"&&(e=La(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 Cp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Rp(){return[]}function Hs(e){return e==null?Rp:function(){return this.querySelectorAll(e)}}function Vp(e){return function(){return Cp(e.apply(this,arguments))}}function Ap(e){typeof e=="function"?e=Vp(e):e=Hs(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 Fs(e){return function(){return this.matches(e)}}function Gs(e){return function(t){return t.matches(e)}}var Tp=Array.prototype.find;function Mp(e){return function(){return Tp.call(this.children,e)}}function Bp(){return this.firstElementChild}function Dp(e){return this.select(e==null?Bp:Mp(typeof e=="function"?e:Gs(e)))}var Op=Array.prototype.filter;function Lp(){return Array.from(this.children)}function Pp(e){return function(){return Op.call(this.children,e)}}function zp(e){return this.selectAll(e==null?Lp:Pp(typeof e=="function"?e:Gs(e)))}function Up(e){typeof e!="function"&&(e=Fs(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 Ys(e){return new Array(e.length)}function Hp(){return new ut(this._enter||this._groups.map(Ys),this._parents)}function li(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}li.prototype={constructor:li,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 Fp(e){return function(){return e}}function Gp(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 li(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Yp(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(h[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new li(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function Wp(e){return e.__data__}function Kp(e,t){if(!arguments.length)return Array.from(this,Wp);var o=t?Yp:Gp,i=this._parents,a=this._groups;typeof e!="function"&&(e=Fp(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],h=f.length,m=qp(e.call(u,u&&u.__data__,d,i)),p=m.length,y=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,y,b,_,m,t);for(var A=0,g=0,N,te;A<p;++A)if(N=y[A]){for(A>=g&&(g=A+1);!(te=b[g])&&++g<p;);N._next=te||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function qp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xp(){return new ut(this._exit||this._groups.map(Ys),this._parents)}function jp(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 Zp(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,h=s[c]=new Array(f),m,p=0;p<f;++p)(m=d[p]||u[p])&&(h[p]=m);for(;c<a;++c)s[c]=o[c];return new ut(s,this._parents)}function Jp(){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 Qp(e){e||(e=eh);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 eh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function th(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function nh(){return Array.from(this)}function oh(){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 ih(){let e=0;for(const t of this)++e;return e}function ah(){return!this.node()}function lh(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 rh(e){return function(){this.removeAttribute(e)}}function sh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ch(e,t){return function(){this.setAttribute(e,t)}}function dh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function uh(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function fh(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 mh(e,t){var o=ai(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?sh:rh:typeof t=="function"?o.local?fh:uh:o.local?dh:ch)(o,t))}function Ws(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ph(e){return function(){this.style.removeProperty(e)}}function hh(e,t,o){return function(){this.style.setProperty(e,t,o)}}function yh(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function gh(e,t,o){return arguments.length>1?this.each((t==null?ph:typeof t=="function"?yh:hh)(e,t,o??"")):Cn(this.node(),e)}function Cn(e,t){return e.style.getPropertyValue(t)||Ws(e).getComputedStyle(e,null).getPropertyValue(t)}function bh(e){return function(){delete this[e]}}function _h(e,t){return function(){this[e]=t}}function kh(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function wh(e,t){return arguments.length>1?this.each((t==null?bh:typeof t=="function"?kh:_h)(e,t)):this.node()[e]}function Ks(e){return e.trim().split(/^|\s+/)}function Pa(e){return e.classList||new qs(e)}function qs(e){this._node=e,this._names=Ks(e.getAttribute("class")||"")}qs.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 Xs(e,t){for(var o=Pa(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function js(e,t){for(var o=Pa(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Eh(e){return function(){Xs(this,e)}}function vh(e){return function(){js(this,e)}}function Nh(e,t){return function(){(t.apply(this,arguments)?Xs:js)(this,e)}}function $h(e,t){var o=Ks(e+"");if(arguments.length<2){for(var i=Pa(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Nh:t?Eh:vh)(o,t))}function xh(){this.textContent=""}function Ih(e){return function(){this.textContent=e}}function Sh(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ch(e){return arguments.length?this.each(e==null?xh:(typeof e=="function"?Sh:Ih)(e)):this.node().textContent}function Rh(){this.innerHTML=""}function Vh(e){return function(){this.innerHTML=e}}function Ah(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Th(e){return arguments.length?this.each(e==null?Rh:(typeof e=="function"?Ah:Vh)(e)):this.node().innerHTML}function Mh(){this.nextSibling&&this.parentNode.appendChild(this)}function Bh(){return this.each(Mh)}function Dh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Oh(){return this.each(Dh)}function Lh(e){var t=typeof e=="function"?e:Us(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ph(){return null}function zh(e,t){var o=typeof e=="function"?e:Us(e),i=t==null?Ph:typeof t=="function"?t:La(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Uh(){var e=this.parentNode;e&&e.removeChild(this)}function Hh(){return this.each(Uh)}function Fh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Gh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Yh(e){return this.select(e?Gh:Fh)}function Wh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Kh(e){return function(t){e.call(this,t,this.__data__)}}function qh(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 Xh(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 jh(e,t,o){return function(){var i=this.__on,a,l=Kh(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 Zh(e,t,o){var i=qh(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?jh:Xh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Zs(e,t,o){var i=Ws(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 Jh(e,t){return function(){return Zs(this,e,t)}}function Qh(e,t){return function(){return Zs(this,e,t.apply(this,arguments))}}function ey(e,t){return this.each((typeof t=="function"?Qh:Jh)(e,t))}function*ty(){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 Js=[null];function ut(e,t){this._groups=e,this._parents=t}function oo(){return new ut([[document.documentElement]],Js)}function ny(){return this}ut.prototype=oo.prototype={constructor:ut,select:Sp,selectAll:Ap,selectChild:Dp,selectChildren:zp,filter:Up,data:Kp,enter:Hp,exit:Xp,join:jp,merge:Zp,selection:ny,order:Jp,sort:Qp,call:th,nodes:nh,node:oh,size:ih,empty:ah,each:lh,attr:mh,style:gh,property:wh,classed:$h,text:Ch,html:Th,raise:Bh,lower:Oh,append:Lh,insert:zh,remove:Hh,clone:Yh,datum:Wh,on:Zh,dispatch:ey,[Symbol.iterator]:ty};function ht(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],Js)}function oy(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Et(e,t){if(e=oy(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 iy={passive:!1},io={capture:!0,passive:!1};function za(e){e.stopImmediatePropagation()}function Rn(e){e.preventDefault(),e.stopImmediatePropagation()}function Qs(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 ec(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 ri=e=>()=>e;function Ua(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}})}Ua.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ay(e){return!e.ctrlKey&&!e.button}function ly(){return this.parentNode}function ry(e,t){return t??{x:e.x,y:e.y}}function sy(){return navigator.maxTouchPoints||"ontouchstart"in this}function cy(){var e=ay,t=ly,o=ry,i=sy,a={},l=oi("start","drag","end"),r=0,s,c,d,u,f=0;function h(N){N.on("mousedown.drag",m).filter(i).on("touchstart.drag",b).on("touchmove.drag",_,iy).on("touchend.drag touchcancel.drag",A).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(N,te){if(!(u||!e.call(this,N,te))){var S=g(this,t.call(this,N,te),N,te,"mouse");S&&(ht(N.view).on("mousemove.drag",p,io).on("mouseup.drag",y,io),Qs(N.view),za(N),d=!1,s=N.clientX,c=N.clientY,S("start",N))}}function p(N){if(Rn(N),!d){var te=N.clientX-s,S=N.clientY-c;d=te*te+S*S>f}a.mouse("drag",N)}function y(N){ht(N.view).on("mousemove.drag mouseup.drag",null),ec(N.view,d),Rn(N),a.mouse("end",N)}function b(N,te){if(e.call(this,N,te)){var S=N.changedTouches,O=t.call(this,N,te),z=S.length,F,ne;for(F=0;F<z;++F)(ne=g(this,O,N,te,S[F].identifier,S[F]))&&(za(N),ne("start",N,S[F]))}}function _(N){var te=N.changedTouches,S=te.length,O,z;for(O=0;O<S;++O)(z=a[te[O].identifier])&&(Rn(N),z("drag",N,te[O]))}function A(N){var te=N.changedTouches,S=te.length,O,z;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),O=0;O<S;++O)(z=a[te[O].identifier])&&(za(N),z("end",N,te[O]))}function g(N,te,S,O,z,F){var ne=l.copy(),re=Et(F||S,te),L,oe,k;if((k=o.call(N,new Ua("beforestart",{sourceEvent:S,target:h,identifier:z,active:r,x:re[0],y:re[1],dx:0,dy:0,dispatch:ne}),O))!=null)return L=k.x-re[0]||0,oe=k.y-re[1]||0,function W(R,G,H){var ae=re,v;switch(R){case"start":a[z]=W,v=r++;break;case"end":delete a[z],--r;case"drag":re=Et(H||G,te),v=r;break}ne.call(R,N,new Ua(R,{sourceEvent:G,subject:k,target:h,identifier:z,active:v,x:re[0]+L,y:re[1]+oe,dx:re[0]-ae[0],dy:re[1]-ae[1],dispatch:ne}),O)}}return h.filter=function(N){return arguments.length?(e=typeof N=="function"?N:ri(!!N),h):e},h.container=function(N){return arguments.length?(t=typeof N=="function"?N:ri(N),h):t},h.subject=function(N){return arguments.length?(o=typeof N=="function"?N:ri(N),h):o},h.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:ri(!!N),h):i},h.on=function(){var N=l.on.apply(l,arguments);return N===l?h:N},h.clickDistance=function(N){return arguments.length?(f=(N=+N)*N,h):Math.sqrt(f)},h}function Ha(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function tc(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function ao(){}var lo=.7,si=1/lo,Vn="\\s*([+-]?\\d+)\\s*",ro="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",dy=/^#([0-9a-f]{3,8})$/,uy=new RegExp(`^rgb\\(${Vn},${Vn},${Vn}\\)$`),fy=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),my=new RegExp(`^rgba\\(${Vn},${Vn},${Vn},${ro}\\)$`),py=new RegExp(`^rgba\\(${vt},${vt},${vt},${ro}\\)$`),hy=new RegExp(`^hsl\\(${ro},${vt},${vt}\\)$`),yy=new RegExp(`^hsla\\(${ro},${vt},${vt},${ro}\\)$`),nc={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};Ha(ao,tn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:oc,formatHex:oc,formatHex8:gy,formatHsl:by,formatRgb:ic,toString:ic});function oc(){return this.rgb().formatHex()}function gy(){return this.rgb().formatHex8()}function by(){return cc(this).formatHsl()}function ic(){return this.rgb().formatRgb()}function tn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=dy.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?ac(t):o===3?new st(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?ci(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ci(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=uy.exec(e))?new st(t[1],t[2],t[3],1):(t=fy.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=my.exec(e))?ci(t[1],t[2],t[3],t[4]):(t=py.exec(e))?ci(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hy.exec(e))?sc(t[1],t[2]/100,t[3]/100,1):(t=yy.exec(e))?sc(t[1],t[2]/100,t[3]/100,t[4]):nc.hasOwnProperty(e)?ac(nc[e]):e==="transparent"?new st(NaN,NaN,NaN,0):null}function ac(e){return new st(e>>16&255,e>>8&255,e&255,1)}function ci(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function _y(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 Fa(e,t,o,i){return arguments.length===1?_y(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}Ha(st,Fa,tc(ao,{brighter(e){return e=e==null?si:Math.pow(si,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),di(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:lc,formatHex:lc,formatHex8:ky,formatRgb:rc,toString:rc}));function lc(){return`#${on(this.r)}${on(this.g)}${on(this.b)}`}function ky(){return`#${on(this.r)}${on(this.g)}${on(this.b)}${on((isNaN(this.opacity)?1:this.opacity)*255)}`}function rc(){const e=di(this.opacity);return`${e===1?"rgb(":"rgba("}${nn(this.r)}, ${nn(this.g)}, ${nn(this.b)}${e===1?")":`, ${e})`}`}function di(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 sc(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 cc(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 wy(e,t,o,i){return arguments.length===1?cc(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}Ha(yt,wy,tc(ao,{brighter(e){return e=e==null?si:Math.pow(si,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(Ga(e>=240?e-240:e+120,a,i),Ga(e,a,i),Ga(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new yt(dc(this.h),ui(this.s),ui(this.l),di(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=di(this.opacity);return`${e===1?"hsl(":"hsla("}${dc(this.h)}, ${ui(this.s)*100}%, ${ui(this.l)*100}%${e===1?")":`, ${e})`}`}}));function dc(e){return e=(e||0)%360,e<0?e+360:e}function ui(e){return Math.max(0,Math.min(1,e||0))}function Ga(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 Ya=e=>()=>e;function Ey(e,t){return function(o){return e+o*t}}function vy(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 Ny(e){return(e=+e)==1?uc:function(t,o){return o-t?vy(t,o,e):Ya(isNaN(t)?o:t)}}function uc(e,t){var o=t-e;return o?Ey(e,o):Ya(isNaN(e)?t:e)}const fi=(function e(t){var o=Ny(t);function i(a,l){var r=o((a=Fa(a)).r,(l=Fa(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=uc(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 $y(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 xy(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Iy(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 Sy(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 Cy(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 Wa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ka=new RegExp(Wa.source,"g");function Ry(e){return function(){return e}}function Vy(e){return function(t){return e(t)+""}}function fc(e,t){var o=Wa.lastIndex=Ka.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Wa.exec(e))&&(a=Ka.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=Ka.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Vy(c[0].x):Ry(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"?Ya(t):(o==="number"?Nt:o==="string"?(i=tn(t))?(t=i,fi):fc:t instanceof tn?fi:t instanceof Date?Sy:xy(t)?$y:Array.isArray(t)?Iy:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Cy:Nt)(e,t)}var mc=180/Math.PI,qa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pc(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)*mc,skewX:Math.atan(c)*mc,scaleX:r,scaleY:s}}var mi;function Ay(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?qa:pc(t.a,t.b,t.c,t.d,t.e,t.f)}function Ty(e){return e==null||(mi||(mi=document.createElementNS("http://www.w3.org/2000/svg","g")),mi.setAttribute("transform",e),!(e=mi.transform.baseVal.consolidate()))?qa:(e=e.matrix,pc(e.a,e.b,e.c,e.d,e.e,e.f))}function hc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push("translate(",null,t,null,o);p.push({i:y-4,x:Nt(d,f)},{i:y-2,x:Nt(u,h)})}else(f||h)&&m.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:Nt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:Nt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push(a(m)+"scale(",null,",",null,")");p.push({i:y-4,x:Nt(d,f)},{i:y-2,x:Nt(u,h)})}else(f!==1||h!==1)&&m.push(a(m)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(m){for(var p=-1,y=h.length,b;++p<y;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var My=hc(Ay,"px, ","px)","deg)"),By=hc(Ty,", ",")",")"),Dy=1e-12;function yc(e){return((e=Math.exp(e))+1/e)/2}function Oy(e){return((e=Math.exp(e))-1/e)/2}function Ly(e){return((e=Math.exp(2*e))-1)/(e+1)}const pi=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],h=r[2],m=u-s,p=f-c,y=m*m+p*p,b,_;if(y<Dy)_=Math.log(h/d)/t,b=function(O){return[s+O*m,c+O*p,d*Math.exp(t*O*_)]};else{var A=Math.sqrt(y),g=(h*h-d*d+i*y)/(2*d*o*A),N=(h*h-d*d-i*y)/(2*h*o*A),te=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(N*N+1)-N);_=(S-te)/t,b=function(O){var z=O*_,F=yc(te),ne=d/(o*A)*(F*Ly(t*z+te)-Oy(te));return[s+ne*m,c+ne*p,d*F/yc(t*z+te)]}}return b.duration=_*1e3*t/Math.SQRT2,b}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var An=0,co=0,uo=0,gc=1e3,hi,fo,yi=0,an=0,gi=0,mo=typeof performance=="object"&&performance.now?performance:Date,bc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xa(){return an||(bc(Py),an=mo.now()+gi)}function Py(){an=0}function bi(){this._call=this._time=this._next=null}bi.prototype=_c.prototype={constructor:bi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Xa():+o)+(t==null?0:+t),!this._next&&fo!==this&&(fo?fo._next=this:hi=this,fo=this),this._call=e,this._time=o,ja()},stop:function(){this._call&&(this._call=null,this._time=1/0,ja())}};function _c(e,t,o){var i=new bi;return i.restart(e,t,o),i}function zy(){Xa(),++An;for(var e=hi,t;e;)(t=an-e._time)>=0&&e._call.call(void 0,t),e=e._next;--An}function kc(){an=(yi=mo.now())+gi,An=co=0;try{zy()}finally{An=0,Hy(),an=0}}function Uy(){var e=mo.now(),t=e-yi;t>gc&&(gi-=t,yi=e)}function Hy(){for(var e,t=hi,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:hi=o);fo=e,ja(i)}function ja(e){if(!An){co&&(co=clearTimeout(co));var t=e-an;t>24?(e<1/0&&(co=setTimeout(kc,e-mo.now()-gi)),uo&&(uo=clearInterval(uo))):(uo||(yi=mo.now(),uo=setInterval(Uy,gc)),An=1,bc(kc))}}function wc(e,t,o){var i=new bi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Fy=oi("start","end","cancel","interrupt"),Gy=[],Ec=0,vc=1,Za=2,_i=3,Nc=4,Ja=5,ki=6;function wi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Yy(e,o,{name:t,index:i,group:a,on:Fy,tween:Gy,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Ec})}function Qa(e,t){var o=gt(e,t);if(o.state>Ec)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 Yy(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=_c(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,m;if(o.state!==vc)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===_i)return wc(r);m.state===Nc?(m.state=ki,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=ki,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(wc(function(){o.state===_i&&(o.state=Nc,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Za,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Za){for(o.state=_i,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Ja,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Ja&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ki,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ei(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>Za&&i.state<Ja,i.state=ki,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function Wy(e){return this.each(function(){Ei(this,e)})}function Ky(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 qy(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 Xy(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?Ky:qy)(o,e,t))}function el(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 $c(e,t){var o;return(typeof t=="number"?Nt:t instanceof tn?fi:(o=tn(t))?(t=o,fi):fc)(e,t)}function jy(e){return function(){this.removeAttribute(e)}}function Zy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Jy(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 Qy(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 eg(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 tg(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 ng(e,t){var o=ai(e),i=o==="transform"?By:$c;return this.attrTween(e,typeof t=="function"?(o.local?tg:eg)(o,i,el(this,"attr."+e,t)):t==null?(o.local?Zy:jy)(o):(o.local?Qy:Jy)(o,i,t))}function og(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function ig(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function ag(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ig(e,l)),o}return a._value=t,a}function lg(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&og(e,l)),o}return a._value=t,a}function rg(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=ai(e);return this.tween(o,(i.local?ag:lg)(i,t))}function sg(e,t){return function(){Qa(this,e).delay=+t.apply(this,arguments)}}function cg(e,t){return t=+t,function(){Qa(this,e).delay=t}}function dg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?sg:cg)(t,e)):gt(this.node(),t).delay}function ug(e,t){return function(){$t(this,e).duration=+t.apply(this,arguments)}}function fg(e,t){return t=+t,function(){$t(this,e).duration=t}}function mg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ug:fg)(t,e)):gt(this.node(),t).duration}function pg(e,t){if(typeof t!="function")throw new Error;return function(){$t(this,e).ease=t}}function hg(e){var t=this._id;return arguments.length?this.each(pg(t,e)):gt(this.node(),t).ease}function yg(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;$t(this,e).ease=o}}function gg(e){if(typeof e!="function")throw new Error;return this.each(yg(this._id,e))}function bg(e){typeof e!="function"&&(e=Fs(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 At(i,this._parents,this._name,this._id)}function _g(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),h,m=0;m<u;++m)(h=c[m]||d[m])&&(f[m]=h);for(;s<i;++s)r[s]=t[s];return new At(r,this._parents,this._name,this._id)}function kg(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 wg(e,t,o){var i,a,l=kg(t)?Qa:$t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Eg(e,t){var o=this._id;return arguments.length<2?gt(this.node(),o).on.on(e):this.each(wg(o,e,t))}function vg(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Ng(){return this.on("end.remove",vg(this._id))}function $g(e){var t=this._name,o=this._id;typeof e!="function"&&(e=La(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,wi(d[h],t,o,h,d,gt(u,o)));return new At(l,this._parents,t,o)}function xg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Hs(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),m,p=gt(u,o),y=0,b=h.length;y<b;++y)(m=h[y])&&wi(m,t,o,y,h,p);l.push(h),r.push(u)}return new At(l,r,t,o)}var Ig=oo.prototype.constructor;function Sg(){return new Ig(this._groups,this._parents)}function Cg(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 xc(e){return function(){this.style.removeProperty(e)}}function Rg(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 Vg(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 Ag(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=xc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Tg(e,t,o){var i=(e+="")=="transform"?My:$c;return t==null?this.styleTween(e,Cg(e,i)).on("end.style."+e,xc(e)):typeof t=="function"?this.styleTween(e,Vg(e,i,el(this,"style."+e,t))).each(Ag(this._id,e)):this.styleTween(e,Rg(e,i,t),o).on("end.style."+e,null)}function Mg(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Bg(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Mg(e,r,o)),i}return l._value=t,l}function Dg(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,Bg(e,t,o??""))}function Og(e){return function(){this.textContent=e}}function Lg(e){return function(){var t=e(this);this.textContent=t??""}}function Pg(e){return this.tween("text",typeof e=="function"?Lg(el(this,"text",e)):Og(e==null?"":e+""))}function zg(e){return function(t){this.textContent=e.call(this,t)}}function Ug(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 Hg(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,Ug(e))}function Fg(){for(var e=this._name,t=this._id,o=Ic(),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);wi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new At(i,this._parents,e,o)}function Gg(){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 Yg=0;function At(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Ic(){return++Yg}var Tt=oo.prototype;At.prototype={constructor:At,select:$g,selectAll:xg,selectChild:Tt.selectChild,selectChildren:Tt.selectChildren,filter:bg,merge:_g,selection:Sg,transition:Fg,call:Tt.call,nodes:Tt.nodes,node:Tt.node,size:Tt.size,empty:Tt.empty,each:Tt.each,on:Eg,attr:ng,attrTween:rg,style:Tg,styleTween:Dg,text:Pg,textTween:Hg,remove:Ng,tween:Xy,delay:dg,duration:mg,ease:hg,easeVarying:gg,end:Gg,[Symbol.iterator]:Tt[Symbol.iterator]};function Wg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Kg={time:null,delay:0,duration:250,ease:Wg};function qg(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 Xg(e){var t,o;e instanceof At?(t=e._id,e=e._name):(t=Ic(),(o=Kg).time=Xa(),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])&&wi(c,e,t,d,r,o||qg(c,t));return new At(i,this._parents,e,t)}oo.prototype.interrupt=Wy,oo.prototype.transition=Xg;const vi=e=>()=>e;function jg(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 Mt(e,t,o){this.k=e,this.x=t,this.y=o}Mt.prototype={constructor:Mt,scale:function(e){return e===1?this:new Mt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Mt(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 Mt(1,0,0);Mt.prototype;function tl(e){e.stopImmediatePropagation()}function po(e){e.preventDefault(),e.stopImmediatePropagation()}function Zg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Jg(){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 Sc(){return this.__zoom||Tn}function Qg(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function eb(){return navigator.maxTouchPoints||"ontouchstart"in this}function tb(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 nb(){var e=Zg,t=Jg,o=tb,i=Qg,a=eb,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=pi,d=oi("start","zoom","end"),u,f,h,m=500,p=150,y=0,b=10;function _(k){k.property("__zoom",Sc).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",re).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,W,R,G){var H=k.selection?k.selection():k;H.property("__zoom",Sc),k!==H?te(k,W,R,G):H.interrupt().each(function(){S(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 H=this.__zoom.k,ae=typeof W=="function"?W.apply(this,arguments):W;return H*ae},R,G)},_.scaleTo=function(k,W,R,G){_.transform(k,function(){var H=t.apply(this,arguments),ae=this.__zoom,v=R==null?N(H):typeof R=="function"?R.apply(this,arguments):R,q=ae.invert(v),le=typeof W=="function"?W.apply(this,arguments):W;return o(g(A(ae,le),v,q),H,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,H){_.transform(k,function(){var ae=t.apply(this,arguments),v=this.__zoom,q=G==null?N(ae):typeof G=="function"?G.apply(this,arguments):G;return o(Tn.translate(q[0],q[1]).scale(v.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof R=="function"?-R.apply(this,arguments):-R),ae,r)},G,H)};function A(k,W){return W=Math.max(l[0],Math.min(l[1],W)),W===k.k?k:new Mt(W,k.x,k.y)}function g(k,W,R){var G=W[0]-R[0]*k.k,H=W[1]-R[1]*k.k;return G===k.x&&H===k.y?k:new Mt(k.k,G,H)}function N(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(){S(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,ae=arguments,v=S(H,ae).event(G),q=t.apply(H,ae),le=R==null?N(q):typeof R=="function"?R.apply(H,ae):R,me=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),he=H.__zoom,se=typeof W=="function"?W.apply(H,ae):W,ce=c(he.invert(le).concat(me/he.k),se.invert(le).concat(me/se.k));return function(ye){if(ye===1)ye=se;else{var ke=ce(ye),Re=me/ke[2];ye=new Mt(Re,le[0]-ke[0]*Re,le[1]-ke[1]*Re)}v.zoom(null,ye)}})}function S(k,W,R){return!R&&k.__zooming||new O(k,W)}function O(k,W){this.that=k,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,W),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,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 jg(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),W)}};function z(k,...W){if(!e.apply(this,arguments))return;var R=S(this,W).event(k),G=this.__zoom,H=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,i.apply(this,arguments)))),ae=Et(k);if(R.wheel)(R.mouse[0][0]!==ae[0]||R.mouse[0][1]!==ae[1])&&(R.mouse[1]=G.invert(R.mouse[0]=ae)),clearTimeout(R.wheel);else{if(G.k===H)return;R.mouse=[ae,G.invert(ae)],Ei(this),R.start()}po(k),R.wheel=setTimeout(v,p),R.zoom("mouse",o(g(A(G,H),R.mouse[0],R.mouse[1]),R.extent,r));function v(){R.wheel=null,R.end()}}function F(k,...W){if(h||!e.apply(this,arguments))return;var R=k.currentTarget,G=S(this,W,!0).event(k),H=ht(k.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",me,!0),ae=Et(k,R),v=k.clientX,q=k.clientY;Qs(k.view),tl(k),G.mouse=[ae,this.__zoom.invert(ae)],Ei(this),G.start();function le(he){if(po(he),!G.moved){var se=he.clientX-v,ce=he.clientY-q;G.moved=se*se+ce*ce>y}G.event(he).zoom("mouse",o(g(G.that.__zoom,G.mouse[0]=Et(he,R),G.mouse[1]),G.extent,r))}function me(he){H.on("mousemove.zoom mouseup.zoom",null),ec(he.view,G.moved),po(he),G.event(he).end()}}function ne(k,...W){if(e.apply(this,arguments)){var R=this.__zoom,G=Et(k.changedTouches?k.changedTouches[0]:k,this),H=R.invert(G),ae=R.k*(k.shiftKey?.5:2),v=o(g(A(R,ae),G,H),t.apply(this,W),r);po(k),s>0?ht(this).transition().duration(s).call(te,v,G,k):ht(this).call(_.transform,v,G,k)}}function re(k,...W){if(e.apply(this,arguments)){var R=k.touches,G=R.length,H=S(this,W,k.changedTouches.length===G).event(k),ae,v,q,le;for(tl(k),v=0;v<G;++v)q=R[v],le=Et(q,this),le=[le,this.__zoom.invert(le),q.identifier],H.touch0?!H.touch1&&H.touch0[2]!==le[2]&&(H.touch1=le,H.taps=0):(H.touch0=le,ae=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),ae&&(H.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),Ei(this),H.start())}}function L(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v,q,le;for(po(k),ae=0;ae<H;++ae)v=G[ae],q=Et(v,this),R.touch0&&R.touch0[2]===v.identifier?R.touch0[0]=q:R.touch1&&R.touch1[2]===v.identifier&&(R.touch1[0]=q);if(v=R.that.__zoom,R.touch1){var me=R.touch0[0],he=R.touch0[1],se=R.touch1[0],ce=R.touch1[1],ye=(ye=se[0]-me[0])*ye+(ye=se[1]-me[1])*ye,ke=(ke=ce[0]-he[0])*ke+(ke=ce[1]-he[1])*ke;v=A(v,Math.sqrt(ye/ke)),q=[(me[0]+se[0])/2,(me[1]+se[1])/2],le=[(he[0]+ce[0])/2,(he[1]+ce[1])/2]}else if(R.touch0)q=R.touch0[0],le=R.touch0[1];else return;R.zoom("touch",o(g(v,q,le),R.extent,r))}}function oe(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v;for(tl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),ae=0;ae<H;++ae)v=G[ae],R.touch0&&R.touch0[2]===v.identifier?delete R.touch0:R.touch1&&R.touch1[2]===v.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&&(v=Et(v,this),Math.hypot(f[0]-v[0],f[1]-v[1])<b)){var q=ht(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:vi(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:vi(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:vi(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:vi([[+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?(y=(k=+k)*k,_):Math.sqrt(y)},_.tapDistance=function(k){return arguments.length?(b=+k,_):b},_}var Se=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Se||{}),nl=(e=>(e.Partial="partial",e.Full="full",e))(nl||{}),ln=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ln||{}),Bt=(e=>(e.Strict="strict",e.Loose="loose",e))(Bt||{}),ol=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(ol||{}),ho=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ho||{}),Cc=(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))(Cc||{});const ob=["INPUT","SELECT","TEXTAREA"],ib=typeof document<"u"?document:null;function il(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 ob.includes(i==null?void 0:i.nodeName)||a||!!l}function ab(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Rc(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 ab(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=lb(o.code,e);return Array.isArray(e)?e.some(a=>Cc(o[i],a,t,o.type==="keyup")):Cc(o[i],e,t,o.type==="keyup")}}function lb(e,t){return t.includes(e)?"code":"key"}function yo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??ob),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}),Ds(["blur","contextmenu"],s),Os((...d)=>r(...d),d=>{var u,f;const h=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=ib(d),(!a||a&&!h)&&il(d))return;const y=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,b=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";!m&&(a||!b)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Os((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&il(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"?ab(d,l):d}return i}const Rc="vue-flow__node-desc",Vc="vue-flow__edge-desc",rb="vue-flow__aria-live",Ac=["Enter"," ","Escape"],Mn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ni(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function $i(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 xi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function rn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Tc(e,t){return{x:rn(e.x,t[0][0],t[1][0]),y:rn(e.y,t[0][1],t[1][1])}}function Mc(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 Ii(e){return!Number.isNaN(e)&&Number.isFinite(e)}function sb(e){return Ii(e.width)&&Ii(e.height)&&Ii(e.x)&&Ii(e.y)}function cb(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 Bc(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 Dc(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 db(...e){if(e.length===3){const[l,r,s]=e;return Dc(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 ub(...e){if(e.length===3){const[l,r,s]=e;return Dc(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 Oc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function fb(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?Ci(s,r):s}function Lc(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 Si({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function Pc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function mb(e,t){return Pc(Lc(Si(e),Si(t)))}function al(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=Lc(t,Si({...i.computedPosition,...i.dimensions}))}return Pc(t)}function zc(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 m=$i(l,Ni(s)),p=f===null||h===null,y=i&&m>0,b=(f??0)*(h??0);(p||y||m>=b||s.dragging)&&r.push(s)}return r}function cn(e,t){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return t.filter(i=>o.has(i.source)||o.has(i.target))}function 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 pb(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 hb(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 Uc(e,t,o,i,a,l=.1){const r=pb(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=rn(d,i,a),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*u,p=o/2-h*u,y=hb(e,m,p,u,t,o),b={left:Math.min(y.left-r.left,0),top:Math.min(y.top-r.top,0),right:Math.min(y.right-r.right,0),bottom:Math.min(y.bottom-r.bottom,0)};return{x:m-b.left+b.right,y:p-b.top+b.bottom,zoom:u}}function yb(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Hc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Hc(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 ll(e){const t=e.ctrlKey&&wo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Fc(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 Gc(e,t,o=15,i=40){const a=Fc(e.x,i,t.width-i)*o,l=Fc(e.y,i,t.height-i)*o;return[a,l]}function rl(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 Yc(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)&&rl(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?rl(r,c):n.nextTick(()=>{rl(r,c)}))}break}return t}function Yt(e,t){return{id:e,type:"select",selected:t}}function Wc(e){return{item:e,type:"add"}}function Kc(e){return{id:e,type:"remove"}}function qc(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 Xc=()=>{};function $e(e){const t=new Set;let o=Xc,i=()=>!1;const a=()=>t.size>0||i(),l=h=>{o=h},r=()=>{o=Xc},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{t.delete(h)};return{on:h=>{t.add(h);const m=()=>d(h);return no(m),{off:m}},off:d,trigger:h=>{const m=[o];return a()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(p=>p(h)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function jc(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function gb(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Hc(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 sl({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 Zc(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"?Zc(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 _b(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]=Zc(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 kb({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function cl(e,t,o,i,a){const l=kb(e.dimensions,_b(e,o,i,a)),r=Tc(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??Nb(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 Jc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function wb({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=Si({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 Eb(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 Qc={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 lb(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=rb(o.code,e);return Array.isArray(e)?e.some(a=>Rc(o[i],a,t,o.type==="keyup")):Rc(o[i],e,t,o.type==="keyup")}}function rb(e,t){return t.includes(e)?"code":"key"}function yo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??ib),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}),Os(["blur","contextmenu"],s),Ls((...d)=>r(...d),d=>{var u,f;const h=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=ab(d),(!a||a&&!h)&&il(d))return;const y=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,b=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";!m&&(a||!b)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Ls((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&il(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"?lb(d,l):d}return i}const Vc="vue-flow__node-desc",Ac="vue-flow__edge-desc",sb="vue-flow__aria-live",Tc=["Enter"," ","Escape"],Mn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ni(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function $i(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 xi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function rn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Mc(e,t){return{x:rn(e.x,t[0][0],t[1][0]),y:rn(e.y,t[0][1],t[1][1])}}function Bc(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 Ii(e){return!Number.isNaN(e)&&Number.isFinite(e)}function cb(e){return Ii(e.width)&&Ii(e.height)&&Ii(e.x)&&Ii(e.y)}function db(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 Dc(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 Oc(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 ub(...e){if(e.length===3){const[l,r,s]=e;return Oc(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 fb(...e){if(e.length===3){const[l,r,s]=e;return Oc(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 Lc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function mb(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?Ci(s,r):s}function Pc(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 Si({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function zc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function pb(e,t){return zc(Pc(Si(e),Si(t)))}function al(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=Pc(t,Si({...i.computedPosition,...i.dimensions}))}return zc(t)}function Uc(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 m=$i(l,Ni(s)),p=f===null||h===null,y=i&&m>0,b=(f??0)*(h??0);(p||y||m>=b||s.dragging)&&r.push(s)}return r}function cn(e,t){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return t.filter(i=>o.has(i.source)||o.has(i.target))}function 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 hb(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 yb(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 Hc(e,t,o,i,a,l=.1){const r=hb(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=rn(d,i,a),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*u,p=o/2-h*u,y=yb(e,m,p,u,t,o),b={left:Math.min(y.left-r.left,0),top:Math.min(y.top-r.top,0),right:Math.min(y.right-r.right,0),bottom:Math.min(y.bottom-r.bottom,0)};return{x:m-b.left+b.right,y:p-b.top+b.bottom,zoom:u}}function gb(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Fc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Fc(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 ll(e){const t=e.ctrlKey&&wo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Gc(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 Yc(e,t,o=15,i=40){const a=Gc(e.x,i,t.width-i)*o,l=Gc(e.y,i,t.height-i)*o;return[a,l]}function rl(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 Wc(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)&&rl(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?rl(r,c):n.nextTick(()=>{rl(r,c)}))}break}return t}function Yt(e,t){return{id:e,type:"select",selected:t}}function Kc(e){return{item:e,type:"add"}}function qc(e){return{id:e,type:"remove"}}function Xc(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Wt(e,t=new Set,o=!1){const i=[];for(const[a,l]of e){const r=t.has(a);!(l.selected===void 0&&!r)&&l.selected!==r&&(o&&(l.selected=r),i.push(Yt(l.id,r)))}return i}const jc=()=>{};function $e(e){const t=new Set;let o=jc,i=()=>!1;const a=()=>t.size>0||i(),l=h=>{o=h},r=()=>{o=jc},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{t.delete(h)};return{on:h=>{t.add(h);const m=()=>d(h);return no(m),{off:m}},off:d,trigger:h=>{const m=[o];return a()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(p=>p(h)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function Zc(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 bb(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Fc(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 sl({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 Jc(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 _b(e,t,o){const[i,a,l,r]=typeof e!="string"?Jc(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 kb(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=_b(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]=Jc(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 wb({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function cl(e,t,o,i,a){const l=wb(e.dimensions,kb(e,o,i,a)),r=Mc(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??$b(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 Qc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function Eb({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=Si({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 vb(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 ed={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
10
10
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
11
11
|
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
|
|
12
12
|
Node: ${e}
|
|
@@ -26,7 +26,7 @@ Edge: ${e}
|
|
|
26
26
|
Source: ${t}
|
|
27
27
|
Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
28
28
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
29
|
-
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Je extends Error{constructor(t,...o){var i;super((i=Qc[t])==null?void 0:i.call(Qc,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function dl(e){return"clientX"in e}function vb(e){return"sourceEvent"in e}function xt(e,t){const o=dl(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 Nb(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 Ci(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const $b=()=>!0;function ul(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function xb(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())$i(a,Ni(l))>0&&i.push(l);return i}const Ib=250;function Sb(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=xb(e,o,t+Ib);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((l=d.handleBounds)==null?void 0:l.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:m}=Dn(d,f,f.position,!0),p=Math.sqrt((h-e.x)**2+(m-e.y)**2);p>t||(p<s?(r=[{...f,x:h,y:m}],s=p):p===s&&r.push({...f,x:h,y:m}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function ed(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=$b},u,f,h,m){const p=l==="target",y=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:b,y:_}=xt(e),A=r.elementFromPoint(b,_),g=A!=null&&A.classList.contains(`${s}-flow__handle`)?A:y,N={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const te=td(void 0,g),S=g.getAttribute("data-nodeid"),O=g.getAttribute("data-handleid"),z=g.classList.contains("connectable"),F=g.classList.contains("connectableend");if(!S||!te)return N;const ne={source:p?S:i,sourceHandle:p?O:a,target:p?i:S,targetHandle:p?a:O};N.connection=ne;const L=z&&F&&(o===Bt.Strict?p&&te==="source"||!p&&te==="target":S!==i||O!==a);N.isValid=L&&d(ne,{nodes:f,edges:u,sourceNode:h(ne.source),targetNode:h(ne.target)}),N.toHandle=nd(S,te,O,m,o,!0)}return N}function td(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Cb(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Rb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function nd(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===Bt.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 fl={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top},Vb=["production","prod"];function Eo(e,...t){od()&&console.warn(`[Vue Flow]: ${e}`,...t)}function od(){return!Vb.includes(process.env.NODE_ENV||"")}function id(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,...xi(r)}}):null}function ml(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 Ab(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:Oc(e)},a=Bc(a,void 0,i),fb(a,t)?!1:a}function Tb(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?Oc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function ad(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!sn(r)){o(new Je(qe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=cb(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 ld(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 pl(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}`;ld("source",c,u,e,a,r),ld("target",c,d,e,l,s)}}function rd(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function hl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Gt(d)?d:Ab(d,s,a,l);if(!u)continue;const f=o(u.source),h=o(u.target);if(!f||!h){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(!h){a(new Je(qe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:h})){a(new Je(qe.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...Bc(u,m,l),sourceNode:f,targetNode:h})}return c}const sd=Symbol("vueFlow"),cd=Symbol("nodeId"),dd=Symbol("nodeRef"),Mb=Symbol("edgeId"),Bb=Symbol("edgeRef"),Ri=Symbol("slots");function ud(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:l,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:h,findNode:m,multiSelectionActive:p,nodesSelectionActive:y,selectNodesOnDrag:b,removeSelectedElements:_,addSelectedNodes:A,updateNodePositions:g,emits:N}=Le(),{onStart:te,onDrag:S,onStop:O,onClick:z,el:F,disabled:ne,id:re,selectable:L,dragHandle:oe}=e,k=n.shallowRef(!1);let W=[],R,G=null,H={x:void 0,y:void 0},ae={x:0,y:0},v=null,q=!1,le=!1,me=0,he=!1;const se=Lb(),ce=({x:X,y:K})=>{H={x:X,y:K};let w=!1;if(W=W.map(C=>{const V={x:X-C.distance.x,y:K-C.distance.y},{computedPosition:Y}=cl(C,o.value?Ci(V,i.value):V,N.error,r.value,C.parentNode?m(C.parentNode):void 0);return w=w||C.position.x!==Y.x||C.position.y!==Y.y,C.position=Y,C}),le=le||w,!!w&&(g(W,!0,!0),k.value=!0,v)){const[C,V]=sl({id:re,dragItems:W,findNode:m});S({event:v,node:C,nodes:V})}},ye=()=>{if(!G)return;const[X,K]=Gc(ae,G,u.value);if(X!==0||K!==0){const w={x:(H.x??0)-X/c.value.zoom,y:(H.y??0)-K/c.value.zoom};h({x:X,y:K})&&ce(w)}me=requestAnimationFrame(ye)},ke=(X,K)=>{q=!0;const w=m(re);!b.value&&!p.value&&w&&(w.selected||_()),w&&n.toValue(L)&&b.value&&ml(w,p.value,A,_,y,!1,K);const C=se(X.sourceEvent);if(H=C,W=gb(l.value,f.value,C,re),W.length){const[V,Y]=sl({id:re,dragItems:W,findNode:m});te({event:X.sourceEvent,node:V,nodes:Y})}},Re=(X,K)=>{var w;X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1||(le=!1,s.value===0&&ke(X,K),H=se(X.sourceEvent),G=((w=t.value)==null?void 0:w.getBoundingClientRect())||null,ae=xt(X.sourceEvent,G))},xe=(X,K)=>{const w=se(X.sourceEvent);if(!he&&q&&d.value&&(he=!0,ye()),!q){const C=w.xSnapped-(H.x??0),V=w.ySnapped-(H.y??0);Math.sqrt(C*C+V*V)>s.value&&ke(X,K)}(H.x!==w.xSnapped||H.y!==w.ySnapped)&&W.length&&q&&(v=X.sourceEvent,ae=xt(X.sourceEvent,G),ce(w))},pe=X=>{let K=!1;if(!q&&!k.value&&!p.value){const w=X.sourceEvent,C=se(w),V=C.xSnapped-(H.x??0),Y=C.ySnapped-(H.y??0),J=Math.sqrt(V*V+Y*Y);J!==0&&J<=s.value&&(z==null||z(w),K=!0)}if(W.length&&!K){le&&(g(W,!1,!1),le=!1);const[w,C]=sl({id:re,dragItems:W,findNode:m});O({event:X.sourceEvent,node:w,nodes:C})}W=[],k.value=!1,he=!1,q=!1,H={x:void 0,y:void 0},cancelAnimationFrame(me)};return n.watch([()=>n.toValue(ne),F],([X,K],w,C)=>{if(K){const V=ht(K);X||(R=sy().on("start",Y=>Re(Y,K)).on("drag",Y=>xe(Y,K)).on("end",Y=>pe(Y)).filter(Y=>{const J=Y.target,ge=n.toValue(oe);return!Y.button&&(!a.value||!jc(J,`.${a.value}`,K)&&(!ge||jc(J,ge,K)))}),V.call(R)),C(()=>{V.on(".drag",null),R&&(R.on("start",null),R.on("drag",null),R.on("end",null))})}}),k}function Db(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),updateStart:$e(),update:$e(),updateEnd:$e()}}function Ob(e,t){const o=Db();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 Lb(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Le();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=vb(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?Ci(u,t.value):u;return{xSnapped:f,ySnapped:h,...u}}}function Vi(){return!0}function fd({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:l,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:m,autoPanOnConnect:p,autoPanSpeed:y,findNode:b,panBy:_,startConnection:A,updateConnection:g,endConnection:N,emits:te,viewport:S,edges:O,nodes:z,isValidConnection:F,nodeLookup:ne}=Le();let re=null,L=!1,oe=null;function k(R){var G;const H=n.toValue(o)==="target",ae=dl(R),v=Mc(R.target),q=R.currentTarget;if(q&&(ae&&R.button===0||!ae)){let le=function(_e){w=xt(_e,pe),ce=Sb(_o(w,S.value,!1,[1,1]),u.value,ne.value,Y),C||(V(),C=!0);const Ce=ed(_e,{handle:ce,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:H?"target":"source",isValidConnection:se,doc:v,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,z.value,b,ne.value);oe=Ce.handleDomNode,re=Ce.connection,L=Rb(!!ce,Ce.isValid);const Te={...Ne,isValid:L,to:Ce.toHandle&&L?bo({x:Ce.toHandle.x,y:Ce.toHandle.y},S.value):w,toHandle:Ce.toHandle,toPosition:L&&Ce.toHandle?Ce.toHandle.position:fl[Y.position],toNode:Ce.toHandle?ne.value.get(Ce.toHandle.nodeId):null};if(L&&ce&&(Ne!=null&&Ne.toHandle)&&Te.toHandle&&Ne.toHandle.type===Te.toHandle.type&&Ne.toHandle.nodeId===Te.toHandle.nodeId&&Ne.toHandle.id===Te.toHandle.id&&Ne.to.x===Te.to.x&&Ne.to.y===Te.to.y)return;const De=ce??Ce.toHandle;if(g(De&&L?bo({x:De.x,y:De.y},S.value):w,De,Cb(!!De,L)),Ne=Te,!ce&&!L&&!oe)return ul(K);re&&re.source!==re.target&&oe&&(ul(K),K=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!L),oe.classList.toggle("vue-flow__handle-valid",!!L))},me=function(_e){"touches"in _e&&_e.touches.length>0||((ce||oe)&&re&&L&&(l?l(_e,re):te.connect(re)),te.connectEnd(_e),a&&(r==null||r(_e)),ul(K),cancelAnimationFrame(ye),N(_e),C=!1,L=!1,re=null,oe=null,v.removeEventListener("mousemove",le),v.removeEventListener("mouseup",me),v.removeEventListener("touchmove",le),v.removeEventListener("touchend",me))};const he=b(n.toValue(t));let se=n.toValue(i)||F.value||Vi;!se&&he&&(se=(H?he.isValidSourcePos:he.isValidTargetPos)||Vi);let ce,ye=0;const{x:ke,y:Re}=xt(R),xe=td(n.toValue(a),q),pe=(G=c.value)==null?void 0:G.getBoundingClientRect();if(!pe||!xe)return;const X=nd(n.toValue(t),xe,n.toValue(e),ne.value,d.value);if(!X)return;let K,w=xt(R,pe),C=!1;const V=()=>{if(!p.value)return;const[_e,Ce]=Gc(w,pe,y.value);_({x:_e,y:Ce}),ye=requestAnimationFrame(V)},Y={...X,nodeId:n.toValue(t),type:xe,position:X.position},J=ne.value.get(n.toValue(t)),we={inProgress:!0,isValid:null,from:Dn(J,Y,Se.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:J,to:w,toHandle:null,toPosition:fl[Y.position],toNode:null};A({nodeId:n.toValue(t),id:n.toValue(e),type:xe,position:(q==null?void 0:q.getAttribute("data-handlepos"))||Se.Top,...w},{x:ke-pe.left,y:Re-pe.top}),te.connectStart({event:R,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:xe});let Ne=we;v.addEventListener("mousemove",le),v.addEventListener("mouseup",me),v.addEventListener("touchmove",le),v.addEventListener("touchend",me)}}function W(R){var G,H;if(!f.value)return;const ae=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 v=n.toValue(i)||F.value||Vi;const q=b(n.toValue(t));if(!v&&q&&(v=(ae?q.isValidSourcePos:q.isValidTargetPos)||Vi),q&&(typeof q.connectable>"u"?m.value:q.connectable)===!1)return;const le=Mc(R.target),me=ed(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:v,doc:le,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,z.value,b,ne.value),he=((G=me.connection)==null?void 0:G.source)===((H=me.connection)==null?void 0:H.target);me.isValid&&me.connection&&!he&&te.connect(me.connection),te.clickConnectEnd(R),N(R,!0)}return{handlePointerDown:k,handleClick:W}}function Pb(){return n.inject(cd,"")}function md(e){const t=e??Pb()??"",o=n.inject(dd,n.ref(null)),{findNode:i,edges:a,emits:l}=Le(),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(()=>cn([r],a.value))}}function zb(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),dragStart:$e(),drag:$e(),dragStop:$e()}}function Ub(e,t){const o=zb();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 pd(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Le();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,h=d?4:1,m=c.x*u*h,p=c.y*f*h,y=[];for(const b of e.value)if(b.draggable||r&&typeof b.draggable>"u"){const _={x:b.computedPosition.x+m,y:b.computedPosition.y+p},{position:A}=cl(b,_,s.error,t.value,b.parentNode?i(b.parentNode):void 0);y.push({id:b.id,position:A,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(y,!0,!1)}}const Ai=.1,Hb=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 Fb={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 Gb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?so:pi).scaleBy(yl(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}=Tc({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:pi).transform(yl(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:pi).scaleTo(yl(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:Ai,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=al(s),{x:d,y:u,zoom:f}=Uc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ai);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:Ai})=>{const{x:r,y:s,zoom:c}=Uc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Ai);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}}}:Fb)}function yl(e,t=0,o=Hb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function Yb(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let y,b,_=!!(o.nodes.value.length||o.edges.value.length);y=Sn([e.modelValue,()=>{var A,g;return(g=(A=e.modelValue)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setElements(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([A,g])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(y==null||y.pause(),e.modelValue.value=[...A,...g],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let y,b,_=!!o.nodes.value.length;y=Sn([e.nodes,()=>{var A,g;return(g=(A=e.nodes)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setNodes(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.nodes,()=>o.nodes.value.length],([A])=>{var g;(g=e.nodes)!=null&&g.value&&Array.isArray(e.nodes.value)&&(y==null||y.pause(),e.nodes.value=[...A],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let y,b,_=!!o.edges.value.length;y=Sn([e.edges,()=>{var A,g;return(g=(A=e.edges)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setEdges(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.edges,()=>o.edges.value.length],([A])=>{var g;(g=e.edges)!=null&&g.value&&Array.isArray(e.edges.value)&&(y==null||y.pause(),e.edges.value=[...A],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&Xe(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&Xe(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&Xe(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&Xe(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{Xe(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const y=async b=>{let _=b;typeof t.autoConnect=="function"&&(_=await t.autoConnect(b)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{Xe(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(b,_,A)=>{b?o.onConnect(y):o.hooks.value.connect.off(y),A(()=>{o.hooks.value.connect.off(y)})},{immediate:!0})})},m=()=>{const y=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(t)){const _=b;if(!y.includes(_)){const A=n.toRef(()=>t[_]),g=o[_];n.isRef(g)&&i.run(()=>{n.watch(A,N=>{Xe(N)&&(g.value=N)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),h(),m()})()}),()=>i.stop()}function Wb(){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=>Eo(e.message))}}function Kb(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=qb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function qb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function hd(){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:nl.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:Bt.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:Wb(),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 Xb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function jb(e,t,o){const i=Gb(e),a=w=>{const C=w??[];e.hooks.updateNodeInternals.trigger(C)},l=w=>ub(w,e.nodes,e.edges),r=w=>db(w,e.nodes,e.edges),s=w=>cn(w,e.edges),c=({id:w,type:C,nodeId:V})=>{var Y;const J=w?`-${C}-${w}`:`-${C}`;return Array.from(((Y=e.connectionLookup.get(`${V}${J}`))==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,C,V)=>{var Y,J;const ge=[];for(const we of w){const Ne={id:we.id,type:"position",dragging:V,from:we.from};if(C&&(Ne.position=we.position,we.parentNode)){const _e=d(we.parentNode);Ne.position={x:Ne.position.x-(((Y=_e==null?void 0:_e.computedPosition)==null?void 0:Y.x)??0),y:Ne.position.y-(((J=_e==null?void 0:_e.computedPosition)==null?void 0:J.y)??0)}}ge.push(Ne)}ge!=null&&ge.length&&e.hooks.nodesChange.trigger(ge)},h=w=>{if(!e.vueFlowRef)return;const C=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!C)return;const V=window.getComputedStyle(C),{m22:Y}=new window.DOMMatrixReadOnly(V.transform),J=[];for(const ge of w){const we=ge,Ne=d(we.id);if(Ne){const _e=xi(we.nodeElement);if(!!(_e.width&&_e.height&&(Ne.dimensions.width!==_e.width||Ne.dimensions.height!==_e.height||we.forceUpdate))){const Te=we.nodeElement.getBoundingClientRect();Ne.dimensions=_e,Ne.handleBounds.source=id("source",we.nodeElement,Te,Y,Ne.id),Ne.handleBounds.target=id("target",we.nodeElement,Te,Y,Ne.id),J.push({id:Ne.id,type:"dimensions",dimensions:_e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),J.length&&e.hooks.nodesChange.trigger(J)},m=(w,C)=>{const V=new Set,Y=new Set;for(const we of w)sn(we)?V.add(we.id):Gt(we)&&Y.add(we.id);const J=Wt(t.value,V,!0),ge=Wt(o.value,Y);if(e.multiSelectionActive){for(const we of V)J.push(Yt(we,C));for(const we of Y)ge.push(Yt(we,C))}J.length&&e.hooks.nodesChange.trigger(J),ge.length&&e.hooks.edgesChange.trigger(ge)},p=w=>{if(e.multiSelectionActive){const C=w.map(V=>Yt(V.id,!0));e.hooks.nodesChange.trigger(C);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(w.map(C=>C.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},y=w=>{if(e.multiSelectionActive){const C=w.map(V=>Yt(V.id,!0));e.hooks.edgesChange.trigger(C);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(w.map(C=>C.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},b=w=>{m(w,!0)},_=w=>{const V=(w||e.nodes).map(Y=>(Y.selected=!1,Yt(Y.id,!1)));e.hooks.nodesChange.trigger(V)},A=w=>{const V=(w||e.edges).map(Y=>(Y.selected=!1,Yt(Y.id,!1)));e.hooks.edgesChange.trigger(V)},g=w=>{if(!w||!w.length)return m([],!1);const C=w.reduce((V,Y)=>{const J=Yt(Y.id,!1);return sn(Y)?V.nodes.push(J):V.edges.push(J),V},{nodes:[],edges:[]});C.nodes.length&&e.hooks.nodesChange.trigger(C.nodes),C.edges.length&&e.hooks.edgesChange.trigger(C.edges)},N=w=>{var C;(C=e.d3Zoom)==null||C.scaleExtent([w,e.maxZoom]),e.minZoom=w},te=w=>{var C;(C=e.d3Zoom)==null||C.scaleExtent([e.minZoom,w]),e.maxZoom=w},S=w=>{var C;(C=e.d3Zoom)==null||C.translateExtent(w),e.translateExtent=w},O=w=>{e.nodeExtent=w,a()},z=w=>{var C;(C=e.d3Zoom)==null||C.clickDistance(w)},F=w=>{e.nodesDraggable=w,e.nodesConnectable=w,e.elementsSelectable=w},ne=w=>{const C=w instanceof Function?w(e.nodes):w;!e.initialized&&!C.length||(e.nodes=ad(C,d,e.hooks.error.trigger))},re=w=>{const C=w instanceof Function?w(e.edges):w;if(!e.initialized&&!C.length)return;const V=hl(C,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);pl(e.connectionLookup,o.value,V),e.edges=V},L=w=>{const C=w instanceof Function?w([...e.nodes,...e.edges]):w;!e.initialized&&!C.length||(ne(C.filter(sn)),re(C.filter(Gt)))},oe=w=>{let C=w instanceof Function?w(e.nodes):w;C=Array.isArray(C)?C:[C];const V=ad(C,d,e.hooks.error.trigger),Y=[];for(const J of V)Y.push(Wc(J));Y.length&&e.hooks.nodesChange.trigger(Y)},k=w=>{let C=w instanceof Function?w(e.edges):w;C=Array.isArray(C)?C:[C];const V=hl(C,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Y=[];for(const J of V)Y.push(Wc(J));Y.length&&e.hooks.edgesChange.trigger(Y)},W=(w,C=!0,V=!1)=>{const Y=w instanceof Function?w(e.nodes):w,J=Array.isArray(Y)?Y:[Y],ge=[],we=[];function Ne(Ce){const Te=s(Ce);for(const De of Te)(!Xe(De.deletable)||De.deletable)&&we.push(qc(De.id,De.source,De.target,De.sourceHandle,De.targetHandle))}function _e(Ce){const Te=[];for(const De of e.nodes)De.parentNode===Ce&&Te.push(De);if(Te.length){for(const De of Te)ge.push(Kc(De.id));C&&Ne(Te);for(const De of Te)_e(De.id)}}for(const Ce of J){const Te=typeof Ce=="string"?d(Ce):Ce;Te&&(Xe(Te.deletable)&&!Te.deletable||(ge.push(Kc(Te.id)),C&&Ne([Te]),V&&_e(Te.id)))}we.length&&e.hooks.edgesChange.trigger(we),ge.length&&e.hooks.nodesChange.trigger(ge)},R=w=>{const C=w instanceof Function?w(e.edges):w,V=Array.isArray(C)?C:[C],Y=[];for(const J of V){const ge=typeof J=="string"?u(J):J;ge&&(Xe(ge.deletable)&&!ge.deletable||Y.push(qc(typeof J=="string"?J:J.id,ge.source,ge.target,ge.sourceHandle,ge.targetHandle)))}e.hooks.edgesChange.trigger(Y)},G=(w,C,V=!0)=>{const Y=u(w.id);if(!Y)return!1;const J=e.edges.indexOf(Y),ge=Tb(w,C,Y,V,e.hooks.error.trigger);if(ge){const[we]=hl([ge],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ne,_e)=>_e===J?we:Ne),pl(e.connectionLookup,o.value,[we]),we}return!1},H=(w,C,V={replace:!1})=>{const Y=u(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;Y.data=V.replace?J:{...Y.data,...J}},ae=w=>Yc(w,e.nodes),v=w=>{const C=Yc(w,e.edges);return pl(e.connectionLookup,o.value,C),C},q=(w,C,V={replace:!1})=>{const Y=d(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;V.replace?e.nodes.splice(e.nodes.indexOf(Y),1,J):Object.assign(Y,J)},le=(w,C,V={replace:!1})=>{const Y=d(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;Y.data=V.replace?J:{...Y.data,...J}},me=(w,C,V=!1)=>{V?e.connectionClickStartHandle=w:e.connectionStartHandle=w,e.connectionEndHandle=null,e.connectionStatus=null,C&&(e.connectionPosition=C)},he=(w,C=null,V=null)=>{e.connectionStartHandle&&(e.connectionPosition=w,e.connectionEndHandle=C,e.connectionStatus=V)},se=(w,C)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,C?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ce=w=>{const C=sb(w),V=C?null:go(w)?w:d(w.id);return!C&&!V?[null,null,C]:[C?w:Ni(V),V,C]},ye=(w,C=!0,V=e.nodes)=>{const[Y,J,ge]=ce(w);if(!Y)return[];const we=[];for(const Ne of V||e.nodes){if(!ge&&(Ne.id===J.id||!Ne.computedPosition))continue;const _e=Ni(Ne),Ce=$i(_e,Y);(C&&Ce>0||Ce>=_e.width*_e.height||Ce>=Number(Y.width)*Number(Y.height))&&we.push(Ne)}return we},ke=(w,C,V=!0)=>{const[Y]=ce(w);if(!Y)return!1;const J=$i(Y,C);return V&&J>0||J>=Number(Y.width)*Number(Y.height)},Re=w=>{const{viewport:C,dimensions:V,d3Zoom:Y,d3Selection:J,translateExtent:ge}=e;if(!Y||!J||!w.x&&!w.y)return!1;const we=Tn.translate(C.x+w.x,C.y+w.y).scale(C.zoom),Ne=[[0,0],[V.width,V.height]],_e=Y.constrain()(we,Ne,ge),Ce=e.viewport.x!==_e.x||e.viewport.y!==_e.y||e.viewport.zoom!==_e.k;return Y.transform(J,_e),Ce},xe=w=>{const C=w instanceof Function?w(e):w,V=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(C.defaultEdgeOptions)&&(e.defaultEdgeOptions=C.defaultEdgeOptions);const Y=C.modelValue||C.nodes||C.edges?[]:void 0;Y&&(C.modelValue&&Y.push(...C.modelValue),C.nodes&&Y.push(...C.nodes),C.edges&&Y.push(...C.edges),L(Y));const J=()=>{Xe(C.maxZoom)&&te(C.maxZoom),Xe(C.minZoom)&&N(C.minZoom),Xe(C.translateExtent)&&S(C.translateExtent)};for(const ge of Object.keys(C)){const we=ge,Ne=C[we];![...Xb,...V].includes(we)&&Xe(Ne)&&(e[we]=Ne)}Ba(()=>e.d3Zoom).not.toBeNull().then(J),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:L,setNodes:ne,setEdges:re,addNodes:oe,addEdges:k,removeNodes:W,removeEdges:R,findNode:d,findEdge:u,updateEdge:G,updateEdgeData:H,updateNode:q,updateNodeData:le,applyEdgeChanges:v,applyNodeChanges:ae,addSelectedElements:b,addSelectedNodes:p,addSelectedEdges:y,setMinZoom:N,setMaxZoom:te,setTranslateExtent:S,setNodeExtent:O,setPaneClickDistance:z,removeSelectedElements:g,removeSelectedNodes:_,removeSelectedEdges:A,startConnection:me,updateConnection:he,endConnection:se,setInteractive:F,setState:xe,getIntersectingNodes:ye,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:ke,panBy:Re,fitView:w=>i.value.fitView(w),zoomIn:w=>i.value.zoomIn(w),zoomOut:w=>i.value.zoomOut(w),zoomTo:(w,C)=>i.value.zoomTo(w,C),setViewport:(w,C)=>i.value.setViewport(w,C),setTransform:(w,C)=>i.value.setTransform(w,C),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(w,C,V)=>i.value.setCenter(w,C,V),fitBounds:(w,C)=>i.value.fitBounds(w,C),project:w=>i.value.project(w),screenToFlowCoordinate:w=>i.value.screenToFlowCoordinate(w),flowToScreenCoordinate:w=>i.value.flowToScreenCoordinate(w),toObject:()=>{const w=[],C=[];for(const V of e.nodes){const{computedPosition:Y,handleBounds:J,selected:ge,dimensions:we,isParent:Ne,resizing:_e,dragging:Ce,events:Te,...De}=V;w.push(De)}for(const V of e.edges){const{selected:Y,sourceNode:J,targetNode:ge,events:we,...Ne}=V;C.push(Ne)}return JSON.parse(JSON.stringify({nodes:w,edges:C,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:w=>new Promise(C=>{const{nodes:V,edges:Y,position:J,zoom:ge,viewport:we}=w;V&&ne(V),Y&&re(Y);const[Ne,_e]=we!=null&&we.x&&(we!=null&&we.y)?[we.x,we.y]:J??[null,null];if(Ne&&_e){const Ce=(we==null?void 0:we.zoom)||ge||e.viewport.zoom;return Ba(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ne,y:_e,zoom:Ce}).then(()=>{C(!0)})})}else C(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const w=hd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const C=Tn.translate(w.defaultViewport.x??0,w.defaultViewport.y??0).scale(rn(w.defaultViewport.zoom??1,w.minZoom,w.maxZoom)),V=e.viewportRef.getBoundingClientRect(),Y=[[0,0],[V.width,V.height]],J=e.d3Zoom.constrain()(C,Y,w.translateExtent);e.d3Zoom.transform(e.d3Selection,J)}xe(w)},$destroy:()=>{}}}const Zb=["data-id","data-handleid","data-nodeid","data-handlepos"],Jb={name:"Handle",compatConfig:{MODE:3}},dn=n.defineComponent({...Jb,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}=Le(),{id:m,node:p,nodeEl:y,connectedEdges:b}=md(),_=n.ref(),A=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),g=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=n.toRef(()=>{var re,L,oe,k,W,R;return((re=r.value)==null?void 0:re.nodeId)===m&&((L=r.value)==null?void 0:L.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===m&&((W=c.value)==null?void 0:W.id)===e.id&&((R=c.value)==null?void 0:R.type)===i.value}),te=n.toRef(()=>{var re,L,oe;return((re=s.value)==null?void 0:re.nodeId)===m&&((L=s.value)==null?void 0:L.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:S,handleClick:O}=fd({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),z=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(re=>{const L=re[`${i.value}Handle`];return re[i.value]!==m?!1:L?L===e.id:!0}):typeof e.connectable=="number"?b.value.filter(re=>{const L=re[`${i.value}Handle`];return re[i.value]!==m?!1:L?L===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(p,b.value):Xe(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var re;if(!p.dimensions.width||!p.dimensions.height)return;const L=(re=p.handleBounds[i.value])==null?void 0:re.find(ae=>ae.id===e.id);if(!d.value||L)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!y.value||!_.value||!oe||!e.id)return;const k=y.value.getBoundingClientRect(),W=_.value.getBoundingClientRect(),R=window.getComputedStyle(oe),{m22:G}=new window.DOMMatrixReadOnly(R.transform),H={id:e.id,position:e.position,x:(W.left-k.left)/G,y:(W.top-k.top)/G,type:i.value,nodeId:m,...xi(_.value)};p.handleBounds[i.value]=[...p.handleBounds[i.value]??[],H]});function F(re){const L=dl(re);z.value&&A.value&&(L&&re.button===0||!L)&&S(re)}function ne(re){!m||!s.value&&!A.value||z.value&&O(re)}return t({handleClick:O,handlePointerDown:S,onClick:ne,onPointerDown:F}),(re,L)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${n.unref(l)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":re.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${re.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(h),i.value,{connectable:z.value,connecting:te.value,connectablestart:A.value,connectableend:g.value,connectionindicator:z.value&&(A.value&&!N.value||g.value&&N.value)}]]),onMousedown:F,onTouchstartPassive:F,onClick:ne},[n.renderSlot(re.$slots,"default",{id:re.id})],42,Zb))}}),Ti=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})]};Ti.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ti.inheritAttrs=!1,Ti.compatConfig={MODE:3};const Qb=Ti,Mi=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])]};Mi.props=["targetPosition","label","isValidTargetPos","connectable","data"],Mi.inheritAttrs=!1,Mi.compatConfig={MODE:3};const e0=Mi,Bi=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})]};Bi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Bi.inheritAttrs=!1,Bi.compatConfig={MODE:3};const t0=Bi,n0=["transform"],o0=["width","height","x","y","rx","ry"],i0=["y"],a0={name:"EdgeText",compatConfig:{MODE:3}},l0=n.defineComponent({...a0,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,o0)):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,i0)],8,n0))}}),r0=["id","d","marker-end","marker-start"],s0=["d","stroke-width"],c0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Di=n.defineComponent({...c0,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,r0),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,s0)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(l0,{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 yd({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 gd({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 Oi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function bd({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Se.Left:r=t-Oi(t-i,l),s=o;break;case Se.Right:r=t+Oi(i-t,l),s=o;break;case Se.Top:r=t,s=o-Oi(o-a,l);break;case Se.Bottom:r=t,s=o+Oi(a-o,l);break}return[r,s]}function _d(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,curvature:s=.25}=e,[c,d]=bd({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=bd({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[h,m,p,y]=gd({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${a},${l}`,h,m,p,y]}function kd({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 wd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top}=e,[s,c]=kd({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=kd({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,h,m,p]=gd({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${l}`,f,h,m,p]}const Ed={[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 d0({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 vd(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function u0({source:e,sourcePosition:t=Se.Bottom,target:o,targetPosition:i=Se.Top,center:a,offset:l}){const r=Ed[t],s=Ed[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=d0({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let m,p,y;const b={x:0,y:0},_={x:0,y:0},[A,g,N,te]=yd({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){p=a.x??A,y=a.y??g;const O=[{x:p,y:c.y},{x:p,y:d.y}],z=[{x:c.x,y},{x:d.x,y}];r[f]===h?m=f==="x"?O:z:m=f==="x"?z:O}else{const O=[{x:c.x,y:d.y}],z=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===h?z:O:m=r.y===h?O:z,t===i){const oe=Math.abs(e[f]-o[f]);if(oe<=l){const k=Math.min(l-1,l-oe);r[f]===h?b[f]=(c[f]>e[f]?-1:1)*k:_[f]=(d[f]>o[f]?-1:1)*k}}if(t!==i){const oe=f==="x"?"y":"x",k=r[f]===s[oe],W=c[oe]>d[oe],R=c[oe]<d[oe];(r[f]===1&&(!k&&W||k&&R)||r[f]!==1&&(!k&&R||k&&W))&&(m=f==="x"?O:z)}const F={x:c.x+b.x,y:c.y+b.y},ne={x:d.x+_.x,y:d.y+_.y},re=Math.max(Math.abs(F.x-m[0].x),Math.abs(ne.x-m[0].x)),L=Math.max(Math.abs(F.y-m[0].y),Math.abs(ne.y-m[0].y));re>=L?(p=(F.x+ne.x)/2,y=m[0].y):(p=m[0].x,y=(F.y+ne.y)/2)}return[[e,{x:c.x+b.x,y:c.y+b.y},...m,{x:d.x+_.x,y:d.y+_.y},o],p,y,N,te]}function f0(e,t,o,i){const a=Math.min(vd(e,t)/2,vd(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 gl(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,h,m,p,y]=u0({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,g)=>{let N;return g>0&&g<f.length-1?N=f0(f[g-1],A,f[g+1],s):N=`${g===0?"M":"L"}${A.x} ${A.y}`,_+=N,_},""),h,m,p,y]}function m0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=yd({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const p0=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]=m0(e);return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),Nd=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]=gl({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),h0=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(Nd,{...e,...t,borderRadius:0})}}),y0=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]=_d({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),g0=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]=wd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),b0={input:t0,default:Qb,output:e0},_0={default:y0,straight:p0,step:h0,smoothstep:Nd,simplebezier:g0};function k0(e,t,o){const i=n.computed(()=>y=>t.value.get(y)),a=n.computed(()=>y=>o.value.get(y)),l=n.computed(()=>{const y={..._0,...e.edgeTypes},b=Object.keys(y);for(const _ of e.edges)_.type&&!b.includes(_.type)&&(y[_.type]=_.type);return y}),r=n.computed(()=>{const y={...b0,...e.nodeTypes},b=Object.keys(y);for(const _ of e.nodes)_.type&&!b.includes(_.type)&&(y[_.type]=_.type);return y}),s=n.computed(()=>e.onlyRenderVisibleElements?zc(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 y=[];for(const b of e.edges){const _=t.value.get(b.source),A=t.value.get(b.target);wb({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})&&y.push(b)}return y}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const y=[];for(const b of e.nodes)b.selected&&y.push(b);return y}),f=n.computed(()=>{const y=[];for(const b of e.edges)b.selected&&y.push(b);return y}),h=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const y=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&y.push(b);return y}),p=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:l,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:p}}class un{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??un.instance;return un.instance=i??new un,o&&(o.config.globalProperties.$vueFlowStorage=un.instance),un.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=hd(),a=n.reactive(i),l={};for(const[h,m]of Object.entries(a.hooks)){const p=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;l[p]=m.on}const r={};for(const[h,m]of Object.entries(a.hooks))r[h]=m.trigger;const s=n.computed(()=>{const h=new Map;for(const m of a.nodes)h.set(m.id,m);return h}),c=n.computed(()=>{const h=new Map;for(const m of a.edges)h.set(m.id,m);return h}),d=k0(a,s,c),u=jb(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...gp(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 Le(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(sd,null);typeof c<"u"&&c!==null&&(!r||c.id===r)&&(s=c)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const c=l??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,h,m)=>{const p=b=>{d.applyNodeChanges(b)},y=b=>{d.applyEdgeChanges(b)};f?(d.onNodesChange(p),d.onEdgesChange(y)):(d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(y)),m(()=>{d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(y)})},{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(sd,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 w0(e){const{emits:t,dimensions:o}=Le();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=xi(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 E0={name:"UserSelection",compatConfig:{MODE:3}},v0=n.defineComponent({...E0,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))}}),N0=["tabIndex"],$0={name:"NodesSelection",compatConfig:{MODE:3}},x0=n.defineComponent({...$0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Le(),s=pd(),c=n.ref(null),d=ud({el:c,onStart(p){t.selectionDragStart(p),t.nodeDragStart(p)},onDrag(p){t.selectionDrag(p),t.nodeDrag(p)},onStop(p){t.selectionDragStop(p),t.nodeDragStop(p)}});n.onMounted(()=>{var p;l.value||(p=c.value)==null||p.focus({preventScroll:!0})});const u=n.computed(()=>al(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(p){t.selectionContextMenu({event:p,nodes:i.value})}function m(p){l.value||Mn[p.key]&&(p.preventDefault(),s({x:Mn[p.key].x,y:Mn[p.key].y},p.shiftKey))}return(p,y)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(l)?void 0:-1,onContextmenu:h,onKeydown:m},null,46,N0)],6)):n.createCommentVNode("",!0)}});function I0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const S0={name:"Pane",compatConfig:{MODE:3}},C0=n.defineComponent({...S0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:l,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:h,removeEdges:m,selectionMode:p,deleteKeyCode:y,multiSelectionKeyCode:b,multiSelectionActive:_,edgeLookup:A,nodeLookup:g,connectionLookup:N,defaultEdgeOptions:te,connectionStartHandle:S,panOnDrag:O}=Le(),z=n.shallowRef(null),F=n.shallowRef(new Set),ne=n.shallowRef(new Set),re=n.shallowRef(null),L=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>S.value!==null);let k=!1,W=!1;const R=yo(y,{actInsideInputWithModifier:!1}),G=yo(b);n.watch(R,se=>{se&&(h(f.value),m(u.value),d.value=!1)}),n.watch(G,se=>{_.value=se});function H(se,ce){return ye=>{ye.target===ce&&(se==null||se(ye))}}function ae(se){if(k||oe.value){k=!1;return}a.paneClick(se),r(),d.value=!1}function v(se){var ce;if(Array.isArray(O.value)&&((ce=O.value)!=null&&ce.includes(2))){se.preventDefault();return}a.paneContextMenu(se)}function q(se){a.paneScroll(se)}function le(se){var ce,ye,ke;if(re.value=((ce=t.value)==null?void 0:ce.getBoundingClientRect())??null,!c.value||!e.isSelecting||se.button!==0||se.target!==z.value||!re.value)return;(ke=(ye=se.target)==null?void 0:ye.setPointerCapture)==null||ke.call(ye,se.pointerId);const{x:Re,y:xe}=I0(se,re.value);W=!0,k=!1,r(),s.value={width:0,height:0,startX:Re,startY:xe,x:Re,y:xe},a.selectionStart(se)}function me(se){var ce;if(!re.value||!s.value)return;k=!0;const{x:ye,y:ke}=xt(se,re.value),{startX:Re=0,startY:xe=0}=s.value,pe={startX:Re,startY:xe,x:ye<Re?ye:Re,y:ke<xe?ke:xe,width:Math.abs(ye-Re),height:Math.abs(ke-xe)},X=F.value,K=ne.value;F.value=new Set(zc(o.value,pe,i.value,p.value===nl.Partial,!0).map(C=>C.id)),ne.value=new Set;const w=((ce=te.value)==null?void 0:ce.selectable)??!0;for(const C of F.value){const V=N.value.get(C);if(V)for(const{edgeId:Y}of V.values()){const J=A.value.get(Y);J&&(J.selectable??w)&&ne.value.add(Y)}}if(!rd(X,F.value)){const C=Wt(g.value,F.value,!0);a.nodesChange(C)}if(!rd(K,ne.value)){const C=Wt(A.value,ne.value);a.edgesChange(C)}s.value=pe,l.value=!0,d.value=!1}function he(se){var ce;se.button!==0||!W||((ce=se.target)==null||ce.releasePointerCapture(se.pointerId),!l.value&&s.value&&se.target===z.value&&ae(se),l.value=!1,s.value=null,d.value=F.value.size>0,a.selectionEnd(se),e.selectionKeyPressed&&(k=!1),W=!1)}return(se,ce)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:z,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:se.isSelecting}]),onClick:ce[0]||(ce[0]=ye=>L.value?void 0:H(ae,z.value)(ye)),onContextmenu:ce[1]||(ce[1]=ye=>H(v,z.value)(ye)),onWheelPassive:ce[2]||(ce[2]=ye=>H(q,z.value)(ye)),onPointerenter:ce[3]||(ce[3]=ye=>L.value?void 0:n.unref(a).paneMouseEnter(ye)),onPointerdown:ce[4]||(ce[4]=ye=>L.value?le(ye):n.unref(a).paneMouseMove(ye)),onPointermove:ce[5]||(ce[5]=ye=>L.value?me(ye):n.unref(a).paneMouseMove(ye)),onPointerup:ce[6]||(ce[6]=ye=>L.value?he(ye):void 0),onPointerleave:ce[7]||(ce[7]=ye=>n.unref(a).paneMouseLeave(ye))},[n.renderSlot(se.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(v0,{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(x0,{key:1})):n.createCommentVNode("",!0)],34))}}),R0={name:"Transform",compatConfig:{MODE:3}},V0=n.defineComponent({...R0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Le(),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))}}),A0={name:"Viewport",compatConfig:{MODE:3}},T0=n.defineComponent({...A0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:l,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:m,zoomOnScroll:p,preventScrolling:y,noWheelClassName:b,noPanClassName:_,emits:A,connectionStartHandle:g,userSelectionActive:N,paneDragging:te,d3Zoom:S,d3Selection:O,d3ZoomHandler:z,viewport:F,viewportRef:ne,paneClickDistance:re}=Le();w0(ne);const L=n.shallowRef(!1),oe=n.shallowRef(!1);let k=null,W=!1,R=0,G={x:0,y:0,zoom:0};const H=yo(s),ae=yo(r),v=yo(l),q=n.toRef(()=>(!ae.value||ae.value&&r.value===!0)&&(H.value||f.value)),le=n.toRef(()=>H.value||c.value),me=n.toRef(()=>r.value===!0&&q.value!==!0),he=n.toRef(()=>ae.value&&r.value!==!0||N.value||me.value),se=n.toRef(()=>g.value!==null);n.onMounted(()=>{if(!ne.value){Eo("Viewport element is missing");return}const xe=ne.value,pe=xe.getBoundingClientRect(),X=tb().clickDistance(re.value).scaleExtent([t.value,o.value]).translateExtent(a.value),K=ht(xe).call(X),w=K.on("wheel.zoom"),C=Tn.translate(i.value.x??0,i.value.y??0).scale(rn(i.value.zoom??1,t.value,o.value)),V=[[0,0],[pe.width,pe.height]],Y=X.constrain()(C,V,a.value);X.transform(K,Y),X.wheelDelta(ll),S.value=X,O.value=K,z.value=w,F.value={x:Y.x,y:Y.y,zoom:Y.k},X.on("start",J=>{var ge;if(!J.sourceEvent)return null;R=J.sourceEvent.button,L.value=!0;const we=ke(J.transform);((ge=J.sourceEvent)==null?void 0:ge.type)==="mousedown"&&(te.value=!0),G=we,A.viewportChangeStart(we),A.moveStart({event:J,flowTransform:we})}),X.on("end",J=>{if(!J.sourceEvent)return null;if(L.value=!1,te.value=!1,ce(q.value,R??0)&&!W&&A.paneContextMenu(J.sourceEvent),W=!1,ye(G,J.transform)){const ge=ke(J.transform);G=ge,A.viewportChangeEnd(ge),A.moveEnd({event:J,flowTransform:ge})}}),X.filter(J=>{var ge;const we=v.value||p.value,Ne=m.value&&J.ctrlKey,_e=J.button,Ce=J.type==="wheel";if(_e===1&&J.type==="mousedown"&&(Re(J,"vue-flow__node")||Re(J,"vue-flow__edge")))return!0;if(!q.value&&!we&&!le.value&&!h.value&&!m.value||N.value||se.value&&!Ce||!h.value&&J.type==="dblclick"||Re(J,b.value)&&Ce||Re(J,_.value)&&(!Ce||le.value&&Ce&&!v.value)||!m.value&&J.ctrlKey&&Ce||!we&&!le.value&&!Ne&&Ce)return!1;if(!m&&J.type==="touchstart"&&((ge=J.touches)==null?void 0:ge.length)>1)return J.preventDefault(),!1;if(!q.value&&(J.type==="mousedown"||J.type==="touchstart")||me.value&&Array.isArray(f.value)&&f.value.includes(0)&&_e===0||Array.isArray(f.value)&&!f.value.includes(_e)&&(J.type==="mousedown"||J.type==="touchstart"))return!1;const Te=Array.isArray(f.value)&&f.value.includes(_e)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!_e||_e<=1;return(!J.ctrlKey||H.value||Ce)&&Te}),n.watch([N,q],()=>{N.value&&!L.value?X.on("zoom",null):N.value||X.on("zoom",J=>{F.value={x:J.transform.x,y:J.transform.y,zoom:J.transform.k};const ge=ke(J.transform);W=ce(q.value,R??0),A.viewportChange(ge),A.move({event:J,flowTransform:ge})})},{immediate:!0}),n.watch([N,le,d,v,m,y,b],()=>{le.value&&!v.value&&!N.value?K.on("wheel.zoom",J=>{if(Re(J,b.value))return!1;const ge=v.value||p.value,we=m.value&&J.ctrlKey;if(!(!y.value||le.value||ge||we))return!1;J.preventDefault(),J.stopImmediatePropagation();const _e=K.property("__zoom").k||1,Ce=wo();if(!H.value&&J.ctrlKey&&m.value&&Ce){const I=Et(J),M=ll(J),B=_e*2**M;X.scaleTo(K,B,I,J);return}const Te=J.deltaMode===1?20:1;let De=d.value===ho.Vertical?0:J.deltaX*Te,E=d.value===ho.Horizontal?0:J.deltaY*Te;!Ce&&J.shiftKey&&d.value!==ho.Vertical&&!De&&E&&(De=E,E=0),X.translateBy(K,-(De/_e)*u.value,-(E/_e)*u.value);const T=ke(K.property("__zoom"));k&&clearTimeout(k),oe.value?(A.move({event:J,flowTransform:T}),A.viewportChange(T),k=setTimeout(()=>{A.moveEnd({event:J,flowTransform:T}),A.viewportChangeEnd(T),oe.value=!1},150)):(oe.value=!0,A.moveStart({event:J,flowTransform:T}),A.viewportChangeStart(T))},{passive:!1}):typeof w<"u"&&K.on("wheel.zoom",function(J,ge){const we=!y.value&&J.type==="wheel"&&!J.ctrlKey,Ne=v.value||p.value,_e=m.value&&J.ctrlKey;if(!Ne&&!c.value&&!_e&&J.type==="wheel"||we||Re(J,b.value))return null;J.preventDefault(),w.call(this,J,ge)},{passive:!1})},{immediate:!0})});function ce(xe,pe){return pe===2&&Array.isArray(xe)&&xe.includes(2)}function ye(xe,pe){return xe.x!==pe.x&&!Number.isNaN(pe.x)||xe.y!==pe.y&&!Number.isNaN(pe.y)||xe.zoom!==pe.k&&!Number.isNaN(pe.k)}function ke(xe){return{x:xe.x,y:xe.y,zoom:xe.k}}function Re(xe,pe){return xe.target.closest(`.${pe}`)}return(xe,pe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:ne,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(C0,{"is-selecting":he.value,"selection-key-pressed":n.unref(ae),class:n.normalizeClass({connecting:se.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(V0,null,{default:n.withCtx(()=>[n.renderSlot(xe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),M0=["id"],B0=["id"],D0=["id"],O0={name:"A11yDescriptions",compatConfig:{MODE:3}},L0=n.defineComponent({...O0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Le();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Rc)}-${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,M0),n.createElementVNode("div",{id:`${n.unref(Vc)}-${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,B0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(rb)}-${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,D0))],64))}});function P0(){const e=Le();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function z0(e,t,o){return o===Se.Left?e-t:o===Se.Right?e+t:e}function U0(e,t,o){return o===Se.Top?e-t:o===Se.Bottom?e+t:e}const bl=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:z0(t,e,i),cy:U0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};bl.props=["radius","centerX","centerY","position","type"],bl.compatConfig={MODE:3};const $d=bl,H0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:l,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:h,multiSelectionActive:m,disableKeyboardA11y:p,elementsSelectable:y,edgesUpdatable:b,edgesFocusable:_,hooks:A}=Le(),g=n.computed(()=>u(e.id)),{emit:N,on:te}=Ob(g.value,l),S=n.inject(Ri),O=n.getCurrentInstance(),z=n.ref(!1),F=n.ref(!1),ne=n.ref(""),re=n.ref(null),L=n.ref("source"),oe=n.ref(null),k=n.toRef(()=>typeof g.value.selectable>"u"?y.value:g.value.selectable),W=n.toRef(()=>typeof g.value.updatable>"u"?b.value:g.value.updatable),R=n.toRef(()=>typeof g.value.focusable>"u"?_.value:g.value.focusable);n.provide(Mb,e.id),n.provide(Bb,oe);const G=n.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),H=n.computed(()=>g.value.style instanceof Function?g.value.style(g.value):g.value.style),ae=n.computed(()=>{const C=g.value.type||"default",V=S==null?void 0:S[`edge-${C}`];if(V)return V;let Y=g.value.template??c.value[C];if(typeof Y=="string"&&O){const J=Object.keys(O.appContext.components);J&&J.includes(C)&&(Y=n.resolveComponent(C,!1))}return Y&&typeof Y!="string"?Y:(l.error(new Je(qe.EDGE_TYPE_MISSING,Y)),!1)}),{handlePointerDown:v}=fd({nodeId:ne,handleId:re,type:L,isValidConnection:h,edgeUpdaterType:L,onEdgeUpdate:me,onEdgeUpdateEnd:he});return()=>{const C=f(g.value.source),V=f(g.value.target),Y="pathOptions"in g.value?g.value.pathOptions:{};if(!C&&!V)return l.error(new Je(qe.EDGE_SOURCE_TARGET_MISSING,g.value.id,g.value.source,g.value.target)),null;if(!C)return l.error(new Je(qe.EDGE_SOURCE_MISSING,g.value.id,g.value.source)),null;if(!V)return l.error(new Je(qe.EDGE_TARGET_MISSING,g.value.id,g.value.target)),null;if(!g.value||g.value.hidden||C.hidden||V.hidden)return null;let J;i.value===Bt.Strict?J=C.handleBounds.source:J=[...C.handleBounds.source||[],...C.handleBounds.target||[]];const ge=Jc(J,g.value.sourceHandle);let we;i.value===Bt.Strict?we=V.handleBounds.target:we=[...V.handleBounds.target||[],...V.handleBounds.source||[]];const Ne=Jc(we,g.value.targetHandle),_e=(ge==null?void 0:ge.position)||Se.Bottom,Ce=(Ne==null?void 0:Ne.position)||Se.Top,{x:Te,y:De}=Dn(C,ge,_e),{x:E,y:T}=Dn(V,Ne,Ce);return g.value.sourceX=Te,g.value.sourceY=De,g.value.targetX=E,g.value.targetY=T,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ae.value===!1?"default":g.value.type||"default"}`,s.value,G.value,{updating:z.value,selected:g.value.selected,animated:g.value.animated,inactive:!k.value&&!A.value.edgeClick.hasListeners()}],tabIndex:R.value?0:void 0,"aria-label":g.value.ariaLabel===null?void 0:g.value.ariaLabel??`Edge from ${g.value.source} to ${g.value.target}`,"aria-describedby":R.value?`${Vc}-${t}`:void 0,"aria-roledescription":"edge",role:R.value?"group":"img",...g.value.domAttributes,onClick:ce,onContextmenu:ye,onDblclick:ke,onMouseenter:Re,onMousemove:xe,onMouseleave:pe,onKeyDown:R.value?w:void 0},[F.value?null:n.h(ae.value===!1?c.value.default:ae.value,{id:e.id,sourceNode:C,targetNode:V,source:g.value.source,target:g.value.target,type:g.value.type,updatable:W.value,selected:g.value.selected,animated:g.value.animated,label:g.value.label,labelStyle:g.value.labelStyle,labelShowBg:g.value.labelShowBg,labelBgStyle:g.value.labelBgStyle,labelBgPadding:g.value.labelBgPadding,labelBgBorderRadius:g.value.labelBgBorderRadius,data:g.value.data,events:{...g.value.events,...te},style:H.value,markerStart:`url('#${ko(g.value.markerStart,t)}')`,markerEnd:`url('#${ko(g.value.markerEnd,t)}')`,sourcePosition:_e,targetPosition:Ce,sourceX:Te,sourceY:De,targetX:E,targetY:T,sourceHandleId:g.value.sourceHandle,targetHandleId:g.value.targetHandle,interactionWidth:g.value.interactionWidth,...Y}),[W.value==="source"||W.value===!0?[n.h("g",{onMousedown:X,onMouseenter:q,onMouseout:le},n.h($d,{position:_e,centerX:Te,centerY:De,radius:a.value,type:"source","data-type":"source"}))]:null,W.value==="target"||W.value===!0?[n.h("g",{onMousedown:K,onMouseenter:q,onMouseout:le},n.h($d,{position:Ce,centerX:E,centerY:T,radius:a.value,type:"target","data-type":"target"}))]:null]])};function q(){z.value=!0}function le(){z.value=!1}function me(C,V){N.update({event:C,edge:g.value,connection:V})}function he(C){N.updateEnd({event:C,edge:g.value}),F.value=!1}function se(C,V){C.button===0&&(F.value=!0,ne.value=V?g.value.target:g.value.source,re.value=(V?g.value.targetHandle:g.value.sourceHandle)??null,L.value=V?"target":"source",N.updateStart({event:C,edge:g.value}),v(C))}function ce(C){var V;const Y={event:C,edge:g.value};k.value&&(r.value=!1,g.value.selected&&m.value?(d([g.value]),(V=oe.value)==null||V.blur()):o([g.value])),N.click(Y)}function ye(C){N.contextMenu({event:C,edge:g.value})}function ke(C){N.doubleClick({event:C,edge:g.value})}function Re(C){N.mouseEnter({event:C,edge:g.value})}function xe(C){N.mouseMove({event:C,edge:g.value})}function pe(C){N.mouseLeave({event:C,edge:g.value})}function X(C){se(C,!0)}function K(C){se(C,!1)}function w(C){var V;!p.value&&Ac.includes(C.key)&&k.value&&(C.key==="Escape"?((V=oe.value)==null||V.blur(),d([u(e.id)])):o([u(e.id)]))}}}),F0=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}=Le(),h=(e=n.inject(Ri))==null?void 0:e["connection-line"],m=n.computed(()=>{var A;return f((A=i.value)==null?void 0:A.nodeId)}),p=n.computed(()=>{var A;return f((A=a.value)==null?void 0:A.nodeId)??null}),y=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),b=n.computed(()=>c.value.markerStart?`url(#${ko(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${ko(c.value.markerEnd,t)})`:"");return()=>{var A,g,N;if(!m.value||!i.value)return null;const te=i.value.id,S=i.value.type,O=m.value.handleBounds;let z=(O==null?void 0:O[S])??[];if(o.value===Bt.Loose){const H=(O==null?void 0:O[S==="source"?"target":"source"])??[];z=[...z,...H]}if(!z)return null;const F=(te?z.find(H=>H.id===te):z[0])??null,ne=(F==null?void 0:F.position)??Se.Top,{x:re,y:L}=Dn(m.value,F,ne);let oe=null;p.value&&(o.value===Bt.Strict?oe=((A=p.value.handleBounds[S==="source"?"target":"source"])==null?void 0:A.find(H=>{var ae;return H.id===((ae=a.value)==null?void 0:ae.id)}))||null:oe=((g=[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]])==null?void 0:g.find(H=>{var ae;return H.id===((ae=a.value)==null?void 0:ae.id)}))||null);const k=((N=a.value)==null?void 0:N.position)??(ne?fl[ne]:null);if(!ne||!k)return null;const W=r.value??c.value.type??ln.Bezier;let R="";const G={sourceX:re,sourceY:L,sourcePosition:ne,targetX:y.value.x,targetY:y.value.y,targetPosition:k};return W===ln.Bezier?[R]=_d(G):W===ln.Step?[R]=gl({...G,borderRadius:0}):W===ln.SmoothStep?[R]=gl(G):W===ln.SimpleBezier?[R]=wd(G):R=`M${re},${L} ${y.value.x},${y.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:re,sourceY:L,sourcePosition:ne,targetX:y.value.x,targetY:y.value.y,targetPosition:k,sourceNode:m.value,sourceHandle:F,targetNode:p.value,targetHandle:oe,markerEnd:_.value,markerStart:b.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":b.value})))}}}),G0=["id","markerWidth","markerHeight","markerUnits","orient"],Y0={name:"MarkerType",compatConfig:{MODE:3}},W0=n.defineComponent({...Y0,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(ol).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(ol).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,G0))}}),K0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},q0={name:"MarkerDefinitions",compatConfig:{MODE:3}},X0=n.defineComponent({...q0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Le(),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",K0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(W0,{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))])]))}}),j0={name:"Edges",compatConfig:{MODE:3}},Z0=n.defineComponent({...j0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Le();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(X0),(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(Eb)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(H0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(F0))],64))}}),J0=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:l,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:m,disableKeyboardA11y:p,ariaLiveMessage:y,snapToGrid:b,snapGrid:_,nodeDragThreshold:A,nodesDraggable:g,elementsSelectable:N,nodesConnectable:te,nodesFocusable:S,hooks:O}=Le(),z=n.ref(null);n.provide(dd,z),n.provide(cd,e.id);const F=n.inject(Ri),ne=n.getCurrentInstance(),re=pd(),{node:L,parentNode:oe}=md(e.id),{emit:k,on:W}=Ub(L,r),R=n.toRef(()=>typeof L.draggable>"u"?g.value:L.draggable),G=n.toRef(()=>typeof L.selectable>"u"?N.value:L.selectable),H=n.toRef(()=>typeof L.connectable>"u"?te.value:L.connectable),ae=n.toRef(()=>typeof L.focusable>"u"?S.value:L.focusable),v=n.computed(()=>G.value||R.value||O.value.nodeClick.hasListeners()||O.value.nodeDoubleClick.hasListeners()||O.value.nodeMouseEnter.hasListeners()||O.value.nodeMouseMove.hasListeners()||O.value.nodeMouseLeave.hasListeners()),q=n.toRef(()=>!!L.dimensions.width&&!!L.dimensions.height),le=n.computed(()=>{const V=L.type||"default",Y=F==null?void 0:F[`node-${V}`];if(Y)return Y;let J=L.template||f.value[V];if(typeof J=="string"&&ne){const ge=Object.keys(ne.appContext.components);ge&&ge.includes(V)&&(J=n.resolveComponent(V,!1))}return J&&typeof J!="string"?J:(r.error(new Je(qe.NODE_TYPE_MISSING,J)),!1)}),me=ud({id:e.id,el:z,disabled:()=>!R.value,selectable:G,dragHandle:()=>L.dragHandle,onStart(V){k.dragStart(V)},onDrag(V){k.drag(V)},onStop(V){k.dragStop(V)},onClick(V){w(V)}}),he=n.computed(()=>L.class instanceof Function?L.class(L):L.class),se=n.computed(()=>{const V=(L.style instanceof Function?L.style(L):L.style)||{},Y=L.width instanceof Function?L.width(L):L.width,J=L.height instanceof Function?L.height(L):L.height;return!V.width&&Y&&(V.width=typeof Y=="string"?Y:`${Y}px`),!V.height&&J&&(V.height=typeof J=="string"?J:`${J}px`),V}),ce=n.toRef(()=>Number(L.zIndex??se.value.zIndex??0));return u(V=>{(V.includes(e.id)||!V.length)&&ke()}),n.onMounted(()=>{n.watch(()=>L.hidden,(V=!1,Y,J)=>{!V&&z.value&&(e.resizeObserver.observe(z.value),J(()=>{z.value&&e.resizeObserver.unobserve(z.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>L.type,()=>L.sourcePosition,()=>L.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:z.value,forceUpdate:!0}])})}),n.watch([()=>L.position.x,()=>L.position.y,()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.x},()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.y},()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.z},ce,()=>L.selected,()=>L.dimensions.height,()=>L.dimensions.width,()=>{var V;return(V=oe.value)==null?void 0:V.dimensions.height},()=>{var V;return(V=oe.value)==null?void 0:V.dimensions.width}],([V,Y,J,ge,we,Ne])=>{const _e={x:V,y:Y,z:Ne+(m.value&&L.selected?1e3:0)};typeof J<"u"&&typeof ge<"u"?L.computedPosition=yb({x:J,y:ge,z:we},_e):L.computedPosition=_e},{flush:"post",immediate:!0}),n.watch([()=>L.extent,h],([V,Y],[J,ge])=>{(V!==J||Y!==ge)&&ye()}),L.extent==="parent"||typeof L.extent=="object"&&"range"in L.extent&&L.extent.range==="parent"?Ba(()=>q).toBe(!0).then(ye):ye(),()=>L.hidden?null:n.h("div",{ref:z,"data-id":L.id,class:["vue-flow__node",`vue-flow__node-${le.value===!1?"default":L.type||"default"}`,{[o.value]:R.value,dragging:me==null?void 0:me.value,draggable:R.value,selected:L.selected,selectable:G.value,parent:L.isParent},he.value],style:{visibility:q.value?"visible":"hidden",zIndex:L.computedPosition.z??ce.value,transform:`translate(${L.computedPosition.x}px,${L.computedPosition.y}px)`,pointerEvents:v.value?"all":"none",...se.value},tabIndex:ae.value?0:void 0,role:ae.value?"group":void 0,"aria-describedby":p.value?void 0:`${Rc}-${t}`,"aria-label":L.ariaLabel,"aria-roledescription":"node",...L.domAttributes,onMouseenter:Re,onMousemove:xe,onMouseleave:pe,onContextmenu:X,onClick:w,onDblclick:K,onKeydown:C},[n.h(le.value===!1?f.value.default:le.value,{id:L.id,type:L.type,data:L.data,events:{...L.events,...W},selected:L.selected,resizing:L.resizing,dragging:me.value,connectable:H.value,position:L.computedPosition,dimensions:L.dimensions,isValidTargetPos:L.isValidTargetPos,isValidSourcePos:L.isValidSourcePos,parent:L.parentNode,parentNodeId:L.parentNode,zIndex:L.computedPosition.z??ce.value,targetPosition:L.targetPosition,sourcePosition:L.sourcePosition,label:L.label,dragHandle:L.dragHandle,onUpdateNodeInternals:ke})]);function ye(){const V=L.computedPosition,{computedPosition:Y,position:J}=cl(L,b.value?Ci(V,_.value):V,r.error,h.value,oe.value);(L.computedPosition.x!==Y.x||L.computedPosition.y!==Y.y)&&(L.computedPosition={...L.computedPosition,...Y}),(L.position.x!==J.x||L.position.y!==J.y)&&(L.position=J)}function ke(){z.value&&d([{id:e.id,nodeElement:z.value,forceUpdate:!0}])}function Re(V){me!=null&&me.value||k.mouseEnter({event:V,node:L})}function xe(V){me!=null&&me.value||k.mouseMove({event:V,node:L})}function pe(V){me!=null&&me.value||k.mouseLeave({event:V,node:L})}function X(V){return k.contextMenu({event:V,node:L})}function K(V){return k.doubleClick({event:V,node:L})}function w(V){G.value&&(!i.value||!R.value||A.value>0)&&ml(L,l.value,c,s,a,!1,z.value),k.click({event:V,node:L})}function C(V){if(!(il(V)||p.value))if(Ac.includes(V.key)&&G.value){const Y=V.key==="Escape";ml(L,l.value,c,s,a,Y,z.value)}else R.value&&L.selected&&Mn[V.key]&&(V.preventDefault(),y.value=`Moved selected node ${V.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~L.position.x}, y: ${~~L.position.y}`,re({x:Mn[V.key].x,y:Mn[V.key].y},V.shiftKey))}}});function Q0(e={includeHiddenNodes:!1}){const{nodes:t}=Le();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 e1={class:"vue-flow__nodes vue-flow__container"},t1={name:"Nodes",compatConfig:{MODE:3}},n1=n.defineComponent({...t1,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Le(),a=Q0(),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",e1,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const h=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,h))return f;const m=(n.openBlock(),n.createBlock(n.unref(J0),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return m.memo=h,m},s,0),128)):n.createCommentVNode("",!0)]))}});function o1(){const{emits:e}=Le();n.onMounted(()=>{if(od()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Je(qe.MISSING_STYLES))}})}const i1=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),a1={name:"VueFlow",compatConfig:{MODE:3}},l1=n.defineComponent({...a1,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=Da(i,"modelValue",o),r=Da(i,"nodes",o),s=Da(i,"edges",o),c=Le(i),d=Yb({modelValue:l,nodes:r,edges:s},i,c);return Kb(o,c.hooks),P0(),o1(),n.provide(Ri,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(T0,null,{default:n.withCtx(()=>[n.createVNode(Z0),i1,n.createVNode(n1),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(L0)],512))}}),r1={name:"Panel",compatConfig:{MODE:3}},xd=n.defineComponent({...r1,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Le(),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"],Id={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function s1(e){return typeof e=="string"&&e in Id}const c1={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},d1=.15;function u1(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 f1(e){if(typeof e!="string")return null;const t=u1(e);if(!t||t.s<d1)return null;let o=null,i=1/0;for(const a of fn){const l=Math.abs(t.h-c1[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(s1(t))return t;const o=e==null?void 0:e.properties;return f1((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function _l(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const m1={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)"},p1={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 Sd(e,t=!1){return e?t?p1[e]:m1[e]:null}function On(e){return Id[e]}function Ln(e){return`var(--em-swatch-${e}-bar)`}const h1=["width","height","innerHTML"],y1=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,h1))}}),Ue=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ue(y1,[["__scopeId","data-v-92c1dba8"]]),g1={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",g1,[(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"},_1={class:"em-mlang__tabs",role:"tablist"},k1=["aria-selected","onClick"],w1={key:0,class:"em-mlang__dot"},kl=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",b1,[n.createElementVNode("div",_1,[(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",w1,"•")):n.createCommentVNode("",!0)],10,k1))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ie.BSTextArea),{key:0,name:`${e.name}-${l.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`${e.name}-${l.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),E1=["disabled"],v1={class:"em-panel__sub-label"},N1={class:"em-field"},$1={class:"em-field"},x1={class:"em-field"},I1={class:"em-class"},S1={class:"em-field"},C1={class:"em-field"},R1={class:"em-field"},V1={class:"em-field"},A1={class:"em-multilang"},T1={class:"em-multilang"},M1={class:"em-jpa"},B1={class:"em-field"},D1={class:"em-field"},O1={class:"em-field"},L1={class:"em-swatch"},P1={class:"em-swatch__row"},z1=["title","onClick"],Cd=Ue(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(L=>L.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(L=>L.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var L;return it(((L=r.value)==null?void 0:L.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=L=>L;function h(L){return L==="inherit"?"기본(따름)":L}function m(L){l.value&&a.updateEntity(l.value.modelId,L)}function p(L,oe,k){var R;const W=((R=l.value)==null?void 0:R.table)??{physicalName:""};m(L==="physicalName"?{table:{...W,physicalName:k}}:{table:{...W,logicalName:{...W.logicalName,[oe]:k}}})}function y(L){m({description:Object.keys(L).length?L:void 0})}function b(L,oe){var k;m({jpaAttrs:{...(k=l.value)==null?void 0:k.jpaAttrs,[L]:oe}})}function _(L,oe){b(L,oe)}const A=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),g=n.computed(()=>{var L,oe;return!((oe=(L=l.value)==null?void 0:L.jpaAttrs)!=null&&oe.useDiscriminator)});function N(L){b("discriminatorType",L==="inherit"?void 0:L)}function te(L){m({hasPersonalInfo:L})}function S(L){m({superClass:L.trim()||void 0})}function O(L){m({schema:L.trim()||void 0})}function z(L){m({abstractClass:L})}const F=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function ne(L){const oe=L.split(",").map(k=>k.trim()).filter(Boolean);m({declarationOfInterfaces:oe.length?oe:void 0})}function re(L){l.value&&a.setEntitySwatch(l.value.modelId,L)}return(L,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",v1,[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",N1,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=G=>m({name:G}))},null,8,["model-value"])]),n.createElementVNode("label",$1,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=G=>m({stereotype:G}))},null,8,["model-value"])]),n.createElementVNode("label",x1,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=G=>m({packageName:G}))},null,8,["model-value"])]),n.createElementVNode("fieldset",I1,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",S1,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=G=>S(G))},null,8,["model-value"])]),n.createElementVNode("label",C1,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":F.value,"onUpdate:modelValue":oe[5]||(oe[5]=G=>ne(G))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=G=>z(G))},null,8,["model-value"])]),n.createElementVNode("label",R1,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-table",width:"100%","model-value":((k=l.value.table)==null?void 0:k.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=G=>p("physicalName",null,G))},null,8,["model-value"])]),n.createElementVNode("label",V1,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=G=>O(G))},null,8,["model-value"])]),n.createElementVNode("fieldset",A1,[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 H,ae;return n.openBlock(),n.createElementBlock("label",{key:G,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(G),1),n.createVNode(n.unref(ie.BSTextInput),{name:`ent-logical-${G}`,width:"100%","model-value":((ae=(H=l.value.table)==null?void 0:H.logicalName)==null?void 0:ae[G])??"","onUpdate:modelValue":v=>p("logicalName",G,v)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",T1,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":y},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",M1,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,G=>{var H;return n.createVNode(n.unref(ie.BSCheckbox),{key:G.key,name:`jpa-${G.key}`,class:"em-check",label:G.label,"model-value":!!((H=l.value.jpaAttrs)!=null&&H[G.key]),"onUpdate:modelValue":ae=>_(G.key,ae)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",B1,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:g.value,"model-value":((W=l.value.jpaAttrs)==null?void 0:W.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=G=>b("discriminatorColumnName",G.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",D1,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ie.BSSelect),{disabled:g.value,"model-value":A.value,items:u,"value-provider":f,"label-provider":h,"onUpdate:modelValue":oe[10]||(oe[10]=G=>G&&N(G))},null,8,["disabled","model-value"])]),n.createElementVNode("label",O1,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ie.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:g.value,"model-value":(R=l.value.jpaAttrs)==null?void 0:R.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=G=>b("discriminatorLength",G||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!l.value.hasPersonalInfo,"onUpdate:modelValue":te},null,8,["model-value"]),n.createElementVNode("fieldset",L1,[oe[27]||(oe[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",P1,[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=>re(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:H=>re(G)},null,14,z1))),128))])])],64)):n.createCommentVNode("",!0)],8,E1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),Rd=["ko","en","ja","zh"];function U1(e){if(e)for(const t of Rd){const o=e[t];if(o)return o}}function wl(e){const t=U1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function H1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Rd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const F1=["aria-expanded"],G1=["aria-selected","onClick","onMouseenter"],Y1={key:0,class:"gcc__opt gcc__opt--empty"},Vd=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(z=>z.groupCode===o.modelValue)),h=n.computed(()=>f.value?wl(f.value):"");n.watch(h,z=>{c.value||(s.value=z)},{immediate:!0});const m=n.computed(()=>s.value===h.value?o.items:H1(o.items,s.value));function p(){var F;const z=(F=a.value)==null?void 0:F.getBoundingClientRect();z&&(u.value={left:`${z.left}px`,top:`${z.bottom}px`,width:`${z.width}px`})}function y(){c.value=!0,p(),d.value=Math.max(0,m.value.findIndex(z=>z.groupCode===o.modelValue)),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),document.addEventListener("mousedown",O)}function b(){c.value=!1,window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p),document.removeEventListener("mousedown",O)}n.onBeforeUnmount(b);function _(){y(),n.nextTick(()=>{var z;return(z=l.value)==null?void 0:z.select()})}function A(){c.value||y(),d.value=0}function g(z){i("update:modelValue",z.groupCode),s.value=wl(z),b()}function N(){i("update:modelValue",void 0),s.value="",b()}function te(){s.value.trim()===""?N():(s.value=h.value,b())}function S(z){var F;if(z.key==="ArrowDown")c.value||y(),d.value=Math.min(d.value+1,m.value.length-1),z.preventDefault();else if(z.key==="ArrowUp")d.value=Math.max(d.value-1,0),z.preventDefault();else if(z.key==="Enter"){const ne=m.value[d.value];ne&&g(ne),z.preventDefault()}else z.key==="Escape"&&(s.value=h.value,b(),(F=l.value)==null||F.blur())}function O(z){var ne,re;const F=z.target;!((ne=a.value)!=null&&ne.contains(F))&&!((re=r.value)!=null&&re.contains(F))&&te()}return(z,F)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":F[0]||(F[0]=ne=>s.value=ne),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:A,onKeydown:S},null,40,F1),[[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:F[1]||(F[1]=n.withModifiers(()=>{},["prevent"])),onClick:N},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(ne,re)=>(n.openBlock(),n.createElementBlock("li",{key:ne.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":re===d.value,"is-selected":ne.groupCode===e.modelValue}]),role:"option","aria-selected":ne.groupCode===e.modelValue,onMousedown:F[2]||(F[2]=n.withModifiers(()=>{},["prevent"])),onClick:L=>g(ne),onMouseenter:L=>d.value=re},n.toDisplayString(n.unref(wl)(ne)),43,G1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Y1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),W1=["disabled"],K1={class:"em-aw__toolbar"},q1={class:"em-aw__count"},X1={class:"em-aw__scroll"},j1={class:"em-aw__table"},Z1={key:0,class:"c-code"},J1=["colspan"],Q1={class:"c-del"},e_={class:"c-flag"},t_={class:"c-flag"},n_={class:"c-flag"},o_={class:"c-flag"},i_={class:"c-flag"},a_={class:"c-flag"},l_={class:"c-flag"},r_={class:"c-flag"},s_={key:0},c_=["title"],d_=["colspan"],u_={class:"c-del"},f_={class:"em-aw__embed-label"},m_={class:"em-aw__ro"},p_={class:"em-aw__ro"},h_={class:"em-aw__ro"},y_={class:"em-aw__ro"},g_={colspan:"8"},b_=["colspan"],__={key:0},k_="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Li="__OWN__",w_=Ue(n.defineComponent({__name:"EntityAttributesWide",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.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(M=>M.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(I){return I==="none"?"(없음)":I}const u=I=>I;function f(I,M){i.value&&o.updateAttribute(i.value.modelId,I.modelId,M)}function h(I){return!!i.value&&!!ti(o.state.logical,i.value.modelId,I.modelId)}function m(I,M){f(I,{naturalId:M||void 0,naturalIdMutable:M?I.naturalIdMutable:void 0})}function p(){return{naturalId:void 0,naturalIdMutable:void 0}}function y(I,M){f(I,{identifier:M,...M?p():{}})}function b(I,M){f(I,{transient:M||void 0,...M?p():{}})}function _(I){return!!I.transient}const A=I=>I.value,g=I=>I.label;function N(I,M){if(!M)return;const B=re.value.find(de=>de.type===M);if(B){const de=I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"};f(I,{type:M,customType:void 0,dbAttrs:[{...de,dataType:B.dataType,length:B.length,scale:B.scale}]});return}f(I,M===zt?{type:M}:{type:M,customType:void 0})}function te(I,M){f(I,{customType:M.trim()===""?void 0:M})}function S(I,M){const de={...I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"},...M};M.dataType!==void 0&&!Go.has(de.dataType)&&(de.scale=void 0),f(I,{dbAttrs:[de]})}function O(I){var M;return Go.has(((M=I.dbAttrs[0])==null?void 0:M.dataType)??"")}function z(I,M,B){var de;S(I,{logicalName:{...(de=I.dbAttrs[0])==null?void 0:de.logicalName,[M]:B}})}function F(I){return I.personalInfoAttributeType??"none"}function ne(I,M){f(I,{personalInfoAttributeType:M==="none"?void 0:M})}const re=n.computed(()=>o.predefinedCustomTypeCatalog.value),L=n.computed(()=>o.embeddableCatalog.value);function oe(I){var M,B;return((M=I.label)==null?void 0:M.ko)??((B=I.label)==null?void 0:B.en)??I.type}function k(I){!I||!i.value||o.addPredefinedEmbed(i.value.modelId,I)}const W=n.computed(()=>o.groupCodeCatalog.value);function R(I){var M;return((M=W.value.find(B=>B.groupCode===I.groupCode))==null?void 0:M.codes)??[]}function G(I){return["none",...R(I)]}function H(I){return I==="none"?"none":I.code}function ae(I){var B,de;if(I==="none")return"(없음)";const M=((B=I.label)==null?void 0:B.ko)??((de=I.label)==null?void 0:de.en);return M?`${I.code} (${M})`:I.code}function v(I,M){i.value&&o.setAttributeGroupCode(i.value.modelId,I.modelId,M)}function q(I,M){f(I,{defaultValue:M==="none"?void 0:M})}function le(I,M){f(I,{defaultValue:M.trim()===""?void 0:M})}function me(I){return I.attrType.startsWith("EMBED")&&I.dbAttrs.length>0}function he(I,M,B){const de=I.dbAttrs.map((be,Q)=>{if(Q!==M)return be;const Z={...be,...B};for(const j of Object.keys(B))B[j]===void 0&&delete Z[j];return Z});i.value&&o.setEmbedColumns(i.value.modelId,I.modelId,de)}function se(I,M,B,de){var be;he(I,M,{logicalName:{...(be=I.dbAttrs[M])==null?void 0:be.logicalName,[B]:de}})}function ce(I,M){var be,Q,Z;if(I.attrType==="EMBED_PREDEF"){const j=(be=o.embeddableCatalog.value.find(ue=>ue.type===I.type))==null?void 0:be.fields[M];return j?{name:j.name,physicalName:j.physicalName,dataType:j.dataType,length:j.length,shareable:j.shareable,logicalName:j.logicalName}:void 0}const B=(Q=I.embedded)==null?void 0:Q.embeddableRef;if(!B)return;const de=(Z=o.state.logical.entities.find(j=>j.modelId===B))==null?void 0:Z.attributes.flatMap(j=>j.dbAttrs)[M];return de?{physicalName:de.physicalName,dataType:de.dataType,length:de.length,scale:de.scale,logicalName:de.logicalName}:void 0}function ye(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.dataType)||((de=I.dbAttrs[M])==null?void 0:de.dataType)||""}function ke(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.length)??((de=I.dbAttrs[M])==null?void 0:de.length)}function Re(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.scale)??((de=I.dbAttrs[M])==null?void 0:de.scale)}const xe=["inherit","true","false"];function pe(I){return I==="inherit"?"기본(따름)":I}function X(I){return(I==null?void 0:I.updatable)===void 0?"inherit":I.updatable?"true":"false"}function K(I,M,B){he(I,M,{updatable:B==="inherit"?void 0:B==="true"})}function w(I,M){S(I,{updatable:M==="inherit"?void 0:M==="true"})}const C=["inherit","true","false"];function V(I){return I==="inherit"?"기본(따름)":I}function Y(I){return(I==null?void 0:I.insertable)===void 0?"inherit":I.insertable?"true":"false"}function J(I,M,B){he(I,M,{insertable:B==="inherit"?void 0:B==="true"})}function ge(I,M){S(I,{insertable:M==="inherit"?void 0:M==="true"})}const we=n.computed(()=>{var I;return Xn(((I=i.value)==null?void 0:I.attributes.flatMap(M=>M.dbAttrs))??[])}),Ne=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(M=>M.attrType==="NORMAL"&&M.dbAttrs.length===1&&M.dbAttrs[0]).map(M=>({modelId:M.dbAttrs[0].modelId,label:M.dbAttrs[0].physicalName||M.name}))});function _e(){return[Li,...Ne.value.map(I=>I.modelId)]}function Ce(I){if(I===Li)return"전용 컬럼(OWN)";const M=Ne.value.find(B=>B.modelId===I);return M?`↗ ${M.label} (공유)`:I}function Te(I){return(I==null?void 0:I.sharedColumnRef)??Li}function De(I,M,B){he(I,M,{sharedColumnRef:B===Li?void 0:B})}function E(I){return(I==null?void 0:I.sharedColumnRef)!=null}function T(I){var M;return((M=Yo(I,we.value))==null?void 0:M.physicalName)??""}return(I,M)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",K1,[n.createElementVNode("span",q1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:M[0]||(M[0]=B=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"구분선",onClick:M[1]||(M[1]=B=>n.unref(o).addDivider(i.value.modelId))}),L.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:L.value,"value-provider":B=>B.type,"label-provider":oe,"onUpdate:modelValue":k},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",X1,[n.createElementVNode("table",j1,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[M[2]||(M[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),M[3]||(M[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),M[4]||(M[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),M[5]||(M[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),M[6]||(M[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),M[7]||(M[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),M[8]||(M[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),M[9]||(M[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),M[10]||(M[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),M[11]||(M[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),M[12]||(M[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),M[13]||(M[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),M[14]||(M[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),M[15]||(M[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),M[16]||(M[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),M[17]||(M[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),M[18]||(M[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),M[19]||(M[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),W.value.length?(n.openBlock(),n.createElementBlock("th",Z1,"코드그룹")):n.createCommentVNode("",!0),M[20]||(M[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),M[21]||(M[21]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,B=>{var de,be,Q,Z,j,ue,x,D,$,U,P;return n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,J1),n.createElementVNode("td",Q1,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2)):me(B)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:W.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(B.dbAttrs.length)+"개",9,d_),n.createElementVNode("td",u_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(ee,fe)=>{var Ie,Be,Me,Ke,Ge,Qe,Ye;return n.openBlock(),n.createElementBlock("tr",{key:ee.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",f_,"↳ "+n.toDisplayString(((Ie=ce(B,fe))==null?void 0:Ie.name)??((Be=ce(B,fe))==null?void 0:Be.physicalName)??`컬럼 ${fe+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",m_,n.toDisplayString(ye(B,fe)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-logical-${ee.modelId}`,width:"100%",placeholder:((Ke=(Me=ce(B,fe))==null?void 0:Me.logicalName)==null?void 0:Ke.ko)??"논리명","model-value":((Ge=ee.logicalName)==null?void 0:Ge.ko)??"","onUpdate:modelValue":Pe=>se(B,fe,"ko",Pe)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-col-${ee.modelId}`,width:"100%",disabled:E(ee),placeholder:((Qe=ce(B,fe))==null?void 0:Qe.physicalName)??"컬럼","model-value":E(ee)?T(ee):ee.physicalName,"onUpdate:modelValue":Pe=>he(B,fe,{physicalName:Pe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":ee.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",p_,n.toDisplayString(ye(B,fe)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",h_,n.toDisplayString(ke(B,fe)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",y_,n.toDisplayString(Re(B,fe)??""),1)]),n.createElementVNode("td",g_,[(Ye=ce(B,fe))!=null&&Ye.shareable?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":Te(ee),items:_e(),"value-provider":u,"label-provider":Ce,"onUpdate:modelValue":Pe=>Pe&&De(B,fe,Pe)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:E(ee),"model-value":E(ee)?"false":Y(ee),items:C,"value-provider":u,"label-provider":V,"onUpdate:modelValue":Pe=>Pe&&J(B,fe,Pe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:E(ee),"model-value":E(ee)?"false":X(ee),items:xe,"value-provider":u,"label-provider":pe,"onUpdate:modelValue":Pe=>Pe&&K(B,fe,Pe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:W.value.length?4:3},null,8,b_)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(B.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:"타입",disabled:!!B.groupCode,items:n.unref(ur)(B.type,re.value),"value-provider":A,"label-provider":g,"model-value":B.type,"onUpdate:modelValue":ee=>N(B,ee)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),B.type===n.unref(zt)?(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":B.customType??"","onUpdate:modelValue":ee=>te(B,ee)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-logical-${B.modelId}`,width:"100%",placeholder:"논리명","model-value":((be=(de=B.dbAttrs[0])==null?void 0:de.logicalName)==null?void 0:be.ko)??"","onUpdate:modelValue":ee=>z(B,"ko",ee)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:"컬럼",disabled:_(B),"model-value":((Q=B.dbAttrs[0])==null?void 0:Q.physicalName)??"","onUpdate:modelValue":ee=>S(B,{physicalName:ee})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Z=B.dbAttrs[0])==null?void 0:Z.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:_(B),items:n.unref(cr)(((j=B.dbAttrs[0])==null?void 0:j.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(_a),"model-value":((ue=B.dbAttrs[0])==null?void 0:ue.dataType)??"","onUpdate:modelValue":ee=>ee&&S(B,{dataType:ee})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:_(B),"model-value":(x=B.dbAttrs[0])==null?void 0:x.length,"onUpdate:modelValue":ee=>S(B,{length:ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"100%",placeholder:"scale",disabled:_(B)||!O(B),"model-value":(D=B.dbAttrs[0])==null?void 0:D.scale,"onUpdate:modelValue":ee=>S(B,{scale:ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",e_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-pk-${B.modelId}`,"model-value":B.identifier,disabled:a.value||_(B),"onUpdate:modelValue":ee=>y(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",t_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nn-${B.modelId}`,"model-value":B.notNull,disabled:_(B),"onUpdate:modelValue":ee=>f(B,{notNull:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",n_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-uq-${B.modelId}`,"model-value":!!(($=B.dbAttrs[0])!=null&&$.unique),disabled:_(B),"onUpdate:modelValue":ee=>S(B,{unique:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",o_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-ai-${B.modelId}`,"model-value":!!((U=B.dbAttrs[0])!=null&&U.autoIncrement),disabled:_(B)||!B.identifier,"onUpdate:modelValue":ee=>S(B,{autoIncrement:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",i_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-tr-${B.modelId}`,"model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":ee=>b(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",a_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nid-${B.modelId}`,"model-value":!!B.naturalId,disabled:B.identifier||_(B),"onUpdate:modelValue":ee=>m(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",l_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nidm-${B.modelId}`,"model-value":!!B.naturalIdMutable,disabled:_(B)||!B.naturalId,"onUpdate:modelValue":ee=>f(B,{naturalIdMutable:ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",r_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-mv-${B.modelId}`,"model-value":!!((P=B.dbAttrs[0])!=null&&P.multiValue),disabled:_(B),"onUpdate:modelValue":ee=>S(B,{multiValue:ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-ins-${B.modelId}`,width:"100%",disabled:_(B),"model-value":Y(B.dbAttrs[0]),items:C,"value-provider":u,"label-provider":V,"onUpdate:modelValue":ee=>ee&&ge(B,ee)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-upd-${B.modelId}`,width:"100%",disabled:_(B),"model-value":X(B.dbAttrs[0]),items:xe,"value-provider":u,"label-provider":pe,"onUpdate:modelValue":ee=>ee&&w(B,ee)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":F(B),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":ee=>ee&&ne(B,ee)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("td",s_,[n.createVNode(Vd,{"model-value":B.groupCode,items:W.value,"onUpdate:modelValue":ee=>v(B,ee)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[R(B).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":B.defaultValue??"none",items:G(B),"value-provider":H,"label-provider":ae,"onUpdate:modelValue":ee=>ee&&q(B,ee)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"100%",placeholder:"기본값","model-value":B.defaultValue??"","onUpdate:modelValue":ee=>le(B,ee)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",{class:"c-del",title:h(B)?k_:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,c_)],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",__,[...M[22]||(M[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,W1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7e02965"]]),E_=["disabled"],v_={class:"em-idxw__list"},N_={class:"em-idxw__list-head"},$_=["onClick"],x_={class:"em-idxw__item-name"},I_={key:0,class:"em-idxw__badge"},S_={class:"em-idxw__item-cnt"},C_={key:0,class:"em-idxw__empty"},R_={key:0,class:"em-idxw__edit"},V_={class:"em-idxw__form"},A_={class:"em-field em-idxw__name"},T_={class:"em-field"},M_=["value"],B_={class:"em-idxw__transfer"},D_={class:"em-idxw__pane"},O_={class:"em-idxw__pane-head"},L_={class:"em-idxw__cols"},P_=["onClick"],z_={key:0,class:"em-idxw__empty"},U_={class:"em-idxw__arrows"},H_={class:"em-idxw__pane"},F_={class:"em-idxw__pane-head"},G_={class:"em-idxw__cols"},Y_={class:"em-idxw__col-name"},W_={class:"em-idxw__col-ops"},K_=["disabled","onClick"],q_=["disabled","onClick"],X_=["onClick"],j_={key:0,class:"em-idxw__empty"},Z_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},J_=Ue(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(z=>z.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(()=>{var S;return new Set(((S=s.value)==null?void 0:S.columns.map(O=>O.columnRef))??[])}),d=n.computed(()=>l.value.filter(S=>!c.value.has(S.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(S){var z;const O=(z=S.dbAttrs[0])==null?void 0:z.physicalName;return O&&O!==S.name?`${S.name} (${O})`:S.name}function h(S){const O=l.value.find(z=>z.modelId===S);return O?f(O):S}function m(S,O){i.value&&o.updateIndex(i.value.modelId,S,O)}function p(){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 y(S){i.value&&o.removeIndex(i.value.modelId,S)}function b(S){s.value&&m(s.value.modelId,{parameters:S.trim()===""?void 0:S})}function _(S){const O=new Set(u.value);O.has(S)?O.delete(S):O.add(S),u.value=O}function A(){const S=s.value;if(!S||!u.value.size)return;const O=[...u.value].map(z=>({columnRef:z,descending:!1}));m(S.modelId,{columns:[...S.columns,...O]}),u.value=new Set}function g(S){const O=s.value;O&&m(O.modelId,{columns:O.columns.filter((z,F)=>F!==S)})}function N(S,O){const z=s.value;z&&m(z.modelId,{columns:z.columns.map((F,ne)=>ne===S?{...F,descending:O}:F)})}function te(S,O){const z=s.value;if(!z)return;const F=S+O;if(F<0||F>=z.columns.length)return;const ne=[...z.columns];[ne[S],ne[F]]=[ne[F],ne[S]],m(z.modelId,{columns:ne})}return(S,O)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",v_,[n.createElementVNode("div",N_,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:p})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,z=>(n.openBlock(),n.createElementBlock("li",{key:z.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":z.modelId===r.value}]),onClick:F=>r.value=z.modelId},[n.createElementVNode("span",x_,n.toDisplayString(z.name||"(이름 없음)"),1),z.unique?(n.openBlock(),n.createElementBlock("span",I_,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",S_,n.toDisplayString(z.columns.length),1)],10,$_))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",C_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",R_,[n.createElementVNode("div",V_,[n.createElementVNode("label",A_,[O[4]||(O[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":O[0]||(O[0]=z=>m(s.value.modelId,{name:z}))},null,8,["model-value"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":O[1]||(O[1]=z=>m(s.value.modelId,{unique:z}))},null,8,["model-value"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:O[2]||(O[2]=z=>y(s.value.modelId))})]),n.createElementVNode("label",T_,[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]=z=>b(z.target.value))},null,40,M_)]),n.createElementVNode("div",B_,[n.createElementVNode("div",D_,[n.createElementVNode("div",O_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",L_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,z=>(n.openBlock(),n.createElementBlock("li",{key:z.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(z.modelId)}]),onClick:F=>_(z.modelId)},n.toDisplayString(f(z)),11,P_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",z_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",U_,[n.createVNode(n.unref(ie.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:A},null,8,["disabled"])]),n.createElementVNode("div",H_,[n.createElementVNode("div",F_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",G_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(z,F)=>(n.openBlock(),n.createElementBlock("li",{key:F,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",Y_,n.toDisplayString(h(z.columnRef)),1),n.createVNode(n.unref(ie.BSCheckbox),{name:`idxw-desc-${F}`,class:"em-check",label:"DESC","model-value":z.descending,"onUpdate:modelValue":ne=>N(F,ne)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",W_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:F===0,onClick:ne=>te(F,-1)},"↑",8,K_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:F===s.value.columns.length-1,onClick:ne=>te(F,1)},"↓",8,q_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:ne=>g(F)},"✕",8,X_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",j_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",Z_,"인덱스를 선택하거나 추가하세요."))],8,E_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),Q_={class:"em-op-src"},ek={class:"em-op-src__actions"},Ad=Ue(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",Q_,[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",ek,[n.createVNode(n.unref(ie.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-2150d2fc"]]),tk=["disabled"],nk={class:"em-ow__toolbar"},ok={class:"em-ow__count"},ik={class:"em-ow__scroll"},ak={class:"em-ow__table"},lk={class:"c-del"},rk={key:0},sk=Ue(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModal(),a=n.computed(()=>o.state.logical.entities.find(p=>p.modelId===t.entityId)??null),l=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(p){return p==="none"?"(없음)":p}const c=p=>p;function d(p,y){a.value&&o.updateOperation(a.value.modelId,p.modelId,y)}function u(p,y,b){d(p,{description:{...p.description,[y]:b}})}function f(p){return p.personalInfoAttributeType??"none"}function h(p,y){d(p,{personalInfoAttributeType:y==="none"?void 0:y})}function m(p){i.openModal({component:Ad,bind:{operationName:p.name,sourceCode:p.sourceCode??"",onSave:y=>d(p,{sourceCode:y})}})}return(p,y)=>{var b,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",nk,[n.createElementVNode("span",ok,"오퍼레이션 ("+n.toDisplayString(((b=a.value.operations)==null?void 0:b.length)??0)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:y[0]||(y[0]=A=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",ik,[n.createElementVNode("table",ak,[y[2]||(y[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 g;return n.openBlock(),n.createElementBlock("tr",{key:A.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-name-${A.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":A.name,"onUpdate:modelValue":N=>d(A,{name:N})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":A.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":N=>N&&d(A,{visibility:N})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-desc-${A.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((g=A.description)==null?void 0:g.ko)??"","onUpdate:modelValue":N=>u(A,"ko",N)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":f(A),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":N=>N&&h(A,N)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:A.sourceCode?"본문 ●":"본문",onClick:N=>m(A)},null,8,["caption","onClick"])]),n.createElementVNode("td",lk,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:N=>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",rk,[...y[1]||(y[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,tk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),ck={class:"em-detail__tabs"},dk=["onClick"],uk=Ue(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const l=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`엔티티 — ${((d=a.value)==null?void 0:d.name)??""}`},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",ck,[(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,dk)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(Cd,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(w_,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(J_,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(sk,{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 Pi(e,t,o){e.openModal({component:uk,bind:{controller:n.markRaw(t),entityId:o}})}const Td="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function fk(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Oe(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const l=Oe();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Oe()}for(const a of t.indexes??[]){a.modelId=Oe();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const pn=Symbol("editorController");function Md(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function zi(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(Rt(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 mm(e,t,Oe))o.push(...zi(i,a));return o}function Bd(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 El(e,t){const o=to(e,t,Oe),i=zi(t,o),a=Bd(e,t,o);return i.push(...zn(a,t)),i}function Dd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Oe()}))}function mk(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,p)=>Math.max(m,p.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let h="id";for(let m=2;f.has(h);m++)h=`id${m}`;a={modelId:Oe(),name:h,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Oe(),physicalName:h.toLowerCase(),dataType:"BIGINT"}]},i.push(Rt(t,a))}const l=[];for(const u of e.entities)for(const f of u.attributes){if(((d=f.embedded)==null?void 0:d.embeddableRef)!==t)continue;const h=e.associations.find(b=>b.modelId===f.embedded.associationRef);if(!h)continue;const m=h.end1.entityRef===u.modelId,p=m?h.end1:h.end2,y=m?h.end2:h.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:h.modelId,end1:{entityRef:u.modelId,multiplicity:p.multiplicity,navigable:p.navigable,composition:!1},end2:{entityRef:t,multiplicity:y.multiplicity,navigable:y.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 m;return((m=h.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push(xn(u.ownerId,u.dispId)),i.push(Zo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...zi(t,s));const c=Bd(r,t,s);return i.push(...zn(c,t)),i}function pk(e,t){const o=e.entities.find(l=>l.modelId===t);if(!o)return[];const i=[],a=l=>l&&l.charAt(0).toLowerCase()+l.slice(1);for(const l of e.associations){if(l.end1.entityRef===l.end2.entityRef)continue;const r=l.end1.entityRef===t,s=l.end2.entityRef===t;if(!r&&!s)continue;const c=r?l.end2.entityRef:l.end1.entityRef,d=e.entities.find(g=>g.modelId===c);if(!d||d.attributes.some(g=>{var N;return((N=g.embedded)==null?void 0:N.associationRef)===l.modelId}))continue;const u=Oe(),f=d.attributes.reduce((g,N)=>Math.max(g,N.order),-1)+1,h=new Set(d.attributes.map(g=>g.name)),m=a(o.name);let p=m;for(let g=2;h.has(p);g++)p=`${m}${g}`;const y=o.attributes.filter(g=>!g.identifier&&!g.derivedFrom).flatMap(g=>g.dbAttrs).map(g=>({...g,modelId:Oe()})),b={modelId:u,name:p,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(Rt(c,b));const _=r?"end2":"end1",A=r?"end1":"end2";i.push(Zo(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 hk(e=Md(),t={}){var Te,De;const o=n.reactive(e);let i=new Ia(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),h=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),p=n.ref(!1),y=n.ref(!1),b=n.ref(0),_=n.ref(null);let A=0;const g=E=>{if(t.onNotice){t.onNotice(E);return}_.value={text:E,id:++A}},N=n.ref(((Te=t.meta)==null?void 0:Te.schemaVersion)??1),te=n.ref(((De=t.meta)==null?void 0:De.opWriteEnabled)??!1),S=n.computed(()=>N.value>=2&&te.value),O=t.historyTransport,z=n.computed(()=>S.value&&O!==void 0),F=t.restoreTransport,ne=n.ref(0),re=n.computed(()=>S.value&&oe.value&&F!==void 0);async function L(E){if(!F||!oe.value)return{ok:!1,reason:"unavailable"};const T=await F(E);return T.ok&&ne.value++,T}const oe=n.ref(!(N.value>=2&&te.value===!1)),k=n.ref("LOGICAL_PHYSICAL"),W=n.ref("straight"),R=n.ref(!0),G=n.ref(!0),H=n.ref(null),ae=n.computed(()=>{var E;return((E=H.value)==null?void 0:E.kind)==="attribute"?{entityId:H.value.entityId,attrId:H.value.anchor}:null}),v=n.computed(()=>{var E;return((E=H.value)==null?void 0:E.kind)==="attribute"?H.value.ids:[]}),q=n.computed(()=>{var E,T;return((E=H.value)==null?void 0:E.kind)==="entity"?H.value.id:((T=H.value)==null?void 0:T.kind)==="attribute"?H.value.entityId:null}),le=n.ref(null);let me=0;const he=n.ref(null),se=n.ref(null);let ce=t.meta;function ye(){i.onChange(()=>{m.value=i.canUndo,p.value=i.canRedo,y.value=i.isDirty,b.value++})}ye();let ke=null,Re=null;function xe(){Re==null||Re(),Re=null,ke=null}function pe(){if(xe(),!S.value||!t.opTransport)return;const E=new ss({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:T=>{oe.value=!1,se.value=T},onError:t.onOpError});E.seed((ce==null?void 0:ce.revSeed)??{}),Re=E.attach(i),ke=E}pe();const X=n.computed(()=>jl(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(()=>pr(o.logical,K.value)),C=n.computed(()=>{const E=new Map;for(const T of w.value){if(!T.targetRef)continue;const I=E.get(T.targetRef);I?I.push(T):E.set(T.targetRef,[T])}return E}),V=E=>{oe.value&&i.execute(E)},Y=E=>o.layout.entityLayouts.some(T=>T.entityRef===E&&!!T.locked),J=E=>o.layout.groupLayouts.some(T=>T.groupRef===E&&!!T.locked),ge=E=>{const T=o.logical.associations.find(I=>I.modelId===E);return!!T&&(Y(T.end1.entityRef)||Y(T.end2.entityRef))},we=(E,T,I)=>{if(Y(E))return;const M=en(E,T,I),B=Pn(o.logical,E,be=>be.map(Q=>Q.modelId===T?{...Q,...I}:Q)),de=zn(B,E);V(de.length?Fe("속성 수정",[M,...de]):M)};function Ne(E){const T=E.map(Z=>o.layout.entityLayouts.find(j=>j.entityRef===Z)).filter(Z=>!!Z);if(!T.length)return{location:{x:40,y:40},size:{width:400,height:300}};let I=1/0,M=1/0,B=-1/0,de=-1/0;for(const Z of T){const j=Z.geo.size.width||220,ue=Z.geo.size.height||140;I=Math.min(I,Z.geo.location.x),M=Math.min(M,Z.geo.location.y),B=Math.max(B,Z.geo.location.x+j),de=Math.max(de,Z.geo.location.y+ue)}const be=40,Q=28;return{location:{x:I-be,y:M-be-Q},size:{width:B-I+be*2,height:de-M+be*2+Q}}}function _e(E,T,I){var Z;const M=o.layout.groupLayouts.find(j=>j.groupRef===E),B=(M==null?void 0:M.geo.location)??T,de=T.x-B.x,be=T.y-B.y,Q=[Rr(E,T),...I.map(j=>$n(j.id,j.location))];if(de||be){const j=new Set(((Z=o.logical.groups.find(ue=>ue.modelId===E))==null?void 0:Z.memberEntityRefs)??[]);for(const ue of o.logical.associations){if(!j.has(ue.end1.entityRef)||!j.has(ue.end2.entityRef))continue;const x=o.layout.associationLayouts.find(D=>D.associationRef===ue.modelId);x&&x.waypoints.length&&Q.push(Yr(ue.modelId,de,be))}for(const ue of(M==null?void 0:M.memberNoteRefs)??[]){const x=o.layout.notes.find(D=>D.modelId===ue);x&&Q.push(eo(ue,{x:x.geo.location.x+de,y:x.geo.location.y+be}))}}return Q}const Ce={state:o,resolved:X,issues:w,issuesByRef:C,flagEntitiesWithoutRelations:h,canUndo:m,canRedo:p,dirty:y,revision:b,notice:_,editable:oe,schemaVersion:N,opWriteEnabled:te,opMode:S,opConflict:se,historyTransport:O,historyAvailable:z,restoreTransport:F,restoreAvailable:re,restoreToSeq:L,reloadRequest:ne,displayMode:k,routingMode:W,showGrid:R,showMinimap:G,selection:H,selectedAttr:ae,selectedAttrIds:v,inspectedEntityId:q,focusRequest:le,clipboard:he,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(E){oe.value=E&&S.value},setEmbeddableCatalog(E){a.value=E},setGroupCodeCatalog(E){l.value=E},setPredefinedCustomTypeCatalog(E){r.value=E},selectAttribute(E,T,I="replace"){const M=H.value,B=(M==null?void 0:M.kind)==="attribute"&&M.entityId===E;if(I==="replace"||!B){H.value={kind:"attribute",entityId:E,ids:[T],anchor:T};return}if(I==="toggle"){const x=M.ids.includes(T),D=x?M.ids.filter(U=>U!==T):[...M.ids,T];if(!D.length){H.value=null;return}const $=x&&M.anchor===T?D[D.length-1]:x?M.anchor:T;H.value={kind:"attribute",entityId:E,ids:D,anchor:$};return}const de=o.logical.entities.find(x=>x.modelId===E),be=[...(de==null?void 0:de.attributes)??[]].sort((x,D)=>x.order-D.order).map(x=>x.modelId),Q=be.indexOf(M.anchor),Z=be.indexOf(T);if(Q<0||Z<0){H.value={kind:"attribute",entityId:E,ids:[T],anchor:T};return}const[j,ue]=Q<=Z?[Q,Z]:[Z,Q];H.value={kind:"attribute",entityId:E,ids:be.slice(j,ue+1),anchor:M.anchor}},moveAttributeFocus(E){const T=H.value;if((T==null?void 0:T.kind)!=="attribute")return!1;const I=o.logical.entities.find(be=>be.modelId===T.entityId);if(!I||!I.attributes.length)return!1;const M=I.attributes.findIndex(be=>be.modelId===T.anchor);if(M<0)return!1;const B=Math.min(Math.max(M+E,0),I.attributes.length-1);if(B===M)return!0;const de=I.attributes[B].modelId;return H.value={kind:"attribute",entityId:T.entityId,ids:[de],anchor:de},!0},nudgeSelectedAttributes(E){const T=H.value;if((T==null?void 0:T.kind)!=="attribute")return!1;const I=o.logical.entities.find(x=>x.modelId===T.entityId);if(!I)return!1;const M=I.attributes,B=new Set(T.ids),de=M.map((x,D)=>B.has(x.modelId)?D:-1).filter(x=>x>=0);if(!de.length)return!1;const be=Math.min(...de),Q=M.filter(x=>!B.has(x.modelId)),Z=M.slice(0,be).filter(x=>!B.has(x.modelId)).length;let j;if(E<0){if(Z<=0)return!0;j=Z-1}else{if(Q.length-Z<=0)return!0;j=Z+1}if(Y(T.entityId))return!0;const ue=M.filter(x=>B.has(x.modelId)).map(x=>x.modelId);return V(Va(T.entityId,ue,j)),!0},deleteSelection(){if(!oe.value)return!1;const E=H.value;if(!E)return!1;if(E.kind==="attribute"){if(Y(E.entityId))return!1;const T=E.ids;if(!T.length)return!1;T.length===1?Ce.removeAttribute(E.entityId,T[0]):Ce.removeAttributes(E.entityId,T)}else if(E.kind==="entity"){if(Y(E.id))return!1;Ce.removeEntity(E.id)}else if(E.kind==="note")Ce.removeNote(E.id);else if(E.kind==="group"){if(J(E.id))return!1;Ce.removeGroup(E.id)}else Ce.removeAssociation(E.id);return H.value=null,!0},nudgeNodes(E,T,I){if(!E.length||T===0&&I===0)return!1;const M=new Set(o.logical.entities.map(j=>j.modelId)),B=new Set(o.logical.groups.map(j=>j.modelId)),de=new Set(o.layout.notes.map(j=>j.modelId)),be=new Set;for(const j of E){if(!B.has(j))continue;const ue=o.logical.groups.find(x=>x.modelId===j);for(const x of(ue==null?void 0:ue.memberEntityRefs)??[])be.add(x)}const Q=[],Z=[];for(const j of E)if(B.has(j)){if(J(j))continue;const ue=o.layout.groupLayouts.find(U=>U.groupRef===j);if(!ue)continue;const x=o.logical.groups.find(U=>U.modelId===j),D=((x==null?void 0:x.memberEntityRefs)??[]).map(U=>{var ee;const P=((ee=o.layout.entityLayouts.find(fe=>fe.entityRef===U))==null?void 0:ee.geo.location)??{x:0,y:0};return{id:U,location:{x:P.x+T,y:P.y+I}}}),$={x:ue.geo.location.x+T,y:ue.geo.location.y+I};Q.push(Fe("그룹 이동",_e(j,$,D))),Z.push("g:"+j)}else if(M.has(j)){if(be.has(j)||Y(j))continue;const ue=o.layout.entityLayouts.find(x=>x.entityRef===j);if(!ue)continue;Q.push($n(j,{x:ue.geo.location.x+T,y:ue.geo.location.y+I})),Z.push("e:"+j)}else if(de.has(j)){const ue=o.layout.notes.find(x=>x.modelId===j);if(!ue)continue;Q.push(eo(j,{x:ue.geo.location.x+T,y:ue.geo.location.y+I})),Z.push("n:"+j)}return Q.length?(V(Fe("이동",Q,"nudge:"+Z.sort().join(","))),!0):!1},requestFocus(E){le.value={id:E,nonce:++me}},undo:()=>{oe.value&&i.undo()},redo:()=>{oe.value&&i.redo()},markSaved:()=>{oe.value&&(ke==null||ke.flush(),i.markSavePoint())},loadDiagram(E,T){xe(),o.logical=E.logical,o.layout=E.layout,i=new Ia(o),ye(),N.value=(T==null?void 0:T.schemaVersion)??1,te.value=(T==null?void 0:T.opWriteEnabled)??!1,oe.value=!(N.value>=2&&te.value===!1),ce=T,se.value=null,H.value=null,m.value=i.canUndo,p.value=i.canRedo,y.value=i.isDirty,pe()},flush(){ke==null||ke.flush()},whenOpsSettled(){return(ke==null?void 0:ke.whenSettled())??Promise.resolve()},addEntity(E="NewEntity",T={x:80,y:80}){const I=Oe(),M={modelId:I,name:E,stereotype:"JPA_ENTITY",table:{physicalName:E.toLowerCase()},attributes:[{modelId:Oe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Oe(),physicalName:"id",dataType:"BIGINT"}]}]};return V(Sa(M,{location:{...T},size:{width:220,height:140}})),I},renameEntity(E,T){Y(E)||V(Er(E,T))},updateEntity(E,T){if(Y(E))return;const I=wr(E,T),M=o.logical.entities.find(be=>be.modelId===E),B=T.stereotype==="JPA_EMBEDDABLE"&&!!M&&M.stereotype!=="JPA_EMBEDDABLE",de=!!T.stereotype&&T.stereotype!=="JPA_EMBEDDABLE"&&!!M&&M.stereotype==="JPA_EMBEDDABLE";if(B&&M){const be=M.attributes.filter(x=>x.identifier&&!x.derivedFrom).map(x=>en(E,x.modelId,{identifier:!1})),Q=Pn({...o.logical,entities:o.logical.entities.map(x=>x.modelId===E?{...x,stereotype:"JPA_EMBEDDABLE"}:x)},E,x=>x.map(D=>D.identifier&&!D.derivedFrom?{...D,identifier:!1}:D)),Z=El(Q,E),j=pk(o.logical,E),ue=[I,...be,...Z,...j];V(ue.length>1?Fe("임베더블 변환",ue):I);return}if(de){const be=mk(o.logical,E),Q=[I,...be];V(Q.length>1?Fe("엔터티 전환",Q):I);return}V(I)},moveEntity(E,T){Y(E)||V($n(E,T))},resizeEntity(E,T){Y(E)||V(vr(E,T))},removeEntity(E){Y(E)||V(kr(E))},setEntitySwatch(E,T){V(Nr(E,T))},setEntityCollapsed(E,T){V($r(E,T))},setEntityLocked(E,T){V(xr(E,T))},isEntityLocked(E){return Y(E)},collapseAll(){V(Ca(!0))},expandAll(){V(Ca(!1))},setAttributeSwatch(E,T,I){V(Xo(E,T,I))},dragGroup(E,T,I){J(E)||V(Fe("그룹 이동",_e(E,T,I)))},resizeGroup(E,T){J(E)||V(Vr(E,T))},setGroupSwatch(E,T){V(Ar(E,T))},setGroupLocked(E,T){V(Tr(E,T))},isGroupLocked(E){return J(E)},updateGroup(E,T){J(E)||V(Ir(E,T))},createGroup(E,T){if(!E.length)return null;const I=[];for(const de of o.logical.groups)for(const be of E)de.memberEntityRefs.includes(be)&&I.push(jo(de.modelId,be));const M=Oe(),B={modelId:M,name:T?{ko:T}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...E]};return I.push(Ra(B,Ne(E))),V(Fe("그룹 생성",I)),H.value=null,M},addEmptyGroup(E,T){const I=Oe();return V(Ra({modelId:I,name:T?{ko:T}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...E},size:{width:360,height:260}})),I},removeGroup(E){J(E)||V(Sr(E))},dropEntity(E,T,I){var de;if(Y(E))return;const M=((de=o.logical.groups.find(be=>be.memberEntityRefs.includes(E)))==null?void 0:de.modelId)??null,B=[$n(E,T)];M!==I&&(M&&B.push(jo(M,E)),I&&B.push(Cr(I,E))),V(Fe("이동",B))},ungroupEntity(E){const T=o.logical.groups.find(I=>I.memberEntityRefs.includes(E));T&&V(jo(T.modelId,E))},dropNote(E,T,I){var de;const M=((de=o.layout.groupLayouts.find(be=>{var Q;return(Q=be.memberNoteRefs)==null?void 0:Q.includes(E)}))==null?void 0:de.groupRef)??null,B=[eo(E,T)];M!==I&&(M&&B.push(es(M,E)),I&&B.push(Qr(I,E))),V(Fe("이동",B))},addPredefinedEmbed(E,T){if(Y(E))return;const I=a.value.find(Z=>Z.type===T),M=o.logical.entities.find(Z=>Z.modelId===E);if(!I||!M)return;const B=M.attributes.reduce((Z,j)=>Math.max(Z,j.order),-1)+1,de=Oe(),be=I.fields.map(()=>({modelId:Oe(),physicalName:"",dataType:""})),Q={modelId:de,name:I.defaultName,type:I.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:B,dbAttrs:be};return V(Rt(E,Q)),de},addAttribute(E,T={}){if(Y(E))return T.modelId??"";const I=o.logical.entities.find(ue=>ue.modelId===E),M=I?I.attributes.length:0,B=T.modelId??Oe(),de=T.name??`field${M}`,be={modelId:B,name:de,type:T.type??ka,attrType:T.attrType??"NORMAL",identifier:T.identifier??!1,notNull:T.notNull??!1,order:M,dbAttrs:T.dbAttrs??[{modelId:Oe(),physicalName:de,dataType:"VARCHAR",length:255}],...T},Q=Rt(E,be),Z=Pn(o.logical,E,ue=>[...ue,be]),j=zn(Z,E);return V(j.length?Fe("속성 추가",[Q,...j]):Q),B},addDivider(E){if(Y(E))return"";const T=o.logical.entities.find(de=>de.modelId===E),I=T?T.attributes.length:0,M=Oe();return V(Rt(E,{modelId:M,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:I,dbAttrs:[]})),M},updateAttribute(E,T,I){we(E,T,I)},setAttributeGroupCode(E,T,I){we(E,T,{groupCode:I,type:I?qn:ka})},setEmbedColumns(E,T,I){var Z,j;if(Y(E))return;const M=en(E,T,{dbAttrs:I}),B=(Z=o.logical.entities.find(ue=>ue.modelId===E))==null?void 0:Z.attributes.find(ue=>ue.modelId===T),de=(j=B==null?void 0:B.embedded)==null?void 0:j.associationRef,be=de?o.logical.associations.find(ue=>ue.modelId===de):void 0,Q=[];be&&de&&(be.end1.legacyEmbedRaw&&Q.push(In(de,"end1",{legacyEmbedRaw:void 0})),be.end2.legacyEmbedRaw&&Q.push(In(de,"end2",{legacyEmbedRaw:void 0}))),V(Q.length?Fe("임베드 컬럼 수정",[M,...Q]):M)},removeAttribute(E,T){if(Y(E))return;if(ti(o.logical,E,T)){g(Td);return}const I=xn(E,T),M=Pn(o.logical,E,de=>de.filter(be=>be.modelId!==T)),B=zn(M,E);V(B.length?Fe("속성 삭제",[I,...B]):I)},removeAttributes(E,T){var Q;if(!T.length||Y(E))return;const I=T.filter(Z=>!ti(o.logical,E,Z));if(I.length<T.length&&g(Td),!I.length)return;const M=I.map(Z=>xn(E,Z)),B=new Set(I),de=Pn(o.logical,E,Z=>Z.filter(j=>!B.has(j.modelId))),be=[...M,...zn(de,E)];V(be.length===1?be[0]:Fe("속성 삭제",be)),((Q=H.value)==null?void 0:Q.kind)==="attribute"&&H.value.entityId===E&&(H.value=null)},setAttributeSwatches(E,T,I){T.length&&(T.length===1?V(Xo(E,T[0],I)):V(Fe("속성 색상",T.map(M=>Xo(E,M,I)))))},reorderAttributes(E,T,I){!T.length||Y(E)||V(Va(E,T,I))},addIndex(E,T){Y(E)||V(zr(E,T))},updateIndex(E,T,I){Y(E)||V(Ur(E,T,I))},removeIndex(E,T){Y(E)||V(Hr(E,T))},addOperation(E,T={}){var be;if(Y(E))return T.modelId??"";const I=o.logical.entities.find(Q=>Q.modelId===E),M=((be=I==null?void 0:I.operations)==null?void 0:be.length)??0,B=T.modelId??Oe(),de={modelId:B,name:T.name??`method${M}`,visibility:T.visibility??"PACKAGE",order:M,...T};return V(Mr(E,de)),B},updateOperation(E,T,I){Y(E)||V(Br(E,T,I))},removeOperation(E,T){Y(E)||V(Dr(E,T))},reorderOperations(E,T,I){!T.length||Y(E)||V(Or(E,T,I))},setOperationSwatch(E,T,I){V(Lr(E,T,I))},addAssociation(E,T,I,M){if(Y(E)||Y(T))return"";const B=Oe(),de={modelId:B,end1:{entityRef:E,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:I},end2:{entityRef:T,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},be={...o.logical,associations:[...o.logical.associations,de]},Q=to(be,T,Oe),Z=Q.add[0];Z&&(de.end2.attributeRef=Z.modelId);const j={associationRef:B,waypoints:[],sourceColumnRef:I,targetColumnRef:(Z==null?void 0:Z.modelId)??M},ue=Aa(de,j),x=zi(T,Q);return V(x.length?Fe("관계 추가",[ue,...x]):ue),B},addEmbedAssociation(E,T){if(Y(E))return;const I=o.logical.entities.find(ee=>ee.modelId===E),M=o.logical.entities.find(ee=>ee.modelId===T);if(!I||!M||M.stereotype!=="JPA_EMBEDDABLE")return;const B=Oe(),de=Oe(),be=Oe(),Q=I.attributes.reduce((ee,fe)=>Math.max(ee,fe.order),-1)+1,Z=Dd(M),j=ee=>ee&&ee.charAt(0).toLowerCase()+ee.slice(1),ue=new Set(I.attributes.map(ee=>ee.name)),x=j(M.name);let D=x;for(let ee=2;ue.has(D);ee++)D=`${x}${ee}`;const $={modelId:de,name:D,type:M.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:Q,dbAttrs:Z,embedded:{associationRef:B,embeddableRef:T}},U={modelId:B,end1:{entityRef:E,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:be},end2:{entityRef:T,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:de}},P={associationRef:B,waypoints:[],sourceColumnRef:de,targetColumnRef:void 0};return V(Fe("임베드 추가",[Rt(E,$),Aa(U,P)])),B},setEmbedCollectionMode(E,T){if(ge(E))return;const I=o.logical.associations.find(j=>j.modelId===E);if(!I)return;let M,B;for(const j of o.logical.entities){const ue=j.attributes.find(x=>{var D;return((D=x.embedded)==null?void 0:D.associationRef)===E&&x.attrType==="EMBED_OWN"});if(ue){M=j.modelId,B=ue;break}}if(!M||!B)return;const de=B.embedded.embeddableRef,be=I.end2.entityRef===de?"end2":"end1",Q=I[be],Z=Q.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(T==="COLLECTION"?Z:!Z))if(T==="COLLECTION")V(Fe("임베드 컬렉션 전환",[en(M,B.modelId,{dbAttrs:[]}),In(E,be,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...Q.jpa,collectionType:"LIST"}})]));else{const j=o.logical.entities.find(ue=>ue.modelId===de);if(!j)return;V(Fe("임베드 단일 전환",[en(M,B.modelId,{dbAttrs:Dd(j)}),In(E,be,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...Q.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(E){if(ge(E))return;const T=o.logical.associations.find(be=>be.modelId===E),I=Pr(E);if(!T){V(I);return}for(const be of o.logical.entities){const Q=be.attributes.find(Z=>{var j;return((j=Z.embedded)==null?void 0:j.associationRef)===E});if(Q){V(Fe("임베드 삭제",[I,xn(be.modelId,Q.modelId)]));return}}const M=T.end2.entityRef,B={...o.logical,associations:o.logical.associations.filter(be=>be.modelId!==E)},de=El(B,M);V(de.length?Fe("관계 삭제",[I,...de]):I)},setAssociationIdentifying(E,T){if(ge(E))return;const I=o.logical.associations.find(Q=>Q.modelId===E),M=Zo(E,{identifying:T});if(!I||I.identifying===T){V(M);return}const B=I.end2.entityRef,de={...o.logical,associations:o.logical.associations.map(Q=>Q.modelId===E?{...Q,identifying:T}:Q)},be=El(de,B);V(be.length?Fe("식별 관계 변경",[M,...be]):M)},updateAssociationEnd(E,T,I){ge(E)||V(In(E,T,I))},moveWaypoint(E,T,I){V(Fr(E,T,I))},addWaypoint(E,T,I){V(Kr(E,T,I))},removeWaypoint(E,T){V(Gr(E,T))},clearWaypoints(E){V(Wr(E))},addNote(E="메모",T={x:80,y:80}){const I=Oe();return V(qr({modelId:I,memo:E,geo:{location:{...T},size:{width:200,height:120}}})),I},removeNote(E){V(Xr(E))},moveNote(E,T){V(eo(E,T))},resizeNote(E,T){V(jr(E,T))},setNoteMemo(E,T){V(Zr(E,T))},setNoteSwatch(E,T){V(Jr(E,T))},addNoteConnection(E,T){V(ts(E,T))},removeNoteConnection(E,T){V(ns(E,T))},moveNoteConnectionWaypoint(E,T,I,M){V(os(E,T,I,M))},addNoteConnectionWaypoint(E,T,I,M){V(is(E,T,I,M))},removeNoteConnectionWaypoint(E,T,I){V(as(E,T,I))},clearNoteConnectionWaypoints(E,T){V(ls(E,T))},autoLayout(){const E=Ql(o.logical,o.layout);E.length&&V(Fe("자동 배치",E.map(T=>$n(T.id,T.location))))},copy(){const E=H.value;if((E==null?void 0:E.kind)==="attribute"){const de=o.logical.entities.find(Q=>Q.modelId===E.entityId);if(!de)return;const be=[...de.attributes].sort((Q,Z)=>Q.order-Z.order).filter(Q=>E.ids.includes(Q.modelId));if(!be.length)return;he.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:be}));return}const T=q.value;if(!T)return;const I=o.logical.entities.find(de=>de.modelId===T),M=o.layout.entityLayouts.find(de=>de.entityRef===T);if(!I)return;const B=(M==null?void 0:M.geo)??{location:{x:80,y:80},size:{width:220,height:140}};he.value=JSON.parse(JSON.stringify({kind:"entity",entity:I,geo:B}))},paste(){if(!oe.value)return;const E=he.value;if(!E)return;if(E.kind==="attribute"){const M=q.value;if(!M)return;const B=o.logical.entities.find(ue=>ue.modelId===M);if(!B)return;const de=new Set(B.attributes.map(ue=>ue.name)),be=new Set(B.attributes.flatMap(ue=>ue.dbAttrs.map(x=>x.physicalName))),Q=B.attributes.length,Z=[],j=E.attributes.map((ue,x)=>{const D=JSON.parse(JSON.stringify(ue));D.modelId=Oe();for(const $ of D.dbAttrs)$.modelId=Oe();de.has(D.name)&&(D.name=`${D.name}_copy`);for(const $ of D.dbAttrs)$.physicalName&&be.has($.physicalName)&&($.physicalName=`${$.physicalName}_copy`);return D.order=Q+x,Z.push(D.modelId),Rt(M,D)});V(j.length===1?j[0]:Fe("속성 붙여넣기",j)),H.value={kind:"attribute",entityId:M,ids:Z,anchor:Z[Z.length-1]};return}const T=fk(E.entity),I={location:{x:E.geo.location.x+40,y:E.geo.location.y+40},size:{...E.geo.size}};V(Sa(T,I)),H.value={kind:"entity",id:T.modelId}}};return Ce}const Ui=Symbol("groupHover"),Od=Symbol("groupDrag"),Un=Symbol("relationHighlight"),yk={key:0,class:"em-sel","aria-hidden":"true"},gk=["title","aria-expanded","disabled"],bk={class:"em-entity__stereotype"},_k={key:1,class:"em-entity__name"},kk=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],wk=["onPointerdown"],Ek={key:1,class:"em-entity__divider-label"},vk=["title"],Nk={class:"em-key-slot"},$k={class:"em-key-slot"},xk={key:0,class:"em-entity__type"},Ik=["onClick"],Sk={class:"em-entity__attrname"},Ck={class:"em-entity__type"},Rk=["data-op"],Vk=["onPointerdown"],Ak={class:"em-entity__op-vis","aria-hidden":"true"},Tk=["title"],Mk={key:4,class:"em-entity__footer"},Ld=Ue(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=ie.useModal();function a(){o&&Pi(i,o,t.id)}const l=n.inject(Ui,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),m=n.computed(()=>{var Q;return((Q=o==null?void 0:o.selection.value)==null?void 0:Q.kind)==="entity"&&o.selection.value.id===t.id}),p=n.computed(()=>!!t.selected&&!m.value),y=n.computed(()=>{var Q;return o&&((Q=o.selectedAttr.value)==null?void 0:Q.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),b=n.computed(()=>y.value.size>0);function _(Q,Z){const j=Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,Q.modelId,j)}const A=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),g=n.computed(()=>t.data.entity),N=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),te=n.computed(()=>t.data.collapsed??!1),S=n.computed(()=>t.data.locked??!1);function O(){s.value&&(o==null||o.setEntityCollapsed(t.id,!te.value))}const z=n.computed(()=>N.value==="PHYSICAL"||N.value==="LOGICAL_PHYSICAL"),F=n.computed(()=>{const Q=N.value==="PHYSICAL"||N.value==="LOGICAL_PHYSICAL",Z={};for(const j of g.value.attributes){const ue=j.attrType.startsWith("RELATION")&&j.dbAttrs.length>0;Z[j.modelId]={pk:j.identifier,fk:ue&&Q,required:j.notNull&&!j.identifier}}return Z});function ne(Q){if(!Q)return"";const Z=[];return Q.pk&&Q.fk?Z.push("PFK (식별 외래키)"):Q.pk?Z.push("PK (기본키)"):Q.fk&&Z.push("FK (외래키)"),Q.required&&Z.push("필수 (NOT NULL)"),Z.join(" · ")}const re=n.computed(()=>{const Q=_l(it(t.data.style)),Z={};return Q&&(Z["--em-header-bg"]=Q.bar,Z["--em-header-fg"]=Q.barOn),Z});function L(Q){var Z,j;return(j=_l(it((Z=t.data.attributeStyles)==null?void 0:Z[Q.modelId])))==null?void 0:j.text}const oe=n.computed(()=>[...g.value.operations??[]].sort((Q,Z)=>Q.order-Z.order)),k=n.computed(()=>N.value==="CLASS"&&oe.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function R(Q){return Q?W[Q]:"~"}function G(Q){var Z,j;return(j=_l(it((Z=t.data.operationStyles)==null?void 0:Z[Q.modelId])))==null?void 0:j.text}function H(Q,Z,j){switch(N.value){case"CLASS":return[{text:Q}];case"PHYSICAL":return[{text:j||Q}];case"LOGICAL":return[Z?{text:Z}:{text:"(논리명)",missing:!0}];default:{const ue=Z?{text:Z}:{text:"(논리명)",missing:!0};return j?[ue,{text:` · ${j}`}]:[ue]}}}function ae(Q){var Z,j,ue;return v(Q)?[{text:Q.name}]:H(Q.name,(j=(Z=Q.dbAttrs[0])==null?void 0:Z.logicalName)==null?void 0:j.ko,((ue=Q.dbAttrs[0])==null?void 0:ue.physicalName)??"")}function v(Q){return Q.attrType.startsWith("EMBED")&&Q.dbAttrs.length>0}function q(Q){return Q.attrType==="DIVIDER"}function le(Q){if(Q.attrType!=="EMBED_PREDEF")return Q.dbAttrs;const Z=o==null?void 0:o.embeddableCatalog.value.find(ue=>ue.type===Q.type);if(!Z)return Q.dbAttrs;const j=Xn(g.value.attributes.flatMap(ue=>ue.dbAttrs));return Q.dbAttrs.map((ue,x)=>{const D=Z.fields[x],$=Yo(ue,j);return $?{...ue,physicalName:$.physicalName,logicalName:ue.logicalName??(D==null?void 0:D.logicalName),dataType:ue.dataType||(D==null?void 0:D.dataType)||""}:D?{...ue,physicalName:ue.physicalName||D.physicalName,logicalName:ue.logicalName??D.logicalName,dataType:ue.dataType||D.dataType,length:ue.length??D.length}:ue})}function me(Q){var Z;return H(Q.physicalName,(Z=Q.logicalName)==null?void 0:Z.ko,Q.physicalName)}function he(Q){const Z=fr(Q,(o==null?void 0:o.state.logical.associations)??[]);return Ea(N.value,Q,Z)}const se=n.computed(()=>{var Q,Z,j;return H(g.value.name,(Z=(Q=g.value.table)==null?void 0:Q.logicalName)==null?void 0:Z.ko,((j=g.value.table)==null?void 0:j.physicalName)??"")}),ce=n.ref(!1),ye=n.ref(""),ke=n.ref(null);async function Re(){var Q,Z;s.value&&(ye.value=g.value.name,ce.value=!0,await n.nextTick(),(Q=ke.value)==null||Q.focus(),(Z=ke.value)==null||Z.select())}function xe(){if(!ce.value)return;ce.value=!1;const Q=ye.value.trim();Q&&Q!==g.value.name&&(o==null||o.renameEntity(t.id,Q))}function pe(){o==null||o.addAttribute(t.id)}function X(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:K,findNode:w}=Le(),C=n.ref(null),V=n.computed(()=>{const Q=C.value??t.data.size;return Q?{width:`${Q.width}px`,minHeight:`${Q.height}px`}:void 0});let Y=null;function J(Q){var ue,x,D;if(!s.value)return;Q.stopPropagation();const Z=(ue=w(t.id))==null?void 0:ue.dimensions,j=K({x:Q.clientX,y:Q.clientY});Y={fx:j.x,fy:j.y,w:(Z==null?void 0:Z.width)??((x=t.data.size)==null?void 0:x.width)??200,h:(Z==null?void 0:Z.height)??((D=t.data.size)==null?void 0:D.height)??120},Q.target.setPointerCapture(Q.pointerId)}function ge(Q){if(!Y)return;const Z=K({x:Q.clientX,y:Q.clientY});C.value={width:Math.max(40,Y.w+(Z.x-Y.fx)),height:Math.max(40,Y.h+(Z.y-Y.fy))}}function we(Q){var Z,j,ue;if(Y&&C.value&&o){const x=(Z=w(t.id))==null?void 0:Z.dimensions;o.resizeEntity(t.id,{width:Math.round((x==null?void 0:x.width)??C.value.width),height:Math.round((x==null?void 0:x.height)??C.value.height)})}Y=null,C.value=null,(ue=(j=Q.target).releasePointerCapture)==null||ue.call(j,Q.pointerId)}const Ne=n.ref(null),_e=n.ref(null);function Ce(Q,Z){if(!s.value)return;Z.stopPropagation(),Z.preventDefault();const j=y.value,ue=j.has(Q.modelId)?new Set(j):new Set([Q.modelId]);_e.value={ids:ue,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId)}function Te(Q){if(!_e.value||!Ne.value)return;const Z=Array.from(Ne.value.querySelectorAll(".em-entity__row"));if(!Z.length)return;let j=Z.length;for(let D=0;D<Z.length;D++){const $=Z[D].getBoundingClientRect();if(Q.clientY<$.top+$.height/2){j=D;break}}const ue=Z[Z.length-1],x=j<Z.length?Z[j].offsetTop:ue.offsetTop+ue.offsetHeight;_e.value={..._e.value,dropIndex:j,lineY:x}}function De(){const Q=_e.value;if(_e.value=null,!Q||Q.dropIndex<0)return;const Z=g.value.attributes,j=Z.filter(U=>Q.ids.has(U.modelId)).map(U=>U.modelId),ue=Z.filter((U,P)=>Q.ids.has(U.modelId)&&P<Q.dropIndex).length,x=Q.dropIndex-ue,D=Z.filter(U=>!Q.ids.has(U.modelId)).map(U=>U.modelId);[...D.slice(0,x),...j,...D.slice(x)].join(",")!==Z.map(U=>U.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,j,x))}function E(){_e.value=null}const T=n.ref(null),I=n.ref(null);function M(Q,Z){s.value&&(Z.stopPropagation(),Z.preventDefault(),I.value={id:Q.modelId,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId))}function B(Q){if(!I.value||!T.value)return;const Z=Array.from(T.value.querySelectorAll(".em-entity__op-row"));if(!Z.length)return;let j=Z.length;for(let D=0;D<Z.length;D++){const $=Z[D].getBoundingClientRect();if(Q.clientY<$.top+$.height/2){j=D;break}}const ue=Z[Z.length-1],x=j<Z.length?Z[j].offsetTop:ue.offsetTop+ue.offsetHeight;I.value={...I.value,dropIndex:j,lineY:x}}function de(){const Q=I.value;if(I.value=null,!Q||Q.dropIndex<0)return;const j=oe.value.findIndex(x=>x.modelId===Q.id);if(j<0)return;const ue=Q.dropIndex-(j<Q.dropIndex?1:0);ue!==j&&(o==null||o.reorderOperations(t.id,[Q.id],ue))}function be(){I.value=null}return(Q,Z)=>(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":m.value,"is-multi-selected":p.value,"has-focused-attr":b.value,"is-locked":S.value}]),style:n.normalizeStyle(V.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",yk,[...Z[7]||(Z[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(re.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(O,["stop"]),onPointerdown:Z[0]||(Z[0]=n.withModifiers(()=>{},["stop"])),onDblclick:Z[1]||(Z[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(te.value?"▸":"▾"),41,gk),n.createElementVNode("span",bk,"«"+n.toDisplayString(g.value.stereotype)+"»",1),ce.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ke,"onUpdate:modelValue":Z[2]||(Z[2]=j=>ye.value=j),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(xe,["enter"]),Z[3]||(Z[3]=n.withKeys(j=>ce.value=!1,["esc"]))],onBlur:xe,onPointerdown:Z[4]||(Z[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ye.value]]):(n.openBlock(),n.createElementBlock("span",_k,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se.value,(j,ue)=>(n.openBlock(),n.createElementBlock("span",{key:ue,class:n.normalizeClass({"em-entity__missing":j.missing})},n.toDisplayString(j.text),3))),128))])),S.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:Ne,class:"em-entity__attrs"},[_e.value&&_e.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${_e.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value.attributes,j=>{var ue,x,D,$;return n.openBlock(),n.createElementBlock(n.Fragment,{key:j.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":y.value.has(j.modelId),"is-dragging":(ue=_e.value)==null?void 0:ue.ids.has(j.modelId),"is-embed":v(j),"is-divider":q(j),nodrag:q(j)&&s.value}]),"data-attr":j.modelId,onClick:n.withModifiers(U=>_(j,U),["stop"]),onPointerdown:U=>q(j)?Ce(j,U):void 0,onPointermove:U=>q(j)?Te(U):void 0,onPointerup:U=>q(j)?De():void 0,onPointercancel:U=>q(j)?E():void 0},[s.value&&!q(j)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:U=>Ce(j,U),onPointermove:Te,onPointerup:De,onPointercancel:E,onClick:Z[5]||(Z[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,wk)):n.createCommentVNode("",!0),q(j)?(n.openBlock(),n.createElementBlock("span",Ek,n.toDisplayString(j.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(dn),{id:`l:${j.modelId}`,type:"target",position:n.unref(Se).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ne(F.value[j.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Nk,[(x=F.value[j.modelId])!=null&&x.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(D=F.value[j.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",$k,[v(j)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):($=F.value[j.modelId])!=null&&$.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,vk),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:L(j)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ae(j),(U,P)=>(n.openBlock(),n.createElementBlock("span",{key:P,class:n.normalizeClass({"em-entity__missing":U.missing})},n.toDisplayString(U.text),3))),128))],4),he(j)?(n.openBlock(),n.createElementBlock("span",xk,n.toDisplayString(he(j)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(dn),{id:`r:${j.modelId}`,type:"source",position:n.unref(Se).Right,class:"em-handle"},null,8,["id","position"])],64))],42,kk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(v(j)&&z.value?le(j):[],U=>(n.openBlock(),n.createElementBlock("li",{key:`${j.modelId}:${U.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":y.value.has(j.modelId)}]),onClick:n.withModifiers(P=>_(j,P),["stop"])},[Z[8]||(Z[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",Sk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me(U),(P,ee)=>(n.openBlock(),n.createElementBlock("span",{key:ee,class:n.normalizeClass({"em-entity__missing":P.missing})},n.toDisplayString(P.text),3))),128))]),n.createElementVNode("span",Ck,n.toDisplayString(U.dataType),1)],10,Ik))),128))],64)}),128))],512)),!te.value&&k.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:T,class:"em-entity__ops"},[I.value&&I.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${I.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,j=>{var ue;return n.openBlock(),n.createElementBlock("li",{key:j.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((ue=I.value)==null?void 0:ue.id)===j.modelId}]),"data-op":j.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:x=>M(j,x),onPointermove:B,onPointerup:de,onPointercancel:be,onClick:Z[6]||(Z[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Vk)):n.createCommentVNode("",!0),n.createElementVNode("span",Ak,n.toDisplayString(R(j.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:G(j)})},n.toDisplayString(j.name)+"()",5)],10,Rk)}),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,Tk)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",Mk,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:pe},"+ 속성"),Z[9]||(Z[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:X},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!ce.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:J,onPointermove:ge,onPointerup:we},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-7efbcdb3"]]),Bk={key:0,class:"em-sel","aria-hidden":"true"},Dk={class:"em-group__label"},Ok={class:"em-group__name"},Lk={key:0,class:"em-group__pkg"},Pk={key:1,class:"em-group__flag"},Pd=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(()=>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(pn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var F;return!!t.id&&((F=r==null?void 0:r.selection.value)==null?void 0:F.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(Ui,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),h=n.inject(Un,null);function m(){t.id&&(h==null||h.setGroupHover(t.id))}function p(){h==null||h.setGroupHover(null)}const y=n.computed(()=>!!h&&h.hoverGroupId.value===t.id),b=n.computed(()=>!!h&&h.hoverGroupId.value!==null&&h.hoverGroupId.value!==t.id),{screenToFlowCoordinate:_,findNode:A}=Le();let g=null,N=null;function te(F){var L;if(!t.id||!s.value)return;F.stopPropagation();const ne=((L=A(t.id))==null?void 0:L.dimensions)??{width:400,height:300},re=_({x:F.clientX,y:F.clientY});g={fx:re.x,fy:re.y,w:ne.width,h:ne.height},F.target.setPointerCapture(F.pointerId)}function S(F){if(!g||!t.id)return;const ne=_({x:F.clientX,y:F.clientY});N={width:Math.max(160,g.w+(ne.x-g.fx)),height:Math.max(120,g.h+(ne.y-g.fy))};const re=A(t.id);re&&(re.style={width:`${N.width}px`,height:`${N.height}px`})}function O(F){var ne,re;g&&N&&t.id&&r&&r.resizeGroup(t.id,N),g=null,N=null,(re=(ne=F.target).releasePointerCapture)==null||re.call(ne,F.pointerId)}const z=n.computed(()=>{const F=o.value.name;return(F==null?void 0:F.ko)||(F==null?void 0:F.en)||(F==null?void 0:F.ja)||(F==null?void 0:F.zh)||o.value.packageName||"그룹"});return(F,ne)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":y.value,"is-dimmed":b.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:m,onMouseleave:p},[c.value?(n.openBlock(),n.createElementBlock("div",Bk,[...ne[0]||(ne[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",Dk,[n.createElementVNode("span",Ok,n.toDisplayString(z.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Lk,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",Pk,"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:S,onPointerup:O},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),zk={key:0,class:"em-sel","aria-hidden":"true"},Uk={key:2,class:"em-note__text"},zd=Ue(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=n.inject(Ui,null),a=n.inject(Un,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 h=n.computed(()=>{var k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!h.value),p=n.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===t.id}),y=n.computed(()=>!!t.selected&&!p.value),b=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!p.value),_=[{id:"n-top",pos:Se.Top},{id:"n-right",pos:Se.Right},{id:"n-bottom",pos:Se.Bottom},{id:"n-left",pos:Se.Left}],A=n.ref(!1),g=n.ref(""),N=n.ref(null);async function te(){var k;r.value&&(g.value=l.value.memo,A.value=!0,await n.nextTick(),(k=N.value)==null||k.focus())}function S(){A.value&&(A.value=!1,g.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,g.value)))}const{screenToFlowCoordinate:O,findNode:z}=Le();let F=null,ne=null;function re(k){var G;if(!r.value)return;k.stopPropagation();const W=((G=z(t.id))==null?void 0:G.dimensions)??l.value.geo.size,R=O({x:k.clientX,y:k.clientY});F={fx:R.x,fy:R.y,w:W.width,h:W.height},k.target.setPointerCapture(k.pointerId)}function L(k){if(!F)return;const W=O({x:k.clientX,y:k.clientY});ne={width:Math.max(140,F.w+(W.x-F.fx)),height:Math.max(60,F.h+(W.y-F.fy))};const R=z(t.id);R&&(R.style={width:`${ne.width}px`,height:`${ne.height}px`})}function oe(k){var W,R;F&&ne&&o&&o.resizeNote(t.id,ne),F=null,ne=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":m.value,"is-dimmed":b.value,"is-selected":p.value,"is-multi-selected":y.value}]),style:n.normalizeStyle(c.value),onDblclick:te,onPointerdown:d,onMouseenter:u,onMouseleave:f},[p.value?(n.openBlock(),n.createElementBlock("div",zk,[...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:N,"onUpdate:modelValue":W[0]||(W[0]=R=>g.value=R),class:"em-note__edit nodrag",onBlur:S,onKeydown:W[1]||(W[1]=n.withKeys(R=>A.value=!1,["esc"])),onPointerdown:W[2]||(W[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,g.value]]):(n.openBlock(),n.createElementBlock("div",Uk,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:re,onPointermove:L,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Hk=20,Fk=22,Gk=7,Yk=22,Ud=31,Hd=7,Wk=20,Fd=11,Gd=11,Kk=Ud+Hd;function qk(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Xk(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Hi(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 Yd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Fi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Wd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:Yd(e,t);return[Fi(o,a,l-Math.PI/2),Fi(o,a,l+Math.PI/2)]}function Kd(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 qd(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=Hi(e,t,Hk),[d,u]=Wd(e,t,c,Fk);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),qk(o.multiplicity)){const f=Hi(e,t,Ud);l.push({cx:f.x,cy:f.y,r:Hd})}if(Xk(o.multiplicity)){const f=Hi(e,t,Gk),[h,m]=Wd(e,t,f,Yk);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:a,circles:l,polygons:r}}let s=e;if(o.composition){const c=Hi(e,t,Wk),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Yd(e,t),f=Fi(d,Fd/2,u-Math.PI/2),h=Fi(d,Fd/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=Kd(s,c,Gd,!0),u=Kd(s,c,Gd,!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 Xd=200,jd=120,vl=24;function Zd(e){var a,l;if(!e)return{x:0,y:0,width:Xd,height:jd};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Xd,i=((l=e.dimensions)==null?void 0:l.height)||jd;return{x:t.x,y:t.y,width:o,height:i}}function Jd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Qd(e){const t=n.computed(()=>Zd(e.sourceNode())),o=n.computed(()=>Zd(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var m,p;const d=t.value,u=d.x+d.width;let f=((m=e.sourceRowY)==null?void 0:m.call(e))??d.y+d.height/3,h=((p=e.targetRowY)==null?void 0:p.call(e))??d.y+d.height*2/3;if(Math.abs(h-f)<vl){const y=(f+h)/2;f=y-vl/2,h=y+vl/2}return{source:{x:u,y:f},target:{x:u,y:h}}}),l=n.computed(()=>e.waypoints()[0]??Jd(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Jd(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?pa(t.value,d,l.value.x):ma(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?pa(o.value,d,r.value.x):ma(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 Nl=Symbol("waypointController"),jk=["d"],Zk=["d"],Jk=["d"],Qk=["x1","y1","x2","y2"],ew=["cx","cy","r"],tw=["x","y"],nw=["x","y"],ow=["cx","cy","onDblclick"],iw=["x","y","onPointerdown","onDblclick"],eu=Ue(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Le(),i=n.inject(Nl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Od,null),s=n.inject(Un,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var pe;return((pe=a==null?void 0:a.selection.value)==null?void 0:pe.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 pe=r==null?void 0:r.value;if(!pe||!a)return null;const X=a.resolved.value.entities,K=C=>{var V;return(V=X.find(Y=>Y.entity.modelId===C))==null?void 0:V.groupRef},w=t.data.association;return K(w.end1.entityRef)===pe.groupId&&K(w.end2.entityRef)===pe.groupId?{dx:pe.dx,dy:pe.dy}:null}),h=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),p=n.ref({x:0,y:0}),y=n.computed(()=>{const pe=f.value;return h.value.map((X,K)=>K===m.value?p.value:pe?{x:X.x+pe.dx,y:X.y+pe.dy}:X)}),b=n.computed(()=>{var pe;return!!((pe=t.sourceNode.data)!=null&&pe.collapsed)}),_=n.computed(()=>{var pe;return!!((pe=t.targetNode.data)!=null&&pe.collapsed)}),{source:A,target:g,sourceSide:N,targetSide:te,isSelf:S}=Qd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>y.value,sourceRowY:()=>t.data.sourceColumnRef&&!b.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),O=Kk+4,z=n.computed(()=>S.value?Jl(A.value,g.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?da(A.value,N.value,y.value,g.value,te.value,O):fa(A.value,y.value,g.value)),F=n.computed(()=>S.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ua(A.value,N.value,y.value,g.value,te.value,O):ha(A.value,y.value,g.value).map((pe,X)=>({point:pe,segIndex:X}))),ne=n.computed(()=>S.value||!l.value?[]:y.value);function re(pe){switch(pe){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function L(pe,X){m.value=pe,p.value={...h.value[pe]},X.target.setPointerCapture(X.pointerId),X.stopPropagation()}function oe(pe){if(m.value<0)return;const X=o({x:pe.clientX,y:pe.clientY});p.value={x:X.x,y:X.y}}function k(pe){var X,K;m.value>=0&&i&&i.movePoint(t.id,m.value,{...p.value}),m.value=-1,(K=(X=pe.target).releasePointerCapture)==null||K.call(X,pe.pointerId)}function W(pe,X){X.stopPropagation(),i==null||i.removePoint(t.id,pe)}function R(pe,X){if(!i)return;const K=o({x:X.clientX,y:X.clientY});i.insertPoint(t.id,pe,{x:K.x,y:K.y})}const G=n.computed(()=>re(t.data.association.end1.multiplicity)),H=n.computed(()=>re(t.data.association.end2.multiplicity)),ae=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),v=n.computed(()=>ae.value==="class"),q=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const pe=Wn(N.value);return{x:A.value.x+pe.x*10,y:A.value.y+pe.y*10}}return y.value[0]??g.value}),le=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const X=Wn(te.value);return{x:g.value.x+X.x*10,y:g.value.y+X.y*10}}const pe=y.value;return pe[pe.length-1]??A.value}),me=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end1.multiplicity,navigable:pe.end1.navigable,composition:pe.end1.composition,otherNavigable:pe.end2.navigable}}),he=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end2.multiplicity,navigable:pe.end2.navigable,composition:pe.end2.composition,otherNavigable:pe.end1.navigable}}),se=n.computed(()=>qd(A.value,q.value,me.value,ae.value)),ce=n.computed(()=>qd(g.value,le.value,he.value,ae.value)),ye=n.computed(()=>[...se.value.lines,...ce.value.lines]),ke=n.computed(()=>[...se.value.circles,...ce.value.circles]),Re=n.computed(()=>[...se.value.polygons,...ce.value.polygons].map(pe=>`M${pe.points.map(X=>`${X.x},${X.y}`).join(" L")} Z`)),xe=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(pe,X)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:z.value,fill:"none",class:"em-edge__hit"},null,8,jk),n.createElementVNode("path",{d:z.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,Zk),(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",xe.value])},null,10,Jk))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ye.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",xe.value])},null,10,Qk))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ke.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",xe.value])},null,10,ew))),128)),v.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,tw),n.createElementVNode("text",{x:n.unref(g).x-8,y:n.unref(g).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(H.value),11,nw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.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(C=>R(K.segIndex,C),["stop"])},null,42,ow))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.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:C=>L(w,C),onPointermove:oe,onPointerup:k,onDblclick:C=>W(w,C)},null,42,iw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Dt=(e=>(e.Lines="lines",e.Dots="dots",e))(Dt||{});const tu=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]}`})},nu=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Dt.Lines+"",Dt.Dots+"";const aw={[Dt.Dots]:"#81818a",[Dt.Lines]:"#eee"},lw=["id","x","y","width","height","patternTransform"],rw={key:2,height:"100",width:"100"},sw=["fill"],cw=["x","y","fill"],dw={name:"Background",compatConfig:{MODE:3}},uw=n.defineComponent({...dw,props:{id:{},variant:{default:()=>Dt.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}=Le(),i=n.computed(()=>{const r=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*r||1,c*r||1],u=e.size*r,[f,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+d[0]/2,h*r||1+d[1]/2];return{scaledGap:d,offset:m,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),l=n.toRef(()=>e.color||e.patternColor||aw[e.variant||Dt.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(Dt).Lines?(n.openBlock(),n.createBlock(n.unref(tu),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Dt).Dots?(n.openBlock(),n.createBlock(n.unref(nu),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",rw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,sw)])):n.createCommentVNode("",!0)])],8,lw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,cw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),fw={name:"ControlButton",compatConfig:{MODE:3}},mw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},pw={type:"button",class:"vue-flow__controls-button"};function hw(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",pw,[n.renderSlot(e.$slots,"default")])}const hn=mw(fw,[["render",hw]]),yw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},gw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function bw(e,t){return n.openBlock(),n.createElementBlock("svg",yw,gw)}const _w={render:bw},kw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ww=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Ew(e,t){return n.openBlock(),n.createElementBlock("svg",kw,ww)}const vw={render:Ew},Nw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},$w=[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 xw(e,t){return n.openBlock(),n.createElementBlock("svg",Nw,$w)}const Iw={render:xw},Sw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Cw=[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 Rw(e,t){return n.openBlock(),n.createElementBlock("svg",Sw,Cw)}const Vw={render:Rw},Aw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Tw=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 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 Mw(e,t){return n.openBlock(),n.createElementBlock("svg",Aw,Tw)}const Bw={render:Mw},Dw={name:"Controls",compatConfig:{MODE:3}},Ow=n.defineComponent({...Dw,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Sc.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}=Le(),h=n.toRef(()=>o.value||i.value||a.value),m=n.toRef(()=>d.value.zoom<=u.value),p=n.toRef(()=>d.value.zoom>=f.value);function y(){r(),t("zoomIn")}function b(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function A(){l(!h.value),t("interactionChange",!h.value)}return(g,N)=>(n.openBlock(),n.createBlock(n.unref(xd),{class:"vue-flow__controls",position:g.position},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"top"),g.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(g.$slots,"control-zoom-in",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomin",disabled:p.value,onClick:y},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(_w))))])]),_:3},8,["disabled"])]),n.renderSlot(g.$slots,"control-zoom-out",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(vw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),g.showFitView?n.renderSlot(g.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hn,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Iw))))])]),_:3})]):n.createCommentVNode("",!0),g.showInteractive?n.renderSlot(g.$slots,"control-interactive",{key:2},()=>[g.showInteractive?(n.openBlock(),n.createBlock(hn,{key:0,class:"vue-flow__controls-interactive",onClick:A},{default:n.withCtx(()=>[h.value?n.renderSlot(g.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Bw))))]):n.createCommentVNode("",!0),h.value?n.createCommentVNode("",!0):n.renderSlot(g.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Vw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(g.$slots,"default")]),_:3},8,["position"]))}});var Lw={value:()=>{}};function $l(){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 Gi(o)}function Gi(e){this._=e}function Pw(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}})}Gi.prototype=$l.prototype={constructor:Gi,on:function(e,t){var o=this._,i=Pw(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=zw(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]=ou(o[a],e.name,t);else if(t==null)for(a in o)o[a]=ou(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 Gi(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 zw(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function ou(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Lw,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var xl="http://www.w3.org/1999/xhtml";const iu={svg:"http://www.w3.org/2000/svg",xhtml:xl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Yi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),iu.hasOwnProperty(t)?{space:iu[t],local:e}:e}function Uw(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===xl&&t.documentElement.namespaceURI===xl?t.createElement(e):t.createElementNS(o,e)}}function Hw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function au(e){var t=Yi(e);return(t.local?Hw:Uw)(t)}function Fw(){}function Il(e){return e==null?Fw:function(){return this.querySelector(e)}}function Gw(e){typeof e!="function"&&(e=Il(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 Yw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ww(){return[]}function lu(e){return e==null?Ww:function(){return this.querySelectorAll(e)}}function Kw(e){return function(){return Yw(e.apply(this,arguments))}}function qw(e){typeof e=="function"?e=Kw(e):e=lu(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 ru(e){return function(){return this.matches(e)}}function su(e){return function(t){return t.matches(e)}}var Xw=Array.prototype.find;function jw(e){return function(){return Xw.call(this.children,e)}}function Zw(){return this.firstElementChild}function Jw(e){return this.select(e==null?Zw:jw(typeof e=="function"?e:su(e)))}var Qw=Array.prototype.filter;function eE(){return Array.from(this.children)}function tE(e){return function(){return Qw.call(this.children,e)}}function nE(e){return this.selectAll(e==null?eE:tE(typeof e=="function"?e:su(e)))}function oE(e){typeof e!="function"&&(e=ru(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 cu(e){return new Array(e.length)}function iE(){return new ft(this._enter||this._groups.map(cu),this._parents)}function Wi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wi.prototype={constructor:Wi,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 aE(e){return function(){return e}}function lE(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 Wi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function rE(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(h[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new Wi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function sE(e){return e.__data__}function cE(e,t){if(!arguments.length)return Array.from(this,sE);var o=t?rE:lE,i=this._parents,a=this._groups;typeof e!="function"&&(e=aE(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],h=f.length,m=dE(e.call(u,u&&u.__data__,d,i)),p=m.length,y=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,y,b,_,m,t);for(var A=0,g=0,N,te;A<p;++A)if(N=y[A]){for(A>=g&&(g=A+1);!(te=b[g])&&++g<p;);N._next=te||null}}return r=new ft(r,i),r._enter=s,r._exit=c,r}function dE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function uE(){return new ft(this._exit||this._groups.map(cu),this._parents)}function fE(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 mE(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,h=s[c]=new Array(f),m,p=0;p<f;++p)(m=d[p]||u[p])&&(h[p]=m);for(;c<a;++c)s[c]=o[c];return new ft(s,this._parents)}function pE(){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 hE(e){e||(e=yE);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 yE(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function bE(){return Array.from(this)}function _E(){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 kE(){let e=0;for(const t of this)++e;return e}function wE(){return!this.node()}function EE(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 vE(e){return function(){this.removeAttribute(e)}}function NE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $E(e,t){return function(){this.setAttribute(e,t)}}function xE(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function IE(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function SE(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 CE(e,t){var o=Yi(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?NE:vE:typeof t=="function"?o.local?SE:IE:o.local?xE:$E)(o,t))}function du(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function RE(e){return function(){this.style.removeProperty(e)}}function VE(e,t,o){return function(){this.style.setProperty(e,t,o)}}function AE(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function TE(e,t,o){return arguments.length>1?this.each((t==null?RE:typeof t=="function"?AE:VE)(e,t,o??"")):Hn(this.node(),e)}function Hn(e,t){return e.style.getPropertyValue(t)||du(e).getComputedStyle(e,null).getPropertyValue(t)}function ME(e){return function(){delete this[e]}}function BE(e,t){return function(){this[e]=t}}function DE(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function OE(e,t){return arguments.length>1?this.each((t==null?ME:typeof t=="function"?DE:BE)(e,t)):this.node()[e]}function uu(e){return e.trim().split(/^|\s+/)}function Sl(e){return e.classList||new fu(e)}function fu(e){this._node=e,this._names=uu(e.getAttribute("class")||"")}fu.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 mu(e,t){for(var o=Sl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function pu(e,t){for(var o=Sl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function LE(e){return function(){mu(this,e)}}function PE(e){return function(){pu(this,e)}}function zE(e,t){return function(){(t.apply(this,arguments)?mu:pu)(this,e)}}function UE(e,t){var o=uu(e+"");if(arguments.length<2){for(var i=Sl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?zE:t?LE:PE)(o,t))}function HE(){this.textContent=""}function FE(e){return function(){this.textContent=e}}function GE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function YE(e){return arguments.length?this.each(e==null?HE:(typeof e=="function"?GE:FE)(e)):this.node().textContent}function WE(){this.innerHTML=""}function KE(e){return function(){this.innerHTML=e}}function qE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function XE(e){return arguments.length?this.each(e==null?WE:(typeof e=="function"?qE:KE)(e)):this.node().innerHTML}function jE(){this.nextSibling&&this.parentNode.appendChild(this)}function ZE(){return this.each(jE)}function JE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function QE(){return this.each(JE)}function ev(e){var t=typeof e=="function"?e:au(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function tv(){return null}function nv(e,t){var o=typeof e=="function"?e:au(e),i=t==null?tv:typeof t=="function"?t:Il(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function ov(){var e=this.parentNode;e&&e.removeChild(this)}function iv(){return this.each(ov)}function av(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lv(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rv(e){return this.select(e?lv:av)}function sv(e){return arguments.length?this.property("__data__",e):this.node().__data__}function cv(e){return function(t){e.call(this,t,this.__data__)}}function dv(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 uv(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 fv(e,t,o){return function(){var i=this.__on,a,l=cv(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 mv(e,t,o){var i=dv(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?fv:uv,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function hu(e,t,o){var i=du(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 pv(e,t){return function(){return hu(this,e,t)}}function hv(e,t){return function(){return hu(this,e,t.apply(this,arguments))}}function yv(e,t){return this.each((typeof t=="function"?hv:pv)(e,t))}function*gv(){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 yu=[null];function ft(e,t){this._groups=e,this._parents=t}function vo(){return new ft([[document.documentElement]],yu)}function bv(){return this}ft.prototype=vo.prototype={constructor:ft,select:Gw,selectAll:qw,selectChild:Jw,selectChildren:nE,filter:oE,data:cE,enter:iE,exit:uE,join:fE,merge:mE,selection:bv,order:pE,sort:hE,call:gE,nodes:bE,node:_E,size:kE,empty:wE,each:EE,attr:CE,style:TE,property:OE,classed:UE,text:YE,html:XE,raise:ZE,lower:QE,append:ev,insert:nv,remove:iv,clone:rv,datum:sv,on:mv,dispatch:yv,[Symbol.iterator]:gv};function qt(e){return typeof e=="string"?new ft([[document.querySelector(e)]],[document.documentElement]):new ft([[e]],yu)}function _v(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=_v(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 Cl={capture:!0,passive:!1};function Rl(e){e.preventDefault(),e.stopImmediatePropagation()}function kv(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",Rl,Cl);"onselectstart"in t?o.on("selectstart.drag",Rl,Cl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function wv(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Rl,Cl),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 Vl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function gu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function No(){}var $o=.7,Ki=1/$o,Fn="\\s*([+-]?\\d+)\\s*",xo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",It="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ev=/^#([0-9a-f]{3,8})$/,vv=new RegExp(`^rgb\\(${Fn},${Fn},${Fn}\\)$`),Nv=new RegExp(`^rgb\\(${It},${It},${It}\\)$`),$v=new RegExp(`^rgba\\(${Fn},${Fn},${Fn},${xo}\\)$`),xv=new RegExp(`^rgba\\(${It},${It},${It},${xo}\\)$`),Iv=new RegExp(`^hsl\\(${xo},${It},${It}\\)$`),Sv=new RegExp(`^hsla\\(${xo},${It},${It},${xo}\\)$`),bu={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};Vl(No,Io,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_u,formatHex:_u,formatHex8:Cv,formatHsl:Rv,formatRgb:ku,toString:ku});function _u(){return this.rgb().formatHex()}function Cv(){return this.rgb().formatHex8()}function Rv(){return $u(this).formatHsl()}function ku(){return this.rgb().formatRgb()}function Io(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Ev.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?wu(t):o===3?new ct(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?qi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?qi(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=vv.exec(e))?new ct(t[1],t[2],t[3],1):(t=Nv.exec(e))?new ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$v.exec(e))?qi(t[1],t[2],t[3],t[4]):(t=xv.exec(e))?qi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Iv.exec(e))?Nu(t[1],t[2]/100,t[3]/100,1):(t=Sv.exec(e))?Nu(t[1],t[2]/100,t[3]/100,t[4]):bu.hasOwnProperty(e)?wu(bu[e]):e==="transparent"?new ct(NaN,NaN,NaN,0):null}function wu(e){return new ct(e>>16&255,e>>8&255,e&255,1)}function qi(e,t,o,i){return i<=0&&(e=t=o=NaN),new ct(e,t,o,i)}function Vv(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 Al(e,t,o,i){return arguments.length===1?Vv(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}Vl(ct,Al,gu(No,{brighter(e){return e=e==null?Ki:Math.pow(Ki,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),Xi(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:Eu,formatHex:Eu,formatHex8:Av,formatRgb:vu,toString:vu}));function Eu(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function Av(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function vu(){const e=Xi(this.opacity);return`${e===1?"rgb(":"rgba("}${yn(this.r)}, ${yn(this.g)}, ${yn(this.b)}${e===1?")":`, ${e})`}`}function Xi(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 Nu(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 $u(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 Tv(e,t,o,i){return arguments.length===1?$u(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}Vl(bt,Tv,gu(No,{brighter(e){return e=e==null?Ki:Math.pow(Ki,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(Tl(e>=240?e-240:e+120,a,i),Tl(e,a,i),Tl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new bt(xu(this.h),ji(this.s),ji(this.l),Xi(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=Xi(this.opacity);return`${e===1?"hsl(":"hsla("}${xu(this.h)}, ${ji(this.s)*100}%, ${ji(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xu(e){return e=(e||0)%360,e<0?e+360:e}function ji(e){return Math.max(0,Math.min(1,e||0))}function Tl(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 Iu=e=>()=>e;function Mv(e,t){return function(o){return e+o*t}}function Bv(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 Dv(e){return(e=+e)==1?Su:function(t,o){return o-t?Bv(t,o,e):Iu(isNaN(t)?o:t)}}function Su(e,t){var o=t-e;return o?Mv(e,o):Iu(isNaN(e)?t:e)}const Cu=(function e(t){var o=Dv(t);function i(a,l){var r=o((a=Al(a)).r,(l=Al(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Su(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 Ml=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bl=new RegExp(Ml.source,"g");function Ov(e){return function(){return e}}function Lv(e){return function(t){return e(t)+""}}function Pv(e,t){var o=Ml.lastIndex=Bl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Ml.exec(e))&&(a=Bl.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=Bl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Lv(c[0].x):Ov(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 Ru=180/Math.PI,Dl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vu(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)*Ru,skewX:Math.atan(c)*Ru,scaleX:r,scaleY:s}}var Zi;function zv(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Dl:Vu(t.a,t.b,t.c,t.d,t.e,t.f)}function Uv(e){return e==null||(Zi||(Zi=document.createElementNS("http://www.w3.org/2000/svg","g")),Zi.setAttribute("transform",e),!(e=Zi.transform.baseVal.consolidate()))?Dl:(e=e.matrix,Vu(e.a,e.b,e.c,e.d,e.e,e.f))}function Au(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push("translate(",null,t,null,o);p.push({i:y-4,x:jt(d,f)},{i:y-2,x:jt(u,h)})}else(f||h)&&m.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:jt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:jt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push(a(m)+"scale(",null,",",null,")");p.push({i:y-4,x:jt(d,f)},{i:y-2,x:jt(u,h)})}else(f!==1||h!==1)&&m.push(a(m)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(m){for(var p=-1,y=h.length,b;++p<y;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var Hv=Au(zv,"px, ","px)","deg)"),Fv=Au(Uv,", ",")",")"),Gv=1e-12;function Tu(e){return((e=Math.exp(e))+1/e)/2}function Yv(e){return((e=Math.exp(e))-1/e)/2}function Wv(e){return((e=Math.exp(2*e))-1)/(e+1)}const Kv=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],h=r[2],m=u-s,p=f-c,y=m*m+p*p,b,_;if(y<Gv)_=Math.log(h/d)/t,b=function(O){return[s+O*m,c+O*p,d*Math.exp(t*O*_)]};else{var A=Math.sqrt(y),g=(h*h-d*d+i*y)/(2*d*o*A),N=(h*h-d*d-i*y)/(2*h*o*A),te=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(N*N+1)-N);_=(S-te)/t,b=function(O){var z=O*_,F=Tu(te),ne=d/(o*A)*(F*Wv(t*z+te)-Yv(te));return[s+ne*m,c+ne*p,d*F/Tu(t*z+te)]}}return b.duration=_*1e3*t/Math.SQRT2,b}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Gn=0,So=0,Co=0,Mu=1e3,Ji,Ro,Qi=0,bn=0,ea=0,Vo=typeof performance=="object"&&performance.now?performance:Date,Bu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ol(){return bn||(Bu(qv),bn=Vo.now()+ea)}function qv(){bn=0}function ta(){this._call=this._time=this._next=null}ta.prototype=Du.prototype={constructor:ta,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&&Ro!==this&&(Ro?Ro._next=this:Ji=this,Ro=this),this._call=e,this._time=o,Ll()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ll())}};function Du(e,t,o){var i=new ta;return i.restart(e,t,o),i}function Xv(){Ol(),++Gn;for(var e=Ji,t;e;)(t=bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Gn}function Ou(){bn=(Qi=Vo.now())+ea,Gn=So=0;try{Xv()}finally{Gn=0,Zv(),bn=0}}function jv(){var e=Vo.now(),t=e-Qi;t>Mu&&(ea-=t,Qi=e)}function Zv(){for(var e,t=Ji,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:Ji=o);Ro=e,Ll(i)}function Ll(e){if(!Gn){So&&(So=clearTimeout(So));var t=e-bn;t>24?(e<1/0&&(So=setTimeout(Ou,e-Vo.now()-ea)),Co&&(Co=clearInterval(Co))):(Co||(Qi=Vo.now(),Co=setInterval(jv,Mu)),Gn=1,Bu(Ou))}}function Lu(e,t,o){var i=new ta;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Jv=$l("start","end","cancel","interrupt"),Qv=[],Pu=0,zu=1,Pl=2,na=3,Uu=4,zl=5,oa=6;function ia(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;eN(e,o,{name:t,index:i,group:a,on:Jv,tween:Qv,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Pu})}function Ul(e,t){var o=_t(e,t);if(o.state>Pu)throw new Error("too late; already scheduled");return o}function St(e,t){var o=_t(e,t);if(o.state>na)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 eN(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Du(l,0,o.time);function l(d){o.state=zu,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,m;if(o.state!==zu)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===na)return Lu(r);m.state===Uu?(m.state=oa,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=oa,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Lu(function(){o.state===na&&(o.state=Uu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Pl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Pl){for(o.state=na,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=zl,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===zl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=oa,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function aa(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>Pl&&i.state<zl,i.state=oa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function tN(e){return this.each(function(){aa(this,e)})}function nN(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 oN(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 iN(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?nN:oN)(o,e,t))}function Hl(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 Hu(e,t){var o;return(typeof t=="number"?jt:t instanceof Io?Cu:(o=Io(t))?(t=o,Cu):Pv)(e,t)}function aN(e){return function(){this.removeAttribute(e)}}function lN(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rN(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 sN(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 cN(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 dN(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 uN(e,t){var o=Yi(e),i=o==="transform"?Fv:Hu;return this.attrTween(e,typeof t=="function"?(o.local?dN:cN)(o,i,Hl(this,"attr."+e,t)):t==null?(o.local?lN:aN)(o):(o.local?sN:rN)(o,i,t))}function fN(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function mN(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function pN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&mN(e,l)),o}return a._value=t,a}function hN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&fN(e,l)),o}return a._value=t,a}function yN(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=Yi(e);return this.tween(o,(i.local?pN:hN)(i,t))}function gN(e,t){return function(){Ul(this,e).delay=+t.apply(this,arguments)}}function bN(e,t){return t=+t,function(){Ul(this,e).delay=t}}function _N(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gN:bN)(t,e)):_t(this.node(),t).delay}function kN(e,t){return function(){St(this,e).duration=+t.apply(this,arguments)}}function wN(e,t){return t=+t,function(){St(this,e).duration=t}}function EN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kN:wN)(t,e)):_t(this.node(),t).duration}function vN(e,t){if(typeof t!="function")throw new Error;return function(){St(this,e).ease=t}}function NN(e){var t=this._id;return arguments.length?this.each(vN(t,e)):_t(this.node(),t).ease}function $N(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;St(this,e).ease=o}}function xN(e){if(typeof e!="function")throw new Error;return this.each($N(this._id,e))}function IN(e){typeof e!="function"&&(e=ru(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 Ot(i,this._parents,this._name,this._id)}function SN(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),h,m=0;m<u;++m)(h=c[m]||d[m])&&(f[m]=h);for(;s<i;++s)r[s]=t[s];return new Ot(r,this._parents,this._name,this._id)}function CN(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 RN(e,t,o){var i,a,l=CN(t)?Ul:St;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function VN(e,t){var o=this._id;return arguments.length<2?_t(this.node(),o).on.on(e):this.each(RN(o,e,t))}function AN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function TN(){return this.on("end.remove",AN(this._id))}function MN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Il(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,ia(d[h],t,o,h,d,_t(u,o)));return new Ot(l,this._parents,t,o)}function BN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=lu(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),m,p=_t(u,o),y=0,b=h.length;y<b;++y)(m=h[y])&&ia(m,t,o,y,h,p);l.push(h),r.push(u)}return new Ot(l,r,t,o)}var DN=vo.prototype.constructor;function ON(){return new DN(this._groups,this._parents)}function LN(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 Fu(e){return function(){this.style.removeProperty(e)}}function PN(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 zN(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 UN(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=Fu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function HN(e,t,o){var i=(e+="")=="transform"?Hv:Hu;return t==null?this.styleTween(e,LN(e,i)).on("end.style."+e,Fu(e)):typeof t=="function"?this.styleTween(e,zN(e,i,Hl(this,"style."+e,t))).each(UN(this._id,e)):this.styleTween(e,PN(e,i,t),o).on("end.style."+e,null)}function FN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function GN(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&FN(e,r,o)),i}return l._value=t,l}function YN(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,GN(e,t,o??""))}function WN(e){return function(){this.textContent=e}}function KN(e){return function(){var t=e(this);this.textContent=t??""}}function qN(e){return this.tween("text",typeof e=="function"?KN(Hl(this,"text",e)):WN(e==null?"":e+""))}function XN(e){return function(t){this.textContent=e.call(this,t)}}function jN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&XN(a)),t}return i._value=e,i}function ZN(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,jN(e))}function JN(){for(var e=this._name,t=this._id,o=Gu(),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);ia(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ot(i,this._parents,e,o)}function QN(){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 e$=0;function Ot(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Gu(){return++e$}var Lt=vo.prototype;Ot.prototype={constructor:Ot,select:MN,selectAll:BN,selectChild:Lt.selectChild,selectChildren:Lt.selectChildren,filter:IN,merge:SN,selection:ON,transition:JN,call:Lt.call,nodes:Lt.nodes,node:Lt.node,size:Lt.size,empty:Lt.empty,each:Lt.each,on:VN,attr:uN,attrTween:yN,style:HN,styleTween:YN,text:qN,textTween:ZN,remove:TN,tween:iN,delay:_N,duration:EN,ease:NN,easeVarying:xN,end:QN,[Symbol.iterator]:Lt[Symbol.iterator]};function t$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var n$={time:null,delay:0,duration:250,ease:t$};function o$(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 i$(e){var t,o;e instanceof Ot?(t=e._id,e=e._name):(t=Gu(),(o=n$).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])&&ia(c,e,t,d,r,o||o$(c,t));return new Ot(i,this._parents,e,t)}vo.prototype.interrupt=tN,vo.prototype.transition=i$;const la=e=>()=>e;function a$(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 Pt(e,t,o){this.k=e,this.x=t,this.y=o}Pt.prototype={constructor:Pt,scale:function(e){return e===1?this:new Pt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pt(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 Fl=new Pt(1,0,0);Pt.prototype;function Gl(e){e.stopImmediatePropagation()}function Ao(e){e.preventDefault(),e.stopImmediatePropagation()}function l$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function r$(){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 Yu(){return this.__zoom||Fl}function s$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function c$(){return navigator.maxTouchPoints||"ontouchstart"in this}function d$(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 u$(){var e=l$,t=r$,o=d$,i=s$,a=c$,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Kv,d=$l("start","zoom","end"),u,f,h,m=500,p=150,y=0,b=10;function _(k){k.property("__zoom",Yu).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",re).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,W,R,G){var H=k.selection?k.selection():k;H.property("__zoom",Yu),k!==H?te(k,W,R,G):H.interrupt().each(function(){S(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 H=this.__zoom.k,ae=typeof W=="function"?W.apply(this,arguments):W;return H*ae},R,G)},_.scaleTo=function(k,W,R,G){_.transform(k,function(){var H=t.apply(this,arguments),ae=this.__zoom,v=R==null?N(H):typeof R=="function"?R.apply(this,arguments):R,q=ae.invert(v),le=typeof W=="function"?W.apply(this,arguments):W;return o(g(A(ae,le),v,q),H,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,H){_.transform(k,function(){var ae=t.apply(this,arguments),v=this.__zoom,q=G==null?N(ae):typeof G=="function"?G.apply(this,arguments):G;return o(Fl.translate(q[0],q[1]).scale(v.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof R=="function"?-R.apply(this,arguments):-R),ae,r)},G,H)};function A(k,W){return W=Math.max(l[0],Math.min(l[1],W)),W===k.k?k:new Pt(W,k.x,k.y)}function g(k,W,R){var G=W[0]-R[0]*k.k,H=W[1]-R[1]*k.k;return G===k.x&&H===k.y?k:new Pt(k.k,G,H)}function N(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(){S(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,ae=arguments,v=S(H,ae).event(G),q=t.apply(H,ae),le=R==null?N(q):typeof R=="function"?R.apply(H,ae):R,me=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),he=H.__zoom,se=typeof W=="function"?W.apply(H,ae):W,ce=c(he.invert(le).concat(me/he.k),se.invert(le).concat(me/se.k));return function(ye){if(ye===1)ye=se;else{var ke=ce(ye),Re=me/ke[2];ye=new Pt(Re,le[0]-ke[0]*Re,le[1]-ke[1]*Re)}v.zoom(null,ye)}})}function S(k,W,R){return!R&&k.__zooming||new O(k,W)}function O(k,W){this.that=k,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,W),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,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 a$(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),W)}};function z(k,...W){if(!e.apply(this,arguments))return;var R=S(this,W).event(k),G=this.__zoom,H=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,i.apply(this,arguments)))),ae=Xt(k);if(R.wheel)(R.mouse[0][0]!==ae[0]||R.mouse[0][1]!==ae[1])&&(R.mouse[1]=G.invert(R.mouse[0]=ae)),clearTimeout(R.wheel);else{if(G.k===H)return;R.mouse=[ae,G.invert(ae)],aa(this),R.start()}Ao(k),R.wheel=setTimeout(v,p),R.zoom("mouse",o(g(A(G,H),R.mouse[0],R.mouse[1]),R.extent,r));function v(){R.wheel=null,R.end()}}function F(k,...W){if(h||!e.apply(this,arguments))return;var R=k.currentTarget,G=S(this,W,!0).event(k),H=qt(k.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",me,!0),ae=Xt(k,R),v=k.clientX,q=k.clientY;kv(k.view),Gl(k),G.mouse=[ae,this.__zoom.invert(ae)],aa(this),G.start();function le(he){if(Ao(he),!G.moved){var se=he.clientX-v,ce=he.clientY-q;G.moved=se*se+ce*ce>y}G.event(he).zoom("mouse",o(g(G.that.__zoom,G.mouse[0]=Xt(he,R),G.mouse[1]),G.extent,r))}function me(he){H.on("mousemove.zoom mouseup.zoom",null),wv(he.view,G.moved),Ao(he),G.event(he).end()}}function ne(k,...W){if(e.apply(this,arguments)){var R=this.__zoom,G=Xt(k.changedTouches?k.changedTouches[0]:k,this),H=R.invert(G),ae=R.k*(k.shiftKey?.5:2),v=o(g(A(R,ae),G,H),t.apply(this,W),r);Ao(k),s>0?qt(this).transition().duration(s).call(te,v,G,k):qt(this).call(_.transform,v,G,k)}}function re(k,...W){if(e.apply(this,arguments)){var R=k.touches,G=R.length,H=S(this,W,k.changedTouches.length===G).event(k),ae,v,q,le;for(Gl(k),v=0;v<G;++v)q=R[v],le=Xt(q,this),le=[le,this.__zoom.invert(le),q.identifier],H.touch0?!H.touch1&&H.touch0[2]!==le[2]&&(H.touch1=le,H.taps=0):(H.touch0=le,ae=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),ae&&(H.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),aa(this),H.start())}}function L(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v,q,le;for(Ao(k),ae=0;ae<H;++ae)v=G[ae],q=Xt(v,this),R.touch0&&R.touch0[2]===v.identifier?R.touch0[0]=q:R.touch1&&R.touch1[2]===v.identifier&&(R.touch1[0]=q);if(v=R.that.__zoom,R.touch1){var me=R.touch0[0],he=R.touch0[1],se=R.touch1[0],ce=R.touch1[1],ye=(ye=se[0]-me[0])*ye+(ye=se[1]-me[1])*ye,ke=(ke=ce[0]-he[0])*ke+(ke=ce[1]-he[1])*ke;v=A(v,Math.sqrt(ye/ke)),q=[(me[0]+se[0])/2,(me[1]+se[1])/2],le=[(he[0]+ce[0])/2,(he[1]+ce[1])/2]}else if(R.touch0)q=R.touch0[0],le=R.touch0[1];else return;R.zoom("touch",o(g(v,q,le),R.extent,r))}}function oe(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v;for(Gl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),ae=0;ae<H;++ae)v=G[ae],R.touch0&&R.touch0[2]===v.identifier?delete R.touch0:R.touch1&&R.touch1[2]===v.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&&(v=Xt(v,this),Math.hypot(f[0]-v[0],f[1]-v[1])<b)){var q=qt(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:la(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:la(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:la(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:la([[+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?(y=(k=+k)*k,_):Math.sqrt(y)},_.tapDistance=function(k){return arguments.length?(b=+k,_):b},_}const Wu=Symbol("MiniMapSlots"),f$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],m$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},p$=n.defineComponent({...m$,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(Wu),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,f$))],64)):n.createCommentVNode("",!0)}}),h$=["width","height","viewBox","aria-labelledby"],y$=["id"],g$=["d","fill","stroke","stroke-width"],b$={name:"MiniMap",compatConfig:{MODE:3}},_$=n.defineComponent({...b$,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,l=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:h,d3Zoom:m,getNodesInitialized:p}=Le(),y=n.ref();n.provide(Wu,o);const b=n.toRef(()=>{var H;return e.width??((H=i.style)==null?void 0:H.width)??a}),_=n.toRef(()=>{var H;return e.height??((H=i.style)==null?void 0:H.height)??l}),A=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",g=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=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:()=>""),S=n.computed(()=>al(p.value.filter(H=>!H.hidden))),O=n.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),z=n.computed(()=>p.value&&p.value.length?mb(S.value,O.value):O.value),F=n.computed(()=>{const H=z.value.width/b.value,ae=z.value.height/_.value;return Math.max(H,ae)}),ne=n.computed(()=>{const H=F.value*b.value,ae=F.value*_.value,v=e.offsetScale*F.value;return{offset:v,x:z.value.x-(H-z.value.width)/2-v,y:z.value.y-(ae-z.value.height)/2-v,width:H+v*2,height:ae+v*2}}),re=n.computed(()=>!ne.value.x||!ne.value.y?"":`
|
|
29
|
+
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Je extends Error{constructor(t,...o){var i;super((i=ed[t])==null?void 0:i.call(ed,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function dl(e){return"clientX"in e}function Nb(e){return"sourceEvent"in e}function xt(e,t){const o=dl(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 $b(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 Ci(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const xb=()=>!0;function ul(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Ib(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())$i(a,Ni(l))>0&&i.push(l);return i}const Sb=250;function Cb(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Ib(e,o,t+Sb);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((l=d.handleBounds)==null?void 0:l.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:m}=Dn(d,f,f.position,!0),p=Math.sqrt((h-e.x)**2+(m-e.y)**2);p>t||(p<s?(r=[{...f,x:h,y:m}],s=p):p===s&&r.push({...f,x:h,y:m}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function td(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=xb},u,f,h,m){const p=l==="target",y=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:b,y:_}=xt(e),A=r.elementFromPoint(b,_),g=A!=null&&A.classList.contains(`${s}-flow__handle`)?A:y,N={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const te=nd(void 0,g),S=g.getAttribute("data-nodeid"),O=g.getAttribute("data-handleid"),z=g.classList.contains("connectable"),F=g.classList.contains("connectableend");if(!S||!te)return N;const ne={source:p?S:i,sourceHandle:p?O:a,target:p?i:S,targetHandle:p?a:O};N.connection=ne;const L=z&&F&&(o===Bt.Strict?p&&te==="source"||!p&&te==="target":S!==i||O!==a);N.isValid=L&&d(ne,{nodes:f,edges:u,sourceNode:h(ne.source),targetNode:h(ne.target)}),N.toHandle=od(S,te,O,m,o,!0)}return N}function nd(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Rb(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Vb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function od(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===Bt.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 fl={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top},Ab=["production","prod"];function Eo(e,...t){id()&&console.warn(`[Vue Flow]: ${e}`,...t)}function id(){return!Ab.includes(process.env.NODE_ENV||"")}function ad(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,...xi(r)}}):null}function ml(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 Tb(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:Lc(e)},a=Dc(a,void 0,i),mb(a,t)?!1:a}function Mb(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?Lc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function ld(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!sn(r)){o(new Je(qe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=db(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 rd(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 pl(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}`;rd("source",c,u,e,a,r),rd("target",c,d,e,l,s)}}function sd(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function hl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Gt(d)?d:Tb(d,s,a,l);if(!u)continue;const f=o(u.source),h=o(u.target);if(!f||!h){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(!h){a(new Je(qe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:h})){a(new Je(qe.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...Dc(u,m,l),sourceNode:f,targetNode:h})}return c}const cd=Symbol("vueFlow"),dd=Symbol("nodeId"),ud=Symbol("nodeRef"),Bb=Symbol("edgeId"),Db=Symbol("edgeRef"),Ri=Symbol("slots");function fd(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:l,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:h,findNode:m,multiSelectionActive:p,nodesSelectionActive:y,selectNodesOnDrag:b,removeSelectedElements:_,addSelectedNodes:A,updateNodePositions:g,emits:N}=Le(),{onStart:te,onDrag:S,onStop:O,onClick:z,el:F,disabled:ne,id:re,selectable:L,dragHandle:oe}=e,k=n.shallowRef(!1);let W=[],R,G=null,H={x:void 0,y:void 0},ae={x:0,y:0},v=null,q=!1,le=!1,me=0,he=!1;const se=Pb(),ce=({x:X,y:K})=>{H={x:X,y:K};let w=!1;if(W=W.map(C=>{const V={x:X-C.distance.x,y:K-C.distance.y},{computedPosition:Y}=cl(C,o.value?Ci(V,i.value):V,N.error,r.value,C.parentNode?m(C.parentNode):void 0);return w=w||C.position.x!==Y.x||C.position.y!==Y.y,C.position=Y,C}),le=le||w,!!w&&(g(W,!0,!0),k.value=!0,v)){const[C,V]=sl({id:re,dragItems:W,findNode:m});S({event:v,node:C,nodes:V})}},ye=()=>{if(!G)return;const[X,K]=Yc(ae,G,u.value);if(X!==0||K!==0){const w={x:(H.x??0)-X/c.value.zoom,y:(H.y??0)-K/c.value.zoom};h({x:X,y:K})&&ce(w)}me=requestAnimationFrame(ye)},ke=(X,K)=>{q=!0;const w=m(re);!b.value&&!p.value&&w&&(w.selected||_()),w&&n.toValue(L)&&b.value&&ml(w,p.value,A,_,y,!1,K);const C=se(X.sourceEvent);if(H=C,W=bb(l.value,f.value,C,re),W.length){const[V,Y]=sl({id:re,dragItems:W,findNode:m});te({event:X.sourceEvent,node:V,nodes:Y})}},Re=(X,K)=>{var w;X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1||(le=!1,s.value===0&&ke(X,K),H=se(X.sourceEvent),G=((w=t.value)==null?void 0:w.getBoundingClientRect())||null,ae=xt(X.sourceEvent,G))},xe=(X,K)=>{const w=se(X.sourceEvent);if(!he&&q&&d.value&&(he=!0,ye()),!q){const C=w.xSnapped-(H.x??0),V=w.ySnapped-(H.y??0);Math.sqrt(C*C+V*V)>s.value&&ke(X,K)}(H.x!==w.xSnapped||H.y!==w.ySnapped)&&W.length&&q&&(v=X.sourceEvent,ae=xt(X.sourceEvent,G),ce(w))},pe=X=>{let K=!1;if(!q&&!k.value&&!p.value){const w=X.sourceEvent,C=se(w),V=C.xSnapped-(H.x??0),Y=C.ySnapped-(H.y??0),J=Math.sqrt(V*V+Y*Y);J!==0&&J<=s.value&&(z==null||z(w),K=!0)}if(W.length&&!K){le&&(g(W,!1,!1),le=!1);const[w,C]=sl({id:re,dragItems:W,findNode:m});O({event:X.sourceEvent,node:w,nodes:C})}W=[],k.value=!1,he=!1,q=!1,H={x:void 0,y:void 0},cancelAnimationFrame(me)};return n.watch([()=>n.toValue(ne),F],([X,K],w,C)=>{if(K){const V=ht(K);X||(R=cy().on("start",Y=>Re(Y,K)).on("drag",Y=>xe(Y,K)).on("end",Y=>pe(Y)).filter(Y=>{const J=Y.target,ge=n.toValue(oe);return!Y.button&&(!a.value||!Zc(J,`.${a.value}`,K)&&(!ge||Zc(J,ge,K)))}),V.call(R)),C(()=>{V.on(".drag",null),R&&(R.on("start",null),R.on("drag",null),R.on("end",null))})}}),k}function Ob(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),updateStart:$e(),update:$e(),updateEnd:$e()}}function Lb(e,t){const o=Ob();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 Pb(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Le();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=Nb(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?Ci(u,t.value):u;return{xSnapped:f,ySnapped:h,...u}}}function Vi(){return!0}function md({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:l,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:m,autoPanOnConnect:p,autoPanSpeed:y,findNode:b,panBy:_,startConnection:A,updateConnection:g,endConnection:N,emits:te,viewport:S,edges:O,nodes:z,isValidConnection:F,nodeLookup:ne}=Le();let re=null,L=!1,oe=null;function k(R){var G;const H=n.toValue(o)==="target",ae=dl(R),v=Bc(R.target),q=R.currentTarget;if(q&&(ae&&R.button===0||!ae)){let le=function(_e){w=xt(_e,pe),ce=Cb(_o(w,S.value,!1,[1,1]),u.value,ne.value,Y),C||(V(),C=!0);const Ce=td(_e,{handle:ce,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:H?"target":"source",isValidConnection:se,doc:v,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,z.value,b,ne.value);oe=Ce.handleDomNode,re=Ce.connection,L=Vb(!!ce,Ce.isValid);const Te={...Ne,isValid:L,to:Ce.toHandle&&L?bo({x:Ce.toHandle.x,y:Ce.toHandle.y},S.value):w,toHandle:Ce.toHandle,toPosition:L&&Ce.toHandle?Ce.toHandle.position:fl[Y.position],toNode:Ce.toHandle?ne.value.get(Ce.toHandle.nodeId):null};if(L&&ce&&(Ne!=null&&Ne.toHandle)&&Te.toHandle&&Ne.toHandle.type===Te.toHandle.type&&Ne.toHandle.nodeId===Te.toHandle.nodeId&&Ne.toHandle.id===Te.toHandle.id&&Ne.to.x===Te.to.x&&Ne.to.y===Te.to.y)return;const De=ce??Ce.toHandle;if(g(De&&L?bo({x:De.x,y:De.y},S.value):w,De,Rb(!!De,L)),Ne=Te,!ce&&!L&&!oe)return ul(K);re&&re.source!==re.target&&oe&&(ul(K),K=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!L),oe.classList.toggle("vue-flow__handle-valid",!!L))},me=function(_e){"touches"in _e&&_e.touches.length>0||((ce||oe)&&re&&L&&(l?l(_e,re):te.connect(re)),te.connectEnd(_e),a&&(r==null||r(_e)),ul(K),cancelAnimationFrame(ye),N(_e),C=!1,L=!1,re=null,oe=null,v.removeEventListener("mousemove",le),v.removeEventListener("mouseup",me),v.removeEventListener("touchmove",le),v.removeEventListener("touchend",me))};const he=b(n.toValue(t));let se=n.toValue(i)||F.value||Vi;!se&&he&&(se=(H?he.isValidSourcePos:he.isValidTargetPos)||Vi);let ce,ye=0;const{x:ke,y:Re}=xt(R),xe=nd(n.toValue(a),q),pe=(G=c.value)==null?void 0:G.getBoundingClientRect();if(!pe||!xe)return;const X=od(n.toValue(t),xe,n.toValue(e),ne.value,d.value);if(!X)return;let K,w=xt(R,pe),C=!1;const V=()=>{if(!p.value)return;const[_e,Ce]=Yc(w,pe,y.value);_({x:_e,y:Ce}),ye=requestAnimationFrame(V)},Y={...X,nodeId:n.toValue(t),type:xe,position:X.position},J=ne.value.get(n.toValue(t)),we={inProgress:!0,isValid:null,from:Dn(J,Y,Se.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:J,to:w,toHandle:null,toPosition:fl[Y.position],toNode:null};A({nodeId:n.toValue(t),id:n.toValue(e),type:xe,position:(q==null?void 0:q.getAttribute("data-handlepos"))||Se.Top,...w},{x:ke-pe.left,y:Re-pe.top}),te.connectStart({event:R,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:xe});let Ne=we;v.addEventListener("mousemove",le),v.addEventListener("mouseup",me),v.addEventListener("touchmove",le),v.addEventListener("touchend",me)}}function W(R){var G,H;if(!f.value)return;const ae=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 v=n.toValue(i)||F.value||Vi;const q=b(n.toValue(t));if(!v&&q&&(v=(ae?q.isValidSourcePos:q.isValidTargetPos)||Vi),q&&(typeof q.connectable>"u"?m.value:q.connectable)===!1)return;const le=Bc(R.target),me=td(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:v,doc:le,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,z.value,b,ne.value),he=((G=me.connection)==null?void 0:G.source)===((H=me.connection)==null?void 0:H.target);me.isValid&&me.connection&&!he&&te.connect(me.connection),te.clickConnectEnd(R),N(R,!0)}return{handlePointerDown:k,handleClick:W}}function zb(){return n.inject(dd,"")}function pd(e){const t=e??zb()??"",o=n.inject(ud,n.ref(null)),{findNode:i,edges:a,emits:l}=Le(),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(()=>cn([r],a.value))}}function Ub(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),dragStart:$e(),drag:$e(),dragStop:$e()}}function Hb(e,t){const o=Ub();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 hd(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Le();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,h=d?4:1,m=c.x*u*h,p=c.y*f*h,y=[];for(const b of e.value)if(b.draggable||r&&typeof b.draggable>"u"){const _={x:b.computedPosition.x+m,y:b.computedPosition.y+p},{position:A}=cl(b,_,s.error,t.value,b.parentNode?i(b.parentNode):void 0);y.push({id:b.id,position:A,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(y,!0,!1)}}const Ai=.1,Fb=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 Gb={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 Yb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?so:pi).scaleBy(yl(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}=Mc({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:pi).transform(yl(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:pi).scaleTo(yl(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:Ai,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=al(s),{x:d,y:u,zoom:f}=Hc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ai);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:Ai})=>{const{x:r,y:s,zoom:c}=Hc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Ai);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}}}:Gb)}function yl(e,t=0,o=Fb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function Wb(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let y,b,_=!!(o.nodes.value.length||o.edges.value.length);y=Sn([e.modelValue,()=>{var A,g;return(g=(A=e.modelValue)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setElements(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([A,g])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(y==null||y.pause(),e.modelValue.value=[...A,...g],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let y,b,_=!!o.nodes.value.length;y=Sn([e.nodes,()=>{var A,g;return(g=(A=e.nodes)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setNodes(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.nodes,()=>o.nodes.value.length],([A])=>{var g;(g=e.nodes)!=null&&g.value&&Array.isArray(e.nodes.value)&&(y==null||y.pause(),e.nodes.value=[...A],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let y,b,_=!!o.edges.value.length;y=Sn([e.edges,()=>{var A,g;return(g=(A=e.edges)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setEdges(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.edges,()=>o.edges.value.length],([A])=>{var g;(g=e.edges)!=null&&g.value&&Array.isArray(e.edges.value)&&(y==null||y.pause(),e.edges.value=[...A],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&Xe(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&Xe(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&Xe(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&Xe(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{Xe(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const y=async b=>{let _=b;typeof t.autoConnect=="function"&&(_=await t.autoConnect(b)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{Xe(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(b,_,A)=>{b?o.onConnect(y):o.hooks.value.connect.off(y),A(()=>{o.hooks.value.connect.off(y)})},{immediate:!0})})},m=()=>{const y=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(t)){const _=b;if(!y.includes(_)){const A=n.toRef(()=>t[_]),g=o[_];n.isRef(g)&&i.run(()=>{n.watch(A,N=>{Xe(N)&&(g.value=N)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),h(),m()})()}),()=>i.stop()}function Kb(){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=>Eo(e.message))}}function qb(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=Xb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function Xb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function yd(){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:nl.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:Bt.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:Kb(),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 jb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Zb(e,t,o){const i=Yb(e),a=w=>{const C=w??[];e.hooks.updateNodeInternals.trigger(C)},l=w=>fb(w,e.nodes,e.edges),r=w=>ub(w,e.nodes,e.edges),s=w=>cn(w,e.edges),c=({id:w,type:C,nodeId:V})=>{var Y;const J=w?`-${C}-${w}`:`-${C}`;return Array.from(((Y=e.connectionLookup.get(`${V}${J}`))==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,C,V)=>{var Y,J;const ge=[];for(const we of w){const Ne={id:we.id,type:"position",dragging:V,from:we.from};if(C&&(Ne.position=we.position,we.parentNode)){const _e=d(we.parentNode);Ne.position={x:Ne.position.x-(((Y=_e==null?void 0:_e.computedPosition)==null?void 0:Y.x)??0),y:Ne.position.y-(((J=_e==null?void 0:_e.computedPosition)==null?void 0:J.y)??0)}}ge.push(Ne)}ge!=null&&ge.length&&e.hooks.nodesChange.trigger(ge)},h=w=>{if(!e.vueFlowRef)return;const C=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!C)return;const V=window.getComputedStyle(C),{m22:Y}=new window.DOMMatrixReadOnly(V.transform),J=[];for(const ge of w){const we=ge,Ne=d(we.id);if(Ne){const _e=xi(we.nodeElement);if(!!(_e.width&&_e.height&&(Ne.dimensions.width!==_e.width||Ne.dimensions.height!==_e.height||we.forceUpdate))){const Te=we.nodeElement.getBoundingClientRect();Ne.dimensions=_e,Ne.handleBounds.source=ad("source",we.nodeElement,Te,Y,Ne.id),Ne.handleBounds.target=ad("target",we.nodeElement,Te,Y,Ne.id),J.push({id:Ne.id,type:"dimensions",dimensions:_e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),J.length&&e.hooks.nodesChange.trigger(J)},m=(w,C)=>{const V=new Set,Y=new Set;for(const we of w)sn(we)?V.add(we.id):Gt(we)&&Y.add(we.id);const J=Wt(t.value,V,!0),ge=Wt(o.value,Y);if(e.multiSelectionActive){for(const we of V)J.push(Yt(we,C));for(const we of Y)ge.push(Yt(we,C))}J.length&&e.hooks.nodesChange.trigger(J),ge.length&&e.hooks.edgesChange.trigger(ge)},p=w=>{if(e.multiSelectionActive){const C=w.map(V=>Yt(V.id,!0));e.hooks.nodesChange.trigger(C);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(w.map(C=>C.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},y=w=>{if(e.multiSelectionActive){const C=w.map(V=>Yt(V.id,!0));e.hooks.edgesChange.trigger(C);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(w.map(C=>C.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},b=w=>{m(w,!0)},_=w=>{const V=(w||e.nodes).map(Y=>(Y.selected=!1,Yt(Y.id,!1)));e.hooks.nodesChange.trigger(V)},A=w=>{const V=(w||e.edges).map(Y=>(Y.selected=!1,Yt(Y.id,!1)));e.hooks.edgesChange.trigger(V)},g=w=>{if(!w||!w.length)return m([],!1);const C=w.reduce((V,Y)=>{const J=Yt(Y.id,!1);return sn(Y)?V.nodes.push(J):V.edges.push(J),V},{nodes:[],edges:[]});C.nodes.length&&e.hooks.nodesChange.trigger(C.nodes),C.edges.length&&e.hooks.edgesChange.trigger(C.edges)},N=w=>{var C;(C=e.d3Zoom)==null||C.scaleExtent([w,e.maxZoom]),e.minZoom=w},te=w=>{var C;(C=e.d3Zoom)==null||C.scaleExtent([e.minZoom,w]),e.maxZoom=w},S=w=>{var C;(C=e.d3Zoom)==null||C.translateExtent(w),e.translateExtent=w},O=w=>{e.nodeExtent=w,a()},z=w=>{var C;(C=e.d3Zoom)==null||C.clickDistance(w)},F=w=>{e.nodesDraggable=w,e.nodesConnectable=w,e.elementsSelectable=w},ne=w=>{const C=w instanceof Function?w(e.nodes):w;!e.initialized&&!C.length||(e.nodes=ld(C,d,e.hooks.error.trigger))},re=w=>{const C=w instanceof Function?w(e.edges):w;if(!e.initialized&&!C.length)return;const V=hl(C,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);pl(e.connectionLookup,o.value,V),e.edges=V},L=w=>{const C=w instanceof Function?w([...e.nodes,...e.edges]):w;!e.initialized&&!C.length||(ne(C.filter(sn)),re(C.filter(Gt)))},oe=w=>{let C=w instanceof Function?w(e.nodes):w;C=Array.isArray(C)?C:[C];const V=ld(C,d,e.hooks.error.trigger),Y=[];for(const J of V)Y.push(Kc(J));Y.length&&e.hooks.nodesChange.trigger(Y)},k=w=>{let C=w instanceof Function?w(e.edges):w;C=Array.isArray(C)?C:[C];const V=hl(C,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Y=[];for(const J of V)Y.push(Kc(J));Y.length&&e.hooks.edgesChange.trigger(Y)},W=(w,C=!0,V=!1)=>{const Y=w instanceof Function?w(e.nodes):w,J=Array.isArray(Y)?Y:[Y],ge=[],we=[];function Ne(Ce){const Te=s(Ce);for(const De of Te)(!Xe(De.deletable)||De.deletable)&&we.push(Xc(De.id,De.source,De.target,De.sourceHandle,De.targetHandle))}function _e(Ce){const Te=[];for(const De of e.nodes)De.parentNode===Ce&&Te.push(De);if(Te.length){for(const De of Te)ge.push(qc(De.id));C&&Ne(Te);for(const De of Te)_e(De.id)}}for(const Ce of J){const Te=typeof Ce=="string"?d(Ce):Ce;Te&&(Xe(Te.deletable)&&!Te.deletable||(ge.push(qc(Te.id)),C&&Ne([Te]),V&&_e(Te.id)))}we.length&&e.hooks.edgesChange.trigger(we),ge.length&&e.hooks.nodesChange.trigger(ge)},R=w=>{const C=w instanceof Function?w(e.edges):w,V=Array.isArray(C)?C:[C],Y=[];for(const J of V){const ge=typeof J=="string"?u(J):J;ge&&(Xe(ge.deletable)&&!ge.deletable||Y.push(Xc(typeof J=="string"?J:J.id,ge.source,ge.target,ge.sourceHandle,ge.targetHandle)))}e.hooks.edgesChange.trigger(Y)},G=(w,C,V=!0)=>{const Y=u(w.id);if(!Y)return!1;const J=e.edges.indexOf(Y),ge=Mb(w,C,Y,V,e.hooks.error.trigger);if(ge){const[we]=hl([ge],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ne,_e)=>_e===J?we:Ne),pl(e.connectionLookup,o.value,[we]),we}return!1},H=(w,C,V={replace:!1})=>{const Y=u(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;Y.data=V.replace?J:{...Y.data,...J}},ae=w=>Wc(w,e.nodes),v=w=>{const C=Wc(w,e.edges);return pl(e.connectionLookup,o.value,C),C},q=(w,C,V={replace:!1})=>{const Y=d(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;V.replace?e.nodes.splice(e.nodes.indexOf(Y),1,J):Object.assign(Y,J)},le=(w,C,V={replace:!1})=>{const Y=d(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;Y.data=V.replace?J:{...Y.data,...J}},me=(w,C,V=!1)=>{V?e.connectionClickStartHandle=w:e.connectionStartHandle=w,e.connectionEndHandle=null,e.connectionStatus=null,C&&(e.connectionPosition=C)},he=(w,C=null,V=null)=>{e.connectionStartHandle&&(e.connectionPosition=w,e.connectionEndHandle=C,e.connectionStatus=V)},se=(w,C)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,C?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ce=w=>{const C=cb(w),V=C?null:go(w)?w:d(w.id);return!C&&!V?[null,null,C]:[C?w:Ni(V),V,C]},ye=(w,C=!0,V=e.nodes)=>{const[Y,J,ge]=ce(w);if(!Y)return[];const we=[];for(const Ne of V||e.nodes){if(!ge&&(Ne.id===J.id||!Ne.computedPosition))continue;const _e=Ni(Ne),Ce=$i(_e,Y);(C&&Ce>0||Ce>=_e.width*_e.height||Ce>=Number(Y.width)*Number(Y.height))&&we.push(Ne)}return we},ke=(w,C,V=!0)=>{const[Y]=ce(w);if(!Y)return!1;const J=$i(Y,C);return V&&J>0||J>=Number(Y.width)*Number(Y.height)},Re=w=>{const{viewport:C,dimensions:V,d3Zoom:Y,d3Selection:J,translateExtent:ge}=e;if(!Y||!J||!w.x&&!w.y)return!1;const we=Tn.translate(C.x+w.x,C.y+w.y).scale(C.zoom),Ne=[[0,0],[V.width,V.height]],_e=Y.constrain()(we,Ne,ge),Ce=e.viewport.x!==_e.x||e.viewport.y!==_e.y||e.viewport.zoom!==_e.k;return Y.transform(J,_e),Ce},xe=w=>{const C=w instanceof Function?w(e):w,V=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(C.defaultEdgeOptions)&&(e.defaultEdgeOptions=C.defaultEdgeOptions);const Y=C.modelValue||C.nodes||C.edges?[]:void 0;Y&&(C.modelValue&&Y.push(...C.modelValue),C.nodes&&Y.push(...C.nodes),C.edges&&Y.push(...C.edges),L(Y));const J=()=>{Xe(C.maxZoom)&&te(C.maxZoom),Xe(C.minZoom)&&N(C.minZoom),Xe(C.translateExtent)&&S(C.translateExtent)};for(const ge of Object.keys(C)){const we=ge,Ne=C[we];![...jb,...V].includes(we)&&Xe(Ne)&&(e[we]=Ne)}Ba(()=>e.d3Zoom).not.toBeNull().then(J),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:L,setNodes:ne,setEdges:re,addNodes:oe,addEdges:k,removeNodes:W,removeEdges:R,findNode:d,findEdge:u,updateEdge:G,updateEdgeData:H,updateNode:q,updateNodeData:le,applyEdgeChanges:v,applyNodeChanges:ae,addSelectedElements:b,addSelectedNodes:p,addSelectedEdges:y,setMinZoom:N,setMaxZoom:te,setTranslateExtent:S,setNodeExtent:O,setPaneClickDistance:z,removeSelectedElements:g,removeSelectedNodes:_,removeSelectedEdges:A,startConnection:me,updateConnection:he,endConnection:se,setInteractive:F,setState:xe,getIntersectingNodes:ye,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:ke,panBy:Re,fitView:w=>i.value.fitView(w),zoomIn:w=>i.value.zoomIn(w),zoomOut:w=>i.value.zoomOut(w),zoomTo:(w,C)=>i.value.zoomTo(w,C),setViewport:(w,C)=>i.value.setViewport(w,C),setTransform:(w,C)=>i.value.setTransform(w,C),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(w,C,V)=>i.value.setCenter(w,C,V),fitBounds:(w,C)=>i.value.fitBounds(w,C),project:w=>i.value.project(w),screenToFlowCoordinate:w=>i.value.screenToFlowCoordinate(w),flowToScreenCoordinate:w=>i.value.flowToScreenCoordinate(w),toObject:()=>{const w=[],C=[];for(const V of e.nodes){const{computedPosition:Y,handleBounds:J,selected:ge,dimensions:we,isParent:Ne,resizing:_e,dragging:Ce,events:Te,...De}=V;w.push(De)}for(const V of e.edges){const{selected:Y,sourceNode:J,targetNode:ge,events:we,...Ne}=V;C.push(Ne)}return JSON.parse(JSON.stringify({nodes:w,edges:C,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:w=>new Promise(C=>{const{nodes:V,edges:Y,position:J,zoom:ge,viewport:we}=w;V&&ne(V),Y&&re(Y);const[Ne,_e]=we!=null&&we.x&&(we!=null&&we.y)?[we.x,we.y]:J??[null,null];if(Ne&&_e){const Ce=(we==null?void 0:we.zoom)||ge||e.viewport.zoom;return Ba(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ne,y:_e,zoom:Ce}).then(()=>{C(!0)})})}else C(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const w=yd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const C=Tn.translate(w.defaultViewport.x??0,w.defaultViewport.y??0).scale(rn(w.defaultViewport.zoom??1,w.minZoom,w.maxZoom)),V=e.viewportRef.getBoundingClientRect(),Y=[[0,0],[V.width,V.height]],J=e.d3Zoom.constrain()(C,Y,w.translateExtent);e.d3Zoom.transform(e.d3Selection,J)}xe(w)},$destroy:()=>{}}}const Jb=["data-id","data-handleid","data-nodeid","data-handlepos"],Qb={name:"Handle",compatConfig:{MODE:3}},dn=n.defineComponent({...Qb,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}=Le(),{id:m,node:p,nodeEl:y,connectedEdges:b}=pd(),_=n.ref(),A=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),g=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=n.toRef(()=>{var re,L,oe,k,W,R;return((re=r.value)==null?void 0:re.nodeId)===m&&((L=r.value)==null?void 0:L.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===m&&((W=c.value)==null?void 0:W.id)===e.id&&((R=c.value)==null?void 0:R.type)===i.value}),te=n.toRef(()=>{var re,L,oe;return((re=s.value)==null?void 0:re.nodeId)===m&&((L=s.value)==null?void 0:L.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:S,handleClick:O}=md({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),z=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(re=>{const L=re[`${i.value}Handle`];return re[i.value]!==m?!1:L?L===e.id:!0}):typeof e.connectable=="number"?b.value.filter(re=>{const L=re[`${i.value}Handle`];return re[i.value]!==m?!1:L?L===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(p,b.value):Xe(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var re;if(!p.dimensions.width||!p.dimensions.height)return;const L=(re=p.handleBounds[i.value])==null?void 0:re.find(ae=>ae.id===e.id);if(!d.value||L)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!y.value||!_.value||!oe||!e.id)return;const k=y.value.getBoundingClientRect(),W=_.value.getBoundingClientRect(),R=window.getComputedStyle(oe),{m22:G}=new window.DOMMatrixReadOnly(R.transform),H={id:e.id,position:e.position,x:(W.left-k.left)/G,y:(W.top-k.top)/G,type:i.value,nodeId:m,...xi(_.value)};p.handleBounds[i.value]=[...p.handleBounds[i.value]??[],H]});function F(re){const L=dl(re);z.value&&A.value&&(L&&re.button===0||!L)&&S(re)}function ne(re){!m||!s.value&&!A.value||z.value&&O(re)}return t({handleClick:O,handlePointerDown:S,onClick:ne,onPointerDown:F}),(re,L)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${n.unref(l)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":re.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${re.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(h),i.value,{connectable:z.value,connecting:te.value,connectablestart:A.value,connectableend:g.value,connectionindicator:z.value&&(A.value&&!N.value||g.value&&N.value)}]]),onMousedown:F,onTouchstartPassive:F,onClick:ne},[n.renderSlot(re.$slots,"default",{id:re.id})],42,Jb))}}),Ti=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})]};Ti.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ti.inheritAttrs=!1,Ti.compatConfig={MODE:3};const e0=Ti,Mi=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])]};Mi.props=["targetPosition","label","isValidTargetPos","connectable","data"],Mi.inheritAttrs=!1,Mi.compatConfig={MODE:3};const t0=Mi,Bi=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})]};Bi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Bi.inheritAttrs=!1,Bi.compatConfig={MODE:3};const n0=Bi,o0=["transform"],i0=["width","height","x","y","rx","ry"],a0=["y"],l0={name:"EdgeText",compatConfig:{MODE:3}},r0=n.defineComponent({...l0,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,i0)):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,a0)],8,o0))}}),s0=["id","d","marker-end","marker-start"],c0=["d","stroke-width"],d0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Di=n.defineComponent({...d0,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,s0),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,c0)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(r0,{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 gd({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 bd({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 Oi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function _d({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Se.Left:r=t-Oi(t-i,l),s=o;break;case Se.Right:r=t+Oi(i-t,l),s=o;break;case Se.Top:r=t,s=o-Oi(o-a,l);break;case Se.Bottom:r=t,s=o+Oi(a-o,l);break}return[r,s]}function kd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,curvature:s=.25}=e,[c,d]=_d({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=_d({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[h,m,p,y]=bd({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${a},${l}`,h,m,p,y]}function wd({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 Ed(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top}=e,[s,c]=wd({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=wd({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,h,m,p]=bd({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${l}`,f,h,m,p]}const 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 u0({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 Nd(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function f0({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=u0({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let m,p,y;const b={x:0,y:0},_={x:0,y:0},[A,g,N,te]=gd({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){p=a.x??A,y=a.y??g;const O=[{x:p,y:c.y},{x:p,y:d.y}],z=[{x:c.x,y},{x:d.x,y}];r[f]===h?m=f==="x"?O:z:m=f==="x"?z:O}else{const O=[{x:c.x,y:d.y}],z=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===h?z:O:m=r.y===h?O:z,t===i){const oe=Math.abs(e[f]-o[f]);if(oe<=l){const k=Math.min(l-1,l-oe);r[f]===h?b[f]=(c[f]>e[f]?-1:1)*k:_[f]=(d[f]>o[f]?-1:1)*k}}if(t!==i){const oe=f==="x"?"y":"x",k=r[f]===s[oe],W=c[oe]>d[oe],R=c[oe]<d[oe];(r[f]===1&&(!k&&W||k&&R)||r[f]!==1&&(!k&&R||k&&W))&&(m=f==="x"?O:z)}const F={x:c.x+b.x,y:c.y+b.y},ne={x:d.x+_.x,y:d.y+_.y},re=Math.max(Math.abs(F.x-m[0].x),Math.abs(ne.x-m[0].x)),L=Math.max(Math.abs(F.y-m[0].y),Math.abs(ne.y-m[0].y));re>=L?(p=(F.x+ne.x)/2,y=m[0].y):(p=m[0].x,y=(F.y+ne.y)/2)}return[[e,{x:c.x+b.x,y:c.y+b.y},...m,{x:d.x+_.x,y:d.y+_.y},o],p,y,N,te]}function m0(e,t,o,i){const a=Math.min(Nd(e,t)/2,Nd(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 gl(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,h,m,p,y]=f0({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,g)=>{let N;return g>0&&g<f.length-1?N=m0(f[g-1],A,f[g+1],s):N=`${g===0?"M":"L"}${A.x} ${A.y}`,_+=N,_},""),h,m,p,y]}function p0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=gd({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const h0=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]=p0(e);return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),$d=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]=gl({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),y0=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($d,{...e,...t,borderRadius:0})}}),g0=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]=kd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),b0=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]=Ed({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),_0={input:n0,default:e0,output:t0},k0={default:g0,straight:h0,step:y0,smoothstep:$d,simplebezier:b0};function w0(e,t,o){const i=n.computed(()=>y=>t.value.get(y)),a=n.computed(()=>y=>o.value.get(y)),l=n.computed(()=>{const y={...k0,...e.edgeTypes},b=Object.keys(y);for(const _ of e.edges)_.type&&!b.includes(_.type)&&(y[_.type]=_.type);return y}),r=n.computed(()=>{const y={..._0,...e.nodeTypes},b=Object.keys(y);for(const _ of e.nodes)_.type&&!b.includes(_.type)&&(y[_.type]=_.type);return y}),s=n.computed(()=>e.onlyRenderVisibleElements?Uc(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 y=[];for(const b of e.edges){const _=t.value.get(b.source),A=t.value.get(b.target);Eb({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})&&y.push(b)}return y}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const y=[];for(const b of e.nodes)b.selected&&y.push(b);return y}),f=n.computed(()=>{const y=[];for(const b of e.edges)b.selected&&y.push(b);return y}),h=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const y=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&y.push(b);return y}),p=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:l,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:p}}class un{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??un.instance;return un.instance=i??new un,o&&(o.config.globalProperties.$vueFlowStorage=un.instance),un.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=yd(),a=n.reactive(i),l={};for(const[h,m]of Object.entries(a.hooks)){const p=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;l[p]=m.on}const r={};for(const[h,m]of Object.entries(a.hooks))r[h]=m.trigger;const s=n.computed(()=>{const h=new Map;for(const m of a.nodes)h.set(m.id,m);return h}),c=n.computed(()=>{const h=new Map;for(const m of a.edges)h.set(m.id,m);return h}),d=w0(a,s,c),u=Zb(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...bp(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 Le(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(cd,null);typeof c<"u"&&c!==null&&(!r||c.id===r)&&(s=c)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const c=l??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,h,m)=>{const p=b=>{d.applyNodeChanges(b)},y=b=>{d.applyEdgeChanges(b)};f?(d.onNodesChange(p),d.onEdgesChange(y)):(d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(y)),m(()=>{d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(y)})},{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(cd,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 E0(e){const{emits:t,dimensions:o}=Le();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=xi(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 v0={name:"UserSelection",compatConfig:{MODE:3}},N0=n.defineComponent({...v0,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))}}),$0=["tabIndex"],x0={name:"NodesSelection",compatConfig:{MODE:3}},I0=n.defineComponent({...x0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Le(),s=hd(),c=n.ref(null),d=fd({el:c,onStart(p){t.selectionDragStart(p),t.nodeDragStart(p)},onDrag(p){t.selectionDrag(p),t.nodeDrag(p)},onStop(p){t.selectionDragStop(p),t.nodeDragStop(p)}});n.onMounted(()=>{var p;l.value||(p=c.value)==null||p.focus({preventScroll:!0})});const u=n.computed(()=>al(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(p){t.selectionContextMenu({event:p,nodes:i.value})}function m(p){l.value||Mn[p.key]&&(p.preventDefault(),s({x:Mn[p.key].x,y:Mn[p.key].y},p.shiftKey))}return(p,y)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(l)?void 0:-1,onContextmenu:h,onKeydown:m},null,46,$0)],6)):n.createCommentVNode("",!0)}});function S0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const C0={name:"Pane",compatConfig:{MODE:3}},R0=n.defineComponent({...C0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:l,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:h,removeEdges:m,selectionMode:p,deleteKeyCode:y,multiSelectionKeyCode:b,multiSelectionActive:_,edgeLookup:A,nodeLookup:g,connectionLookup:N,defaultEdgeOptions:te,connectionStartHandle:S,panOnDrag:O}=Le(),z=n.shallowRef(null),F=n.shallowRef(new Set),ne=n.shallowRef(new Set),re=n.shallowRef(null),L=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>S.value!==null);let k=!1,W=!1;const R=yo(y,{actInsideInputWithModifier:!1}),G=yo(b);n.watch(R,se=>{se&&(h(f.value),m(u.value),d.value=!1)}),n.watch(G,se=>{_.value=se});function H(se,ce){return ye=>{ye.target===ce&&(se==null||se(ye))}}function ae(se){if(k||oe.value){k=!1;return}a.paneClick(se),r(),d.value=!1}function v(se){var ce;if(Array.isArray(O.value)&&((ce=O.value)!=null&&ce.includes(2))){se.preventDefault();return}a.paneContextMenu(se)}function q(se){a.paneScroll(se)}function le(se){var ce,ye,ke;if(re.value=((ce=t.value)==null?void 0:ce.getBoundingClientRect())??null,!c.value||!e.isSelecting||se.button!==0||se.target!==z.value||!re.value)return;(ke=(ye=se.target)==null?void 0:ye.setPointerCapture)==null||ke.call(ye,se.pointerId);const{x:Re,y:xe}=S0(se,re.value);W=!0,k=!1,r(),s.value={width:0,height:0,startX:Re,startY:xe,x:Re,y:xe},a.selectionStart(se)}function me(se){var ce;if(!re.value||!s.value)return;k=!0;const{x:ye,y:ke}=xt(se,re.value),{startX:Re=0,startY:xe=0}=s.value,pe={startX:Re,startY:xe,x:ye<Re?ye:Re,y:ke<xe?ke:xe,width:Math.abs(ye-Re),height:Math.abs(ke-xe)},X=F.value,K=ne.value;F.value=new Set(Uc(o.value,pe,i.value,p.value===nl.Partial,!0).map(C=>C.id)),ne.value=new Set;const w=((ce=te.value)==null?void 0:ce.selectable)??!0;for(const C of F.value){const V=N.value.get(C);if(V)for(const{edgeId:Y}of V.values()){const J=A.value.get(Y);J&&(J.selectable??w)&&ne.value.add(Y)}}if(!sd(X,F.value)){const C=Wt(g.value,F.value,!0);a.nodesChange(C)}if(!sd(K,ne.value)){const C=Wt(A.value,ne.value);a.edgesChange(C)}s.value=pe,l.value=!0,d.value=!1}function he(se){var ce;se.button!==0||!W||((ce=se.target)==null||ce.releasePointerCapture(se.pointerId),!l.value&&s.value&&se.target===z.value&&ae(se),l.value=!1,s.value=null,d.value=F.value.size>0,a.selectionEnd(se),e.selectionKeyPressed&&(k=!1),W=!1)}return(se,ce)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:z,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:se.isSelecting}]),onClick:ce[0]||(ce[0]=ye=>L.value?void 0:H(ae,z.value)(ye)),onContextmenu:ce[1]||(ce[1]=ye=>H(v,z.value)(ye)),onWheelPassive:ce[2]||(ce[2]=ye=>H(q,z.value)(ye)),onPointerenter:ce[3]||(ce[3]=ye=>L.value?void 0:n.unref(a).paneMouseEnter(ye)),onPointerdown:ce[4]||(ce[4]=ye=>L.value?le(ye):n.unref(a).paneMouseMove(ye)),onPointermove:ce[5]||(ce[5]=ye=>L.value?me(ye):n.unref(a).paneMouseMove(ye)),onPointerup:ce[6]||(ce[6]=ye=>L.value?he(ye):void 0),onPointerleave:ce[7]||(ce[7]=ye=>n.unref(a).paneMouseLeave(ye))},[n.renderSlot(se.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(N0,{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(I0,{key:1})):n.createCommentVNode("",!0)],34))}}),V0={name:"Transform",compatConfig:{MODE:3}},A0=n.defineComponent({...V0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Le(),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))}}),T0={name:"Viewport",compatConfig:{MODE:3}},M0=n.defineComponent({...T0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:l,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:m,zoomOnScroll:p,preventScrolling:y,noWheelClassName:b,noPanClassName:_,emits:A,connectionStartHandle:g,userSelectionActive:N,paneDragging:te,d3Zoom:S,d3Selection:O,d3ZoomHandler:z,viewport:F,viewportRef:ne,paneClickDistance:re}=Le();E0(ne);const L=n.shallowRef(!1),oe=n.shallowRef(!1);let k=null,W=!1,R=0,G={x:0,y:0,zoom:0};const H=yo(s),ae=yo(r),v=yo(l),q=n.toRef(()=>(!ae.value||ae.value&&r.value===!0)&&(H.value||f.value)),le=n.toRef(()=>H.value||c.value),me=n.toRef(()=>r.value===!0&&q.value!==!0),he=n.toRef(()=>ae.value&&r.value!==!0||N.value||me.value),se=n.toRef(()=>g.value!==null);n.onMounted(()=>{if(!ne.value){Eo("Viewport element is missing");return}const xe=ne.value,pe=xe.getBoundingClientRect(),X=nb().clickDistance(re.value).scaleExtent([t.value,o.value]).translateExtent(a.value),K=ht(xe).call(X),w=K.on("wheel.zoom"),C=Tn.translate(i.value.x??0,i.value.y??0).scale(rn(i.value.zoom??1,t.value,o.value)),V=[[0,0],[pe.width,pe.height]],Y=X.constrain()(C,V,a.value);X.transform(K,Y),X.wheelDelta(ll),S.value=X,O.value=K,z.value=w,F.value={x:Y.x,y:Y.y,zoom:Y.k},X.on("start",J=>{var ge;if(!J.sourceEvent)return null;R=J.sourceEvent.button,L.value=!0;const we=ke(J.transform);((ge=J.sourceEvent)==null?void 0:ge.type)==="mousedown"&&(te.value=!0),G=we,A.viewportChangeStart(we),A.moveStart({event:J,flowTransform:we})}),X.on("end",J=>{if(!J.sourceEvent)return null;if(L.value=!1,te.value=!1,ce(q.value,R??0)&&!W&&A.paneContextMenu(J.sourceEvent),W=!1,ye(G,J.transform)){const ge=ke(J.transform);G=ge,A.viewportChangeEnd(ge),A.moveEnd({event:J,flowTransform:ge})}}),X.filter(J=>{var ge;const we=v.value||p.value,Ne=m.value&&J.ctrlKey,_e=J.button,Ce=J.type==="wheel";if(_e===1&&J.type==="mousedown"&&(Re(J,"vue-flow__node")||Re(J,"vue-flow__edge")))return!0;if(!q.value&&!we&&!le.value&&!h.value&&!m.value||N.value||se.value&&!Ce||!h.value&&J.type==="dblclick"||Re(J,b.value)&&Ce||Re(J,_.value)&&(!Ce||le.value&&Ce&&!v.value)||!m.value&&J.ctrlKey&&Ce||!we&&!le.value&&!Ne&&Ce)return!1;if(!m&&J.type==="touchstart"&&((ge=J.touches)==null?void 0:ge.length)>1)return J.preventDefault(),!1;if(!q.value&&(J.type==="mousedown"||J.type==="touchstart")||me.value&&Array.isArray(f.value)&&f.value.includes(0)&&_e===0||Array.isArray(f.value)&&!f.value.includes(_e)&&(J.type==="mousedown"||J.type==="touchstart"))return!1;const Te=Array.isArray(f.value)&&f.value.includes(_e)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!_e||_e<=1;return(!J.ctrlKey||H.value||Ce)&&Te}),n.watch([N,q],()=>{N.value&&!L.value?X.on("zoom",null):N.value||X.on("zoom",J=>{F.value={x:J.transform.x,y:J.transform.y,zoom:J.transform.k};const ge=ke(J.transform);W=ce(q.value,R??0),A.viewportChange(ge),A.move({event:J,flowTransform:ge})})},{immediate:!0}),n.watch([N,le,d,v,m,y,b],()=>{le.value&&!v.value&&!N.value?K.on("wheel.zoom",J=>{if(Re(J,b.value))return!1;const ge=v.value||p.value,we=m.value&&J.ctrlKey;if(!(!y.value||le.value||ge||we))return!1;J.preventDefault(),J.stopImmediatePropagation();const _e=K.property("__zoom").k||1,Ce=wo();if(!H.value&&J.ctrlKey&&m.value&&Ce){const I=Et(J),M=ll(J),B=_e*2**M;X.scaleTo(K,B,I,J);return}const Te=J.deltaMode===1?20:1;let De=d.value===ho.Vertical?0:J.deltaX*Te,E=d.value===ho.Horizontal?0:J.deltaY*Te;!Ce&&J.shiftKey&&d.value!==ho.Vertical&&!De&&E&&(De=E,E=0),X.translateBy(K,-(De/_e)*u.value,-(E/_e)*u.value);const T=ke(K.property("__zoom"));k&&clearTimeout(k),oe.value?(A.move({event:J,flowTransform:T}),A.viewportChange(T),k=setTimeout(()=>{A.moveEnd({event:J,flowTransform:T}),A.viewportChangeEnd(T),oe.value=!1},150)):(oe.value=!0,A.moveStart({event:J,flowTransform:T}),A.viewportChangeStart(T))},{passive:!1}):typeof w<"u"&&K.on("wheel.zoom",function(J,ge){const we=!y.value&&J.type==="wheel"&&!J.ctrlKey,Ne=v.value||p.value,_e=m.value&&J.ctrlKey;if(!Ne&&!c.value&&!_e&&J.type==="wheel"||we||Re(J,b.value))return null;J.preventDefault(),w.call(this,J,ge)},{passive:!1})},{immediate:!0})});function ce(xe,pe){return pe===2&&Array.isArray(xe)&&xe.includes(2)}function ye(xe,pe){return xe.x!==pe.x&&!Number.isNaN(pe.x)||xe.y!==pe.y&&!Number.isNaN(pe.y)||xe.zoom!==pe.k&&!Number.isNaN(pe.k)}function ke(xe){return{x:xe.x,y:xe.y,zoom:xe.k}}function Re(xe,pe){return xe.target.closest(`.${pe}`)}return(xe,pe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:ne,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(R0,{"is-selecting":he.value,"selection-key-pressed":n.unref(ae),class:n.normalizeClass({connecting:se.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(A0,null,{default:n.withCtx(()=>[n.renderSlot(xe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),B0=["id"],D0=["id"],O0=["id"],L0={name:"A11yDescriptions",compatConfig:{MODE:3}},P0=n.defineComponent({...L0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Le();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Vc)}-${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,B0),n.createElementVNode("div",{id:`${n.unref(Ac)}-${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,D0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(sb)}-${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,O0))],64))}});function z0(){const e=Le();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function U0(e,t,o){return o===Se.Left?e-t:o===Se.Right?e+t:e}function H0(e,t,o){return o===Se.Top?e-t:o===Se.Bottom?e+t:e}const bl=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:U0(t,e,i),cy:H0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};bl.props=["radius","centerX","centerY","position","type"],bl.compatConfig={MODE:3};const xd=bl,F0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:l,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:h,multiSelectionActive:m,disableKeyboardA11y:p,elementsSelectable:y,edgesUpdatable:b,edgesFocusable:_,hooks:A}=Le(),g=n.computed(()=>u(e.id)),{emit:N,on:te}=Lb(g.value,l),S=n.inject(Ri),O=n.getCurrentInstance(),z=n.ref(!1),F=n.ref(!1),ne=n.ref(""),re=n.ref(null),L=n.ref("source"),oe=n.ref(null),k=n.toRef(()=>typeof g.value.selectable>"u"?y.value:g.value.selectable),W=n.toRef(()=>typeof g.value.updatable>"u"?b.value:g.value.updatable),R=n.toRef(()=>typeof g.value.focusable>"u"?_.value:g.value.focusable);n.provide(Bb,e.id),n.provide(Db,oe);const G=n.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),H=n.computed(()=>g.value.style instanceof Function?g.value.style(g.value):g.value.style),ae=n.computed(()=>{const C=g.value.type||"default",V=S==null?void 0:S[`edge-${C}`];if(V)return V;let Y=g.value.template??c.value[C];if(typeof Y=="string"&&O){const J=Object.keys(O.appContext.components);J&&J.includes(C)&&(Y=n.resolveComponent(C,!1))}return Y&&typeof Y!="string"?Y:(l.error(new Je(qe.EDGE_TYPE_MISSING,Y)),!1)}),{handlePointerDown:v}=md({nodeId:ne,handleId:re,type:L,isValidConnection:h,edgeUpdaterType:L,onEdgeUpdate:me,onEdgeUpdateEnd:he});return()=>{const C=f(g.value.source),V=f(g.value.target),Y="pathOptions"in g.value?g.value.pathOptions:{};if(!C&&!V)return l.error(new Je(qe.EDGE_SOURCE_TARGET_MISSING,g.value.id,g.value.source,g.value.target)),null;if(!C)return l.error(new Je(qe.EDGE_SOURCE_MISSING,g.value.id,g.value.source)),null;if(!V)return l.error(new Je(qe.EDGE_TARGET_MISSING,g.value.id,g.value.target)),null;if(!g.value||g.value.hidden||C.hidden||V.hidden)return null;let J;i.value===Bt.Strict?J=C.handleBounds.source:J=[...C.handleBounds.source||[],...C.handleBounds.target||[]];const ge=Qc(J,g.value.sourceHandle);let we;i.value===Bt.Strict?we=V.handleBounds.target:we=[...V.handleBounds.target||[],...V.handleBounds.source||[]];const Ne=Qc(we,g.value.targetHandle),_e=(ge==null?void 0:ge.position)||Se.Bottom,Ce=(Ne==null?void 0:Ne.position)||Se.Top,{x:Te,y:De}=Dn(C,ge,_e),{x:E,y:T}=Dn(V,Ne,Ce);return g.value.sourceX=Te,g.value.sourceY=De,g.value.targetX=E,g.value.targetY=T,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ae.value===!1?"default":g.value.type||"default"}`,s.value,G.value,{updating:z.value,selected:g.value.selected,animated:g.value.animated,inactive:!k.value&&!A.value.edgeClick.hasListeners()}],tabIndex:R.value?0:void 0,"aria-label":g.value.ariaLabel===null?void 0:g.value.ariaLabel??`Edge from ${g.value.source} to ${g.value.target}`,"aria-describedby":R.value?`${Ac}-${t}`:void 0,"aria-roledescription":"edge",role:R.value?"group":"img",...g.value.domAttributes,onClick:ce,onContextmenu:ye,onDblclick:ke,onMouseenter:Re,onMousemove:xe,onMouseleave:pe,onKeyDown:R.value?w:void 0},[F.value?null:n.h(ae.value===!1?c.value.default:ae.value,{id:e.id,sourceNode:C,targetNode:V,source:g.value.source,target:g.value.target,type:g.value.type,updatable:W.value,selected:g.value.selected,animated:g.value.animated,label:g.value.label,labelStyle:g.value.labelStyle,labelShowBg:g.value.labelShowBg,labelBgStyle:g.value.labelBgStyle,labelBgPadding:g.value.labelBgPadding,labelBgBorderRadius:g.value.labelBgBorderRadius,data:g.value.data,events:{...g.value.events,...te},style:H.value,markerStart:`url('#${ko(g.value.markerStart,t)}')`,markerEnd:`url('#${ko(g.value.markerEnd,t)}')`,sourcePosition:_e,targetPosition:Ce,sourceX:Te,sourceY:De,targetX:E,targetY:T,sourceHandleId:g.value.sourceHandle,targetHandleId:g.value.targetHandle,interactionWidth:g.value.interactionWidth,...Y}),[W.value==="source"||W.value===!0?[n.h("g",{onMousedown:X,onMouseenter:q,onMouseout:le},n.h(xd,{position:_e,centerX:Te,centerY:De,radius:a.value,type:"source","data-type":"source"}))]:null,W.value==="target"||W.value===!0?[n.h("g",{onMousedown:K,onMouseenter:q,onMouseout:le},n.h(xd,{position:Ce,centerX:E,centerY:T,radius:a.value,type:"target","data-type":"target"}))]:null]])};function q(){z.value=!0}function le(){z.value=!1}function me(C,V){N.update({event:C,edge:g.value,connection:V})}function he(C){N.updateEnd({event:C,edge:g.value}),F.value=!1}function se(C,V){C.button===0&&(F.value=!0,ne.value=V?g.value.target:g.value.source,re.value=(V?g.value.targetHandle:g.value.sourceHandle)??null,L.value=V?"target":"source",N.updateStart({event:C,edge:g.value}),v(C))}function ce(C){var V;const Y={event:C,edge:g.value};k.value&&(r.value=!1,g.value.selected&&m.value?(d([g.value]),(V=oe.value)==null||V.blur()):o([g.value])),N.click(Y)}function ye(C){N.contextMenu({event:C,edge:g.value})}function ke(C){N.doubleClick({event:C,edge:g.value})}function Re(C){N.mouseEnter({event:C,edge:g.value})}function xe(C){N.mouseMove({event:C,edge:g.value})}function pe(C){N.mouseLeave({event:C,edge:g.value})}function X(C){se(C,!0)}function K(C){se(C,!1)}function w(C){var V;!p.value&&Tc.includes(C.key)&&k.value&&(C.key==="Escape"?((V=oe.value)==null||V.blur(),d([u(e.id)])):o([u(e.id)]))}}}),G0=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}=Le(),h=(e=n.inject(Ri))==null?void 0:e["connection-line"],m=n.computed(()=>{var A;return f((A=i.value)==null?void 0:A.nodeId)}),p=n.computed(()=>{var A;return f((A=a.value)==null?void 0:A.nodeId)??null}),y=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),b=n.computed(()=>c.value.markerStart?`url(#${ko(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${ko(c.value.markerEnd,t)})`:"");return()=>{var A,g,N;if(!m.value||!i.value)return null;const te=i.value.id,S=i.value.type,O=m.value.handleBounds;let z=(O==null?void 0:O[S])??[];if(o.value===Bt.Loose){const H=(O==null?void 0:O[S==="source"?"target":"source"])??[];z=[...z,...H]}if(!z)return null;const F=(te?z.find(H=>H.id===te):z[0])??null,ne=(F==null?void 0:F.position)??Se.Top,{x:re,y:L}=Dn(m.value,F,ne);let oe=null;p.value&&(o.value===Bt.Strict?oe=((A=p.value.handleBounds[S==="source"?"target":"source"])==null?void 0:A.find(H=>{var ae;return H.id===((ae=a.value)==null?void 0:ae.id)}))||null:oe=((g=[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]])==null?void 0:g.find(H=>{var ae;return H.id===((ae=a.value)==null?void 0:ae.id)}))||null);const k=((N=a.value)==null?void 0:N.position)??(ne?fl[ne]:null);if(!ne||!k)return null;const W=r.value??c.value.type??ln.Bezier;let R="";const G={sourceX:re,sourceY:L,sourcePosition:ne,targetX:y.value.x,targetY:y.value.y,targetPosition:k};return W===ln.Bezier?[R]=kd(G):W===ln.Step?[R]=gl({...G,borderRadius:0}):W===ln.SmoothStep?[R]=gl(G):W===ln.SimpleBezier?[R]=Ed(G):R=`M${re},${L} ${y.value.x},${y.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:re,sourceY:L,sourcePosition:ne,targetX:y.value.x,targetY:y.value.y,targetPosition:k,sourceNode:m.value,sourceHandle:F,targetNode:p.value,targetHandle:oe,markerEnd:_.value,markerStart:b.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":b.value})))}}}),Y0=["id","markerWidth","markerHeight","markerUnits","orient"],W0={name:"MarkerType",compatConfig:{MODE:3}},K0=n.defineComponent({...W0,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(ol).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(ol).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,Y0))}}),q0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},X0={name:"MarkerDefinitions",compatConfig:{MODE:3}},j0=n.defineComponent({...X0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Le(),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",q0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(K0,{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))])]))}}),Z0={name:"Edges",compatConfig:{MODE:3}},J0=n.defineComponent({...Z0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Le();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(j0),(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(vb)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(F0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(G0))],64))}}),Q0=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:l,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:m,disableKeyboardA11y:p,ariaLiveMessage:y,snapToGrid:b,snapGrid:_,nodeDragThreshold:A,nodesDraggable:g,elementsSelectable:N,nodesConnectable:te,nodesFocusable:S,hooks:O}=Le(),z=n.ref(null);n.provide(ud,z),n.provide(dd,e.id);const F=n.inject(Ri),ne=n.getCurrentInstance(),re=hd(),{node:L,parentNode:oe}=pd(e.id),{emit:k,on:W}=Hb(L,r),R=n.toRef(()=>typeof L.draggable>"u"?g.value:L.draggable),G=n.toRef(()=>typeof L.selectable>"u"?N.value:L.selectable),H=n.toRef(()=>typeof L.connectable>"u"?te.value:L.connectable),ae=n.toRef(()=>typeof L.focusable>"u"?S.value:L.focusable),v=n.computed(()=>G.value||R.value||O.value.nodeClick.hasListeners()||O.value.nodeDoubleClick.hasListeners()||O.value.nodeMouseEnter.hasListeners()||O.value.nodeMouseMove.hasListeners()||O.value.nodeMouseLeave.hasListeners()),q=n.toRef(()=>!!L.dimensions.width&&!!L.dimensions.height),le=n.computed(()=>{const V=L.type||"default",Y=F==null?void 0:F[`node-${V}`];if(Y)return Y;let J=L.template||f.value[V];if(typeof J=="string"&&ne){const ge=Object.keys(ne.appContext.components);ge&&ge.includes(V)&&(J=n.resolveComponent(V,!1))}return J&&typeof J!="string"?J:(r.error(new Je(qe.NODE_TYPE_MISSING,J)),!1)}),me=fd({id:e.id,el:z,disabled:()=>!R.value,selectable:G,dragHandle:()=>L.dragHandle,onStart(V){k.dragStart(V)},onDrag(V){k.drag(V)},onStop(V){k.dragStop(V)},onClick(V){w(V)}}),he=n.computed(()=>L.class instanceof Function?L.class(L):L.class),se=n.computed(()=>{const V=(L.style instanceof Function?L.style(L):L.style)||{},Y=L.width instanceof Function?L.width(L):L.width,J=L.height instanceof Function?L.height(L):L.height;return!V.width&&Y&&(V.width=typeof Y=="string"?Y:`${Y}px`),!V.height&&J&&(V.height=typeof J=="string"?J:`${J}px`),V}),ce=n.toRef(()=>Number(L.zIndex??se.value.zIndex??0));return u(V=>{(V.includes(e.id)||!V.length)&&ke()}),n.onMounted(()=>{n.watch(()=>L.hidden,(V=!1,Y,J)=>{!V&&z.value&&(e.resizeObserver.observe(z.value),J(()=>{z.value&&e.resizeObserver.unobserve(z.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>L.type,()=>L.sourcePosition,()=>L.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:z.value,forceUpdate:!0}])})}),n.watch([()=>L.position.x,()=>L.position.y,()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.x},()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.y},()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.z},ce,()=>L.selected,()=>L.dimensions.height,()=>L.dimensions.width,()=>{var V;return(V=oe.value)==null?void 0:V.dimensions.height},()=>{var V;return(V=oe.value)==null?void 0:V.dimensions.width}],([V,Y,J,ge,we,Ne])=>{const _e={x:V,y:Y,z:Ne+(m.value&&L.selected?1e3:0)};typeof J<"u"&&typeof ge<"u"?L.computedPosition=gb({x:J,y:ge,z:we},_e):L.computedPosition=_e},{flush:"post",immediate:!0}),n.watch([()=>L.extent,h],([V,Y],[J,ge])=>{(V!==J||Y!==ge)&&ye()}),L.extent==="parent"||typeof L.extent=="object"&&"range"in L.extent&&L.extent.range==="parent"?Ba(()=>q).toBe(!0).then(ye):ye(),()=>L.hidden?null:n.h("div",{ref:z,"data-id":L.id,class:["vue-flow__node",`vue-flow__node-${le.value===!1?"default":L.type||"default"}`,{[o.value]:R.value,dragging:me==null?void 0:me.value,draggable:R.value,selected:L.selected,selectable:G.value,parent:L.isParent},he.value],style:{visibility:q.value?"visible":"hidden",zIndex:L.computedPosition.z??ce.value,transform:`translate(${L.computedPosition.x}px,${L.computedPosition.y}px)`,pointerEvents:v.value?"all":"none",...se.value},tabIndex:ae.value?0:void 0,role:ae.value?"group":void 0,"aria-describedby":p.value?void 0:`${Vc}-${t}`,"aria-label":L.ariaLabel,"aria-roledescription":"node",...L.domAttributes,onMouseenter:Re,onMousemove:xe,onMouseleave:pe,onContextmenu:X,onClick:w,onDblclick:K,onKeydown:C},[n.h(le.value===!1?f.value.default:le.value,{id:L.id,type:L.type,data:L.data,events:{...L.events,...W},selected:L.selected,resizing:L.resizing,dragging:me.value,connectable:H.value,position:L.computedPosition,dimensions:L.dimensions,isValidTargetPos:L.isValidTargetPos,isValidSourcePos:L.isValidSourcePos,parent:L.parentNode,parentNodeId:L.parentNode,zIndex:L.computedPosition.z??ce.value,targetPosition:L.targetPosition,sourcePosition:L.sourcePosition,label:L.label,dragHandle:L.dragHandle,onUpdateNodeInternals:ke})]);function ye(){const V=L.computedPosition,{computedPosition:Y,position:J}=cl(L,b.value?Ci(V,_.value):V,r.error,h.value,oe.value);(L.computedPosition.x!==Y.x||L.computedPosition.y!==Y.y)&&(L.computedPosition={...L.computedPosition,...Y}),(L.position.x!==J.x||L.position.y!==J.y)&&(L.position=J)}function ke(){z.value&&d([{id:e.id,nodeElement:z.value,forceUpdate:!0}])}function Re(V){me!=null&&me.value||k.mouseEnter({event:V,node:L})}function xe(V){me!=null&&me.value||k.mouseMove({event:V,node:L})}function pe(V){me!=null&&me.value||k.mouseLeave({event:V,node:L})}function X(V){return k.contextMenu({event:V,node:L})}function K(V){return k.doubleClick({event:V,node:L})}function w(V){G.value&&(!i.value||!R.value||A.value>0)&&ml(L,l.value,c,s,a,!1,z.value),k.click({event:V,node:L})}function C(V){if(!(il(V)||p.value))if(Tc.includes(V.key)&&G.value){const Y=V.key==="Escape";ml(L,l.value,c,s,a,Y,z.value)}else R.value&&L.selected&&Mn[V.key]&&(V.preventDefault(),y.value=`Moved selected node ${V.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~L.position.x}, y: ${~~L.position.y}`,re({x:Mn[V.key].x,y:Mn[V.key].y},V.shiftKey))}}});function e1(e={includeHiddenNodes:!1}){const{nodes:t}=Le();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 t1={class:"vue-flow__nodes vue-flow__container"},n1={name:"Nodes",compatConfig:{MODE:3}},o1=n.defineComponent({...n1,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Le(),a=e1(),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",t1,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const h=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,h))return f;const m=(n.openBlock(),n.createBlock(n.unref(Q0),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return m.memo=h,m},s,0),128)):n.createCommentVNode("",!0)]))}});function i1(){const{emits:e}=Le();n.onMounted(()=>{if(id()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Je(qe.MISSING_STYLES))}})}const a1=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),l1={name:"VueFlow",compatConfig:{MODE:3}},r1=n.defineComponent({...l1,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=Da(i,"modelValue",o),r=Da(i,"nodes",o),s=Da(i,"edges",o),c=Le(i),d=Wb({modelValue:l,nodes:r,edges:s},i,c);return qb(o,c.hooks),z0(),i1(),n.provide(Ri,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(M0,null,{default:n.withCtx(()=>[n.createVNode(J0),a1,n.createVNode(o1),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(P0)],512))}}),s1={name:"Panel",compatConfig:{MODE:3}},Id=n.defineComponent({...s1,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Le(),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"],Sd={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function c1(e){return typeof e=="string"&&e in Sd}const d1={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},u1=.15;function f1(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 m1(e){if(typeof e!="string")return null;const t=f1(e);if(!t||t.s<u1)return null;let o=null,i=1/0;for(const a of fn){const l=Math.abs(t.h-d1[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(c1(t))return t;const o=e==null?void 0:e.properties;return m1((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function _l(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const p1={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)"},h1={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 Cd(e,t=!1){return e?t?h1[e]:p1[e]:null}function On(e){return Sd[e]}function Ln(e){return`var(--em-swatch-${e}-bar)`}const y1=["width","height","innerHTML"],g1=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,y1))}}),Ue=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ue(g1,[["__scopeId","data-v-92c1dba8"]]),b1={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",b1,[(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"]]),_1={class:"em-mlang"},k1={class:"em-mlang__tabs",role:"tablist"},w1=["aria-selected","onClick"],E1={key:0,class:"em-mlang__dot"},kl=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",_1,[n.createElementVNode("div",k1,[(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",E1,"•")):n.createCommentVNode("",!0)],10,w1))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ie.BSTextArea),{key:0,name:`${e.name}-${l.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`${e.name}-${l.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),v1=["disabled"],N1={class:"em-panel__sub-label"},$1={class:"em-field"},x1={class:"em-field"},I1={class:"em-field"},S1={class:"em-class"},C1={class:"em-field"},R1={class:"em-field"},V1={class:"em-field"},A1={class:"em-field"},T1={class:"em-multilang"},M1={class:"em-multilang"},B1={class:"em-jpa"},D1={class:"em-field"},O1={class:"em-field"},L1={class:"em-field"},P1={class:"em-swatch"},z1={class:"em-swatch__row"},U1=["title","onClick"],Rd=Ue(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(L=>L.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(L=>L.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var L;return it(((L=r.value)==null?void 0:L.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=L=>L;function h(L){return L==="inherit"?"기본(따름)":L}function m(L){l.value&&a.updateEntity(l.value.modelId,L)}function p(L,oe,k){var R;const W=((R=l.value)==null?void 0:R.table)??{physicalName:""};m(L==="physicalName"?{table:{...W,physicalName:k}}:{table:{...W,logicalName:{...W.logicalName,[oe]:k}}})}function y(L){m({description:Object.keys(L).length?L:void 0})}function b(L,oe){var k;m({jpaAttrs:{...(k=l.value)==null?void 0:k.jpaAttrs,[L]:oe}})}function _(L,oe){b(L,oe)}const A=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),g=n.computed(()=>{var L,oe;return!((oe=(L=l.value)==null?void 0:L.jpaAttrs)!=null&&oe.useDiscriminator)});function N(L){b("discriminatorType",L==="inherit"?void 0:L)}function te(L){m({hasPersonalInfo:L})}function S(L){m({superClass:L.trim()||void 0})}function O(L){m({schema:L.trim()||void 0})}function z(L){m({abstractClass:L})}const F=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function ne(L){const oe=L.split(",").map(k=>k.trim()).filter(Boolean);m({declarationOfInterfaces:oe.length?oe:void 0})}function re(L){l.value&&a.setEntitySwatch(l.value.modelId,L)}return(L,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",N1,[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",$1,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=G=>m({name:G}))},null,8,["model-value"])]),n.createElementVNode("label",x1,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=G=>m({stereotype:G}))},null,8,["model-value"])]),n.createElementVNode("label",I1,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=G=>m({packageName:G}))},null,8,["model-value"])]),n.createElementVNode("fieldset",S1,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",C1,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=G=>S(G))},null,8,["model-value"])]),n.createElementVNode("label",R1,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":F.value,"onUpdate:modelValue":oe[5]||(oe[5]=G=>ne(G))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=G=>z(G))},null,8,["model-value"])]),n.createElementVNode("label",V1,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-table",width:"100%","model-value":((k=l.value.table)==null?void 0:k.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=G=>p("physicalName",null,G))},null,8,["model-value"])]),n.createElementVNode("label",A1,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=G=>O(G))},null,8,["model-value"])]),n.createElementVNode("fieldset",T1,[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 H,ae;return n.openBlock(),n.createElementBlock("label",{key:G,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(G),1),n.createVNode(n.unref(ie.BSTextInput),{name:`ent-logical-${G}`,width:"100%","model-value":((ae=(H=l.value.table)==null?void 0:H.logicalName)==null?void 0:ae[G])??"","onUpdate:modelValue":v=>p("logicalName",G,v)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",M1,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":y},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",B1,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,G=>{var H;return n.createVNode(n.unref(ie.BSCheckbox),{key:G.key,name:`jpa-${G.key}`,class:"em-check",label:G.label,"model-value":!!((H=l.value.jpaAttrs)!=null&&H[G.key]),"onUpdate:modelValue":ae=>_(G.key,ae)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",D1,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:g.value,"model-value":((W=l.value.jpaAttrs)==null?void 0:W.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=G=>b("discriminatorColumnName",G.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",O1,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ie.BSSelect),{disabled:g.value,"model-value":A.value,items:u,"value-provider":f,"label-provider":h,"onUpdate:modelValue":oe[10]||(oe[10]=G=>G&&N(G))},null,8,["disabled","model-value"])]),n.createElementVNode("label",L1,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ie.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:g.value,"model-value":(R=l.value.jpaAttrs)==null?void 0:R.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=G=>b("discriminatorLength",G||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!l.value.hasPersonalInfo,"onUpdate:modelValue":te},null,8,["model-value"]),n.createElementVNode("fieldset",P1,[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=>re(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:H=>re(G)},null,14,U1))),128))])])],64)):n.createCommentVNode("",!0)],8,v1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),Vd=["ko","en","ja","zh"];function H1(e){if(e)for(const t of Vd){const o=e[t];if(o)return o}}function wl(e){const t=H1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function F1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Vd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const G1=["aria-expanded"],Y1=["aria-selected","onClick","onMouseenter"],W1={key:0,class:"gcc__opt gcc__opt--empty"},Ad=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(z=>z.groupCode===o.modelValue)),h=n.computed(()=>f.value?wl(f.value):"");n.watch(h,z=>{c.value||(s.value=z)},{immediate:!0});const m=n.computed(()=>s.value===h.value?o.items:F1(o.items,s.value));function p(){var F;const z=(F=a.value)==null?void 0:F.getBoundingClientRect();z&&(u.value={left:`${z.left}px`,top:`${z.bottom}px`,width:`${z.width}px`})}function y(){c.value=!0,p(),d.value=Math.max(0,m.value.findIndex(z=>z.groupCode===o.modelValue)),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),document.addEventListener("mousedown",O)}function b(){c.value=!1,window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p),document.removeEventListener("mousedown",O)}n.onBeforeUnmount(b);function _(){y(),n.nextTick(()=>{var z;return(z=l.value)==null?void 0:z.select()})}function A(){c.value||y(),d.value=0}function g(z){i("update:modelValue",z.groupCode),s.value=wl(z),b()}function N(){i("update:modelValue",void 0),s.value="",b()}function te(){s.value.trim()===""?N():(s.value=h.value,b())}function S(z){var F;if(z.key==="ArrowDown")c.value||y(),d.value=Math.min(d.value+1,m.value.length-1),z.preventDefault();else if(z.key==="ArrowUp")d.value=Math.max(d.value-1,0),z.preventDefault();else if(z.key==="Enter"){const ne=m.value[d.value];ne&&g(ne),z.preventDefault()}else z.key==="Escape"&&(s.value=h.value,b(),(F=l.value)==null||F.blur())}function O(z){var ne,re;const F=z.target;!((ne=a.value)!=null&&ne.contains(F))&&!((re=r.value)!=null&&re.contains(F))&&te()}return(z,F)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":F[0]||(F[0]=ne=>s.value=ne),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:A,onKeydown:S},null,40,G1),[[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:F[1]||(F[1]=n.withModifiers(()=>{},["prevent"])),onClick:N},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(ne,re)=>(n.openBlock(),n.createElementBlock("li",{key:ne.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":re===d.value,"is-selected":ne.groupCode===e.modelValue}]),role:"option","aria-selected":ne.groupCode===e.modelValue,onMousedown:F[2]||(F[2]=n.withModifiers(()=>{},["prevent"])),onClick:L=>g(ne),onMouseenter:L=>d.value=re},n.toDisplayString(n.unref(wl)(ne)),43,Y1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",W1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),K1=["disabled"],q1={class:"em-aw__toolbar"},X1={class:"em-aw__count"},j1={class:"em-aw__scroll"},Z1={class:"em-aw__table"},J1={key:0,class:"c-code"},Q1=["colspan"],e_={class:"c-del"},t_={class:"c-flag"},n_={class:"c-flag"},o_={class:"c-flag"},i_={class:"c-flag"},a_={class:"c-flag"},l_={class:"c-flag"},r_={class:"c-flag"},s_={class:"c-flag"},c_={key:0},d_=["title"],u_=["colspan"],f_={class:"c-del"},m_={class:"em-aw__embed-label"},p_={class:"em-aw__ro"},h_={class:"em-aw__ro"},y_={class:"em-aw__ro"},g_={class:"em-aw__ro"},b_={colspan:"8"},__=["colspan"],k_={key:0},w_="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Li="__OWN__",E_=Ue(n.defineComponent({__name:"EntityAttributesWide",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.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(M=>M.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(I){return I==="none"?"(없음)":I}const u=I=>I;function f(I,M){i.value&&o.updateAttribute(i.value.modelId,I.modelId,M)}function h(I){return!!i.value&&!!ti(o.state.logical,i.value.modelId,I.modelId)}function m(I,M){f(I,{naturalId:M||void 0,naturalIdMutable:M?I.naturalIdMutable:void 0})}function p(){return{naturalId:void 0,naturalIdMutable:void 0}}function y(I,M){f(I,{identifier:M,...M?p():{}})}function b(I,M){f(I,{transient:M||void 0,...M?p():{}})}function _(I){return!!I.transient}const A=I=>I.value,g=I=>I.label;function N(I,M){if(!M)return;const B=re.value.find(de=>de.type===M);if(B){const de=I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"};f(I,{type:M,customType:void 0,dbAttrs:[{...de,dataType:B.dataType,length:B.length,scale:B.scale}]});return}f(I,M===zt?{type:M}:{type:M,customType:void 0})}function te(I,M){f(I,{customType:M.trim()===""?void 0:M})}function S(I,M){const de={...I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"},...M};M.dataType!==void 0&&!Go.has(de.dataType)&&(de.scale=void 0),f(I,{dbAttrs:[de]})}function O(I){var M;return Go.has(((M=I.dbAttrs[0])==null?void 0:M.dataType)??"")}function z(I,M,B){var de;S(I,{logicalName:{...(de=I.dbAttrs[0])==null?void 0:de.logicalName,[M]:B}})}function F(I){return I.personalInfoAttributeType??"none"}function ne(I,M){f(I,{personalInfoAttributeType:M==="none"?void 0:M})}const re=n.computed(()=>o.predefinedCustomTypeCatalog.value),L=n.computed(()=>o.embeddableCatalog.value);function oe(I){var M,B;return((M=I.label)==null?void 0:M.ko)??((B=I.label)==null?void 0:B.en)??I.type}function k(I){!I||!i.value||o.addPredefinedEmbed(i.value.modelId,I)}const W=n.computed(()=>o.groupCodeCatalog.value);function R(I){var M;return((M=W.value.find(B=>B.groupCode===I.groupCode))==null?void 0:M.codes)??[]}function G(I){return["none",...R(I)]}function H(I){return I==="none"?"none":I.code}function ae(I){var B,de;if(I==="none")return"(없음)";const M=((B=I.label)==null?void 0:B.ko)??((de=I.label)==null?void 0:de.en);return M?`${I.code} (${M})`:I.code}function v(I,M){i.value&&o.setAttributeGroupCode(i.value.modelId,I.modelId,M)}function q(I,M){f(I,{defaultValue:M==="none"?void 0:M})}function le(I,M){f(I,{defaultValue:M.trim()===""?void 0:M})}function me(I){return I.attrType.startsWith("EMBED")&&I.dbAttrs.length>0}function he(I,M,B){const de=I.dbAttrs.map((be,Q)=>{if(Q!==M)return be;const Z={...be,...B};for(const j of Object.keys(B))B[j]===void 0&&delete Z[j];return Z});i.value&&o.setEmbedColumns(i.value.modelId,I.modelId,de)}function se(I,M,B,de){var be;he(I,M,{logicalName:{...(be=I.dbAttrs[M])==null?void 0:be.logicalName,[B]:de}})}function ce(I,M){var be,Q,Z;if(I.attrType==="EMBED_PREDEF"){const j=(be=o.embeddableCatalog.value.find(ue=>ue.type===I.type))==null?void 0:be.fields[M];return j?{name:j.name,physicalName:j.physicalName,dataType:j.dataType,length:j.length,shareable:j.shareable,logicalName:j.logicalName}:void 0}const B=(Q=I.embedded)==null?void 0:Q.embeddableRef;if(!B)return;const de=(Z=o.state.logical.entities.find(j=>j.modelId===B))==null?void 0:Z.attributes.flatMap(j=>j.dbAttrs)[M];return de?{physicalName:de.physicalName,dataType:de.dataType,length:de.length,scale:de.scale,logicalName:de.logicalName}:void 0}function ye(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.dataType)||((de=I.dbAttrs[M])==null?void 0:de.dataType)||""}function ke(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.length)??((de=I.dbAttrs[M])==null?void 0:de.length)}function Re(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.scale)??((de=I.dbAttrs[M])==null?void 0:de.scale)}const xe=["inherit","true","false"];function pe(I){return I==="inherit"?"기본(따름)":I}function X(I){return(I==null?void 0:I.updatable)===void 0?"inherit":I.updatable?"true":"false"}function K(I,M,B){he(I,M,{updatable:B==="inherit"?void 0:B==="true"})}function w(I,M){S(I,{updatable:M==="inherit"?void 0:M==="true"})}const C=["inherit","true","false"];function V(I){return I==="inherit"?"기본(따름)":I}function Y(I){return(I==null?void 0:I.insertable)===void 0?"inherit":I.insertable?"true":"false"}function J(I,M,B){he(I,M,{insertable:B==="inherit"?void 0:B==="true"})}function ge(I,M){S(I,{insertable:M==="inherit"?void 0:M==="true"})}const we=n.computed(()=>{var I;return Xn(((I=i.value)==null?void 0:I.attributes.flatMap(M=>M.dbAttrs))??[])}),Ne=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(M=>M.attrType==="NORMAL"&&M.dbAttrs.length===1&&M.dbAttrs[0]).map(M=>({modelId:M.dbAttrs[0].modelId,label:M.dbAttrs[0].physicalName||M.name}))});function _e(){return[Li,...Ne.value.map(I=>I.modelId)]}function Ce(I){if(I===Li)return"전용 컬럼(OWN)";const M=Ne.value.find(B=>B.modelId===I);return M?`↗ ${M.label} (공유)`:I}function Te(I){return(I==null?void 0:I.sharedColumnRef)??Li}function De(I,M,B){he(I,M,{sharedColumnRef:B===Li?void 0:B})}function E(I){return(I==null?void 0:I.sharedColumnRef)!=null}function T(I){var M;return((M=Yo(I,we.value))==null?void 0:M.physicalName)??""}return(I,M)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",q1,[n.createElementVNode("span",X1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:M[0]||(M[0]=B=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"구분선",onClick:M[1]||(M[1]=B=>n.unref(o).addDivider(i.value.modelId))}),L.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:L.value,"value-provider":B=>B.type,"label-provider":oe,"onUpdate:modelValue":k},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",j1,[n.createElementVNode("table",Z1,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[M[2]||(M[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),M[3]||(M[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),M[4]||(M[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),M[5]||(M[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),M[6]||(M[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),M[7]||(M[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),M[8]||(M[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),M[9]||(M[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),M[10]||(M[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),M[11]||(M[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),M[12]||(M[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),M[13]||(M[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),M[14]||(M[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),M[15]||(M[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),M[16]||(M[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),M[17]||(M[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),M[18]||(M[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),M[19]||(M[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),W.value.length?(n.openBlock(),n.createElementBlock("th",J1,"코드그룹")):n.createCommentVNode("",!0),M[20]||(M[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),M[21]||(M[21]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,B=>{var de,be,Q,Z,j,ue,x,D,$,U,P;return n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,Q1),n.createElementVNode("td",e_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2)):me(B)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:W.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(B.dbAttrs.length)+"개",9,u_),n.createElementVNode("td",f_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(ee,fe)=>{var Ie,Be,Me,Ke,Ge,Qe,Ye;return n.openBlock(),n.createElementBlock("tr",{key:ee.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",m_,"↳ "+n.toDisplayString(((Ie=ce(B,fe))==null?void 0:Ie.name)??((Be=ce(B,fe))==null?void 0:Be.physicalName)??`컬럼 ${fe+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",p_,n.toDisplayString(ye(B,fe)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-logical-${ee.modelId}`,width:"100%",placeholder:((Ke=(Me=ce(B,fe))==null?void 0:Me.logicalName)==null?void 0:Ke.ko)??"논리명","model-value":((Ge=ee.logicalName)==null?void 0:Ge.ko)??"","onUpdate:modelValue":Pe=>se(B,fe,"ko",Pe)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-col-${ee.modelId}`,width:"100%",disabled:E(ee),placeholder:((Qe=ce(B,fe))==null?void 0:Qe.physicalName)??"컬럼","model-value":E(ee)?T(ee):ee.physicalName,"onUpdate:modelValue":Pe=>he(B,fe,{physicalName:Pe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":ee.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",h_,n.toDisplayString(ye(B,fe)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",y_,n.toDisplayString(ke(B,fe)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",g_,n.toDisplayString(Re(B,fe)??""),1)]),n.createElementVNode("td",b_,[(Ye=ce(B,fe))!=null&&Ye.shareable?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":Te(ee),items:_e(),"value-provider":u,"label-provider":Ce,"onUpdate:modelValue":Pe=>Pe&&De(B,fe,Pe)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:E(ee),"model-value":E(ee)?"false":Y(ee),items:C,"value-provider":u,"label-provider":V,"onUpdate:modelValue":Pe=>Pe&&J(B,fe,Pe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:E(ee),"model-value":E(ee)?"false":X(ee),items:xe,"value-provider":u,"label-provider":pe,"onUpdate:modelValue":Pe=>Pe&&K(B,fe,Pe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:W.value.length?4:3},null,8,__)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(B.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:"타입",disabled:!!B.groupCode,items:n.unref(ur)(B.type,re.value),"value-provider":A,"label-provider":g,"model-value":B.type,"onUpdate:modelValue":ee=>N(B,ee)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),B.type===n.unref(zt)?(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":B.customType??"","onUpdate:modelValue":ee=>te(B,ee)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-logical-${B.modelId}`,width:"100%",placeholder:"논리명","model-value":((be=(de=B.dbAttrs[0])==null?void 0:de.logicalName)==null?void 0:be.ko)??"","onUpdate:modelValue":ee=>z(B,"ko",ee)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:"컬럼",disabled:_(B),"model-value":((Q=B.dbAttrs[0])==null?void 0:Q.physicalName)??"","onUpdate:modelValue":ee=>S(B,{physicalName:ee})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Z=B.dbAttrs[0])==null?void 0:Z.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:_(B),items:n.unref(cr)(((j=B.dbAttrs[0])==null?void 0:j.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(_a),"model-value":((ue=B.dbAttrs[0])==null?void 0:ue.dataType)??"","onUpdate:modelValue":ee=>ee&&S(B,{dataType:ee})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:_(B),"model-value":(x=B.dbAttrs[0])==null?void 0:x.length,"onUpdate:modelValue":ee=>S(B,{length:ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"100%",placeholder:"scale",disabled:_(B)||!O(B),"model-value":(D=B.dbAttrs[0])==null?void 0:D.scale,"onUpdate:modelValue":ee=>S(B,{scale:ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",t_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-pk-${B.modelId}`,"model-value":B.identifier,disabled:a.value||_(B),"onUpdate:modelValue":ee=>y(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",n_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nn-${B.modelId}`,"model-value":B.notNull,disabled:_(B),"onUpdate:modelValue":ee=>f(B,{notNull:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",o_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-uq-${B.modelId}`,"model-value":!!(($=B.dbAttrs[0])!=null&&$.unique),disabled:_(B),"onUpdate:modelValue":ee=>S(B,{unique:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",i_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-ai-${B.modelId}`,"model-value":!!((U=B.dbAttrs[0])!=null&&U.autoIncrement),disabled:_(B)||!B.identifier,"onUpdate:modelValue":ee=>S(B,{autoIncrement:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",a_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-tr-${B.modelId}`,"model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":ee=>b(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",l_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nid-${B.modelId}`,"model-value":!!B.naturalId,disabled:B.identifier||_(B),"onUpdate:modelValue":ee=>m(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",r_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nidm-${B.modelId}`,"model-value":!!B.naturalIdMutable,disabled:_(B)||!B.naturalId,"onUpdate:modelValue":ee=>f(B,{naturalIdMutable:ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",s_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-mv-${B.modelId}`,"model-value":!!((P=B.dbAttrs[0])!=null&&P.multiValue),disabled:_(B),"onUpdate:modelValue":ee=>S(B,{multiValue:ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-ins-${B.modelId}`,width:"100%",disabled:_(B),"model-value":Y(B.dbAttrs[0]),items:C,"value-provider":u,"label-provider":V,"onUpdate:modelValue":ee=>ee&&ge(B,ee)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-upd-${B.modelId}`,width:"100%",disabled:_(B),"model-value":X(B.dbAttrs[0]),items:xe,"value-provider":u,"label-provider":pe,"onUpdate:modelValue":ee=>ee&&w(B,ee)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":F(B),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":ee=>ee&&ne(B,ee)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("td",c_,[n.createVNode(Ad,{"model-value":B.groupCode,items:W.value,"onUpdate:modelValue":ee=>v(B,ee)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[R(B).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":B.defaultValue??"none",items:G(B),"value-provider":H,"label-provider":ae,"onUpdate:modelValue":ee=>ee&&q(B,ee)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"100%",placeholder:"기본값","model-value":B.defaultValue??"","onUpdate:modelValue":ee=>le(B,ee)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",{class:"c-del",title:h(B)?w_:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,d_)],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",k_,[...M[22]||(M[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,K1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7e02965"]]),v_=["disabled"],N_={class:"em-idxw__list"},$_={class:"em-idxw__list-head"},x_=["onClick"],I_={class:"em-idxw__item-name"},S_={key:0,class:"em-idxw__badge"},C_={class:"em-idxw__item-cnt"},R_={key:0,class:"em-idxw__empty"},V_={key:0,class:"em-idxw__edit"},A_={class:"em-idxw__form"},T_={class:"em-field em-idxw__name"},M_={class:"em-field"},B_=["value"],D_={class:"em-idxw__transfer"},O_={class:"em-idxw__pane"},L_={class:"em-idxw__pane-head"},P_={class:"em-idxw__cols"},z_=["onClick"],U_={key:0,class:"em-idxw__empty"},H_={class:"em-idxw__arrows"},F_={class:"em-idxw__pane"},G_={class:"em-idxw__pane-head"},Y_={class:"em-idxw__cols"},W_={class:"em-idxw__col-name"},K_={class:"em-idxw__col-ops"},q_=["disabled","onClick"],X_=["disabled","onClick"],j_=["onClick"],Z_={key:0,class:"em-idxw__empty"},J_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Q_=Ue(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(z=>z.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(()=>{var S;return new Set(((S=s.value)==null?void 0:S.columns.map(O=>O.columnRef))??[])}),d=n.computed(()=>l.value.filter(S=>!c.value.has(S.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(S){var z;const O=(z=S.dbAttrs[0])==null?void 0:z.physicalName;return O&&O!==S.name?`${S.name} (${O})`:S.name}function h(S){const O=l.value.find(z=>z.modelId===S);return O?f(O):S}function m(S,O){i.value&&o.updateIndex(i.value.modelId,S,O)}function p(){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 y(S){i.value&&o.removeIndex(i.value.modelId,S)}function b(S){s.value&&m(s.value.modelId,{parameters:S.trim()===""?void 0:S})}function _(S){const O=new Set(u.value);O.has(S)?O.delete(S):O.add(S),u.value=O}function A(){const S=s.value;if(!S||!u.value.size)return;const O=[...u.value].map(z=>({columnRef:z,descending:!1}));m(S.modelId,{columns:[...S.columns,...O]}),u.value=new Set}function g(S){const O=s.value;O&&m(O.modelId,{columns:O.columns.filter((z,F)=>F!==S)})}function N(S,O){const z=s.value;z&&m(z.modelId,{columns:z.columns.map((F,ne)=>ne===S?{...F,descending:O}:F)})}function te(S,O){const z=s.value;if(!z)return;const F=S+O;if(F<0||F>=z.columns.length)return;const ne=[...z.columns];[ne[S],ne[F]]=[ne[F],ne[S]],m(z.modelId,{columns:ne})}return(S,O)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",N_,[n.createElementVNode("div",$_,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:p})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,z=>(n.openBlock(),n.createElementBlock("li",{key:z.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":z.modelId===r.value}]),onClick:F=>r.value=z.modelId},[n.createElementVNode("span",I_,n.toDisplayString(z.name||"(이름 없음)"),1),z.unique?(n.openBlock(),n.createElementBlock("span",S_,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",C_,n.toDisplayString(z.columns.length),1)],10,x_))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",R_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",V_,[n.createElementVNode("div",A_,[n.createElementVNode("label",T_,[O[4]||(O[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":O[0]||(O[0]=z=>m(s.value.modelId,{name:z}))},null,8,["model-value"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":O[1]||(O[1]=z=>m(s.value.modelId,{unique:z}))},null,8,["model-value"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:O[2]||(O[2]=z=>y(s.value.modelId))})]),n.createElementVNode("label",M_,[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]=z=>b(z.target.value))},null,40,B_)]),n.createElementVNode("div",D_,[n.createElementVNode("div",O_,[n.createElementVNode("div",L_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",P_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,z=>(n.openBlock(),n.createElementBlock("li",{key:z.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(z.modelId)}]),onClick:F=>_(z.modelId)},n.toDisplayString(f(z)),11,z_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",U_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",H_,[n.createVNode(n.unref(ie.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:A},null,8,["disabled"])]),n.createElementVNode("div",F_,[n.createElementVNode("div",G_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",Y_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(z,F)=>(n.openBlock(),n.createElementBlock("li",{key:F,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",W_,n.toDisplayString(h(z.columnRef)),1),n.createVNode(n.unref(ie.BSCheckbox),{name:`idxw-desc-${F}`,class:"em-check",label:"DESC","model-value":z.descending,"onUpdate:modelValue":ne=>N(F,ne)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",K_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:F===0,onClick:ne=>te(F,-1)},"↑",8,q_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:F===s.value.columns.length-1,onClick:ne=>te(F,1)},"↓",8,X_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:ne=>g(F)},"✕",8,j_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Z_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",J_,"인덱스를 선택하거나 추가하세요."))],8,v_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),ek={class:"em-op-src"},tk={class:"em-op-src__actions"},Td=Ue(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",ek,[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",tk,[n.createVNode(n.unref(ie.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-2150d2fc"]]),nk=["disabled"],ok={class:"em-ow__toolbar"},ik={class:"em-ow__count"},ak={class:"em-ow__scroll"},lk={class:"em-ow__table"},rk={class:"c-del"},sk={key:0},ck=Ue(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModal(),a=n.computed(()=>o.state.logical.entities.find(p=>p.modelId===t.entityId)??null),l=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(p){return p==="none"?"(없음)":p}const c=p=>p;function d(p,y){a.value&&o.updateOperation(a.value.modelId,p.modelId,y)}function u(p,y,b){d(p,{description:{...p.description,[y]:b}})}function f(p){return p.personalInfoAttributeType??"none"}function h(p,y){d(p,{personalInfoAttributeType:y==="none"?void 0:y})}function m(p){i.openModal({component:Td,bind:{operationName:p.name,sourceCode:p.sourceCode??"",onSave:y=>d(p,{sourceCode:y})}})}return(p,y)=>{var b,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",ok,[n.createElementVNode("span",ik,"오퍼레이션 ("+n.toDisplayString(((b=a.value.operations)==null?void 0:b.length)??0)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:y[0]||(y[0]=A=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",ak,[n.createElementVNode("table",lk,[y[2]||(y[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 g;return n.openBlock(),n.createElementBlock("tr",{key:A.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-name-${A.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":A.name,"onUpdate:modelValue":N=>d(A,{name:N})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":A.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":N=>N&&d(A,{visibility:N})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-desc-${A.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((g=A.description)==null?void 0:g.ko)??"","onUpdate:modelValue":N=>u(A,"ko",N)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":f(A),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":N=>N&&h(A,N)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:A.sourceCode?"본문 ●":"본문",onClick:N=>m(A)},null,8,["caption","onClick"])]),n.createElementVNode("td",rk,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:N=>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",sk,[...y[1]||(y[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,nk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),dk={class:"em-detail__tabs"},uk=["onClick"],fk=Ue(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const l=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`엔티티 — ${((d=a.value)==null?void 0:d.name)??""}`},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",dk,[(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,uk)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(Rd,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(E_,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(Q_,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(ck,{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 Pi(e,t,o){e.openModal({component:fk,bind:{controller:n.markRaw(t),entityId:o}})}const Md="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function mk(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Oe(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const l=Oe();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Oe()}for(const a of t.indexes??[]){a.modelId=Oe();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const pn=Symbol("editorController");function Bd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function zi(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(Rt(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 pm(e,t,Oe))o.push(...zi(i,a));return o}function Dd(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 El(e,t){const o=to(e,t,Oe),i=zi(t,o),a=Dd(e,t,o);return i.push(...zn(a,t)),i}function Od(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Oe()}))}function pk(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,p)=>Math.max(m,p.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let h="id";for(let m=2;f.has(h);m++)h=`id${m}`;a={modelId:Oe(),name:h,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Oe(),physicalName:h.toLowerCase(),dataType:"BIGINT"}]},i.push(Rt(t,a))}const l=[];for(const u of e.entities)for(const f of u.attributes){if(((d=f.embedded)==null?void 0:d.embeddableRef)!==t)continue;const h=e.associations.find(b=>b.modelId===f.embedded.associationRef);if(!h)continue;const m=h.end1.entityRef===u.modelId,p=m?h.end1:h.end2,y=m?h.end2:h.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:h.modelId,end1:{entityRef:u.modelId,multiplicity:p.multiplicity,navigable:p.navigable,composition:!1},end2:{entityRef:t,multiplicity:y.multiplicity,navigable:y.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 m;return((m=h.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push(xn(u.ownerId,u.dispId)),i.push(Zo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...zi(t,s));const c=Dd(r,t,s);return i.push(...zn(c,t)),i}function hk(e,t){const o=e.entities.find(l=>l.modelId===t);if(!o)return[];const i=[],a=l=>l&&l.charAt(0).toLowerCase()+l.slice(1);for(const l of e.associations){if(l.end1.entityRef===l.end2.entityRef)continue;const r=l.end1.entityRef===t,s=l.end2.entityRef===t;if(!r&&!s)continue;const c=r?l.end2.entityRef:l.end1.entityRef,d=e.entities.find(g=>g.modelId===c);if(!d||d.attributes.some(g=>{var N;return((N=g.embedded)==null?void 0:N.associationRef)===l.modelId}))continue;const u=Oe(),f=d.attributes.reduce((g,N)=>Math.max(g,N.order),-1)+1,h=new Set(d.attributes.map(g=>g.name)),m=a(o.name);let p=m;for(let g=2;h.has(p);g++)p=`${m}${g}`;const y=o.attributes.filter(g=>!g.identifier&&!g.derivedFrom).flatMap(g=>g.dbAttrs).map(g=>({...g,modelId:Oe()})),b={modelId:u,name:p,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(Rt(c,b));const _=r?"end2":"end1",A=r?"end1":"end2";i.push(Zo(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 yk(e=Bd(),t={}){var Te,De;const o=n.reactive(e);let i=new Ia(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),h=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),p=n.ref(!1),y=n.ref(!1),b=n.ref(0),_=n.ref(null);let A=0;const g=E=>{if(t.onNotice){t.onNotice(E);return}_.value={text:E,id:++A}},N=n.ref(((Te=t.meta)==null?void 0:Te.schemaVersion)??1),te=n.ref(((De=t.meta)==null?void 0:De.opWriteEnabled)??!1),S=n.computed(()=>N.value>=2&&te.value),O=t.historyTransport,z=n.computed(()=>S.value&&O!==void 0),F=t.restoreTransport,ne=n.ref(0),re=n.computed(()=>S.value&&oe.value&&F!==void 0);async function L(E){if(!F||!oe.value)return{ok:!1,reason:"unavailable"};const T=await F(E);return T.ok&&ne.value++,T}const oe=n.ref(!(N.value>=2&&te.value===!1)),k=n.ref("LOGICAL_PHYSICAL"),W=n.ref("straight"),R=n.ref(!0),G=n.ref(!0),H=n.ref(null),ae=n.computed(()=>{var E;return((E=H.value)==null?void 0:E.kind)==="attribute"?{entityId:H.value.entityId,attrId:H.value.anchor}:null}),v=n.computed(()=>{var E;return((E=H.value)==null?void 0:E.kind)==="attribute"?H.value.ids:[]}),q=n.computed(()=>{var E,T;return((E=H.value)==null?void 0:E.kind)==="entity"?H.value.id:((T=H.value)==null?void 0:T.kind)==="attribute"?H.value.entityId:null}),le=n.ref(null);let me=0;const he=n.ref(null),se=n.ref(null);let ce=t.meta;function ye(){i.onChange(()=>{m.value=i.canUndo,p.value=i.canRedo,y.value=i.isDirty,b.value++})}ye();let ke=null,Re=null;function xe(){Re==null||Re(),Re=null,ke=null}function pe(){if(xe(),!S.value||!t.opTransport)return;const E=new ss({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:T=>{oe.value=!1,se.value=T},onError:t.onOpError});E.seed((ce==null?void 0:ce.revSeed)??{}),Re=E.attach(i),ke=E}pe();const X=n.computed(()=>jl(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(()=>pr(o.logical,K.value)),C=n.computed(()=>{const E=new Map;for(const T of w.value){if(!T.targetRef)continue;const I=E.get(T.targetRef);I?I.push(T):E.set(T.targetRef,[T])}return E}),V=E=>{oe.value&&i.execute(E)},Y=E=>o.layout.entityLayouts.some(T=>T.entityRef===E&&!!T.locked),J=E=>o.layout.groupLayouts.some(T=>T.groupRef===E&&!!T.locked),ge=E=>{const T=o.logical.associations.find(I=>I.modelId===E);return!!T&&(Y(T.end1.entityRef)||Y(T.end2.entityRef))},we=(E,T,I)=>{if(Y(E))return;const M=en(E,T,I),B=Pn(o.logical,E,be=>be.map(Q=>Q.modelId===T?{...Q,...I}:Q)),de=zn(B,E);V(de.length?Fe("속성 수정",[M,...de]):M)};function Ne(E){const T=E.map(Z=>o.layout.entityLayouts.find(j=>j.entityRef===Z)).filter(Z=>!!Z);if(!T.length)return{location:{x:40,y:40},size:{width:400,height:300}};let I=1/0,M=1/0,B=-1/0,de=-1/0;for(const Z of T){const j=Z.geo.size.width||220,ue=Z.geo.size.height||140;I=Math.min(I,Z.geo.location.x),M=Math.min(M,Z.geo.location.y),B=Math.max(B,Z.geo.location.x+j),de=Math.max(de,Z.geo.location.y+ue)}const be=40,Q=28;return{location:{x:I-be,y:M-be-Q},size:{width:B-I+be*2,height:de-M+be*2+Q}}}function _e(E,T,I){var Z;const M=o.layout.groupLayouts.find(j=>j.groupRef===E),B=(M==null?void 0:M.geo.location)??T,de=T.x-B.x,be=T.y-B.y,Q=[Rr(E,T),...I.map(j=>$n(j.id,j.location))];if(de||be){const j=new Set(((Z=o.logical.groups.find(ue=>ue.modelId===E))==null?void 0:Z.memberEntityRefs)??[]);for(const ue of o.logical.associations){if(!j.has(ue.end1.entityRef)||!j.has(ue.end2.entityRef))continue;const x=o.layout.associationLayouts.find(D=>D.associationRef===ue.modelId);x&&x.waypoints.length&&Q.push(Yr(ue.modelId,de,be))}for(const ue of(M==null?void 0:M.memberNoteRefs)??[]){const x=o.layout.notes.find(D=>D.modelId===ue);x&&Q.push(eo(ue,{x:x.geo.location.x+de,y:x.geo.location.y+be}))}}return Q}const Ce={state:o,resolved:X,issues:w,issuesByRef:C,flagEntitiesWithoutRelations:h,canUndo:m,canRedo:p,dirty:y,revision:b,notice:_,editable:oe,schemaVersion:N,opWriteEnabled:te,opMode:S,opConflict:se,historyTransport:O,historyAvailable:z,restoreTransport:F,restoreAvailable:re,restoreToSeq:L,reloadRequest:ne,displayMode:k,routingMode:W,showGrid:R,showMinimap:G,selection:H,selectedAttr:ae,selectedAttrIds:v,inspectedEntityId:q,focusRequest:le,clipboard:he,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(E){oe.value=E&&S.value},setEmbeddableCatalog(E){a.value=E},setGroupCodeCatalog(E){l.value=E},setPredefinedCustomTypeCatalog(E){r.value=E},selectAttribute(E,T,I="replace"){const M=H.value,B=(M==null?void 0:M.kind)==="attribute"&&M.entityId===E;if(I==="replace"||!B){H.value={kind:"attribute",entityId:E,ids:[T],anchor:T};return}if(I==="toggle"){const x=M.ids.includes(T),D=x?M.ids.filter(U=>U!==T):[...M.ids,T];if(!D.length){H.value=null;return}const $=x&&M.anchor===T?D[D.length-1]:x?M.anchor:T;H.value={kind:"attribute",entityId:E,ids:D,anchor:$};return}const de=o.logical.entities.find(x=>x.modelId===E),be=[...(de==null?void 0:de.attributes)??[]].sort((x,D)=>x.order-D.order).map(x=>x.modelId),Q=be.indexOf(M.anchor),Z=be.indexOf(T);if(Q<0||Z<0){H.value={kind:"attribute",entityId:E,ids:[T],anchor:T};return}const[j,ue]=Q<=Z?[Q,Z]:[Z,Q];H.value={kind:"attribute",entityId:E,ids:be.slice(j,ue+1),anchor:M.anchor}},moveAttributeFocus(E){const T=H.value;if((T==null?void 0:T.kind)!=="attribute")return!1;const I=o.logical.entities.find(be=>be.modelId===T.entityId);if(!I||!I.attributes.length)return!1;const M=I.attributes.findIndex(be=>be.modelId===T.anchor);if(M<0)return!1;const B=Math.min(Math.max(M+E,0),I.attributes.length-1);if(B===M)return!0;const de=I.attributes[B].modelId;return H.value={kind:"attribute",entityId:T.entityId,ids:[de],anchor:de},!0},nudgeSelectedAttributes(E){const T=H.value;if((T==null?void 0:T.kind)!=="attribute")return!1;const I=o.logical.entities.find(x=>x.modelId===T.entityId);if(!I)return!1;const M=I.attributes,B=new Set(T.ids),de=M.map((x,D)=>B.has(x.modelId)?D:-1).filter(x=>x>=0);if(!de.length)return!1;const be=Math.min(...de),Q=M.filter(x=>!B.has(x.modelId)),Z=M.slice(0,be).filter(x=>!B.has(x.modelId)).length;let j;if(E<0){if(Z<=0)return!0;j=Z-1}else{if(Q.length-Z<=0)return!0;j=Z+1}if(Y(T.entityId))return!0;const ue=M.filter(x=>B.has(x.modelId)).map(x=>x.modelId);return V(Va(T.entityId,ue,j)),!0},deleteSelection(){if(!oe.value)return!1;const E=H.value;if(!E)return!1;if(E.kind==="attribute"){if(Y(E.entityId))return!1;const T=E.ids;if(!T.length)return!1;T.length===1?Ce.removeAttribute(E.entityId,T[0]):Ce.removeAttributes(E.entityId,T)}else if(E.kind==="entity"){if(Y(E.id))return!1;Ce.removeEntity(E.id)}else if(E.kind==="note")Ce.removeNote(E.id);else if(E.kind==="group"){if(J(E.id))return!1;Ce.removeGroup(E.id)}else Ce.removeAssociation(E.id);return H.value=null,!0},nudgeNodes(E,T,I){if(!E.length||T===0&&I===0)return!1;const M=new Set(o.logical.entities.map(j=>j.modelId)),B=new Set(o.logical.groups.map(j=>j.modelId)),de=new Set(o.layout.notes.map(j=>j.modelId)),be=new Set;for(const j of E){if(!B.has(j))continue;const ue=o.logical.groups.find(x=>x.modelId===j);for(const x of(ue==null?void 0:ue.memberEntityRefs)??[])be.add(x)}const Q=[],Z=[];for(const j of E)if(B.has(j)){if(J(j))continue;const ue=o.layout.groupLayouts.find(U=>U.groupRef===j);if(!ue)continue;const x=o.logical.groups.find(U=>U.modelId===j),D=((x==null?void 0:x.memberEntityRefs)??[]).map(U=>{var ee;const P=((ee=o.layout.entityLayouts.find(fe=>fe.entityRef===U))==null?void 0:ee.geo.location)??{x:0,y:0};return{id:U,location:{x:P.x+T,y:P.y+I}}}),$={x:ue.geo.location.x+T,y:ue.geo.location.y+I};Q.push(Fe("그룹 이동",_e(j,$,D))),Z.push("g:"+j)}else if(M.has(j)){if(be.has(j)||Y(j))continue;const ue=o.layout.entityLayouts.find(x=>x.entityRef===j);if(!ue)continue;Q.push($n(j,{x:ue.geo.location.x+T,y:ue.geo.location.y+I})),Z.push("e:"+j)}else if(de.has(j)){const ue=o.layout.notes.find(x=>x.modelId===j);if(!ue)continue;Q.push(eo(j,{x:ue.geo.location.x+T,y:ue.geo.location.y+I})),Z.push("n:"+j)}return Q.length?(V(Fe("이동",Q,"nudge:"+Z.sort().join(","))),!0):!1},requestFocus(E){le.value={id:E,nonce:++me}},undo:()=>{oe.value&&i.undo()},redo:()=>{oe.value&&i.redo()},markSaved:()=>{oe.value&&(ke==null||ke.flush(),i.markSavePoint())},loadDiagram(E,T){xe(),o.logical=E.logical,o.layout=E.layout,i=new Ia(o),ye(),N.value=(T==null?void 0:T.schemaVersion)??1,te.value=(T==null?void 0:T.opWriteEnabled)??!1,oe.value=!(N.value>=2&&te.value===!1),ce=T,se.value=null,H.value=null,m.value=i.canUndo,p.value=i.canRedo,y.value=i.isDirty,pe()},flush(){ke==null||ke.flush()},whenOpsSettled(){return(ke==null?void 0:ke.whenSettled())??Promise.resolve()},addEntity(E="NewEntity",T={x:80,y:80}){const I=Oe(),M={modelId:I,name:E,stereotype:"JPA_ENTITY",table:{physicalName:E.toLowerCase()},attributes:[{modelId:Oe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Oe(),physicalName:"id",dataType:"BIGINT"}]}]};return V(Sa(M,{location:{...T},size:{width:220,height:140}})),I},renameEntity(E,T){Y(E)||V(Er(E,T))},updateEntity(E,T){if(Y(E))return;const I=wr(E,T),M=o.logical.entities.find(be=>be.modelId===E),B=T.stereotype==="JPA_EMBEDDABLE"&&!!M&&M.stereotype!=="JPA_EMBEDDABLE",de=!!T.stereotype&&T.stereotype!=="JPA_EMBEDDABLE"&&!!M&&M.stereotype==="JPA_EMBEDDABLE";if(B&&M){const be=M.attributes.filter(x=>x.identifier&&!x.derivedFrom).map(x=>en(E,x.modelId,{identifier:!1})),Q=Pn({...o.logical,entities:o.logical.entities.map(x=>x.modelId===E?{...x,stereotype:"JPA_EMBEDDABLE"}:x)},E,x=>x.map(D=>D.identifier&&!D.derivedFrom?{...D,identifier:!1}:D)),Z=El(Q,E),j=hk(o.logical,E),ue=[I,...be,...Z,...j];V(ue.length>1?Fe("임베더블 변환",ue):I);return}if(de){const be=pk(o.logical,E),Q=[I,...be];V(Q.length>1?Fe("엔터티 전환",Q):I);return}V(I)},moveEntity(E,T){Y(E)||V($n(E,T))},resizeEntity(E,T){Y(E)||V(vr(E,T))},removeEntity(E){Y(E)||V(kr(E))},setEntitySwatch(E,T){V(Nr(E,T))},setEntityCollapsed(E,T){V($r(E,T))},setEntityLocked(E,T){V(xr(E,T))},isEntityLocked(E){return Y(E)},collapseAll(){V(Ca(!0))},expandAll(){V(Ca(!1))},setAttributeSwatch(E,T,I){V(Xo(E,T,I))},dragGroup(E,T,I){J(E)||V(Fe("그룹 이동",_e(E,T,I)))},resizeGroup(E,T){J(E)||V(Vr(E,T))},setGroupSwatch(E,T){V(Ar(E,T))},setGroupLocked(E,T){V(Tr(E,T))},isGroupLocked(E){return J(E)},updateGroup(E,T){J(E)||V(Ir(E,T))},createGroup(E,T){if(!E.length)return null;const I=[];for(const de of o.logical.groups)for(const be of E)de.memberEntityRefs.includes(be)&&I.push(jo(de.modelId,be));const M=Oe(),B={modelId:M,name:T?{ko:T}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...E]};return I.push(Ra(B,Ne(E))),V(Fe("그룹 생성",I)),H.value=null,M},addEmptyGroup(E,T){const I=Oe();return V(Ra({modelId:I,name:T?{ko:T}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...E},size:{width:360,height:260}})),I},removeGroup(E){J(E)||V(Sr(E))},dropEntity(E,T,I){var de;if(Y(E))return;const M=((de=o.logical.groups.find(be=>be.memberEntityRefs.includes(E)))==null?void 0:de.modelId)??null,B=[$n(E,T)];M!==I&&(M&&B.push(jo(M,E)),I&&B.push(Cr(I,E))),V(Fe("이동",B))},ungroupEntity(E){const T=o.logical.groups.find(I=>I.memberEntityRefs.includes(E));T&&V(jo(T.modelId,E))},dropNote(E,T,I){var de;const M=((de=o.layout.groupLayouts.find(be=>{var Q;return(Q=be.memberNoteRefs)==null?void 0:Q.includes(E)}))==null?void 0:de.groupRef)??null,B=[eo(E,T)];M!==I&&(M&&B.push(es(M,E)),I&&B.push(Qr(I,E))),V(Fe("이동",B))},addPredefinedEmbed(E,T){if(Y(E))return;const I=a.value.find(Z=>Z.type===T),M=o.logical.entities.find(Z=>Z.modelId===E);if(!I||!M)return;const B=M.attributes.reduce((Z,j)=>Math.max(Z,j.order),-1)+1,de=Oe(),be=I.fields.map(()=>({modelId:Oe(),physicalName:"",dataType:""})),Q={modelId:de,name:I.defaultName,type:I.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:B,dbAttrs:be};return V(Rt(E,Q)),de},addAttribute(E,T={}){if(Y(E))return T.modelId??"";const I=o.logical.entities.find(ue=>ue.modelId===E),M=I?I.attributes.length:0,B=T.modelId??Oe(),de=T.name??`field${M}`,be={modelId:B,name:de,type:T.type??ka,attrType:T.attrType??"NORMAL",identifier:T.identifier??!1,notNull:T.notNull??!1,order:M,dbAttrs:T.dbAttrs??[{modelId:Oe(),physicalName:de,dataType:"VARCHAR",length:255}],...T},Q=Rt(E,be),Z=Pn(o.logical,E,ue=>[...ue,be]),j=zn(Z,E);return V(j.length?Fe("속성 추가",[Q,...j]):Q),B},addDivider(E){if(Y(E))return"";const T=o.logical.entities.find(de=>de.modelId===E),I=T?T.attributes.length:0,M=Oe();return V(Rt(E,{modelId:M,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:I,dbAttrs:[]})),M},updateAttribute(E,T,I){we(E,T,I)},setAttributeGroupCode(E,T,I){we(E,T,{groupCode:I,type:I?qn:ka})},setEmbedColumns(E,T,I){var Z,j;if(Y(E))return;const M=en(E,T,{dbAttrs:I}),B=(Z=o.logical.entities.find(ue=>ue.modelId===E))==null?void 0:Z.attributes.find(ue=>ue.modelId===T),de=(j=B==null?void 0:B.embedded)==null?void 0:j.associationRef,be=de?o.logical.associations.find(ue=>ue.modelId===de):void 0,Q=[];be&&de&&(be.end1.legacyEmbedRaw&&Q.push(In(de,"end1",{legacyEmbedRaw:void 0})),be.end2.legacyEmbedRaw&&Q.push(In(de,"end2",{legacyEmbedRaw:void 0}))),V(Q.length?Fe("임베드 컬럼 수정",[M,...Q]):M)},removeAttribute(E,T){if(Y(E))return;if(ti(o.logical,E,T)){g(Md);return}const I=xn(E,T),M=Pn(o.logical,E,de=>de.filter(be=>be.modelId!==T)),B=zn(M,E);V(B.length?Fe("속성 삭제",[I,...B]):I)},removeAttributes(E,T){var Q;if(!T.length||Y(E))return;const I=T.filter(Z=>!ti(o.logical,E,Z));if(I.length<T.length&&g(Md),!I.length)return;const M=I.map(Z=>xn(E,Z)),B=new Set(I),de=Pn(o.logical,E,Z=>Z.filter(j=>!B.has(j.modelId))),be=[...M,...zn(de,E)];V(be.length===1?be[0]:Fe("속성 삭제",be)),((Q=H.value)==null?void 0:Q.kind)==="attribute"&&H.value.entityId===E&&(H.value=null)},setAttributeSwatches(E,T,I){T.length&&(T.length===1?V(Xo(E,T[0],I)):V(Fe("속성 색상",T.map(M=>Xo(E,M,I)))))},reorderAttributes(E,T,I){!T.length||Y(E)||V(Va(E,T,I))},addIndex(E,T){Y(E)||V(zr(E,T))},updateIndex(E,T,I){Y(E)||V(Ur(E,T,I))},removeIndex(E,T){Y(E)||V(Hr(E,T))},addOperation(E,T={}){var be;if(Y(E))return T.modelId??"";const I=o.logical.entities.find(Q=>Q.modelId===E),M=((be=I==null?void 0:I.operations)==null?void 0:be.length)??0,B=T.modelId??Oe(),de={modelId:B,name:T.name??`method${M}`,visibility:T.visibility??"PACKAGE",order:M,...T};return V(Mr(E,de)),B},updateOperation(E,T,I){Y(E)||V(Br(E,T,I))},removeOperation(E,T){Y(E)||V(Dr(E,T))},reorderOperations(E,T,I){!T.length||Y(E)||V(Or(E,T,I))},setOperationSwatch(E,T,I){V(Lr(E,T,I))},addAssociation(E,T,I,M){if(Y(E)||Y(T))return"";const B=Oe(),de={modelId:B,end1:{entityRef:E,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:I},end2:{entityRef:T,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},be={...o.logical,associations:[...o.logical.associations,de]},Q=to(be,T,Oe),Z=Q.add[0];Z&&(de.end2.attributeRef=Z.modelId);const j={associationRef:B,waypoints:[],sourceColumnRef:I,targetColumnRef:(Z==null?void 0:Z.modelId)??M},ue=Aa(de,j),x=zi(T,Q);return V(x.length?Fe("관계 추가",[ue,...x]):ue),B},addEmbedAssociation(E,T){if(Y(E))return;const I=o.logical.entities.find(ee=>ee.modelId===E),M=o.logical.entities.find(ee=>ee.modelId===T);if(!I||!M||M.stereotype!=="JPA_EMBEDDABLE")return;const B=Oe(),de=Oe(),be=Oe(),Q=I.attributes.reduce((ee,fe)=>Math.max(ee,fe.order),-1)+1,Z=Od(M),j=ee=>ee&&ee.charAt(0).toLowerCase()+ee.slice(1),ue=new Set(I.attributes.map(ee=>ee.name)),x=j(M.name);let D=x;for(let ee=2;ue.has(D);ee++)D=`${x}${ee}`;const $={modelId:de,name:D,type:M.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:Q,dbAttrs:Z,embedded:{associationRef:B,embeddableRef:T}},U={modelId:B,end1:{entityRef:E,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:be},end2:{entityRef:T,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:de}},P={associationRef:B,waypoints:[],sourceColumnRef:de,targetColumnRef:void 0};return V(Fe("임베드 추가",[Rt(E,$),Aa(U,P)])),B},setEmbedCollectionMode(E,T){if(ge(E))return;const I=o.logical.associations.find(j=>j.modelId===E);if(!I)return;let M,B;for(const j of o.logical.entities){const ue=j.attributes.find(x=>{var D;return((D=x.embedded)==null?void 0:D.associationRef)===E&&x.attrType==="EMBED_OWN"});if(ue){M=j.modelId,B=ue;break}}if(!M||!B)return;const de=B.embedded.embeddableRef,be=I.end2.entityRef===de?"end2":"end1",Q=I[be],Z=Q.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(T==="COLLECTION"?Z:!Z))if(T==="COLLECTION")V(Fe("임베드 컬렉션 전환",[en(M,B.modelId,{dbAttrs:[]}),In(E,be,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...Q.jpa,collectionType:"LIST"}})]));else{const j=o.logical.entities.find(ue=>ue.modelId===de);if(!j)return;V(Fe("임베드 단일 전환",[en(M,B.modelId,{dbAttrs:Od(j)}),In(E,be,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...Q.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(E){if(ge(E))return;const T=o.logical.associations.find(be=>be.modelId===E),I=Pr(E);if(!T){V(I);return}for(const be of o.logical.entities){const Q=be.attributes.find(Z=>{var j;return((j=Z.embedded)==null?void 0:j.associationRef)===E});if(Q){V(Fe("임베드 삭제",[I,xn(be.modelId,Q.modelId)]));return}}const M=T.end2.entityRef,B={...o.logical,associations:o.logical.associations.filter(be=>be.modelId!==E)},de=El(B,M);V(de.length?Fe("관계 삭제",[I,...de]):I)},setAssociationIdentifying(E,T){if(ge(E))return;const I=o.logical.associations.find(Q=>Q.modelId===E),M=Zo(E,{identifying:T});if(!I||I.identifying===T){V(M);return}const B=I.end2.entityRef,de={...o.logical,associations:o.logical.associations.map(Q=>Q.modelId===E?{...Q,identifying:T}:Q)},be=El(de,B);V(be.length?Fe("식별 관계 변경",[M,...be]):M)},updateAssociationEnd(E,T,I){ge(E)||V(In(E,T,I))},moveWaypoint(E,T,I){V(Fr(E,T,I))},addWaypoint(E,T,I){V(Kr(E,T,I))},removeWaypoint(E,T){V(Gr(E,T))},clearWaypoints(E){V(Wr(E))},addNote(E="메모",T={x:80,y:80}){const I=Oe();return V(qr({modelId:I,memo:E,geo:{location:{...T},size:{width:200,height:120}}})),I},removeNote(E){V(Xr(E))},moveNote(E,T){V(eo(E,T))},resizeNote(E,T){V(jr(E,T))},setNoteMemo(E,T){V(Zr(E,T))},setNoteSwatch(E,T){V(Jr(E,T))},addNoteConnection(E,T){V(ts(E,T))},removeNoteConnection(E,T){V(ns(E,T))},moveNoteConnectionWaypoint(E,T,I,M){V(os(E,T,I,M))},addNoteConnectionWaypoint(E,T,I,M){V(is(E,T,I,M))},removeNoteConnectionWaypoint(E,T,I){V(as(E,T,I))},clearNoteConnectionWaypoints(E,T){V(ls(E,T))},autoLayout(){const E=Ql(o.logical,o.layout);E.length&&V(Fe("자동 배치",E.map(T=>$n(T.id,T.location))))},copy(){const E=H.value;if((E==null?void 0:E.kind)==="attribute"){const de=o.logical.entities.find(Q=>Q.modelId===E.entityId);if(!de)return;const be=[...de.attributes].sort((Q,Z)=>Q.order-Z.order).filter(Q=>E.ids.includes(Q.modelId));if(!be.length)return;he.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:be}));return}const T=q.value;if(!T)return;const I=o.logical.entities.find(de=>de.modelId===T),M=o.layout.entityLayouts.find(de=>de.entityRef===T);if(!I)return;const B=(M==null?void 0:M.geo)??{location:{x:80,y:80},size:{width:220,height:140}};he.value=JSON.parse(JSON.stringify({kind:"entity",entity:I,geo:B}))},paste(){if(!oe.value)return;const E=he.value;if(!E)return;if(E.kind==="attribute"){const M=q.value;if(!M)return;const B=o.logical.entities.find(ue=>ue.modelId===M);if(!B)return;const de=new Set(B.attributes.map(ue=>ue.name)),be=new Set(B.attributes.flatMap(ue=>ue.dbAttrs.map(x=>x.physicalName))),Q=B.attributes.length,Z=[],j=E.attributes.map((ue,x)=>{const D=JSON.parse(JSON.stringify(ue));D.modelId=Oe();for(const $ of D.dbAttrs)$.modelId=Oe();de.has(D.name)&&(D.name=`${D.name}_copy`);for(const $ of D.dbAttrs)$.physicalName&&be.has($.physicalName)&&($.physicalName=`${$.physicalName}_copy`);return D.order=Q+x,Z.push(D.modelId),Rt(M,D)});V(j.length===1?j[0]:Fe("속성 붙여넣기",j)),H.value={kind:"attribute",entityId:M,ids:Z,anchor:Z[Z.length-1]};return}const T=mk(E.entity),I={location:{x:E.geo.location.x+40,y:E.geo.location.y+40},size:{...E.geo.size}};V(Sa(T,I)),H.value={kind:"entity",id:T.modelId}}};return Ce}const Ui=Symbol("groupHover"),Ld=Symbol("groupDrag"),Un=Symbol("relationHighlight"),gk={key:0,class:"em-sel","aria-hidden":"true"},bk=["title","aria-expanded","disabled"],_k={class:"em-entity__stereotype"},kk={key:1,class:"em-entity__name"},wk=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Ek=["onPointerdown"],vk={key:1,class:"em-entity__divider-label"},Nk=["title"],$k={class:"em-key-slot"},xk={class:"em-key-slot"},Ik={key:0,class:"em-entity__type"},Sk=["onClick"],Ck={class:"em-entity__attrname"},Rk={class:"em-entity__type"},Vk=["data-op"],Ak=["onPointerdown"],Tk={class:"em-entity__op-vis","aria-hidden":"true"},Mk=["title"],Bk={key:4,class:"em-entity__footer"},Pd=Ue(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=ie.useModal();function a(){o&&Pi(i,o,t.id)}const l=n.inject(Ui,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),m=n.computed(()=>{var Q;return((Q=o==null?void 0:o.selection.value)==null?void 0:Q.kind)==="entity"&&o.selection.value.id===t.id}),p=n.computed(()=>!!t.selected&&!m.value),y=n.computed(()=>{var Q;return o&&((Q=o.selectedAttr.value)==null?void 0:Q.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),b=n.computed(()=>y.value.size>0);function _(Q,Z){const j=Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,Q.modelId,j)}const A=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),g=n.computed(()=>t.data.entity),N=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),te=n.computed(()=>t.data.collapsed??!1),S=n.computed(()=>t.data.locked??!1);function O(){s.value&&(o==null||o.setEntityCollapsed(t.id,!te.value))}const z=n.computed(()=>N.value==="PHYSICAL"||N.value==="LOGICAL_PHYSICAL"),F=n.computed(()=>{const Q=N.value==="PHYSICAL"||N.value==="LOGICAL_PHYSICAL",Z={};for(const j of g.value.attributes){const ue=j.attrType.startsWith("RELATION")&&j.dbAttrs.length>0;Z[j.modelId]={pk:j.identifier,fk:ue&&Q,required:j.notNull&&!j.identifier}}return Z});function ne(Q){if(!Q)return"";const Z=[];return Q.pk&&Q.fk?Z.push("PFK (식별 외래키)"):Q.pk?Z.push("PK (기본키)"):Q.fk&&Z.push("FK (외래키)"),Q.required&&Z.push("필수 (NOT NULL)"),Z.join(" · ")}const re=n.computed(()=>{const Q=_l(it(t.data.style)),Z={};return Q&&(Z["--em-header-bg"]=Q.bar,Z["--em-header-fg"]=Q.barOn),Z});function L(Q){var Z,j;return(j=_l(it((Z=t.data.attributeStyles)==null?void 0:Z[Q.modelId])))==null?void 0:j.text}const oe=n.computed(()=>[...g.value.operations??[]].sort((Q,Z)=>Q.order-Z.order)),k=n.computed(()=>N.value==="CLASS"&&oe.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function R(Q){return Q?W[Q]:"~"}function G(Q){var Z,j;return(j=_l(it((Z=t.data.operationStyles)==null?void 0:Z[Q.modelId])))==null?void 0:j.text}function H(Q,Z,j){switch(N.value){case"CLASS":return[{text:Q}];case"PHYSICAL":return[{text:j||Q}];case"LOGICAL":return[Z?{text:Z}:{text:"(논리명)",missing:!0}];default:{const ue=Z?{text:Z}:{text:"(논리명)",missing:!0};return j?[ue,{text:` · ${j}`}]:[ue]}}}function ae(Q){var Z,j,ue;return v(Q)?[{text:Q.name}]:H(Q.name,(j=(Z=Q.dbAttrs[0])==null?void 0:Z.logicalName)==null?void 0:j.ko,((ue=Q.dbAttrs[0])==null?void 0:ue.physicalName)??"")}function v(Q){return Q.attrType.startsWith("EMBED")&&Q.dbAttrs.length>0}function q(Q){return Q.attrType==="DIVIDER"}function le(Q){if(Q.attrType!=="EMBED_PREDEF")return Q.dbAttrs;const Z=o==null?void 0:o.embeddableCatalog.value.find(ue=>ue.type===Q.type);if(!Z)return Q.dbAttrs;const j=Xn(g.value.attributes.flatMap(ue=>ue.dbAttrs));return Q.dbAttrs.map((ue,x)=>{const D=Z.fields[x],$=Yo(ue,j);return $?{...ue,physicalName:$.physicalName,logicalName:ue.logicalName??(D==null?void 0:D.logicalName),dataType:ue.dataType||(D==null?void 0:D.dataType)||""}:D?{...ue,physicalName:ue.physicalName||D.physicalName,logicalName:ue.logicalName??D.logicalName,dataType:ue.dataType||D.dataType,length:ue.length??D.length}:ue})}function me(Q){var Z;return H(Q.physicalName,(Z=Q.logicalName)==null?void 0:Z.ko,Q.physicalName)}function he(Q){const Z=fr(Q,(o==null?void 0:o.state.logical.associations)??[]);return Ea(N.value,Q,Z)}const se=n.computed(()=>{var Q,Z,j;return H(g.value.name,(Z=(Q=g.value.table)==null?void 0:Q.logicalName)==null?void 0:Z.ko,((j=g.value.table)==null?void 0:j.physicalName)??"")}),ce=n.ref(!1),ye=n.ref(""),ke=n.ref(null);async function Re(){var Q,Z;s.value&&(ye.value=g.value.name,ce.value=!0,await n.nextTick(),(Q=ke.value)==null||Q.focus(),(Z=ke.value)==null||Z.select())}function xe(){if(!ce.value)return;ce.value=!1;const Q=ye.value.trim();Q&&Q!==g.value.name&&(o==null||o.renameEntity(t.id,Q))}function pe(){o==null||o.addAttribute(t.id)}function X(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:K,findNode:w}=Le(),C=n.ref(null),V=n.computed(()=>{const Q=C.value??t.data.size;return Q?{width:`${Q.width}px`,minHeight:`${Q.height}px`}:void 0});let Y=null;function J(Q){var ue,x,D;if(!s.value)return;Q.stopPropagation();const Z=(ue=w(t.id))==null?void 0:ue.dimensions,j=K({x:Q.clientX,y:Q.clientY});Y={fx:j.x,fy:j.y,w:(Z==null?void 0:Z.width)??((x=t.data.size)==null?void 0:x.width)??200,h:(Z==null?void 0:Z.height)??((D=t.data.size)==null?void 0:D.height)??120},Q.target.setPointerCapture(Q.pointerId)}function ge(Q){if(!Y)return;const Z=K({x:Q.clientX,y:Q.clientY});C.value={width:Math.max(40,Y.w+(Z.x-Y.fx)),height:Math.max(40,Y.h+(Z.y-Y.fy))}}function we(Q){var Z,j,ue;if(Y&&C.value&&o){const x=(Z=w(t.id))==null?void 0:Z.dimensions;o.resizeEntity(t.id,{width:Math.round((x==null?void 0:x.width)??C.value.width),height:Math.round((x==null?void 0:x.height)??C.value.height)})}Y=null,C.value=null,(ue=(j=Q.target).releasePointerCapture)==null||ue.call(j,Q.pointerId)}const Ne=n.ref(null),_e=n.ref(null);function Ce(Q,Z){if(!s.value)return;Z.stopPropagation(),Z.preventDefault();const j=y.value,ue=j.has(Q.modelId)?new Set(j):new Set([Q.modelId]);_e.value={ids:ue,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId)}function Te(Q){if(!_e.value||!Ne.value)return;const Z=Array.from(Ne.value.querySelectorAll(".em-entity__row"));if(!Z.length)return;let j=Z.length;for(let D=0;D<Z.length;D++){const $=Z[D].getBoundingClientRect();if(Q.clientY<$.top+$.height/2){j=D;break}}const ue=Z[Z.length-1],x=j<Z.length?Z[j].offsetTop:ue.offsetTop+ue.offsetHeight;_e.value={..._e.value,dropIndex:j,lineY:x}}function De(){const Q=_e.value;if(_e.value=null,!Q||Q.dropIndex<0)return;const Z=g.value.attributes,j=Z.filter(U=>Q.ids.has(U.modelId)).map(U=>U.modelId),ue=Z.filter((U,P)=>Q.ids.has(U.modelId)&&P<Q.dropIndex).length,x=Q.dropIndex-ue,D=Z.filter(U=>!Q.ids.has(U.modelId)).map(U=>U.modelId);[...D.slice(0,x),...j,...D.slice(x)].join(",")!==Z.map(U=>U.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,j,x))}function E(){_e.value=null}const T=n.ref(null),I=n.ref(null);function M(Q,Z){s.value&&(Z.stopPropagation(),Z.preventDefault(),I.value={id:Q.modelId,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId))}function B(Q){if(!I.value||!T.value)return;const Z=Array.from(T.value.querySelectorAll(".em-entity__op-row"));if(!Z.length)return;let j=Z.length;for(let D=0;D<Z.length;D++){const $=Z[D].getBoundingClientRect();if(Q.clientY<$.top+$.height/2){j=D;break}}const ue=Z[Z.length-1],x=j<Z.length?Z[j].offsetTop:ue.offsetTop+ue.offsetHeight;I.value={...I.value,dropIndex:j,lineY:x}}function de(){const Q=I.value;if(I.value=null,!Q||Q.dropIndex<0)return;const j=oe.value.findIndex(x=>x.modelId===Q.id);if(j<0)return;const ue=Q.dropIndex-(j<Q.dropIndex?1:0);ue!==j&&(o==null||o.reorderOperations(t.id,[Q.id],ue))}function be(){I.value=null}return(Q,Z)=>(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":m.value,"is-multi-selected":p.value,"has-focused-attr":b.value,"is-locked":S.value}]),style:n.normalizeStyle(V.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",gk,[...Z[7]||(Z[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(re.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(O,["stop"]),onPointerdown:Z[0]||(Z[0]=n.withModifiers(()=>{},["stop"])),onDblclick:Z[1]||(Z[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(te.value?"▸":"▾"),41,bk),n.createElementVNode("span",_k,"«"+n.toDisplayString(g.value.stereotype)+"»",1),ce.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ke,"onUpdate:modelValue":Z[2]||(Z[2]=j=>ye.value=j),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(xe,["enter"]),Z[3]||(Z[3]=n.withKeys(j=>ce.value=!1,["esc"]))],onBlur:xe,onPointerdown:Z[4]||(Z[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ye.value]]):(n.openBlock(),n.createElementBlock("span",kk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se.value,(j,ue)=>(n.openBlock(),n.createElementBlock("span",{key:ue,class:n.normalizeClass({"em-entity__missing":j.missing})},n.toDisplayString(j.text),3))),128))])),S.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:Ne,class:"em-entity__attrs"},[_e.value&&_e.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${_e.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value.attributes,j=>{var ue,x,D,$;return n.openBlock(),n.createElementBlock(n.Fragment,{key:j.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":y.value.has(j.modelId),"is-dragging":(ue=_e.value)==null?void 0:ue.ids.has(j.modelId),"is-embed":v(j),"is-divider":q(j),nodrag:q(j)&&s.value}]),"data-attr":j.modelId,onClick:n.withModifiers(U=>_(j,U),["stop"]),onPointerdown:U=>q(j)?Ce(j,U):void 0,onPointermove:U=>q(j)?Te(U):void 0,onPointerup:U=>q(j)?De():void 0,onPointercancel:U=>q(j)?E():void 0},[s.value&&!q(j)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:U=>Ce(j,U),onPointermove:Te,onPointerup:De,onPointercancel:E,onClick:Z[5]||(Z[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Ek)):n.createCommentVNode("",!0),q(j)?(n.openBlock(),n.createElementBlock("span",vk,n.toDisplayString(j.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(dn),{id:`l:${j.modelId}`,type:"target",position:n.unref(Se).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ne(F.value[j.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",$k,[(x=F.value[j.modelId])!=null&&x.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(D=F.value[j.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",xk,[v(j)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):($=F.value[j.modelId])!=null&&$.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Nk),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:L(j)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ae(j),(U,P)=>(n.openBlock(),n.createElementBlock("span",{key:P,class:n.normalizeClass({"em-entity__missing":U.missing})},n.toDisplayString(U.text),3))),128))],4),he(j)?(n.openBlock(),n.createElementBlock("span",Ik,n.toDisplayString(he(j)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(dn),{id:`r:${j.modelId}`,type:"source",position:n.unref(Se).Right,class:"em-handle"},null,8,["id","position"])],64))],42,wk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(v(j)&&z.value?le(j):[],U=>(n.openBlock(),n.createElementBlock("li",{key:`${j.modelId}:${U.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":y.value.has(j.modelId)}]),onClick:n.withModifiers(P=>_(j,P),["stop"])},[Z[8]||(Z[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",Ck,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me(U),(P,ee)=>(n.openBlock(),n.createElementBlock("span",{key:ee,class:n.normalizeClass({"em-entity__missing":P.missing})},n.toDisplayString(P.text),3))),128))]),n.createElementVNode("span",Rk,n.toDisplayString(U.dataType),1)],10,Sk))),128))],64)}),128))],512)),!te.value&&k.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:T,class:"em-entity__ops"},[I.value&&I.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${I.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,j=>{var ue;return n.openBlock(),n.createElementBlock("li",{key:j.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((ue=I.value)==null?void 0:ue.id)===j.modelId}]),"data-op":j.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:x=>M(j,x),onPointermove:B,onPointerup:de,onPointercancel:be,onClick:Z[6]||(Z[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Ak)):n.createCommentVNode("",!0),n.createElementVNode("span",Tk,n.toDisplayString(R(j.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:G(j)})},n.toDisplayString(j.name)+"()",5)],10,Vk)}),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,Mk)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",Bk,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:pe},"+ 속성"),Z[9]||(Z[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:X},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!ce.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:J,onPointermove:ge,onPointerup:we},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-7efbcdb3"]]),Dk={key:0,class:"em-sel","aria-hidden":"true"},Ok={class:"em-group__label"},Lk={class:"em-group__name"},Pk={key:0,class:"em-group__pkg"},zk={key:1,class:"em-group__flag"},zd=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(()=>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(pn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var F;return!!t.id&&((F=r==null?void 0:r.selection.value)==null?void 0:F.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(Ui,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),h=n.inject(Un,null);function m(){t.id&&(h==null||h.setGroupHover(t.id))}function p(){h==null||h.setGroupHover(null)}const y=n.computed(()=>!!h&&h.hoverGroupId.value===t.id),b=n.computed(()=>!!h&&h.hoverGroupId.value!==null&&h.hoverGroupId.value!==t.id),{screenToFlowCoordinate:_,findNode:A}=Le();let g=null,N=null;function te(F){var L;if(!t.id||!s.value)return;F.stopPropagation();const ne=((L=A(t.id))==null?void 0:L.dimensions)??{width:400,height:300},re=_({x:F.clientX,y:F.clientY});g={fx:re.x,fy:re.y,w:ne.width,h:ne.height},F.target.setPointerCapture(F.pointerId)}function S(F){if(!g||!t.id)return;const ne=_({x:F.clientX,y:F.clientY});N={width:Math.max(160,g.w+(ne.x-g.fx)),height:Math.max(120,g.h+(ne.y-g.fy))};const re=A(t.id);re&&(re.style={width:`${N.width}px`,height:`${N.height}px`})}function O(F){var ne,re;g&&N&&t.id&&r&&r.resizeGroup(t.id,N),g=null,N=null,(re=(ne=F.target).releasePointerCapture)==null||re.call(ne,F.pointerId)}const z=n.computed(()=>{const F=o.value.name;return(F==null?void 0:F.ko)||(F==null?void 0:F.en)||(F==null?void 0:F.ja)||(F==null?void 0:F.zh)||o.value.packageName||"그룹"});return(F,ne)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":y.value,"is-dimmed":b.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:m,onMouseleave:p},[c.value?(n.openBlock(),n.createElementBlock("div",Dk,[...ne[0]||(ne[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",Ok,[n.createElementVNode("span",Lk,n.toDisplayString(z.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Pk,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",zk,"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:S,onPointerup:O},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),Uk={key:0,class:"em-sel","aria-hidden":"true"},Hk={key:2,class:"em-note__text"},Ud=Ue(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=n.inject(Ui,null),a=n.inject(Un,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 h=n.computed(()=>{var k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!h.value),p=n.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===t.id}),y=n.computed(()=>!!t.selected&&!p.value),b=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!p.value),_=[{id:"n-top",pos:Se.Top},{id:"n-right",pos:Se.Right},{id:"n-bottom",pos:Se.Bottom},{id:"n-left",pos:Se.Left}],A=n.ref(!1),g=n.ref(""),N=n.ref(null);async function te(){var k;r.value&&(g.value=l.value.memo,A.value=!0,await n.nextTick(),(k=N.value)==null||k.focus())}function S(){A.value&&(A.value=!1,g.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,g.value)))}const{screenToFlowCoordinate:O,findNode:z}=Le();let F=null,ne=null;function re(k){var G;if(!r.value)return;k.stopPropagation();const W=((G=z(t.id))==null?void 0:G.dimensions)??l.value.geo.size,R=O({x:k.clientX,y:k.clientY});F={fx:R.x,fy:R.y,w:W.width,h:W.height},k.target.setPointerCapture(k.pointerId)}function L(k){if(!F)return;const W=O({x:k.clientX,y:k.clientY});ne={width:Math.max(140,F.w+(W.x-F.fx)),height:Math.max(60,F.h+(W.y-F.fy))};const R=z(t.id);R&&(R.style={width:`${ne.width}px`,height:`${ne.height}px`})}function oe(k){var W,R;F&&ne&&o&&o.resizeNote(t.id,ne),F=null,ne=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":m.value,"is-dimmed":b.value,"is-selected":p.value,"is-multi-selected":y.value}]),style:n.normalizeStyle(c.value),onDblclick:te,onPointerdown:d,onMouseenter:u,onMouseleave:f},[p.value?(n.openBlock(),n.createElementBlock("div",Uk,[...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:N,"onUpdate:modelValue":W[0]||(W[0]=R=>g.value=R),class:"em-note__edit nodrag",onBlur:S,onKeydown:W[1]||(W[1]=n.withKeys(R=>A.value=!1,["esc"])),onPointerdown:W[2]||(W[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,g.value]]):(n.openBlock(),n.createElementBlock("div",Hk,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:re,onPointermove:L,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Fk=20,Gk=22,Yk=7,Wk=22,Hd=31,Fd=7,Kk=20,Gd=11,Yd=11,qk=Hd+Fd;function Xk(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function jk(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Hi(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 Wd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Fi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Kd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:Wd(e,t);return[Fi(o,a,l-Math.PI/2),Fi(o,a,l+Math.PI/2)]}function qd(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 Xd(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=Hi(e,t,Fk),[d,u]=Kd(e,t,c,Gk);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}),Xk(o.multiplicity)){const f=Hi(e,t,Hd);l.push({cx:f.x,cy:f.y,r:Fd})}if(jk(o.multiplicity)){const f=Hi(e,t,Yk),[h,m]=Kd(e,t,f,Wk);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:a,circles:l,polygons:r}}let s=e;if(o.composition){const c=Hi(e,t,Kk),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Wd(e,t),f=Fi(d,Gd/2,u-Math.PI/2),h=Fi(d,Gd/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=qd(s,c,Yd,!0),u=qd(s,c,Yd,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:l,polygons:r}}const jd=200,Zd=120,vl=24;function Jd(e){var a,l;if(!e)return{x:0,y:0,width:jd,height:Zd};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||jd,i=((l=e.dimensions)==null?void 0:l.height)||Zd;return{x:t.x,y:t.y,width:o,height:i}}function Qd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function eu(e){const t=n.computed(()=>Jd(e.sourceNode())),o=n.computed(()=>Jd(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var m,p;const d=t.value,u=d.x+d.width;let f=((m=e.sourceRowY)==null?void 0:m.call(e))??d.y+d.height/3,h=((p=e.targetRowY)==null?void 0:p.call(e))??d.y+d.height*2/3;if(Math.abs(h-f)<vl){const y=(f+h)/2;f=y-vl/2,h=y+vl/2}return{source:{x:u,y:f},target:{x:u,y:h}}}),l=n.computed(()=>e.waypoints()[0]??Qd(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Qd(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?pa(t.value,d,l.value.x):ma(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?pa(o.value,d,r.value.x):ma(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 Nl=Symbol("waypointController"),Zk=["d"],Jk=["d"],Qk=["d"],ew=["x1","y1","x2","y2"],tw=["cx","cy","r"],nw=["x","y"],ow=["x","y"],iw=["cx","cy","onDblclick"],aw=["x","y","onPointerdown","onDblclick"],tu=Ue(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Le(),i=n.inject(Nl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Ld,null),s=n.inject(Un,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var pe;return((pe=a==null?void 0:a.selection.value)==null?void 0:pe.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 pe=r==null?void 0:r.value;if(!pe||!a)return null;const X=a.resolved.value.entities,K=C=>{var V;return(V=X.find(Y=>Y.entity.modelId===C))==null?void 0:V.groupRef},w=t.data.association;return K(w.end1.entityRef)===pe.groupId&&K(w.end2.entityRef)===pe.groupId?{dx:pe.dx,dy:pe.dy}:null}),h=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),p=n.ref({x:0,y:0}),y=n.computed(()=>{const pe=f.value;return h.value.map((X,K)=>K===m.value?p.value:pe?{x:X.x+pe.dx,y:X.y+pe.dy}:X)}),b=n.computed(()=>{var pe;return!!((pe=t.sourceNode.data)!=null&&pe.collapsed)}),_=n.computed(()=>{var pe;return!!((pe=t.targetNode.data)!=null&&pe.collapsed)}),{source:A,target:g,sourceSide:N,targetSide:te,isSelf:S}=eu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>y.value,sourceRowY:()=>t.data.sourceColumnRef&&!b.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),O=qk+4,z=n.computed(()=>S.value?Jl(A.value,g.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?da(A.value,N.value,y.value,g.value,te.value,O):fa(A.value,y.value,g.value)),F=n.computed(()=>S.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ua(A.value,N.value,y.value,g.value,te.value,O):ha(A.value,y.value,g.value).map((pe,X)=>({point:pe,segIndex:X}))),ne=n.computed(()=>S.value||!l.value?[]:y.value);function re(pe){switch(pe){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function L(pe,X){m.value=pe,p.value={...h.value[pe]},X.target.setPointerCapture(X.pointerId),X.stopPropagation()}function oe(pe){if(m.value<0)return;const X=o({x:pe.clientX,y:pe.clientY});p.value={x:X.x,y:X.y}}function k(pe){var X,K;m.value>=0&&i&&i.movePoint(t.id,m.value,{...p.value}),m.value=-1,(K=(X=pe.target).releasePointerCapture)==null||K.call(X,pe.pointerId)}function W(pe,X){X.stopPropagation(),i==null||i.removePoint(t.id,pe)}function R(pe,X){if(!i)return;const K=o({x:X.clientX,y:X.clientY});i.insertPoint(t.id,pe,{x:K.x,y:K.y})}const G=n.computed(()=>re(t.data.association.end1.multiplicity)),H=n.computed(()=>re(t.data.association.end2.multiplicity)),ae=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),v=n.computed(()=>ae.value==="class"),q=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const pe=Wn(N.value);return{x:A.value.x+pe.x*10,y:A.value.y+pe.y*10}}return y.value[0]??g.value}),le=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const X=Wn(te.value);return{x:g.value.x+X.x*10,y:g.value.y+X.y*10}}const pe=y.value;return pe[pe.length-1]??A.value}),me=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end1.multiplicity,navigable:pe.end1.navigable,composition:pe.end1.composition,otherNavigable:pe.end2.navigable}}),he=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end2.multiplicity,navigable:pe.end2.navigable,composition:pe.end2.composition,otherNavigable:pe.end1.navigable}}),se=n.computed(()=>Xd(A.value,q.value,me.value,ae.value)),ce=n.computed(()=>Xd(g.value,le.value,he.value,ae.value)),ye=n.computed(()=>[...se.value.lines,...ce.value.lines]),ke=n.computed(()=>[...se.value.circles,...ce.value.circles]),Re=n.computed(()=>[...se.value.polygons,...ce.value.polygons].map(pe=>`M${pe.points.map(X=>`${X.x},${X.y}`).join(" L")} Z`)),xe=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(pe,X)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:z.value,fill:"none",class:"em-edge__hit"},null,8,Zk),n.createElementVNode("path",{d:z.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,Jk),(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",xe.value])},null,10,Qk))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ye.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",xe.value])},null,10,ew))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ke.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",xe.value])},null,10,tw))),128)),v.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,nw),n.createElementVNode("text",{x:n.unref(g).x-8,y:n.unref(g).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(H.value),11,ow)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.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(C=>R(K.segIndex,C),["stop"])},null,42,iw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.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:C=>L(w,C),onPointermove:oe,onPointerup:k,onDblclick:C=>W(w,C)},null,42,aw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Dt=(e=>(e.Lines="lines",e.Dots="dots",e))(Dt||{});const nu=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]}`})},ou=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Dt.Lines+"",Dt.Dots+"";const lw={[Dt.Dots]:"#81818a",[Dt.Lines]:"#eee"},rw=["id","x","y","width","height","patternTransform"],sw={key:2,height:"100",width:"100"},cw=["fill"],dw=["x","y","fill"],uw={name:"Background",compatConfig:{MODE:3}},fw=n.defineComponent({...uw,props:{id:{},variant:{default:()=>Dt.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}=Le(),i=n.computed(()=>{const r=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*r||1,c*r||1],u=e.size*r,[f,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+d[0]/2,h*r||1+d[1]/2];return{scaledGap:d,offset:m,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),l=n.toRef(()=>e.color||e.patternColor||lw[e.variant||Dt.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(Dt).Lines?(n.openBlock(),n.createBlock(n.unref(nu),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Dt).Dots?(n.openBlock(),n.createBlock(n.unref(ou),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",sw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,cw)])):n.createCommentVNode("",!0)])],8,rw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,dw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),mw={name:"ControlButton",compatConfig:{MODE:3}},pw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},hw={type:"button",class:"vue-flow__controls-button"};function yw(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",hw,[n.renderSlot(e.$slots,"default")])}const hn=pw(mw,[["render",yw]]),gw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},bw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function _w(e,t){return n.openBlock(),n.createElementBlock("svg",gw,bw)}const kw={render:_w},ww={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Ew=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function vw(e,t){return n.openBlock(),n.createElementBlock("svg",ww,Ew)}const Nw={render:vw},$w={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},xw=[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 Iw(e,t){return n.openBlock(),n.createElementBlock("svg",$w,xw)}const Sw={render:Iw},Cw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Rw=[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 Vw(e,t){return n.openBlock(),n.createElementBlock("svg",Cw,Rw)}const Aw={render:Vw},Tw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Mw=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 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 Bw(e,t){return n.openBlock(),n.createElementBlock("svg",Tw,Mw)}const Dw={render:Bw},Ow={name:"Controls",compatConfig:{MODE:3}},Lw=n.defineComponent({...Ow,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Cc.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}=Le(),h=n.toRef(()=>o.value||i.value||a.value),m=n.toRef(()=>d.value.zoom<=u.value),p=n.toRef(()=>d.value.zoom>=f.value);function y(){r(),t("zoomIn")}function b(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function A(){l(!h.value),t("interactionChange",!h.value)}return(g,N)=>(n.openBlock(),n.createBlock(n.unref(Id),{class:"vue-flow__controls",position:g.position},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"top"),g.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(g.$slots,"control-zoom-in",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomin",disabled:p.value,onClick:y},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(kw))))])]),_:3},8,["disabled"])]),n.renderSlot(g.$slots,"control-zoom-out",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Nw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),g.showFitView?n.renderSlot(g.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hn,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Sw))))])]),_:3})]):n.createCommentVNode("",!0),g.showInteractive?n.renderSlot(g.$slots,"control-interactive",{key:2},()=>[g.showInteractive?(n.openBlock(),n.createBlock(hn,{key:0,class:"vue-flow__controls-interactive",onClick:A},{default:n.withCtx(()=>[h.value?n.renderSlot(g.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Dw))))]):n.createCommentVNode("",!0),h.value?n.createCommentVNode("",!0):n.renderSlot(g.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Aw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(g.$slots,"default")]),_:3},8,["position"]))}});var Pw={value:()=>{}};function $l(){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 Gi(o)}function Gi(e){this._=e}function zw(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}})}Gi.prototype=$l.prototype={constructor:Gi,on:function(e,t){var o=this._,i=zw(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Uw(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]=iu(o[a],e.name,t);else if(t==null)for(a in o)o[a]=iu(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 Gi(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 Uw(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function iu(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Pw,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var xl="http://www.w3.org/1999/xhtml";const au={svg:"http://www.w3.org/2000/svg",xhtml:xl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Yi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),au.hasOwnProperty(t)?{space:au[t],local:e}:e}function Hw(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===xl&&t.documentElement.namespaceURI===xl?t.createElement(e):t.createElementNS(o,e)}}function Fw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function lu(e){var t=Yi(e);return(t.local?Fw:Hw)(t)}function Gw(){}function Il(e){return e==null?Gw:function(){return this.querySelector(e)}}function Yw(e){typeof e!="function"&&(e=Il(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 Ww(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Kw(){return[]}function ru(e){return e==null?Kw:function(){return this.querySelectorAll(e)}}function qw(e){return function(){return Ww(e.apply(this,arguments))}}function Xw(e){typeof e=="function"?e=qw(e):e=ru(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 su(e){return function(){return this.matches(e)}}function cu(e){return function(t){return t.matches(e)}}var jw=Array.prototype.find;function Zw(e){return function(){return jw.call(this.children,e)}}function Jw(){return this.firstElementChild}function Qw(e){return this.select(e==null?Jw:Zw(typeof e=="function"?e:cu(e)))}var eE=Array.prototype.filter;function tE(){return Array.from(this.children)}function nE(e){return function(){return eE.call(this.children,e)}}function oE(e){return this.selectAll(e==null?tE:nE(typeof e=="function"?e:cu(e)))}function iE(e){typeof e!="function"&&(e=su(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 du(e){return new Array(e.length)}function aE(){return new ft(this._enter||this._groups.map(du),this._parents)}function Wi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wi.prototype={constructor:Wi,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 lE(e){return function(){return e}}function rE(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 Wi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function sE(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(h[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new Wi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function cE(e){return e.__data__}function dE(e,t){if(!arguments.length)return Array.from(this,cE);var o=t?sE:rE,i=this._parents,a=this._groups;typeof e!="function"&&(e=lE(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],h=f.length,m=uE(e.call(u,u&&u.__data__,d,i)),p=m.length,y=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,y,b,_,m,t);for(var A=0,g=0,N,te;A<p;++A)if(N=y[A]){for(A>=g&&(g=A+1);!(te=b[g])&&++g<p;);N._next=te||null}}return r=new ft(r,i),r._enter=s,r._exit=c,r}function uE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fE(){return new ft(this._exit||this._groups.map(du),this._parents)}function mE(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 pE(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,h=s[c]=new Array(f),m,p=0;p<f;++p)(m=d[p]||u[p])&&(h[p]=m);for(;c<a;++c)s[c]=o[c];return new ft(s,this._parents)}function hE(){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 yE(e){e||(e=gE);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 gE(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function bE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _E(){return Array.from(this)}function kE(){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 wE(){let e=0;for(const t of this)++e;return e}function EE(){return!this.node()}function vE(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 NE(e){return function(){this.removeAttribute(e)}}function $E(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xE(e,t){return function(){this.setAttribute(e,t)}}function IE(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SE(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function CE(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 RE(e,t){var o=Yi(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?$E:NE:typeof t=="function"?o.local?CE:SE:o.local?IE:xE)(o,t))}function uu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function VE(e){return function(){this.style.removeProperty(e)}}function AE(e,t,o){return function(){this.style.setProperty(e,t,o)}}function TE(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function ME(e,t,o){return arguments.length>1?this.each((t==null?VE:typeof t=="function"?TE:AE)(e,t,o??"")):Hn(this.node(),e)}function Hn(e,t){return e.style.getPropertyValue(t)||uu(e).getComputedStyle(e,null).getPropertyValue(t)}function BE(e){return function(){delete this[e]}}function DE(e,t){return function(){this[e]=t}}function OE(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function LE(e,t){return arguments.length>1?this.each((t==null?BE:typeof t=="function"?OE:DE)(e,t)):this.node()[e]}function fu(e){return e.trim().split(/^|\s+/)}function Sl(e){return e.classList||new mu(e)}function mu(e){this._node=e,this._names=fu(e.getAttribute("class")||"")}mu.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 pu(e,t){for(var o=Sl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function hu(e,t){for(var o=Sl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function PE(e){return function(){pu(this,e)}}function zE(e){return function(){hu(this,e)}}function UE(e,t){return function(){(t.apply(this,arguments)?pu:hu)(this,e)}}function HE(e,t){var o=fu(e+"");if(arguments.length<2){for(var i=Sl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?UE:t?PE:zE)(o,t))}function FE(){this.textContent=""}function GE(e){return function(){this.textContent=e}}function YE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function WE(e){return arguments.length?this.each(e==null?FE:(typeof e=="function"?YE:GE)(e)):this.node().textContent}function KE(){this.innerHTML=""}function qE(e){return function(){this.innerHTML=e}}function XE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function jE(e){return arguments.length?this.each(e==null?KE:(typeof e=="function"?XE:qE)(e)):this.node().innerHTML}function ZE(){this.nextSibling&&this.parentNode.appendChild(this)}function JE(){return this.each(ZE)}function QE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ev(){return this.each(QE)}function tv(e){var t=typeof e=="function"?e:lu(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function nv(){return null}function ov(e,t){var o=typeof e=="function"?e:lu(e),i=t==null?nv:typeof t=="function"?t:Il(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function iv(){var e=this.parentNode;e&&e.removeChild(this)}function av(){return this.each(iv)}function lv(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rv(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sv(e){return this.select(e?rv:lv)}function cv(e){return arguments.length?this.property("__data__",e):this.node().__data__}function dv(e){return function(t){e.call(this,t,this.__data__)}}function uv(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 fv(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 mv(e,t,o){return function(){var i=this.__on,a,l=dv(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 pv(e,t,o){var i=uv(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?mv:fv,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function yu(e,t,o){var i=uu(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 hv(e,t){return function(){return yu(this,e,t)}}function yv(e,t){return function(){return yu(this,e,t.apply(this,arguments))}}function gv(e,t){return this.each((typeof t=="function"?yv:hv)(e,t))}function*bv(){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 gu=[null];function ft(e,t){this._groups=e,this._parents=t}function vo(){return new ft([[document.documentElement]],gu)}function _v(){return this}ft.prototype=vo.prototype={constructor:ft,select:Yw,selectAll:Xw,selectChild:Qw,selectChildren:oE,filter:iE,data:dE,enter:aE,exit:fE,join:mE,merge:pE,selection:_v,order:hE,sort:yE,call:bE,nodes:_E,node:kE,size:wE,empty:EE,each:vE,attr:RE,style:ME,property:LE,classed:HE,text:WE,html:jE,raise:JE,lower:ev,append:tv,insert:ov,remove:av,clone:sv,datum:cv,on:pv,dispatch:gv,[Symbol.iterator]:bv};function qt(e){return typeof e=="string"?new ft([[document.querySelector(e)]],[document.documentElement]):new ft([[e]],gu)}function kv(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=kv(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 Cl={capture:!0,passive:!1};function Rl(e){e.preventDefault(),e.stopImmediatePropagation()}function wv(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",Rl,Cl);"onselectstart"in t?o.on("selectstart.drag",Rl,Cl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ev(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Rl,Cl),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 Vl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function bu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function No(){}var $o=.7,Ki=1/$o,Fn="\\s*([+-]?\\d+)\\s*",xo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",It="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vv=/^#([0-9a-f]{3,8})$/,Nv=new RegExp(`^rgb\\(${Fn},${Fn},${Fn}\\)$`),$v=new RegExp(`^rgb\\(${It},${It},${It}\\)$`),xv=new RegExp(`^rgba\\(${Fn},${Fn},${Fn},${xo}\\)$`),Iv=new RegExp(`^rgba\\(${It},${It},${It},${xo}\\)$`),Sv=new RegExp(`^hsl\\(${xo},${It},${It}\\)$`),Cv=new RegExp(`^hsla\\(${xo},${It},${It},${xo}\\)$`),_u={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};Vl(No,Io,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ku,formatHex:ku,formatHex8:Rv,formatHsl:Vv,formatRgb:wu,toString:wu});function ku(){return this.rgb().formatHex()}function Rv(){return this.rgb().formatHex8()}function Vv(){return xu(this).formatHsl()}function wu(){return this.rgb().formatRgb()}function Io(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=vv.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Eu(t):o===3?new ct(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?qi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?qi(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=Nv.exec(e))?new ct(t[1],t[2],t[3],1):(t=$v.exec(e))?new ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xv.exec(e))?qi(t[1],t[2],t[3],t[4]):(t=Iv.exec(e))?qi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Sv.exec(e))?$u(t[1],t[2]/100,t[3]/100,1):(t=Cv.exec(e))?$u(t[1],t[2]/100,t[3]/100,t[4]):_u.hasOwnProperty(e)?Eu(_u[e]):e==="transparent"?new ct(NaN,NaN,NaN,0):null}function Eu(e){return new ct(e>>16&255,e>>8&255,e&255,1)}function qi(e,t,o,i){return i<=0&&(e=t=o=NaN),new ct(e,t,o,i)}function Av(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 Al(e,t,o,i){return arguments.length===1?Av(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}Vl(ct,Al,bu(No,{brighter(e){return e=e==null?Ki:Math.pow(Ki,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),Xi(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:Tv,formatRgb:Nu,toString:Nu}));function vu(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function Tv(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Nu(){const e=Xi(this.opacity);return`${e===1?"rgb(":"rgba("}${yn(this.r)}, ${yn(this.g)}, ${yn(this.b)}${e===1?")":`, ${e})`}`}function Xi(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 $u(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 xu(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 Mv(e,t,o,i){return arguments.length===1?xu(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}Vl(bt,Mv,bu(No,{brighter(e){return e=e==null?Ki:Math.pow(Ki,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(Tl(e>=240?e-240:e+120,a,i),Tl(e,a,i),Tl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new bt(Iu(this.h),ji(this.s),ji(this.l),Xi(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=Xi(this.opacity);return`${e===1?"hsl(":"hsla("}${Iu(this.h)}, ${ji(this.s)*100}%, ${ji(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Iu(e){return e=(e||0)%360,e<0?e+360:e}function ji(e){return Math.max(0,Math.min(1,e||0))}function Tl(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 Su=e=>()=>e;function Bv(e,t){return function(o){return e+o*t}}function Dv(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 Ov(e){return(e=+e)==1?Cu:function(t,o){return o-t?Dv(t,o,e):Su(isNaN(t)?o:t)}}function Cu(e,t){var o=t-e;return o?Bv(e,o):Su(isNaN(e)?t:e)}const Ru=(function e(t){var o=Ov(t);function i(a,l){var r=o((a=Al(a)).r,(l=Al(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Cu(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 Ml=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bl=new RegExp(Ml.source,"g");function Lv(e){return function(){return e}}function Pv(e){return function(t){return e(t)+""}}function zv(e,t){var o=Ml.lastIndex=Bl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Ml.exec(e))&&(a=Bl.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=Bl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Pv(c[0].x):Lv(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 Vu=180/Math.PI,Dl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Au(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)*Vu,skewX:Math.atan(c)*Vu,scaleX:r,scaleY:s}}var Zi;function Uv(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Dl:Au(t.a,t.b,t.c,t.d,t.e,t.f)}function Hv(e){return e==null||(Zi||(Zi=document.createElementNS("http://www.w3.org/2000/svg","g")),Zi.setAttribute("transform",e),!(e=Zi.transform.baseVal.consolidate()))?Dl:(e=e.matrix,Au(e.a,e.b,e.c,e.d,e.e,e.f))}function Tu(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push("translate(",null,t,null,o);p.push({i:y-4,x:jt(d,f)},{i:y-2,x:jt(u,h)})}else(f||h)&&m.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:jt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:jt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push(a(m)+"scale(",null,",",null,")");p.push({i:y-4,x:jt(d,f)},{i:y-2,x:jt(u,h)})}else(f!==1||h!==1)&&m.push(a(m)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(m){for(var p=-1,y=h.length,b;++p<y;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var Fv=Tu(Uv,"px, ","px)","deg)"),Gv=Tu(Hv,", ",")",")"),Yv=1e-12;function Mu(e){return((e=Math.exp(e))+1/e)/2}function Wv(e){return((e=Math.exp(e))-1/e)/2}function Kv(e){return((e=Math.exp(2*e))-1)/(e+1)}const qv=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],h=r[2],m=u-s,p=f-c,y=m*m+p*p,b,_;if(y<Yv)_=Math.log(h/d)/t,b=function(O){return[s+O*m,c+O*p,d*Math.exp(t*O*_)]};else{var A=Math.sqrt(y),g=(h*h-d*d+i*y)/(2*d*o*A),N=(h*h-d*d-i*y)/(2*h*o*A),te=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(N*N+1)-N);_=(S-te)/t,b=function(O){var z=O*_,F=Mu(te),ne=d/(o*A)*(F*Kv(t*z+te)-Wv(te));return[s+ne*m,c+ne*p,d*F/Mu(t*z+te)]}}return b.duration=_*1e3*t/Math.SQRT2,b}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Gn=0,So=0,Co=0,Bu=1e3,Ji,Ro,Qi=0,bn=0,ea=0,Vo=typeof performance=="object"&&performance.now?performance:Date,Du=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ol(){return bn||(Du(Xv),bn=Vo.now()+ea)}function Xv(){bn=0}function ta(){this._call=this._time=this._next=null}ta.prototype=Ou.prototype={constructor:ta,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&&Ro!==this&&(Ro?Ro._next=this:Ji=this,Ro=this),this._call=e,this._time=o,Ll()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ll())}};function Ou(e,t,o){var i=new ta;return i.restart(e,t,o),i}function jv(){Ol(),++Gn;for(var e=Ji,t;e;)(t=bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Gn}function Lu(){bn=(Qi=Vo.now())+ea,Gn=So=0;try{jv()}finally{Gn=0,Jv(),bn=0}}function Zv(){var e=Vo.now(),t=e-Qi;t>Bu&&(ea-=t,Qi=e)}function Jv(){for(var e,t=Ji,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:Ji=o);Ro=e,Ll(i)}function Ll(e){if(!Gn){So&&(So=clearTimeout(So));var t=e-bn;t>24?(e<1/0&&(So=setTimeout(Lu,e-Vo.now()-ea)),Co&&(Co=clearInterval(Co))):(Co||(Qi=Vo.now(),Co=setInterval(Zv,Bu)),Gn=1,Du(Lu))}}function Pu(e,t,o){var i=new ta;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Qv=$l("start","end","cancel","interrupt"),eN=[],zu=0,Uu=1,Pl=2,na=3,Hu=4,zl=5,oa=6;function ia(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;tN(e,o,{name:t,index:i,group:a,on:Qv,tween:eN,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:zu})}function Ul(e,t){var o=_t(e,t);if(o.state>zu)throw new Error("too late; already scheduled");return o}function St(e,t){var o=_t(e,t);if(o.state>na)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 tN(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Ou(l,0,o.time);function l(d){o.state=Uu,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,m;if(o.state!==Uu)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===na)return Pu(r);m.state===Hu?(m.state=oa,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=oa,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Pu(function(){o.state===na&&(o.state=Hu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Pl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Pl){for(o.state=na,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=zl,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===zl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=oa,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function aa(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>Pl&&i.state<zl,i.state=oa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function nN(e){return this.each(function(){aa(this,e)})}function oN(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 iN(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 aN(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?oN:iN)(o,e,t))}function Hl(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 Fu(e,t){var o;return(typeof t=="number"?jt:t instanceof Io?Ru:(o=Io(t))?(t=o,Ru):zv)(e,t)}function lN(e){return function(){this.removeAttribute(e)}}function rN(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sN(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 cN(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 dN(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 uN(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 fN(e,t){var o=Yi(e),i=o==="transform"?Gv:Fu;return this.attrTween(e,typeof t=="function"?(o.local?uN:dN)(o,i,Hl(this,"attr."+e,t)):t==null?(o.local?rN:lN)(o):(o.local?cN:sN)(o,i,t))}function mN(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function pN(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function hN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&pN(e,l)),o}return a._value=t,a}function yN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&mN(e,l)),o}return a._value=t,a}function gN(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=Yi(e);return this.tween(o,(i.local?hN:yN)(i,t))}function bN(e,t){return function(){Ul(this,e).delay=+t.apply(this,arguments)}}function _N(e,t){return t=+t,function(){Ul(this,e).delay=t}}function kN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?bN:_N)(t,e)):_t(this.node(),t).delay}function wN(e,t){return function(){St(this,e).duration=+t.apply(this,arguments)}}function EN(e,t){return t=+t,function(){St(this,e).duration=t}}function vN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wN:EN)(t,e)):_t(this.node(),t).duration}function NN(e,t){if(typeof t!="function")throw new Error;return function(){St(this,e).ease=t}}function $N(e){var t=this._id;return arguments.length?this.each(NN(t,e)):_t(this.node(),t).ease}function xN(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;St(this,e).ease=o}}function IN(e){if(typeof e!="function")throw new Error;return this.each(xN(this._id,e))}function SN(e){typeof e!="function"&&(e=su(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 Ot(i,this._parents,this._name,this._id)}function CN(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),h,m=0;m<u;++m)(h=c[m]||d[m])&&(f[m]=h);for(;s<i;++s)r[s]=t[s];return new Ot(r,this._parents,this._name,this._id)}function RN(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 VN(e,t,o){var i,a,l=RN(t)?Ul:St;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function AN(e,t){var o=this._id;return arguments.length<2?_t(this.node(),o).on.on(e):this.each(VN(o,e,t))}function TN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function MN(){return this.on("end.remove",TN(this._id))}function BN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Il(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,ia(d[h],t,o,h,d,_t(u,o)));return new Ot(l,this._parents,t,o)}function DN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ru(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),m,p=_t(u,o),y=0,b=h.length;y<b;++y)(m=h[y])&&ia(m,t,o,y,h,p);l.push(h),r.push(u)}return new Ot(l,r,t,o)}var ON=vo.prototype.constructor;function LN(){return new ON(this._groups,this._parents)}function PN(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 Gu(e){return function(){this.style.removeProperty(e)}}function zN(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 UN(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 HN(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=Gu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function FN(e,t,o){var i=(e+="")=="transform"?Fv:Fu;return t==null?this.styleTween(e,PN(e,i)).on("end.style."+e,Gu(e)):typeof t=="function"?this.styleTween(e,UN(e,i,Hl(this,"style."+e,t))).each(HN(this._id,e)):this.styleTween(e,zN(e,i,t),o).on("end.style."+e,null)}function GN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function YN(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&GN(e,r,o)),i}return l._value=t,l}function WN(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,YN(e,t,o??""))}function KN(e){return function(){this.textContent=e}}function qN(e){return function(){var t=e(this);this.textContent=t??""}}function XN(e){return this.tween("text",typeof e=="function"?qN(Hl(this,"text",e)):KN(e==null?"":e+""))}function jN(e){return function(t){this.textContent=e.call(this,t)}}function ZN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&jN(a)),t}return i._value=e,i}function JN(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,ZN(e))}function QN(){for(var e=this._name,t=this._id,o=Yu(),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);ia(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ot(i,this._parents,e,o)}function e$(){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 t$=0;function Ot(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Yu(){return++t$}var Lt=vo.prototype;Ot.prototype={constructor:Ot,select:BN,selectAll:DN,selectChild:Lt.selectChild,selectChildren:Lt.selectChildren,filter:SN,merge:CN,selection:LN,transition:QN,call:Lt.call,nodes:Lt.nodes,node:Lt.node,size:Lt.size,empty:Lt.empty,each:Lt.each,on:AN,attr:fN,attrTween:gN,style:FN,styleTween:WN,text:XN,textTween:JN,remove:MN,tween:aN,delay:kN,duration:vN,ease:$N,easeVarying:IN,end:e$,[Symbol.iterator]:Lt[Symbol.iterator]};function n$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var o$={time:null,delay:0,duration:250,ease:n$};function i$(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 a$(e){var t,o;e instanceof Ot?(t=e._id,e=e._name):(t=Yu(),(o=o$).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])&&ia(c,e,t,d,r,o||i$(c,t));return new Ot(i,this._parents,e,t)}vo.prototype.interrupt=nN,vo.prototype.transition=a$;const la=e=>()=>e;function l$(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 Pt(e,t,o){this.k=e,this.x=t,this.y=o}Pt.prototype={constructor:Pt,scale:function(e){return e===1?this:new Pt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pt(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 Fl=new Pt(1,0,0);Pt.prototype;function Gl(e){e.stopImmediatePropagation()}function Ao(e){e.preventDefault(),e.stopImmediatePropagation()}function r$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function s$(){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 Wu(){return this.__zoom||Fl}function c$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function d$(){return navigator.maxTouchPoints||"ontouchstart"in this}function u$(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 f$(){var e=r$,t=s$,o=u$,i=c$,a=d$,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=qv,d=$l("start","zoom","end"),u,f,h,m=500,p=150,y=0,b=10;function _(k){k.property("__zoom",Wu).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",re).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,W,R,G){var H=k.selection?k.selection():k;H.property("__zoom",Wu),k!==H?te(k,W,R,G):H.interrupt().each(function(){S(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 H=this.__zoom.k,ae=typeof W=="function"?W.apply(this,arguments):W;return H*ae},R,G)},_.scaleTo=function(k,W,R,G){_.transform(k,function(){var H=t.apply(this,arguments),ae=this.__zoom,v=R==null?N(H):typeof R=="function"?R.apply(this,arguments):R,q=ae.invert(v),le=typeof W=="function"?W.apply(this,arguments):W;return o(g(A(ae,le),v,q),H,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,H){_.transform(k,function(){var ae=t.apply(this,arguments),v=this.__zoom,q=G==null?N(ae):typeof G=="function"?G.apply(this,arguments):G;return o(Fl.translate(q[0],q[1]).scale(v.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof R=="function"?-R.apply(this,arguments):-R),ae,r)},G,H)};function A(k,W){return W=Math.max(l[0],Math.min(l[1],W)),W===k.k?k:new Pt(W,k.x,k.y)}function g(k,W,R){var G=W[0]-R[0]*k.k,H=W[1]-R[1]*k.k;return G===k.x&&H===k.y?k:new Pt(k.k,G,H)}function N(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(){S(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,ae=arguments,v=S(H,ae).event(G),q=t.apply(H,ae),le=R==null?N(q):typeof R=="function"?R.apply(H,ae):R,me=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),he=H.__zoom,se=typeof W=="function"?W.apply(H,ae):W,ce=c(he.invert(le).concat(me/he.k),se.invert(le).concat(me/se.k));return function(ye){if(ye===1)ye=se;else{var ke=ce(ye),Re=me/ke[2];ye=new Pt(Re,le[0]-ke[0]*Re,le[1]-ke[1]*Re)}v.zoom(null,ye)}})}function S(k,W,R){return!R&&k.__zooming||new O(k,W)}function O(k,W){this.that=k,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,W),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,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 l$(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),W)}};function z(k,...W){if(!e.apply(this,arguments))return;var R=S(this,W).event(k),G=this.__zoom,H=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,i.apply(this,arguments)))),ae=Xt(k);if(R.wheel)(R.mouse[0][0]!==ae[0]||R.mouse[0][1]!==ae[1])&&(R.mouse[1]=G.invert(R.mouse[0]=ae)),clearTimeout(R.wheel);else{if(G.k===H)return;R.mouse=[ae,G.invert(ae)],aa(this),R.start()}Ao(k),R.wheel=setTimeout(v,p),R.zoom("mouse",o(g(A(G,H),R.mouse[0],R.mouse[1]),R.extent,r));function v(){R.wheel=null,R.end()}}function F(k,...W){if(h||!e.apply(this,arguments))return;var R=k.currentTarget,G=S(this,W,!0).event(k),H=qt(k.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",me,!0),ae=Xt(k,R),v=k.clientX,q=k.clientY;wv(k.view),Gl(k),G.mouse=[ae,this.__zoom.invert(ae)],aa(this),G.start();function le(he){if(Ao(he),!G.moved){var se=he.clientX-v,ce=he.clientY-q;G.moved=se*se+ce*ce>y}G.event(he).zoom("mouse",o(g(G.that.__zoom,G.mouse[0]=Xt(he,R),G.mouse[1]),G.extent,r))}function me(he){H.on("mousemove.zoom mouseup.zoom",null),Ev(he.view,G.moved),Ao(he),G.event(he).end()}}function ne(k,...W){if(e.apply(this,arguments)){var R=this.__zoom,G=Xt(k.changedTouches?k.changedTouches[0]:k,this),H=R.invert(G),ae=R.k*(k.shiftKey?.5:2),v=o(g(A(R,ae),G,H),t.apply(this,W),r);Ao(k),s>0?qt(this).transition().duration(s).call(te,v,G,k):qt(this).call(_.transform,v,G,k)}}function re(k,...W){if(e.apply(this,arguments)){var R=k.touches,G=R.length,H=S(this,W,k.changedTouches.length===G).event(k),ae,v,q,le;for(Gl(k),v=0;v<G;++v)q=R[v],le=Xt(q,this),le=[le,this.__zoom.invert(le),q.identifier],H.touch0?!H.touch1&&H.touch0[2]!==le[2]&&(H.touch1=le,H.taps=0):(H.touch0=le,ae=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),ae&&(H.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),aa(this),H.start())}}function L(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v,q,le;for(Ao(k),ae=0;ae<H;++ae)v=G[ae],q=Xt(v,this),R.touch0&&R.touch0[2]===v.identifier?R.touch0[0]=q:R.touch1&&R.touch1[2]===v.identifier&&(R.touch1[0]=q);if(v=R.that.__zoom,R.touch1){var me=R.touch0[0],he=R.touch0[1],se=R.touch1[0],ce=R.touch1[1],ye=(ye=se[0]-me[0])*ye+(ye=se[1]-me[1])*ye,ke=(ke=ce[0]-he[0])*ke+(ke=ce[1]-he[1])*ke;v=A(v,Math.sqrt(ye/ke)),q=[(me[0]+se[0])/2,(me[1]+se[1])/2],le=[(he[0]+ce[0])/2,(he[1]+ce[1])/2]}else if(R.touch0)q=R.touch0[0],le=R.touch0[1];else return;R.zoom("touch",o(g(v,q,le),R.extent,r))}}function oe(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v;for(Gl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),ae=0;ae<H;++ae)v=G[ae],R.touch0&&R.touch0[2]===v.identifier?delete R.touch0:R.touch1&&R.touch1[2]===v.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&&(v=Xt(v,this),Math.hypot(f[0]-v[0],f[1]-v[1])<b)){var q=qt(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:la(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:la(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:la(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:la([[+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?(y=(k=+k)*k,_):Math.sqrt(y)},_.tapDistance=function(k){return arguments.length?(b=+k,_):b},_}const Ku=Symbol("MiniMapSlots"),m$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],p$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},h$=n.defineComponent({...p$,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(Ku),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,m$))],64)):n.createCommentVNode("",!0)}}),y$=["width","height","viewBox","aria-labelledby"],g$=["id"],b$=["d","fill","stroke","stroke-width"],_$={name:"MiniMap",compatConfig:{MODE:3}},k$=n.defineComponent({..._$,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,l=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:h,d3Zoom:m,getNodesInitialized:p}=Le(),y=n.ref();n.provide(Ku,o);const b=n.toRef(()=>{var H;return e.width??((H=i.style)==null?void 0:H.width)??a}),_=n.toRef(()=>{var H;return e.height??((H=i.style)==null?void 0:H.height)??l}),A=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",g=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=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:()=>""),S=n.computed(()=>al(p.value.filter(H=>!H.hidden))),O=n.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),z=n.computed(()=>p.value&&p.value.length?pb(S.value,O.value):O.value),F=n.computed(()=>{const H=z.value.width/b.value,ae=z.value.height/_.value;return Math.max(H,ae)}),ne=n.computed(()=>{const H=F.value*b.value,ae=F.value*_.value,v=e.offsetScale*F.value;return{offset:v,x:z.value.x-(H-z.value.width)/2-v,y:z.value.y-(ae-z.value.height)/2-v,width:H+v*2,height:ae+v*2}}),re=n.computed(()=>!ne.value.x||!ne.value.y?"":`
|
|
30
30
|
M${ne.value.x-ne.value.offset},${ne.value.y-ne.value.offset}
|
|
31
31
|
h${ne.value.width+ne.value.offset*2}
|
|
32
32
|
v${ne.value.height+ne.value.offset*2}
|
|
@@ -39,5 +39,5 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
|
|
|
39
39
|
h${-(O.value.width-2*e.maskBorderRadius)}
|
|
40
40
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
41
41
|
v${-(O.value.height-2*e.maskBorderRadius)}
|
|
42
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(H=>{if(y.value){const ae=qt(y.value),v=me=>{if(me.sourceEvent.type!=="wheel"||!h.value||!m.value)return;const he=me.sourceEvent.ctrlKey&&wo()?10:1,se=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*e.zoomStep,ce=c.value.zoom*2**(se*he);m.value.scaleTo(h.value,ce)},q=me=>{if(me.sourceEvent.type!=="mousemove"||!h.value||!m.value)return;const he=F.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),se={x:c.value.x-me.sourceEvent.movementX*he,y:c.value.y-me.sourceEvent.movementY*he},ce=[[0,0],[u.value.width,u.value.height]],ye=Fl.translate(se.x,se.y).scale(c.value.zoom),ke=m.value.constrain()(ye,ce,d.value);m.value.transform(h.value,ke)},le=u$().wheelDelta(me=>ll(me)*(e.zoomStep/10)).on("zoom",e.pannable?q:()=>{}).on("zoom.wheel",e.zoomable?v:()=>{});ae.call(le),H(()=>{ae.on("zoom",null)})}},{flush:"post"});function L(H){const[ae,v]=Xt(H);t("click",{event:H,position:{x:ae,y:v}})}function oe(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeClick(v),t("nodeClick",v)}function k(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeDoubleClick(v),t("nodeDblclick",v)}function W(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseEnter(v),t("nodeMouseenter",v)}function R(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseMove(v),t("nodeMousemove",v)}function G(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseLeave(v),t("nodeMouseleave",v)}return(H,ae)=>(n.openBlock(),n.createBlock(n.unref(xd),{position:H.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:H.pannable,zoomable:H.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:y,width:b.value,height:_.value,viewBox:[ne.value.x,ne.value.y,ne.value.width,ne.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:L},[H.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(H.ariaLabel),9,y$)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(p),v=>(n.openBlock(),n.createBlock(p$,{id:v.id,key:v.id,f:"",position:v.computedPosition,dimensions:v.dimensions,selected:v.selected,dragging:v.dragging,style:n.normalizeStyle(v.style),class:n.normalizeClass(te.value(v)),color:g.value(v),"border-radius":H.nodeBorderRadius,"stroke-color":N.value(v),"stroke-width":H.nodeStrokeWidth,"shape-rendering":n.unref(A),type:v.type,hidden:v.hidden,onClick:q=>oe(q,v),onDblclick:q=>k(q,v),onMouseenter:q=>W(q,v),onMousemove:q=>R(q,v),onMouseleave:q=>G(q,v)},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:re.value,fill:H.maskColor,stroke:H.maskStrokeColor,"stroke-width":H.maskStrokeWidth,"fill-rule":"evenodd"},null,8,g$)],8,h$))]),_:1},8,["position","class"]))}}),k$=["d"],w$=["cx","cy","onDblclick"],E$=["x","y","onPointerdown","onDblclick"],v$=Ue(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Le(),i=n.inject(Nl),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((z,F)=>F===d.value?u.value:z)),{source:h,target:m,sourceSide:p,targetSide:y}=Qd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),b=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?da(h.value,p.value,f.value,m.value,y.value):fa(h.value,f.value,m.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ua(h.value,p.value,f.value,m.value,y.value):ha(h.value,f.value,m.value).map((z,F)=>({point:z,segIndex:F})):[]),A=n.computed(()=>l.value?f.value:[]);function g(z,F){d.value=z,u.value={...c.value[z]},F.target.setPointerCapture(F.pointerId),F.stopPropagation()}function N(z){if(d.value<0)return;const F=o({x:z.clientX,y:z.clientY});u.value={x:F.x,y:F.y}}function te(z){var F,ne;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(ne=(F=z.target).releasePointerCapture)==null||ne.call(F,z.pointerId)}function S(z,F){F.stopPropagation(),i==null||i.removePoint(t.id,z)}function O(z,F){if(!i)return;const ne=o({x:F.clientX,y:F.clientY});i.insertPoint(t.id,z,{x:ne.x,y:ne.y})}return(z,F)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:b.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,k$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(ne,re)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${re}`,cx:ne.point.x,cy:ne.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(L=>O(ne.segIndex,L),["stop"])},null,42,w$))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(A.value,(ne,re)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${re}`,x:ne.x-5,y:ne.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:L=>g(re,L),onPointermove:N,onPointerup:te,onDblclick:L=>S(re,L)},null,42,E$))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),N$=["data-theme"],$$={key:0,class:"em-ctx__sep",role:"separator"},x$={key:1,class:"em-ctx__swatches"},I$={class:"em-ctx__swatches-label"},S$={class:"em-ctx__chips"},C$=["onClick"],R$=["title","onClick"],V$=["disabled","onClick"],A$={class:"em-ctx__icon"},T$={class:"em-ctx__caption"},M$=Ue(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),a=n.ref(void 0),l=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(m,p){var _;i.value=p,a.value=(_=m.target)!=null&&_.closest('[data-theme="dark"]')?"dark":void 0,r.x=m.clientX,r.y=m.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const y=l.value;if(!y)return;const b=y.getBoundingClientRect();r.x+b.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-b.width)),r.y+b.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-b.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(m){m.key==="Escape"&&(m.stopPropagation(),d())}function f(m){m.disabled||(m.handler(),d())}function h(m,p){m.onPick(p),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,p)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":a.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:l,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:p[0]||(p[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(y,b)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b},[y.type==="separator"?(n.openBlock(),n.createElementBlock("div",$$)):y.type==="swatches"?(n.openBlock(),n.createElementBlock("div",x$,[n.createElementVNode("span",I$,n.toDisplayString(y.caption),1),n.createElementVNode("div",S$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":y.current===null}]),title:"없음",onClick:_=>h(y,null)},null,10,C$),(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":y.current===_}]),style:n.normalizeStyle({background:n.unref(Ln)(_)}),title:n.unref(On)(_),onClick:A=>h(y,_)},null,14,R$))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":y.danger,"is-disabled":y.disabled}]),disabled:y.disabled,role:"menuitem",onClick:_=>f(y)},[n.createElementVNode("span",A$,[y.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:y.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",T$,n.toDisplayString(y.caption),1)],10,V$))],64))),128))],36)],8,N$)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Yl=[".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 B$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function D$(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const l=e.firstChild,r=a.getClientRects();if(!l||l.nodeType!==3||r.length<=1){const p=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(p.width===0&&p.height===0)return[];const y=t(p.left,p.top+p.height/2);return[{...i,x:y.x,y:y.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,h=0;const m=()=>{const p=d.trim();if(p){const y=t(f,(u+h)/2);c.push({...i,x:y.x,y:y.y,text:p})}d=""};for(let p=0;p<s.length;p++){a.setStart(l,p),a.setEnd(l,p+1);const y=a.getBoundingClientRect();u===null||Math.abs(y.top-u)>1?(m(),u=y.top,f=y.left,h=y.bottom,d=s[p]):(d+=s[p],h=Math.max(h,y.bottom))}return m(),c}function ra(e,t){const o=[];for(const i of e.querySelectorAll("*"))B$(i)&&(i.closest(Yl)||Yn(i)&&o.push(...D$(i,t)));return o}function To(e){return Math.round(e*100)/100}function O$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Yl)||!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 L$(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 Ku(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Yl)||!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 Wl(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 P$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,p)=>e.screenToFlowCoordinate({x:m,y:p}),i=[],a=[],l=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const p=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!p||!Yn(p))continue;const y=p.firstElementChild;if(y)if(m.type==="group"){const b=Mo(y,o);Wl(s,b),i.push({...b,texts:[]});const _=y.querySelector(".em-group__label");_&&i.push({...Mo(_,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ra(y,o)})}else if(m.type==="note"){const b={...Mo(y,o),texts:ra(y,o),lines:Ku(y,y,o)};Wl(s,b),l.push(b)}else{const b=Mo(y,o);Wl(s,b);const _=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const A=y.querySelector(".em-entity__header");if(A){const g=Mo(A,o);a.push({x:b.x,y:b.y,w:b.w,h:g.y+g.h-b.y,fill:g.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ra(y,o),lines:Ku(y,y,o),icons:O$(y,o)}),a.push({...b,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const p=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!p||!Yn(p))continue;const y=p.getAttribute("d");if(!y)continue;const b=getComputedStyle(p),_=b.strokeDasharray,A=L$(m);r.push({d:y,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:ra(m,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 Kl(e){return sr(P$(e))}function qu(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 Xu(e,t="diagram.svg"){const o=Kl(e);qu(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function z$(e){var i,a;const t=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:t>0?t:1,h:o>0?o:1}}async function ju(e,t="diagram.png",o=2){const i=Kl(e),{w:a,h:l}=z$(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 변환 실패");qu(u,t)}finally{URL.revokeObjectURL(r)}}const U$={class:"em-shortcuts"},H$={class:"em-shortcuts__title"},F$={class:"em-shortcuts__keys"},G$={class:"em-shortcuts__kbd"},Y$={key:0,class:"em-shortcuts__plus"},W$={class:"em-shortcuts__desc"},K$={class:"em-shortcuts__actions"},Zu=Ue(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ie.useModalHandle(),i=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",a=[{title:"편집",items:[{keys:[i,"Z"],desc:"실행 취소"},{keys:[i,"Shift","Z"],desc:"다시 실행"},{keys:[i,"C"],desc:"선택 복사"},{keys:[i,"V"],desc:"붙여넣기"},{keys:["Delete"],desc:"선택 항목 삭제 (Backspace 동일)"}]},{title:"이동 · 정렬",items:[{keys:["←","↑","→","↓"],desc:"선택 노드 1px 이동"},{keys:["Shift","방향키"],desc:"선택 노드 10px 이동"},{keys:["↑","↓"],desc:"속성 선택 시 포커스 이동"},{keys:["Alt","↑","↓"],desc:"속성 순서 위/아래로"}]},{title:"기타",items:[{keys:["우클릭"],desc:"컨텍스트 메뉴 (엔티티·노트 추가 등)"},{keys:["Enter"],desc:"인라인 편집 확정"},{keys:["Esc"],desc:"편집·메뉴 닫기"},{keys:["?"],desc:"이 도움말 열기"}]}];return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",U$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",H$,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",F$,[(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",G$,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",Y$,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",W$,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",K$,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function q$(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const X$={key:0,class:"em-canvas__empty","aria-hidden":"true"},j$={key:1,class:"em-canvas__empty-title"},Z$={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},J$={class:"em-conflict-banner__body"},Q$={class:"em-conflict-banner__title"},ex={class:"em-conflict-banner__detail"},tx={key:0,class:"em-toast",role:"status","aria-live":"polite"},ql="nc:",Ju=Ue(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,x=>{x&&(l.value=x.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>q$(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f(x){u.x=x.clientX,u.y=x.clientY}const h=n.ref(null);n.provide(Ui,h);const m=n.ref(null);n.provide(Od,m);const p=n.ref(null),y=n.computed(()=>{const x=p.value,D=new Set;if(!x)return D;if(x.kind==="entity")D.add(x.id);else if(x.kind==="group"){const $=i.resolved.value.groups.find(U=>U.group.modelId===x.id);for(const U of($==null?void 0:$.group.memberEntityRefs)??[])D.add(U)}return D}),b=n.computed(()=>{const x=p.value,D=new Set(y.value),$=new Set,U=new Set;if(!x)return{related:D,edges:$,notes:U};if(x.kind==="note"){U.add(x.id);for(const ee of i.resolved.value.noteConnections)ee.noteRef===x.id&&D.add(ee.targetRef);return{related:D,edges:$,notes:U}}const P=y.value;if(!P.size)return{related:D,edges:$,notes:U};for(const ee of i.resolved.value.associations){const{end1:fe,end2:Ie}=ee.association;(P.has(fe.entityRef)||P.has(Ie.entityRef))&&($.add(ee.association.modelId),D.add(fe.entityRef),D.add(Ie.entityRef))}for(const ee of i.resolved.value.noteConnections)D.has(ee.targetRef)&&U.add(ee.noteRef);return{related:D,edges:$,notes:U}});n.provide(Un,{source:p,active:n.computed(()=>p.value!==null),primaryEntityIds:y,relatedEntityIds:n.computed(()=>b.value.related),relatedEdgeIds:n.computed(()=>b.value.edges),relatedNoteIds:n.computed(()=>b.value.notes),hoverGroupId:n.computed(()=>{var x;return((x=p.value)==null?void 0:x.kind)==="group"?p.value.id:null}),setEntityHover:x=>{m.value||d.value||(p.value=x?{kind:"entity",id:x}:null)},setGroupHover:x=>{m.value||d.value||(p.value=x?{kind:"group",id:x}:null)},setNoteHover:x=>{m.value||d.value||(p.value=x?{kind:"note",id:x}:null)}}),n.provide(pn,i);function _(x,D){return`${ql}${x}:${D}`}function A(x){if(!x.startsWith(ql))return null;const[D,$]=x.slice(ql.length).split(":");return D&&$?{noteRef:D,targetRef:$}:null}n.provide(Nl,{points:x=>{var $,U;const D=A(x);return D?(($=i.resolved.value.noteConnections.find(P=>P.noteRef===D.noteRef&&P.targetRef===D.targetRef))==null?void 0:$.waypoints)??[]:((U=i.resolved.value.associations.find(P=>P.association.modelId===x))==null?void 0:U.waypoints)??[]},movePoint:(x,D,$)=>{const U=A(x);U?i.moveNoteConnectionWaypoint(U.noteRef,U.targetRef,D,$):i.moveWaypoint(x,D,$)},insertPoint:(x,D,$)=>{const U=A(x);U?i.addNoteConnectionWaypoint(U.noteRef,U.targetRef,D,$):i.addWaypoint(x,D,$)},removePoint:(x,D)=>{const $=A(x);$?i.removeNoteConnectionWaypoint($.noteRef,$.targetRef,D):i.removeWaypoint(x,D)}});const g=Le(),{nodes:N,edges:te,findNode:S,findEdge:O,addNodes:z,addEdges:F,removeNodes:ne,removeEdges:re,fitView:L,setCenter:oe,getViewport:k,screenToFlowCoordinate:W,getSelectedNodes:R,updateNodeInternals:G}=g,H=n.ref(!1);async function ae(x){H.value=!0,await n.nextTick(),await new Promise(D=>requestAnimationFrame(()=>D(null)));try{return await x()}finally{H.value=!1}}function v(){return ae(()=>Xu(g))}function q(){return ae(()=>ju(g))}t({exportSvg:v,exportPng:q});const le=n.computed(()=>i.resolved.value.entities.length===0);function me(){const x=k(),{width:D,height:$}=g.dimensions.value;return{x:(D/2-x.x)/x.zoom,y:($/2-x.y)/x.zoom}}function he(){const x=me();i.addEntity("NewEntity",{x:x.x,y:x.y})}function se(){const x=me();i.addNote("메모",{x:x.x,y:x.y})}function ce(x){for(const D of i.resolved.value.groups){const{location:$,size:U}=D.geo;if(x.x>=$.x&&x.x<=$.x+U.width&&x.y>=$.y&&x.y<=$.y+U.height)return D.group.modelId}return null}function ye(){const x=i.resolved.value,D=new Map(x.groups.map(fe=>[fe.group.modelId,fe.geo])),$=new Set(x.groups.map(fe=>fe.group.modelId)),U=new Set([...$,...x.entities.map(fe=>fe.entity.modelId),...x.notes.map(fe=>fe.note.modelId)]);for(const fe of[...N.value])U.has(fe.id)||ne([fe.id]);for(const fe of x.groups){const Ie=fe.group.modelId,Be={width:`${fe.geo.size.width}px`,height:`${fe.geo.size.height}px`},Me={group:fe.group,style:fe.style,locked:fe.locked},Ke=fe.locked?!1:void 0,Ge=S(Ie);Ge?(Ge.position={...fe.geo.location},Ge.data=Me,Ge.style=Be,Ge.draggable=Ke):z([{id:Ie,type:"group",position:{...fe.geo.location},draggable:Ke,style:Be,data:Me}])}for(const fe of x.entities){const Ie=fe.entity.modelId,Be=fe.groupRef&&$.has(fe.groupRef)?fe.groupRef:void 0,Me={entity:fe.entity,displayMode:i.displayMode.value,collapsed:fe.collapsed,locked:fe.locked,groupRef:Be,size:fe.geo.size,style:fe.style,attributeStyles:fe.attributeStyles,operationStyles:fe.operationStyles},Ke=fe.locked?!1:void 0,Ge=Be?D.get(Be):void 0,Qe=Ge?{x:fe.geo.location.x-Ge.location.x,y:fe.geo.location.y-Ge.location.y}:{...fe.geo.location},Ye=S(Ie);Ye?(Ye.position=Qe,Ye.data=Me,Ye.parentNode=Be,Ye.draggable=Ke):z([{id:Ie,type:"entity",position:Qe,parentNode:Be,draggable:Ke,data:Me}])}for(const fe of x.notes){const Ie=fe.note,Be=Ie.modelId,Me=fe.groupRef&&$.has(fe.groupRef)?fe.groupRef:void 0,Ke={note:Ie,groupRef:Me},Ge={width:`${Ie.geo.size.width}px`,height:`${Ie.geo.size.height}px`},Qe=Me?D.get(Me):void 0,Ye=Qe?{x:Ie.geo.location.x-Qe.location.x,y:Ie.geo.location.y-Qe.location.y}:{...Ie.geo.location},Pe=S(Be);Pe?(Pe.position=Ye,Pe.data=Ke,Pe.style=Ge,Pe.parentNode=Me):z([{id:Be,type:"note",position:Ye,parentNode:Me,style:Ge,data:Ke}])}const P=new Map(x.associations.map(fe=>[fe.association.modelId,fe])),ee=new Set(x.noteConnections.map(fe=>_(fe.noteRef,fe.targetRef)));for(const fe of[...te.value])!P.has(fe.id)&&!ee.has(fe.id)&&re([fe.id]);for(const[fe,Ie]of P){const Be={id:fe,type:"association",source:Ie.association.end1.entityRef,target:Ie.association.end2.entityRef,sourceHandle:Ie.sourceColumnRef?`r:${Ie.sourceColumnRef}`:void 0,targetHandle:Ie.targetColumnRef?`l:${Ie.targetColumnRef}`:void 0,data:{association:Ie.association,sourceColumnRef:Ie.sourceColumnRef,targetColumnRef:Ie.targetColumnRef}},Me=O(fe);Me?(Me.data=Be.data,Me.sourceHandle=Be.sourceHandle,Me.targetHandle=Be.targetHandle):F([Be])}for(const fe of x.noteConnections){const Ie=_(fe.noteRef,fe.targetRef),Be={noteRef:fe.noteRef,targetRef:fe.targetRef},Me=O(Ie);Me?Me.data=Be:F([{id:Ie,type:"note-connection",source:fe.noteRef,target:fe.targetRef,data:Be}])}ke()}function ke(){n.nextTick(()=>requestAnimationFrame(()=>G()))}function Re(){const x=R.value.map($=>$.id);if(x.length)return x;const D=i.selection.value;return D&&(D.kind==="entity"||D.kind==="note"||D.kind==="group")?[D.id]:[]}function xe(x){var P;const D=x.target;if(D&&(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable))return;if(x.key==="?"){a.openModal({component:Zu}),x.preventDefault();return}if(!i.editable.value){(x.metaKey||x.ctrlKey)&&x.key.toLowerCase()==="c"&&(i.copy(),x.preventDefault());return}if(x.key==="Delete"||x.key==="Backspace"){i.deleteSelection()&&x.preventDefault();return}if(x.key==="ArrowUp"||x.key==="ArrowDown"||x.key==="ArrowLeft"||x.key==="ArrowRight"){if(((P=i.selection.value)==null?void 0:P.kind)==="attribute"){if(x.key==="ArrowUp"||x.key==="ArrowDown"){const Be=x.key==="ArrowDown"?1:-1;(x.altKey?i.nudgeSelectedAttributes(Be):i.moveAttributeFocus(Be))&&x.preventDefault()}return}const ee=x.shiftKey?10:1,fe=x.key==="ArrowLeft"?-ee:x.key==="ArrowRight"?ee:0,Ie=x.key==="ArrowUp"?-ee:x.key==="ArrowDown"?ee:0;i.nudgeNodes(Re(),fe,Ie)&&x.preventDefault();return}if(!(x.metaKey||x.ctrlKey))return;const U=x.key.toLowerCase();U==="c"?(i.copy(),x.preventDefault()):U==="v"?(i.paste(),x.preventDefault()):U==="z"&&(x.shiftKey?i.redo():i.undo(),x.preventDefault())}n.onMounted(async()=>{ye(),await n.nextTick(),L(),window.addEventListener("keydown",xe),window.addEventListener("pointerup",pe),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",xe),window.removeEventListener("pointerup",pe),window.removeEventListener("pointermove",f)});function pe(){h.value=null}function X(){d.value=!0,p.value=null}function K(){var U;d.value=!1;const x=(U=document.elementFromPoint(u.x,u.y))==null?void 0:U.closest(".vue-flow__node"),D=x==null?void 0:x.dataset.id;if(!D){p.value=null;return}const $=x.classList.contains("vue-flow__node-group")?"group":x.classList.contains("vue-flow__node-note")?"note":"entity";p.value={kind:$,id:D}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ye),n.watch(()=>i.revision.value,ke),n.watch(()=>i.resolved.value,x=>{const D=p.value;if(!D)return;(D.kind==="entity"?x.entities.some(U=>U.entity.modelId===D.id):D.kind==="group"?x.groups.some(U=>U.group.modelId===D.id):x.notes.some(U=>U.note.modelId===D.id))||(p.value=null)});function w(x){const D=x.computedPosition??x.position,$=x.dimensions??{width:0,height:0};return{x:D.x+$.width/2,y:D.y+$.height/2}}function C(x){const D=x.node;if(D){if(p.value=null,D.type==="group"){const $=i.resolved.value.groups.find(U=>U.group.modelId===D.id);m.value=$?{groupId:D.id,dx:D.position.x-$.geo.location.x,dy:D.position.y-$.geo.location.y}:null,h.value=null;return}if(D.type!=="entity"&&D.type!=="note"){h.value=null;return}h.value=ce(w(D))}}function V(x){var U;h.value=null,m.value=null;const D=(U=x.nodes)!=null&&U.length?x.nodes:[x.node],$=D.filter(P=>(P==null?void 0:P.type)==="group");if($.length){for(const P of $){if(!P)continue;const ee=i.resolved.value.entities.filter(fe=>fe.groupRef===P.id).map(fe=>{const Ie=S(fe.entity.modelId),Be=(Ie==null?void 0:Ie.computedPosition)??(Ie==null?void 0:Ie.position)??{x:0,y:0};return{id:fe.entity.modelId,location:{x:Be.x,y:Be.y}}});i.dragGroup(P.id,{x:P.position.x,y:P.position.y},ee)}return}for(const P of D){if(!P||P.type==="group")continue;const ee=P.computedPosition??P.position,fe=P.dimensions??{width:0,height:0},Ie={x:ee.x+fe.width/2,y:ee.y+fe.height/2};P.type==="note"?i.dropNote(P.id,{x:ee.x,y:ee.y},ce(Ie)):i.dropEntity(P.id,{x:ee.x,y:ee.y},ce(Ie))}}function Y(x){var Be,Me,Ke,Ge,Qe;if(!i.editable.value||!x.source||!x.target)return;const D=((Be=S(x.source))==null?void 0:Be.type)==="note",$=((Me=S(x.target))==null?void 0:Me.type)==="note";if(D||$){if(D&&$)return;const Ye=D?x.source:x.target,Pe=D?x.target:x.source;((Ke=S(Pe))==null?void 0:Ke.type)==="entity"&&i.addNoteConnection(Ye,Pe);return}const U=Ye=>{var Pe;return(Pe=i.state.logical.entities.find(_n=>_n.modelId===Ye))==null?void 0:Pe.stereotype},P=U(x.source)==="JPA_EMBEDDABLE",ee=U(x.target)==="JPA_EMBEDDABLE";if(P||ee){if(P&&ee)return;const Ye=P?x.source:x.target,Pe=P?x.target:x.source;i.addEmbedAssociation(Pe,Ye);return}const fe=(Ge=x.sourceHandle)!=null&&Ge.startsWith("r:")?x.sourceHandle.slice(2):void 0,Ie=(Qe=x.targetHandle)!=null&&Qe.startsWith("l:")?x.targetHandle.slice(2):void 0;i.addAssociation(x.source,x.target,fe,Ie)}const J=n.ref(null);function ge(x,D){var U;const $=i.state.layout.entityLayouts.find(P=>P.entityRef===x);return it((U=$==null?void 0:$.attributeStyles)==null?void 0:U[D])}function we(x,D){var U;const $=i.state.layout.entityLayouts.find(P=>P.entityRef===x);return it((U=$==null?void 0:$.operationStyles)==null?void 0:U[D])}function Ne(x){var D;return it((D=i.state.layout.groupLayouts.find($=>$.groupRef===x))==null?void 0:D.style)}function _e(x){var D;return it((D=i.state.layout.notes.find($=>$.modelId===x))==null?void 0:D.style)}function Ce(x){var U,P;if(x.preventDefault(),!i.editable.value)return;const D=()=>W({x:x.clientX,y:x.clientY}),$=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const ee=D();i.addEntity("NewEntity",{x:ee.x,y:ee.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const ee=D();i.addNote("메모",{x:ee.x,y:ee.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const ee=D();i.addEmptyGroup({x:ee.x,y:ee.y})}}];((U=i.clipboard.value)==null?void 0:U.kind)==="entity"&&$.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&$.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(P=J.value)==null||P.open(x,$)}function Te({event:x,node:D}){var Be,Me,Ke,Ge,Qe,Ye,Pe,_n,Ee,et,Bo,Do,Oo,Lo,Po,zo,Uo,rt;const $=x;if($.preventDefault(),!i.editable.value){if(D.type==="group"||D.type==="note")return;const ze=(Me=(Be=$.target)==null?void 0:Be.closest("[data-attr]"))==null?void 0:Me.dataset.attr;if(ze){const je=i.selection.value;(je==null?void 0:je.kind)==="attribute"&&je.entityId===D.id&&je.ids.includes(ze)||i.selectAttribute(D.id,ze);const kn=((Ke=i.selection.value)==null?void 0:Ke.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[ze];(Ge=J.value)==null||Ge.open($,[{caption:kn.length>1?`복사 (${kn.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Qe=J.value)==null||Qe.open($,[{caption:"상세 편집…",icon:"pencil",handler:()=>Pi(a,i,D.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}]);return}if(D.type==="group"){const ze=i.isGroupLocked(D.id),je=[];ze||je.push({type:"swatches",caption:"색상",current:Ne(D.id),onPick:nt=>i.setGroupSwatch(D.id,nt)},{type:"separator"}),je.push({caption:ze?"잠금 해제":"잠금",icon:ze?"unlock":"lock",handler:()=>i.setGroupLocked(D.id,!ze)}),ze||je.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(D.id)}),(Ye=J.value)==null||Ye.open($,je);return}if(D.type==="note"){(Pe=J.value)==null||Pe.open($,[{type:"swatches",caption:"색상",current:_e(D.id),onPick:ze=>i.setNoteSwatch(D.id,ze)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(D.id)}]);return}const U=(Ee=(_n=$.target)==null?void 0:_n.closest("[data-attr]"))==null?void 0:Ee.dataset.attr;if(U){const ze=i.selection.value;(ze==null?void 0:ze.kind)==="attribute"&&ze.entityId===D.id&&ze.ids.includes(U)||i.selectAttribute(D.id,U);const nt=((et=i.selection.value)==null?void 0:et.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[U];if(i.isEntityLocked(D.id)){(Bo=J.value)==null||Bo.open($,[{caption:nt.length>1?`복사 (${nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const kn=nt.length>1,Xl=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{type:"swatches",caption:kn?`색상 (${nt.length})`:"색상",current:kn?null:ge(D.id,U),onPick:eC=>i.setAttributeSwatches(D.id,nt,eC)},{type:"separator"},{caption:kn?`복사 (${nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Ho=i.clipboard.value;(Ho==null?void 0:Ho.kind)==="attribute"&&Xl.push({caption:Ho.attributes.length>1?`속성 붙여넣기 (${Ho.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Xl.push({type:"separator"},{caption:kn?`속성 삭제 (${nt.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(D.id,nt)}),(Do=J.value)==null||Do.open($,Xl);return}const P=(Lo=(Oo=$.target)==null?void 0:Oo.closest("[data-op]"))==null?void 0:Lo.dataset.op;if(P){if(i.isEntityLocked(D.id))return;(Po=J.value)==null||Po.open($,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(D.id)},{type:"swatches",caption:"색상",current:we(D.id,P),onPick:ze=>i.setOperationSwatch(D.id,P,ze)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(D.id,P)}]);return}const ee=i.resolved.value.entities.find(ze=>ze.entity.modelId===D.id),fe=!!(ee!=null&&ee.locked),Ie=[{caption:fe?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>Pi(a,i,D.id)}];if(!fe){Ie.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(D.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const je=R.value.filter(nt=>nt.type==="entity").map(nt=>nt.id);i.createGroup(je.includes(D.id)&&je.length?je:[D.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(D.id,D.id)});const ze=i.embeddableCatalog.value;if(ze.length){Ie.push({type:"separator"});for(const je of ze){const nt=((zo=je.label)==null?void 0:zo.ko)??((Uo=je.label)==null?void 0:Uo.en)??je.type;Ie.push({caption:`임베더블 추가: ${nt}`,icon:"link",handler:()=>i.addPredefinedEmbed(D.id,je.type)})}}}if(Ie.push({type:"separator"}),Ie.push({caption:ee!=null&&ee.collapsed?"펼치기":"접기",icon:ee!=null&&ee.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(D.id,!(ee!=null&&ee.collapsed))}),ee!=null&&ee.groupRef&&!fe&&Ie.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(D.id)}),Ie.push({caption:fe?"잠금 해제":"잠금",icon:fe?"unlock":"lock",handler:()=>i.setEntityLocked(D.id,!fe)}),Ie.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}),!fe){const ze=i.clipboard.value;(ze==null?void 0:ze.kind)==="attribute"&&Ie.push({caption:ze.attributes.length>1?`속성 붙여넣기 (${ze.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Ie.push({type:"separator"}),Ie.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(D.id)})}(rt=J.value)==null||rt.open($,Ie)}function De({event:x,edge:D}){var P,ee;const $=x;if($.preventDefault(),!i.editable.value)return;const U=A(D.id);if(U){(P=J.value)==null||P.open($,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(U.noteRef,U.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(U.noteRef,U.targetRef)}]);return}(ee=J.value)==null||ee.open($,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(D.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(D.id)}])}function E(x){return x==="group"?"group":x==="note"?"note":"entity"}function T({node:x}){if(R.value.length>1){i.selection.value=null;return}i.selection.value={kind:E(x.type),id:x.id}}function I({nodes:x}){x.length>1&&(i.selection.value=null)}function M({edge:x}){const D=A(x.id);i.selection.value=D?{kind:"note",id:D.noteRef}:{kind:"association",id:x.id}}function B(x){const D=i.selection.value;return!!D&&D.kind!=="attribute"&&D.id===x.id}function de(x){var D,$;return B(x)?x.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":x.type==="note"?"var(--em-note-soft)":x.type==="group"?Sd(it((D=x.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":Sd(it(($=x.data)==null?void 0:$.style))??"var(--em-mm-entity)"}function be(x){return B(x)?"var(--em-selection)":x.type==="note"?"var(--em-note-accent)":x.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function Q(x,D){oe(x,D,{zoom:k().zoom,duration:350})}n.watch(()=>i.focusRequest.value,x=>{if(!x)return;const D=S(x.id);if(!D)return;const $=D.computedPosition??D.position,U=D.dimensions??{width:0,height:0};Q($.x+U.width/2,$.y+U.height/2)});function Z({position:x}){Q(x.x,x.y)}function j({node:x}){i.selection.value={kind:E(x.type),id:x.id};const D=x.computedPosition??x.position,$=x.dimensions??{width:0,height:0};Q(D.x+$.width/2,D.y+$.height/2)}function ue({node:x}){L({nodes:[x.id],duration:350,maxZoom:1.2,padding:.6})}return(x,D)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(l1),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!H.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(Bt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:X,onMoveEnd:K,onConnect:Y,onConnectStart:D[1]||(D[1]=$=>c.value=!0),onConnectEnd:D[2]||(D[2]=$=>c.value=!1),onNodeDrag:C,onNodeDragStop:V,onNodeClick:T,onEdgeClick:M,onSelectionChange:I,onPaneClick:D[3]||(D[3]=$=>n.unref(i).selection.value=null),onPaneContextMenu:Ce,onNodeContextMenu:Te,onEdgeContextMenu:De},{"node-group":n.withCtx($=>[n.createVNode(Pd,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"node-entity":n.withCtx($=>[n.createVNode(Ld,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"node-note":n.withCtx($=>[n.createVNode(zd,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"edge-association":n.withCtx($=>[n.createVNode(eu,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"edge-note-connection":n.withCtx($=>[n.createVNode(v$,n.normalizeProps(n.guardReactiveProps($)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(uw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Ow),{"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:he},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"노트 추가",onClick:se},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"자동 배치",onClick:D[0]||(D[0]=$=>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(_$),{key:1,pannable:"",width:224,height:160,"node-color":de,"node-stroke-color":be,"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:Z,onNodeClick:j,onNodeDblclick:ue})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),le.value?(n.openBlock(),n.createElementBlock("div",X$,[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",j$,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",Z$,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",J$,[n.createElementVNode("strong",Q$,n.toDisplayString(s.value.title),1),n.createElementVNode("span",ex,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(M$,{ref_key:"menuRef",ref:J},null,512),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",tx,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function sa(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function nx(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 ox={class:"em-explorer em-scroll-overlay"},ix={class:"em-explorer__search"},ax={key:0,class:"em-explorer__empty"},lx={class:"em-explorer__rows"},rx=["data-key","onClick","onDblclick"],sx=["onClick"],cx=["title"],dx={class:"em-key-slot"},ux={class:"em-key-slot"},fx={class:"em-explorer__label"},Qu=Ue(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.computed(()=>{var ae;const S=i.resolved.value,O=i.displayMode.value,z=v=>{var q,le,me;return Fo(O,v.name,(le=(q=v.table)==null?void 0:q.logicalName)==null?void 0:le.ko,(me=v.table)==null?void 0:me.physicalName)},F=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",ne=v=>{const q=v.attrType.startsWith("RELATION")&&v.dbAttrs.length>0;return{icon:v.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:v.identifier,fk:q&&F}}},re=v=>v.attrType.startsWith("EMBED")&&v.dbAttrs.length>0,L=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",oe=v=>{if(v.attrType!=="EMBED_PREDEF")return v.dbAttrs;const q=i.embeddableCatalog.value.find(le=>le.type===v.type);return q?v.dbAttrs.map((le,me)=>{const he=q.fields[me];return he?{...le,physicalName:le.physicalName||he.physicalName,logicalName:le.logicalName??he.logicalName,dataType:le.dataType||he.dataType,length:le.length??he.length}:le}):v.dbAttrs},k=(v,q)=>{var se,ce,ye,ke,Re,xe,pe,X,K;const le={entityId:q,attrId:v.modelId};if(re(v)){const w=Ea(O,v);return{key:`attr:${v.modelId}`,label:v.name+(w?` : ${w}`:""),icon:"table",attrRef:le,focusId:q,matchText:sa(v.name,(ce=(se=v.dbAttrs[0])==null?void 0:se.logicalName)==null?void 0:ce.ko,(ye=v.dbAttrs[0])==null?void 0:ye.physicalName),children:L?oe(v).map(C=>{var V,Y;return{key:`attr:${v.modelId}:col:${C.modelId}`,label:Fo(O,C.physicalName,(V=C.logicalName)==null?void 0:V.ko,C.physicalName)+(C.dataType?` : ${C.dataType}`:""),icon:"field",attrRef:le,focusId:q,matchText:sa(C.physicalName,(Y=C.logicalName)==null?void 0:Y.ko),children:[]}}):[]}}const me=fr(v,i.state.logical.associations),he=Ea(O,v,me);return{key:`attr:${v.modelId}`,label:Fo(O,v.name,(Re=(ke=v.dbAttrs[0])==null?void 0:ke.logicalName)==null?void 0:Re.ko,(xe=v.dbAttrs[0])==null?void 0:xe.physicalName)+(he?` : ${he}`:""),...ne(v),attrRef:le,focusId:q,matchText:sa(v.name,(X=(pe=v.dbAttrs[0])==null?void 0:pe.logicalName)==null?void 0:X.ko,(K=v.dbAttrs[0])==null?void 0:K.physicalName),children:[]}},W=v=>{var me,he,se;const q=v.entity,le=[...q.attributes].sort((ce,ye)=>ce.order-ye.order);return{key:`entity:${q.modelId}`,label:z(q),icon:"table",selectKind:"entity",selectId:q.modelId,focusId:q.modelId,matchText:sa(q.name,(he=(me=q.table)==null?void 0:me.logicalName)==null?void 0:he.ko,(se=q.table)==null?void 0:se.physicalName),children:le.map(ce=>k(ce,q.modelId))}},R=new Map,G=[];for(const v of S.entities)if(v.groupRef){const q=R.get(v.groupRef)??[];q.push(v),R.set(v.groupRef,q)}else G.push(v);const H=[];for(const v of S.groups){const q=v.group;H.push({key:`group:${q.modelId}`,label:((ae=q.name)==null?void 0:ae.ko)||q.packageName||"(그룹)",icon:"folder",focusId:q.modelId,children:(R.get(q.modelId)??[]).map(W)})}for(const v of G)H.push(W(v));if(S.associations.length){const v=new Map(S.entities.map(q=>[q.entity.modelId,z(q.entity)]));H.push({key:"section:associations",label:`관계 (${S.associations.length})`,icon:"arrow-lr",children:S.associations.map(q=>{const le=q.association,me=v.get(le.end1.entityRef)??le.end1.entityRef,he=v.get(le.end2.entityRef)??le.end2.entityRef;return{key:`assoc:${le.modelId}`,label:`${me} — ${he}`,icon:"arrow-lr",selectKind:"association",selectId:le.modelId,children:[]}})})}return S.notes.length&&H.push({key:"section:notes",label:`노트 (${S.notes.length})`,icon:"note",children:S.notes.map(({note:v})=>{var q;return{key:`note:${v.modelId}`,label:((q=v.memo.split(`
|
|
43
|
-
`)[0])==null?void 0:q.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:v.modelId,focusId:v.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:H}});function r(S){return S?S.pk&&S.fk?"PFK (식별 외래키)":S.pk?"PK (기본키)":S.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(S){const O=new Set(s.value);O.has(S)?O.delete(S):O.add(S),s.value=O}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),h=n.computed(()=>{const S=[];if(f.value){const z=nx(l.value,d.value.trim().toLowerCase()),F=(ne,re)=>{if(z.has(ne.key)){S.push({node:ne,depth:re});for(const L of ne.children)F(L,re+1)}};return F(l.value,0),S}const O=(z,F)=>{if(S.push({node:z,depth:F}),!s.value.has(z.key))for(const ne of z.children)O(ne,F+1)};return O(l.value,0),S}),m=n.computed(()=>f.value&&h.value.length<=1);function p(S){var F;if(S.key!=="/"||S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;const O=S.target,z=O==null?void 0:O.tagName;z==="INPUT"||z==="TEXTAREA"||z==="SELECT"||O!=null&&O.isContentEditable||(S.preventDefault(),(F=u.value)==null||F.focus())}n.onMounted(()=>window.addEventListener("keydown",p)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",p));const y=n.computed(()=>{const S=[],O=z=>{if(z.children.length){z.key!=="root"&&S.push(z.key);for(const F of z.children)O(F)}};return O(l.value),S}),b=n.computed(()=>!y.value.some(S=>s.value.has(S)));function _(){s.value=b.value?new Set(y.value):new Set}t({toggleAll:_,allExpanded:b,hasExpandable:n.computed(()=>y.value.length>0)});function A(S){const O=i.selection.value;return S.attrRef?(O==null?void 0:O.kind)==="attribute"&&O.entityId===S.attrRef.entityId&&O.ids.includes(S.attrRef.attrId):!!O&&O.kind!=="attribute"&&!!S.selectId&&S.selectKind===O.kind&&S.selectId===O.id}function g(S){const O=i.selection.value;return S.selectKind==="entity"&&(O==null?void 0:O.kind)==="attribute"&&O.entityId===S.selectId}function N(S,O){if(S.attrRef){const z=O.shiftKey?"range":O.metaKey||O.ctrlKey?"toggle":"replace";i.selectAttribute(S.attrRef.entityId,S.attrRef.attrId,z)}else S.selectKind&&S.selectId&&(i.selection.value={kind:S.selectKind,id:S.selectId});S.focusId&&i.requestFocus(S.focusId)}function te(S){S.selectKind==="entity"&&S.selectId&&Pi(a,i,S.selectId)}return(S,O)=>(n.openBlock(),n.createElementBlock("section",ox,[n.createElementVNode("div",ix,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":O[0]||(O[0]=z=>d.value=z),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:O[1]||(O[1]=n.withKeys(z=>d.value="",["esc"]))},null,544),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":"검색어 지우기",title:"지우기 (Esc)",onClick:O[2]||(O[2]=z=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("p",ax,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",lx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,({node:z,depth:F})=>(n.openBlock(),n.createElementBlock("div",{key:z.key,class:n.normalizeClass(["em-explorer__row",{"is-active":A(z),"is-focus-parent":g(z),"is-selectable":!!z.selectKind||!!z.attrRef||!!z.focusId}]),"data-key":z.key,style:n.normalizeStyle({paddingLeft:4+F*14+"px"}),onClick:ne=>N(z,ne),onDblclick:ne=>te(z)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!z.children.length,"is-open":!s.value.has(z.key)}]),onClick:n.withModifiers(ne=>z.children.length&&c(z.key),["stop"])},[z.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,sx),z.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(z.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",dx,[z.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):z.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:z.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",ux,[z.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,cx)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:z.icon,size:15},null,8,["name"])),n.createElementVNode("span",fx,n.toDisplayString(z.label),1)],46,rx))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),mx={class:"em-text-export"},px={key:0,class:"em-text-export__tabs",role:"tablist"},hx=["aria-selected","onClick"],yx={class:"em-text-export__pre"},gx={class:"em-text-export__actions"},bx=Ue(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(0);function a(){return t.formats[i.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(a().content),ie.showNotification("클립보드에 복사되었습니다.","info")}catch{ie.showNotification("복사에 실패했습니다.","error")}}function r(){const s=a(),c=new Blob([s.content],{type:"text/plain;charset=utf-8"}),d=URL.createObjectURL(c);try{const u=document.createElement("a");u.href=d,u.download=s.filename,document.body.appendChild(u),u.click(),u.remove()}finally{URL.revokeObjectURL(d)}}return(s,c)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",mx,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",px,[(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,hx))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",yx,n.toDisplayString(a().content),1),n.createElementVNode("div",gx,[n.createVNode(n.unref(ie.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ie.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),_x={class:"em-toolbar"},kx={class:"em-toolbar__mode"},ef=Ue(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ie.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:m=>i.displayMode.value=m});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(p=>p.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){const m=i.state.logical;l.openModal({component:bx,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:or(m),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:ya(m,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:ya(m,"class"),filename:"diagram.class.mmd"}]}})}function h(){l.openModal({component:Zu})}return(m,p)=>(n.openBlock(),n.createElementBlock("div",_x,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:p[0]||(p[0]=y=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:p[1]||(p[1]=y=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),p[10]||(p[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",kx,[p[8]||(p[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:s.value,"onUpdate:modelValue":p[2]||(p[2]=y=>s.value=y),items:r,"value-provider":y=>y.v,"label-provider":y=>y.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:p[3]||(p[3]=y=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:p[4]||(p[4]=y=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:d.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),p[11]||(p[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"내보내기 (텍스트 · Mermaid)",onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:p[5]||(p[5]=y=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:p[6]||(p[6]=y=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[p[9]||(p[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:p[7]||(p[7]=y=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:"키보드 단축키 (?)",onClick:h},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1})]))}}),[["__scopeId","data-v-aea19e30"]]),wx={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},Ex=["title"],vx=["disabled","aria-pressed"],Nx=["disabled","aria-pressed"],$x=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",wx,[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,vx),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,Nx)],10,Ex))}}),[["__scopeId","data-v-44f7d737"]]),xx=["disabled"],Ix={class:"em-panel__sub"},Sx={class:"em-nav"},Cx={key:0,class:"em-nav__divider","aria-hidden":"true"},Rx={key:1},Vx=["onClick","onKeydown"],Ax={class:"em-nav__name"},Tx=["title"],Mx={key:0,class:"em-panel__note"},Bx=["data-attr-block"],Dx={class:"em-attr__row"},Ox=["title"],Lx={key:0,class:"em-attr__row"},Px={class:"em-attr__row"},zx={class:"em-attr__row"},Ux={class:"em-attr__flags"},Hx={class:"em-attr__pii"},Fx={class:"em-attr__pii"},Gx={class:"em-attr__pii"},Yx={key:0,class:"em-attr__pii em-attr__codetop"},Wx={class:"em-multilang"},Kx={key:2,class:"em-embed-cols"},qx={class:"em-embed-col__label"},Xx={class:"em-attr__row"},jx={class:"em-attr__row"},Zx={key:0,class:"em-embed-upd"},Jx={class:"em-embed-upd"},Qx={class:"em-embed-upd"},eI={class:"em-swatch__row em-attr__swatch"},tI=["onClick"],nI=["title","onClick"],oI={key:0,class:"em-attr__swatch-hint"},iI="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",ca="__OWN__",aI=Ue(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find($=>$.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find($=>$.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes.filter(U=>U.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes)??[]}),d=n.computed(()=>s.value.filter($=>r.value.has($.modelId)));function u($){return{pk:$.identifier,fk:$.attrType.startsWith("RELATION")&&$.dbAttrs.length>0,required:$.notNull&&!$.identifier}}function f($){return!!i.value&&!!ti(o.state.logical,i.value.modelId,$.modelId)}function h($){const U=u($),P=[U.pk&&"PK",U.fk&&"FK",U.required&&"NOT NULL"].filter(Boolean);return P.length?P.join(" · "):void 0}function m($,U){i.value&&o.selectAttribute(i.value.modelId,$.modelId,U.shiftKey?"range":U.metaKey||U.ctrlKey?"toggle":"replace")}const p=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function y($){return $==="none"?"(없음)":$}const b=$=>$;function _($){var U,P;return it((P=(U=a.value)==null?void 0:U.attributeStyles)==null?void 0:P[$.modelId])}function A($){return r.value.size>1&&r.value.has($.modelId)}function g($,U){if(!i.value)return;const P=A($)?o.selectedAttrIds.value:[$.modelId];o.setAttributeSwatches(i.value.modelId,P,U)}function N($,U){i.value&&o.updateAttribute(i.value.modelId,$.modelId,U)}function te($,U){N($,{naturalId:U||void 0,naturalIdMutable:U?$.naturalIdMutable:void 0})}function S(){return{naturalId:void 0,naturalIdMutable:void 0}}function O($,U){N($,{identifier:U,...U?S():{}})}function z($,U){N($,{transient:U||void 0,...U?S():{}})}function F($){return!!$.transient}const ne=$=>$.value,re=$=>$.label;function L($,U){if(!U)return;const P=v.value.find(ee=>ee.type===U);if(P){const ee=$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"};N($,{type:U,customType:void 0,dbAttrs:[{...ee,dataType:P.dataType,length:P.length,scale:P.scale}]});return}N($,U===zt?{type:U}:{type:U,customType:void 0})}function oe($,U){N($,{customType:U.trim()===""?void 0:U})}function k($,U){const ee={...$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!Go.has(ee.dataType)&&(ee.scale=void 0),N($,{dbAttrs:[ee]})}function W($){var U;return Go.has(((U=$.dbAttrs[0])==null?void 0:U.dataType)??"")}function R($,U,P){var ee;k($,{logicalName:{...(ee=$.dbAttrs[0])==null?void 0:ee.logicalName,[U]:P}})}function G($,U){N($,{description:Object.keys(U).length?U:void 0})}function H($){return $.personalInfoAttributeType??"none"}function ae($,U){N($,{personalInfoAttributeType:U==="none"?void 0:U})}const v=n.computed(()=>o.predefinedCustomTypeCatalog.value),q=n.computed(()=>o.embeddableCatalog.value),le=n.ref(void 0);function me($){var U,P;return((U=$.label)==null?void 0:U.ko)??((P=$.label)==null?void 0:P.en)??$.type}function he($){if(!$||!i.value)return;const U=o.addPredefinedEmbed(i.value.modelId,$);U&&o.selectAttribute(i.value.modelId,U),le.value=void 0}function se(){if(!i.value)return;const $=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,$)}const ce=n.computed(()=>o.groupCodeCatalog.value);function ye($){var U;return((U=ce.value.find(P=>P.groupCode===$.groupCode))==null?void 0:U.codes)??[]}function ke($){return["none",...ye($)]}function Re($){return $==="none"?"none":$.code}function xe($){var P,ee;if($==="none")return"(없음)";const U=((P=$.label)==null?void 0:P.ko)??((ee=$.label)==null?void 0:ee.en);return U?`${$.code} (${U})`:$.code}function pe($,U){i.value&&o.setAttributeGroupCode(i.value.modelId,$.modelId,U)}function X($,U){N($,{defaultValue:U==="none"?void 0:U})}function K($,U){N($,{defaultValue:U.trim()===""?void 0:U})}function w($){return $.attrType.startsWith("EMBED")&&$.dbAttrs.length>0}function C($,U,P){const ee=$.dbAttrs.map((fe,Ie)=>{if(Ie!==U)return fe;const Be={...fe,...P};for(const Me of Object.keys(P))P[Me]===void 0&&delete Be[Me];return Be});i.value&&o.setEmbedColumns(i.value.modelId,$.modelId,ee)}function V($,U,P,ee){var fe;C($,U,{logicalName:{...(fe=$.dbAttrs[U])==null?void 0:fe.logicalName,[P]:ee}})}function Y($,U){var fe,Ie,Be;if($.attrType==="EMBED_PREDEF"){const Me=(fe=o.embeddableCatalog.value.find(Ke=>Ke.type===$.type))==null?void 0:fe.fields[U];return Me?{name:Me.name,physicalName:Me.physicalName,dataType:Me.dataType,length:Me.length,shareable:Me.shareable,logicalName:Me.logicalName}:void 0}const P=(Ie=$.embedded)==null?void 0:Ie.embeddableRef;if(!P)return;const ee=(Be=o.state.logical.entities.find(Me=>Me.modelId===P))==null?void 0:Be.attributes.flatMap(Me=>Me.dbAttrs)[U];return ee?{physicalName:ee.physicalName,dataType:ee.dataType,length:ee.length,scale:ee.scale,logicalName:ee.logicalName}:void 0}function J($,U){var P,ee;return((P=Y($,U))==null?void 0:P.dataType)||((ee=$.dbAttrs[U])==null?void 0:ee.dataType)||""}function ge($,U){var P,ee;return((P=Y($,U))==null?void 0:P.length)??((ee=$.dbAttrs[U])==null?void 0:ee.length)}function we($,U){var P,ee;return((P=Y($,U))==null?void 0:P.scale)??((ee=$.dbAttrs[U])==null?void 0:ee.scale)}const Ne=["inherit","true","false"];function _e($){return $==="inherit"?"기본(따름)":$}function Ce($){return($==null?void 0:$.updatable)===void 0?"inherit":$.updatable?"true":"false"}function Te($,U,P){C($,U,{updatable:P==="inherit"?void 0:P==="true"})}function De($,U){k($,{updatable:U==="inherit"?void 0:U==="true"})}const E=["inherit","true","false"];function T($){return $==="inherit"?"기본(따름)":$}function I($){return($==null?void 0:$.insertable)===void 0?"inherit":$.insertable?"true":"false"}function M($,U,P){C($,U,{insertable:P==="inherit"?void 0:P==="true"})}function B($,U){k($,{insertable:U==="inherit"?void 0:U==="true"})}const de=n.computed(()=>{var $;return Xn((($=i.value)==null?void 0:$.attributes.flatMap(U=>U.dbAttrs))??[])}),be=n.computed(()=>{var $;return((($=i.value)==null?void 0:$.attributes)??[]).filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>({modelId:U.dbAttrs[0].modelId,label:U.dbAttrs[0].physicalName||U.name}))});function Q(){return[ca,...be.value.map($=>$.modelId)]}function Z($){if($===ca)return"전용 컬럼(OWN)";const U=be.value.find(P=>P.modelId===$);return U?`↗ ${U.label} (공유)`:$}function j($){return($==null?void 0:$.sharedColumnRef)??ca}function ue($,U,P){C($,U,{sharedColumnRef:P===ca?void 0:P})}function x($){return($==null?void 0:$.sharedColumnRef)!=null}function D($){var U;return((U=Yo($,de.value))==null?void 0:U.physicalName)??""}return($,U)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",Ix,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:se}),q.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":le.value,items:q.value,"value-provider":P=>P.type,"label-provider":me,"onUpdate:modelValue":he},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",Sx,[(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",Cx,[...U[0]||(U[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",Rx,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(P.modelId)}]),role:"button",tabindex:"0",onClick:ee=>m(P,ee),onKeydown:[n.withKeys(n.withModifiers(ee=>m(P,ee),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ee=>m(P,ee),["prevent"]),["space"])]},[n.createElementVNode("span",Ax,n.toDisplayString(P.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:h(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,Tx)],42,Vx)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",Mx," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>{var ee,fe,Ie,Be,Me,Ke,Ge,Qe,Ye,Pe,_n;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",Dx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-name-${P.modelId}`,width:"100%",placeholder:"이름","model-value":P.name,"onUpdate:modelValue":Ee=>N(P,{name:Ee})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-type-${P.modelId}`,width:"84px",placeholder:"타입",disabled:P.attrType.startsWith("EMBED")||!!P.groupCode,items:n.unref(ur)(P.type,v.value),"value-provider":ne,"label-provider":re,"model-value":P.type,"onUpdate:modelValue":Ee=>L(P,Ee)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(P)?iI:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>n.unref(o).removeAttribute(i.value.modelId,P.modelId)},null,8,["onClick"])],8,Ox)]),P.type===n.unref(zt)?(n.openBlock(),n.createElementBlock("div",Lx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-customtype-${P.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":P.customType??"","onUpdate:modelValue":Ee=>oe(P,Ee)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),w(P)?(n.openBlock(),n.createElementBlock("div",Kx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.dbAttrs,(Ee,et)=>{var Bo,Do,Oo,Lo,Po,zo,Uo;return n.openBlock(),n.createElementBlock("div",{key:Ee.modelId,class:"em-embed-col"},[n.createElementVNode("span",qx,n.toDisplayString(((Bo=Y(P,et))==null?void 0:Bo.name)??((Do=Y(P,et))==null?void 0:Do.physicalName)??`컬럼 ${et+1}`),1),n.createElementVNode("div",Xx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-col-${Ee.modelId}`,width:"100%",disabled:x(Ee),placeholder:((Oo=Y(P,et))==null?void 0:Oo.physicalName)??"컬럼","model-value":x(Ee)?D(Ee):Ee.physicalName,"onUpdate:modelValue":rt=>C(P,et,{physicalName:rt})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSTextInput),{name:`embed-dtype-${Ee.modelId}`,width:"84px",disabled:"","model-value":J(P,et)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-len-${Ee.modelId}`,width:"48px",disabled:"","model-value":ge(P,et)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-scale-${Ee.modelId}`,width:"48px",disabled:"","model-value":we(P,et)},null,8,["name","model-value"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",jx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-logical-${Ee.modelId}`,width:"100%",placeholder:((Po=(Lo=Y(P,et))==null?void 0:Lo.logicalName)==null?void 0:Po.ko)??"논리명","model-value":((zo=Ee.logicalName)==null?void 0:zo.ko)??"","onUpdate:modelValue":rt=>V(P,et,"ko",rt)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Uo=Y(P,et))!=null&&Uo.shareable?(n.openBlock(),n.createElementBlock("label",Zx,[U[7]||(U[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px","model-value":j(Ee),items:Q(),"value-provider":b,"label-provider":Z,"onUpdate:modelValue":rt=>rt&&ue(P,et,rt)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",Jx,[U[8]||(U[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:x(Ee),"model-value":x(Ee)?"false":I(Ee),items:E,"value-provider":b,"label-provider":T,"onUpdate:modelValue":rt=>rt&&M(P,et,rt)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Qx,[U[9]||(U[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:x(Ee),"model-value":x(Ee)?"false":Ce(Ee),items:Ne,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":rt=>rt&&Te(P,et,rt)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",Px,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-logical-${P.modelId}`,width:"100%",placeholder:"논리명","model-value":((fe=(ee=P.dbAttrs[0])==null?void 0:ee.logicalName)==null?void 0:fe.ko)??"","onUpdate:modelValue":Ee=>R(P,"ko",Ee)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",zx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-col-${P.modelId}`,width:"100%",placeholder:"컬럼",disabled:F(P),"model-value":((Ie=P.dbAttrs[0])==null?void 0:Ie.physicalName)??"","onUpdate:modelValue":Ee=>k(P,{physicalName:Ee})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-dtype-${P.modelId}`,width:"84px",placeholder:"dataType",disabled:F(P),items:n.unref(cr)(((Be=P.dbAttrs[0])==null?void 0:Be.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":b,"label-provider":n.unref(_a),"model-value":((Me=P.dbAttrs[0])==null?void 0:Me.dataType)??"","onUpdate:modelValue":Ee=>Ee&&k(P,{dataType:Ee})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-len-${P.modelId}`,width:"48px",placeholder:"len",disabled:F(P),"model-value":(Ke=P.dbAttrs[0])==null?void 0:Ke.length,"onUpdate:modelValue":Ee=>k(P,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-scale-${P.modelId}`,width:"48px",placeholder:"scale",disabled:F(P)||!W(P),"model-value":(Ge=P.dbAttrs[0])==null?void 0:Ge.scale,"onUpdate:modelValue":Ee=>k(P,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Qe=P.dbAttrs[0])==null?void 0:Qe.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",Ux,[n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-pk-${P.modelId}`,label:"Primary Key","model-value":P.identifier,disabled:l.value||F(P),"onUpdate:modelValue":Ee=>O(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nn-${P.modelId}`,label:"Not Null","model-value":P.notNull,disabled:F(P),"onUpdate:modelValue":Ee=>N(P,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-uq-${P.modelId}`,label:"Unique","model-value":!!((Ye=P.dbAttrs[0])!=null&&Ye.unique),disabled:F(P),"onUpdate:modelValue":Ee=>k(P,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-ai-${P.modelId}`,label:"Auto Increment","model-value":!!((Pe=P.dbAttrs[0])!=null&&Pe.autoIncrement),disabled:F(P)||!P.identifier,"onUpdate:modelValue":Ee=>k(P,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-tr-${P.modelId}`,label:"@Transient","model-value":!!P.transient,disabled:P.identifier,"onUpdate:modelValue":Ee=>z(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nid-${P.modelId}`,label:"@NaturalId","model-value":!!P.naturalId,disabled:P.identifier||F(P),"onUpdate:modelValue":Ee=>te(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${P.modelId}`,label:"mutable","model-value":!!P.naturalIdMutable,disabled:F(P)||!P.naturalId,"onUpdate:modelValue":Ee=>N(P,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-mv-${P.modelId}`,label:"Multi-Value (Set)","model-value":!!((_n=P.dbAttrs[0])!=null&&_n.multiValue),disabled:F(P),"onUpdate:modelValue":Ee=>k(P,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",Hx,[U[1]||(U[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:F(P),"model-value":I(P.dbAttrs[0]),items:E,"value-provider":b,"label-provider":T,"onUpdate:modelValue":Ee=>Ee&&B(P,Ee)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Fx,[U[2]||(U[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:F(P),"model-value":Ce(P.dbAttrs[0]),items:Ne,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":Ee=>Ee&&De(P,Ee)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Gx,[U[3]||(U[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":H(P),items:p,"value-provider":b,"label-provider":y,"onUpdate:modelValue":Ee=>Ee&&ae(P,Ee)},null,8,["model-value","onUpdate:modelValue"])]),ce.value.length?(n.openBlock(),n.createElementBlock("label",Yx,[U[4]||(U[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Vd,{"model-value":P.groupCode,items:ce.value,"onUpdate:modelValue":Ee=>pe(P,Ee)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!ce.value.length}])},[U[5]||(U[5]=n.createElementVNode("span",null,"기본값",-1)),ye(P).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":P.defaultValue??"none",items:ke(P),"value-provider":Re,"label-provider":xe,"onUpdate:modelValue":Ee=>Ee&&X(P,Ee)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`attr-default-${P.modelId}`,width:"100%",placeholder:"기본값","model-value":P.defaultValue??"","onUpdate:modelValue":Ee=>K(P,Ee)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",Wx,[U[6]||(U[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{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":Ee=>G(P,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",eI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(P)===null}]),title:"없음",onClick:Ee=>g(P,null)},"∅",10,tI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),Ee=>(n.openBlock(),n.createElementBlock("button",{key:Ee,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(P)===Ee}]),style:n.normalizeStyle({background:n.unref(Ln)(Ee)}),title:n.unref(On)(Ee),onClick:et=>g(P,Ee)},null,14,nI))),128)),A(P)?(n.openBlock(),n.createElementBlock("span",oI,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,Bx)}),128))],8,xx)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-52beb53b"]]),lI=["disabled"],rI={class:"em-panel__sub-label"},sI={class:"em-attr__row"},cI={class:"em-field em-idx-params"},dI=["value","onChange"],uI=Ue(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(m=>m.modelId===o.entityId)??null);function r(){var p;if(!l.value)return;const m=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:Oe(),name:`idx_${(((p=l.value.indexes)==null?void 0:p.length)??0)+1}`,unique:!1,columns:m?[{columnRef:m.modelId,descending:!1}]:[]})}function s(m,p){l.value&&a.updateIndex(l.value.modelId,m,p)}function c(m){var y;const p=(y=l.value)==null?void 0:y.attributes[0];p&&s(m.modelId,{columns:[...m.columns,{columnRef:p.modelId,descending:!1}]})}function d(m,p,y){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,columnRef:y}:b)})}function u(m,p,y){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,descending:y}:b)})}function f(m,p){s(m.modelId,{columns:m.columns.filter((y,b)=>b!==p)})}function h(m,p){s(m.modelId,{parameters:p.trim()===""?void 0:p})}return(m,p)=>{var y;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:p[0]||(p[0]=b=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",rI,[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(((y=l.value.indexes)==null?void 0:y.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(r,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],b=>(n.openBlock(),n.createElementBlock("div",{key:b.modelId,class:"em-attr"},[n.createElementVNode("div",sI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`idx-name-${b.modelId}`,width:"100%",placeholder:"인덱스명","model-value":b.name,"onUpdate:modelValue":_=>s(b.modelId,{name:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-uq-${b.modelId}`,class:"em-check",label:"UQ","model-value":b.unique,"onUpdate:modelValue":_=>s(b.modelId,{unique:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(a).removeIndex(l.value.modelId,b.modelId)},null,8,["onClick"])]),n.createVNode(mn,{controller:n.unref(a),"ref-id":b.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.columns,(_,A)=>(n.openBlock(),n.createElementBlock("div",{key:A,class:"em-attr__row"},[n.createVNode(n.unref(ie.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":g=>g.modelId,"label-provider":g=>g.name,"onUpdate:modelValue":g=>g&&d(b,A,g)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-${b.modelId}-desc-${A}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":g=>u(b,A,g)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"−",onClick:g=>f(b,A)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(b)},null,8,["onClick"]),n.createElementVNode("label",cI,[p[1]||(p[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:b.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:_=>h(b,_.target.value)},null,40,dI)])]))),128)):n.createCommentVNode("",!0)],8,lI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),fI=["disabled"],mI={class:"em-panel__sub-label"},pI={class:"em-attr__row"},hI={class:"em-attr__row"},yI={class:"em-multilang"},gI={class:"em-attr__pii"},bI={class:"em-swatch__row em-attr__swatch"},_I=["onClick"],kI=["title","onClick"],wI=Ue(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=ie.useModal(),r=n.computed(()=>a.state.logical.entities.find(g=>g.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(g=>g.entityRef===r.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(g){return g==="none"?"(없음)":g}const f=g=>g;function h(g,N){r.value&&a.updateOperation(r.value.modelId,g.modelId,N)}function m(g,N){h(g,{description:Object.keys(N).length?N:void 0})}function p(g){return g.personalInfoAttributeType??"none"}function y(g,N){h(g,{personalInfoAttributeType:N==="none"?void 0:N})}function b(g){var N,te;return it((te=(N=s.value)==null?void 0:N.operationStyles)==null?void 0:te[g.modelId])}function _(g,N){r.value&&a.setOperationSwatch(r.value.modelId,g.modelId,N)}function A(g){l.openModal({component:Ad,bind:{operationName:g.name,sourceCode:g.sourceCode??"",onSave:N=>h(g,{sourceCode:N})}})}return(g,N)=>{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:N[1]||(N[1]=S=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",mI,[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(ie.BSButton),{variant:"text",caption:"추가",onClick:N[0]||(N[0]=n.withModifiers(S=>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??[],S=>(n.openBlock(),n.createElementBlock("div",{key:S.modelId,class:"em-attr"},[n.createElementVNode("div",pI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":S.name,"onUpdate:modelValue":O=>h(S,{name:O})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":O=>O&&h(S,{visibility:O})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:O=>n.unref(a).removeOperation(r.value.modelId,S.modelId)},null,8,["onClick"])]),n.createElementVNode("div",hI,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:S.sourceCode?"본문 편집 ●":"본문 편집",onClick:O=>A(S)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",yI,[N[2]||(N[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{multiline:"",name:`op-desc-${S.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":O=>m(S,O)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",gI,[N[3]||(N[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":p(S),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":O=>O&&y(S,O)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",bI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(S)===null}]),title:"없음",onClick:O=>_(S,null)},"∅",10,_I),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),O=>(n.openBlock(),n.createElementBlock("button",{key:O,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(S)===O}]),style:n.normalizeStyle({background:n.unref(Ln)(O)}),title:n.unref(On)(O),onClick:z=>_(S,O)},null,14,kI))),128))])]))),128)):n.createCommentVNode("",!0)],8,fI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),EI={class:"em-panel__head"},vI={class:"em-panel__head-row"},NI={class:"em-panel__context"},$I={key:0,class:"em-panel__lock"},xI=["disabled"],II={key:0,class:"em-panel__note"},SI={key:1,class:"em-panel__note"},CI={key:2,class:"em-jpa"},RI={class:"em-field"},VI={class:"em-field"},AI={key:0,class:"em-field"},TI={class:"em-panel__sub"},MI={class:"em-field"},BI={class:"em-jpa"},DI={key:0,class:"em-panel__note"},OI={class:"em-jpa"},LI={class:"em-field"},PI={key:0,class:"em-panel__note"},zI={class:"em-field"},UI={class:"em-multilang"},HI={class:"em-field"},FI=["value"],GI={class:"em-field"},YI={class:"em-swatch"},WI={class:"em-swatch__row"},KI=["title","onClick"],qI={class:"em-panel__note"},XI={class:"em-field"},jI=["value"],ZI={class:"em-swatch"},JI={class:"em-swatch__row"},QI=["title","onClick"],tf=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 X=r.value;return X?a.state.logical.entities.find(K=>K.modelId===X)??null:null}),c=n.computed(()=>{const X=l.value;if((X==null?void 0:X.kind)==="association"){const w=a.state.logical.associations.find(C=>C.modelId===X.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 X;return((X=a.selectedAttr.value)==null?void 0:X.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),f=n.computed(()=>d.value!==null),h=n.ref({});n.watch(f,()=>{h.value={}});function m(X){return h.value[X]??f.value}function p(X){h.value={...h.value,[X]:!m(X)}}const y=n.computed(()=>{var w;const X=s.value;if(!X)return"엔티티";const K=(w=X.table)==null?void 0:w.physicalName;return K?`${X.name} (${K})`:X.name}),b=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="association"?a.state.logical.associations.find(K=>K.modelId===X.id)??null:null}),_=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="group"?a.state.logical.groups.find(K=>K.modelId===X.id)??null:null}),A=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="note"?a.state.layout.notes.find(K=>K.modelId===X.id)??null:null}),g=n.computed(()=>{var K,w;const X=(K=_.value)==null?void 0:K.name;return(X==null?void 0:X.ko)||(X==null?void 0:X.en)||(X==null?void 0:X.ja)||(X==null?void 0:X.zh)||((w=_.value)==null?void 0:w.packageName)||"그룹"}),N=n.computed(()=>{if(s.value){const X=u.value.size;if(X>1)return`엔티티 · ${s.value.name} › 속성 · ${X}개`;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(b.value){const X=K=>{var w;return((w=a.state.logical.entities.find(C=>C.modelId===K))==null?void 0:w.name)??K};return`관계 · ${X(b.value.end1.entityRef)} — ${X(b.value.end2.entityRef)}`}return _.value?`그룹 · ${g.value}`:A.value?"노트":"선택된 항목 없음"}),te=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],S=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],O=["LIST","SET"],z=["inherit","LAZY","EAGER"],F=X=>X;function ne(X){return X==="inherit"?"기본(따름)":X}const re=n.computed(()=>!!b.value&&b.value.end1.entityRef===b.value.end2.entityRef);function L(X,K){b.value&&a.updateAssociationEnd(b.value.modelId,X,K)}function oe(X){b.value&&!re.value&&a.setAssociationIdentifying(b.value.modelId,X)}function k(X){var K,w,C;return!!((C=(w=(K=b.value)==null?void 0:K[X].jpa)==null?void 0:w.cascadeTypes)!=null&&C.includes("ALL"))}function W(X,K,w){var Y,J;const C=(Y=b.value)==null?void 0:Y[X];if(K==="ALL"&&w){L(X,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:["ALL"]}});return}const V=new Set(((J=C==null?void 0:C.jpa)==null?void 0:J.cascadeTypes)??[]);w?V.add(K):V.delete(K),L(X,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:[...V]}})}function R(X,K){var C;const w=(C=b.value)==null?void 0:C[X];L(X,{jpa:{...w==null?void 0:w.jpa,...K}})}function G(X){var K,w;return((w=(K=b.value)==null?void 0:K[X].jpa)==null?void 0:w.fetchType)??"inherit"}function H(X,K){R(X,{fetchType:K==="inherit"?void 0:K})}function ae(X){var w;const K=(w=b.value)==null?void 0:w[X==="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 v=n.computed(()=>{const X=b.value;if(!X)return null;for(const K of a.state.logical.entities){const w=K.attributes.find(Y=>{var J;return((J=Y.embedded)==null?void 0:J.associationRef)===X.modelId&&Y.attrType==="EMBED_OWN"});if(!w)continue;const C=X.end2.entityRef===w.embedded.embeddableRef?"end2":"end1",V=X[C].jpa;return{which:C,isCollection:X[C].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(V==null?void 0:V.collectionType)??"LIST",collectionTable:(V==null?void 0:V.collectionTable)??"",orderColumn:(V==null?void 0:V.orderColumn)??""}}return null});function q(X){b.value&&a.setEmbedCollectionMode(b.value.modelId,X?"COLLECTION":"SINGLE")}function le(X){const K=v.value;K&&R(K.which,X==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function me(X){const K=v.value;K&&R(K.which,{collectionTable:X.trim()||void 0})}function he(X){const K=v.value;K&&R(K.which,{orderColumn:X.trim()||void 0})}function se(X){_.value&&a.updateGroup(_.value.modelId,X)}function ce(X,K){var w;se({name:{...(w=_.value)==null?void 0:w.name,[X]:K}})}const ye=n.computed(()=>{var X;return _.value?it((X=a.state.layout.groupLayouts.find(K=>K.groupRef===_.value.modelId))==null?void 0:X.style):null});function ke(X){_.value&&a.setGroupSwatch(_.value.modelId,X)}function Re(X){A.value&&a.setNoteMemo(A.value.modelId,X)}const xe=n.computed(()=>{var X;return it((X=A.value)==null?void 0:X.style)});function pe(X){A.value&&a.setNoteSwatch(A.value.modelId,X)}return(X,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",EI,[n.createElementVNode("div",vI,[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",NI,n.toDisplayString(N.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",$I,[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(Cd,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("basics"),title:y.value,onToggle:K[3]||(K[3]=w=>p("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(aI,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(uI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("index"),onToggle:K[4]||(K[4]=w=>p("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(wI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("ops"),onToggle:K[5]||(K[5]=w=>p("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ie.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!b.value.identifying,disabled:re.value||!!v.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),re.value?(n.openBlock(),n.createElementBlock("p",II,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):v.value?(n.openBlock(),n.createElementBlock("p",SI,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),v.value?(n.openBlock(),n.createElementBlock("fieldset",CI,[K[18]||(K[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ie.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":v.value.isCollection,"onUpdate:modelValue":q},null,8,["model-value"]),v.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",RI,[K[15]||(K[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":v.value.collectionType,items:O,"value-provider":F,"label-provider":F,"onUpdate:modelValue":K[6]||(K[6]=w=>w&&le(w))},null,8,["model-value"])]),n.createElementVNode("label",VI,[K[16]||(K[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":v.value.collectionTable,"onUpdate:modelValue":me},null,8,["model-value"])]),v.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",AI,[K[17]||(K[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":v.value.orderColumn,"onUpdate:modelValue":he},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 C,V,Y,J;return n.createElementVNode("div",{key:w,class:"em-end"},[n.createElementVNode("h4",TI,n.toDisplayString(w)+" → "+n.toDisplayString(b.value[w].entityRef),1),n.createElementVNode("label",MI,[K[20]||(K[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":b.value[w].multiplicity,items:te,"value-provider":F,"label-provider":F,disabled:((C=v.value)==null?void 0:C.which)===w,"onUpdate:modelValue":ge=>L(w,{multiplicity:ge})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-navigable`,class:"em-check",label:"navigable","model-value":b.value[w].navigable,"onUpdate:modelValue":ge=>L(w,{navigable:ge})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-composition`,class:"em-check",label:"composition","model-value":b.value[w].composition,"onUpdate:modelValue":ge=>L(w,{composition:ge})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",BI,[K[21]||(K[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(S,ge=>{var we,Ne;return n.createVNode(n.unref(ie.BSCheckbox),{key:ge,name:`${w}-cascade-${ge}`,class:"em-check",label:ge,"model-value":!!((Ne=(we=b.value[w].jpa)==null?void 0:we.cascadeTypes)!=null&&Ne.includes(ge)),disabled:ge!=="ALL"&&k(w),"onUpdate:modelValue":_e=>W(w,ge,_e)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),k(w)?(n.openBlock(),n.createElementBlock("p",DI,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",OI,[K[24]||(K[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",LI,[K[22]||(K[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":G(w),items:z,"value-provider":F,"label-provider":ne,"onUpdate:modelValue":ge=>ge&&H(w,ge)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((V=b.value[w].jpa)!=null&&V.orphanRemoval),disabled:ae(w),"onUpdate:modelValue":ge=>R(w,{orphanRemoval:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ae(w)&&((Y=b.value[w].jpa)!=null&&Y.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",PI,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",zI,[K[23]||(K[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:`${w}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((J=b.value[w].jpa)==null?void 0:J.orderBy)??"","onUpdate:modelValue":ge=>R(w,{orderBy:ge.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",UI,[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 C;return n.openBlock(),n.createElementBlock("label",{key:w,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(w),1),n.createVNode(n.unref(ie.BSTextInput),{name:`grp-name-${w}`,width:"100%","model-value":((C=_.value.name)==null?void 0:C[w])??"","onUpdate:modelValue":V=>ce(w,V)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",HI,[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=>se({description:w.target.value}))},null,40,FI)]),n.createElementVNode("label",GI,[K[27]||(K[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":K[8]||(K[8]=w=>se({packageName:w}))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":K[9]||(K[9]=w=>se({excludeDDLGeneration:w}))},null,8,["model-value"]),n.createElementVNode("fieldset",YI,[K[28]||(K[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",WI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ye.value===null}]),title:"없음",onClick:K[10]||(K[10]=w=>ke(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":ye.value===w}]),style:n.normalizeStyle({background:n.unref(Ln)(w)}),title:n.unref(On)(w),onClick:C=>ke(w)},null,14,KI))),128))])]),n.createElementVNode("p",qI,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),A.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",XI,[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,jI)]),n.createElementVNode("fieldset",ZI,[K[30]||(K[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",JI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":xe.value===null}]),title:"없음",onClick:K[12]||(K[12]=w=>pe(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":xe.value===w}]),style:n.normalizeStyle({background:n.unref(Ln)(w)}),title:n.unref(On)(w),onClick:C=>pe(w)},null,14,QI))),128))])])],64)):n.createCommentVNode("",!0)],8,xI)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),eS={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function tS(e){const t=e.split("-")[1];return t?eS[t]??t:e}function nS(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const oS=["title"],iS=["title","onClick"],aS={key:0,class:"em-validation__body"},lS={class:"em-validation__opt"},rS={key:0,class:"em-validation__empty"},sS={key:1,class:"em-validation__empty"},cS={key:2,class:"em-validation__list"},dS=["onClick"],uS={class:"em-validation__item-msg"},fS={key:0,class:"em-validation__item-entity"},mS=["title"],pS=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 y=new Map;for(const b of o.state.logical.entities)y.set(b.modelId,b.name);return y});function l(y){const b=nS(y);if(!b)return null;const _=a.value.get(b);return _===void 0?null:_.trim()===""?"(이름 없음)":_}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const y={error:0,warning:0,info:0};for(const b of i.value)y[b.severity]++;return y}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(y=>c.value[y.severity]).slice().sort((y,b)=>r[y.severity].order-r[b.severity].order)),u=n.computed(()=>d.value.map(y=>({issue:y,entityName:l(y),category:tS(y.ruleId)}))),f=n.ref(!1);function h(y){c.value[y]=!c.value[y]}function m(y){if(!f.value){f.value=!0;return}h(y)}function p(y){y.targetRef&&o.requestFocus(y.targetRef)}return(y,b)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(f.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:b[1]||(b[1]=_=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),b[3]||(b[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,oS),n.createElementVNode("div",{class:"em-validation__counts",onClick:b[0]||(b[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],_=>n.createElementVNode("button",{key:_,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:f.value?`${r[_].label} ${c.value[_]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:A=>m(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,iS)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",aS,[n.createElementVNode("label",lS,[n.createVNode(n.unref(ie.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":b[2]||(b[2]=_=>n.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",rS,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",sS," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",cS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:A,category:g},N)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${N}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:te=>p(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",uS,[A?(n.openBlock(),n.createElementBlock("span",fS,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(g),9,mS)],10,dS))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),hS={class:"em-history"},yS={class:"em-history__head"},gS={class:"em-history__title"},bS={class:"em-history__head-actions"},_S=["disabled"],kS={class:"em-history__filters"},wS={class:"em-history__filter"},ES={class:"em-history__body"},vS={key:0,class:"em-history__empty"},NS={key:1,class:"em-history__empty is-error"},$S={key:2,class:"em-history__empty"},xS={key:3,class:"em-history__list"},IS=["onClick"],SS={class:"em-history__summary"},CS={class:"em-history__seq"},RS={class:"em-history__gmeta"},VS={class:"em-history__who"},AS={key:0,class:"em-history__time"},TS={key:1,class:"em-history__restored-from"},MS={key:0,class:"em-history__detail"},BS={class:"em-history__action-head"},DS={class:"em-history__action-name"},OS={key:0,class:"em-history__fields"},LS={class:"em-history__fname"},PS={key:0,class:"em-history__old"},zS={class:"em-history__val"},US={key:1,class:"em-history__restore"},HS=["disabled","onClick"],FS=["disabled"],GS=["onClick"],YS=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(v){s.value=v instanceof Error?v.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,v=>{v&&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(v=>[v.modelId,v]))),m=n.computed(()=>new Map(a.state.logical.associations.map(v=>[v.modelId,v]))),p=n.computed(()=>new Map((a.state.logical.groups??[]).map(v=>{var q;return[v.modelId,v.packageName||((q=v.name)==null?void 0:q.ko)||v.modelId]})));function y(v){var he,se,ce,ye,ke,Re,xe;const q=m.value.get(v);if(!q)return"연관";if((he=q.description)!=null&&he.trim())return q.description.trim();const le=(ye=(ce=h.value.get((se=q.end1)==null?void 0:se.entityRef))==null?void 0:ce.name)==null?void 0:ye.trim(),me=(xe=(Re=h.value.get((ke=q.end2)==null?void 0:ke.entityRef))==null?void 0:Re.name)==null?void 0:xe.trim();return le&&me?`${le}→${me}`:"연관"}function b(v){var q,le,me,he;if(v.kind==="entity")return((le=(q=h.value.get(v.ref))==null?void 0:q.name)==null?void 0:le.trim())||"(이름 없음)";if(v.kind==="attribute"||v.kind==="operation"||v.kind==="index"){const se=v.entityRef?h.value.get(v.entityRef):void 0,ye=((v.kind==="attribute"?se==null?void 0:se.attributes:v.kind==="operation"?se==null?void 0:se.operations:se==null?void 0:se.indexes)??[]).find(Re=>Re.modelId===v.ref),ke=(me=se==null?void 0:se.name)==null?void 0:me.trim();return`${ke?ke+".":""}${((he=ye==null?void 0:ye.name)==null?void 0:he.trim())||v.ref}`}return v.kind==="association"?y(v.ref):v.kind==="associationEnd"?`${y(v.ref)}(${v.end})`:v.kind==="group"?`그룹 ${p.value.get(v.ref)??v.ref}`:v.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},A={add:"추가",update:"수정",remove:"삭제"},g=n.ref("all"),N=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],te=n.computed({get:()=>g.value,set:v=>{v&&(g.value=v)}}),S=n.computed(()=>br(l.value)),O=n.computed(()=>S.value.length?S.value[0].seq:null),z=n.computed(()=>g.value==="all"?S.value:S.value.filter(v=>(v.kind??"edit")===g.value));function F(v){return v===void 0?"—":v===null?"(비움)":typeof v=="object"?JSON.stringify(v):String(v)}function ne(v){const q=b(v.subject);if(v.verb==="add")return`${q} 추가`;if(v.verb==="remove")return`${q} 삭제`;if(v.fields.length===1){const le=v.fields[0];return`${q}.${le.field} ${le.oldValue!==void 0?F(le.oldValue)+"→":""}${F(le.value)}`}return`${q} ${v.fields.length}개 변경`}function re(v){return v.actions.length===0?"변경 없음":v.actions.length===1?ne(v.actions[0]):`${ne(v.actions[0])} 외 ${v.actions.length-1}건`}const L=n.ref(new Set);function oe(v){const q=new Set(L.value);q.has(v)?q.delete(v):q.add(v),L.value=q}function k(v){if(v==null)return"";const q=new Date(v);return isNaN(q.getTime())?String(v):q.toLocaleString()}function W(v){const q=v.author,le=v.origin;return q&&le?`${q}(${le})`:q||(le?`(${le})`:"—")}const R=n.ref(null),G=n.ref(!1);function H(v){R.value=v}async function ae(v){G.value=!0;try{const q=await a.restoreToSeq(v);q.ok||(s.value=`복원 실패: ${q.reason??"알 수 없음"}`)}finally{G.value=!1,R.value=null}}return(v,q)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",hS,[n.createElementVNode("header",yS,[n.createElementVNode("div",gS,[n.createVNode(Ve,{name:"undo",size:15}),q[4]||(q[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",bS,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:q[0]||(q[0]=le=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,_S),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:q[1]||(q[1]=le=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",kS,[n.createElementVNode("label",wS,[q[5]||(q[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:te.value,"onUpdate:modelValue":q[2]||(q[2]=le=>te.value=le),items:N,"value-provider":le=>le.v,"label-provider":le=>le.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",ES,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",vS,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",NS,n.toDisplayString(s.value),1)):z.value.length===0?(n.openBlock(),n.createElementBlock("p",$S,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",xS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(z.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:me=>oe(le.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":L.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",SS,n.toDisplayString(re(le)),1),n.createElementVNode("span",CS,"#"+n.toDisplayString(le.seq),1)],8,IS),n.createElementVNode("div",RS,[n.createElementVNode("span",VS,n.toDisplayString(W(le)),1),le.ts?(n.openBlock(),n.createElementBlock("span",AS,n.toDisplayString(k(le.ts)),1)):n.createCommentVNode("",!0),le.kind==="restore"&&le.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",TS,"← #"+n.toDisplayString(le.restoredFromSeq),1)):n.createCommentVNode("",!0)]),L.value.has(le.seq)?(n.openBlock(),n.createElementBlock("div",MS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le.actions,(me,he)=>(n.openBlock(),n.createElementBlock("div",{key:he,class:"em-history__action"},[n.createElementVNode("div",BS,[n.createVNode(Ve,{name:_[me.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",DS,n.toDisplayString(b(me.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${me.verb}`])},n.toDisplayString(A[me.verb]),3)]),me.fields.length?(n.openBlock(),n.createElementBlock("ul",OS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me.fields,(se,ce)=>(n.openBlock(),n.createElementBlock("li",{key:ce,class:"em-history__field"},[n.createElementVNode("span",LS,n.toDisplayString(se.field),1),se.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",PS,n.toDisplayString(F(se.oldValue)),1)):n.createCommentVNode("",!0),se.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",zS,n.toDisplayString(F(se.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&le.seq!==O.value?(n.openBlock(),n.createElementBlock("div",US,[R.value===le.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[q[6]||(q[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:G.value,onClick:me=>ae(le.seq)},"복원",8,HS),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:G.value,onClick:q[3]||(q[3]=me=>R.value=null)},"취소",8,FS)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:me=>H(le.seq)},[n.createVNode(Ve,{name:"undo",size:12}),q[7]||(q[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,GS))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function WS(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 nf(e){const t=n.ref(WS(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 KS={class:"em-modeler"},qS={class:"em-modeler__body"},XS={class:"em-drawer__inner"},jS={class:"em-drawer__head"},ZS={class:"em-drawer__actions"},JS=["title"],QS=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}=nf({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=nf({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(h,m)=>{var p,y,b;return n.openBlock(),n.createElementBlock("div",KS,[n.createVNode(ef,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=_=>{var A;return(A=u.value)==null?void 0:A.exportSvg()}),onExportPng:m[1]||(m[1]=_=>{var A;return(A=u.value)==null?void 0:A.exportPng()}),onToggleHistory:m[2]||(m[2]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",qS,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",XS,[n.createElementVNode("header",jS,[m[10]||(m[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",ZS,[(p=f.value)!=null&&p.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(y=f.value)!=null&&y.allExpanded?"모두 접기":"모두 펼치기",onClick:m[3]||(m[3]=_=>{var A;return(A=f.value)==null?void 0:A.toggleAll()})},[n.createVNode(Ve,{name:(b=f.value)!=null&&b.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,JS)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[4]||(m[4]=_=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Qu,{ref_key:"explorer",ref:f,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(l)}]),title:"너비 조절",onPointerdown:m[5]||(m[5]=(..._)=>n.unref(r)&&n.unref(r)(..._))},null,34),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:m[6]||(m[6]=_=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],512),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(l),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(Ju,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(tf,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[7]||(m[7]=_=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:"Inspector 열기",onClick:m[8]||(m[8]=_=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(YS,{controller:e.controller,open:i.value,onClose:m[9]||(m[9]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(pS,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1bc07cae"]]);ve.APPLY_MODEL_OPS_INPUT_SCHEMA=Am,ve.AssociationEdge=eu,ve.CUSTOM_TYPE_VALUE=zt,ve.CommandStack=Ia,ve.DEFAULT_JAVA_TYPE=ka,ve.DiagramCanvas=Ju,ve.DiagramExplorer=Qu,ve.EDITOR=pn,ve.EditModeToggle=$x,ve.EditorToolbar=ef,ve.EntityModeler=QS,ve.EntityNode=Ld,ve.GROUP_CODE_ENUM_VALUE=qn,ve.GroupNode=Pd,ve.JAVA_TYPES=wa,ve.NoteNode=zd,ve.OpSyncAdapter=ss,ve.PHYSICAL_NAME_MAX_LENGTH=va,ve.PropertyPanel=tf,ve.RevCache=rs,ve.SELECTABLE_JAVA_TYPES=dr,ve.SYMBOLIC_OP_KINDS=cs,ve.SYMBOLIC_OP_SCHEMA=ks,ve.anchoredEdgePoint=pa,ve.buildAgentBatch=Tm,ve.buildDiagramSvg=Kl,ve.buildOrthogonalPath=da,ve.buildSelfLoopPath=Jl,ve.buildStraightPath=fa,ve.commands=nm,ve.computeAutoLayout=Ql,ve.createEditorController=hk,ve.defaultMermaidDialect=uf,ve.displayLabel=Fo,ve.emptyState=Md,ve.entityModelToMermaid=ya,ve.entityModelToText=or,ve.estimateEntityHeight=tr,ve.exportDiagramPng=ju,ve.exportDiagramSvg=Xu,ve.fromPersisted=Km,ve.indexColumnsByModelId=Xn,ve.javaTypeLabel=En,ve.migrateLegacyMoney=Of,ve.newId=Oe,ve.orthogonalMidpoints=ua,ve.packEntityBoxes=df,ve.physicalNameWarning=Wo,ve.projectActionLog=br,ve.projectEntityAudit=yr,ve.projectFieldAudit=Ut,ve.rectExitPoint=ma,ve.renderDiagramSvg=sr,ve.resolveDiagram=jl,ve.resolveSharedColumn=Yo,ve.resolveSymbolicOps=Em,ve.restoreDeepEqual=vn,ve.segmentMidpoints=ha,ve.sideDir=Wn,ve.synthesizeRestoreOps=Kf,ve.toPersisted=rp,ve.toPersistedV2=sp,ve.validateModel=pr,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})}));
|
|
42
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(H=>{if(y.value){const ae=qt(y.value),v=me=>{if(me.sourceEvent.type!=="wheel"||!h.value||!m.value)return;const he=me.sourceEvent.ctrlKey&&wo()?10:1,se=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*e.zoomStep,ce=c.value.zoom*2**(se*he);m.value.scaleTo(h.value,ce)},q=me=>{if(me.sourceEvent.type!=="mousemove"||!h.value||!m.value)return;const he=F.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),se={x:c.value.x-me.sourceEvent.movementX*he,y:c.value.y-me.sourceEvent.movementY*he},ce=[[0,0],[u.value.width,u.value.height]],ye=Fl.translate(se.x,se.y).scale(c.value.zoom),ke=m.value.constrain()(ye,ce,d.value);m.value.transform(h.value,ke)},le=f$().wheelDelta(me=>ll(me)*(e.zoomStep/10)).on("zoom",e.pannable?q:()=>{}).on("zoom.wheel",e.zoomable?v:()=>{});ae.call(le),H(()=>{ae.on("zoom",null)})}},{flush:"post"});function L(H){const[ae,v]=Xt(H);t("click",{event:H,position:{x:ae,y:v}})}function oe(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeClick(v),t("nodeClick",v)}function k(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeDoubleClick(v),t("nodeDblclick",v)}function W(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseEnter(v),t("nodeMouseenter",v)}function R(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseMove(v),t("nodeMousemove",v)}function G(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseLeave(v),t("nodeMouseleave",v)}return(H,ae)=>(n.openBlock(),n.createBlock(n.unref(Id),{position:H.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:H.pannable,zoomable:H.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:y,width:b.value,height:_.value,viewBox:[ne.value.x,ne.value.y,ne.value.width,ne.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:L},[H.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(H.ariaLabel),9,g$)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(p),v=>(n.openBlock(),n.createBlock(h$,{id:v.id,key:v.id,f:"",position:v.computedPosition,dimensions:v.dimensions,selected:v.selected,dragging:v.dragging,style:n.normalizeStyle(v.style),class:n.normalizeClass(te.value(v)),color:g.value(v),"border-radius":H.nodeBorderRadius,"stroke-color":N.value(v),"stroke-width":H.nodeStrokeWidth,"shape-rendering":n.unref(A),type:v.type,hidden:v.hidden,onClick:q=>oe(q,v),onDblclick:q=>k(q,v),onMouseenter:q=>W(q,v),onMousemove:q=>R(q,v),onMouseleave:q=>G(q,v)},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:re.value,fill:H.maskColor,stroke:H.maskStrokeColor,"stroke-width":H.maskStrokeWidth,"fill-rule":"evenodd"},null,8,b$)],8,y$))]),_:1},8,["position","class"]))}}),w$=["d"],E$=["cx","cy","onDblclick"],v$=["x","y","onPointerdown","onDblclick"],N$=Ue(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Le(),i=n.inject(Nl),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((z,F)=>F===d.value?u.value:z)),{source:h,target:m,sourceSide:p,targetSide:y}=eu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),b=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?da(h.value,p.value,f.value,m.value,y.value):fa(h.value,f.value,m.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ua(h.value,p.value,f.value,m.value,y.value):ha(h.value,f.value,m.value).map((z,F)=>({point:z,segIndex:F})):[]),A=n.computed(()=>l.value?f.value:[]);function g(z,F){d.value=z,u.value={...c.value[z]},F.target.setPointerCapture(F.pointerId),F.stopPropagation()}function N(z){if(d.value<0)return;const F=o({x:z.clientX,y:z.clientY});u.value={x:F.x,y:F.y}}function te(z){var F,ne;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(ne=(F=z.target).releasePointerCapture)==null||ne.call(F,z.pointerId)}function S(z,F){F.stopPropagation(),i==null||i.removePoint(t.id,z)}function O(z,F){if(!i)return;const ne=o({x:F.clientX,y:F.clientY});i.insertPoint(t.id,z,{x:ne.x,y:ne.y})}return(z,F)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:b.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,w$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(ne,re)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${re}`,cx:ne.point.x,cy:ne.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(L=>O(ne.segIndex,L),["stop"])},null,42,E$))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(A.value,(ne,re)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${re}`,x:ne.x-5,y:ne.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:L=>g(re,L),onPointermove:N,onPointerup:te,onDblclick:L=>S(re,L)},null,42,v$))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),$$=["data-theme"],x$={key:0,class:"em-ctx__sep",role:"separator"},I$={key:1,class:"em-ctx__swatches"},S$={class:"em-ctx__swatches-label"},C$={class:"em-ctx__chips"},R$=["onClick"],V$=["title","onClick"],A$=["disabled","onClick"],T$={class:"em-ctx__icon"},M$={class:"em-ctx__caption"},B$=Ue(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),a=n.ref(void 0),l=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(m,p){var _;i.value=p,a.value=(_=m.target)!=null&&_.closest('[data-theme="dark"]')?"dark":void 0,r.x=m.clientX,r.y=m.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const y=l.value;if(!y)return;const b=y.getBoundingClientRect();r.x+b.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-b.width)),r.y+b.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-b.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(m){m.key==="Escape"&&(m.stopPropagation(),d())}function f(m){m.disabled||(m.handler(),d())}function h(m,p){m.onPick(p),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,p)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":a.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:l,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:p[0]||(p[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(y,b)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b},[y.type==="separator"?(n.openBlock(),n.createElementBlock("div",x$)):y.type==="swatches"?(n.openBlock(),n.createElementBlock("div",I$,[n.createElementVNode("span",S$,n.toDisplayString(y.caption),1),n.createElementVNode("div",C$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":y.current===null}]),title:"없음",onClick:_=>h(y,null)},null,10,R$),(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":y.current===_}]),style:n.normalizeStyle({background:n.unref(Ln)(_)}),title:n.unref(On)(_),onClick:A=>h(y,_)},null,14,V$))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":y.danger,"is-disabled":y.disabled}]),disabled:y.disabled,role:"menuitem",onClick:_=>f(y)},[n.createElementVNode("span",T$,[y.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:y.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",M$,n.toDisplayString(y.caption),1)],10,A$))],64))),128))],36)],8,$$)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Yl=[".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 D$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function O$(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const l=e.firstChild,r=a.getClientRects();if(!l||l.nodeType!==3||r.length<=1){const p=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(p.width===0&&p.height===0)return[];const y=t(p.left,p.top+p.height/2);return[{...i,x:y.x,y:y.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,h=0;const m=()=>{const p=d.trim();if(p){const y=t(f,(u+h)/2);c.push({...i,x:y.x,y:y.y,text:p})}d=""};for(let p=0;p<s.length;p++){a.setStart(l,p),a.setEnd(l,p+1);const y=a.getBoundingClientRect();u===null||Math.abs(y.top-u)>1?(m(),u=y.top,f=y.left,h=y.bottom,d=s[p]):(d+=s[p],h=Math.max(h,y.bottom))}return m(),c}function ra(e,t){const o=[];for(const i of e.querySelectorAll("*"))D$(i)&&(i.closest(Yl)||Yn(i)&&o.push(...O$(i,t)));return o}function To(e){return Math.round(e*100)/100}function L$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Yl)||!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 P$(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 qu(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Yl)||!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 Wl(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 z$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,p)=>e.screenToFlowCoordinate({x:m,y:p}),i=[],a=[],l=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const p=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!p||!Yn(p))continue;const y=p.firstElementChild;if(y)if(m.type==="group"){const b=Mo(y,o);Wl(s,b),i.push({...b,texts:[]});const _=y.querySelector(".em-group__label");_&&i.push({...Mo(_,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ra(y,o)})}else if(m.type==="note"){const b={...Mo(y,o),texts:ra(y,o),lines:qu(y,y,o)};Wl(s,b),l.push(b)}else{const b=Mo(y,o);Wl(s,b);const _=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const A=y.querySelector(".em-entity__header");if(A){const g=Mo(A,o);a.push({x:b.x,y:b.y,w:b.w,h:g.y+g.h-b.y,fill:g.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ra(y,o),lines:qu(y,y,o),icons:L$(y,o)}),a.push({...b,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const p=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!p||!Yn(p))continue;const y=p.getAttribute("d");if(!y)continue;const b=getComputedStyle(p),_=b.strokeDasharray,A=P$(m);r.push({d:y,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:ra(m,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 Kl(e){return sr(z$(e))}function Xu(e,t){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function ju(e,t="diagram.svg"){const o=Kl(e);Xu(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function U$(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 Zu(e,t="diagram.png",o=2){const i=Kl(e),{w:a,h:l}=U$(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 변환 실패");Xu(u,t)}finally{URL.revokeObjectURL(r)}}const H$={class:"em-shortcuts"},F$={class:"em-shortcuts__title"},G$={class:"em-shortcuts__keys"},Y$={class:"em-shortcuts__kbd"},W$={key:0,class:"em-shortcuts__plus"},K$={class:"em-shortcuts__desc"},q$={class:"em-shortcuts__actions"},Ju=Ue(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ie.useModalHandle(),i=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",a=[{title:"편집",items:[{keys:[i,"Z"],desc:"실행 취소"},{keys:[i,"Shift","Z"],desc:"다시 실행"},{keys:[i,"C"],desc:"선택 복사"},{keys:[i,"V"],desc:"붙여넣기"},{keys:["Delete"],desc:"선택 항목 삭제 (Backspace 동일)"}]},{title:"이동 · 정렬",items:[{keys:["←","↑","→","↓"],desc:"선택 노드 1px 이동"},{keys:["Shift","방향키"],desc:"선택 노드 10px 이동"},{keys:["↑","↓"],desc:"속성 선택 시 포커스 이동"},{keys:["Alt","↑","↓"],desc:"속성 순서 위/아래로"}]},{title:"기타",items:[{keys:["우클릭"],desc:"컨텍스트 메뉴 (엔티티·노트 추가 등)"},{keys:["Enter"],desc:"인라인 편집 확정"},{keys:["Esc"],desc:"편집·메뉴 닫기"},{keys:["?"],desc:"이 도움말 열기"}]}];return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",H$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",F$,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",G$,[(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",Y$,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",W$,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",K$,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",q$,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function X$(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const j$={key:0,class:"em-canvas__empty","aria-hidden":"true"},Z$={key:1,class:"em-canvas__empty-title"},J$={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},Q$={class:"em-conflict-banner__body"},ex={class:"em-conflict-banner__title"},tx={class:"em-conflict-banner__detail"},nx={key:0,class:"em-toast",role:"status","aria-live":"polite"},ql="nc:",Qu=Ue(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,x=>{x&&(l.value=x.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>X$(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f(x){u.x=x.clientX,u.y=x.clientY}const h=n.ref(null);n.provide(Ui,h);const m=n.ref(null);n.provide(Ld,m);const p=n.ref(null),y=n.computed(()=>{const x=p.value,D=new Set;if(!x)return D;if(x.kind==="entity")D.add(x.id);else if(x.kind==="group"){const $=i.resolved.value.groups.find(U=>U.group.modelId===x.id);for(const U of($==null?void 0:$.group.memberEntityRefs)??[])D.add(U)}return D}),b=n.computed(()=>{const x=p.value,D=new Set(y.value),$=new Set,U=new Set;if(!x)return{related:D,edges:$,notes:U};if(x.kind==="note"){U.add(x.id);for(const ee of i.resolved.value.noteConnections)ee.noteRef===x.id&&D.add(ee.targetRef);return{related:D,edges:$,notes:U}}const P=y.value;if(!P.size)return{related:D,edges:$,notes:U};for(const ee of i.resolved.value.associations){const{end1:fe,end2:Ie}=ee.association;(P.has(fe.entityRef)||P.has(Ie.entityRef))&&($.add(ee.association.modelId),D.add(fe.entityRef),D.add(Ie.entityRef))}for(const ee of i.resolved.value.noteConnections)D.has(ee.targetRef)&&U.add(ee.noteRef);return{related:D,edges:$,notes:U}});n.provide(Un,{source:p,active:n.computed(()=>p.value!==null),primaryEntityIds:y,relatedEntityIds:n.computed(()=>b.value.related),relatedEdgeIds:n.computed(()=>b.value.edges),relatedNoteIds:n.computed(()=>b.value.notes),hoverGroupId:n.computed(()=>{var x;return((x=p.value)==null?void 0:x.kind)==="group"?p.value.id:null}),setEntityHover:x=>{m.value||d.value||(p.value=x?{kind:"entity",id:x}:null)},setGroupHover:x=>{m.value||d.value||(p.value=x?{kind:"group",id:x}:null)},setNoteHover:x=>{m.value||d.value||(p.value=x?{kind:"note",id:x}:null)}}),n.provide(pn,i);function _(x,D){return`${ql}${x}:${D}`}function A(x){if(!x.startsWith(ql))return null;const[D,$]=x.slice(ql.length).split(":");return D&&$?{noteRef:D,targetRef:$}:null}n.provide(Nl,{points:x=>{var $,U;const D=A(x);return D?(($=i.resolved.value.noteConnections.find(P=>P.noteRef===D.noteRef&&P.targetRef===D.targetRef))==null?void 0:$.waypoints)??[]:((U=i.resolved.value.associations.find(P=>P.association.modelId===x))==null?void 0:U.waypoints)??[]},movePoint:(x,D,$)=>{const U=A(x);U?i.moveNoteConnectionWaypoint(U.noteRef,U.targetRef,D,$):i.moveWaypoint(x,D,$)},insertPoint:(x,D,$)=>{const U=A(x);U?i.addNoteConnectionWaypoint(U.noteRef,U.targetRef,D,$):i.addWaypoint(x,D,$)},removePoint:(x,D)=>{const $=A(x);$?i.removeNoteConnectionWaypoint($.noteRef,$.targetRef,D):i.removeWaypoint(x,D)}});const g=Le(),{nodes:N,edges:te,findNode:S,findEdge:O,addNodes:z,addEdges:F,removeNodes:ne,removeEdges:re,fitView:L,setCenter:oe,getViewport:k,screenToFlowCoordinate:W,getSelectedNodes:R,updateNodeInternals:G}=g,H=n.ref(!1);async function ae(x){H.value=!0,await n.nextTick(),await new Promise(D=>requestAnimationFrame(()=>D(null)));try{return await x()}finally{H.value=!1}}function v(){return ae(()=>ju(g))}function q(){return ae(()=>Zu(g))}t({exportSvg:v,exportPng:q});const le=n.computed(()=>i.resolved.value.entities.length===0);function me(){const x=k(),{width:D,height:$}=g.dimensions.value;return{x:(D/2-x.x)/x.zoom,y:($/2-x.y)/x.zoom}}function he(){const x=me();i.addEntity("NewEntity",{x:x.x,y:x.y})}function se(){const x=me();i.addNote("메모",{x:x.x,y:x.y})}function ce(x){for(const D of i.resolved.value.groups){const{location:$,size:U}=D.geo;if(x.x>=$.x&&x.x<=$.x+U.width&&x.y>=$.y&&x.y<=$.y+U.height)return D.group.modelId}return null}function ye(){const x=i.resolved.value,D=new Map(x.groups.map(fe=>[fe.group.modelId,fe.geo])),$=new Set(x.groups.map(fe=>fe.group.modelId)),U=new Set([...$,...x.entities.map(fe=>fe.entity.modelId),...x.notes.map(fe=>fe.note.modelId)]);for(const fe of[...N.value])U.has(fe.id)||ne([fe.id]);for(const fe of x.groups){const Ie=fe.group.modelId,Be={width:`${fe.geo.size.width}px`,height:`${fe.geo.size.height}px`},Me={group:fe.group,style:fe.style,locked:fe.locked},Ke=fe.locked?!1:void 0,Ge=S(Ie);Ge?(Ge.position={...fe.geo.location},Ge.data=Me,Ge.style=Be,Ge.draggable=Ke):z([{id:Ie,type:"group",position:{...fe.geo.location},draggable:Ke,style:Be,data:Me}])}for(const fe of x.entities){const Ie=fe.entity.modelId,Be=fe.groupRef&&$.has(fe.groupRef)?fe.groupRef:void 0,Me={entity:fe.entity,displayMode:i.displayMode.value,collapsed:fe.collapsed,locked:fe.locked,groupRef:Be,size:fe.geo.size,style:fe.style,attributeStyles:fe.attributeStyles,operationStyles:fe.operationStyles},Ke=fe.locked?!1:void 0,Ge=Be?D.get(Be):void 0,Qe=Ge?{x:fe.geo.location.x-Ge.location.x,y:fe.geo.location.y-Ge.location.y}:{...fe.geo.location},Ye=S(Ie);Ye?(Ye.position=Qe,Ye.data=Me,Ye.parentNode=Be,Ye.draggable=Ke):z([{id:Ie,type:"entity",position:Qe,parentNode:Be,draggable:Ke,data:Me}])}for(const fe of x.notes){const Ie=fe.note,Be=Ie.modelId,Me=fe.groupRef&&$.has(fe.groupRef)?fe.groupRef:void 0,Ke={note:Ie,groupRef:Me},Ge={width:`${Ie.geo.size.width}px`,height:`${Ie.geo.size.height}px`},Qe=Me?D.get(Me):void 0,Ye=Qe?{x:Ie.geo.location.x-Qe.location.x,y:Ie.geo.location.y-Qe.location.y}:{...Ie.geo.location},Pe=S(Be);Pe?(Pe.position=Ye,Pe.data=Ke,Pe.style=Ge,Pe.parentNode=Me):z([{id:Be,type:"note",position:Ye,parentNode:Me,style:Ge,data:Ke}])}const P=new Map(x.associations.map(fe=>[fe.association.modelId,fe])),ee=new Set(x.noteConnections.map(fe=>_(fe.noteRef,fe.targetRef)));for(const fe of[...te.value])!P.has(fe.id)&&!ee.has(fe.id)&&re([fe.id]);for(const[fe,Ie]of P){const Be={id:fe,type:"association",source:Ie.association.end1.entityRef,target:Ie.association.end2.entityRef,sourceHandle:Ie.sourceColumnRef?`r:${Ie.sourceColumnRef}`:void 0,targetHandle:Ie.targetColumnRef?`l:${Ie.targetColumnRef}`:void 0,data:{association:Ie.association,sourceColumnRef:Ie.sourceColumnRef,targetColumnRef:Ie.targetColumnRef}},Me=O(fe);Me?(Me.data=Be.data,Me.sourceHandle=Be.sourceHandle,Me.targetHandle=Be.targetHandle):F([Be])}for(const fe of x.noteConnections){const Ie=_(fe.noteRef,fe.targetRef),Be={noteRef:fe.noteRef,targetRef:fe.targetRef},Me=O(Ie);Me?Me.data=Be:F([{id:Ie,type:"note-connection",source:fe.noteRef,target:fe.targetRef,data:Be}])}ke()}function ke(){n.nextTick(()=>requestAnimationFrame(()=>G()))}function Re(){const x=R.value.map($=>$.id);if(x.length)return x;const D=i.selection.value;return D&&(D.kind==="entity"||D.kind==="note"||D.kind==="group")?[D.id]:[]}function xe(x){var P;const D=x.target;if(D&&(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable))return;if(x.key==="?"){a.openModal({component:Ju}),x.preventDefault();return}if(!i.editable.value){(x.metaKey||x.ctrlKey)&&x.key.toLowerCase()==="c"&&(i.copy(),x.preventDefault());return}if(x.key==="Delete"||x.key==="Backspace"){i.deleteSelection()&&x.preventDefault();return}if(x.key==="ArrowUp"||x.key==="ArrowDown"||x.key==="ArrowLeft"||x.key==="ArrowRight"){if(((P=i.selection.value)==null?void 0:P.kind)==="attribute"){if(x.key==="ArrowUp"||x.key==="ArrowDown"){const Be=x.key==="ArrowDown"?1:-1;(x.altKey?i.nudgeSelectedAttributes(Be):i.moveAttributeFocus(Be))&&x.preventDefault()}return}const ee=x.shiftKey?10:1,fe=x.key==="ArrowLeft"?-ee:x.key==="ArrowRight"?ee:0,Ie=x.key==="ArrowUp"?-ee:x.key==="ArrowDown"?ee:0;i.nudgeNodes(Re(),fe,Ie)&&x.preventDefault();return}if(!(x.metaKey||x.ctrlKey))return;const U=x.key.toLowerCase();U==="c"?(i.copy(),x.preventDefault()):U==="v"?(i.paste(),x.preventDefault()):U==="z"&&(x.shiftKey?i.redo():i.undo(),x.preventDefault())}n.onMounted(async()=>{ye(),await n.nextTick(),L(),window.addEventListener("keydown",xe),window.addEventListener("pointerup",pe),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",xe),window.removeEventListener("pointerup",pe),window.removeEventListener("pointermove",f)});function pe(){h.value=null}function X(){d.value=!0,p.value=null}function K(){var U;d.value=!1;const x=(U=document.elementFromPoint(u.x,u.y))==null?void 0:U.closest(".vue-flow__node"),D=x==null?void 0:x.dataset.id;if(!D){p.value=null;return}const $=x.classList.contains("vue-flow__node-group")?"group":x.classList.contains("vue-flow__node-note")?"note":"entity";p.value={kind:$,id:D}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ye),n.watch(()=>i.revision.value,ke),n.watch(()=>i.resolved.value,x=>{const D=p.value;if(!D)return;(D.kind==="entity"?x.entities.some(U=>U.entity.modelId===D.id):D.kind==="group"?x.groups.some(U=>U.group.modelId===D.id):x.notes.some(U=>U.note.modelId===D.id))||(p.value=null)});function w(x){const D=x.computedPosition??x.position,$=x.dimensions??{width:0,height:0};return{x:D.x+$.width/2,y:D.y+$.height/2}}function C(x){const D=x.node;if(D){if(p.value=null,D.type==="group"){const $=i.resolved.value.groups.find(U=>U.group.modelId===D.id);m.value=$?{groupId:D.id,dx:D.position.x-$.geo.location.x,dy:D.position.y-$.geo.location.y}:null,h.value=null;return}if(D.type!=="entity"&&D.type!=="note"){h.value=null;return}h.value=ce(w(D))}}function V(x){var U;h.value=null,m.value=null;const D=(U=x.nodes)!=null&&U.length?x.nodes:[x.node],$=D.filter(P=>(P==null?void 0:P.type)==="group");if($.length){for(const P of $){if(!P)continue;const ee=i.resolved.value.entities.filter(fe=>fe.groupRef===P.id).map(fe=>{const Ie=S(fe.entity.modelId),Be=(Ie==null?void 0:Ie.computedPosition)??(Ie==null?void 0:Ie.position)??{x:0,y:0};return{id:fe.entity.modelId,location:{x:Be.x,y:Be.y}}});i.dragGroup(P.id,{x:P.position.x,y:P.position.y},ee)}return}for(const P of D){if(!P||P.type==="group")continue;const ee=P.computedPosition??P.position,fe=P.dimensions??{width:0,height:0},Ie={x:ee.x+fe.width/2,y:ee.y+fe.height/2};P.type==="note"?i.dropNote(P.id,{x:ee.x,y:ee.y},ce(Ie)):i.dropEntity(P.id,{x:ee.x,y:ee.y},ce(Ie))}}function Y(x){var Be,Me,Ke,Ge,Qe;if(!i.editable.value||!x.source||!x.target)return;const D=((Be=S(x.source))==null?void 0:Be.type)==="note",$=((Me=S(x.target))==null?void 0:Me.type)==="note";if(D||$){if(D&&$)return;const Ye=D?x.source:x.target,Pe=D?x.target:x.source;((Ke=S(Pe))==null?void 0:Ke.type)==="entity"&&i.addNoteConnection(Ye,Pe);return}const U=Ye=>{var Pe;return(Pe=i.state.logical.entities.find(_n=>_n.modelId===Ye))==null?void 0:Pe.stereotype},P=U(x.source)==="JPA_EMBEDDABLE",ee=U(x.target)==="JPA_EMBEDDABLE";if(P||ee){if(P&&ee)return;const Ye=P?x.source:x.target,Pe=P?x.target:x.source;i.addEmbedAssociation(Pe,Ye);return}const fe=(Ge=x.sourceHandle)!=null&&Ge.startsWith("r:")?x.sourceHandle.slice(2):void 0,Ie=(Qe=x.targetHandle)!=null&&Qe.startsWith("l:")?x.targetHandle.slice(2):void 0;i.addAssociation(x.source,x.target,fe,Ie)}const J=n.ref(null);function ge(x,D){var U;const $=i.state.layout.entityLayouts.find(P=>P.entityRef===x);return it((U=$==null?void 0:$.attributeStyles)==null?void 0:U[D])}function we(x,D){var U;const $=i.state.layout.entityLayouts.find(P=>P.entityRef===x);return it((U=$==null?void 0:$.operationStyles)==null?void 0:U[D])}function Ne(x){var D;return it((D=i.state.layout.groupLayouts.find($=>$.groupRef===x))==null?void 0:D.style)}function _e(x){var D;return it((D=i.state.layout.notes.find($=>$.modelId===x))==null?void 0:D.style)}function Ce(x){var U,P;if(x.preventDefault(),!i.editable.value)return;const D=()=>W({x:x.clientX,y:x.clientY}),$=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const ee=D();i.addEntity("NewEntity",{x:ee.x,y:ee.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const ee=D();i.addNote("메모",{x:ee.x,y:ee.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const ee=D();i.addEmptyGroup({x:ee.x,y:ee.y})}}];((U=i.clipboard.value)==null?void 0:U.kind)==="entity"&&$.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&$.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(P=J.value)==null||P.open(x,$)}function Te({event:x,node:D}){var Be,Me,Ke,Ge,Qe,Ye,Pe,_n,Ee,et,Bo,Do,Oo,Lo,Po,zo,Uo,rt;const $=x;if($.preventDefault(),!i.editable.value){if(D.type==="group"||D.type==="note")return;const ze=(Me=(Be=$.target)==null?void 0:Be.closest("[data-attr]"))==null?void 0:Me.dataset.attr;if(ze){const je=i.selection.value;(je==null?void 0:je.kind)==="attribute"&&je.entityId===D.id&&je.ids.includes(ze)||i.selectAttribute(D.id,ze);const kn=((Ke=i.selection.value)==null?void 0:Ke.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[ze];(Ge=J.value)==null||Ge.open($,[{caption:kn.length>1?`복사 (${kn.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Qe=J.value)==null||Qe.open($,[{caption:"상세 편집…",icon:"pencil",handler:()=>Pi(a,i,D.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}]);return}if(D.type==="group"){const ze=i.isGroupLocked(D.id),je=[];ze||je.push({type:"swatches",caption:"색상",current:Ne(D.id),onPick:nt=>i.setGroupSwatch(D.id,nt)},{type:"separator"}),je.push({caption:ze?"잠금 해제":"잠금",icon:ze?"unlock":"lock",handler:()=>i.setGroupLocked(D.id,!ze)}),ze||je.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(D.id)}),(Ye=J.value)==null||Ye.open($,je);return}if(D.type==="note"){(Pe=J.value)==null||Pe.open($,[{type:"swatches",caption:"색상",current:_e(D.id),onPick:ze=>i.setNoteSwatch(D.id,ze)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(D.id)}]);return}const U=(Ee=(_n=$.target)==null?void 0:_n.closest("[data-attr]"))==null?void 0:Ee.dataset.attr;if(U){const ze=i.selection.value;(ze==null?void 0:ze.kind)==="attribute"&&ze.entityId===D.id&&ze.ids.includes(U)||i.selectAttribute(D.id,U);const nt=((et=i.selection.value)==null?void 0:et.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[U];if(i.isEntityLocked(D.id)){(Bo=J.value)==null||Bo.open($,[{caption:nt.length>1?`복사 (${nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const kn=nt.length>1,Xl=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{type:"swatches",caption:kn?`색상 (${nt.length})`:"색상",current:kn?null:ge(D.id,U),onPick:tC=>i.setAttributeSwatches(D.id,nt,tC)},{type:"separator"},{caption:kn?`복사 (${nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Ho=i.clipboard.value;(Ho==null?void 0:Ho.kind)==="attribute"&&Xl.push({caption:Ho.attributes.length>1?`속성 붙여넣기 (${Ho.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Xl.push({type:"separator"},{caption:kn?`속성 삭제 (${nt.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(D.id,nt)}),(Do=J.value)==null||Do.open($,Xl);return}const P=(Lo=(Oo=$.target)==null?void 0:Oo.closest("[data-op]"))==null?void 0:Lo.dataset.op;if(P){if(i.isEntityLocked(D.id))return;(Po=J.value)==null||Po.open($,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(D.id)},{type:"swatches",caption:"색상",current:we(D.id,P),onPick:ze=>i.setOperationSwatch(D.id,P,ze)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(D.id,P)}]);return}const ee=i.resolved.value.entities.find(ze=>ze.entity.modelId===D.id),fe=!!(ee!=null&&ee.locked),Ie=[{caption:fe?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>Pi(a,i,D.id)}];if(!fe){Ie.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(D.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const je=R.value.filter(nt=>nt.type==="entity").map(nt=>nt.id);i.createGroup(je.includes(D.id)&&je.length?je:[D.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(D.id,D.id)});const ze=i.embeddableCatalog.value;if(ze.length){Ie.push({type:"separator"});for(const je of ze){const nt=((zo=je.label)==null?void 0:zo.ko)??((Uo=je.label)==null?void 0:Uo.en)??je.type;Ie.push({caption:`임베더블 추가: ${nt}`,icon:"link",handler:()=>i.addPredefinedEmbed(D.id,je.type)})}}}if(Ie.push({type:"separator"}),Ie.push({caption:ee!=null&&ee.collapsed?"펼치기":"접기",icon:ee!=null&&ee.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(D.id,!(ee!=null&&ee.collapsed))}),ee!=null&&ee.groupRef&&!fe&&Ie.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(D.id)}),Ie.push({caption:fe?"잠금 해제":"잠금",icon:fe?"unlock":"lock",handler:()=>i.setEntityLocked(D.id,!fe)}),Ie.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}),!fe){const ze=i.clipboard.value;(ze==null?void 0:ze.kind)==="attribute"&&Ie.push({caption:ze.attributes.length>1?`속성 붙여넣기 (${ze.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Ie.push({type:"separator"}),Ie.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(D.id)})}(rt=J.value)==null||rt.open($,Ie)}function De({event:x,edge:D}){var P,ee;const $=x;if($.preventDefault(),!i.editable.value)return;const U=A(D.id);if(U){(P=J.value)==null||P.open($,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(U.noteRef,U.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(U.noteRef,U.targetRef)}]);return}(ee=J.value)==null||ee.open($,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(D.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(D.id)}])}function E(x){return x==="group"?"group":x==="note"?"note":"entity"}function T({node:x}){if(R.value.length>1){i.selection.value=null;return}i.selection.value={kind:E(x.type),id:x.id}}function I({nodes:x}){x.length>1&&(i.selection.value=null)}function M({edge:x}){const D=A(x.id);i.selection.value=D?{kind:"note",id:D.noteRef}:{kind:"association",id:x.id}}function B(x){const D=i.selection.value;return!!D&&D.kind!=="attribute"&&D.id===x.id}function de(x){var D,$;return B(x)?x.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":x.type==="note"?"var(--em-note-soft)":x.type==="group"?Cd(it((D=x.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":Cd(it(($=x.data)==null?void 0:$.style))??"var(--em-mm-entity)"}function be(x){return B(x)?"var(--em-selection)":x.type==="note"?"var(--em-note-accent)":x.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function Q(x,D){oe(x,D,{zoom:k().zoom,duration:350})}n.watch(()=>i.focusRequest.value,x=>{if(!x)return;const D=S(x.id);if(!D)return;const $=D.computedPosition??D.position,U=D.dimensions??{width:0,height:0};Q($.x+U.width/2,$.y+U.height/2)});function Z({position:x}){Q(x.x,x.y)}function j({node:x}){i.selection.value={kind:E(x.type),id:x.id};const D=x.computedPosition??x.position,$=x.dimensions??{width:0,height:0};Q(D.x+$.width/2,D.y+$.height/2)}function ue({node:x}){L({nodes:[x.id],duration:350,maxZoom:1.2,padding:.6})}return(x,D)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(r1),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!H.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(Bt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:X,onMoveEnd:K,onConnect:Y,onConnectStart:D[1]||(D[1]=$=>c.value=!0),onConnectEnd:D[2]||(D[2]=$=>c.value=!1),onNodeDrag:C,onNodeDragStop:V,onNodeClick:T,onEdgeClick:M,onSelectionChange:I,onPaneClick:D[3]||(D[3]=$=>n.unref(i).selection.value=null),onPaneContextMenu:Ce,onNodeContextMenu:Te,onEdgeContextMenu:De},{"node-group":n.withCtx($=>[n.createVNode(zd,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"node-entity":n.withCtx($=>[n.createVNode(Pd,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"node-note":n.withCtx($=>[n.createVNode(Ud,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"edge-association":n.withCtx($=>[n.createVNode(tu,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"edge-note-connection":n.withCtx($=>[n.createVNode(N$,n.normalizeProps(n.guardReactiveProps($)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(fw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Lw),{"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:he},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"노트 추가",onClick:se},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"자동 배치",onClick:D[0]||(D[0]=$=>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(k$),{key:1,pannable:"",width:224,height:160,"node-color":de,"node-stroke-color":be,"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:Z,onNodeClick:j,onNodeDblclick:ue})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),le.value?(n.openBlock(),n.createElementBlock("div",j$,[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",Z$,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",J$,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",Q$,[n.createElementVNode("strong",ex,n.toDisplayString(s.value.title),1),n.createElementVNode("span",tx,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(B$,{ref_key:"menuRef",ref:J},null,512),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",nx,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function sa(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function ox(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 ix={class:"em-explorer em-scroll-overlay"},ax={class:"em-explorer__search"},lx={key:0,class:"em-explorer__empty"},rx={class:"em-explorer__rows"},sx=["data-key","onClick","onDblclick"],cx=["onClick"],dx=["title"],ux={class:"em-key-slot"},fx={class:"em-key-slot"},mx={class:"em-explorer__label"},ef=Ue(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.computed(()=>{var ae;const S=i.resolved.value,O=i.displayMode.value,z=v=>{var q,le,me;return Fo(O,v.name,(le=(q=v.table)==null?void 0:q.logicalName)==null?void 0:le.ko,(me=v.table)==null?void 0:me.physicalName)},F=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",ne=v=>{const q=v.attrType.startsWith("RELATION")&&v.dbAttrs.length>0;return{icon:v.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:v.identifier,fk:q&&F}}},re=v=>v.attrType.startsWith("EMBED")&&v.dbAttrs.length>0,L=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",oe=v=>{if(v.attrType!=="EMBED_PREDEF")return v.dbAttrs;const q=i.embeddableCatalog.value.find(le=>le.type===v.type);return q?v.dbAttrs.map((le,me)=>{const he=q.fields[me];return he?{...le,physicalName:le.physicalName||he.physicalName,logicalName:le.logicalName??he.logicalName,dataType:le.dataType||he.dataType,length:le.length??he.length}:le}):v.dbAttrs},k=(v,q)=>{var se,ce,ye,ke,Re,xe,pe,X,K;const le={entityId:q,attrId:v.modelId};if(re(v)){const w=Ea(O,v);return{key:`attr:${v.modelId}`,label:v.name+(w?` : ${w}`:""),icon:"table",attrRef:le,focusId:q,matchText:sa(v.name,(ce=(se=v.dbAttrs[0])==null?void 0:se.logicalName)==null?void 0:ce.ko,(ye=v.dbAttrs[0])==null?void 0:ye.physicalName),children:L?oe(v).map(C=>{var V,Y;return{key:`attr:${v.modelId}:col:${C.modelId}`,label:Fo(O,C.physicalName,(V=C.logicalName)==null?void 0:V.ko,C.physicalName)+(C.dataType?` : ${C.dataType}`:""),icon:"field",attrRef:le,focusId:q,matchText:sa(C.physicalName,(Y=C.logicalName)==null?void 0:Y.ko),children:[]}}):[]}}const me=fr(v,i.state.logical.associations),he=Ea(O,v,me);return{key:`attr:${v.modelId}`,label:Fo(O,v.name,(Re=(ke=v.dbAttrs[0])==null?void 0:ke.logicalName)==null?void 0:Re.ko,(xe=v.dbAttrs[0])==null?void 0:xe.physicalName)+(he?` : ${he}`:""),...ne(v),attrRef:le,focusId:q,matchText:sa(v.name,(X=(pe=v.dbAttrs[0])==null?void 0:pe.logicalName)==null?void 0:X.ko,(K=v.dbAttrs[0])==null?void 0:K.physicalName),children:[]}},W=v=>{var me,he,se;const q=v.entity,le=[...q.attributes].sort((ce,ye)=>ce.order-ye.order);return{key:`entity:${q.modelId}`,label:z(q),icon:"table",selectKind:"entity",selectId:q.modelId,focusId:q.modelId,matchText:sa(q.name,(he=(me=q.table)==null?void 0:me.logicalName)==null?void 0:he.ko,(se=q.table)==null?void 0:se.physicalName),children:le.map(ce=>k(ce,q.modelId))}},R=new Map,G=[];for(const v of S.entities)if(v.groupRef){const q=R.get(v.groupRef)??[];q.push(v),R.set(v.groupRef,q)}else G.push(v);const H=[];for(const v of S.groups){const q=v.group;H.push({key:`group:${q.modelId}`,label:((ae=q.name)==null?void 0:ae.ko)||q.packageName||"(그룹)",icon:"folder",focusId:q.modelId,children:(R.get(q.modelId)??[]).map(W)})}for(const v of G)H.push(W(v));if(S.associations.length){const v=new Map(S.entities.map(q=>[q.entity.modelId,z(q.entity)]));H.push({key:"section:associations",label:`관계 (${S.associations.length})`,icon:"arrow-lr",children:S.associations.map(q=>{const le=q.association,me=v.get(le.end1.entityRef)??le.end1.entityRef,he=v.get(le.end2.entityRef)??le.end2.entityRef;return{key:`assoc:${le.modelId}`,label:`${me} — ${he}`,icon:"arrow-lr",selectKind:"association",selectId:le.modelId,children:[]}})})}return S.notes.length&&H.push({key:"section:notes",label:`노트 (${S.notes.length})`,icon:"note",children:S.notes.map(({note:v})=>{var q;return{key:`note:${v.modelId}`,label:((q=v.memo.split(`
|
|
43
|
+
`)[0])==null?void 0:q.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:v.modelId,focusId:v.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:H}});function r(S){return S?S.pk&&S.fk?"PFK (식별 외래키)":S.pk?"PK (기본키)":S.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(S){const O=new Set(s.value);O.has(S)?O.delete(S):O.add(S),s.value=O}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),h=n.computed(()=>{const S=[];if(f.value){const z=ox(l.value,d.value.trim().toLowerCase()),F=(ne,re)=>{if(z.has(ne.key)){S.push({node:ne,depth:re});for(const L of ne.children)F(L,re+1)}};return F(l.value,0),S}const O=(z,F)=>{if(S.push({node:z,depth:F}),!s.value.has(z.key))for(const ne of z.children)O(ne,F+1)};return O(l.value,0),S}),m=n.computed(()=>f.value&&h.value.length<=1);function p(S){var F;if(S.key!=="/"||S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;const O=S.target,z=O==null?void 0:O.tagName;z==="INPUT"||z==="TEXTAREA"||z==="SELECT"||O!=null&&O.isContentEditable||(S.preventDefault(),(F=u.value)==null||F.focus())}n.onMounted(()=>window.addEventListener("keydown",p)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",p));const y=n.computed(()=>{const S=[],O=z=>{if(z.children.length){z.key!=="root"&&S.push(z.key);for(const F of z.children)O(F)}};return O(l.value),S}),b=n.computed(()=>!y.value.some(S=>s.value.has(S)));function _(){s.value=b.value?new Set(y.value):new Set}t({toggleAll:_,allExpanded:b,hasExpandable:n.computed(()=>y.value.length>0)});function A(S){const O=i.selection.value;return S.attrRef?(O==null?void 0:O.kind)==="attribute"&&O.entityId===S.attrRef.entityId&&O.ids.includes(S.attrRef.attrId):!!O&&O.kind!=="attribute"&&!!S.selectId&&S.selectKind===O.kind&&S.selectId===O.id}function g(S){const O=i.selection.value;return S.selectKind==="entity"&&(O==null?void 0:O.kind)==="attribute"&&O.entityId===S.selectId}function N(S,O){if(S.attrRef){const z=O.shiftKey?"range":O.metaKey||O.ctrlKey?"toggle":"replace";i.selectAttribute(S.attrRef.entityId,S.attrRef.attrId,z)}else S.selectKind&&S.selectId&&(i.selection.value={kind:S.selectKind,id:S.selectId});S.focusId&&i.requestFocus(S.focusId)}function te(S){S.selectKind==="entity"&&S.selectId&&Pi(a,i,S.selectId)}return(S,O)=>(n.openBlock(),n.createElementBlock("section",ix,[n.createElementVNode("div",ax,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":O[0]||(O[0]=z=>d.value=z),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:O[1]||(O[1]=n.withKeys(z=>d.value="",["esc"]))},null,544),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":"검색어 지우기",title:"지우기 (Esc)",onClick:O[2]||(O[2]=z=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("p",lx,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",rx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,({node:z,depth:F})=>(n.openBlock(),n.createElementBlock("div",{key:z.key,class:n.normalizeClass(["em-explorer__row",{"is-active":A(z),"is-focus-parent":g(z),"is-selectable":!!z.selectKind||!!z.attrRef||!!z.focusId}]),"data-key":z.key,style:n.normalizeStyle({paddingLeft:4+F*14+"px"}),onClick:ne=>N(z,ne),onDblclick:ne=>te(z)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!z.children.length,"is-open":!s.value.has(z.key)}]),onClick:n.withModifiers(ne=>z.children.length&&c(z.key),["stop"])},[z.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,cx),z.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(z.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",ux,[z.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):z.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:z.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",fx,[z.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,dx)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:z.icon,size:15},null,8,["name"])),n.createElementVNode("span",mx,n.toDisplayString(z.label),1)],46,sx))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),px={class:"em-text-export"},hx={key:0,class:"em-text-export__tabs",role:"tablist"},yx=["aria-selected","onClick"],gx={class:"em-text-export__pre"},bx={class:"em-text-export__actions"},_x=Ue(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(0);function a(){return t.formats[i.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(a().content),ie.showNotification("클립보드에 복사되었습니다.","info")}catch{ie.showNotification("복사에 실패했습니다.","error")}}function r(){const s=a(),c=new Blob([s.content],{type:"text/plain;charset=utf-8"}),d=URL.createObjectURL(c);try{const u=document.createElement("a");u.href=d,u.download=s.filename,document.body.appendChild(u),u.click(),u.remove()}finally{URL.revokeObjectURL(d)}}return(s,c)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",px,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",hx,[(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,yx))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",gx,n.toDisplayString(a().content),1),n.createElementVNode("div",bx,[n.createVNode(n.unref(ie.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ie.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),kx={class:"em-toolbar"},wx={class:"em-toolbar__mode"},tf=Ue(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ie.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:m=>i.displayMode.value=m});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(p=>p.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){const m=i.state.logical;l.openModal({component:_x,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:or(m),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:ya(m,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:ya(m,"class"),filename:"diagram.class.mmd"}]}})}function h(){l.openModal({component:Ju})}return(m,p)=>(n.openBlock(),n.createElementBlock("div",kx,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:p[0]||(p[0]=y=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:p[1]||(p[1]=y=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),p[10]||(p[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",wx,[p[8]||(p[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:s.value,"onUpdate:modelValue":p[2]||(p[2]=y=>s.value=y),items:r,"value-provider":y=>y.v,"label-provider":y=>y.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:p[3]||(p[3]=y=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:p[4]||(p[4]=y=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:d.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),p[11]||(p[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"내보내기 (텍스트 · Mermaid)",onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:p[5]||(p[5]=y=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:p[6]||(p[6]=y=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[p[9]||(p[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:p[7]||(p[7]=y=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:"키보드 단축키 (?)",onClick:h},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1})]))}}),[["__scopeId","data-v-aea19e30"]]),Ex={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},vx=["title"],Nx=["disabled","aria-pressed"],$x=["disabled","aria-pressed"],xx=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",Ex,[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,Nx),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,$x)],10,vx))}}),[["__scopeId","data-v-44f7d737"]]),Ix=["disabled"],Sx={class:"em-panel__sub"},Cx={class:"em-nav"},Rx={key:0,class:"em-nav__divider","aria-hidden":"true"},Vx={key:1},Ax=["onClick","onKeydown"],Tx={class:"em-nav__name"},Mx=["title"],Bx={key:0,class:"em-panel__note"},Dx=["data-attr-block"],Ox={class:"em-attr__row"},Lx=["title"],Px={key:0,class:"em-attr__row"},zx={class:"em-attr__row"},Ux={class:"em-attr__row"},Hx={class:"em-attr__flags"},Fx={class:"em-attr__pii"},Gx={class:"em-attr__pii"},Yx={class:"em-attr__pii"},Wx={key:0,class:"em-attr__pii em-attr__codetop"},Kx={class:"em-multilang"},qx={key:2,class:"em-embed-cols"},Xx={class:"em-embed-col__label"},jx={class:"em-attr__row"},Zx={class:"em-attr__row"},Jx={key:0,class:"em-embed-upd"},Qx={class:"em-embed-upd"},eI={class:"em-embed-upd"},tI={class:"em-swatch__row em-attr__swatch"},nI=["onClick"],oI=["title","onClick"],iI={key:0,class:"em-attr__swatch-hint"},aI="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",ca="__OWN__",lI=Ue(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find($=>$.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find($=>$.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes.filter(U=>U.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes)??[]}),d=n.computed(()=>s.value.filter($=>r.value.has($.modelId)));function u($){return{pk:$.identifier,fk:$.attrType.startsWith("RELATION")&&$.dbAttrs.length>0,required:$.notNull&&!$.identifier}}function f($){return!!i.value&&!!ti(o.state.logical,i.value.modelId,$.modelId)}function h($){const U=u($),P=[U.pk&&"PK",U.fk&&"FK",U.required&&"NOT NULL"].filter(Boolean);return P.length?P.join(" · "):void 0}function m($,U){i.value&&o.selectAttribute(i.value.modelId,$.modelId,U.shiftKey?"range":U.metaKey||U.ctrlKey?"toggle":"replace")}const p=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function y($){return $==="none"?"(없음)":$}const b=$=>$;function _($){var U,P;return it((P=(U=a.value)==null?void 0:U.attributeStyles)==null?void 0:P[$.modelId])}function A($){return r.value.size>1&&r.value.has($.modelId)}function g($,U){if(!i.value)return;const P=A($)?o.selectedAttrIds.value:[$.modelId];o.setAttributeSwatches(i.value.modelId,P,U)}function N($,U){i.value&&o.updateAttribute(i.value.modelId,$.modelId,U)}function te($,U){N($,{naturalId:U||void 0,naturalIdMutable:U?$.naturalIdMutable:void 0})}function S(){return{naturalId:void 0,naturalIdMutable:void 0}}function O($,U){N($,{identifier:U,...U?S():{}})}function z($,U){N($,{transient:U||void 0,...U?S():{}})}function F($){return!!$.transient}const ne=$=>$.value,re=$=>$.label;function L($,U){if(!U)return;const P=v.value.find(ee=>ee.type===U);if(P){const ee=$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"};N($,{type:U,customType:void 0,dbAttrs:[{...ee,dataType:P.dataType,length:P.length,scale:P.scale}]});return}N($,U===zt?{type:U}:{type:U,customType:void 0})}function oe($,U){N($,{customType:U.trim()===""?void 0:U})}function k($,U){const ee={...$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!Go.has(ee.dataType)&&(ee.scale=void 0),N($,{dbAttrs:[ee]})}function W($){var U;return Go.has(((U=$.dbAttrs[0])==null?void 0:U.dataType)??"")}function R($,U,P){var ee;k($,{logicalName:{...(ee=$.dbAttrs[0])==null?void 0:ee.logicalName,[U]:P}})}function G($,U){N($,{description:Object.keys(U).length?U:void 0})}function H($){return $.personalInfoAttributeType??"none"}function ae($,U){N($,{personalInfoAttributeType:U==="none"?void 0:U})}const v=n.computed(()=>o.predefinedCustomTypeCatalog.value),q=n.computed(()=>o.embeddableCatalog.value),le=n.ref(void 0);function me($){var U,P;return((U=$.label)==null?void 0:U.ko)??((P=$.label)==null?void 0:P.en)??$.type}function he($){if(!$||!i.value)return;const U=o.addPredefinedEmbed(i.value.modelId,$);U&&o.selectAttribute(i.value.modelId,U),le.value=void 0}function se(){if(!i.value)return;const $=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,$)}const ce=n.computed(()=>o.groupCodeCatalog.value);function ye($){var U;return((U=ce.value.find(P=>P.groupCode===$.groupCode))==null?void 0:U.codes)??[]}function ke($){return["none",...ye($)]}function Re($){return $==="none"?"none":$.code}function xe($){var P,ee;if($==="none")return"(없음)";const U=((P=$.label)==null?void 0:P.ko)??((ee=$.label)==null?void 0:ee.en);return U?`${$.code} (${U})`:$.code}function pe($,U){i.value&&o.setAttributeGroupCode(i.value.modelId,$.modelId,U)}function X($,U){N($,{defaultValue:U==="none"?void 0:U})}function K($,U){N($,{defaultValue:U.trim()===""?void 0:U})}function w($){return $.attrType.startsWith("EMBED")&&$.dbAttrs.length>0}function C($,U,P){const ee=$.dbAttrs.map((fe,Ie)=>{if(Ie!==U)return fe;const Be={...fe,...P};for(const Me of Object.keys(P))P[Me]===void 0&&delete Be[Me];return Be});i.value&&o.setEmbedColumns(i.value.modelId,$.modelId,ee)}function V($,U,P,ee){var fe;C($,U,{logicalName:{...(fe=$.dbAttrs[U])==null?void 0:fe.logicalName,[P]:ee}})}function Y($,U){var fe,Ie,Be;if($.attrType==="EMBED_PREDEF"){const Me=(fe=o.embeddableCatalog.value.find(Ke=>Ke.type===$.type))==null?void 0:fe.fields[U];return Me?{name:Me.name,physicalName:Me.physicalName,dataType:Me.dataType,length:Me.length,shareable:Me.shareable,logicalName:Me.logicalName}:void 0}const P=(Ie=$.embedded)==null?void 0:Ie.embeddableRef;if(!P)return;const ee=(Be=o.state.logical.entities.find(Me=>Me.modelId===P))==null?void 0:Be.attributes.flatMap(Me=>Me.dbAttrs)[U];return ee?{physicalName:ee.physicalName,dataType:ee.dataType,length:ee.length,scale:ee.scale,logicalName:ee.logicalName}:void 0}function J($,U){var P,ee;return((P=Y($,U))==null?void 0:P.dataType)||((ee=$.dbAttrs[U])==null?void 0:ee.dataType)||""}function ge($,U){var P,ee;return((P=Y($,U))==null?void 0:P.length)??((ee=$.dbAttrs[U])==null?void 0:ee.length)}function we($,U){var P,ee;return((P=Y($,U))==null?void 0:P.scale)??((ee=$.dbAttrs[U])==null?void 0:ee.scale)}const Ne=["inherit","true","false"];function _e($){return $==="inherit"?"기본(따름)":$}function Ce($){return($==null?void 0:$.updatable)===void 0?"inherit":$.updatable?"true":"false"}function Te($,U,P){C($,U,{updatable:P==="inherit"?void 0:P==="true"})}function De($,U){k($,{updatable:U==="inherit"?void 0:U==="true"})}const E=["inherit","true","false"];function T($){return $==="inherit"?"기본(따름)":$}function I($){return($==null?void 0:$.insertable)===void 0?"inherit":$.insertable?"true":"false"}function M($,U,P){C($,U,{insertable:P==="inherit"?void 0:P==="true"})}function B($,U){k($,{insertable:U==="inherit"?void 0:U==="true"})}const de=n.computed(()=>{var $;return Xn((($=i.value)==null?void 0:$.attributes.flatMap(U=>U.dbAttrs))??[])}),be=n.computed(()=>{var $;return((($=i.value)==null?void 0:$.attributes)??[]).filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>({modelId:U.dbAttrs[0].modelId,label:U.dbAttrs[0].physicalName||U.name}))});function Q(){return[ca,...be.value.map($=>$.modelId)]}function Z($){if($===ca)return"전용 컬럼(OWN)";const U=be.value.find(P=>P.modelId===$);return U?`↗ ${U.label} (공유)`:$}function j($){return($==null?void 0:$.sharedColumnRef)??ca}function ue($,U,P){C($,U,{sharedColumnRef:P===ca?void 0:P})}function x($){return($==null?void 0:$.sharedColumnRef)!=null}function D($){var U;return((U=Yo($,de.value))==null?void 0:U.physicalName)??""}return($,U)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",Sx,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:se}),q.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":le.value,items:q.value,"value-provider":P=>P.type,"label-provider":me,"onUpdate:modelValue":he},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",Cx,[(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",Rx,[...U[0]||(U[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",Vx,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(P.modelId)}]),role:"button",tabindex:"0",onClick:ee=>m(P,ee),onKeydown:[n.withKeys(n.withModifiers(ee=>m(P,ee),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ee=>m(P,ee),["prevent"]),["space"])]},[n.createElementVNode("span",Tx,n.toDisplayString(P.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:h(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,Mx)],42,Ax)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",Bx," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>{var ee,fe,Ie,Be,Me,Ke,Ge,Qe,Ye,Pe,_n;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",Ox,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-name-${P.modelId}`,width:"100%",placeholder:"이름","model-value":P.name,"onUpdate:modelValue":Ee=>N(P,{name:Ee})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-type-${P.modelId}`,width:"84px",placeholder:"타입",disabled:P.attrType.startsWith("EMBED")||!!P.groupCode,items:n.unref(ur)(P.type,v.value),"value-provider":ne,"label-provider":re,"model-value":P.type,"onUpdate:modelValue":Ee=>L(P,Ee)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(P)?aI:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>n.unref(o).removeAttribute(i.value.modelId,P.modelId)},null,8,["onClick"])],8,Lx)]),P.type===n.unref(zt)?(n.openBlock(),n.createElementBlock("div",Px,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-customtype-${P.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":P.customType??"","onUpdate:modelValue":Ee=>oe(P,Ee)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),w(P)?(n.openBlock(),n.createElementBlock("div",qx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.dbAttrs,(Ee,et)=>{var Bo,Do,Oo,Lo,Po,zo,Uo;return n.openBlock(),n.createElementBlock("div",{key:Ee.modelId,class:"em-embed-col"},[n.createElementVNode("span",Xx,n.toDisplayString(((Bo=Y(P,et))==null?void 0:Bo.name)??((Do=Y(P,et))==null?void 0:Do.physicalName)??`컬럼 ${et+1}`),1),n.createElementVNode("div",jx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-col-${Ee.modelId}`,width:"100%",disabled:x(Ee),placeholder:((Oo=Y(P,et))==null?void 0:Oo.physicalName)??"컬럼","model-value":x(Ee)?D(Ee):Ee.physicalName,"onUpdate:modelValue":rt=>C(P,et,{physicalName:rt})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSTextInput),{name:`embed-dtype-${Ee.modelId}`,width:"84px",disabled:"","model-value":J(P,et)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-len-${Ee.modelId}`,width:"48px",disabled:"","model-value":ge(P,et)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-scale-${Ee.modelId}`,width:"48px",disabled:"","model-value":we(P,et)},null,8,["name","model-value"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",Zx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-logical-${Ee.modelId}`,width:"100%",placeholder:((Po=(Lo=Y(P,et))==null?void 0:Lo.logicalName)==null?void 0:Po.ko)??"논리명","model-value":((zo=Ee.logicalName)==null?void 0:zo.ko)??"","onUpdate:modelValue":rt=>V(P,et,"ko",rt)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Uo=Y(P,et))!=null&&Uo.shareable?(n.openBlock(),n.createElementBlock("label",Jx,[U[7]||(U[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px","model-value":j(Ee),items:Q(),"value-provider":b,"label-provider":Z,"onUpdate:modelValue":rt=>rt&&ue(P,et,rt)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",Qx,[U[8]||(U[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:x(Ee),"model-value":x(Ee)?"false":I(Ee),items:E,"value-provider":b,"label-provider":T,"onUpdate:modelValue":rt=>rt&&M(P,et,rt)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",eI,[U[9]||(U[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:x(Ee),"model-value":x(Ee)?"false":Ce(Ee),items:Ne,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":rt=>rt&&Te(P,et,rt)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",zx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-logical-${P.modelId}`,width:"100%",placeholder:"논리명","model-value":((fe=(ee=P.dbAttrs[0])==null?void 0:ee.logicalName)==null?void 0:fe.ko)??"","onUpdate:modelValue":Ee=>R(P,"ko",Ee)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Ux,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-col-${P.modelId}`,width:"100%",placeholder:"컬럼",disabled:F(P),"model-value":((Ie=P.dbAttrs[0])==null?void 0:Ie.physicalName)??"","onUpdate:modelValue":Ee=>k(P,{physicalName:Ee})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-dtype-${P.modelId}`,width:"84px",placeholder:"dataType",disabled:F(P),items:n.unref(cr)(((Be=P.dbAttrs[0])==null?void 0:Be.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":b,"label-provider":n.unref(_a),"model-value":((Me=P.dbAttrs[0])==null?void 0:Me.dataType)??"","onUpdate:modelValue":Ee=>Ee&&k(P,{dataType:Ee})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-len-${P.modelId}`,width:"48px",placeholder:"len",disabled:F(P),"model-value":(Ke=P.dbAttrs[0])==null?void 0:Ke.length,"onUpdate:modelValue":Ee=>k(P,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-scale-${P.modelId}`,width:"48px",placeholder:"scale",disabled:F(P)||!W(P),"model-value":(Ge=P.dbAttrs[0])==null?void 0:Ge.scale,"onUpdate:modelValue":Ee=>k(P,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Qe=P.dbAttrs[0])==null?void 0:Qe.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",Hx,[n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-pk-${P.modelId}`,label:"Primary Key","model-value":P.identifier,disabled:l.value||F(P),"onUpdate:modelValue":Ee=>O(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nn-${P.modelId}`,label:"Not Null","model-value":P.notNull,disabled:F(P),"onUpdate:modelValue":Ee=>N(P,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-uq-${P.modelId}`,label:"Unique","model-value":!!((Ye=P.dbAttrs[0])!=null&&Ye.unique),disabled:F(P),"onUpdate:modelValue":Ee=>k(P,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-ai-${P.modelId}`,label:"Auto Increment","model-value":!!((Pe=P.dbAttrs[0])!=null&&Pe.autoIncrement),disabled:F(P)||!P.identifier,"onUpdate:modelValue":Ee=>k(P,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-tr-${P.modelId}`,label:"@Transient","model-value":!!P.transient,disabled:P.identifier,"onUpdate:modelValue":Ee=>z(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nid-${P.modelId}`,label:"@NaturalId","model-value":!!P.naturalId,disabled:P.identifier||F(P),"onUpdate:modelValue":Ee=>te(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${P.modelId}`,label:"mutable","model-value":!!P.naturalIdMutable,disabled:F(P)||!P.naturalId,"onUpdate:modelValue":Ee=>N(P,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-mv-${P.modelId}`,label:"Multi-Value (Set)","model-value":!!((_n=P.dbAttrs[0])!=null&&_n.multiValue),disabled:F(P),"onUpdate:modelValue":Ee=>k(P,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",Fx,[U[1]||(U[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:F(P),"model-value":I(P.dbAttrs[0]),items:E,"value-provider":b,"label-provider":T,"onUpdate:modelValue":Ee=>Ee&&B(P,Ee)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Gx,[U[2]||(U[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:F(P),"model-value":Ce(P.dbAttrs[0]),items:Ne,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":Ee=>Ee&&De(P,Ee)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Yx,[U[3]||(U[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":H(P),items:p,"value-provider":b,"label-provider":y,"onUpdate:modelValue":Ee=>Ee&&ae(P,Ee)},null,8,["model-value","onUpdate:modelValue"])]),ce.value.length?(n.openBlock(),n.createElementBlock("label",Wx,[U[4]||(U[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Ad,{"model-value":P.groupCode,items:ce.value,"onUpdate:modelValue":Ee=>pe(P,Ee)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!ce.value.length}])},[U[5]||(U[5]=n.createElementVNode("span",null,"기본값",-1)),ye(P).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":P.defaultValue??"none",items:ke(P),"value-provider":Re,"label-provider":xe,"onUpdate:modelValue":Ee=>Ee&&X(P,Ee)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`attr-default-${P.modelId}`,width:"100%",placeholder:"기본값","model-value":P.defaultValue??"","onUpdate:modelValue":Ee=>K(P,Ee)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",Kx,[U[6]||(U[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{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":Ee=>G(P,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",tI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(P)===null}]),title:"없음",onClick:Ee=>g(P,null)},"∅",10,nI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),Ee=>(n.openBlock(),n.createElementBlock("button",{key:Ee,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(P)===Ee}]),style:n.normalizeStyle({background:n.unref(Ln)(Ee)}),title:n.unref(On)(Ee),onClick:et=>g(P,Ee)},null,14,oI))),128)),A(P)?(n.openBlock(),n.createElementBlock("span",iI,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,Dx)}),128))],8,Ix)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-52beb53b"]]),rI=["disabled"],sI={class:"em-panel__sub-label"},cI={class:"em-attr__row"},dI={class:"em-field em-idx-params"},uI=["value","onChange"],fI=Ue(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(m=>m.modelId===o.entityId)??null);function r(){var p;if(!l.value)return;const m=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:Oe(),name:`idx_${(((p=l.value.indexes)==null?void 0:p.length)??0)+1}`,unique:!1,columns:m?[{columnRef:m.modelId,descending:!1}]:[]})}function s(m,p){l.value&&a.updateIndex(l.value.modelId,m,p)}function c(m){var y;const p=(y=l.value)==null?void 0:y.attributes[0];p&&s(m.modelId,{columns:[...m.columns,{columnRef:p.modelId,descending:!1}]})}function d(m,p,y){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,columnRef:y}:b)})}function u(m,p,y){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,descending:y}:b)})}function f(m,p){s(m.modelId,{columns:m.columns.filter((y,b)=>b!==p)})}function h(m,p){s(m.modelId,{parameters:p.trim()===""?void 0:p})}return(m,p)=>{var y;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:p[0]||(p[0]=b=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",sI,[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(((y=l.value.indexes)==null?void 0:y.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(r,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],b=>(n.openBlock(),n.createElementBlock("div",{key:b.modelId,class:"em-attr"},[n.createElementVNode("div",cI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`idx-name-${b.modelId}`,width:"100%",placeholder:"인덱스명","model-value":b.name,"onUpdate:modelValue":_=>s(b.modelId,{name:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-uq-${b.modelId}`,class:"em-check",label:"UQ","model-value":b.unique,"onUpdate:modelValue":_=>s(b.modelId,{unique:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(a).removeIndex(l.value.modelId,b.modelId)},null,8,["onClick"])]),n.createVNode(mn,{controller:n.unref(a),"ref-id":b.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.columns,(_,A)=>(n.openBlock(),n.createElementBlock("div",{key:A,class:"em-attr__row"},[n.createVNode(n.unref(ie.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":g=>g.modelId,"label-provider":g=>g.name,"onUpdate:modelValue":g=>g&&d(b,A,g)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-${b.modelId}-desc-${A}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":g=>u(b,A,g)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"−",onClick:g=>f(b,A)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(b)},null,8,["onClick"]),n.createElementVNode("label",dI,[p[1]||(p[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:b.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:_=>h(b,_.target.value)},null,40,uI)])]))),128)):n.createCommentVNode("",!0)],8,rI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),mI=["disabled"],pI={class:"em-panel__sub-label"},hI={class:"em-attr__row"},yI={class:"em-attr__row"},gI={class:"em-multilang"},bI={class:"em-attr__pii"},_I={class:"em-swatch__row em-attr__swatch"},kI=["onClick"],wI=["title","onClick"],EI=Ue(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=ie.useModal(),r=n.computed(()=>a.state.logical.entities.find(g=>g.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(g=>g.entityRef===r.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(g){return g==="none"?"(없음)":g}const f=g=>g;function h(g,N){r.value&&a.updateOperation(r.value.modelId,g.modelId,N)}function m(g,N){h(g,{description:Object.keys(N).length?N:void 0})}function p(g){return g.personalInfoAttributeType??"none"}function y(g,N){h(g,{personalInfoAttributeType:N==="none"?void 0:N})}function b(g){var N,te;return it((te=(N=s.value)==null?void 0:N.operationStyles)==null?void 0:te[g.modelId])}function _(g,N){r.value&&a.setOperationSwatch(r.value.modelId,g.modelId,N)}function A(g){l.openModal({component:Td,bind:{operationName:g.name,sourceCode:g.sourceCode??"",onSave:N=>h(g,{sourceCode:N})}})}return(g,N)=>{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:N[1]||(N[1]=S=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",pI,[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(ie.BSButton),{variant:"text",caption:"추가",onClick:N[0]||(N[0]=n.withModifiers(S=>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??[],S=>(n.openBlock(),n.createElementBlock("div",{key:S.modelId,class:"em-attr"},[n.createElementVNode("div",hI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":S.name,"onUpdate:modelValue":O=>h(S,{name:O})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":O=>O&&h(S,{visibility:O})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:O=>n.unref(a).removeOperation(r.value.modelId,S.modelId)},null,8,["onClick"])]),n.createElementVNode("div",yI,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:S.sourceCode?"본문 편집 ●":"본문 편집",onClick:O=>A(S)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",gI,[N[2]||(N[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{multiline:"",name:`op-desc-${S.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":O=>m(S,O)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",bI,[N[3]||(N[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":p(S),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":O=>O&&y(S,O)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",_I,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(S)===null}]),title:"없음",onClick:O=>_(S,null)},"∅",10,kI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),O=>(n.openBlock(),n.createElementBlock("button",{key:O,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(S)===O}]),style:n.normalizeStyle({background:n.unref(Ln)(O)}),title:n.unref(On)(O),onClick:z=>_(S,O)},null,14,wI))),128))])]))),128)):n.createCommentVNode("",!0)],8,mI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),vI={class:"em-panel__head"},NI={class:"em-panel__head-row"},$I={class:"em-panel__context"},xI={key:0,class:"em-panel__lock"},II=["disabled"],SI={key:0,class:"em-panel__note"},CI={key:1,class:"em-panel__note"},RI={key:2,class:"em-jpa"},VI={class:"em-field"},AI={class:"em-field"},TI={key:0,class:"em-field"},MI={class:"em-panel__sub"},BI={class:"em-field"},DI={class:"em-jpa"},OI={key:0,class:"em-panel__note"},LI={class:"em-jpa"},PI={class:"em-field"},zI={key:0,class:"em-panel__note"},UI={class:"em-field"},HI={class:"em-multilang"},FI={class:"em-field"},GI=["value"],YI={class:"em-field"},WI={class:"em-swatch"},KI={class:"em-swatch__row"},qI=["title","onClick"],XI={class:"em-panel__note"},jI={class:"em-field"},ZI=["value"],JI={class:"em-swatch"},QI={class:"em-swatch__row"},eS=["title","onClick"],nf=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 X=r.value;return X?a.state.logical.entities.find(K=>K.modelId===X)??null:null}),c=n.computed(()=>{const X=l.value;if((X==null?void 0:X.kind)==="association"){const w=a.state.logical.associations.find(C=>C.modelId===X.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 X;return((X=a.selectedAttr.value)==null?void 0:X.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),f=n.computed(()=>d.value!==null),h=n.ref({});n.watch(f,()=>{h.value={}});function m(X){return h.value[X]??f.value}function p(X){h.value={...h.value,[X]:!m(X)}}const y=n.computed(()=>{var w;const X=s.value;if(!X)return"엔티티";const K=(w=X.table)==null?void 0:w.physicalName;return K?`${X.name} (${K})`:X.name}),b=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="association"?a.state.logical.associations.find(K=>K.modelId===X.id)??null:null}),_=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="group"?a.state.logical.groups.find(K=>K.modelId===X.id)??null:null}),A=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="note"?a.state.layout.notes.find(K=>K.modelId===X.id)??null:null}),g=n.computed(()=>{var K,w;const X=(K=_.value)==null?void 0:K.name;return(X==null?void 0:X.ko)||(X==null?void 0:X.en)||(X==null?void 0:X.ja)||(X==null?void 0:X.zh)||((w=_.value)==null?void 0:w.packageName)||"그룹"}),N=n.computed(()=>{if(s.value){const X=u.value.size;if(X>1)return`엔티티 · ${s.value.name} › 속성 · ${X}개`;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(b.value){const X=K=>{var w;return((w=a.state.logical.entities.find(C=>C.modelId===K))==null?void 0:w.name)??K};return`관계 · ${X(b.value.end1.entityRef)} — ${X(b.value.end2.entityRef)}`}return _.value?`그룹 · ${g.value}`:A.value?"노트":"선택된 항목 없음"}),te=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],S=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],O=["LIST","SET"],z=["inherit","LAZY","EAGER"],F=X=>X;function ne(X){return X==="inherit"?"기본(따름)":X}const re=n.computed(()=>!!b.value&&b.value.end1.entityRef===b.value.end2.entityRef);function L(X,K){b.value&&a.updateAssociationEnd(b.value.modelId,X,K)}function oe(X){b.value&&!re.value&&a.setAssociationIdentifying(b.value.modelId,X)}function k(X){var K,w,C;return!!((C=(w=(K=b.value)==null?void 0:K[X].jpa)==null?void 0:w.cascadeTypes)!=null&&C.includes("ALL"))}function W(X,K,w){var Y,J;const C=(Y=b.value)==null?void 0:Y[X];if(K==="ALL"&&w){L(X,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:["ALL"]}});return}const V=new Set(((J=C==null?void 0:C.jpa)==null?void 0:J.cascadeTypes)??[]);w?V.add(K):V.delete(K),L(X,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:[...V]}})}function R(X,K){var C;const w=(C=b.value)==null?void 0:C[X];L(X,{jpa:{...w==null?void 0:w.jpa,...K}})}function G(X){var K,w;return((w=(K=b.value)==null?void 0:K[X].jpa)==null?void 0:w.fetchType)??"inherit"}function H(X,K){R(X,{fetchType:K==="inherit"?void 0:K})}function ae(X){var w;const K=(w=b.value)==null?void 0:w[X==="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 v=n.computed(()=>{const X=b.value;if(!X)return null;for(const K of a.state.logical.entities){const w=K.attributes.find(Y=>{var J;return((J=Y.embedded)==null?void 0:J.associationRef)===X.modelId&&Y.attrType==="EMBED_OWN"});if(!w)continue;const C=X.end2.entityRef===w.embedded.embeddableRef?"end2":"end1",V=X[C].jpa;return{which:C,isCollection:X[C].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(V==null?void 0:V.collectionType)??"LIST",collectionTable:(V==null?void 0:V.collectionTable)??"",orderColumn:(V==null?void 0:V.orderColumn)??""}}return null});function q(X){b.value&&a.setEmbedCollectionMode(b.value.modelId,X?"COLLECTION":"SINGLE")}function le(X){const K=v.value;K&&R(K.which,X==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function me(X){const K=v.value;K&&R(K.which,{collectionTable:X.trim()||void 0})}function he(X){const K=v.value;K&&R(K.which,{orderColumn:X.trim()||void 0})}function se(X){_.value&&a.updateGroup(_.value.modelId,X)}function ce(X,K){var w;se({name:{...(w=_.value)==null?void 0:w.name,[X]:K}})}const ye=n.computed(()=>{var X;return _.value?it((X=a.state.layout.groupLayouts.find(K=>K.groupRef===_.value.modelId))==null?void 0:X.style):null});function ke(X){_.value&&a.setGroupSwatch(_.value.modelId,X)}function Re(X){A.value&&a.setNoteMemo(A.value.modelId,X)}const xe=n.computed(()=>{var X;return it((X=A.value)==null?void 0:X.style)});function pe(X){A.value&&a.setNoteSwatch(A.value.modelId,X)}return(X,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",vI,[n.createElementVNode("div",NI,[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",$I,n.toDisplayString(N.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",xI,[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(Rd,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("basics"),title:y.value,onToggle:K[3]||(K[3]=w=>p("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(lI,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(fI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("index"),onToggle:K[4]||(K[4]=w=>p("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(EI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("ops"),onToggle:K[5]||(K[5]=w=>p("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ie.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!b.value.identifying,disabled:re.value||!!v.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),re.value?(n.openBlock(),n.createElementBlock("p",SI,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):v.value?(n.openBlock(),n.createElementBlock("p",CI,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),v.value?(n.openBlock(),n.createElementBlock("fieldset",RI,[K[18]||(K[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ie.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":v.value.isCollection,"onUpdate:modelValue":q},null,8,["model-value"]),v.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",VI,[K[15]||(K[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":v.value.collectionType,items:O,"value-provider":F,"label-provider":F,"onUpdate:modelValue":K[6]||(K[6]=w=>w&&le(w))},null,8,["model-value"])]),n.createElementVNode("label",AI,[K[16]||(K[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":v.value.collectionTable,"onUpdate:modelValue":me},null,8,["model-value"])]),v.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",TI,[K[17]||(K[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":v.value.orderColumn,"onUpdate:modelValue":he},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 C,V,Y,J;return n.createElementVNode("div",{key:w,class:"em-end"},[n.createElementVNode("h4",MI,n.toDisplayString(w)+" → "+n.toDisplayString(b.value[w].entityRef),1),n.createElementVNode("label",BI,[K[20]||(K[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":b.value[w].multiplicity,items:te,"value-provider":F,"label-provider":F,disabled:((C=v.value)==null?void 0:C.which)===w,"onUpdate:modelValue":ge=>L(w,{multiplicity:ge})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-navigable`,class:"em-check",label:"navigable","model-value":b.value[w].navigable,"onUpdate:modelValue":ge=>L(w,{navigable:ge})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-composition`,class:"em-check",label:"composition","model-value":b.value[w].composition,"onUpdate:modelValue":ge=>L(w,{composition:ge})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",DI,[K[21]||(K[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(S,ge=>{var we,Ne;return n.createVNode(n.unref(ie.BSCheckbox),{key:ge,name:`${w}-cascade-${ge}`,class:"em-check",label:ge,"model-value":!!((Ne=(we=b.value[w].jpa)==null?void 0:we.cascadeTypes)!=null&&Ne.includes(ge)),disabled:ge!=="ALL"&&k(w),"onUpdate:modelValue":_e=>W(w,ge,_e)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),k(w)?(n.openBlock(),n.createElementBlock("p",OI,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",LI,[K[24]||(K[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",PI,[K[22]||(K[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":G(w),items:z,"value-provider":F,"label-provider":ne,"onUpdate:modelValue":ge=>ge&&H(w,ge)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((V=b.value[w].jpa)!=null&&V.orphanRemoval),disabled:ae(w),"onUpdate:modelValue":ge=>R(w,{orphanRemoval:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ae(w)&&((Y=b.value[w].jpa)!=null&&Y.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",zI,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",UI,[K[23]||(K[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:`${w}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((J=b.value[w].jpa)==null?void 0:J.orderBy)??"","onUpdate:modelValue":ge=>R(w,{orderBy:ge.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",HI,[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 C;return n.openBlock(),n.createElementBlock("label",{key:w,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(w),1),n.createVNode(n.unref(ie.BSTextInput),{name:`grp-name-${w}`,width:"100%","model-value":((C=_.value.name)==null?void 0:C[w])??"","onUpdate:modelValue":V=>ce(w,V)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",FI,[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=>se({description:w.target.value}))},null,40,GI)]),n.createElementVNode("label",YI,[K[27]||(K[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":K[8]||(K[8]=w=>se({packageName:w}))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":K[9]||(K[9]=w=>se({excludeDDLGeneration:w}))},null,8,["model-value"]),n.createElementVNode("fieldset",WI,[K[28]||(K[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",KI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ye.value===null}]),title:"없음",onClick:K[10]||(K[10]=w=>ke(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":ye.value===w}]),style:n.normalizeStyle({background:n.unref(Ln)(w)}),title:n.unref(On)(w),onClick:C=>ke(w)},null,14,qI))),128))])]),n.createElementVNode("p",XI,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),A.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",jI,[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,ZI)]),n.createElementVNode("fieldset",JI,[K[30]||(K[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",QI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":xe.value===null}]),title:"없음",onClick:K[12]||(K[12]=w=>pe(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":xe.value===w}]),style:n.normalizeStyle({background:n.unref(Ln)(w)}),title:n.unref(On)(w),onClick:C=>pe(w)},null,14,eS))),128))])])],64)):n.createCommentVNode("",!0)],8,II)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),tS={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function nS(e){const t=e.split("-")[1];return t?tS[t]??t:e}function oS(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const iS=["title"],aS=["title","onClick"],lS={key:0,class:"em-validation__body"},rS={class:"em-validation__opt"},sS={key:0,class:"em-validation__empty"},cS={key:1,class:"em-validation__empty"},dS={key:2,class:"em-validation__list"},uS=["onClick"],fS={class:"em-validation__item-msg"},mS={key:0,class:"em-validation__item-entity"},pS=["title"],hS=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 y=new Map;for(const b of o.state.logical.entities)y.set(b.modelId,b.name);return y});function l(y){const b=oS(y);if(!b)return null;const _=a.value.get(b);return _===void 0?null:_.trim()===""?"(이름 없음)":_}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const y={error:0,warning:0,info:0};for(const b of i.value)y[b.severity]++;return y}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(y=>c.value[y.severity]).slice().sort((y,b)=>r[y.severity].order-r[b.severity].order)),u=n.computed(()=>d.value.map(y=>({issue:y,entityName:l(y),category:nS(y.ruleId)}))),f=n.ref(!1);function h(y){c.value[y]=!c.value[y]}function m(y){if(!f.value){f.value=!0;return}h(y)}function p(y){y.targetRef&&o.requestFocus(y.targetRef)}return(y,b)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(f.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:b[1]||(b[1]=_=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),b[3]||(b[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,iS),n.createElementVNode("div",{class:"em-validation__counts",onClick:b[0]||(b[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],_=>n.createElementVNode("button",{key:_,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:f.value?`${r[_].label} ${c.value[_]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:A=>m(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,aS)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",lS,[n.createElementVNode("label",rS,[n.createVNode(n.unref(ie.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":b[2]||(b[2]=_=>n.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",sS,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",cS," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",dS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:A,category:g},N)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${N}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:te=>p(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",fS,[A?(n.openBlock(),n.createElementBlock("span",mS,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(g),9,pS)],10,uS))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),yS={class:"em-history"},gS={class:"em-history__head"},bS={class:"em-history__title"},_S={class:"em-history__head-actions"},kS=["disabled"],wS={class:"em-history__filters"},ES={class:"em-history__filter"},vS={class:"em-history__body"},NS={key:0,class:"em-history__empty"},$S={key:1,class:"em-history__empty is-error"},xS={key:2,class:"em-history__empty"},IS={key:3,class:"em-history__list"},SS=["onClick"],CS={class:"em-history__summary"},RS={class:"em-history__seq"},VS={class:"em-history__gmeta"},AS={class:"em-history__who"},TS={key:0,class:"em-history__time"},MS={key:1,class:"em-history__restored-from"},BS={key:0,class:"em-history__detail"},DS={class:"em-history__action-head"},OS={class:"em-history__action-name"},LS={key:0,class:"em-history__fields"},PS={class:"em-history__fname"},zS={key:0,class:"em-history__old"},US={class:"em-history__val"},HS={key:1,class:"em-history__restore"},FS=["disabled","onClick"],GS=["disabled"],YS=["onClick"],WS=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(v){s.value=v instanceof Error?v.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,v=>{v&&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(v=>[v.modelId,v]))),m=n.computed(()=>new Map(a.state.logical.associations.map(v=>[v.modelId,v]))),p=n.computed(()=>new Map((a.state.logical.groups??[]).map(v=>{var q;return[v.modelId,v.packageName||((q=v.name)==null?void 0:q.ko)||v.modelId]})));function y(v){var he,se,ce,ye,ke,Re,xe;const q=m.value.get(v);if(!q)return"연관";if((he=q.description)!=null&&he.trim())return q.description.trim();const le=(ye=(ce=h.value.get((se=q.end1)==null?void 0:se.entityRef))==null?void 0:ce.name)==null?void 0:ye.trim(),me=(xe=(Re=h.value.get((ke=q.end2)==null?void 0:ke.entityRef))==null?void 0:Re.name)==null?void 0:xe.trim();return le&&me?`${le}→${me}`:"연관"}function b(v){var q,le,me,he;if(v.kind==="entity")return((le=(q=h.value.get(v.ref))==null?void 0:q.name)==null?void 0:le.trim())||"(이름 없음)";if(v.kind==="attribute"||v.kind==="operation"||v.kind==="index"){const se=v.entityRef?h.value.get(v.entityRef):void 0,ye=((v.kind==="attribute"?se==null?void 0:se.attributes:v.kind==="operation"?se==null?void 0:se.operations:se==null?void 0:se.indexes)??[]).find(Re=>Re.modelId===v.ref),ke=(me=se==null?void 0:se.name)==null?void 0:me.trim();return`${ke?ke+".":""}${((he=ye==null?void 0:ye.name)==null?void 0:he.trim())||v.ref}`}return v.kind==="association"?y(v.ref):v.kind==="associationEnd"?`${y(v.ref)}(${v.end})`:v.kind==="group"?`그룹 ${p.value.get(v.ref)??v.ref}`:v.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},A={add:"추가",update:"수정",remove:"삭제"},g=n.ref("all"),N=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],te=n.computed({get:()=>g.value,set:v=>{v&&(g.value=v)}}),S=n.computed(()=>br(l.value)),O=n.computed(()=>S.value.length?S.value[0].seq:null),z=n.computed(()=>g.value==="all"?S.value:S.value.filter(v=>(v.kind??"edit")===g.value));function F(v){return v===void 0?"—":v===null?"(비움)":typeof v=="object"?JSON.stringify(v):String(v)}function ne(v){const q=b(v.subject);if(v.verb==="add")return`${q} 추가`;if(v.verb==="remove")return`${q} 삭제`;if(v.fields.length===1){const le=v.fields[0];return`${q}.${le.field} ${le.oldValue!==void 0?F(le.oldValue)+"→":""}${F(le.value)}`}return`${q} ${v.fields.length}개 변경`}function re(v){return v.actions.length===0?"변경 없음":v.actions.length===1?ne(v.actions[0]):`${ne(v.actions[0])} 외 ${v.actions.length-1}건`}const L=n.ref(new Set);function oe(v){const q=new Set(L.value);q.has(v)?q.delete(v):q.add(v),L.value=q}function k(v){if(v==null)return"";const q=new Date(v);return isNaN(q.getTime())?String(v):q.toLocaleString()}function W(v){const q=v.author,le=v.origin;return q&&le?`${q}(${le})`:q||(le?`(${le})`:"—")}const R=n.ref(null),G=n.ref(!1);function H(v){R.value=v}async function ae(v){G.value=!0;try{const q=await a.restoreToSeq(v);q.ok||(s.value=`복원 실패: ${q.reason??"알 수 없음"}`)}finally{G.value=!1,R.value=null}}return(v,q)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",yS,[n.createElementVNode("header",gS,[n.createElementVNode("div",bS,[n.createVNode(Ve,{name:"undo",size:15}),q[4]||(q[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",_S,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:q[0]||(q[0]=le=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,kS),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:q[1]||(q[1]=le=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",wS,[n.createElementVNode("label",ES,[q[5]||(q[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:te.value,"onUpdate:modelValue":q[2]||(q[2]=le=>te.value=le),items:N,"value-provider":le=>le.v,"label-provider":le=>le.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",vS,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",NS,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",$S,n.toDisplayString(s.value),1)):z.value.length===0?(n.openBlock(),n.createElementBlock("p",xS,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",IS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(z.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:me=>oe(le.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":L.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",CS,n.toDisplayString(re(le)),1),n.createElementVNode("span",RS,"#"+n.toDisplayString(le.seq),1)],8,SS),n.createElementVNode("div",VS,[n.createElementVNode("span",AS,n.toDisplayString(W(le)),1),le.ts?(n.openBlock(),n.createElementBlock("span",TS,n.toDisplayString(k(le.ts)),1)):n.createCommentVNode("",!0),le.kind==="restore"&&le.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",MS,"← #"+n.toDisplayString(le.restoredFromSeq),1)):n.createCommentVNode("",!0)]),L.value.has(le.seq)?(n.openBlock(),n.createElementBlock("div",BS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le.actions,(me,he)=>(n.openBlock(),n.createElementBlock("div",{key:he,class:"em-history__action"},[n.createElementVNode("div",DS,[n.createVNode(Ve,{name:_[me.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",OS,n.toDisplayString(b(me.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${me.verb}`])},n.toDisplayString(A[me.verb]),3)]),me.fields.length?(n.openBlock(),n.createElementBlock("ul",LS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me.fields,(se,ce)=>(n.openBlock(),n.createElementBlock("li",{key:ce,class:"em-history__field"},[n.createElementVNode("span",PS,n.toDisplayString(se.field),1),se.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",zS,n.toDisplayString(F(se.oldValue)),1)):n.createCommentVNode("",!0),se.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",US,n.toDisplayString(F(se.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&le.seq!==O.value?(n.openBlock(),n.createElementBlock("div",HS,[R.value===le.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[q[6]||(q[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:G.value,onClick:me=>ae(le.seq)},"복원",8,FS),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:G.value,onClick:q[3]||(q[3]=me=>R.value=null)},"취소",8,GS)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:me=>H(le.seq)},[n.createVNode(Ve,{name:"undo",size:12}),q[7]||(q[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,YS))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function KS(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 of(e){const t=n.ref(KS(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 qS={class:"em-modeler"},XS={class:"em-modeler__body"},jS={class:"em-drawer__inner"},ZS={class:"em-drawer__head"},JS={class:"em-drawer__actions"},QS=["title"],eC=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}=of({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=of({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(h,m)=>{var p,y,b;return n.openBlock(),n.createElementBlock("div",qS,[n.createVNode(tf,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=_=>{var A;return(A=u.value)==null?void 0:A.exportSvg()}),onExportPng:m[1]||(m[1]=_=>{var A;return(A=u.value)==null?void 0:A.exportPng()}),onToggleHistory:m[2]||(m[2]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",XS,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",jS,[n.createElementVNode("header",ZS,[m[10]||(m[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",JS,[(p=f.value)!=null&&p.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(y=f.value)!=null&&y.allExpanded?"모두 접기":"모두 펼치기",onClick:m[3]||(m[3]=_=>{var A;return(A=f.value)==null?void 0:A.toggleAll()})},[n.createVNode(Ve,{name:(b=f.value)!=null&&b.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,QS)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[4]||(m[4]=_=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(ef,{ref_key:"explorer",ref:f,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(l)}]),title:"너비 조절",onPointerdown:m[5]||(m[5]=(..._)=>n.unref(r)&&n.unref(r)(..._))},null,34),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:m[6]||(m[6]=_=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],512),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(l),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(Qu,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(nf,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[7]||(m[7]=_=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:"Inspector 열기",onClick:m[8]||(m[8]=_=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(WS,{controller:e.controller,open:i.value,onClose:m[9]||(m[9]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(hS,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1bc07cae"]]);ve.APPLY_MODEL_OPS_INPUT_SCHEMA=Tm,ve.AssociationEdge=tu,ve.CUSTOM_TYPE_VALUE=zt,ve.CommandStack=Ia,ve.DEFAULT_JAVA_TYPE=ka,ve.DiagramCanvas=Qu,ve.DiagramExplorer=ef,ve.EDITOR=pn,ve.EditModeToggle=xx,ve.EditorToolbar=tf,ve.EntityModeler=eC,ve.EntityNode=Pd,ve.GROUP_CODE_ENUM_VALUE=qn,ve.GroupNode=zd,ve.JAVA_TYPES=wa,ve.NoteNode=Ud,ve.OpSyncAdapter=ss,ve.PHYSICAL_NAME_MAX_LENGTH=va,ve.PropertyPanel=nf,ve.RevCache=rs,ve.SELECTABLE_JAVA_TYPES=dr,ve.SYMBOLIC_OP_KINDS=cs,ve.SYMBOLIC_OP_SCHEMA=ks,ve.anchoredEdgePoint=pa,ve.buildAgentBatch=Mm,ve.buildDiagramSvg=Kl,ve.buildOrthogonalPath=da,ve.buildSelfLoopPath=Jl,ve.buildStraightPath=fa,ve.commands=om,ve.computeAutoLayout=Ql,ve.createEditorController=yk,ve.defaultMermaidDialect=ff,ve.displayLabel=Fo,ve.emptyState=Bd,ve.entityModelToMermaid=ya,ve.entityModelToText=or,ve.estimateEntityHeight=tr,ve.exportDiagramPng=Zu,ve.exportDiagramSvg=ju,ve.fromPersisted=qm,ve.indexColumnsByModelId=Xn,ve.javaTypeLabel=En,ve.migrateLegacyMoney=Lf,ve.newId=Oe,ve.orthogonalMidpoints=ua,ve.packEntityBoxes=uf,ve.physicalNameWarning=Wo,ve.projectActionLog=br,ve.projectEntityAudit=yr,ve.projectFieldAudit=Ut,ve.rectExitPoint=ma,ve.renderDiagramSvg=sr,ve.resolveDiagram=jl,ve.resolveSharedColumn=Yo,ve.resolveSymbolicOps=vm,ve.restoreDeepEqual=vn,ve.segmentMidpoints=ha,ve.sideDir=Wn,ve.synthesizeRestoreOps=qf,ve.toPersisted=sp,ve.toPersistedV2=cp,ve.validateModel=pr,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})}));
|