@g1cloud/entity-modeler-next 5.0.11 → 5.1.0
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/adapter/diagramAdapter.d.ts +5 -0
- package/dist/adapter/persisted.d.ts +11 -0
- package/dist/core/referenceOnly.d.ts +50 -0
- package/dist/core/types.d.ts +23 -0
- package/dist/editor/controller.d.ts +6 -0
- package/dist/entity-modeler-next.css +1 -1
- package/dist/entity-modeler.js +11360 -11267
- package/dist/entity-modeler.umd.cjs +29 -29
- package/dist/i18n/ko.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
(function(ge,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(ge=typeof globalThis<"u"?globalThis:ge||self,t(ge.EntityModeler={},ge.Vue,ge.OpenBlueseaCore))})(this,(function(ge,t,te){"use strict";var eD=Object.defineProperty;var tD=(ge,t,te)=>t in ge?eD(ge,t,{enumerable:!0,configurable:!0,writable:!0,value:te}):ge[t]=te;var Qe=(ge,t,te)=>tD(ge,typeof t!="symbol"?t+"":t,te);const Eh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Nh(e,n){const o=e%n.perRow,i=Math.floor(e/n.perRow);return{location:{x:n.startX+o*n.columnGap,y:n.startY+i*n.rowGap},size:{...n.defaultSize}}}function vs(e,n,o={}){const i={...Eh,...o},a=new Map(e.entities.map(f=>[f.modelId,f])),r=new Map(n.entityLayouts.map(f=>[f.entityRef,f])),l=new Map(n.associationLayouts.map(f=>[f.associationRef,f])),s=new Map;for(const f of e.groups)for(const g of f.memberEntityRefs)s.set(g,f.modelId);const c=new Map;for(const f of n.groupLayouts)for(const g of f.memberNoteRefs??[])c.set(g,f.groupRef);let d=0;const u=e.entities.map(f=>{const g=s.get(f.modelId),k=r.get(f.modelId);if(k){const N={location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}};return{entity:f,geo:N,collapsed:k.collapsed??!1,locked:k.locked??!1,groupRef:g,style:k.style,attributeStyles:k.attributeStyles,operationStyles:k.operationStyles}}const _=Nh(d++,i);return{entity:f,geo:_,collapsed:!1,locked:!1,groupRef:g}}),m=new Map(n.groupLayouts.map(f=>[f.groupRef,f])),h=e.groups.map(f=>{const g=m.get(f.modelId),k=g?{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:f,geo:k,style:g==null?void 0:g.style,locked:(g==null?void 0:g.locked)??!1}}),p=e.associations.map(f=>{const g=l.get(f.modelId);return{association:f,waypoints:(g==null?void 0:g.waypoints)??[],sourceColumnRef:g==null?void 0:g.sourceColumnRef,targetColumnRef:g==null?void 0:g.targetColumnRef}}),y=n.notes.map(f=>({note:{...f,geo:{location:{x:f.geo.location.x,y:f.geo.location.y},size:{width:f.geo.size.width,height:f.geo.size.height}}},groupRef:c.get(f.modelId)})),b=[];for(const f of n.notes)for(const g of f.connections??[])a.has(g.targetRef)&&b.push({noteRef:f.modelId,targetRef:g.targetRef,waypoints:g.waypoints.map(k=>({x:k.x,y:k.y}))});return{entities:u,associations:p,groups:h,notes:y,noteConnections:b}}const wh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Cs(e,n,o={}){const i={...wh,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),h=m?m.location:{x:0,y:0},p=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((p-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((b,f)=>{const g=f%y,k=Math.floor(f/y);r.push({id:b,location:{x:h.x+i.pad+g*i.cellWidth,y:h.y+i.pad+i.headerHeight+k*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const h=m%i.ungroupedCols,p=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+p*i.cellHeight}})}),r}const xs={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Ih(e,n={}){const o={...xs,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function _r(e,n={}){const o={...xs,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Ih(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Mn(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function Ss(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const Bi="inherited:";function Rs(e,n){return`${Bi}${e}:${n}`}function Vn(e){return e.startsWith(Bi)}function kr(e){if(!Vn(e))return null;const n=e.slice(Bi.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function Ho(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Rs(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}const vh={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function jo(e){return vh[e]??e}function Di(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Li(e,n,o,i,a=0){var u;if(!Di(e))return;const r=i.find(m=>m.end1.attributeRef===e.modelId||m.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(m=>m.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(u=e.derivedFrom)==null?void 0:u.sourceAttributeRef;if(c){const m=s==null?void 0:s.attributes.find(h=>h.modelId===c);if(m)return m.dbAttrs[a];for(const h of o){const p=h.attributes.find(y=>y.modelId===c);if(p)return p.dbAttrs[a]}}return s?s.attributes.filter(m=>m.identifier&&(m.attrType==="NORMAL"||m.attrType==="RELATION_OWN")).sort((m,h)=>m.order-h.order).flatMap(m=>m.dbAttrs)[a]:void 0}const As=e=>e==null||e.trim()==="";function $s(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=i.entities.find(u=>u.modelId===d))==null?void 0:c.attributes.flatMap(u=>u.dbAttrs)[n]}if(e.attrType.startsWith("RELATION"))return Li(e,o,i.entities,i.associations,n)}function Bn(e,n,o,i,a,r){const l=$s(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:Ch(n.logicalName)?n.logicalName:l.logicalName}:n}function Ch(e){return e!=null&&Object.values(e).some(n=>!As(n))}function Ko(e,n,o,i,a,r){var l;return As(n.physicalName)?((l=$s(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Ts(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let h=0;h<m.dbAttrs.length;h++){if(u===n)return m.name||void 0;u++}}}function Er(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function En(e,n){return Er(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function co(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Dn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function Oi(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const Ms="(미지정)",xh="(이름 없음)",Pi=e=>e==null||String(e).trim()==="",zi=e=>Pi(e)?xh:String(e),Vs=e=>Pi(e)?Ms:String(e);function Bs(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..*"}return Ms}function Ds(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Pi(n)?Vs(e.physicalName):String(n),a=Pi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function Ls(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function Os(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${zi(c.name)}${d} «${jo(c.stereotype)}»${u?` [${u}]`:""}`);const m=co(En(c,e.entities)),h=f=>{var g;return f.sharedColumnRef?(g=Dn(f,m))==null?void 0:g.physicalName:void 0},p=[...c.attributes].sort((f,g)=>f.order-g.order);for(const f of p){if(f.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${f.name?` ${f.name} ${"─".repeat(8)}`:""}`);continue}const g=f.dbAttrs.map((C,A)=>Bn(f,C,A,c,e,n)),k=[f.identifier?"PK":"",f.notNull?"NOT NULL":""].filter(Boolean),_=` - ${zi(f.name)}: ${Vs(f.type)}`,N=C=>C.length?` {${C.join(", ")}}`:"";if(g.length>1){a.push(`${_}${N(k)}`),g.forEach((C,A)=>{const T=Ts(f,A,e,n);a.push(` · ${T?`${T} → `:""}${Ds(C,h(C))}${N(Ls(C))}`)});continue}const I=g[0],$=I?` → ${Ds(I,h(I))}`:"";a.push(`${_}${$}${N([...k,...I?Ls(I):[]])}`)}const y=Mn(c.attributes);for(const f of c.indexes??[]){const g=f.columns.map(k=>{var _,N;return`${((_=y.attributeOf(k.columnRef))==null?void 0:_.name)??((N=kr(k.columnRef))==null?void 0:N.field)??k.columnRef}${k.descending?" DESC":""}`}).join(", ");a.push(` index ${zi(f.name)}${f.unique?" UNIQUE":""}: ${g}`)}const b=[...c.operations??[]].sort((f,g)=>f.order-g.order);for(const f of b){const g=f.visibility?` {${f.visibility}}`:"",k=(s=f.description)!=null&&s.ko?` — ${f.description.ko}`:"";a.push(` method ${zi(f.name)}()${g}${k}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Bs(c.end1.multiplicity)} —— ${Bs(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
-
`).trim()}const
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:
|
|
6
|
-
`)}function
|
|
7
|
-
`)+(
|
|
8
|
-
${
|
|
9
|
-
${
|
|
10
|
-
);`);const _=new Map;for(const
|
|
1
|
+
(function(be,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,ee){"use strict";var dD=Object.defineProperty;var uD=(be,t,ee)=>t in be?dD(be,t,{enumerable:!0,configurable:!0,writable:!0,value:ee}):be[t]=ee;var Xe=(be,t,ee)=>uD(be,typeof t!="symbol"?t+"":t,ee);const xh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Ch(e,n){const o=e%n.perRow,i=Math.floor(e/n.perRow);return{location:{x:n.startX+o*n.columnGap,y:n.startY+i*n.rowGap},size:{...n.defaultSize}}}function Ss(e,n,o={}){const i={...xh,...o},a=new Map(e.entities.map(k=>[k.modelId,k])),r=new Map(n.entityLayouts.map(k=>[k.entityRef,k])),l=new Map(n.associationLayouts.map(k=>[k.associationRef,k])),s=new Map;for(const k of e.groups)for(const N of k.memberEntityRefs)s.set(N,k.modelId);const c=new Map;for(const k of n.groupLayouts)for(const N of k.memberNoteRefs??[])c.set(N,k.groupRef);let d=0;const u=e.entities.map(k=>{const N=s.get(k.modelId),b=r.get(k.modelId);if(b){const E={location:{x:b.geo.location.x,y:b.geo.location.y},size:{width:b.geo.size.width,height:b.geo.size.height}};return{entity:k,geo:E,collapsed:b.collapsed??!1,locked:b.locked??!1,groupRef:N,style:b.style,attributeStyles:b.attributeStyles,operationStyles:b.operationStyles}}const _=Ch(d++,i);return{entity:k,geo:_,collapsed:!1,locked:!1,groupRef:N}}),m=new Map(n.groupLayouts.map(k=>[k.groupRef,k])),p=e.groups.map(k=>{const N=m.get(k.modelId),b=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:k,geo:b,style:N==null?void 0:N.style,locked:(N==null?void 0:N.locked)??!1}}),f=e.associations.map(k=>{const N=l.get(k.modelId);return{association:k,waypoints:(N==null?void 0:N.waypoints)??[],sourceColumnRef:N==null?void 0:N.sourceColumnRef,targetColumnRef:N==null?void 0:N.targetColumnRef}}),h=n.notes.map(k=>({note:{...k,geo:{location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}}},groupRef:c.get(k.modelId)})),g=[];for(const k of n.notes)for(const N of k.connections??[])a.has(N.targetRef)&&g.push({noteRef:k.modelId,targetRef:N.targetRef,waypoints:N.waypoints.map(b=>({x:b.x,y:b.y}))});return{entities:u,associations:f,groups:p,notes:h,noteConnections:g}}const Sh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Rs(e,n,o={}){const i={...Sh,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),p=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const h=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,k)=>{const N=k%h,b=Math.floor(k/h);r.push({id:g,location:{x:p.x+i.pad+N*i.cellWidth,y:p.y+i.pad+i.headerHeight+b*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const p=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+f*i.cellHeight}})}),r}const As={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Rh(e,n={}){const o={...As,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function kr(e,n={}){const o={...As,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Rh(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Tn(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function $s(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const Di="inherited:";function Ts(e,n){return`${Di}${e}:${n}`}function Mn(e){return e.startsWith(Di)}function Er(e){if(!Mn(e))return null;const n=e.slice(Di.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function jo(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Ts(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}const Ah={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function Ko(e){return Ah[e]??e}function Oi(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Li(e,n,o,i,a=0){var u;if(!Oi(e))return;const r=i.find(m=>m.end1.attributeRef===e.modelId||m.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(m=>m.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(u=e.derivedFrom)==null?void 0:u.sourceAttributeRef;if(c){const m=s==null?void 0:s.attributes.find(p=>p.modelId===c);if(m)return m.dbAttrs[a];for(const p of o){const f=p.attributes.find(h=>h.modelId===c);if(f)return f.dbAttrs[a]}}return s?s.attributes.filter(m=>m.identifier&&(m.attrType==="NORMAL"||m.attrType==="RELATION_OWN")).sort((m,p)=>m.order-p.order).flatMap(m=>m.dbAttrs)[a]:void 0}const Ms=e=>e==null||e.trim()==="";function Vs(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=i.entities.find(u=>u.modelId===d))==null?void 0:c.attributes.flatMap(u=>u.dbAttrs)[n]}if(e.attrType.startsWith("RELATION"))return Li(e,o,i.entities,i.associations,n)}function Vn(e,n,o,i,a,r){const l=Vs(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:$h(n.logicalName)?n.logicalName:l.logicalName}:n}function $h(e){return e!=null&&Object.values(e).some(n=>!Ms(n))}function Go(e,n,o,i,a,r){var l;return Ms(n.physicalName)?((l=Vs(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Bs(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let p=0;p<m.dbAttrs.length;p++){if(u===n)return m.name||void 0;u++}}}function Nr(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function kn(e,n){return Nr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function so(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Bn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function Pi(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const Ds="(미지정)",Th="(이름 없음)",zi=e=>e==null||String(e).trim()==="",Fi=e=>zi(e)?Th:String(e),Os=e=>zi(e)?Ds:String(e);function Ls(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..*"}return Ds}function Ps(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=zi(n)?Os(e.physicalName):String(n),a=zi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function zs(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function Fs(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${Fi(c.name)}${d} «${Ko(c.stereotype)}»${u?` [${u}]`:""}`);const m=so(kn(c,e.entities)),p=k=>{var N;return k.sharedColumnRef?(N=Bn(k,m))==null?void 0:N.physicalName:void 0},f=[...c.attributes].sort((k,N)=>k.order-N.order);for(const k of f){if(k.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${k.name?` ${k.name} ${"─".repeat(8)}`:""}`);continue}const N=k.dbAttrs.map((T,L)=>Vn(k,T,L,c,e,n)),b=[k.identifier?"PK":"",k.notNull?"NOT NULL":""].filter(Boolean),_=` - ${Fi(k.name)}: ${Os(k.type)}`,E=T=>T.length?` {${T.join(", ")}}`:"";if(N.length>1){a.push(`${_}${E(b)}`),N.forEach((T,L)=>{const x=Bs(k,L,e,n);a.push(` · ${x?`${x} → `:""}${Ps(T,p(T))}${E(zs(T))}`)});continue}const I=N[0],A=I?` → ${Ps(I,p(I))}`:"";a.push(`${_}${A}${E([...b,...I?zs(I):[]])}`)}const h=Tn(c.attributes);for(const k of c.indexes??[]){const N=k.columns.map(b=>{var _,E;return`${((_=h.attributeOf(b.columnRef))==null?void 0:_.name)??((E=Er(b.columnRef))==null?void 0:E.field)??b.columnRef}${b.descending?" DESC":""}`}).join(", ");a.push(` index ${Fi(k.name)}${k.unique?" UNIQUE":""}: ${N}`)}const g=[...c.operations??[]].sort((k,N)=>k.order-N.order);for(const k of g){const N=k.visibility?` {${k.visibility}}`:"",b=(s=k.description)!=null&&s.ko?` — ${k.description.ko}`:"";a.push(` method ${Fi(k.name)}()${N}${b}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Ls(c.end1.multiplicity)} —— ${Ls(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
+
`).trim()}const Mh=e=>e&&e[0].toLowerCase()+e.slice(1);function Ui(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Us(e){return e!=="EXACTLY_ONE_INSTANCE"&&e!=="ONE_OR_MORE_INSTANCES"}function Hi(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 Vh(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function ji(e,n){const o=Mh(e);return n?Vh(o):o}function co(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function uo(e){return e.referenceOnly===!0}function wr(e){const n=new Set;for(const o of e.entities)uo(o)&&n.add(o.modelId);return n}function Hs(e){return e.entities.filter(n=>!uo(n))}function js(e,n=wr(e)){return n.size===0?e.associations:e.associations.filter(o=>!n.has(o.end1.entityRef)&&!n.has(o.end2.entityRef))}function Ks(e,n){return n?{...e,entities:e.entities.map(o=>o.referenceOnly?o:{...o,referenceOnly:!0})}:e}function Bh(e,n){return uo(e)||n===!0}function Dh(e){return e==="CLASS"?"class":"er"}function Ir(e,n,o){const i=Oh(e);return n==="class"?jh(i):Fh(i,o)}function Oh(e){const n=wr(e);return n.size===0?e:{...e,entities:Hs(e),associations:js(e,n)}}function Yo(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function vr(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Gs(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=Yo(n(a),`Entity_${r+1}`);let s=l,c=2;for(;o.has(s);)s=`${l}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function Lh(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const Ys=Hi;function xr(e){return e!=null&&qs[e]!=null}const qs={NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"};function Ws(e,n){const o={NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"},i=xr(e)?e:"ZERO_OR_MORE_INSTANCES";return(n==="left"?qs:o)[i]}function Ph(e,n,o,i){if(e.dbAttrs.length===0)return[];const a=[];return e.dbAttrs.forEach((r,l)=>{var p;const s=Vn(e,r,l,n,o,i);if(s.sharedColumnRef!=null)return;const c=l===0?e.name:Bs(e,l,o,i),d=Yo(s.dataType||e.type,"unknown"),u=Yo(s.physicalName||c,"col"),m=s.length?`(${s.length}${s.scale!=null?`,${s.scale}`:""})`:"";a.push(zh(d,u,e,s.unique===!0,m,(p=s.logicalName)==null?void 0:p.ko))}),a}function zh(e,n,o,i,a,r){const l=[o.identifier?"PK":"",Lh(o)?"FK":"",i?"UK":""].filter(Boolean).join(", "),s=vr([r,a].filter(Boolean).join(" ")),c=[` ${e} ${n}`];return l&&c.push(l),c.join(" ")+(s?` "${s}"`:"")}function Fh(e,n){const o=Gs(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),i=["erDiagram"];for(const r of e.entities){const l=o.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){i.push(` ${l}`);continue}i.push(` ${l} {`);for(const c of s)for(const d of Ph(c,r,e,n))i.push(d);i.push(" }")}const a=[];for(const r of e.associations){const l=o.get(r.end1.entityRef),s=o.get(r.end2.entityRef);if(!l||!s)continue;const c=`${Ws(r.end1.multiplicity,"left")}--${Ws(r.end2.multiplicity,"right")}`,d=vr(r.description);i.push(` ${l} ${c} ${s} : "${d}"`),(!xr(r.end1.multiplicity)||!xr(r.end2.multiplicity))&&a.push(`${l} -- ${s}`)}if(a.length>0){i.push(`%% ⚠ 다중성 미지정 ${a.length}건 — 0..*(가장 약한 주장)로 표기함. 모델을 정정할 지점:`);for(const r of a)i.push(`%% ${r}`)}return i.join(`
|
|
3
|
+
`)}function Uh(e){return e&&e!=="UNDEFINED"?Ko(e):null}function Hh(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function jh(e){const n=Gs(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=Uh(i.stereotype);l&&r.push(` <<${l}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)r.push(` +${Hh(c.type)} ${Yo(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${Yo(c.name,"op")}()`);r.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...r),o.push(" }"))}for(const i of e.associations){const a=n.get(i.end1.entityRef),r=n.get(i.end2.entityRef);if(!a||!r)continue;const l=Kh(i),s=vr(i.description),c=` ${a} "${Ys(i.end1.multiplicity)}" ${l} "${Ys(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function Kh(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Me(){return crypto.randomUUID()}const Js=["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"],Gh=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"]),Yh=Js.filter(e=>!Gh.has(e)),qh={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Cr(e){return qh[e]??e}const Wh=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Sr=new Set(["NUMERIC","DECIMAL"]);function Xs(e,n=Yh){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const tn="CustomType",Dn="GroupCodeEnum",Rr="String",qo=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Dn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:tn,label:"CustomType"}],Jh=new Map(qo.map(e=>[e.value,e.label]));function mo(e){return Jh.get(e)??e}const Xh={TINYINT:"Short",SMALLINT:"Short",INTEGER:"Integer",BIGINT:"Long",SERIAL:"Integer",BIG_SERIAL:"Long",FLOAT:"Double",REAL:"Double",DOUBLE:"Double",NUMERIC:"BigDecimal",DECIMAL:"BigDecimal",CHAR:"String",VARCHAR:"String",LONGVARCHAR:"String",NCHAR:"String",NVARCHAR:"String",LONGNVARCHAR:"String",CLOB:"String",NCLOB:"String",BIT:"Boolean",BOOLEAN:"Boolean",DATE:"LocalDate",TIMESTAMP:"LocalDateTime",TIMESTAMP_WITH_TIMEZONE:"OffsetDateTime",BINARY:"ByteArray",VARBINARY:"ByteArray",LONGVARBINARY:"ByteArray",BLOB:"ByteArray"};function Zs(e){if(e)return Xh[e.toUpperCase()]}const Zh={String:new Set(["VARCHAR","CHAR","LONGVARCHAR","CLOB","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","JSONB"]),CharacterArray:new Set(["CHAR","VARCHAR","LONGVARCHAR","CLOB"]),Integer:new Set(["INTEGER","SERIAL","SMALLINT","NUMERIC","DECIMAL"]),Long:new Set(["BIGINT","BIG_SERIAL","NUMERIC","DECIMAL"]),Short:new Set(["SMALLINT","TINYINT","NUMERIC","DECIMAL"]),Double:new Set(["DOUBLE","FLOAT","REAL","NUMERIC","DECIMAL"]),BigDecimal:new Set(["NUMERIC","DECIMAL"]),BigInteger:new Set(["NUMERIC","DECIMAL","BIGINT"]),Boolean:new Set(["BOOLEAN","BIT","CHAR","VARCHAR"]),Date:new Set(["DATE","TIME","TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),LocalDate:new Set(["DATE"]),LocalDateTime:new Set(["TIMESTAMP"]),Instant:new Set(["TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),ZonedDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),OffsetDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),ByteArray:new Set(["BINARY","VARBINARY","LONGVARBINARY","BLOB"]),Currency:new Set(["VARCHAR","CHAR"]),[Dn]:new Set(["VARCHAR","CHAR"])},Qh=new Map(qo.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function ey(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!Js.includes(i))return;const a=Qh.get(o)??o,r=Zh[a];if(r)return r.has(i)}const ty=new Set([Dn,"CustomMoneyType"]),Qs=qo.filter(e=>!ty.has(e.value)).map(e=>e.value===tn?{...e,label:"CustomType (사용자정의)"}:e);function ec(e,n=[]){const o=n.map(a=>{var l,s;const r=((l=a.label)==null?void 0:l.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:r?`${a.type} (${r})`:a.type}}),i=[...Qs,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:mo(e)},...i]:i}function ny(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Ar(e,n){var r;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=n.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==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES")return((r=i.jpa)==null?void 0:r.collectionType)??"LIST"}function $r(e,n,o){var i;return n.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&n.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${mo(n.type)}>`:ny(n)?mo(n.type):e==="CLASS"?n.type===tn&&n.customType||mo(n.type):Cr(((i=n.dbAttrs[0])==null?void 0:i.dataType)??"")}const oy={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},iy={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function ay(e,n,o){var a,r;if(!o.size)return;const i=new Map(e.map(l=>[l.modelId,l]));for(const l of e){const s=l.attributes.filter(d=>o.has(d.modelId));if(!s.length)continue;const c=n.filter(d=>d.end2.entityRef===l.modelId).map(d=>({assoc:d,parent:i.get(d.end1.entityRef)})).filter(d=>d.parent!=null);if(c.length)for(const d of s){const u=(a=d.dbAttrs[0])==null?void 0:a.physicalName,m=(f,h)=>f.attributes.find(g=>{var k;return g.identifier&&(h==null||((k=g.dbAttrs[0])==null?void 0:k.physicalName)===h)});let p=c.length===1?c[0]:void 0;if(!p){const f=c.filter(h=>m(h.parent,u)!=null);f.length===1&&(p=f[0])}p&&(d.attrType="RELATION_OWN",d.derivedFrom={associationRef:p.assoc.modelId,sourceAttributeRef:((r=m(p.parent,u)??m(p.parent))==null?void 0:r.modelId)??""},p.assoc.end2.attributeRef||(p.assoc.end2.attributeRef=d.modelId))}}}function ry(e,n){let o=e,i;const a=o.match(/"([^"]*)"\s*$/);a&&(i=a[1],o=o.slice(0,a.index).trim());const r=o.split(/\s+/).filter(Boolean);if(r.length<2)return null;const l=r[0],s=r[1],c=new Set(r.slice(2).join(" ").split(",").map(h=>h.trim()).filter(Boolean));let d,u,m;if(i!=null){const h=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(h){d=Number(h[1]),h[2]!=null&&(u=Number(h[2]));const g=i.slice(0,h.index).trim();g&&(m=g)}else i.trim()&&(m=i.trim())}const p={modelId:Me(),physicalName:s,dataType:l};return d!=null&&(p.length=d),u!=null&&(p.scale=u),c.has("UK")&&(p.unique=!0),m&&(p.logicalName={ko:m}),{attr:{modelId:Me(),name:s,type:Zs(l)??"",attrType:"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[p]},foreignKey:c.has("FK")}}function tc(e){const n=e.split(`
|
|
5
|
+
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:Me(),name:d,stereotype:"JPA_ENTITY",table:{physicalName:d},attributes:[]};return o.push(m),i.set(d,m),m};let s=null;for(const d of n){const u=d.trim();if(!u||u==="erDiagram"||u.startsWith("%%"))continue;if(s){if(u==="}"){s=null;continue}const f=ry(u,s.attributes.length);f&&(s.attributes.push(f.attr),f.foreignKey&&r.add(f.attr.modelId));continue}const m=u.match(/^(\S+)\s*\{$/);if(m){s=l(m[1]);continue}const p=u.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(p&&/--|\.\./.test(p[2])){const[f,h]=p[2].split(/--|\.\./);let g=(p[4]??"").trim();const k=g.match(/^"([^"]*)"$/);k&&(g=k[1]),a.push({left:p[1],right:p[3],cardL:f??"",cardR:h??"",label:g});continue}/^\S+$/.test(u)&&l(u)}const c=a.map(d=>{const u=l(d.left),m=l(d.right);return{modelId:Me(),description:d.label||void 0,end1:{entityRef:u.modelId,multiplicity:oy[d.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:iy[d.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return ay(o,c,r),{modelId:Me(),entities:o,associations:c,groups:[]}}function nc(e){const n=tc(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=kr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Me(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const oc={smallint:{dataType:"SMALLINT"},int2:{dataType:"SMALLINT"},integer:{dataType:"INTEGER"},int:{dataType:"INTEGER"},int4:{dataType:"INTEGER"},bigint:{dataType:"BIGINT"},int8:{dataType:"BIGINT"},smallserial:{dataType:"SMALLINT",autoIncrement:!0},serial:{dataType:"INTEGER",autoIncrement:!0},serial4:{dataType:"INTEGER",autoIncrement:!0},bigserial:{dataType:"BIGINT",autoIncrement:!0},serial8:{dataType:"BIGINT",autoIncrement:!0},real:{dataType:"REAL"},float4:{dataType:"REAL"},"double precision":{dataType:"DOUBLE"},float8:{dataType:"DOUBLE"},numeric:{dataType:"NUMERIC"},decimal:{dataType:"DECIMAL"},boolean:{dataType:"BOOLEAN"},bool:{dataType:"BOOLEAN"},char:{dataType:"CHAR"},character:{dataType:"CHAR"},varchar:{dataType:"VARCHAR"},"character varying":{dataType:"VARCHAR"},text:{dataType:"LONGVARCHAR"},bytea:{dataType:"VARBINARY"},date:{dataType:"DATE"},time:{dataType:"TIME"},"time with time zone":{dataType:"TIME_WITH_TIMEZONE"},timestamp:{dataType:"TIMESTAMP"},"timestamp with time zone":{dataType:"TIMESTAMP_WITH_TIMEZONE"},jsonb:{dataType:"JSONB"},json:{dataType:"JSONB"},xml:{dataType:"SQLXML"}},ly=Object.keys(oc).sort((e,n)=>n.length-e.length),ic=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,fo=`${ic}(?:\\.${ic})*`,sy=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${fo})\s*\(([\s\S]*)\)\s*$`,"i"),cy=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${fo})\s*\(([^)]*)\)`,"i"),dy=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${fo})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${fo})\s*\(([^)]*)\)`,"i"),uy=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${fo})\s+ON\s+(${fo})\s*\(([^)]*)\)`,"i");function vt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function On(e){const n=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(n.push(i),i=""):i+=a;return i.trim()&&n.push(i),n.map(a=>a.trim()).filter(Boolean)}function my(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=vt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const k of ly)if(a.startsWith(k)){const N=oc[k];r=N.dataType,l=!!N.autoIncrement;let b=i.slice(k.length);const _=b.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);_&&(s=Number(_[1]),_[2]!=null&&(c=Number(_[2])),b=b.slice(_[0].length)),d=b,u=!0;break}if(!u){const k=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);k&&(r=k[1].toUpperCase(),k[2]!=null&&(s=Number(k[2])),k[3]!=null&&(c=Number(k[3])),d=k[4]??"")}const m=d.toUpperCase(),p=/\bPRIMARY\s+KEY\b/.test(m),f=p||/\bNOT\s+NULL\b/.test(m),h=/\bUNIQUE\b/.test(m),g={modelId:Me(),physicalName:o,dataType:r};return s!=null&&(g.length=s),c!=null&&(g.scale=c),h&&(g.unique=!0),l&&(g.autoIncrement=!0),{primaryKey:p,attr:{modelId:Me(),name:o,type:Zs(r)??"",attrType:"NORMAL",identifier:p,notNull:f,order:0,dbAttrs:[g]}}}function fy(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function ac(e){const n=e.match(/\(([^)]*)\)/);return n?On(n[1]).map(vt):[]}function Tr(e){var d;const n=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(u=>u.trim()).filter(Boolean);for(const u of c){const m=u.match(sy);if(!m)continue;const p=vt(m[1]),f=m[2],h={modelId:Me(),name:p,stereotype:"JPA_ENTITY",table:{physicalName:p},attributes:[]},g=new Map,k=[];let N=0;for(const b of On(f)){if(fy(b)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(b))k.push(...ac(b));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(b))for(const I of ac(b)){const A=g.get(I.toLowerCase());A!=null&&A.dbAttrs[0]&&(A.dbAttrs[0].unique=!0)}const E=b.match(cy);E&&l.push({childTable:p,childCols:On(E[1]).map(vt),parentTable:vt(E[2]),parentCols:On(E[3]).map(vt)});continue}const _=my(b);if(!_){n.push(`컬럼 정의 해석 실패: ${b.slice(0,40)}`);continue}_.attr.order=N++,_.attr.type||n.push(`자바 타입 미해소(수동 지정 필요): ${p}.${_.attr.name} — ${(d=_.attr.dbAttrs[0])==null?void 0:d.dataType}`),h.attributes.push(_.attr),g.set(_.attr.name.toLowerCase(),_.attr)}for(const b of k){const _=g.get(b.toLowerCase());_&&(_.identifier=!0,_.notNull=!0)}o.push(h),i.set(p.toLowerCase(),h);for(const[b,_]of g)a.set(`${p.toLowerCase()}.${b}`,_)}for(const u of c){const m=u.match(dy);m&&l.push({childTable:vt(m[1]),childCols:On(m[2]).map(vt),parentTable:vt(m[3]),parentCols:On(m[4]).map(vt)})}for(const u of l){const m=i.get(u.childTable.toLowerCase()),p=i.get(u.parentTable.toLowerCase());if(!m||!p){n.push(`FK 대상 테이블 없음: ${u.childTable}→${u.parentTable}`);continue}const f=a.get(`${u.childTable.toLowerCase()}.${(u.childCols[0]??"").toLowerCase()}`),h={modelId:Me(),end1:{entityRef:p.modelId,multiplicity:f!=null&&f.notNull?"EXACTLY_ONE_INSTANCE":"NO_INSTANCE_OR_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};u.childCols.forEach((g,k)=>{const N=a.get(`${u.childTable.toLowerCase()}.${g.toLowerCase()}`),b=a.get(`${u.parentTable.toLowerCase()}.${(u.parentCols[k]??"").toLowerCase()}`);N&&(N.attrType="RELATION_OWN",N.derivedFrom={associationRef:h.modelId,sourceAttributeRef:(b==null?void 0:b.modelId)??""},k===0&&(h.end2.attributeRef=N.modelId))}),r.push(h)}for(const u of c){const m=u.match(uy);if(!m)continue;const p=vt(m[3]),f=i.get(p.toLowerCase());if(!f){n.push(`인덱스 대상 테이블 없음: ${p}`);continue}const g=On(m[4]).map(N=>vt(N.replace(/\s+(ASC|DESC)$/i,""))).map(N=>{var b,_;return(_=(b=a.get(`${p.toLowerCase()}.${N.toLowerCase()}`))==null?void 0:b.dbAttrs[0])==null?void 0:_.modelId}).filter(N=>!!N).map(N=>({columnRef:N,descending:!1}));if(!g.length)continue;const k={modelId:Me(),name:vt(m[2]),unique:!!m[1],columns:g};f.indexes=[...f.indexes??[],k]}return{logical:{modelId:Me(),entities:o,associations:r,groups:[]},warnings:n}}function rc(e){const{logical:n}=Tr(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=kr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Me(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}function py(){return"postgres"}function lc(e,n="postgres",o){return ky(e,o)}const po=e=>e==null||e.trim()==="";function Ki(e){return[...e.attributes].filter(n=>n.attrType!=="DIVIDER"&&!n.transient).sort((n,o)=>n.order-o.order)}function hy(e){const n=new Set;for(const o of e.groups)if(o.excludeDDLGeneration)for(const i of o.memberEntityRefs)n.add(i);return e.entities.filter(o=>o.stereotype!=="JPA_EMBEDDABLE"&&!n.has(o.modelId)&&!uo(o))}function Mr(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name}const yy={SMALLINT:"smallint",TINYINT:"smallint",INTEGER:"integer",BIGINT:"bigint",SERIAL:"serial",BIG_SERIAL:"bigserial",REAL:"real",FLOAT:"double precision",DOUBLE:"double precision",BOOLEAN:"boolean",BIT:"boolean",LONGVARCHAR:"text",LONGNVARCHAR:"text",CLOB:"text",NCLOB:"text",BINARY:"bytea",VARBINARY:"bytea",LONGVARBINARY:"bytea",BLOB:"bytea",DATE:"date",TIME:"time",TIME_WITH_TIMEZONE:"time with time zone",TIMESTAMP:"timestamp",TIMESTAMP_WITH_TIMEZONE:"timestamp with time zone",JSONB:"jsonb",JAVA_OBJECT:"jsonb",SQLXML:"xml"};function gy(e){const n=e.dataType;if(e.autoIncrement){if(n==="BIGINT")return"bigserial";if(n==="SMALLINT")return"smallserial";if(n==="INTEGER")return"serial"}return n==="NUMERIC"||n==="DECIMAL"?e.length==null?"numeric":e.scale!=null?`numeric(${e.length}, ${e.scale})`:`numeric(${e.length})`:n==="CHAR"||n==="NCHAR"?e.length!=null?`char(${e.length})`:"char":n==="VARCHAR"||n==="NVARCHAR"?e.length!=null?`varchar(${e.length})`:"varchar":yy[n]??n.toLowerCase()}function by(e,n,o){const i=[];for(const a of Ki(e))a.dbAttrs.forEach((r,l)=>{const s=Vn(a,r,l,e,n,o);sc(s)&&i.push({attr:a,col:s,name:s.physicalName})});return i}function sc(e){return e.sharedColumnRef==null&&!po(e.physicalName)&&!po(e.dataType)}function _y(e){return[` -- ⚠ 컬럼명 충돌로 ${e.length}개 컬럼 생략 (CHK-NAME-2 — 같은 물리명을 둘 이상이 사용):`,...e.map(({attr:o,name:i})=>` -- ${o.name||"(이름 없음)"} → ${i}`)].join(`
|
|
6
|
+
`)}function ky(e,n){const o=hy(e),i=new Map,a=new Map;for(const d of e.entities)for(const u of Ki(d)){i.set(u.modelId,d);const m=[];u.dbAttrs.forEach((p,f)=>{const h=Vn(u,p,f,d,e,n);sc(h)&&(m[f]=h.physicalName)}),a.set(u.modelId,m)}const r=[],l=[],s=[];for(const d of o){const u=Mr(d),m=by(d,e,n);if(m.length===0)continue;const p=new Map,f=new Map;for(const{attr:T,col:L,name:x}of m){const R=T.dbAttrs.findIndex(B=>B.modelId===L.modelId),$=p.get(T.modelId)??[];$[R<0?$.length:R]=x,p.set(T.modelId,$),f.set(L.modelId,x)}const h=new Set,g=[],k=[];for(const{attr:T,col:L,name:x}of m){if(h.has(x)){g.push({attr:T,col:L,name:x});continue}h.add(x);const R=[` ${x} ${gy(L)}`];T.notNull&&!T.identifier&&R.push("NOT NULL"),L.unique&&R.push("UNIQUE"),k.push(R.join(" "))}const N=Ki(d).filter(T=>T.identifier).flatMap(T=>p.get(T.modelId)??[]).filter(T=>!po(T));N.length&&k.push(` PRIMARY KEY (${N.join(", ")})`);const b=k.join(`,
|
|
7
|
+
`)+(g.length?`
|
|
8
|
+
${_y(g)}`:"");r.push(`CREATE TABLE ${u} (
|
|
9
|
+
${b}
|
|
10
|
+
);`);const _=new Map,E=[];for(const T of Ki(d)){const L=T.derivedFrom;if(!L)continue;const x=i.get(L.sourceAttributeRef);if(!x)continue;if(uo(x)){E.push(`${T.name||T.modelId} → ${Mr(x)}`);continue}const R=p.get(T.modelId)??[],$=a.get(L.sourceAttributeRef)??[],B=[];for(let y=0;y<Math.max(R.length,$.length);y++){const w=R[y],v=$[y];po(w)||po(v)||B.push([w,v])}if(!B.length)continue;const O=_.get(L.associationRef)??{childCols:[],parentTable:Mr(x),parentCols:[]};for(const[y,w]of B)O.childCols.push(y),O.parentCols.push(w);_.set(L.associationRef,O)}E.length&&l.push(`-- ⚠ ${u}: 참고 전용 부모를 참조하는 FK ${E.length}개 생략 — ${E.join(", ")}`);let I=0;for(const T of _.values()){const L=`fk_${u}_${T.parentTable}${_.size>1?`_${++I}`:""}`;l.push(`ALTER TABLE ${u} ADD CONSTRAINT ${L} FOREIGN KEY (${T.childCols.join(", ")}) REFERENCES ${T.parentTable} (${T.parentCols.join(", ")});`)}const A=Tn(d.attributes);for(const T of d.indexes??[]){const L=[],x=[],R=[],$=new Set;for(const O of T.columns){const y=f.get(A.canon(O.columnRef));if(po(y)){Mn(O.columnRef)||x.push($s(A,O.columnRef));continue}if($.has(y)){R.push(y);continue}$.add(y),L.push(y)}if(x.length&&s.push(`-- ⚠ ${u} 인덱스 ${T.name||"(이름 없음)"}: 컬럼 참조 미해소 ${x.length}개 생략 — ${x.join(", ")}`),R.length&&s.push(`-- ⚠ ${u} 인덱스 ${T.name||"(이름 없음)"}: 중복 컬럼 ${R.length}개 생략 (CHK-DSN-7) — ${R.join(", ")}`),!L.length)continue;const B=T.name||`ix_${u}_${L.join("_")}`;s.push(`CREATE ${T.unique?"UNIQUE ":""}INDEX ${B} ON ${u} (${L.join(", ")});`)}}return[r.join(`
|
|
11
11
|
|
|
12
12
|
`),l.join(`
|
|
13
13
|
`),s.join(`
|
|
14
14
|
`)].filter(d=>d.length).join(`
|
|
15
15
|
|
|
16
|
-
`)}const $r="entity-modeler-diagram",Tr=1;class Pn extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function ic(e,n){return JSON.stringify({format:$r,version:Tr,logical:e,layout:n},null,2)}const Ki=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ho=e=>Array.isArray(e)?e:[];function ac(e){let n;try{n=JSON.parse(e)}catch{throw new Pn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Ki(n))throw new Pn("최상위가 객체가 아닙니다.");if(n.format!==$r)throw new Pn(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Tr)throw new Pn(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Ki(o)||!Array.isArray(o.entities))throw new Pn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Ki(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Pn("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:ho(o.associations),groups:ho(o.groups)},a=Ki(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:ho(a.entityLayouts),associationLayouts:ho(a.associationLayouts),groupLayouts:ho(a.groupLayouts),notes:ho(a.notes)};return{logical:i,layout:r}}const py=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function xt(e){return e.replace(py,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Le(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function rc(e){return`<text ${[`x="${Le(e.x)}"`,`y="${Le(e.y)}"`,`fill="${xt(e.fill)}"`,`font-size="${Le(e.fontSize)}"`,e.fontFamily?`font-family="${xt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${xt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${xt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${xt(e.text)}</text>`}function hy(e){return`<line x1="${Le(e.x1)}" y1="${Le(e.y)}" x2="${Le(e.x2)}" y2="${Le(e.y)}" stroke="${xt(e.stroke)}" stroke-width="${Le(e.strokeWidth??1)}" />`}function yy(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 gy(e,n,o,i,a){return[`M${Le(e+a.tl)},${Le(n)}`,`L${Le(e+o-a.tr)},${Le(n)}`,a.tr?`Q${Le(e+o)},${Le(n)} ${Le(e+o)},${Le(n+a.tr)}`:"",`L${Le(e+o)},${Le(n+i-a.br)}`,a.br?`Q${Le(e+o)},${Le(n+i)} ${Le(e+o-a.br)},${Le(n+i)}`:"",`L${Le(e+a.bl)},${Le(n+i)}`,a.bl?`Q${Le(e)},${Le(n+i)} ${Le(e)},${Le(n+i-a.bl)}`:"",`L${Le(e)},${Le(n+a.tl)}`,a.tl?`Q${Le(e)},${Le(n)} ${Le(e+a.tl)},${Le(n)}`:"","Z"].filter(Boolean).join(" ")}function Mr(e){const n=yy(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${xt(e.fill)}"`,`stroke="${xt(e.stroke)}"`,`stroke-width="${Le(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${xt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Le(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${gy(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Le(e.x)}" y="${Le(e.y)}" width="${Le(e.w)}" height="${Le(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(hy(l));for(const l of e.texts)r.push(rc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function by(e){const o=[`<path ${[`d="${xt(e.d)}"`,'fill="none"',`stroke="${xt(e.stroke)}"`,`stroke-width="${Le(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${xt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(rc(i));return`<g>${o.join("")}</g>`}function lc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Le(n)}" y="${Le(o)}" width="${Le(i)}" height="${Le(a)}" fill="${xt(e.background)}" />`);for(const l of e.groups)r.push(Mr(l));for(const l of e.edges)r.push(by(l));for(const l of e.entities)r.push(Mr(l));for(const l of e.notes)r.push(Mr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Le(n)} ${Le(o)} ${Le(i)} ${Le(a)}" width="${Le(i)}" height="${Le(a)}">`+r.join("")+"</svg>"}function Gi(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function _y(e,n,o){const i=Gi(e,o),a=Gi(n,o);return i.kind===a.kind&&i.value!==a.value}const Vr=()=>crypto.randomUUID(),sc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,ky=e=>e&&e[0].toLowerCase()+e.slice(1),Ey=e=>e&&e[0].toUpperCase()+e.slice(1),cc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Ny(e,n){return ky(e??"")+Ey(n??"")}function wy(e,n){const o=uo(e.name,n);return o===e.name?e:{...e,name:o,dbAttrs:e.dbAttrs.map(i=>({...i,physicalName:cc(o)}))}}function dc(e,n){const o=e.entities.find(s=>s.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!Ps(n.end1.multiplicity);return o.attributes.filter(s=>s.identifier&&(s.attrType==="NORMAL"||s.attrType==="RELATION_OWN")).sort((s,c)=>s.order-c.order).map(s=>{const c=Ny(o.name,s.name);return{associationRef:n.modelId,sourceAttributeRef:s.modelId,name:c,type:s.type,identifier:a,notNull:r,dbAttrs:s.dbAttrs.map(d=>({physicalName:cc(c),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const Yi=(e,n)=>`${e}::${n}`,qi=e=>e??void 0;function Iy(e,n,o){const i={};return e.type!==n.type&&(i.type=n.type),e.identifier!==n.identifier&&(i.identifier=n.identifier),e.notNull!==n.notNull&&(i.notNull=n.notNull),(e.dbAttrs.length!==n.dbAttrs.length||n.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||qi(s.length)!==qi(r.length)||qi(s.scale)!==qi(r.scale)}))&&(i.dbAttrs=n.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function vy(e,n,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:n,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function qo(e,n,o=Vr){const i={add:[],update:[],remove:[]},a=e.entities.find(p=>p.modelId===n);if(!a)return i;const r=e.associations.filter(p=>p.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(p=>dc(e,p)),s=new Map(l.map(p=>[Yi(p.associationRef,p.sourceAttributeRef),p])),c=a.attributes.filter(p=>p.derivedFrom),d=new Map(c.map(p=>[Yi(p.derivedFrom.associationRef,p.derivedFrom.sourceAttributeRef),p]));for(const p of c){const y=Yi(p.derivedFrom.associationRef,p.derivedFrom.sourceAttributeRef);s.has(y)||i.remove.push(p.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(p=>!u.has(p.modelId)).map(p=>p.name));let h=a.attributes.reduce((p,y)=>Math.max(p,y.order),-1)+1;for(const p of l){const y=Yi(p.associationRef,p.sourceAttributeRef),b=d.get(y);if(b){const f=Iy(b,p,o);f&&i.update.push({attributeId:b.modelId,patch:f})}else{const f=wy(p,m);m.add(f.name),i.add.push(vy(f,h++,o))}}return i}function uc(e,n){if(n.remove.length){const o=new Set(n.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of n.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}n.add.length&&e.attributes.push(...n.add)}function Cy(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function mc(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function fc(e,n,o=Vr){const i=new Map,a=Cy(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(h=>h.end1.entityRef===d).map(h=>h.end2.entityRef));for(const h of m){const p=qo(a,h,o);if(sc(p))continue;const y=i.get(h);i.set(h,y?mc(y,p):p);const b=a.entities.find(f=>f.modelId===h);b&&uc(b,p),r.has(h)||(r.add(h),c.push(h))}}return i}function pc(e,n,o=Vr){const i=[],a=qo(e,n,o);let r=e;sc(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return uc(s,a),s})});for(const[l,s]of fc(r,n,o))i.push({entityId:l,plan:s});return i}function Wi(e,n,o){var l;const i=e.entities.find(s=>s.modelId===n),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!Di(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const Wo=63;function Br(e){if(!e)return null;const n=e.length;return n>Wo?n:null}function Dr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function bt(e){return!e||e.trim()===""}function yo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function xy(e){const n=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const m=n.get(u.end1.entityRef)??[];m.push(u.end2.entityRef),n.set(u.end1.entityRef,m)}const o=0,i=1,a=2,r=new Map,l=[],s=[],c=new Set,d=u=>{r.set(u,i),l.push(u);for(const m of n.get(u)??[]){const h=r.get(m)??o;if(h===o)d(m);else if(h===i){const p=l.slice(l.indexOf(m)),y=[...p].sort().join(" ");c.has(y)||(c.add(y),s.push(p))}}l.pop(),r.set(u,a)};for(const u of e.entities)(r.get(u.modelId)??o)===o&&d(u.modelId);return s}function hc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Sy(e){return e.entities.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function yc(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Ry(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=bt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Ay(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Ry(a,o))).size===1}function gc(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function Lr(e,n){const o=new Map;for(const i of e){const a=n(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=n(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function Ji(e,n){var c,d,u,m,h,p,y,b,f;const o=[],i=new Map(e.entities.map(g=>[g.modelId,g])),a=new Map(e.associations.map(g=>[g.modelId,g]));for(const g of gc(e.entities,k=>k.name))for(const k of g){const _=g.filter($=>$!==k),N=hc(k)&&_.some(hc),I=_.some($=>!_y(k,$,e));!N&&!I||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:k.modelId,params:{name:k.name,reason:N?"entity":"package"}})}for(const g of gc(Sy(e),yc))if(new Set(g.map(k=>k.name)).size!==1&&!Ay(g,e))for(const k of g)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:k.modelId,params:{name:yc(k)}});const r=e.entities.flatMap(g=>(g.indexes??[]).map(k=>({e:g,ix:k})));for(const g of Lr(r,k=>k.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:g.ix.modelId,contextRef:g.e.modelId,params:{name:g.ix.name}});for(const g of e.entities){const k=g.attributes.filter(R=>R.attrType!=="DIVIDER");if(bt(g.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:g.modelId}),g.stereotype==="JPA_ENTITY"&&!g.abstractClass&&(k.some(R=>R.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:g.modelId}),bt((c=g.table)==null?void 0:c.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:g.modelId})),g.stereotype==="JPA_EMBEDDABLE")for(const R of k.filter(x=>x.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}});for(const R of k.filter(x=>x.identifier&&x.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}});for(const R of k)if(!R.identifier)for(const x of R.dbAttrs)!x.autoIncrement&&bt(x.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:x.modelId,contextRef:g.modelId,params:x.autoIncrement?{name:R.name}:{name:R.name,seq:x.sequenceName??""}});const _=k.filter(R=>R.identifier&&!R.transient);if(_.reduce((R,x)=>R+x.dbAttrs.length,0)>=2)for(const R of _)for(const x of R.dbAttrs)!x.autoIncrement&&bt(x.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:x.modelId,contextRef:g.modelId,params:{name:R.name}});for(const R of k.filter(x=>x.naturalId&&x.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}});for(const R of k.filter(x=>x.naturalId&&x.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}});for(const R of k.filter(x=>x.naturalId&&!x.notNull&&!x.identifier&&!x.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}});!g.abstractClass&&k.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:g.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&k.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:g.modelId,params:{count:k.length,threshold:n.largeEntityThreshold}});for(const R of Lr(k,x=>x.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}});for(const R of k)if(bt(R.name)){const x=R.attrType.startsWith("RELATION")||R.attrType.startsWith("EMBED");o.push({ruleId:x?"CHK-NAME-7":"CHK-NAME-4",severity:x?"error":"info",targetKind:"attribute",targetRef:R.modelId,contextRef:g.modelId,...x?{params:{attrType:R.attrType}}:{}})}const N=k.flatMap(R=>R.dbAttrs.map((x,M)=>({attr:R,index:M,col:x,name:Ko(R,x,M,g,e,n)})).filter(x=>x.col.sharedColumnRef==null));for(const R of Lr(N,x=>x.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:R.col.modelId,contextRef:g.modelId,params:{name:R.name}});for(const R of N){if(!bt(R.name)||R.attr.transient||bt(R.attr.name)&&(R.attr.attrType.startsWith("RELATION")||R.attr.attrType.startsWith("EMBED"))||R.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const x=Li(R.attr,g,e.entities,e.associations,R.index);bt(x==null?void 0:x.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:R.col.modelId,contextRef:g.modelId,params:{name:R.attr.name}})}for(const R of N){const x=R.col,M=Br(x.physicalName);M!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:x.modelId,contextRef:g.modelId,params:{max:Wo,len:M}}),n!=null&&n.reservedWords&&!bt(x.physicalName)&&n.reservedWords.has(x.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:x.modelId,contextRef:g.modelId,params:{name:x.physicalName}}),n!=null&&n.selectableDataTypes&&!bt(x.dataType)&&!n.selectableDataTypes.has(x.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:x.modelId,contextRef:g.modelId,params:{dataType:x.dataType}});const E=R.attr.transient||x.multiValue||R.attr.attrType.startsWith("EMBED")||R.attr.attrType.startsWith("RELATION")?void 0:Yh(R.attr.type,x.dataType);E===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:x.modelId,contextRef:g.modelId,params:{type:R.attr.type,dataType:Dr(x)}}),E!==!1&&!bt(x.dataType)&&Uh.has(x.dataType)&&!x.length&&(Bn(R.attr,x,R.index,g,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:x.modelId,contextRef:g.modelId,params:{dataType:x.dataType}}))}for(const R of N)bt(R.col.dataType)&&(R.attr.transient||R.attr.attrType.startsWith("EMBED")||R.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:R.col.modelId,contextRef:g.modelId,params:{name:R.attr.name}}));if((d=n==null?void 0:n.embeddableCatalog)!=null&&d.length){const R=co(En(g,e.entities));for(const x of k){if(x.attrType!=="EMBED_PREDEF")continue;const M=n.embeddableCatalog.find(E=>E.type===x.type);M&&x.dbAttrs.forEach((E,w)=>{if(E.sharedColumnRef==null)return;const S=M.fields[w],B=R.get(E.sharedColumnRef);if(!S||!B)return;(B.dataType!==S.dataType||(B.length??null)!==(S.length??null)||(B.scale??null)!==(S.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:E.modelId,contextRef:g.modelId,params:{targetType:Dr(B),metaName:S.name,metaType:Dr(S)}})})}}for(const R of k){const x=R.dbAttrs[0];if(!(x!=null&&x.multiValue))continue;R.type===Ln&&x.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:x.modelId,contextRef:g.modelId,params:{type:R.type||"",dataType:x.dataType||""}})}for(const R of k){if(R.attrType!=="EMBED_OWN"||!R.embedded)continue;const x=i.get(R.embedded.embeddableRef);if(!x)continue;const M=a.get(R.embedded.associationRef),E=M==null?void 0:M.end1.entityRef===R.embedded.embeddableRef?M.end1:M.end2;if(E&&yo(E.multiplicity))continue;const w=x.attributes.flatMap(S=>S.dbAttrs).length;R.dbAttrs.length!==w&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name,embeddable:x.name,slots:R.dbAttrs.length,declared:w}})}const I=(u=g.table)==null?void 0:u.physicalName,$=Br(I);$!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:g.modelId,params:{max:Wo,len:$}}),n!=null&&n.reservedWords&&!bt(I)&&n.reservedWords.has(I.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:g.modelId,params:{name:I}});const C=new Set;for(const R of g.attributes){C.add(R.modelId);for(const x of R.dbAttrs)C.add(x.modelId)}const A=new Set(Ho(g,(n==null?void 0:n.superClassCatalog)??[]).map(R=>R.modelId)),T=(((m=n==null?void 0:n.superClassCatalog)==null?void 0:m.length)??0)>0,V=Mn(g.attributes);for(const R of g.indexes??[]){const x=Br(R.name);x!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:R.modelId,contextRef:g.modelId,params:{max:Wo,len:x}}),n!=null&&n.reservedWords&&!bt(R.name)&&n.reservedWords.has(R.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}});for(const M of R.columns){const E=M.columnRef;if(C.has(E)||A.has(E))continue;const w=Vn(E);w&&!T||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:R.modelId,contextRef:g.modelId,params:w?{name:R.name,field:((h=kr(E))==null?void 0:h.field)??E}:{name:R.name}})}R.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}}),new Set(R.columns.map(M=>V.canon(M.columnRef))).size!==R.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:R.modelId,contextRef:g.modelId,params:{name:R.name}})}}const l=new Map;for(const g of e.entities)for(const k of g.attributes)k.attrType==="EMBED_OWN"&&k.embedded&&l.set(k.embedded.associationRef,k);for(const g of e.associations){if(yo(g.end1.multiplicity)&&yo(g.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:g.modelId}),l.has(g.modelId)&&g.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:g.modelId}),!l.has(g.modelId)){const k=!!g.end2.attributeRef&&(((y=(p=g.end2.jpa)==null?void 0:p.cascadeTypes)==null?void 0:y.length)??0)>0,_=!!g.end1.attributeRef&&g.end1.navigable&&(((f=(b=g.end1.jpa)==null?void 0:b.cascadeTypes)==null?void 0:f.length)??0)>0;k&&_&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:g.modelId})}if(!l.has(g.modelId)&&g.end1.navigable&&g.end1.attributeRef){const k=i.get(g.end1.entityRef),_=k==null?void 0:k.attributes.some($=>$.modelId===g.end1.attributeRef),N=i.get(g.end2.entityRef),I=dc(e,g).length>0;_&&N&&I&&(g.end2.attributeRef&&N.attributes.some(C=>C.modelId===g.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:g.modelId,params:{child:N.name}}))}for(const k of["end1","end2"]){const _=g[k].jpa;if(!_)continue;const N=_.cascadeTypes??[],I=N.includes("ALL"),$=N.includes("REMOVE");I&&N.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:g.modelId,params:{which:k}}),_.orphanRemoval&&($||I)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:g.modelId,params:{which:k,cascade:I?"ALL":"REMOVE"}}),yo(g[k].multiplicity)&&_.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:g.modelId,params:{which:k}}),_.orphanRemoval&&yo(g[k==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:g.modelId,params:{which:k}}),!yo(g[k].multiplicity)&&(_.collectionType||_.collectionTable||_.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:g.modelId,params:{which:k}}),_.collectionType==="SET"&&_.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:g.modelId,params:{which:k}})}}const s=new Map(e.entities.map(g=>[g.modelId,g.name||g.modelId]));for(const g of xy(e)){const k=[...g,g[0]].map(_=>s.get(_)??_).join(" → ");for(const _ of g)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:_,params:{path:k}})}if(n!=null&&n.flagEntitiesWithoutRelations){const g=new Set;for(const _ of e.associations)g.add(_.end1.entityRef),g.add(_.end2.entityRef);const k=new Map(e.entities.map(_=>[_.name,_.modelId]));for(const _ of e.entities){for(const N of _.attributes)N.embedded&&(g.add(_.modelId),g.add(N.embedded.embeddableRef));if(!bt(_.superClass)){g.add(_.modelId);const N=k.get(_.superClass);N&&g.add(N)}}for(const _ of e.entities)g.has(_.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:_.modelId})}return o}function Or(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return $y(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}function $y(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=Mn(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const go="javax.persistence",Xe={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},Ty={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function bc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Ut(o)?null:o??Ty[n]}const Xi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function My(e){if(!e)return;if(Xi[e])return{simpleName:e,fqn:Xi[e]};const n=Object.entries(Xi).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function _c(e){return!(Ut(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Vy(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(o.skipUngeneratable!==!1&&!_c(l)||a.push(Oy(l,e,o)))}return a}class kc{constructor(){Qe(this,"imports",new Set);Qe(this,"body",[]);Qe(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${go}.${n}`)}line(n=""){this.body.push(n)}fillIn(n){this.fillIns.push(n)}render(n){const o=[`package ${n};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
16
|
+
`)}const Vr="entity-modeler-diagram",Br=1;class Ln extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function cc(e,n){return JSON.stringify({format:Vr,version:Br,logical:e,layout:n},null,2)}const Gi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ho=e=>Array.isArray(e)?e:[];function dc(e){let n;try{n=JSON.parse(e)}catch{throw new Ln("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Gi(n))throw new Ln("최상위가 객체가 아닙니다.");if(n.format!==Vr)throw new Ln(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Br)throw new Ln(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Gi(o)||!Array.isArray(o.entities))throw new Ln("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Gi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Ln("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:ho(o.associations),groups:ho(o.groups)},a=Gi(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:ho(a.entityLayouts),associationLayouts:ho(a.associationLayouts),groupLayouts:ho(a.groupLayouts),notes:ho(a.notes)};return{logical:i,layout:r}}const Ey=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function xt(e){return e.replace(Ey,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Oe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function uc(e){return`<text ${[`x="${Oe(e.x)}"`,`y="${Oe(e.y)}"`,`fill="${xt(e.fill)}"`,`font-size="${Oe(e.fontSize)}"`,e.fontFamily?`font-family="${xt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${xt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${xt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${xt(e.text)}</text>`}function Ny(e){return`<line x1="${Oe(e.x1)}" y1="${Oe(e.y)}" x2="${Oe(e.x2)}" y2="${Oe(e.y)}" stroke="${xt(e.stroke)}" stroke-width="${Oe(e.strokeWidth??1)}" />`}function wy(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 Iy(e,n,o,i,a){return[`M${Oe(e+a.tl)},${Oe(n)}`,`L${Oe(e+o-a.tr)},${Oe(n)}`,a.tr?`Q${Oe(e+o)},${Oe(n)} ${Oe(e+o)},${Oe(n+a.tr)}`:"",`L${Oe(e+o)},${Oe(n+i-a.br)}`,a.br?`Q${Oe(e+o)},${Oe(n+i)} ${Oe(e+o-a.br)},${Oe(n+i)}`:"",`L${Oe(e+a.bl)},${Oe(n+i)}`,a.bl?`Q${Oe(e)},${Oe(n+i)} ${Oe(e)},${Oe(n+i-a.bl)}`:"",`L${Oe(e)},${Oe(n+a.tl)}`,a.tl?`Q${Oe(e)},${Oe(n)} ${Oe(e+a.tl)},${Oe(n)}`:"","Z"].filter(Boolean).join(" ")}function Dr(e){const n=wy(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${xt(e.fill)}"`,`stroke="${xt(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${xt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Oe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Iy(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Oe(e.x)}" y="${Oe(e.y)}" width="${Oe(e.w)}" height="${Oe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Ny(l));for(const l of e.texts)r.push(uc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function vy(e){const o=[`<path ${[`d="${xt(e.d)}"`,'fill="none"',`stroke="${xt(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${xt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(uc(i));return`<g>${o.join("")}</g>`}function mc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Oe(n)}" y="${Oe(o)}" width="${Oe(i)}" height="${Oe(a)}" fill="${xt(e.background)}" />`);for(const l of e.groups)r.push(Dr(l));for(const l of e.edges)r.push(vy(l));for(const l of e.entities)r.push(Dr(l));for(const l of e.notes)r.push(Dr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Oe(n)} ${Oe(o)} ${Oe(i)} ${Oe(a)}" width="${Oe(i)}" height="${Oe(a)}">`+r.join("")+"</svg>"}function Yi(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function xy(e,n,o){const i=Yi(e,o),a=Yi(n,o);return i.kind===a.kind&&i.value!==a.value}const Or=()=>crypto.randomUUID(),fc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Cy=e=>e&&e[0].toLowerCase()+e.slice(1),Sy=e=>e&&e[0].toUpperCase()+e.slice(1),pc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Ry(e,n){return Cy(e??"")+Sy(n??"")}function Ay(e,n){const o=co(e.name,n);return o===e.name?e:{...e,name:o,dbAttrs:e.dbAttrs.map(i=>({...i,physicalName:pc(o)}))}}function hc(e,n){const o=e.entities.find(s=>s.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!Us(n.end1.multiplicity);return o.attributes.filter(s=>s.identifier&&(s.attrType==="NORMAL"||s.attrType==="RELATION_OWN")).sort((s,c)=>s.order-c.order).map(s=>{const c=Ry(o.name,s.name);return{associationRef:n.modelId,sourceAttributeRef:s.modelId,name:c,type:s.type,identifier:a,notNull:r,dbAttrs:s.dbAttrs.map(d=>({physicalName:pc(c),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const qi=(e,n)=>`${e}::${n}`,Wi=e=>e??void 0;function $y(e,n,o){const i={};return e.type!==n.type&&(i.type=n.type),e.identifier!==n.identifier&&(i.identifier=n.identifier),e.notNull!==n.notNull&&(i.notNull=n.notNull),(e.dbAttrs.length!==n.dbAttrs.length||n.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||Wi(s.length)!==Wi(r.length)||Wi(s.scale)!==Wi(r.scale)}))&&(i.dbAttrs=n.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function Ty(e,n,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:n,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function Wo(e,n,o=Or){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(f=>hc(e,f)),s=new Map(l.map(f=>[qi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[qi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=qi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let p=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of l){const h=qi(f.associationRef,f.sourceAttributeRef),g=d.get(h);if(g){const k=$y(g,f,o);k&&i.update.push({attributeId:g.modelId,patch:k})}else{const k=Ay(f,m);m.add(k.name),i.add.push(Ty(k,p++,o))}}return i}function yc(e,n){if(n.remove.length){const o=new Set(n.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of n.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}n.add.length&&e.attributes.push(...n.add)}function My(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function gc(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function bc(e,n,o=Or){const i=new Map,a=My(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(p=>p.end1.entityRef===d).map(p=>p.end2.entityRef));for(const p of m){const f=Wo(a,p,o);if(fc(f))continue;const h=i.get(p);i.set(p,h?gc(h,f):f);const g=a.entities.find(k=>k.modelId===p);g&&yc(g,f),r.has(p)||(r.add(p),c.push(p))}}return i}function _c(e,n,o=Or){const i=[],a=Wo(e,n,o);let r=e;fc(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return yc(s,a),s})});for(const[l,s]of bc(r,n,o))i.push({entityId:l,plan:s});return i}function Ji(e,n,o){var l;const i=e.entities.find(s=>s.modelId===n),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!Oi(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const Jo=63;function Lr(e){if(!e)return null;const n=e.length;return n>Jo?n:null}function Pr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function bt(e){return!e||e.trim()===""}function yo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Vy(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const p=o.get(m.end1.entityRef)??[];p.push(m.end2.entityRef),o.set(m.end1.entityRef,p)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const p of o.get(m)??[]){const f=l.get(p)??i;if(f===i)u(p);else if(f===a){const h=s.slice(s.indexOf(p)),g=[...h].sort().join(" ");d.has(g)||(d.add(g),c.push(h))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function kc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function By(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function Ec(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Dy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=bt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Oy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Dy(a,o))).size===1}function Nc(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function zr(e,n){const o=new Map;for(const i of e){const a=n(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=n(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function Xi(e,n){var m,p,f,h,g,k,N,b,_;const o=[],i=new Map(e.entities.map(E=>[E.modelId,E])),a=new Map(e.associations.map(E=>[E.modelId,E])),r=wr(e),l=r.size===0?e.entities:Hs(e),s=js(e,r);for(const E of Nc(l,I=>I.name))for(const I of E){const A=E.filter(x=>x!==I),T=kc(I)&&A.some(kc),L=A.some(x=>!xy(I,x,e));!T&&!L||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:I.modelId,params:{name:I.name,reason:T?"entity":"package"}})}for(const E of Nc(By(l),Ec))if(new Set(E.map(I=>I.name)).size!==1&&!Oy(E,e))for(const I of E)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:I.modelId,params:{name:Ec(I)}});const c=l.flatMap(E=>(E.indexes??[]).map(I=>({e:E,ix:I})));for(const E of zr(c,I=>I.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:E.ix.modelId,contextRef:E.e.modelId,params:{name:E.ix.name}});for(const E of l){const I=E.attributes.filter(y=>y.attrType!=="DIVIDER");if(bt(E.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:E.modelId}),E.stereotype==="JPA_ENTITY"&&!E.abstractClass&&(I.some(y=>y.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:E.modelId}),bt((m=E.table)==null?void 0:m.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:E.modelId})),E.stereotype==="JPA_EMBEDDABLE")for(const y of I.filter(w=>w.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.identifier&&w.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I)if(!y.identifier)for(const w of y.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:w.autoIncrement?{name:y.name}:{name:y.name,seq:w.sequenceName??""}});const A=I.filter(y=>y.identifier&&!y.transient);if(A.reduce((y,w)=>y+w.dbAttrs.length,0)>=2)for(const y of A)for(const w of y.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&w.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&w.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&!w.notNull&&!w.identifier&&!w.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});!E.abstractClass&&I.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:E.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&I.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:E.modelId,params:{count:I.length,threshold:n.largeEntityThreshold}});for(const y of zr(I,w=>w.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I)if(bt(y.name)){const w=y.attrType.startsWith("RELATION")||y.attrType.startsWith("EMBED");o.push({ruleId:w?"CHK-NAME-7":"CHK-NAME-4",severity:w?"error":"info",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,...w?{params:{attrType:y.attrType}}:{}})}const T=I.flatMap(y=>y.dbAttrs.map((w,v)=>({attr:y,index:v,col:w,name:Go(y,w,v,E,e,n)})).filter(w=>w.col.sharedColumnRef==null));for(const y of zr(T,w=>w.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of T){if(!bt(y.name)||y.attr.transient||bt(y.attr.name)&&(y.attr.attrType.startsWith("RELATION")||y.attr.attrType.startsWith("EMBED"))||y.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const w=Li(y.attr,E,e.entities,e.associations,y.index);bt(w==null?void 0:w.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.attr.name}})}for(const y of T){const w=y.col,v=Lr(w.physicalName);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{max:Jo,len:v}}),n!=null&&n.reservedWords&&!bt(w.physicalName)&&n.reservedWords.has(w.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{name:w.physicalName}}),n!=null&&n.selectableDataTypes&&!bt(w.dataType)&&!n.selectableDataTypes.has(w.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{dataType:w.dataType}});const M=y.attr.transient||w.multiValue||y.attr.attrType.startsWith("EMBED")||y.attr.attrType.startsWith("RELATION")?void 0:ey(y.attr.type,w.dataType);M===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{type:y.attr.type,dataType:Pr(w)}}),M!==!1&&!bt(w.dataType)&&Wh.has(w.dataType)&&!w.length&&(Vn(y.attr,w,y.index,E,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{dataType:w.dataType}}))}for(const y of T)bt(y.col.dataType)&&(y.attr.transient||y.attr.attrType.startsWith("EMBED")||y.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.attr.name}}));if((p=n==null?void 0:n.embeddableCatalog)!=null&&p.length){const y=so(kn(E,e.entities));for(const w of I){if(w.attrType!=="EMBED_PREDEF")continue;const v=n.embeddableCatalog.find(M=>M.type===w.type);v&&w.dbAttrs.forEach((M,D)=>{if(M.sharedColumnRef==null)return;const U=v.fields[D],W=y.get(M.sharedColumnRef);if(!U||!W)return;(W.dataType!==U.dataType||(W.length??null)!==(U.length??null)||(W.scale??null)!==(U.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:M.modelId,contextRef:E.modelId,params:{targetType:Pr(W),metaName:U.name,metaType:Pr(U)}})})}}for(const y of I){const w=y.dbAttrs[0];if(!(w!=null&&w.multiValue))continue;y.type===Dn&&w.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{type:y.type||"",dataType:w.dataType||""}})}for(const y of I){if(y.attrType!=="EMBED_OWN"||!y.embedded)continue;const w=i.get(y.embedded.embeddableRef);if(!w)continue;const v=a.get(y.embedded.associationRef),M=v==null?void 0:v.end1.entityRef===y.embedded.embeddableRef?v.end1:v.end2;if(M&&yo(M.multiplicity))continue;const D=w.attributes.flatMap(U=>U.dbAttrs).length;y.dbAttrs.length!==D&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name,embeddable:w.name,slots:y.dbAttrs.length,declared:D}})}const L=(f=E.table)==null?void 0:f.physicalName,x=Lr(L);x!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:E.modelId,params:{max:Jo,len:x}}),n!=null&&n.reservedWords&&!bt(L)&&n.reservedWords.has(L.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:E.modelId,params:{name:L}});const R=new Set;for(const y of E.attributes){R.add(y.modelId);for(const w of y.dbAttrs)R.add(w.modelId)}const $=new Set(jo(E,(n==null?void 0:n.superClassCatalog)??[]).map(y=>y.modelId)),B=(((h=n==null?void 0:n.superClassCatalog)==null?void 0:h.length)??0)>0,O=Tn(E.attributes);for(const y of E.indexes??[]){const w=Lr(y.name);w!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{max:Jo,len:w}}),n!=null&&n.reservedWords&&!bt(y.name)&&n.reservedWords.has(y.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const v of y.columns){const M=v.columnRef;if(R.has(M)||$.has(M))continue;const D=Mn(M);D&&!B||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:D?{name:y.name,field:((g=Er(M))==null?void 0:g.field)??M}:{name:y.name}})}y.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}}),new Set(y.columns.map(v=>O.canon(v.columnRef))).size!==y.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}})}}const d=new Map;for(const E of e.entities)for(const I of E.attributes)I.attrType==="EMBED_OWN"&&I.embedded&&d.set(I.embedded.associationRef,I);for(const E of s){if(yo(E.end1.multiplicity)&&yo(E.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:E.modelId}),d.has(E.modelId)&&E.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:E.modelId}),!d.has(E.modelId)){const I=!!E.end2.attributeRef&&(((N=(k=E.end2.jpa)==null?void 0:k.cascadeTypes)==null?void 0:N.length)??0)>0,A=!!E.end1.attributeRef&&E.end1.navigable&&(((_=(b=E.end1.jpa)==null?void 0:b.cascadeTypes)==null?void 0:_.length)??0)>0;I&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:E.modelId})}if(!d.has(E.modelId)&&E.end1.navigable&&E.end1.attributeRef){const I=i.get(E.end1.entityRef),A=I==null?void 0:I.attributes.some(x=>x.modelId===E.end1.attributeRef),T=i.get(E.end2.entityRef),L=hc(e,E).length>0;A&&T&&L&&(E.end2.attributeRef&&T.attributes.some(R=>R.modelId===E.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:E.modelId,params:{child:T.name}}))}for(const I of["end1","end2"]){const A=E[I].jpa;if(!A)continue;const T=A.cascadeTypes??[],L=T.includes("ALL"),x=T.includes("REMOVE");L&&T.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.orphanRemoval&&(x||L)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:E.modelId,params:{which:I,cascade:L?"ALL":"REMOVE"}}),yo(E[I].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.orphanRemoval&&yo(E[I==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:E.modelId,params:{which:I}}),!yo(E[I].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}})}}const u=new Map(e.entities.map(E=>[E.modelId,E.name||E.modelId]));for(const E of Vy(l,s)){const I=[...E,E[0]].map(A=>u.get(A)??A).join(" → ");for(const A of E)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:I}})}if(n!=null&&n.flagEntitiesWithoutRelations){const E=new Set;for(const A of e.associations)E.add(A.end1.entityRef),E.add(A.end2.entityRef);const I=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const T of A.attributes)T.embedded&&(E.add(A.modelId),E.add(T.embedded.embeddableRef));if(!bt(A.superClass)){E.add(A.modelId);const T=I.get(A.superClass);T&&E.add(T)}}for(const A of l)E.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function Fr(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return Ly(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}function Ly(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=Tn(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const go="javax.persistence",Je={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},Py={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function wc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Ut(o)?null:o??Py[n]}const Zi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function zy(e){if(!e)return;if(Zi[e])return{simpleName:e,fqn:Zi[e]};const n=Object.entries(Zi).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function Ic(e){return!(Ut(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Fy(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(uo(l)||o.skipUngeneratable!==!1&&!Ic(l)||a.push(Ky(l,e,o)))}return a}class vc{constructor(){Xe(this,"imports",new Set);Xe(this,"body",[]);Xe(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${go}.${n}`)}line(n=""){this.body.push(n)}fillIn(n){this.fillIns.push(n)}render(n){const o=[`package ${n};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
17
17
|
`)+`
|
|
18
|
-
`}}function
|
|
18
|
+
`}}function xc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Uy(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function bo(e,n){n&&(e.import(Je.lombokGetter),e.line(" @Getter"))}const Hy=["ko","en","ja","zh"];function Ur(e,n){if(!e)return[];const o=Hy.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${n} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${n}/**`,`${n} * <ul>`,...o,`${n} * </ul>`,`${n} */`]}function Qi(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...qo,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Dn){if(i){const c=[`${go}.Enumerated`,`${go}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${go}.Enumerated`,`${go}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===tn){const c=zy(n),d=c?`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${n??"(미지정)"}`;return{...a,type:n||"Object",fillIns:[d]}}if(e==="CustomMoneyType"){const c=wc(o,"money");return{type:"Money",primitive:!1,imports:c?[Je.money,`${go}.Convert`]:[Je.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=Zi[e];if(s)return{type:e,primitive:!1,imports:[s,Je.jdbcTypeCode,Je.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const c=l.label,d=[],u=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),u.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:l.boxed!=null,imports:d,fieldAnnotations:[],fillIns:u}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function Cc(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function Hr(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return Qi(e.type,e.customType,o,e.groupCode).type;const a=n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return Qi(e.type,e.customType,o).type;const r=Cc(a);return r.length>=2?`${a.name}PK`:r.length===1?Hr(r[0],n,o,new Set([...i,a.modelId])):Qi(e.type,e.customType,o).type}function jy(e,n,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!n)return!1;const i=!Kr(n.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function Ky(e,n,o){var x,R,$,B,O,y;if(e.stereotype==="JPA_EMBEDDABLE")return Gy(e,n,o);const i=new vc,a=e.name;let r=Xo(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ea}')`),r=ea);const l=new Map(n.entities.map(w=>[w.modelId,w])),s=r,c=ag(e,o,i),d=new Map;for(const w of n.associations)w.end2.attributeRef&&d.set(w.end2.attributeRef,{assoc:w,role:"owner"}),w.end1.attributeRef&&w.end1.navigable&&d.set(w.end1.attributeRef,{assoc:w,role:"inverse"});const u=Cc(e),m=new Set(u.filter(w=>w.attrType==="NORMAL").flatMap(w=>w.dbAttrs.map(v=>v.physicalName)).filter(Boolean)),p=new Set;for(const w of u)jy(w,(x=d.get(w.modelId))==null?void 0:x.assoc,m)&&p.add(w.modelId);const f=u.filter(w=>!p.has(w.modelId)),h=f.length>=2,g=f.length===1,k=`${a}PK`,N=w=>p.has(w.modelId)?"mapsId":w.identifier?"id":"none",b=o.lombok!==!1;i.jpa("Entity"),i.import(Je.jsonIdentityInfo),i.import(Je.jsogGenerator);const _=["@Entity"];_.push(Zy(e,n,o,i)),_.push('@SuppressWarnings("serial")'),_.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),h&&(i.jpa("IdClass"),i.import(`${r}.${a}.${k}`),_.push(`@IdClass(${a}.${k}.class)`)),(R=e.jpaAttrs)!=null&&R.useDynamicInsert&&(_.push("@DynamicInsert"),i.import(Je.dynamicInsert)),($=e.jpaAttrs)!=null&&$.useDynamicUpdate&&(_.push("@DynamicUpdate"),i.import(Je.dynamicUpdate)),(B=e.jpaAttrs)!=null&&B.useCacheable&&(_.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(Yy),_.push("@PersonalInfo")),b&&(i.import(Je.lombokNoArgs),i.import(Je.lombokAccessLevel),_.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const w of Ur((O=e.table)==null?void 0:O.logicalName,""))i.line(w);for(const w of _)i.line(w);const E=e.abstractClass?"abstract ":"";i.line(`public ${E}class ${a}${c}${Ac(e,i)} {`);const I=e.attributes.filter(w=>w.attrType!=="DIVIDER").sort((w,v)=>w.order-v.order),A=(y=e.jpaAttrs)!=null&&y.useVersion?u.length?u[u.length-1].modelId:null:void 0,T=[];for(const w of I){if(w.attrType.startsWith("EMBED"))T.push(...Vc(w,e,n,o,i));else if(w.attrType==="RELATION_OWN"){const v=d.get(w.modelId);if(v){const M=ng(w,v.assoc,s,l,N(w),b,n,o,i);M&&T.push(M)}else eg(w,e,new Set(d.keys()))||i.fillIn(`${e.name}.${w.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`)}else if(w.attrType==="RELATION_REF"){const v=d.get(w.modelId),M=v?og(w,v.assoc,s,l,b,n,o,i):null;M&&T.push(M)}else T.push(Tc(w,a,o,i));w.modelId===A&&Sc(i,T,b)}A===null&&Sc(i,T,b),b||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Rc(T,i,b),$c(e,i),h&&(i.import(Je.jsonBackReference),i.import(Je.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${k} getPK() {`),i.line(` return (${k}) HibernateBeanUtil.getPK(this);`),i.line(" }"),rg(k,f.map(w=>({type:Hr(w,n,o),name:w.name})),b,i)),i.line("}");let L;return h?L=lg(a,k,r):g&&(L=sg(a,r,Hr(f[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:L}}function Sc(e,n,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||n.push({type:"int",name:"dataVersion",category:0})}function Rc(e,n,o){const i=e.map((a,r)=>({g:a,i:r})).sort((a,r)=>a.g.category-r.g.category||a.i-r.i);for(const{g:a}of i){if(o&&!a.collection)continue;n.line(""),n.line(` public ${a.type} get${xc(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(n.import("java.util.Collections"),n.line(` return Collections.${r}(this.${a.name});`)):n.line(` return ${a.name};`),n.line(" }")}}function Gy(e,n,o){var d;const i=new vc,a=e.name;let r=Xo(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ea}')`),r=ea),i.jpa("Embeddable"),i.import(Je.jsonIdentityInfo),i.import(Je.jsogGenerator),i.import(Je.serializable);for(const u of Ur((d=e.table)==null?void 0:d.logicalName,""))i.line(u);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)");const l=e.abstractClass?"abstract ":"";i.line(`public ${l}class ${a}${Ac(e,i,["Serializable"])} {`);const s=e.attributes.filter(u=>u.attrType!=="DIVIDER").sort((u,m)=>u.order-m.order),c=[];for(const u of s){if(u.attrType.startsWith("EMBED")){c.push(...Vc(u,e,n,o,i));continue}c.push(Tc(u,a,o,i))}return Rc(c,i,o.lombok!==!1),$c(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Ac(e,n,o=[]){const i=(e.declarationOfInterfaces??[]).map(s=>s.trim()).filter(Boolean),a=new Set(i.filter(s=>!s.includes("."))),r=[...i].sort().map(s=>{if(!s.includes("."))return s;const c=s.slice(s.lastIndexOf(".")+1);return a.has(c)?s:(n.import(s),c)}),l=[...o,...r];return l.length?` implements ${l.join(", ")}`:""}const Yy="net.g1project.bluecomm.annotation.PersonalInfo",qy="net.g1project.bluecomm.annotation.PersonalInfoAttribute",Wy="net.g1project.bluecomm.model.PersonalInfoAttributeType";function $c(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Ut(i.name)||Ut(a))continue;const r=a.replace(/\r\n/g,`
|
|
19
19
|
`).split(`
|
|
20
|
-
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(
|
|
20
|
+
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(qy),n.import(Wy),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function Tc(e,n,o,i){const a=e.dbAttrs[0],r=e.name||Uy(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${n}.${r}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const l=Qi(e.type,e.customType,o,e.groupCode);for(const u of l.imports)i.import(u);for(const u of l.fillIns)i.fillIn(`${n}.${r}: ${u}`);const s=(a==null?void 0:a.multiValue)===!0,c=s?`Set<${l.type}>`:l.type;s&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${n}.${r}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const u of Ur(a==null?void 0:a.logicalName," "))i.line(u);e.identifier&&(i.jpa("Id"),i.line(" @Id"),a!=null&&a.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(Je.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${ig(e,a,i)}`);for(const u of l.fieldAnnotations)i.line(` ${u}`);const d=!s&&(a==null?void 0:a.dataType)==="VARCHAR"?e.type==="PrimitiveBoolean"?"booleanYnPrimitive":e.type==="Boolean"?"booleanYnBoxed":null:null;if(d){const u=wc(o,d);u?(i.jpa("Convert"),i.line(` @Convert(converter = ${u}.class)`)):i.fillIn(`${n}.${r}: Y/N 문자 플래그 컨버터 비활성(converterCatalog) — boolean × VARCHAR 매핑 @Convert 손채움 필요`)}return s?(i.line(` // TODO [손채움]: ${r} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),bo(i,o.lombok!==!1),i.line(` private ${c} ${r} = new LinkedHashSet<>();`)):(bo(i,o.lombok!==!1),i.line(` private ${c} ${r};`)),{type:c,name:r,category:0}}function Mc(e,n,o){var r,l;if(e.attrType==="EMBED_PREDEF"){const s=(r=o.embeddableCatalog)==null?void 0:r.find(c=>c.type===e.type);return e.dbAttrs.map((c,d)=>{var u,m;return{fieldName:((u=s==null?void 0:s.fields[d])==null?void 0:u.name)??"",defaultPhysical:((m=s==null?void 0:s.fields[d])==null?void 0:m.physicalName)??""}})}const i=(l=e.embedded)!=null&&l.embeddableRef?n.entities.find(s=>s.modelId===e.embedded.embeddableRef):void 0,a=[];if(i)for(const s of i.attributes.filter(c=>c.attrType!=="DIVIDER"))for(const c of s.dbAttrs)c.physicalName&&a.push({fieldName:s.name,defaultPhysical:c.physicalName});return a}function Jy(e,n,o,i,a){const r=so(kn(n,o.entities)),l=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],u=Bn(s,r);if(!d||!d.fieldName){(u||s.physicalName&&s.physicalName!==(d==null?void 0:d.defaultPhysical))&&a.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${c}] @AttributeOverride 필드명 미해소(카탈로그/임베더블 확인)`);return}if(u){l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${u.physicalName}", insertable = false, updatable = false))`);return}const m=s.physicalName||d.defaultPhysical;m&&m!==d.defaultPhysical&&l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${m}"))`)}),l}function Ut(e){return!e||e.trim()===""}function Vc(e,n,o,i,a){var m,p,f,h;const r=n.name,l=Xo(n,o,i);if(Ut(e.name))return a.fillIn(`${r} 임베드: 속성명(필드명) 미지정 — @Embedded/@ElementCollection 방출 불가, 속성명을 채워야 함`),[];let s=e.type;if(e.attrType==="EMBED_OWN"){const g=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(k=>k.modelId===e.embedded.embeddableRef):void 0;if(g){s=g.name;const k=Xo(g,o,i);k&&k!==l&&a.import(`${k}.${g.name}`)}}if(Ut(s))return a.fillIn(`${r}.${e.name}: 임베드 대상 타입 미해소 — @Embedded/@ElementCollection 방출 불가`),[];if(e.type==="Money")return[Xy(e,n,o,i,a)];const c=Mc(e,o,i),d=Jy(e,n,o,c,a),u=Ar(e,o.associations);if(a.line(""),u){const g=o.associations.find(I=>{var A;return I.modelId===((A=e.embedded)==null?void 0:A.associationRef)}),k=g?g.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?g.end2:g.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const N=(f=k==null?void 0:k.jpa)==null?void 0:f.collectionTable;N?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${N}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),jr(d,a);const b=u==="SET";!b&&((h=k==null?void 0:k.jpa)!=null&&h.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${k.jpa.orderColumn}")`)),a.import(b?"java.util.Set":"java.util.List"),a.import(b?"java.util.LinkedHashSet":"java.util.ArrayList");const _=b?`Set<${s}>`:`List<${s}>`,E=b?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${_} ${e.name} = ${E};`),[{type:_,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),jr(d,a),bo(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function Xy(e,n,o,i,a){a.jpa("Embedded"),a.import(Je.compositeType),a.import(Je.money),a.import(Je.moneyUserType);const r=Mc(e,o,i),l=so(kn(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var k,N;const u=((k=r[d])==null?void 0:k.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),m=Bn(c,l),p=((N=r[d])==null?void 0:N.defaultPhysical)||"",f=c.physicalName||"",h=c.insertable===!1||c.updatable===!1;if(!m&&!h&&(!f||f===p))return[];const g=[`name = "${m?m.physicalName:f||p}"`];return e.notNull&&g.push("nullable = false"),m?g.push("insertable = false","updatable = false"):(c.insertable===!1&&g.push("insertable = false"),c.updatable===!1&&g.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${g.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),jr(s,a),bo(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function jr(e,n){e.length!==0&&(n.jpa("AttributeOverride"),n.jpa("AttributeOverrides"),n.jpa("Column"),n.line(" @AttributeOverrides({"),e.forEach((o,i)=>n.line(` ${o}${i<e.length-1?",":""}`)),n.line(" })"))}function Zy(e,n,o,i){var m;i.jpa("Table");const a=((m=e.table)==null?void 0:m.physicalName)??"",r=e.indexes??[];if(r.length===0)return`@Table(name = "${a}")`;const l={embeddableCatalog:o.embeddableCatalog},s=new Map;for(const p of e.attributes)p.dbAttrs.forEach((f,h)=>s.set(f.modelId,Go(p,f,h,e,n,l)));for(const p of jo(e,o.superClassCatalog??[]))s.set(p.modelId,p.physicalName);const c=Tn(e.attributes),d=[];for(const p of r){const f=[];for(const g of p.columns){const k=s.get(c.canon(g.columnRef));if(!k){i.fillIn(`${e.name}.@Index(${p.name}): 컬럼 참조 미해소(${$s(c,g.columnRef)}) — 카탈로그 확인`);continue}f.includes(k)||f.push(k)}if(!f.length)continue;const h=p.unique?", unique = true":"";d.push(`@Index(name = "${p.name}", columnList = "${f.join(", ")}"${h})`)}if(d.length===0)return`@Table(name = "${a}")`;if(i.jpa("Index"),d.length===1)return`@Table(name = "${a}", indexes = { ${d[0]} })`;const u=d.map(p=>` ${p}`).join(`,
|
|
21
21
|
`);return`@Table(name = "${a}", indexes = {
|
|
22
22
|
${u}
|
|
23
|
-
})`}function
|
|
23
|
+
})`}function Kr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Qy(e,n,o,i=0){var r,l;const a=o.get(n.end1.entityRef);if(e.derivedFrom){const s=a==null?void 0:a.attributes.find(c=>c.modelId===e.derivedFrom.sourceAttributeRef);if(s!=null&&s.dbAttrs[i])return s.dbAttrs[i].physicalName;if(s&&i>0)return(r=Bc(a)[i])==null?void 0:r.physicalName}return(l=Bc(a)[i])==null?void 0:l.physicalName}function eg(e,n,o){var a;const i=(a=e.derivedFrom)==null?void 0:a.associationRef;return i?n.attributes.some(r=>{var l;return r.modelId!==e.modelId&&r.attrType==="RELATION_OWN"&&((l=r.derivedFrom)==null?void 0:l.associationRef)===i&&o.has(r.modelId)}):!1}function Bc(e){return((e==null?void 0:e.attributes)??[]).filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).slice().sort((n,o)=>n.order-o.order).flatMap(n=>n.dbAttrs)}function tg(e,n,o,i){const a=n.modelId,r=o.attributes.filter(c=>{var d;return c.attrType==="RELATION_OWN"&&((d=c.derivedFrom)==null?void 0:d.associationRef)===a});if(r.length<=1)return[e];const l=i.get(n.end1.entityRef),s=c=>{const d=l==null?void 0:l.attributes.find(u=>{var m;return u.modelId===((m=c.derivedFrom)==null?void 0:m.sourceAttributeRef)});return d?d.order:Number.MAX_SAFE_INTEGER};return r.slice().sort((c,d)=>s(c)-s(d)||c.order-d.order)}function Dc(e,n,o,i,a){if(!e)return;const r=Xo(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function ng(e,n,o,i,a,r,l,s,c){var N;const d=i.get(n.end1.entityRef),u=(d==null?void 0:d.name)??n.end1.entityRef;if(Ut(e.name)||Ut(u))return c.fillIn(`${u||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @ManyToOne/@OneToOne 방출 불가`),null;const m=Kr(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),Dc(d,o,l,s,c);const p=n.end2.jpa,f=[];e.notNull&&f.push("optional = false"),p!=null&&p.fetchType&&(c.jpa("FetchType"),f.push(`fetch = FetchType.${p.fetchType}`)),(N=p==null?void 0:p.cascadeTypes)!=null&&N.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${p.cascadeTypes.map(b=>`CascadeType.${b}`).join(", ")} }`)),c.jpa("JoinColumn");const h=i.get(n.end2.entityRef),g=h?tg(e,n,h,i):[e],k=[];for(const b of g){const _=Math.max(1,b.dbAttrs.length);for(let E=0;E<_;E++){const I=b.dbAttrs[E],A=Qy(b,n,i,E),T=(I==null?void 0:I.physicalName)||A||"",L=[];T?L.push(`name = "${T}"`):c.fillIn(`${(h==null?void 0:h.name)??""}.${b.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),A&&L.push(`referencedColumnName = "${A}"`),b.notNull&&L.push("nullable = false"),(I==null?void 0:I.insertable)===!1&&L.push("insertable = false"),(I==null?void 0:I.updatable)===!1&&L.push("updatable = false"),k.push(`@JoinColumn(${L.join(", ")})`)}}return c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${f.length?`(${f.join(", ")})`:""}`),k.length===1?c.line(` ${k[0]}`):(c.jpa("JoinColumns"),c.line(` @JoinColumns({${k[0]},`),k.slice(1).forEach((b,_)=>{const E=_===k.length-2;c.line(` ${b}${E?"})":","}`)})),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),bo(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function og(e,n,o,i,a,r,l,s){const c=i.get(n.end2.entityRef),d=(c==null?void 0:c.name)??n.end2.entityRef;if(Ut(e.name)||Ut(d))return s.fillIn(`${d||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @OneToMany/@OneToOne 방출 불가`),null;const u=c==null?void 0:c.attributes.find(I=>I.modelId===n.end2.attributeRef),m=(u==null?void 0:u.name)??"";if(!m)return s.fillIn(`${e.name}: 반대편(${d})에 대응 관계 속성이 없어 @OneToMany/@OneToOne(mappedBy) 방출 불가 — 자식에 FK 속성을 만들거나 관계를 단방향으로 정리 필요(CHK-JPA-19)`),null;Dc(c,o,r,l,s);const p=Kr(n.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),bo(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const f=n.end1.jpa,h=n.end1.composition||n.end2.composition;let g=(f==null?void 0:f.cascadeTypes)??[],k=f==null?void 0:f.orphanRemoval;h&&g.length===0&&(g=["ALL"],k==null&&(k=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const N=[`mappedBy = "${m}"`];g.length&&(s.jpa("CascadeType"),N.push(`cascade = { ${g.map(I=>`CascadeType.${I}`).join(", ")} }`)),k&&N.push("orphanRemoval = true"),f!=null&&f.fetchType&&(s.jpa("FetchType"),N.push(`fetch = FetchType.${f.fetchType}`)),s.line(` @OneToMany(${N.join(", ")})`),f!=null&&f.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${f.orderBy}")`));const b=(f==null?void 0:f.collectionType)==="SET";s.import(b?"java.util.Set":"java.util.List"),s.import(b?"java.util.LinkedHashSet":"java.util.ArrayList");const _=b?`Set<${d}>`:`List<${d}>`,E=b?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${_} ${e.name} = ${E};`),{type:_,name:e.name,category:1,collection:!0}}function ig(e,n,o){o.jpa("Column");const i=[`name = "${(n==null?void 0:n.physicalName)??""}"`];if(e.notNull&&i.push("nullable = false"),n){const a=Sr.has(n.dataType);n.length!=null&&i.push(a?`precision = ${n.length}`:`length = ${n.length}`),n.scale!=null&&i.push(`scale = ${n.scale}`),n.insertable===!1&&i.push("insertable = false"),n.updatable===!1&&i.push("updatable = false"),n.unique&&i.push("unique = true")}return`@Column(${i.join(", ")})`}function ag(e,n,o){var l;const i=n.superClassCatalog??[],a=e.superClass||((l=i.find(s=>s.default))==null?void 0:l.name);if(!a||a==="Object")return"";const r=i.find(s=>s.name===a);return r!=null&&r.packageName?o.import(`${r.packageName}.${r.name}`):o.fillIn(`${e.name}: superClass '${a}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${a}`}function rg(e,n,o,i){i.import(Je.serializable),i.import(Je.objects),i.import(Je.jsonUtils),o&&i.import(Je.lombokGetter),i.line(""),i.line(` public static class ${e} implements Serializable {`);for(const a of n)i.line(""),o&&i.line(" @Getter"),i.line(` private ${a.type} ${a.name};`);i.line(""),i.line(` protected ${e}() {`),i.line(" }"),i.line(""),i.line(` public ${e}(${n.map(a=>`${a.type} ${a.name}`).join(", ")}) {`);for(const a of n)i.line(` this.${a.name} = ${a.name};`);if(i.line(" }"),!o)for(const a of n)i.line(""),i.line(` public ${a.type} get${xc(a.name)}() {`),i.line(` return ${a.name};`),i.line(" }");i.line(""),i.line(" @Override"),i.line(" public int hashCode() {"),i.line(` return Objects.hash(${n.map(a=>a.name).join(", ")});`),i.line(" }"),i.line(""),i.line(" @Override"),i.line(" public boolean equals(Object obj) {"),i.line(" if (this == obj) {"),i.line(" return true;"),i.line(" }"),i.line(" if (obj == null) {"),i.line(" return false;"),i.line(" }"),i.line(" if (getClass() != obj.getClass()) {"),i.line(" return false;"),i.line(" }"),i.line(` ${e} other = (${e}) obj;`),i.line(` return ${n.map(a=>`Objects.equals(this.${a.name}, other.${a.name})`).join(" && ")};`),i.line(" }"),i.line(""),i.line(` public static ${e} getPK(String stringId) {`),i.line(` return JSONUtils.readValue(stringId, ${e}.class);`),i.line(" }"),i.line(" }")}function lg(e,n,o){const i=[`${o}.${e}`,`${o}.${e}.${n}`,Je.jpaRepository,Je.querydslExecutor].sort(),a=[`package ${o};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${n}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
24
24
|
`)+`
|
|
25
|
-
`}}function
|
|
25
|
+
`}}function sg(e,n,o){const i=[`${n}.${e}`,Je.jpaRepository,Je.querydslExecutor].sort(),a=[`package ${n};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
26
26
|
`)+`
|
|
27
|
-
`}}const Qi="com.example",ng="command.domain";function Jo(e,n,o={}){const i=Gi(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??ng,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const og="CustomMoneyType",ig="Money";function ag(e){return!(e.type!==og||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function rg(e){const n=e.dbAttrs[0]??{modelId:Be(),physicalName:"",dataType:""},o={modelId:Be(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:ig,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function lg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>ag(l)?(a=!0,n=!0,rg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function sg(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const b=new Map,f=new Map,g=new Map,k=(_,N,I)=>{if(!_)return;o.get(_)||o.set(_,[{entityId:N,assignedId:_}]),i.push({id:_,entityId:N,sink:I}),I(_)};for(const _ of y.attributes){k(_.modelId,y.modelId,N=>b.set(_,N));for(const N of _.dbAttrs)k(N.modelId,y.modelId,I=>f.set(N,I))}for(const _ of y.indexes??[])k(_.modelId,y.modelId,N=>g.set(_,N));a.set(y,{attrs:b,cols:f,idx:g})}const r=new Set(o.keys()),l=new Map;for(const y of i){const b=(l.get(y.id)??0)+1;if(l.set(y.id,b),b===1)continue;const f=cg(y.id,b-1,r);r.add(f),o.get(y.id).push({entityId:y.entityId,assignedId:f}),y.sink(f)}const s=[...o.values()].reduce((y,b)=>y+Math.max(0,b.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,b)=>{var g;if(!b||!y)return b;const f=o.get(b);return!f||f.length<2?b:((g=f.find(k=>k.entityId===y))==null?void 0:g.assignedId)??b},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,b)=>{const f=d.get(y);if(f)return f.end1.entityRef===b?f.end2.entityRef:f.end1.entityRef},m=e.entities.map(y=>{var _;const b=a.get(y),f=y.attributes.map(N=>{const I=b.attrs.get(N),$=N.dbAttrs.map(T=>{const V=b.cols.get(T);return V===T.modelId?T:{...T,modelId:V}});let C=N.derivedFrom;if(C){const T=u(C.associationRef,y.modelId),V=c(T,C.sourceAttributeRef);V!==C.sourceAttributeRef&&(C={...C,sourceAttributeRef:V})}return I!==N.modelId||C!==N.derivedFrom||$.some((T,V)=>T!==N.dbAttrs[V])?{...N,modelId:I,dbAttrs:$,derivedFrom:C}:N}),g=(_=y.indexes)==null?void 0:_.map(N=>{const I=b.idx.get(N),$=N.columns.map(A=>{const T=c(y.modelId,A.columnRef);return T===A.columnRef?A:{...A,columnRef:T}});return I!==N.modelId||$.some((A,T)=>A!==N.columns[T])?{...N,modelId:I,columns:$}:N});return f.some((N,I)=>N!==y.attributes[I])||g&&y.indexes&&g.some((N,I)=>N!==y.indexes[I])?{...y,attributes:f,...g?{indexes:g}:{}}:y}),h=e.associations.map(y=>{const b=c(y.end1.entityRef,y.end1.attributeRef),f=c(y.end2.entityRef,y.end2.attributeRef);return b===y.end1.attributeRef&&f===y.end2.attributeRef?y:{...y,end1:b===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:b},end2:f===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:f}}}),p=n.associationLayouts.map(y=>{const b=d.get(y.associationRef);if(!b)return y;const f=c(b.end1.entityRef,y.sourceColumnRef),g=c(b.end2.entityRef,y.targetColumnRef);return f===y.sourceColumnRef&&g===y.targetColumnRef?y:{...y,sourceColumnRef:f,targetColumnRef:g}});return{logical:{...e,entities:m,associations:h},layout:p.some((y,b)=>y!==n.associationLayouts[b])?{...n,associationLayouts:p}:n,reissued:s}}function cg(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function At(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Hr(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function Tc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Mc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Tc);if(!i.length)continue;const a=o.filter(s=>!Tc(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),n.attributes=l}}function _o(e){return JSON.parse(JSON.stringify(e))}function Vc(e,n,o){var A;const i=o.idFactory??Be,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const T=new Set(n);for(const V of r.associations){const R=T.has(V.end1.entityRef),x=T.has(V.end2.entityRef);R!==x&&s.add(R?V.end2.entityRef:V.end1.entityRef)}}const c=r.entities.filter(T=>s.has(T.modelId)),d=new Set(c.map(T=>T.modelId)),u=r.associations.filter(T=>d.has(T.end1.entityRef)&&d.has(T.end2.entityRef)),m=new Set(u.map(T=>T.modelId)),h=new Map,p=T=>{let V=h.get(T);return V||(V=i(),h.set(T,V)),V};for(const T of c){p(T.modelId);for(const V of T.attributes){p(V.modelId);for(const R of V.dbAttrs)p(R.modelId)}for(const V of T.indexes??[])p(V.modelId);for(const V of T.operations??[])p(V.modelId)}for(const T of u)p(T.modelId);const y=T=>h.get(T),b=c.map(T=>{const V=_o(T);V.modelId=y(T.modelId),V.attributes=V.attributes.map(R=>dg(R,y,m,d));for(const R of V.indexes??[])R.modelId=y(R.modelId),R.columns=R.columns.map(x=>Vn(x.columnRef)?x:{...x,columnRef:y(x.columnRef)}).filter(x=>x.columnRef!==void 0);for(const R of V.operations??[])R.modelId=y(R.modelId);return V});Mc(b);const f=u.map(T=>{const V=_o(T);return V.modelId=y(T.modelId),V.end1=Bc(V.end1,y),V.end2=Bc(V.end2,y),V}),g=[];for(const T of r.groups){const V=T.memberEntityRefs.filter(x=>d.has(x));if(V.length===0)continue;const R=_o(T);R.modelId=p(T.modelId),R.memberEntityRefs=V.map(x=>y(x)),g.push(R)}const k=o.collisionSuffix??"_imported",_=new Set(o.existing.entities.map(T=>T.name)),N=new Set(o.existing.entities.map(T=>{var V;return(V=T.table)==null?void 0:V.physicalName}).filter(T=>!!T));for(const T of b)_.has(T.name)&&(T.name=`${T.name}${k}`),(A=T.table)!=null&&A.physicalName&&N.has(T.table.physicalName)&&(T.table.physicalName=`${T.table.physicalName}${k}`);const I=[];for(const T of l.entityLayouts){const V=y(T.entityRef);if(!V)continue;const R=_o(T);R.entityRef=V,R.geo={...R.geo,location:jr(R.geo.location,a)},R.attributeStyles&&(R.attributeStyles=ea(R.attributeStyles,y)),R.operationStyles&&(R.operationStyles=ea(R.operationStyles,y)),I.push(R)}const $=[];for(const T of l.associationLayouts){const V=y(T.associationRef);if(!V)continue;const R=_o(T);R.associationRef=V,R.sourceColumnRef=T.sourceColumnRef?y(T.sourceColumnRef):void 0,R.targetColumnRef=T.targetColumnRef?y(T.targetColumnRef):void 0,R.waypoints=R.waypoints.map(x=>jr(x,a)),$.push(R)}const C=[];for(const T of l.groupLayouts){const V=y(T.groupRef);if(!V)continue;const R=_o(T);R.groupRef=V,R.geo={...R.geo,location:jr(R.geo.location,a)},delete R.memberNoteRefs,C.push(R)}return{logical:{entities:b,associations:f,groups:g},layout:{entityLayouts:I,associationLayouts:$,groupLayouts:C},idMap:h}}function jr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function dg(e,n,o,i){e.modelId=n(e.modelId);for(const a of e.dbAttrs)if(a.modelId=n(a.modelId),a.sharedColumnRef!==void 0){const r=n(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:n(e.derivedFrom.associationRef),sourceAttributeRef:n(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:n(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:n(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function Bc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function ea(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Kr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function zn(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>zn(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!zn(e[i],n[i]))return!1;return!0}return!1}function Fn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||zn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Un(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function ug(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const mg=new Set(["attributes","operations","indexes","rev"]),fg=new Set(["end1","end2","rev"]),pg=new Set(["memberEntityRefs","rev"]),Dc=new Set(["modelId"]),hg=new Set(["modelId","columns"]),yg=new Set([]);function gg(e,n,o,i){const a=Un(n.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=Fn(s,c,Dc);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Un(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=Fn(s,c,Dc);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Un(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!zn(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=Fn(s,c,hg);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function bg(e,n,o){const i=Un(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:Kr(l)});for(const{cur:l,tgt:s}of i.common){const c=Fn(l,s,mg);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),gg(l.modelId,l,s,o)}const a=Un(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:Kr(l)});for(const{cur:l,tgt:s}of a.common){const c=Fn(l,s,fg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=Fn(l[d]??{},s[d]??{},yg);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=Un(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:Kr(l)});for(const{cur:l,tgt:s}of r.common){const c=Fn(l,s,pg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=ug(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function ta(e,n,o,i,a,r,l){const s=Un(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)zn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function _g(e,n,o){ta(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ta(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ta(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ta(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function kg(e,n){const o=[];return bg(e.logical,n.logical,o),_g(e.layout,n.layout,o),o}function Eg(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 Ng={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 wg{constructor(n){Qe(this,"out",[]);Qe(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...Xo(n),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(n,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...Xo(n),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({...Xo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...Xo(n),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(n,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...Xo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Xo(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Ht(e,n,o,i){if(o==null||typeof o!="object")return;const a=Ng[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Hn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Gr(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Nn(e,n){var r,l,s,c,d,u,m,h;const o=Eg(n),i=new wg(n.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?Ht(i,p,y.value,"entity"):y.kind==="entity.update"?Hn(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=Gr((r=y.value)==null?void 0:r.attributes,n.attributeRef);b&&Ht(i,p,b,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?Ht(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Hn(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=Gr((s=y.value)==null?void 0:s.operations,n.operationRef);b&&Ht(i,p,b,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?Ht(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Hn(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=Gr((d=y.value)==null?void 0:d.indexes,n.indexRef);b&&Ht(i,p,b,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?Ht(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Hn(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?Ht(i,p,y.value,"association"):y.kind==="association.update"?Hn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const b=(m=y.value)==null?void 0:m[n.end];Ht(i,p,b,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Hn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){Ht(i,p,y.value,"group");const b=(h=y.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(b))for(const f of b)i.member(p,f,!1)}else y.kind==="group.update"?Hn(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}const We={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},Ig={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":We,"entityLayout.remove":We,"entityLayout.move":We,"entityLayout.resize":We,"entityLayout.setCollapsed":We,"entityLayout.setLocked":We,"entityLayout.setStyle":We,"entityLayout.setAttrStyle":We,"entityLayout.setOpStyle":We,"groupLayout.add":We,"groupLayout.remove":We,"groupLayout.move":We,"groupLayout.resize":We,"groupLayout.setLocked":We,"groupLayout.setStyle":We,"groupLayout.addNoteMember":We,"groupLayout.removeNoteMember":We,"associationLayout.add":We,"associationLayout.remove":We,"associationLayout.setWaypoints":We,"note.add":We,"note.remove":We,"note.move":We,"note.resize":We,"note.setMemo":We,"note.setStyle":We,"noteConnection.add":We,"noteConnection.remove":We,"noteConnection.setWaypoints":We},$t=e=>typeof e=="string"?e:void 0,vg=e=>{var n;return $t((n=e.value)==null?void 0:n.modelId)};function Lc(e){return $t(e.containerRef)??$t(e.entityRef)}function Yr(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=$t(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function qr(e){const n=Ig[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=$t(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Yr(o,"attributes","attribute",a),...Yr(o,"operations","operation",a),...Yr(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Lc(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?vg(o):$t(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=$t(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=$t(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Cg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=$t(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Lc(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=$t(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=$t(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function xg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Sg(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of qr(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function na(e,n){return e.map(o=>({...o,subject:n}))}function Oc(e,n){const o=e.filter(s=>s.ops.some(c=>xg(c,n))),{attributes:i,operations:a,indexes:r}=Sg(o,n),l=[...na(Nn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...na(Nn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...na(Nn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...na(Nn(o,{entityRef:n,indexRef:s}),{kind:"index",ref:s}));return l.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 Wr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Rg(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of qr(i))a.existence==="add"&&n.add(Wr(a.subject));return n}function Ag(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=Cg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function $g(e){const{entities:n,associations:o,groups:i}=Ag(e),a=[];for(const r of n)for(const l of Oc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Nn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Nn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Nn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function Jr(e){const n=$g(e),o=Rg(e),i=new Map;for(const l of n){const s=Wr(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of n){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=Wr(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...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 r.sort((l,s)=>s.seq-l.seq)}function Pc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Tg(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of qr(r)){if(!l.existence||l.inline)continue;const s=l.subject;Mg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const Mg=new Set(["attribute","operation","index"]);function Xr(e,n){const{fromSeq:o}=n,i=Jr(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const h=Pc(m.subject);let p=s.get(h);p||(p={subject:m.subject,evs:[]},s.set(h,p)),p.evs.push(m)};for(const m of l)for(const h of m.actions)c({seq:m.seq,subject:h.subject,verb:h.verb,fields:h.fields});for(const m of Tg(e,o,r)){const h=s.get(Pc(m.subject));h!=null&&h.evs.some(p=>p.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((p,y)=>p.seq-y.seq);const h=m.evs[m.evs.length-1];m.subject.kind==="entity"&&h.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const h=m.evs[0].verb==="add",p=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||h&&p)continue;const y=new Map;let b=null;for(const g of m.evs){g.verb==="add"&&b!==null&&b!=="add"&&y.clear(),b=g.verb;for(const k of g.fields){const _=y.get(k.field);_?_.lastValue=k.value:y.set(k.field,{firstOld:k.oldValue,hasOld:k.oldValue!==void 0,lastValue:k.value})}}if(p){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(h){const g=[];for(const[k,_]of y)g.push({field:k,value:_.lastValue});d.push({subject:m.subject,verb:"added",fields:g});continue}const f=[];for(const[g,k]of y)k.hasOld&&zn(k.firstOld,k.lastValue)||f.push({field:g,value:k.lastValue,...k.hasOld?{oldValue:k.firstOld}:{}});f.length!==0&&d.push({subject:m.subject,verb:"modified",fields:f})}return{fromSeq:o,toSeq:r,entries:d}}function zc(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class Zr{constructor(n){Qe(this,"undoStack",[]);Qe(this,"redoStack",[]);Qe(this,"savePoint",null);Qe(this,"listeners",new Set);Qe(this,"commandListeners",new Set);Qe(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"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.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function wt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Fc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function dt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Tt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function tt(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function nn(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function oa(e,n,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:n,...o})},invert(i){const a=Fc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=dt(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Uc(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Fc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=dt(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(h=>h.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function Hc(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=tt(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(tt(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:wt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:wt(o)}]}}}}function jc(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=tt(i,e);o=a.name,a.name=n},invert(i){tt(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function ko(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=dt(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(n)],invert:[i(o)]}}}}function Kc(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=dt(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(n)],invert:[i(o)]}}}}function Zo(e,n){const o={...(e==null?void 0:e.properties)??{}};return n?o.swatch=n:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function Gc(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=Zo(r.style,n)},invert(i){const a=dt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=dt(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function Yc(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=dt(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(n)],invert:[i(o)]}}}}function qc(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=dt(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(n)],invert:[i(o)]}}}}function Qr(e){let n=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){n=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=n[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:n[l]}})}),{forward:i,invert:a}}}}function ia(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=dt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=Zo(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=dt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=dt(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function aa(e,n,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:n,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Wc(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:wt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:wt(o)}]}}}}function Jc(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={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){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function Xc(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function ra(e,n){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,n)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}}}}function Zc(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.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(n)],invert:[i(o)]}}}}function Qc(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.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(n)],invert:[i(o)]}}}}function ed(e,n){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Zo(a.style,n)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function td(e,n){let o;return{label:n?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=n},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function jt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){tt(o,e).attributes.push(n)},invert(o){const i=tt(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function on(e,n,o){const i={},a=r=>{const l=tt(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:wt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:wt(i)}]}}}}function nd(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=tt(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&tt(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function od(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function el(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=tt(a,e);i=r.attributes.map(s=>({...s}));const l=Hr([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&tt(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=tt(a,e).attributes;return od("attribute.update","attributeRef",e,r,i??[])}}}function id(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=tt(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=tt(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,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:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function ad(e,n,o){const i={},a=r=>{var s;const l=(s=tt(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:wt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:wt(i)}]}}}}function rd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=tt(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=tt(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:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function ld(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=tt(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Hr([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=tt(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=tt(a,e).operations??[];return od("operation.update","operationRef",e,r,i??[])}}}function sd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=dt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=Zo(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=dt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=dt(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function la(e,n){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(n)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.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:n,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 cd(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={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){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function sa(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:wt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:wt(o)}]}}}}function Mt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:wt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:wt(i)}]}}}}function dd(e,n){return{label:"인덱스 추가",apply(o){const i=tt(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=tt(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function ca(e,n,o){const i={},a=r=>{var s;const l=(s=tt(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:wt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:wt(i)}]}}}}function ud(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=tt(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&tt(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Kt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),Qo=(e,n)=>{var o;return((o=Tt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function md(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Tt(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=Tt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=Qo(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Kt(e,r)],invert:[Kt(e,l)]}}}}function fd(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Tt(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=Tt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=Qo(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Kt(e,a)],invert:[Kt(e,r)]}}}}function pd(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Tt(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=Tt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Kt(e,Qo(a,e))],invert:[Kt(e,i??[])]}}}}function hd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Tt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Tt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Kt(e,Qo(o,e))],invert:[Kt(e,n??[])]}}}}function yd(e,n,o){return{label:"waypoint 추가",apply(i){const a=Tt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Tt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=Qo(i,e),r=a.slice();return r.splice(n,1),{forward:[Kt(e,a)],invert:[Kt(e,r)]}}}}function gd(e){return{label:"노트 추가",apply(n){n.layout.notes.push(e)},invert(n){const o=n.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&n.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 bd(e){let n=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);n={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){n&&o.layout.notes.splice(n.index,0,n.item)},emitOps(){return n?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:n.item}]}:{forward:[],invert:[]}}}}function ei(e,n){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.notes.find(r=>r.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(n)],invert:[i(o)]}}}}function _d(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.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(n)],invert:[i(o)]}}}}function kd(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Ed(e,n){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Zo(a.style,n)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Nd(e,n){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(n)&&(l.memberNoteRefs.push(n),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(n);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}:{forward:[],invert:[]}}}}function wd(e,n){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(n))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,n))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}}}}const wn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),da=(e,n,o)=>{var i;return((i=nn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Id(e,n){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===n)){o=!1;return}r.connections.push({targetRef:n,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===n);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:{targetRef:n,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}]}:{forward:[],invert:[]}}}}function vd(e,n){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===n))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${n}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.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:n}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:o.item}]}:{forward:[],invert:[]}}}}function Cd(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=nn(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=nn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=da(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[wn(e,n,l)],invert:[wn(e,n,s)]}}}}function xd(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=nn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=nn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=da(a,e,n),l=r.slice();return l.splice(o,1),{forward:[wn(e,n,r)],invert:[wn(e,n,l)]}}}}function Sd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=nn(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=nn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=da(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[wn(e,n,r)],invert:[wn(e,n,l)]}}}}function Rd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=nn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=nn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[wn(e,n,da(i,e,n))],invert:[wn(e,n,o??[])]}}}}function Je(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const Vg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:la,addAttribute:jt,addEntity:oa,addEntityToGroup:Xc,addGroup:aa,addIndex:dd,addNote:gd,addNoteConnection:Id,addNoteConnectionWaypoint:xd,addNoteToGroup:Nd,addOperation:id,addWaypoint:yd,clearNoteConnectionWaypoints:Rd,clearWaypoints:hd,composite:Je,moveEntity:ko,moveGroup:Zc,moveNote:ei,moveNoteConnectionWaypoint:Cd,moveWaypoint:md,removeAssociation:cd,removeAttribute:nd,removeEntity:Uc,removeEntityFromGroup:ra,removeGroup:Jc,removeIndex:ud,removeNote:bd,removeNoteConnection:vd,removeNoteConnectionWaypoint:Sd,removeNoteFromGroup:wd,removeOperation:rd,removeWaypoint:fd,renameEntity:jc,reorderAttributes:el,reorderOperations:ld,resizeEntity:Kc,resizeGroup:Qc,resizeNote:_d,setAllEntitiesCollapsed:Qr,setAttributeSwatch:ia,setEntityCollapsed:Yc,setEntityLocked:qc,setEntitySwatch:Gc,setGroupLocked:td,setGroupSwatch:ed,setNoteMemo:kd,setNoteSwatch:Ed,setOperationSwatch:sd,translateWaypoints:pd,updateAssociation:sa,updateAssociationEnd:Mt,updateAttribute:on,updateEntity:Hc,updateGroup:Wc,updateIndex:ca,updateOperation:ad},Symbol.toStringTag,{value:"Module"}));class Ad{constructor(){Qe(this,"revs",new Map);Qe(this,"layoutVersion",0);Qe(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const Bg=[400,1200];function Dg(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function Lg(e){const n=Dg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Og=e=>new Promise(n=>setTimeout(n,e));class $d{constructor(n){Qe(this,"cache",new Ad);Qe(this,"newClientOpId");Qe(this,"debounceMs");Qe(this,"retryDelaysMs");Qe(this,"emissions",new WeakMap);Qe(this,"open",null);Qe(this,"debounceHandle",null);Qe(this,"queue",[]);Qe(this,"sending",!1);Qe(this,"_frozen",!1);Qe(this,"stack",null);Qe(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Be,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??Bg}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(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(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((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(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!Lg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Og(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const Td=["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","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Md=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Vd(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function Pg(e){return e.flatMap(n=>n.dbAttrs).length}function Bd(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function zg(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=Ko(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function Fg(e,n,o=Be){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Pg(i.attributes);if(a===0)return[];const r=Bd(e,n),l=i.attributes.flatMap(c=>c.dbAttrs),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;zg(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function Dd(e,n,o){var h;const i=e.entities.find(p=>p.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(p=>[p.modelId,p])),l=[];for(const p of o){const y=r.get(p);if(!y)return[];l.push(y)}const s=a.flatMap(p=>p.dbAttrs).map(p=>p.modelId),c=l.flatMap(p=>p.dbAttrs).map(p=>p.modelId);if(s.length!==c.length)return[];if(s.every((p,y)=>p===c[y]))return[];const d=new Map(s.map((p,y)=>[p,y])),u=Bd(e,n),m=[];for(const p of e.entities)for(const y of p.attributes){if(y.attrType!=="EMBED_OWN"||((h=y.embedded)==null?void 0:h.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const b=c.map(g=>y.dbAttrs[d.get(g)]),f=b.reduce((g,k,_)=>k===y.dbAttrs[_]?g:g+1,0);f&&m.push({entityId:p.modelId,attributeId:y.modelId,dbAttrs:b,moved:f})}return m}function Ug(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Hg(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Ld(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function yt(e,n){const o=Ug(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>Gg(i,e))}}function jg(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function tl(e,n){const o=jg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function nl(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const Kg=new Set(["name","description","packageName","excludeDDLGeneration"]);function Gg(e,n){var a;const o=Gi(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(h=>h.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function Od(e,n){const o=Hg(e,n);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 Yg(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function qg(e,n){const o=Yg(e,n);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 Pd(e,n){const o=e.filter(i=>i.physicalName===n.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function ol(e){return e.by!==void 0&&e.by!=="name"}function Wg(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function Jg(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function Xg(e,n){const o=Wg(e,n);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 zd(e,n){const o=Jg(e,n);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 Fd(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Ud(e){return Fd(e)&&e.dataType==null}function Hd(e,n,o){const i=Fd(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...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 jd(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),m=[];let h=!1;for(const p of n.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const b={ref:y.sharedColumnPhysicalName,by:"physicalName"},f=Pd(En(i,a),b);if(!f.ok){s.push(f.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:b}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:b,matches:f.matches}),h=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:f.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return h?null:{modelId:d,name:e.name,type:n.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:m}}const Zg=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),Qg=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table"]),eb=new Set(["description","identifying"]),tb=new Set(["multiplicity","navigable","composition"]),nb=new Set(["name","unique","description","parameters"]),ob=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Eo(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const il=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),ib=new Set([...il].filter(e=>e!=="sharedColumnRef"));function ab(e,n,o,i){if(i||o.some(l=>!ib.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))il.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function rb(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,h)=>{const p=n.fields[h],y=p?c.get(p.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const f={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=Pd(En(i,a),f);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:f}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:f,matches:g.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});return}const b={...m};delete b.sharedColumnRef,d.push({...b,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function Kd(e,n,o){return{modelId:o(),name:e.name,order:n,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Gd(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=qg(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}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:n.name,unique:n.unique??!1,columns:l,...n.description?{description:n.description}:{},...n.parameters?{parameters:n.parameters}:{}}}function No(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function lb(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Vd(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function al(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of pc(n,o,i)){for(const u of c.remove)No(e,a,s,u);for(const u of c.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:s,entityRef:s,attributeRef:u.attributeId,patch:u.patch});const d=((l=n.entities.find(u=>u.modelId===s))==null?void 0:l.attributes)??[];for(const u of c.add)e.push({kind:"attribute.add",casUnit:"logical",containerRef:s,entityRef:s,value:{...u,order:r(s,d)}})}}function sb(e,n,o={}){const i=o.mkId??Be,a=o.embeddableCatalog??[],r=f=>a.find(g=>g.type===f),l=[],s=[],c=new Map,d=(f,g)=>{const k=c.get(f)??At(g);return c.set(f,k+1),k},u=new Map,m=new Set,h=new Set,p={seen:new Set,pairs:[]},y=new Set;for(const f of n)f.kind==="entity.add"&&(y.add(f.spec.name),f.spec.physicalName&&y.add(f.spec.physicalName));const b=new Set;return n.forEach((f,g)=>{var k,_,N,I,$;switch(f.kind){case"entity.add":{const C=e.entities.filter(E=>E.name===f.spec.name).map(E=>E.modelId);if(C.length||b.has(f.spec.name)){s.push({code:"entity-name-conflict",opIndex:g,handle:{ref:f.spec.name},matches:C});break}b.add(f.spec.name);const A=i(),T={modelId:A,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},V={ref:f.spec.name};let R=!1;for(const[E,w]of(f.spec.attributes??[]).entries()){if(w.type==="GroupCodeEnum"&&!w.groupCode){s.push({code:"groupcode-required",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0;continue}if(!r(w.type)&&!((k=w.embeddableOverrides)!=null&&k.length)&&Ud(w)){s.push({code:"datatype-required",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0;continue}const S=r(w.type);if(S){const B=jd(w,S,E,T,e.entities,g,V,s,i);B?T.attributes.push(B):R=!0}else(_=w.embeddableOverrides)!=null&&_.length?(s.push({code:"embeddable-type-unresolved",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0):T.attributes.push(Hd(w,E,i))}const x=(f.spec.operations??[]).map((E,w)=>Kd(E,w,i));x.length&&(T.operations=x);const M=[];for(const E of f.spec.indexes??[]){const w=Gd(T,E,g,V,s,i);w?M.push(w):R=!0}if(M.length&&(T.indexes=M),R)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:A,value:T});break}case"entity.update":{const C=yt(e,f.entity);if(!C.ok){s.push(gt(C.reason,g,f.entity,C.matches,y));break}const A=Eo(f.patch,Qg,["jpaAttrs.","table."]);if(A.length){s.push({code:"entity-patch-unknown-key",opIndex:g,entity:f.entity,keys:A});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,patch:f.patch});break}case"entity.remove":{const C=yt(e,f.entity);if(!C.ok){s.push(gt(C.reason,g,f.entity,C.matches,y));break}const A=C.value.modelId,T=e.associations.filter(M=>M.end1.entityRef===A||M.end2.entityRef===A),V=new Set(T.map(M=>M.modelId));for(const M of T)m.has(M.modelId)||(m.add(M.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:M.modelId}));for(const M of e.entities)if(M.modelId!==A)for(const E of M.attributes)E.embedded&&V.has(E.embedded.associationRef)&&No(l,p,M.modelId,E.modelId);for(const M of T){if(M.end1.entityRef===A||!M.end1.attributeRef)continue;const E=e.entities.find(S=>S.modelId===M.end1.entityRef),w=E==null?void 0:E.attributes.find(S=>S.modelId===M.end1.attributeRef&&S.attrType==="RELATION_REF");w&&No(l,p,E.modelId,w.modelId)}const R={...e,entities:e.entities.filter(M=>M.modelId!==A),associations:e.associations.filter(M=>!V.has(M.modelId))},x=new Set(T.filter(M=>M.end1.entityRef===A&&M.end2.entityRef!==A).map(M=>M.end2.entityRef));for(const M of x)al(l,R,M,i,p,d);h.add(A),l.push({kind:"entity.remove",casUnit:"logical",entityRef:A});break}case"attribute.add":{const C=yt(e,f.entity);if(!C.ok){s.push(gt(C.reason,g,f.entity,C.matches,y));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}if(!r(f.spec.type)&&!((N=f.spec.embeddableOverrides)!=null&&N.length)&&Ud(f.spec)){s.push({code:"datatype-required",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}const A=d(C.value.modelId,C.value.attributes),T=r(f.spec.type);let V;if(T)V=jd(f.spec,T,A,C.value,e.entities,g,f.entity,s,i);else if((I=f.spec.embeddableOverrides)!=null&&I.length){s.push({code:"embeddable-type-unresolved",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}else V=Hd(f.spec,A,i);if(!V)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,value:V});break}case"attribute.update":case"attribute.remove":{const C=yt(e,f.entity);if(!C.ok){s.push(gt(C.reason,g,f.entity,C.matches,y));break}const A=Od(C.value,f.attribute);if(!A.ok){s.push(A.reason==="not-found"?{code:"attribute-not-found",opIndex:g,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:g,entity:f.entity,handle:f.attribute,matches:A.matches});break}if(f.kind==="attribute.update"){const T=[],V=[];let R=!1;for(const w of Object.keys(f.patch)){if(w.includes(".")){w.startsWith("dbAttrs.")?R=!0:V.push(w);continue}il.has(w)?T.push(w):Zg.has(w)||V.push(w)}if(V.length){s.push({code:"attribute-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.attribute,keys:V});break}if("attrType"in f.patch){const w=String(f.patch.attrType),S=Md.includes(w)?w!==A.value.attrType?"transition":void 0:"unknown-value";if(S){s.push({code:"attribute-attrtype-unsupported",opIndex:g,entity:f.entity,handle:f.attribute,reason:S,current:A.value.attrType,requested:w});break}}const x="type"in f.patch?f.patch.type:A.value.type,M="groupCode"in f.patch?f.patch.groupCode:A.value.groupCode;if(x==="GroupCodeEnum"&&!M){s.push({code:"groupcode-required",opIndex:g,entity:f.entity,handle:f.attribute});break}let E=f.patch;if(T.length){const w=ab(A.value,f.patch,T,R);if(!w){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:g,entity:f.entity,handle:f.attribute,keys:T});break}E=w}if(($=f.embeddableOverrides)!=null&&$.length){const w=r(A.value.type);if(!w||A.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:g,entity:f.entity,handle:f.attribute});break}const S=rb(A.value,w,f.embeddableOverrides,C.value,e.entities,g,f.entity,s);if(!S)break;E={...E,dbAttrs:S}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,attributeRef:A.value.modelId,patch:E})}else{const T=Wi(e,C.value.modelId,A.value.modelId);if(T){const V=R=>{var x;return((x=e.entities.find(M=>M.modelId===R))==null?void 0:x.name)??R};s.push({code:"attribute-fk-managed",opIndex:g,entity:f.entity,handle:f.attribute,association:{from:V(T.end1.entityRef),to:V(T.end2.entityRef)}});break}No(l,p,C.value.modelId,A.value.modelId)}break}case"association.add":{const C=yt(e,f.spec.from),A=yt(e,f.spec.to);if(C.ok||s.push(gt(C.reason,g,f.spec.from,C.matches,y)),A.ok||s.push(gt(A.reason,g,f.spec.to,A.matches,y)),!C.ok||!A.ok)break;if(f.spec.identifying&&C.value.modelId===A.value.modelId){s.push({code:"self-identifying",opIndex:g,handle:{from:f.spec.from,to:f.spec.to}});break}const T=i(),V={modelId:T,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:C.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:A.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},R={...e,associations:[...e.associations,V]},x=qo(R,A.value.modelId,i);x.add[0]&&(V.end2.attributeRef=x.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:V});for(const M of x.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:A.value.modelId,entityRef:A.value.modelId,value:{...M,order:d(A.value.modelId,A.value.attributes)}});break}case"association.remove":{const C=yt(e,f.association.from),A=yt(e,f.association.to);if(C.ok||s.push(gt(C.reason,g,f.association.from,C.matches,y)),A.ok||s.push(gt(A.reason,g,f.association.to,A.matches,y)),!C.ok||!A.ok)break;const T=Ld(e,C.value.modelId,A.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:g,handle:f.association}:{code:"association-ambiguous",opIndex:g,handle:f.association,matches:T.map(M=>M.modelId)});break}const V=T[0];m.has(V.modelId)||(m.add(V.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:V.modelId}));const R=e.entities.find(M=>M.attributes.some(E=>{var w;return((w=E.embedded)==null?void 0:w.associationRef)===V.modelId}));if(R){const M=R.attributes.find(E=>{var w;return((w=E.embedded)==null?void 0:w.associationRef)===V.modelId});No(l,p,R.modelId,M.modelId);break}if(V.end1.attributeRef){const M=e.entities.find(w=>w.modelId===V.end1.entityRef),E=M==null?void 0:M.attributes.find(w=>w.modelId===V.end1.attributeRef&&w.attrType==="RELATION_REF");E&&No(l,p,M.modelId,E.modelId)}const x={...e,associations:e.associations.filter(M=>M.modelId!==V.modelId)};al(l,x,V.end2.entityRef,i,p,d);break}case"association.update":{const C=Yd(e,f.association,g,s,y);if(!C)break;const A=f.patch.identifying,T=typeof A=="boolean"?A:void 0;if(T===!0&&C.end1.entityRef===C.end2.entityRef){s.push({code:"self-identifying",opIndex:g,handle:f.association});break}const V=Eo(f.patch,eb);if(V.length){s.push({code:"association-patch-unknown-key",opIndex:g,handle:f.association,keys:V});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:C.modelId,associationRef:C.modelId,patch:f.patch}),T!==void 0&&T!==(C.identifying??!1)){const R={...e,associations:e.associations.map(x=>x.modelId===C.modelId?{...x,identifying:T}:x)};al(l,R,C.end2.entityRef,i,p,d)}break}case"associationEnd.update":{const C=Yd(e,f.association,g,s,y);if(!C)break;const A=f.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(f.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:g,handle:f.association});break}const T=Eo(f.patch,tb,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:g,handle:f.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:C.modelId,associationRef:C.modelId,end:A,patch:f.patch});break}case"index.add":{const C=yt(e,f.entity);if(!C.ok){s.push(gt(C.reason,g,f.entity,C.matches,y));break}const A=Gd(C.value,f.spec,g,f.entity,s,i);if(!A)break;l.push({kind:"index.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:A.modelId,value:A});break}case"index.update":case"index.remove":{const C=yt(e,f.entity);if(!C.ok){s.push(gt(C.reason,g,f.entity,C.matches,y));break}if(ol(f.index)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:f.index,target:"index"});break}const A=Xg(C.value,f.index);if(!A.ok){s.push(A.reason==="not-found"?{code:"index-not-found",opIndex:g,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:g,entity:f.entity,handle:f.index,matches:A.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:g,entity:f.entity,handle:f.index});break}const T=Eo(f.patch,nb);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:A.value.modelId,patch:f.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:A.value.modelId});break}case"operation.add":{const C=yt(e,f.entity);if(!C.ok){s.push(gt(C.reason,g,f.entity,C.matches,y));break}const A=u.get(C.value.modelId)??(C.value.operations?At(C.value.operations):0);u.set(C.value.modelId,A+1);const T=Kd(f.spec,A,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const C=yt(e,f.entity);if(!C.ok){s.push(gt(C.reason,g,f.entity,C.matches,y));break}if(ol(f.operation)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:f.operation,target:"operation"});break}const A=zd(C.value,f.operation);if(!A.ok){s.push(A.reason==="not-found"?{code:"operation-not-found",opIndex:g,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:g,entity:f.entity,handle:f.operation,matches:A.matches});break}if(f.kind==="operation.update"){const T=Eo(f.patch,ob);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:A.value.modelId,patch:f.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:A.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const C=f.kind==="attribute.reorder",A=yt(e,f.entity);if(!A.ok){s.push(gt(A.reason,g,f.entity,A.matches,y));break}const T=C?f.order:f.operations,V=[],R=new Set;let x=!1;for(const S of T){if(!C&&ol(S)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:S,target:"operation"}),x=!0;continue}const B=C?Od(A.value,S):zd(A.value,S);if(!B.ok){s.push(B.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:g,entity:f.entity,handle:S}:{code:"reorder-handle-ambiguous",opIndex:g,entity:f.entity,handle:S,matches:B.matches}),x=!0;continue}if(R.has(B.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:g,entity:f.entity,handle:S}),x=!0;continue}R.add(B.value.modelId),V.push(B.value)}if(x)break;const E=[...C?A.value.attributes:A.value.operations??[]].sort((S,B)=>S.order-B.order).filter(S=>!R.has(S.modelId)),w=[...V,...E];if(w.forEach((S,B)=>{S.order!==B&&l.push(C?{kind:"attribute.update",casUnit:"logical",containerRef:A.value.modelId,entityRef:A.value.modelId,attributeRef:S.modelId,patch:{order:B}}:{kind:"operation.update",casUnit:"logical",containerRef:A.value.modelId,entityRef:A.value.modelId,operationRef:S.modelId,patch:{order:B}})}),C)for(const S of Dd(e,A.value.modelId,w.map(B=>B.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:S.entityId,entityRef:S.entityId,attributeRef:S.attributeId,patch:{dbAttrs:S.dbAttrs}});break}case"group.add":{const C=[];let A=!1;for(const R of f.spec.members){const x=yt(e,R);if(!x.ok){s.push(gt(x.reason,g,R,x.matches,y)),A=!0;continue}C.push(x.value.modelId)}if(A)break;const T=i(),V={modelId:T,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:C,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:T,value:V});break}case"group.update":{const C=tl(e,f.group);if(!C.ok){s.push(nl(C,g,f.group));break}const A=Eo(f.patch,Kg);if(A.length){s.push({code:"group-patch-unknown-key",opIndex:g,handle:f.group,keys:A});break}l.push({kind:"group.update",casUnit:"logical",containerRef:C.value.modelId,groupRef:C.value.modelId,patch:f.patch});break}case"group.remove":{const C=tl(e,f.group);if(!C.ok){s.push(nl(C,g,f.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:C.value.modelId});break}case"group.addMember":case"group.removeMember":{const C=tl(e,f.group);if(!C.ok){s.push(nl(C,g,f.group));break}const A=yt(e,f.entity);if(!A.ok){s.push(gt(A.reason,g,f.entity,A.matches,y));break}const T=C.value.memberEntityRefs.includes(A.value.modelId);if(f.kind==="group.addMember"?T:!T)break;l.push({kind:f.kind,casUnit:"logical",containerRef:C.value.modelId,groupRef:C.value.modelId,entityRef:A.value.modelId});break}}}),s.length||lb(l,e,p,h),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function gt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function Yd(e,n,o,i,a){const r=yt(e,n.from),l=yt(e,n.to);if(r.ok||i.push(gt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(gt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Ld(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:n}:{code:"association-ambiguous",opIndex:o,handle:n,matches:s.map(c=>c.modelId)}),null):s[0]}const qd={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},cb={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},db={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},ub={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},In={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},mb={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:{...In,description:"속성 설명(다국어)."},columnLogicalName:{...In,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},fb={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. 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 — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},Wd={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},pb={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Wd,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Wd,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},hb={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...qd,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},yb={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...In,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},gb={type:"object",properties:{name:{...In,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},bb={type:"object",description:"기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부).",properties:{name:{type:"string"},type:{type:"string"},customType:{type:"string"},attrType:{type:"string",enum:[...Md],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},description:{...In,description:"속성 설명(다국어)."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...In,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},_b={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},kb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Eb={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...In,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Nb={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경.'},wb={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function it(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const Ib={"entity.add":it("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":it("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":it("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":it("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":it("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":it("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":it("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":it("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":it("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":it("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":it("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":it("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":it("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":it("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":it("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":it("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":it("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":it("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":it("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":it("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":it("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":it("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":it("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},vb={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},Cb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...In,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},Jd={anyOf:Td.map(e=>Ib[e])},xb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:qd,nameHandle:cb,groupHandle:vb,assocHandle:db,entitySpec:ub,attrSpec:mb,embeddableOverrides:fb,assocSpec:pb,indexSpec:hb,operationSpec:yb,groupSpec:gb,entityUpdatePatch:Nb,attrUpdatePatch:bb,assocUpdatePatch:_b,assocEndUpdatePatch:wb,indexUpdatePatch:kb,operationUpdatePatch:Eb,groupUpdatePatch:Cb,symbolicOp:Jd}};function Sb(e,n,o,i={}){const a=i.mkClientOpId??Be,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const Xd={location:{x:0,y:0},size:{width:220,height:140}};function Zd(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 Rb=/^[-=_*~\s]{3,}$/;function Ab(e){return e.attrType&&e.attrType!=="NORMAL"||!Rb.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function $b(e){return e.type===tn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Tb(e,n){if(e.attrType==="DIVIDER"||Ab(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=$b(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(Zd)}}function Mb(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Vb(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(n=>({columnRef:n.targetColumn.refId,descending:n.descending}))}}function Bb(e){var n,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(Tb),operations:(n=e.operations)==null?void 0:n.map(Mb),indexes:(o=e.indexes)==null?void 0:o.map(Vb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Db(e){const n={};for(const i of e.attributes)i.style&&(n[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??{...Xd},style:e.style,attributeStyles:Object.keys(n).length?n:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function Qd(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 rl(e){var n;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(n=e.attribute)==null?void 0:n.modelId,jpa:Qd(e)}}function Lb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>ll(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Ob(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:Lb(e),end1:rl(e.end1),end2:rl(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:n,layout:o}}function ll(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function eu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function tu(e){var o;const n=e.attribute;return(n==null?void 0:n.attrType)==="EMBED_OWN"&&(((o=n.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function nu(e,n){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:n,dbAttrs:(e.dbAttrs??[]).map(Zd)}}function Pb(e,n,o){var N,I;const i=ll(e.end1.attribute),a=ll(e.end2.attribute);if(i===a)return Ob(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(I=(N=s.dbAttrs)==null?void 0:N[0])==null?void 0:I.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce(($,C)=>Math.max($,C.order),-1)+1:s.order??0,h={...nu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const p=n.get(r.endModel.refId),y=l.attribute;let b;if(y&&p&&r.navigable){const $=Fi(l.multiplicity);b={modelId:y.modelId??crypto.randomUUID(),name:uo(y.name??Hi((u==null?void 0:u.name)??l.endModel.refId,$),new Set(p.attributes.map(C=>C.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:p.attributes.reduce((C,A)=>Math.max(C,A.order),-1)+1,dbAttrs:[]},p.attributes.push(b)}const f=($,C)=>({entityRef:$.endModel.refId,multiplicity:$.multiplicity,navigable:$.navigable,composition:$.composition,attributeRef:C?b==null?void 0:b.modelId:h.modelId,jpa:Qd($)}),g=r.endModel.refId===l.endModel.refId,k={modelId:e.modelId,description:e.description,identifying:!g&&h.identifier===!0?!0:void 0,end1:f(e.end1,i),end2:f(e.end2,a)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:h.modelId,targetColumnRef:i?h.modelId:d,style:e.style};return{assoc:k,layout:_}}function zb(e,n){const o=e.targetModelId?n.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 Fb(e,n,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((b,f)=>Math.max(b,f.order),-1)+1:l.order??0,d={...nu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(b=>zb(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...rl(b),legacyEmbedRaw:b.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:m,layout:p}}function Ub(e,n){var i,a,r,l;const o=[];for(const s of n){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function ou(e,n={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=Ub(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+n.x,y:a.location.y+n.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function iu(e,n,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(n.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function Hb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(h=>h.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(h=>h.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=Fi(i.end2.multiplicity),u=Hi(r.name,d),m=uo(u,new Set(a.attributes.map(h=>h.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((h,p)=>Math.max(h,p.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function jb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function au(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if((l==null?void 0:l.stereotype)==="JPA_EMBEDDABLE")continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Ps(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function ru(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?Kb(n):Gb(n)}function Kb(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:h,...p}=m;return h!=null&&(o[m.modelId]=h),p},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);Hb(a,r),jb(a,r),au(a,r);const{version:s,...c}=e.layout;iu(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},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 Gb(e){var g,k;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(_,N)=>{o.push(Bb(_));const I=Db(_);I.geo={location:{x:I.geo.location.x+N.x,y:I.geo.location.y+N.y},size:I.geo.size},i.push(I);for(const $ of _.ownedAssociations??[])c.push($)},u={x:0,y:0};for(const _ of e.entities??[])d(_,u);const m=[];for(const _ of e.groups??[]){const N=_.entities??[];l.push({modelId:_.modelId,name:_.name,description:_.description,packageName:_.packageName,excludeDDLGeneration:_.excludeDDLGeneration??!1,memberEntityRefs:N.map($=>$.modelId)});const I=((g=_.geo)==null?void 0:g.location)??u;if(_.geo){const $=(_.notes??[]).map(C=>C.modelId);s.push({groupRef:_.modelId,geo:_.geo,style:_.style,locked:_.locked,memberNoteRefs:$.length?$:void 0})}for(const $ of N)d($,I);for(const $ of _.notes??[])m.push(ou($,I))}const h=new Map(o.map(_=>[_.modelId,_])),p=new Map,y=new Map;for(const _ of o)for(const N of _.attributes)for(const I of N.dbAttrs)p.set(I.modelId,N.modelId),y.set(I.modelId,I);for(const _ of c)for(const N of[_.end1,_.end2]){const I=N.attribute;if(I&&(((k=I.dbAttrs)==null?void 0:k.length)??0)>0)for(const $ of I.dbAttrs)$.modelId&&p.set($.modelId,I.modelId)}for(const _ of c){const N=eu(_.end1.attribute),I=eu(_.end2.attribute),$=tu(_.end1)||tu(_.end2),{assoc:C,layout:A}=N!==I||$?Fb(_,h,y):Pb(_,h,p);a.push(C),r.push(A)}iu(o,a,r),Mc(o),au(o,a);const b={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(_=>ou(_)),...m]}},f={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:f}}function lu(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 Yb(e,n){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(lu),style:n}}function qb(e,n){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:n}}function Wb(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(n=>({targetColumn:{refId:n.columnRef},descending:n.descending}))}}function vn(e,n){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:n??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function Jb(e,n){const o=n==null?void 0:n.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 r;return{...lu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function Xb(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function su(e,n){const o=l=>{if(!l.attributeRef)return;const s=n.logical.entities.find(c=>c.modelId===l.entityRef);return s==null?void 0:s.attributes.find(c=>c.modelId===l.attributeRef)},i=o(e.end1),a=o(e.end2),r=l=>(l==null?void 0:l.attrType)==="RELATION_OWN"?l:void 0;return(i==null?void 0:i.attrType)==="RELATION_REF"?{navEnd:e.end1,fkEnd:e.end2,navAttr:i,fk:r(a)}:(a==null?void 0:a.attrType)==="RELATION_REF"?{navEnd:e.end2,fkEnd:e.end1,navAttr:a,fk:r(i)}:null}function Zb(e){const n=new Set;for(const o of e.logical.associations){const i=su(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function Qb(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function e_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function t_(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:e_(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function n_(e,n,o){let i;for(const m of n.logical.entities){const h=m.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.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((m,h)=>t_(m,l[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:vn(e.end1,c?s:u),end2:vn(e.end2,c?u:s)}}function o_(e,n,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:vn(e.end1,e.end1.legacyEmbedRaw),end2:vn(e.end2,e.end2.legacyEmbedRaw)};const a=n_(e,n,i);if(a)return a;const r=su(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?Jb(r.fk,l):void 0,c=Xb(r.navAttr);return{...i,end1:vn(e.end1,r.navEnd===e.end1?s:c),end2:vn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:vn(e.end1),end2:vn(e.end2)}}function cu(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(h=>h.entityRef===e.modelId),l=n.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>n.layout.associationLayouts.find(p=>p.associationRef===h),c=(r==null?void 0:r.geo)??{...Xd},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var p;return Yb(h,(p=r==null?void 0:r.attributeStyles)==null?void 0:p[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var p;return qb(h,(p=r==null?void 0:r.operationStyles)==null?void 0:p[h.modelId])}),ownedAssociations:l.map(h=>o_(h,n,s(h.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(Wb),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function i_(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>du(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>cu(c,n,o,i,l)),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 du(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function a_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Zb(e),r=Qb(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:n.id,diagramVersion:n.diagramVersion,version:n.version,size:n.size??e.layout.canvasSize,packageName:n.packageName??e.logical.packageName,entities:i.map(s=>cu(s,e,a,r)),groups:e.logical.groups.map(s=>i_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>du(s))}}function r_(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.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:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const l_=["notNull"];function s_(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=ru(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(h=>[h.modelId,h]))]));for(const m of i.logical.entities){const h=c.get(m.modelId);if(h)for(const p of m.attributes){const y=h.get(p.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:p}),s.navAdds++;continue}const b={};for(const f of l_)p[f]===!0!=(y[f]===!0)&&(b[f]=p[f],s.attributeFieldsByName[f]=(s.attributeFieldsByName[f]??0)+1);Object.keys(b).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:p.modelId,patch:b}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const h=d.get(m.modelId);h&&(m.end1.attributeRef&&m.end1.attributeRef!==h.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&h.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function ti(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function an(e){return typeof e=="function"?e():t.unref(e)}const c_=typeof window<"u"&&typeof document<"u",d_=e=>typeof e<"u",u_=Object.prototype.toString,m_=e=>u_.call(e)==="[object Object]",f_=()=>{};function p_(e,n){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>n.apply(this,i),{fn:n,thisArg:this,args:i})).then(a).catch(r)})}return o}const uu=e=>e();function h_(e=uu){const n=t.ref(!0);function o(){n.value=!1}function i(){n.value=!0}const a=(...r)=>{n.value&&e(...r)};return{isActive:t.readonly(n),pause:o,resume:i,eventFilter:a}}function mu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function y_(e,n,o={}){const{eventFilter:i=uu,...a}=o;return t.watch(e,p_(i,n),a)}function wo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=h_(i);return{stop:y_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function g_(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=an(n.replaceRef))!=null?r:!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 sl(e,n=!1){function o(m,{flush:h="sync",deep:p=!1,timeout:y,throwOnTimeout:b}={}){let f=null;const k=[new Promise(_=>{f=t.watch(e,N=>{m(N)!==n&&(f==null||f(),_(N))},{flush:h,deep:p,immediate:!0})})];return y!=null&&k.push(mu(y,b).then(()=>an(e)).finally(()=>f==null?void 0:f())),Promise.race(k)}function i(m,h){if(!t.isRef(m))return o(N=>N===m,h);const{flush:p="sync",deep:y=!1,timeout:b,throwOnTimeout:f}=h??{};let g=null;const _=[new Promise(N=>{g=t.watch([e,m],([I,$])=>{n!==(I===$)&&(g==null||g(),N(I))},{flush:p,deep:y,immediate:!0})})];return b!=null&&_.push(mu(b,f).then(()=>an(e)).finally(()=>(g==null||g(),an(e)))),Promise.race(_)}function a(m){return o(h=>!!h,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,h){return o(p=>{const y=Array.from(p);return y.includes(m)||y.includes(an(m))},h)}function d(m){return u(1,m)}function u(m=1,h){let p=-1;return o(()=>(p+=1,p>=m),h)}return Array.isArray(an(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return sl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return sl(e,!n)}}}function cl(e){return sl(e)}function b_(e){var n;const o=an(e);return(n=o==null?void 0:o.$el)!=null?n:o}const fu=c_?window:void 0;function pu(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=fu):[n,o,i,a]=e,!n)return f_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,h,p)=>(u.addEventListener(m,h,p),()=>u.removeEventListener(m,h,p)),c=t.watch(()=>[b_(n),an(a)],([u,m])=>{if(l(),!u)return;const h=m_(m)?{...m}:m;r.push(...o.flatMap(p=>i.map(y=>s(u,p,y,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ti(d),d}function __(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function hu(...e){let n,o,i={};e.length===3?(n=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],i=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:a=fu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=__(n);return pu(a,r,u=>{u.repeat&&an(s)||c(u)&&o(u)},l)}function k_(e){return JSON.parse(JSON.stringify(e))}function dl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:h}=i,p=t.getCurrentInstance(),y=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((l=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p==null?void 0:p.proxy));let b=d;n||(n="modelValue"),b=b||`update:${n.toString()}`;const f=_=>s?typeof s=="function"?s(_):k_(_):_,g=()=>d_(e[n])?f(e[n]):m,k=_=>{h?h(_)&&y(b,_):y(b,_)};if(c){const _=g(),N=t.ref(_);let I=!1;return t.watch(()=>e[n],$=>{I||(I=!0,N.value=f($),t.nextTick(()=>I=!1))}),t.watch(N,$=>{!I&&($!==e[n]||u)&&k($)},{deep:u}),N}else return t.computed({get(){return g()},set(_){k(_)}})}var E_={value:()=>{}};function ua(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new ma(o)}function ma(e){this._=e}function N_(e,n){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&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}ma.prototype=ua.prototype={constructor:ma,on:function(e,n){var o=this._,i=N_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=w_(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=yu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=yu(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new ma(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function w_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function yu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=E_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ul="http://www.w3.org/1999/xhtml";const gu={svg:"http://www.w3.org/2000/svg",xhtml:ul,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function fa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),gu.hasOwnProperty(n)?{space:gu[n],local:e}:e}function I_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ul&&n.documentElement.namespaceURI===ul?n.createElement(e):n.createElementNS(o,e)}}function v_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function bu(e){var n=fa(e);return(n.local?v_:I_)(n)}function C_(){}function ml(e){return e==null?C_:function(){return this.querySelector(e)}}function x_(e){typeof e!="function"&&(e=ml(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new St(i,this._parents)}function S_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function R_(){return[]}function _u(e){return e==null?R_:function(){return this.querySelectorAll(e)}}function A_(e){return function(){return S_(e.apply(this,arguments))}}function $_(e){typeof e=="function"?e=A_(e):e=_u(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new St(i,a)}function ku(e){return function(){return this.matches(e)}}function Eu(e){return function(n){return n.matches(e)}}var T_=Array.prototype.find;function M_(e){return function(){return T_.call(this.children,e)}}function V_(){return this.firstElementChild}function B_(e){return this.select(e==null?V_:M_(typeof e=="function"?e:Eu(e)))}var D_=Array.prototype.filter;function L_(){return Array.from(this.children)}function O_(e){return function(){return D_.call(this.children,e)}}function P_(e){return this.selectAll(e==null?L_:O_(typeof e=="function"?e:Eu(e)))}function z_(e){typeof e!="function"&&(e=ku(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new St(i,this._parents)}function Nu(e){return new Array(e.length)}function F_(){return new St(this._enter||this._groups.map(Nu),this._parents)}function pa(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}pa.prototype={constructor:pa,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function U_(e){return function(){return e}}function H_(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new pa(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function j_(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),p;for(s=0;s<u;++s)(c=n[s])&&(h[s]=p=l.call(c,c.__data__,s,n)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new pa(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function K_(e){return e.__data__}function G_(e,n){if(!arguments.length)return Array.from(this,K_);var o=n?j_:H_,i=this._parents,a=this._groups;typeof e!="function"&&(e=U_(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,p=Y_(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),f=l[d]=new Array(y),g=c[d]=new Array(h);o(u,m,b,f,g,p,n);for(var k=0,_=0,N,I;k<y;++k)if(N=b[k]){for(k>=_&&(_=k+1);!(I=f[_])&&++_<y;);N._next=I||null}}return l=new St(l,i),l._enter=s,l._exit=c,l}function Y_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function q_(){return new St(this._exit||this._groups.map(Nu),this._parents)}function W_(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function J_(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(h[y]=p);for(;c<a;++c)s[c]=o[c];return new St(s,this._parents)}function X_(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function Z_(e){e||(e=Q_);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new St(a,this._parents).order()}function Q_(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function ek(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function tk(){return Array.from(this)}function nk(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function ok(){let e=0;for(const n of this)++e;return e}function ik(){return!this.node()}function ak(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function rk(e){return function(){this.removeAttribute(e)}}function lk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sk(e,n){return function(){this.setAttribute(e,n)}}function ck(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function dk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function uk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function mk(e,n){var o=fa(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?lk:rk:typeof n=="function"?o.local?uk:dk:o.local?ck:sk)(o,n))}function wu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fk(e){return function(){this.style.removeProperty(e)}}function pk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function hk(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function yk(e,n,o){return arguments.length>1?this.each((n==null?fk:typeof n=="function"?hk:pk)(e,n,o??"")):Io(this.node(),e)}function Io(e,n){return e.style.getPropertyValue(n)||wu(e).getComputedStyle(e,null).getPropertyValue(n)}function gk(e){return function(){delete this[e]}}function bk(e,n){return function(){this[e]=n}}function _k(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function kk(e,n){return arguments.length>1?this.each((n==null?gk:typeof n=="function"?_k:bk)(e,n)):this.node()[e]}function Iu(e){return e.trim().split(/^|\s+/)}function fl(e){return e.classList||new vu(e)}function vu(e){this._node=e,this._names=Iu(e.getAttribute("class")||"")}vu.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Cu(e,n){for(var o=fl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function xu(e,n){for(var o=fl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Ek(e){return function(){Cu(this,e)}}function Nk(e){return function(){xu(this,e)}}function wk(e,n){return function(){(n.apply(this,arguments)?Cu:xu)(this,e)}}function Ik(e,n){var o=Iu(e+"");if(arguments.length<2){for(var i=fl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?wk:n?Ek:Nk)(o,n))}function vk(){this.textContent=""}function Ck(e){return function(){this.textContent=e}}function xk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Sk(e){return arguments.length?this.each(e==null?vk:(typeof e=="function"?xk:Ck)(e)):this.node().textContent}function Rk(){this.innerHTML=""}function Ak(e){return function(){this.innerHTML=e}}function $k(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Tk(e){return arguments.length?this.each(e==null?Rk:(typeof e=="function"?$k:Ak)(e)):this.node().innerHTML}function Mk(){this.nextSibling&&this.parentNode.appendChild(this)}function Vk(){return this.each(Mk)}function Bk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dk(){return this.each(Bk)}function Lk(e){var n=typeof e=="function"?e:bu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Ok(){return null}function Pk(e,n){var o=typeof e=="function"?e:bu(e),i=n==null?Ok:typeof n=="function"?n:ml(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function zk(){var e=this.parentNode;e&&e.removeChild(this)}function Fk(){return this.each(zk)}function Uk(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Hk(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function jk(e){return this.select(e?Hk:Uk)}function Kk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Gk(e){return function(n){e.call(this,n,this.__data__)}}function Yk(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function qk(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function Wk(e,n,o){return function(){var i=this.__on,a,r=Gk(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Jk(e,n,o){var i=Yk(e+""),a,r=i.length,l;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<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?Wk:qk,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Su(e,n,o){var i=wu(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function Xk(e,n){return function(){return Su(this,e,n)}}function Zk(e,n){return function(){return Su(this,e,n.apply(this,arguments))}}function Qk(e,n){return this.each((typeof n=="function"?Zk:Xk)(e,n))}function*eE(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Ru=[null];function St(e,n){this._groups=e,this._parents=n}function ni(){return new St([[document.documentElement]],Ru)}function tE(){return this}St.prototype=ni.prototype={constructor:St,select:x_,selectAll:$_,selectChild:B_,selectChildren:P_,filter:z_,data:G_,enter:F_,exit:q_,join:W_,merge:J_,selection:tE,order:X_,sort:Z_,call:ek,nodes:tk,node:nk,size:ok,empty:ik,each:ak,attr:mk,style:yk,property:kk,classed:Ik,text:Sk,html:Tk,raise:Vk,lower:Dk,append:Lk,insert:Pk,remove:Fk,clone:jk,datum:Kk,on:Jk,dispatch:Qk,[Symbol.iterator]:eE};function Vt(e){return typeof e=="string"?new St([[document.querySelector(e)]],[document.documentElement]):new St([[e]],Ru)}function nE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Gt(e,n){if(e=nE(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const oE={passive:!1},oi={capture:!0,passive:!1};function pl(e){e.stopImmediatePropagation()}function vo(e){e.preventDefault(),e.stopImmediatePropagation()}function Au(e){var n=e.document.documentElement,o=Vt(e).on("dragstart.drag",vo,oi);"onselectstart"in n?o.on("selectstart.drag",vo,oi):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function $u(e,n){var o=e.document.documentElement,i=Vt(e).on("dragstart.drag",null);n&&(i.on("click.drag",vo,oi),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 ha=e=>()=>e;function hl(e,{sourceEvent:n,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}hl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function iE(e){return!e.ctrlKey&&!e.button}function aE(){return this.parentNode}function rE(e,n){return n??{x:e.x,y:e.y}}function lE(){return navigator.maxTouchPoints||"ontouchstart"in this}function sE(){var e=iE,n=aE,o=rE,i=lE,a={},r=ua("start","drag","end"),l=0,s,c,d,u,m=0;function h(N){N.on("mousedown.drag",p).filter(i).on("touchstart.drag",f).on("touchmove.drag",g,oE).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(N,I){if(!(u||!e.call(this,N,I))){var $=_(this,n.call(this,N,I),N,I,"mouse");$&&(Vt(N.view).on("mousemove.drag",y,oi).on("mouseup.drag",b,oi),Au(N.view),pl(N),d=!1,s=N.clientX,c=N.clientY,$("start",N))}}function y(N){if(vo(N),!d){var I=N.clientX-s,$=N.clientY-c;d=I*I+$*$>m}a.mouse("drag",N)}function b(N){Vt(N.view).on("mousemove.drag mouseup.drag",null),$u(N.view,d),vo(N),a.mouse("end",N)}function f(N,I){if(e.call(this,N,I)){var $=N.changedTouches,C=n.call(this,N,I),A=$.length,T,V;for(T=0;T<A;++T)(V=_(this,C,N,I,$[T].identifier,$[T]))&&(pl(N),V("start",N,$[T]))}}function g(N){var I=N.changedTouches,$=I.length,C,A;for(C=0;C<$;++C)(A=a[I[C].identifier])&&(vo(N),A("drag",N,I[C]))}function k(N){var I=N.changedTouches,$=I.length,C,A;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<$;++C)(A=a[I[C].identifier])&&(pl(N),A("end",N,I[C]))}function _(N,I,$,C,A,T){var V=r.copy(),R=Gt(T||$,I),x,M,E;if((E=o.call(N,new hl("beforestart",{sourceEvent:$,target:h,identifier:A,active:l,x:R[0],y:R[1],dx:0,dy:0,dispatch:V}),C))!=null)return x=E.x-R[0]||0,M=E.y-R[1]||0,function w(S,B,z){var K=R,J;switch(S){case"start":a[A]=w,J=l++;break;case"end":delete a[A],--l;case"drag":R=Gt(z||B,I),J=l;break}V.call(S,N,new hl(S,{sourceEvent:B,subject:E,target:h,identifier:A,active:J,x:R[0]+x,y:R[1]+M,dx:R[0]-K[0],dy:R[1]-K[1],dispatch:V}),C)}}return h.filter=function(N){return arguments.length?(e=typeof N=="function"?N:ha(!!N),h):e},h.container=function(N){return arguments.length?(n=typeof N=="function"?N:ha(N),h):n},h.subject=function(N){return arguments.length?(o=typeof N=="function"?N:ha(N),h):o},h.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:ha(!!N),h):i},h.on=function(){var N=r.on.apply(r,arguments);return N===r?h:N},h.clickDistance=function(N){return arguments.length?(m=(N=+N)*N,h):Math.sqrt(m)},h}function yl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Tu(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ii(){}var ai=.7,ya=1/ai,Co="\\s*([+-]?\\d+)\\s*",ri="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",cE=/^#([0-9a-f]{3,8})$/,dE=new RegExp(`^rgb\\(${Co},${Co},${Co}\\)$`),uE=new RegExp(`^rgb\\(${Yt},${Yt},${Yt}\\)$`),mE=new RegExp(`^rgba\\(${Co},${Co},${Co},${ri}\\)$`),fE=new RegExp(`^rgba\\(${Yt},${Yt},${Yt},${ri}\\)$`),pE=new RegExp(`^hsl\\(${ri},${Yt},${Yt}\\)$`),hE=new RegExp(`^hsla\\(${ri},${Yt},${Yt},${ri}\\)$`),Mu={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};yl(ii,jn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vu,formatHex:Vu,formatHex8:yE,formatHsl:gE,formatRgb:Bu,toString:Bu});function Vu(){return this.rgb().formatHex()}function yE(){return this.rgb().formatHex8()}function gE(){return zu(this).formatHsl()}function Bu(){return this.rgb().formatRgb()}function jn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=cE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Du(n):o===3?new It(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ga(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ga(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=dE.exec(e))?new It(n[1],n[2],n[3],1):(n=uE.exec(e))?new It(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=mE.exec(e))?ga(n[1],n[2],n[3],n[4]):(n=fE.exec(e))?ga(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=pE.exec(e))?Pu(n[1],n[2]/100,n[3]/100,1):(n=hE.exec(e))?Pu(n[1],n[2]/100,n[3]/100,n[4]):Mu.hasOwnProperty(e)?Du(Mu[e]):e==="transparent"?new It(NaN,NaN,NaN,0):null}function Du(e){return new It(e>>16&255,e>>8&255,e&255,1)}function ga(e,n,o,i){return i<=0&&(e=n=o=NaN),new It(e,n,o,i)}function bE(e){return e instanceof ii||(e=jn(e)),e?(e=e.rgb(),new It(e.r,e.g,e.b,e.opacity)):new It}function gl(e,n,o,i){return arguments.length===1?bE(e):new It(e,n,o,i??1)}function It(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}yl(It,gl,Tu(ii,{brighter(e){return e=e==null?ya:Math.pow(ya,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ai:Math.pow(ai,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new It(Kn(this.r),Kn(this.g),Kn(this.b),ba(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:Lu,formatHex:Lu,formatHex8:_E,formatRgb:Ou,toString:Ou}));function Lu(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function _E(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ou(){const e=ba(this.opacity);return`${e===1?"rgb(":"rgba("}${Kn(this.r)}, ${Kn(this.g)}, ${Kn(this.b)}${e===1?")":`, ${e})`}`}function ba(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gn(e){return e=Kn(e),(e<16?"0":"")+e.toString(16)}function Pu(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Bt(e,n,o,i)}function zu(e){if(e instanceof Bt)return new Bt(e.h,e.s,e.l,e.opacity);if(e instanceof ii||(e=jn(e)),!e)return new Bt;if(e instanceof Bt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Bt(l,s,c,e.opacity)}function kE(e,n,o,i){return arguments.length===1?zu(e):new Bt(e,n,o,i??1)}function Bt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}yl(Bt,kE,Tu(ii,{brighter(e){return e=e==null?ya:Math.pow(ya,e),new Bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ai:Math.pow(ai,e),new Bt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new It(bl(e>=240?e-240:e+120,a,i),bl(e,a,i),bl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Bt(Fu(this.h),_a(this.s),_a(this.l),ba(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=ba(this.opacity);return`${e===1?"hsl(":"hsla("}${Fu(this.h)}, ${_a(this.s)*100}%, ${_a(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Fu(e){return e=(e||0)%360,e<0?e+360:e}function _a(e){return Math.max(0,Math.min(1,e||0))}function bl(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const _l=e=>()=>e;function EE(e,n){return function(o){return e+o*n}}function NE(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function wE(e){return(e=+e)==1?Uu:function(n,o){return o-n?NE(n,o,e):_l(isNaN(n)?o:n)}}function Uu(e,n){var o=n-e;return o?EE(e,o):_l(isNaN(e)?n:e)}const ka=(function e(n){var o=wE(n);function i(a,r){var l=o((a=gl(a)).r,(r=gl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Uu(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function IE(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,i=n.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+n[a]*r;return i}}function vE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function CE(e,n){var o=n?n.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=li(e[l],n[l]);for(;l<o;++l)r[l]=n[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function xE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function qt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function SE(e,n){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in e?o[a]=li(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var kl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,El=new RegExp(kl.source,"g");function RE(e){return function(){return e}}function AE(e){return function(n){return e(n)+""}}function Hu(e,n){var o=kl.lastIndex=El.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=kl.exec(e))&&(a=El.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:qt(i,a)})),o=El.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?AE(c[0].x):RE(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function li(e,n){var o=typeof n,i;return n==null||o==="boolean"?_l(n):(o==="number"?qt:o==="string"?(i=jn(n))?(n=i,ka):Hu:n instanceof jn?ka:n instanceof Date?xE:vE(n)?IE:Array.isArray(n)?CE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?SE:qt)(e,n)}var ju=180/Math.PI,Nl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ku(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*ju,skewX:Math.atan(c)*ju,scaleX:l,scaleY:s}}var Ea;function $E(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Nl:Ku(n.a,n.b,n.c,n.d,n.e,n.f)}function TE(e){return e==null||(Ea||(Ea=document.createElementNS("http://www.w3.org/2000/svg","g")),Ea.setAttribute("transform",e),!(e=Ea.transform.baseVal.consolidate()))?Nl:(e=e.matrix,Ku(e.a,e.b,e.c,e.d,e.e,e.f))}function Gu(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push("translate(",null,n,null,o);y.push({i:b-4,x:qt(d,m)},{i:b-2,x:qt(u,h)})}else(m||h)&&p.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:qt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:qt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:qt(d,m)},{i:b-2,x:qt(u,h)})}else(m!==1||h!==1)&&p.push(a(p)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(p){for(var y=-1,b=h.length,f;++y<b;)m[(f=h[y]).i]=f.x(p);return m.join("")}}}var ME=Gu($E,"px, ","px)","deg)"),VE=Gu(TE,", ",")",")"),BE=1e-12;function Yu(e){return((e=Math.exp(e))+1/e)/2}function DE(e){return((e=Math.exp(e))-1/e)/2}function LE(e){return((e=Math.exp(2*e))-1)/(e+1)}const Na=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],p=u-s,y=m-c,b=p*p+y*y,f,g;if(b<BE)g=Math.log(h/d)/n,f=function(C){return[s+C*p,c+C*y,d*Math.exp(n*C*g)]};else{var k=Math.sqrt(b),_=(h*h-d*d+i*b)/(2*d*o*k),N=(h*h-d*d-i*b)/(2*h*o*k),I=Math.log(Math.sqrt(_*_+1)-_),$=Math.log(Math.sqrt(N*N+1)-N);g=($-I)/n,f=function(C){var A=C*g,T=Yu(I),V=d/(o*k)*(T*LE(n*A+I)-DE(I));return[s+V*p,c+V*y,d*T/Yu(n*A+I)]}}return f.duration=g*1e3*n/Math.SQRT2,f}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var xo=0,si=0,ci=0,qu=1e3,wa,di,Ia=0,Yn=0,va=0,ui=typeof performance=="object"&&performance.now?performance:Date,Wu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wl(){return Yn||(Wu(OE),Yn=ui.now()+va)}function OE(){Yn=0}function Ca(){this._call=this._time=this._next=null}Ca.prototype=Ju.prototype={constructor:Ca,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?wl():+o)+(n==null?0:+n),!this._next&&di!==this&&(di?di._next=this:wa=this,di=this),this._call=e,this._time=o,Il()},stop:function(){this._call&&(this._call=null,this._time=1/0,Il())}};function Ju(e,n,o){var i=new Ca;return i.restart(e,n,o),i}function PE(){wl(),++xo;for(var e=wa,n;e;)(n=Yn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--xo}function Xu(){Yn=(Ia=ui.now())+va,xo=si=0;try{PE()}finally{xo=0,FE(),Yn=0}}function zE(){var e=ui.now(),n=e-Ia;n>qu&&(va-=n,Ia=e)}function FE(){for(var e,n=wa,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:wa=o);di=e,Il(i)}function Il(e){if(!xo){si&&(si=clearTimeout(si));var n=e-Yn;n>24?(e<1/0&&(si=setTimeout(Xu,e-ui.now()-va)),ci&&(ci=clearInterval(ci))):(ci||(Ia=ui.now(),ci=setInterval(zE,qu)),xo=1,Wu(Xu))}}function Zu(e,n,o){var i=new Ca;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var UE=ua("start","end","cancel","interrupt"),HE=[],Qu=0,em=1,vl=2,xa=3,tm=4,Cl=5,Sa=6;function Ra(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;jE(e,o,{name:n,index:i,group:a,on:UE,tween:HE,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Qu})}function xl(e,n){var o=Dt(e,n);if(o.state>Qu)throw new Error("too late; already scheduled");return o}function Wt(e,n){var o=Dt(e,n);if(o.state>xa)throw new Error("too late; already running");return o}function Dt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function jE(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Ju(r,0,o.time);function r(d){o.state=em,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,p;if(o.state!==em)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===xa)return Zu(l);p.state===tm?(p.state=Sa,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<n&&(p.state=Sa,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Zu(function(){o.state===xa&&(o.state=tm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=vl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===vl){for(o.state=xa,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Cl,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Cl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Sa,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Aa(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>vl&&i.state<Cl,i.state=Sa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function KE(e){return this.each(function(){Aa(this,e)})}function GE(e,n){var o,i;return function(){var a=Wt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function YE(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Wt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function qE(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Dt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?GE:YE)(o,e,n))}function Sl(e,n,o){var i=e._id;return e.each(function(){var a=Wt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Dt(a,i).value[n]}}function nm(e,n){var o;return(typeof n=="number"?qt:n instanceof jn?ka:(o=jn(n))?(n=o,ka):Hu)(e,n)}function WE(e){return function(){this.removeAttribute(e)}}function JE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function XE(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function ZE(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function QE(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function e1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function t1(e,n){var o=fa(e),i=o==="transform"?VE:nm;return this.attrTween(e,typeof n=="function"?(o.local?e1:QE)(o,i,Sl(this,"attr."+e,n)):n==null?(o.local?JE:WE)(o):(o.local?ZE:XE)(o,i,n))}function n1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function o1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function i1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&o1(e,r)),o}return a._value=n,a}function a1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&n1(e,r)),o}return a._value=n,a}function r1(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=fa(e);return this.tween(o,(i.local?i1:a1)(i,n))}function l1(e,n){return function(){xl(this,e).delay=+n.apply(this,arguments)}}function s1(e,n){return n=+n,function(){xl(this,e).delay=n}}function c1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?l1:s1)(n,e)):Dt(this.node(),n).delay}function d1(e,n){return function(){Wt(this,e).duration=+n.apply(this,arguments)}}function u1(e,n){return n=+n,function(){Wt(this,e).duration=n}}function m1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?d1:u1)(n,e)):Dt(this.node(),n).duration}function f1(e,n){if(typeof n!="function")throw new Error;return function(){Wt(this,e).ease=n}}function p1(e){var n=this._id;return arguments.length?this.each(f1(n,e)):Dt(this.node(),n).ease}function h1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Wt(this,e).ease=o}}function y1(e){if(typeof e!="function")throw new Error;return this.each(h1(this._id,e))}function g1(e){typeof e!="function"&&(e=ku(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new rn(i,this._parents,this._name,this._id)}function b1(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||d[p])&&(m[p]=h);for(;s<i;++s)l[s]=n[s];return new rn(l,this._parents,this._name,this._id)}function _1(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function k1(e,n,o){var i,a,r=_1(n)?xl:Wt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function E1(e,n){var o=this._id;return arguments.length<2?Dt(this.node(),o).on.on(e):this.each(k1(o,e,n))}function N1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function w1(){return this.on("end.remove",N1(this._id))}function I1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ml(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,Ra(d[h],n,o,h,d,Dt(u,o)));return new rn(r,this._parents,n,o)}function v1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=_u(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),p,y=Dt(u,o),b=0,f=h.length;b<f;++b)(p=h[b])&&Ra(p,n,o,b,h,y);r.push(h),l.push(u)}return new rn(r,l,n,o)}var C1=ni.prototype.constructor;function x1(){return new C1(this._groups,this._parents)}function S1(e,n){var o,i,a;return function(){var r=Io(this,e),l=(this.style.removeProperty(e),Io(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function om(e){return function(){this.style.removeProperty(e)}}function R1(e,n,o){var i,a=o+"",r;return function(){var l=Io(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function A1(e,n,o){var i,a,r;return function(){var l=Io(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Io(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function $1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Wt(this,e),d=c.on,u=c.value[r]==null?s||(s=om(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function T1(e,n,o){var i=(e+="")=="transform"?ME:nm;return n==null?this.styleTween(e,S1(e,i)).on("end.style."+e,om(e)):typeof n=="function"?this.styleTween(e,A1(e,i,Sl(this,"style."+e,n))).each($1(this._id,e)):this.styleTween(e,R1(e,i,n),o).on("end.style."+e,null)}function M1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function V1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&M1(e,l,o)),i}return r._value=n,r}function B1(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,V1(e,n,o??""))}function D1(e){return function(){this.textContent=e}}function L1(e){return function(){var n=e(this);this.textContent=n??""}}function O1(e){return this.tween("text",typeof e=="function"?L1(Sl(this,"text",e)):D1(e==null?"":e+""))}function P1(e){return function(n){this.textContent=e.call(this,n)}}function z1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&P1(a)),n}return i._value=e,i}function F1(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,z1(e))}function U1(){for(var e=this._name,n=this._id,o=im(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Dt(c,n);Ra(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new rn(i,this._parents,e,o)}function H1(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Wt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var j1=0;function rn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function im(){return++j1}var ln=ni.prototype;rn.prototype={constructor:rn,select:I1,selectAll:v1,selectChild:ln.selectChild,selectChildren:ln.selectChildren,filter:g1,merge:b1,selection:x1,transition:U1,call:ln.call,nodes:ln.nodes,node:ln.node,size:ln.size,empty:ln.empty,each:ln.each,on:E1,attr:t1,attrTween:r1,style:T1,styleTween:B1,text:O1,textTween:F1,remove:w1,tween:qE,delay:c1,duration:m1,ease:p1,easeVarying:y1,end:H1,[Symbol.iterator]:ln[Symbol.iterator]};function K1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var G1={time:null,delay:0,duration:250,ease:K1};function Y1(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function q1(e){var n,o;e instanceof rn?(n=e._id,e=e._name):(n=im(),(o=G1).time=wl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Ra(c,e,n,d,l,o||Y1(c,n));return new rn(i,this._parents,e,n)}ni.prototype.interrupt=KE,ni.prototype.transition=q1;const $a=e=>()=>e;function W1(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function sn(e,n,o){this.k=e,this.x=n,this.y=o}sn.prototype={constructor:sn,scale:function(e){return e===1?this:new sn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new sn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var So=new sn(1,0,0);sn.prototype;function Rl(e){e.stopImmediatePropagation()}function mi(e){e.preventDefault(),e.stopImmediatePropagation()}function J1(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function X1(){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 am(){return this.__zoom||So}function Z1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Q1(){return navigator.maxTouchPoints||"ontouchstart"in this}function e0(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function t0(){var e=J1,n=X1,o=e0,i=Z1,a=Q1,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Na,d=ua("start","zoom","end"),u,m,h,p=500,y=150,b=0,f=10;function g(E){E.property("__zoom",am).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(a).on("touchstart.zoom",R).on("touchmove.zoom",x).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(E,w,S,B){var z=E.selection?E.selection():E;z.property("__zoom",am),E!==z?I(E,w,S,B):z.interrupt().each(function(){$(this,arguments).event(B).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},g.scaleBy=function(E,w,S,B){g.scaleTo(E,function(){var z=this.__zoom.k,K=typeof w=="function"?w.apply(this,arguments):w;return z*K},S,B)},g.scaleTo=function(E,w,S,B){g.transform(E,function(){var z=n.apply(this,arguments),K=this.__zoom,J=S==null?N(z):typeof S=="function"?S.apply(this,arguments):S,re=K.invert(J),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(k(K,pe),J,re),z,l)},S,B)},g.translateBy=function(E,w,S,B){g.transform(E,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof S=="function"?S.apply(this,arguments):S),n.apply(this,arguments),l)},null,B)},g.translateTo=function(E,w,S,B,z){g.transform(E,function(){var K=n.apply(this,arguments),J=this.__zoom,re=B==null?N(K):typeof B=="function"?B.apply(this,arguments):B;return o(So.translate(re[0],re[1]).scale(J.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof S=="function"?-S.apply(this,arguments):-S),K,l)},B,z)};function k(E,w){return w=Math.max(r[0],Math.min(r[1],w)),w===E.k?E:new sn(w,E.x,E.y)}function _(E,w,S){var B=w[0]-S[0]*E.k,z=w[1]-S[1]*E.k;return B===E.x&&z===E.y?E:new sn(E.k,B,z)}function N(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function I(E,w,S,B){E.on("start.zoom",function(){$(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(B).end()}).tween("zoom",function(){var z=this,K=arguments,J=$(z,K).event(B),re=n.apply(z,K),pe=S==null?N(re):typeof S=="function"?S.apply(z,K):S,ce=Math.max(re[1][0]-re[0][0],re[1][1]-re[0][1]),Ne=z.__zoom,he=typeof w=="function"?w.apply(z,K):w,de=c(Ne.invert(pe).concat(ce/Ne.k),he.invert(pe).concat(ce/he.k));return function(_e){if(_e===1)_e=he;else{var Se=de(_e),me=ce/Se[2];_e=new sn(me,pe[0]-Se[0]*me,pe[1]-Se[1]*me)}J.zoom(null,_e)}})}function $(E,w,S){return!S&&E.__zooming||new C(E,w)}function C(E,w){this.that=E,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(E,w),this.taps=0}C.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,w){return this.mouse&&E!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&E!=="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(E){var w=Vt(this.that).datum();d.call(E,this.that,new W1(E,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),w)}};function A(E,...w){if(!e.apply(this,arguments))return;var S=$(this,w).event(E),B=this.__zoom,z=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),K=Gt(E);if(S.wheel)(S.mouse[0][0]!==K[0]||S.mouse[0][1]!==K[1])&&(S.mouse[1]=B.invert(S.mouse[0]=K)),clearTimeout(S.wheel);else{if(B.k===z)return;S.mouse=[K,B.invert(K)],Aa(this),S.start()}mi(E),S.wheel=setTimeout(J,y),S.zoom("mouse",o(_(k(B,z),S.mouse[0],S.mouse[1]),S.extent,l));function J(){S.wheel=null,S.end()}}function T(E,...w){if(h||!e.apply(this,arguments))return;var S=E.currentTarget,B=$(this,w,!0).event(E),z=Vt(E.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ce,!0),K=Gt(E,S),J=E.clientX,re=E.clientY;Au(E.view),Rl(E),B.mouse=[K,this.__zoom.invert(K)],Aa(this),B.start();function pe(Ne){if(mi(Ne),!B.moved){var he=Ne.clientX-J,de=Ne.clientY-re;B.moved=he*he+de*de>b}B.event(Ne).zoom("mouse",o(_(B.that.__zoom,B.mouse[0]=Gt(Ne,S),B.mouse[1]),B.extent,l))}function ce(Ne){z.on("mousemove.zoom mouseup.zoom",null),$u(Ne.view,B.moved),mi(Ne),B.event(Ne).end()}}function V(E,...w){if(e.apply(this,arguments)){var S=this.__zoom,B=Gt(E.changedTouches?E.changedTouches[0]:E,this),z=S.invert(B),K=S.k*(E.shiftKey?.5:2),J=o(_(k(S,K),B,z),n.apply(this,w),l);mi(E),s>0?Vt(this).transition().duration(s).call(I,J,B,E):Vt(this).call(g.transform,J,B,E)}}function R(E,...w){if(e.apply(this,arguments)){var S=E.touches,B=S.length,z=$(this,w,E.changedTouches.length===B).event(E),K,J,re,pe;for(Rl(E),J=0;J<B;++J)re=S[J],pe=Gt(re,this),pe=[pe,this.__zoom.invert(pe),re.identifier],z.touch0?!z.touch1&&z.touch0[2]!==pe[2]&&(z.touch1=pe,z.taps=0):(z.touch0=pe,K=!0,z.taps=1+!!u);u&&(u=clearTimeout(u)),K&&(z.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},p)),Aa(this),z.start())}}function x(E,...w){if(this.__zooming){var S=$(this,w).event(E),B=E.changedTouches,z=B.length,K,J,re,pe;for(mi(E),K=0;K<z;++K)J=B[K],re=Gt(J,this),S.touch0&&S.touch0[2]===J.identifier?S.touch0[0]=re:S.touch1&&S.touch1[2]===J.identifier&&(S.touch1[0]=re);if(J=S.that.__zoom,S.touch1){var ce=S.touch0[0],Ne=S.touch0[1],he=S.touch1[0],de=S.touch1[1],_e=(_e=he[0]-ce[0])*_e+(_e=he[1]-ce[1])*_e,Se=(Se=de[0]-Ne[0])*Se+(Se=de[1]-Ne[1])*Se;J=k(J,Math.sqrt(_e/Se)),re=[(ce[0]+he[0])/2,(ce[1]+he[1])/2],pe=[(Ne[0]+de[0])/2,(Ne[1]+de[1])/2]}else if(S.touch0)re=S.touch0[0],pe=S.touch0[1];else return;S.zoom("touch",o(_(J,re,pe),S.extent,l))}}function M(E,...w){if(this.__zooming){var S=$(this,w).event(E),B=E.changedTouches,z=B.length,K,J;for(Rl(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),K=0;K<z;++K)J=B[K],S.touch0&&S.touch0[2]===J.identifier?delete S.touch0:S.touch1&&S.touch1[2]===J.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(J=Gt(J,this),Math.hypot(m[0]-J[0],m[1]-J[1])<f)){var re=Vt(this).on("dblclick.zoom");re&&re.apply(this,arguments)}}}return g.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:$a(+E),g):i},g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:$a(!!E),g):e},g.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:$a(!!E),g):a},g.extent=function(E){return arguments.length?(n=typeof E=="function"?E:$a([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),g):n},g.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],g):[r[0],r[1]]},g.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],g):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},g.constrain=function(E){return arguments.length?(o=E,g):o},g.duration=function(E){return arguments.length?(s=+E,g):s},g.interpolate=function(E){return arguments.length?(c=E,g):c},g.on=function(){var E=d.on.apply(d,arguments);return E===d?g:E},g.clickDistance=function(E){return arguments.length?(b=(E=+E)*E,g):Math.sqrt(b)},g.tapDistance=function(E){return arguments.length?(f=+E,g):f},g}var Te=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Te||{}),Al=(e=>(e.Partial="partial",e.Full="full",e))(Al||{}),qn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(qn||{}),cn=(e=>(e.Strict="strict",e.Loose="loose",e))(cn||{}),$l=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))($l||{}),fi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(fi||{}),rm=(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))(rm||{});const n0=["INPUT","SELECT","TEXTAREA"],o0=typeof document<"u"?document:null;function Tl(e){var n,o;const i=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return n0.includes(i==null?void 0:i.nodeName)||a||!!r}function i0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function lm(e,n,o,i){const a=n.replace("+",`
|
|
27
|
+
`}}const ea="com.example",cg="command.domain";function Xo(e,n,o={}){const i=Yi(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??cg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const dg="CustomMoneyType",ug="Money";function mg(e){return!(e.type!==dg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function fg(e){const n=e.dbAttrs[0]??{modelId:Me(),physicalName:"",dataType:""},o={modelId:Me(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:ug,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function pg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>mg(l)?(a=!0,n=!0,fg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function hg(e,n){const o=new Map,i=[],a=new Map;for(const h of e.entities){const g=new Map,k=new Map,N=new Map,b=(_,E,I)=>{if(!_)return;o.get(_)||o.set(_,[{entityId:E,assignedId:_}]),i.push({id:_,entityId:E,sink:I}),I(_)};for(const _ of h.attributes){b(_.modelId,h.modelId,E=>g.set(_,E));for(const E of _.dbAttrs)b(E.modelId,h.modelId,I=>k.set(E,I))}for(const _ of h.indexes??[])b(_.modelId,h.modelId,E=>N.set(_,E));a.set(h,{attrs:g,cols:k,idx:N})}const r=new Set(o.keys()),l=new Map;for(const h of i){const g=(l.get(h.id)??0)+1;if(l.set(h.id,g),g===1)continue;const k=yg(h.id,g-1,r);r.add(k),o.get(h.id).push({entityId:h.entityId,assignedId:k}),h.sink(k)}const s=[...o.values()].reduce((h,g)=>h+Math.max(0,g.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(h,g)=>{var N;if(!g||!h)return g;const k=o.get(g);return!k||k.length<2?g:((N=k.find(b=>b.entityId===h))==null?void 0:N.assignedId)??g},d=new Map(e.associations.map(h=>[h.modelId,h])),u=(h,g)=>{const k=d.get(h);if(k)return k.end1.entityRef===g?k.end2.entityRef:k.end1.entityRef},m=e.entities.map(h=>{var _;const g=a.get(h),k=h.attributes.map(E=>{const I=g.attrs.get(E),A=E.dbAttrs.map(x=>{const R=g.cols.get(x);return R===x.modelId?x:{...x,modelId:R}});let T=E.derivedFrom;if(T){const x=u(T.associationRef,h.modelId),R=c(x,T.sourceAttributeRef);R!==T.sourceAttributeRef&&(T={...T,sourceAttributeRef:R})}return I!==E.modelId||T!==E.derivedFrom||A.some((x,R)=>x!==E.dbAttrs[R])?{...E,modelId:I,dbAttrs:A,derivedFrom:T}:E}),N=(_=h.indexes)==null?void 0:_.map(E=>{const I=g.idx.get(E),A=E.columns.map(L=>{const x=c(h.modelId,L.columnRef);return x===L.columnRef?L:{...L,columnRef:x}});return I!==E.modelId||A.some((L,x)=>L!==E.columns[x])?{...E,modelId:I,columns:A}:E});return k.some((E,I)=>E!==h.attributes[I])||N&&h.indexes&&N.some((E,I)=>E!==h.indexes[I])?{...h,attributes:k,...N?{indexes:N}:{}}:h}),p=e.associations.map(h=>{const g=c(h.end1.entityRef,h.end1.attributeRef),k=c(h.end2.entityRef,h.end2.attributeRef);return g===h.end1.attributeRef&&k===h.end2.attributeRef?h:{...h,end1:g===h.end1.attributeRef?h.end1:{...h.end1,attributeRef:g},end2:k===h.end2.attributeRef?h.end2:{...h.end2,attributeRef:k}}}),f=n.associationLayouts.map(h=>{const g=d.get(h.associationRef);if(!g)return h;const k=c(g.end1.entityRef,h.sourceColumnRef),N=c(g.end2.entityRef,h.targetColumnRef);return k===h.sourceColumnRef&&N===h.targetColumnRef?h:{...h,sourceColumnRef:k,targetColumnRef:N}});return{logical:{...e,entities:m,associations:p},layout:f.some((h,g)=>h!==n.associationLayouts[g])?{...n,associationLayouts:f}:n,reissued:s}}function yg(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function Rt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Gr(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function Oc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Lc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Oc);if(!i.length)continue;const a=o.filter(s=>!Oc(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),n.attributes=l}}function _o(e){return JSON.parse(JSON.stringify(e))}function Pc(e,n,o){var L;const i=o.idFactory??Me,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const x=new Set(n);for(const R of r.associations){const $=x.has(R.end1.entityRef),B=x.has(R.end2.entityRef);$!==B&&s.add($?R.end2.entityRef:R.end1.entityRef)}}const c=r.entities.filter(x=>s.has(x.modelId)),d=new Set(c.map(x=>x.modelId)),u=r.associations.filter(x=>d.has(x.end1.entityRef)&&d.has(x.end2.entityRef)),m=new Set(u.map(x=>x.modelId)),p=new Map,f=x=>{let R=p.get(x);return R||(R=i(),p.set(x,R)),R};for(const x of c){f(x.modelId);for(const R of x.attributes){f(R.modelId);for(const $ of R.dbAttrs)f($.modelId)}for(const R of x.indexes??[])f(R.modelId);for(const R of x.operations??[])f(R.modelId)}for(const x of u)f(x.modelId);const h=x=>p.get(x),g=c.map(x=>{const R=_o(x);R.modelId=h(x.modelId),R.attributes=R.attributes.map($=>gg($,h,m,d));for(const $ of R.indexes??[])$.modelId=h($.modelId),$.columns=$.columns.map(B=>Mn(B.columnRef)?B:{...B,columnRef:h(B.columnRef)}).filter(B=>B.columnRef!==void 0);for(const $ of R.operations??[])$.modelId=h($.modelId);return R});Lc(g);const k=u.map(x=>{const R=_o(x);return R.modelId=h(x.modelId),R.end1=zc(R.end1,h),R.end2=zc(R.end2,h),R}),N=[];for(const x of r.groups){const R=x.memberEntityRefs.filter(B=>d.has(B));if(R.length===0)continue;const $=_o(x);$.modelId=f(x.modelId),$.memberEntityRefs=R.map(B=>h(B)),N.push($)}const b=o.collisionSuffix??"_imported",_=new Set(o.existing.entities.map(x=>x.name)),E=new Set(o.existing.entities.map(x=>{var R;return(R=x.table)==null?void 0:R.physicalName}).filter(x=>!!x));for(const x of g)_.has(x.name)&&(x.name=`${x.name}${b}`),(L=x.table)!=null&&L.physicalName&&E.has(x.table.physicalName)&&(x.table.physicalName=`${x.table.physicalName}${b}`);const I=[];for(const x of l.entityLayouts){const R=h(x.entityRef);if(!R)continue;const $=_o(x);$.entityRef=R,$.geo={...$.geo,location:Yr($.geo.location,a)},$.attributeStyles&&($.attributeStyles=ta($.attributeStyles,h)),$.operationStyles&&($.operationStyles=ta($.operationStyles,h)),I.push($)}const A=[];for(const x of l.associationLayouts){const R=h(x.associationRef);if(!R)continue;const $=_o(x);$.associationRef=R,$.sourceColumnRef=x.sourceColumnRef?h(x.sourceColumnRef):void 0,$.targetColumnRef=x.targetColumnRef?h(x.targetColumnRef):void 0,$.waypoints=$.waypoints.map(B=>Yr(B,a)),A.push($)}const T=[];for(const x of l.groupLayouts){const R=h(x.groupRef);if(!R)continue;const $=_o(x);$.groupRef=R,$.geo={...$.geo,location:Yr($.geo.location,a)},delete $.memberNoteRefs,T.push($)}return{logical:{entities:g,associations:k,groups:N},layout:{entityLayouts:I,associationLayouts:A,groupLayouts:T},idMap:p}}function Yr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function gg(e,n,o,i){e.modelId=n(e.modelId);for(const a of e.dbAttrs)if(a.modelId=n(a.modelId),a.sharedColumnRef!==void 0){const r=n(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:n(e.derivedFrom.associationRef),sourceAttributeRef:n(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:n(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:n(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function zc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function ta(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function qr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function Pn(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>Pn(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!Pn(e[i],n[i]))return!1;return!0}return!1}function zn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||Pn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Fn(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function bg(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const _g=new Set(["attributes","operations","indexes","rev"]),kg=new Set(["end1","end2","rev"]),Eg=new Set(["memberEntityRefs","rev"]),Fc=new Set(["modelId"]),Ng=new Set(["modelId","columns"]),wg=new Set([]);function Ig(e,n,o,i){const a=Fn(n.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=zn(s,c,Fc);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Fn(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=zn(s,c,Fc);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Fn(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!Pn(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=zn(s,c,Ng);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function vg(e,n,o){const i=Fn(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:qr(l)});for(const{cur:l,tgt:s}of i.common){const c=zn(l,s,_g);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Ig(l.modelId,l,s,o)}const a=Fn(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:qr(l)});for(const{cur:l,tgt:s}of a.common){const c=zn(l,s,kg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=zn(l[d]??{},s[d]??{},wg);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=Fn(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:qr(l)});for(const{cur:l,tgt:s}of r.common){const c=zn(l,s,Eg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=bg(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function na(e,n,o,i,a,r,l){const s=Fn(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)Pn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function xg(e,n,o){na(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),na(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),na(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),na(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Cg(e,n){const o=[];return vg(e.logical,n.logical,o),xg(e.layout,n.layout,o),o}function Sg(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 Rg={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 Ag{constructor(n){Xe(this,"out",[]);Xe(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...Zo(n),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(n,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...Zo(n),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({...Zo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...Zo(n),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(n,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...Zo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Zo(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Ht(e,n,o,i){if(o==null||typeof o!="object")return;const a=Rg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Un(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Wr(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function En(e,n){var r,l,s,c,d,u,m,p;const o=Sg(n),i=new Ag(n.field),a=[...e].sort((f,h)=>f.seq-h.seq);for(const f of a)for(const h of f.ops)switch(o){case"entity":if(h.entityRef!==n.entityRef)break;h.kind==="entity.add"?Ht(i,f,h.value,"entity"):h.kind==="entity.update"?Un(i,f,h.patch):h.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Wr((r=h.value)==null?void 0:r.attributes,n.attributeRef);g&&Ht(i,f,g,"attribute")}else h.kind==="attribute.add"&&((l=h.value)==null?void 0:l.modelId)===n.attributeRef?Ht(i,f,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===n.attributeRef?Un(i,f,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===n.attributeRef||h.kind==="entity.remove")&&i.remove(f);break;case"operation":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Wr((s=h.value)==null?void 0:s.operations,n.operationRef);g&&Ht(i,f,g,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===n.operationRef?Ht(i,f,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===n.operationRef?Un(i,f,h.patch):(h.kind==="operation.remove"&&h.operationRef===n.operationRef||h.kind==="entity.remove")&&i.remove(f);break;case"index":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Wr((d=h.value)==null?void 0:d.indexes,n.indexRef);g&&Ht(i,f,g,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===n.indexRef?Ht(i,f,h.value,"index"):h.kind==="index.update"&&h.indexRef===n.indexRef?Un(i,f,h.patch):(h.kind==="index.remove"&&h.indexRef===n.indexRef||h.kind==="entity.remove")&&i.remove(f);break;case"association":if(h.associationRef!==n.associationRef)break;h.kind==="association.add"?Ht(i,f,h.value,"association"):h.kind==="association.update"?Un(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(h.associationRef!==n.associationRef)break;if(h.kind==="association.add"){const g=(m=h.value)==null?void 0:m[n.end];Ht(i,f,g,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===n.end?Un(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"group":if(h.groupRef!==n.groupRef)break;if(h.kind==="group.add"){Ht(i,f,h.value,"group");const g=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(g))for(const k of g)i.member(f,k,!1)}else h.kind==="group.update"?Un(i,f,h.patch):h.kind==="group.remove"?i.remove(f):h.kind==="group.addMember"&&h.entityRef!=null?i.member(f,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(f,h.entityRef,!0);break}return i.result()}const qe={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},$g={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":qe,"entityLayout.remove":qe,"entityLayout.move":qe,"entityLayout.resize":qe,"entityLayout.setCollapsed":qe,"entityLayout.setLocked":qe,"entityLayout.setStyle":qe,"entityLayout.setAttrStyle":qe,"entityLayout.setOpStyle":qe,"groupLayout.add":qe,"groupLayout.remove":qe,"groupLayout.move":qe,"groupLayout.resize":qe,"groupLayout.setLocked":qe,"groupLayout.setStyle":qe,"groupLayout.addNoteMember":qe,"groupLayout.removeNoteMember":qe,"associationLayout.add":qe,"associationLayout.remove":qe,"associationLayout.setWaypoints":qe,"note.add":qe,"note.remove":qe,"note.move":qe,"note.resize":qe,"note.setMemo":qe,"note.setStyle":qe,"noteConnection.add":qe,"noteConnection.remove":qe,"noteConnection.setWaypoints":qe},At=e=>typeof e=="string"?e:void 0,Tg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Uc(e){return At(e.containerRef)??At(e.entityRef)}function Jr(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=At(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function Xr(e){const n=$g[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=At(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Jr(o,"attributes","attribute",a),...Jr(o,"operations","operation",a),...Jr(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Uc(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?Tg(o):At(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=At(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=At(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Mg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=At(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Uc(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=At(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=At(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function Vg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Bg(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of Xr(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function oa(e,n){return e.map(o=>({...o,subject:n}))}function Hc(e,n){const o=e.filter(s=>s.ops.some(c=>Vg(c,n))),{attributes:i,operations:a,indexes:r}=Bg(o,n),l=[...oa(En(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...oa(En(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...oa(En(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...oa(En(o,{entityRef:n,indexRef:s}),{kind:"index",ref:s}));return l.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 Zr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Dg(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of Xr(i))a.existence==="add"&&n.add(Zr(a.subject));return n}function Og(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=Mg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Lg(e){const{entities:n,associations:o,groups:i}=Og(e),a=[];for(const r of n)for(const l of Hc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of En(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of En(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of En(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function Qr(e){const n=Lg(e),o=Dg(e),i=new Map;for(const l of n){const s=Zr(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of n){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=Zr(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...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 r.sort((l,s)=>s.seq-l.seq)}function jc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Pg(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of Xr(r)){if(!l.existence||l.inline)continue;const s=l.subject;zg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const zg=new Set(["attribute","operation","index"]);function el(e,n){const{fromSeq:o}=n,i=Qr(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const p=jc(m.subject);let f=s.get(p);f||(f={subject:m.subject,evs:[]},s.set(p,f)),f.evs.push(m)};for(const m of l)for(const p of m.actions)c({seq:m.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const m of Pg(e,o,r)){const p=s.get(jc(m.subject));p!=null&&p.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,h)=>f.seq-h.seq);const p=m.evs[m.evs.length-1];m.subject.kind==="entity"&&p.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const p=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||p&&f)continue;const h=new Map;let g=null;for(const N of m.evs){N.verb==="add"&&g!==null&&g!=="add"&&h.clear(),g=N.verb;for(const b of N.fields){const _=h.get(b.field);_?_.lastValue=b.value:h.set(b.field,{firstOld:b.oldValue,hasOld:b.oldValue!==void 0,lastValue:b.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const N=[];for(const[b,_]of h)N.push({field:b,value:_.lastValue});d.push({subject:m.subject,verb:"added",fields:N});continue}const k=[];for(const[N,b]of h)b.hasOld&&Pn(b.firstOld,b.lastValue)||k.push({field:N,value:b.lastValue,...b.hasOld?{oldValue:b.firstOld}:{}});k.length!==0&&d.push({subject:m.subject,verb:"modified",fields:k})}return{fromSeq:o,toSeq:r,entries:d}}function Kc(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class tl{constructor(n){Xe(this,"undoStack",[]);Xe(this,"redoStack",[]);Xe(this,"savePoint",null);Xe(this,"listeners",new Set);Xe(this,"commandListeners",new Set);Xe(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"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.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function Nt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Gc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function mt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function $t(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function Qe(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function nn(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function ia(e,n,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:n,...o})},invert(i){const a=Gc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=mt(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Yc(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Gc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=mt(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(p=>p.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function qc(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=Qe(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(Qe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(o)}]}}}}function Wc(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=Qe(i,e);o=a.name,a.name=n},invert(i){Qe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function ko(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=mt(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(n)],invert:[i(o)]}}}}function Jc(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=mt(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(n)],invert:[i(o)]}}}}function Qo(e,n){const o={...(e==null?void 0:e.properties)??{}};return n?o.swatch=n:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function Xc(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=Qo(r.style,n)},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=mt(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function Zc(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=mt(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(n)],invert:[i(o)]}}}}function Qc(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=mt(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(n)],invert:[i(o)]}}}}function nl(e){let n=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){n=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=n[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:n[l]}})}),{forward:i,invert:a}}}}function aa(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=Qo(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function ra(e,n,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:n,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function ed(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(o)}]}}}}function td(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={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){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function nd(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function la(e,n){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,n)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}}}}function od(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.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(n)],invert:[i(o)]}}}}function id(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.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(n)],invert:[i(o)]}}}}function ad(e,n){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Qo(a.style,n)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function rd(e,n){let o;return{label:n?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=n},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function jt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){Qe(o,e).attributes.push(n)},invert(o){const i=Qe(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function on(e,n,o){const i={},a=r=>{const l=Qe(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(i)}]}}}}function ld(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=Qe(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&Qe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function sd(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function ol(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Qe(a,e);i=r.attributes.map(s=>({...s}));const l=Gr([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&Qe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).attributes;return sd("attribute.update","attributeRef",e,r,i??[])}}}function cd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=Qe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=Qe(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,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:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function dd(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(i)}]}}}}function ud(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Qe(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=Qe(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:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function md(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Qe(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Gr([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=Qe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).operations??[];return sd("operation.update","operationRef",e,r,i??[])}}}function fd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=Qo(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function sa(e,n){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(n)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.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:n,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 pd(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={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){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function ca(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(o)}]}}}}function Tt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(i)}]}}}}function hd(e,n){return{label:"인덱스 추가",apply(o){const i=Qe(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=Qe(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function da(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(i)}]}}}}function yd(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Qe(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&Qe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Kt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ei=(e,n)=>{var o;return((o=$t(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function gd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=$t(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=$t(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ei(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Kt(e,r)],invert:[Kt(e,l)]}}}}function bd(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=$t(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=$t(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ei(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Kt(e,a)],invert:[Kt(e,r)]}}}}function _d(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=$t(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=$t(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Kt(e,ei(a,e))],invert:[Kt(e,i??[])]}}}}function kd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=$t(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=$t(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Kt(e,ei(o,e))],invert:[Kt(e,n??[])]}}}}function Ed(e,n,o){return{label:"waypoint 추가",apply(i){const a=$t(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=$t(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ei(i,e),r=a.slice();return r.splice(n,1),{forward:[Kt(e,a)],invert:[Kt(e,r)]}}}}function Nd(e){return{label:"노트 추가",apply(n){n.layout.notes.push(e)},invert(n){const o=n.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&n.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 wd(e){let n=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);n={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){n&&o.layout.notes.splice(n.index,0,n.item)},emitOps(){return n?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:n.item}]}:{forward:[],invert:[]}}}}function ti(e,n){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.notes.find(r=>r.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(n)],invert:[i(o)]}}}}function Id(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.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(n)],invert:[i(o)]}}}}function vd(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function xd(e,n){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Qo(a.style,n)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Cd(e,n){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(n)&&(l.memberNoteRefs.push(n),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(n);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}:{forward:[],invert:[]}}}}function Sd(e,n){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(n))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,n))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}}}}const Nn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),ua=(e,n,o)=>{var i;return((i=nn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Rd(e,n){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===n)){o=!1;return}r.connections.push({targetRef:n,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===n);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:{targetRef:n,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}]}:{forward:[],invert:[]}}}}function Ad(e,n){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===n))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${n}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.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:n}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:o.item}]}:{forward:[],invert:[]}}}}function $d(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=nn(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=nn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=ua(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Nn(e,n,l)],invert:[Nn(e,n,s)]}}}}function Td(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=nn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=nn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=ua(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Nn(e,n,r)],invert:[Nn(e,n,l)]}}}}function Md(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=nn(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=nn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=ua(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Nn(e,n,r)],invert:[Nn(e,n,l)]}}}}function Vd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=nn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=nn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Nn(e,n,ua(i,e,n))],invert:[Nn(e,n,o??[])]}}}}function We(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const Fg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:sa,addAttribute:jt,addEntity:ia,addEntityToGroup:nd,addGroup:ra,addIndex:hd,addNote:Nd,addNoteConnection:Rd,addNoteConnectionWaypoint:Td,addNoteToGroup:Cd,addOperation:cd,addWaypoint:Ed,clearNoteConnectionWaypoints:Vd,clearWaypoints:kd,composite:We,moveEntity:ko,moveGroup:od,moveNote:ti,moveNoteConnectionWaypoint:$d,moveWaypoint:gd,removeAssociation:pd,removeAttribute:ld,removeEntity:Yc,removeEntityFromGroup:la,removeGroup:td,removeIndex:yd,removeNote:wd,removeNoteConnection:Ad,removeNoteConnectionWaypoint:Md,removeNoteFromGroup:Sd,removeOperation:ud,removeWaypoint:bd,renameEntity:Wc,reorderAttributes:ol,reorderOperations:md,resizeEntity:Jc,resizeGroup:id,resizeNote:Id,setAllEntitiesCollapsed:nl,setAttributeSwatch:aa,setEntityCollapsed:Zc,setEntityLocked:Qc,setEntitySwatch:Xc,setGroupLocked:rd,setGroupSwatch:ad,setNoteMemo:vd,setNoteSwatch:xd,setOperationSwatch:fd,translateWaypoints:_d,updateAssociation:ca,updateAssociationEnd:Tt,updateAttribute:on,updateEntity:qc,updateGroup:ed,updateIndex:da,updateOperation:dd},Symbol.toStringTag,{value:"Module"}));class Bd{constructor(){Xe(this,"revs",new Map);Xe(this,"layoutVersion",0);Xe(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const Ug=[400,1200];function Hg(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function jg(e){const n=Hg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Kg=e=>new Promise(n=>setTimeout(n,e));class Dd{constructor(n){Xe(this,"cache",new Bd);Xe(this,"newClientOpId");Xe(this,"debounceMs");Xe(this,"retryDelaysMs");Xe(this,"emissions",new WeakMap);Xe(this,"open",null);Xe(this,"debounceHandle",null);Xe(this,"queue",[]);Xe(this,"sending",!1);Xe(this,"_frozen",!1);Xe(this,"stack",null);Xe(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Me,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??Ug}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(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(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((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(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!jg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Kg(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const Od=["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","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Ld=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Pd(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function Gg(e){return e.flatMap(n=>n.dbAttrs).length}function zd(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function Yg(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=Go(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function qg(e,n,o=Me){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Gg(i.attributes);if(a===0)return[];const r=zd(e,n),l=i.attributes.flatMap(c=>c.dbAttrs),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;Yg(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function Fd(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const h=r.get(f);if(!h)return[];l.push(h)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,h)=>f===c[h]))return[];const d=new Map(s.map((f,h)=>[f,h])),u=zd(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const g=c.map(N=>h.dbAttrs[d.get(N)]),k=g.reduce((N,b,_)=>b===h.dbAttrs[_]?N:N+1,0);k&&m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:g,moved:k})}return m}function Wg(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Jg(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Ud(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function yt(e,n){const o=Wg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>Qg(i,e))}}function Xg(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function il(e,n){const o=Xg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function al(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const Zg=new Set(["name","description","packageName","excludeDDLGeneration"]);function Qg(e,n){var a;const o=Yi(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(p=>p.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function Hd(e,n){const o=Jg(e,n);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 eb(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function tb(e,n){const o=eb(e,n);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 jd(e,n){const o=e.filter(i=>i.physicalName===n.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function rl(e){return e.by!==void 0&&e.by!=="name"}function nb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function ob(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function ib(e,n){const o=nb(e,n);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 Kd(e,n){const o=ob(e,n);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 Gd(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Yd(e){return Gd(e)&&e.dataType==null}function qd(e,n,o){const i=Gd(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...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 Wd(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let p=!1;for(const f of n.fields){const h=u.get(f.name);if(h!=null&&h.sharedColumnPhysicalName){const g={ref:h.sharedColumnPhysicalName,by:"physicalName"},k=jd(kn(i,a),g);if(!k.ok){s.push(k.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:k.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:k.value.modelId});continue}m.push({modelId:c(),physicalName:(h==null?void 0:h.physicalName)??"",dataType:"",...h!=null&&h.length?{length:h.length}:{},...h!=null&&h.scale?{scale:h.scale}:{},...(h==null?void 0:h.insertable)!=null?{insertable:h.insertable}:{},...(h==null?void 0:h.updatable)!=null?{updatable:h.updatable}:{}})}return p?null:{modelId:d,name:e.name,type:n.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:m}}const ab=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),rb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),lb=new Set(["description","identifying"]),sb=new Set(["multiplicity","navigable","composition"]),cb=new Set(["name","unique","description","parameters"]),db=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Eo(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const ll=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),ub=new Set([...ll].filter(e=>e!=="sharedColumnRef"));function mb(e,n,o,i){if(i||o.some(l=>!ub.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))ll.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function fb(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,p)=>{const f=n.fields[p],h=f?c.get(f.name):void 0;if(!h){d.push(m);return}if(h.sharedColumnPhysicalName){const k={ref:h.sharedColumnPhysicalName,by:"physicalName"},N=jd(kn(i,a),k);if(!N.ok){s.push(N.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:k}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:k,matches:N.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:N.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...h.physicalName!=null?{physicalName:h.physicalName}:{},...h.length!=null?{length:h.length}:{},...h.scale!=null?{scale:h.scale}:{},...h.insertable!=null?{insertable:h.insertable}:{},...h.updatable!=null?{updatable:h.updatable}:{}})}),u?null:d}function Jd(e,n,o){return{modelId:o(),name:e.name,order:n,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Xd(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=tb(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}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:n.name,unique:n.unique??!1,columns:l,...n.description?{description:n.description}:{},...n.parameters?{parameters:n.parameters}:{}}}function No(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function pb(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Pd(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function sl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of _c(n,o,i)){for(const u of c.remove)No(e,a,s,u);for(const u of c.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:s,entityRef:s,attributeRef:u.attributeId,patch:u.patch});const d=((l=n.entities.find(u=>u.modelId===s))==null?void 0:l.attributes)??[];for(const u of c.add)e.push({kind:"attribute.add",casUnit:"logical",containerRef:s,entityRef:s,value:{...u,order:r(s,d)}})}}function hb(e,n,o={}){const i=o.mkId??Me,a=o.embeddableCatalog??[],r=b=>a.find(_=>_.type===b),l=[],s=[],c=new Map,d=(b,_)=>{const E=c.get(b)??Rt(_);return c.set(b,E+1),E},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},h=new Set,g=(b,_)=>`${b}\0${_}`,k=new Set;for(const b of n)b.kind==="entity.add"&&(k.add(b.spec.name),b.spec.physicalName&&k.add(b.spec.physicalName));const N=new Set;return n.forEach((b,_)=>{var E,I,A,T,L;switch(b.kind){case"entity.add":{const x=e.entities.filter(v=>v.name===b.spec.name).map(v=>v.modelId);if(x.length||N.has(b.spec.name)){s.push({code:"entity-name-conflict",opIndex:_,handle:{ref:b.spec.name},matches:x});break}N.add(b.spec.name);const R=i(),$={modelId:R,name:b.spec.name,stereotype:b.spec.stereotype??"JPA_ENTITY",attributes:[],...b.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...b.spec.physicalName?{table:{physicalName:b.spec.physicalName}}:{}},B={ref:b.spec.name};let O=!1;for(const[v,M]of(b.spec.attributes??[]).entries()){if(M.type==="GroupCodeEnum"&&!M.groupCode){s.push({code:"groupcode-required",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0;continue}if(!r(M.type)&&!((E=M.embeddableOverrides)!=null&&E.length)&&Yd(M)){s.push({code:"datatype-required",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0;continue}const D=r(M.type);if(D){const U=Wd(M,D,v,$,e.entities,_,B,s,i);U?$.attributes.push(U):O=!0}else(I=M.embeddableOverrides)!=null&&I.length?(s.push({code:"embeddable-type-unresolved",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0):$.attributes.push(qd(M,v,i))}const y=(b.spec.operations??[]).map((v,M)=>Jd(v,M,i));y.length&&($.operations=y);const w=[];for(const v of b.spec.indexes??[]){const M=Xd($,v,_,B,s,i);M?w.push(M):O=!0}if(w.length&&($.indexes=w),O)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:R,value:$});break}case"entity.update":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Eo(b.patch,rb,["jpaAttrs.","table."]);if(R.length){s.push({code:"entity-patch-unknown-key",opIndex:_,entity:b.entity,keys:R});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:b.patch});break}case"entity.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=x.value.modelId,$=e.associations.filter(w=>w.end1.entityRef===R||w.end2.entityRef===R),B=new Set($.map(w=>w.modelId));for(const w of $)m.has(w.modelId)||(m.add(w.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:w.modelId}));for(const w of e.entities)if(w.modelId!==R)for(const v of w.attributes)v.embedded&&B.has(v.embedded.associationRef)&&No(l,f,w.modelId,v.modelId);for(const w of $){if(w.end1.entityRef===R||!w.end1.attributeRef)continue;const v=e.entities.find(D=>D.modelId===w.end1.entityRef),M=v==null?void 0:v.attributes.find(D=>D.modelId===w.end1.attributeRef&&D.attrType==="RELATION_REF");M&&No(l,f,v.modelId,M.modelId)}const O={...e,entities:e.entities.filter(w=>w.modelId!==R),associations:e.associations.filter(w=>!B.has(w.modelId))},y=new Set($.filter(w=>w.end1.entityRef===R&&w.end2.entityRef!==R).map(w=>w.end2.entityRef));for(const w of y)sl(l,O,w,i,f,d);for(const w of e.groups)w.memberEntityRefs.includes(R)&&(h.has(g(w.modelId,R))||(h.add(g(w.modelId,R)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:w.modelId,groupRef:w.modelId,entityRef:R})));p.add(R),l.push({kind:"entity.remove",casUnit:"logical",entityRef:R});break}case"attribute.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(b.spec.type==="GroupCodeEnum"&&!b.spec.groupCode){s.push({code:"groupcode-required",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}if(!r(b.spec.type)&&!((A=b.spec.embeddableOverrides)!=null&&A.length)&&Yd(b.spec)){s.push({code:"datatype-required",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}const R=d(x.value.modelId,x.value.attributes),$=r(b.spec.type);let B;if($)B=Wd(b.spec,$,R,x.value,e.entities,_,b.entity,s,i);else if((T=b.spec.embeddableOverrides)!=null&&T.length){s.push({code:"embeddable-type-unresolved",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}else B=qd(b.spec,R,i);if(!B)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:B});break}case"attribute.update":case"attribute.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Hd(x.value,b.attribute);if(!R.ok){s.push(R.reason==="not-found"?{code:"attribute-not-found",opIndex:_,entity:b.entity,handle:b.attribute}:{code:"attribute-ambiguous",opIndex:_,entity:b.entity,handle:b.attribute,matches:R.matches});break}if(b.kind==="attribute.update"){const $=[],B=[];let O=!1;for(const M of Object.keys(b.patch)){if(M.includes(".")){M.startsWith("dbAttrs.")?O=!0:B.push(M);continue}ll.has(M)?$.push(M):ab.has(M)||B.push(M)}if(B.length){s.push({code:"attribute-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.attribute,keys:B});break}if("attrType"in b.patch){const M=String(b.patch.attrType),D=Ld.includes(M)?M!==R.value.attrType?"transition":void 0:"unknown-value";if(D){s.push({code:"attribute-attrtype-unsupported",opIndex:_,entity:b.entity,handle:b.attribute,reason:D,current:R.value.attrType,requested:M});break}}const y="type"in b.patch?b.patch.type:R.value.type,w="groupCode"in b.patch?b.patch.groupCode:R.value.groupCode;if(y==="GroupCodeEnum"&&!w){s.push({code:"groupcode-required",opIndex:_,entity:b.entity,handle:b.attribute});break}let v=b.patch;if($.length){const M=mb(R.value,b.patch,$,O);if(!M){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:_,entity:b.entity,handle:b.attribute,keys:$});break}v=M}if((L=b.embeddableOverrides)!=null&&L.length){const M=r(R.value.type);if(!M||R.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:_,entity:b.entity,handle:b.attribute});break}const D=fb(R.value,M,b.embeddableOverrides,x.value,e.entities,_,b.entity,s);if(!D)break;v={...v,dbAttrs:D}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:R.value.modelId,patch:v})}else{const $=Ji(e,x.value.modelId,R.value.modelId);if($){const B=O=>{var y;return((y=e.entities.find(w=>w.modelId===O))==null?void 0:y.name)??O};s.push({code:"attribute-fk-managed",opIndex:_,entity:b.entity,handle:b.attribute,association:{from:B($.end1.entityRef),to:B($.end2.entityRef)}});break}No(l,f,x.value.modelId,R.value.modelId)}break}case"association.add":{const x=yt(e,b.spec.from),R=yt(e,b.spec.to);if(x.ok||s.push(gt(x.reason,_,b.spec.from,x.matches,k)),R.ok||s.push(gt(R.reason,_,b.spec.to,R.matches,k)),!x.ok||!R.ok)break;if(b.spec.identifying&&x.value.modelId===R.value.modelId){s.push({code:"self-identifying",opIndex:_,handle:{from:b.spec.from,to:b.spec.to}});break}const $=i(),B={modelId:$,...b.spec.identifying!=null?{identifying:b.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:b.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:R.value.modelId,multiplicity:b.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:b.spec.composition??!1}},O={...e,associations:[...e.associations,B]},y=Wo(O,R.value.modelId,i);y.add[0]&&(B.end2.attributeRef=y.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:$,value:B});for(const w of y.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:{...w,order:d(R.value.modelId,R.value.attributes)}});break}case"association.remove":{const x=yt(e,b.association.from),R=yt(e,b.association.to);if(x.ok||s.push(gt(x.reason,_,b.association.from,x.matches,k)),R.ok||s.push(gt(R.reason,_,b.association.to,R.matches,k)),!x.ok||!R.ok)break;const $=Ud(e,x.value.modelId,R.value.modelId);if($.length!==1){s.push($.length===0?{code:"association-not-found",opIndex:_,handle:b.association}:{code:"association-ambiguous",opIndex:_,handle:b.association,matches:$.map(w=>w.modelId)});break}const B=$[0];m.has(B.modelId)||(m.add(B.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:B.modelId}));const O=e.entities.find(w=>w.attributes.some(v=>{var M;return((M=v.embedded)==null?void 0:M.associationRef)===B.modelId}));if(O){const w=O.attributes.find(v=>{var M;return((M=v.embedded)==null?void 0:M.associationRef)===B.modelId});No(l,f,O.modelId,w.modelId);break}if(B.end1.attributeRef){const w=e.entities.find(M=>M.modelId===B.end1.entityRef),v=w==null?void 0:w.attributes.find(M=>M.modelId===B.end1.attributeRef&&M.attrType==="RELATION_REF");v&&No(l,f,w.modelId,v.modelId)}const y={...e,associations:e.associations.filter(w=>w.modelId!==B.modelId)};sl(l,y,B.end2.entityRef,i,f,d);break}case"association.update":{const x=Zd(e,b.association,_,s,k);if(!x)break;const R=b.patch.identifying,$=typeof R=="boolean"?R:void 0;if($===!0&&x.end1.entityRef===x.end2.entityRef){s.push({code:"self-identifying",opIndex:_,handle:b.association});break}const B=Eo(b.patch,lb);if(B.length){s.push({code:"association-patch-unknown-key",opIndex:_,handle:b.association,keys:B});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:b.patch}),$!==void 0&&$!==(x.identifying??!1)){const O={...e,associations:e.associations.map(y=>y.modelId===x.modelId?{...y,identifying:$}:y)};sl(l,O,x.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const x=Zd(e,b.association,_,s,k);if(!x)break;const R=b.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(b.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:_,handle:b.association});break}const $=Eo(b.patch,sb,["jpa."]);if($.length){s.push({code:"association-end-patch-unknown-key",opIndex:_,handle:b.association,keys:$});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:R,patch:b.patch});break}case"index.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Xd(x.value,b.spec,_,b.entity,s,i);if(!R)break;l.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.modelId,value:R});break}case"index.update":case"index.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(rl(b.index)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:b.index,target:"index"});break}const R=ib(x.value,b.index);if(!R.ok){s.push(R.reason==="not-found"?{code:"index-not-found",opIndex:_,entity:b.entity,handle:b.index}:{code:"index-ambiguous",opIndex:_,entity:b.entity,handle:b.index,matches:R.matches});break}if(b.kind==="index.update"){if("columns"in b.patch){s.push({code:"index-columns-patch-unsupported",opIndex:_,entity:b.entity,handle:b.index});break}const $=Eo(b.patch,cb);if($.length){s.push({code:"index-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.index,keys:$});break}l.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId,patch:b.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId});break}case"operation.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=u.get(x.value.modelId)??(x.value.operations?Rt(x.value.operations):0);u.set(x.value.modelId,R+1);const $=Jd(b.spec,R,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:$.modelId,value:$});break}case"operation.update":case"operation.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(rl(b.operation)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:b.operation,target:"operation"});break}const R=Kd(x.value,b.operation);if(!R.ok){s.push(R.reason==="not-found"?{code:"operation-not-found",opIndex:_,entity:b.entity,handle:b.operation}:{code:"operation-ambiguous",opIndex:_,entity:b.entity,handle:b.operation,matches:R.matches});break}if(b.kind==="operation.update"){const $=Eo(b.patch,db);if($.length){s.push({code:"operation-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.operation,keys:$});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId,patch:b.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=b.kind==="attribute.reorder",R=yt(e,b.entity);if(!R.ok){s.push(gt(R.reason,_,b.entity,R.matches,k));break}const $=x?b.order:b.operations,B=[],O=new Set;let y=!1;for(const D of $){if(!x&&rl(D)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:D,target:"operation"}),y=!0;continue}const U=x?Hd(R.value,D):Kd(R.value,D);if(!U.ok){s.push(U.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:_,entity:b.entity,handle:D}:{code:"reorder-handle-ambiguous",opIndex:_,entity:b.entity,handle:D,matches:U.matches}),y=!0;continue}if(O.has(U.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:_,entity:b.entity,handle:D}),y=!0;continue}O.add(U.value.modelId),B.push(U.value)}if(y)break;const v=[...x?R.value.attributes:R.value.operations??[]].sort((D,U)=>D.order-U.order).filter(D=>!O.has(D.modelId)),M=[...B,...v];if(M.forEach((D,U)=>{D.order!==U&&l.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:D.modelId,patch:{order:U}}:{kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:D.modelId,patch:{order:U}})}),x)for(const D of Fd(e,R.value.modelId,M.map(U=>U.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:D.entityId,entityRef:D.entityId,attributeRef:D.attributeId,patch:{dbAttrs:D.dbAttrs}});break}case"group.add":{const x=[];let R=!1;for(const O of b.spec.members){const y=yt(e,O);if(!y.ok){s.push(gt(y.reason,_,O,y.matches,k)),R=!0;continue}x.push(y.value.modelId)}if(R)break;const $=i(),B={modelId:$,excludeDDLGeneration:b.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...b.spec.name?{name:b.spec.name}:{},...b.spec.packageName?{packageName:b.spec.packageName}:{},...b.spec.description?{description:b.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:$,value:B});break}case"group.update":{const x=il(e,b.group);if(!x.ok){s.push(al(x,_,b.group));break}const R=Eo(b.patch,Zg);if(R.length){s.push({code:"group-patch-unknown-key",opIndex:_,handle:b.group,keys:R});break}l.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:b.patch});break}case"group.remove":{const x=il(e,b.group);if(!x.ok){s.push(al(x,_,b.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=il(e,b.group);if(!x.ok){s.push(al(x,_,b.group));break}const R=yt(e,b.entity);if(!R.ok){s.push(gt(R.reason,_,b.entity,R.matches,k));break}const $=x.value.memberEntityRefs.includes(R.value.modelId);if(b.kind==="group.addMember"?$:!$)break;if(b.kind==="group.removeMember"){if(h.has(g(x.value.modelId,R.value.modelId)))break;h.add(g(x.value.modelId,R.value.modelId))}l.push({kind:b.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:R.value.modelId});break}}}),s.length||pb(l,e,f,p),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function gt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function Zd(e,n,o,i,a){const r=yt(e,n.from),l=yt(e,n.to);if(r.ok||i.push(gt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(gt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Ud(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:n}:{code:"association-ambiguous",opIndex:o,handle:n,matches:s.map(c=>c.modelId)}),null):s[0]}const Qd={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},yb={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},gb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},bb={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},wn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},_b={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:{...wn,description:"속성 설명(다국어)."},columnLogicalName:{...wn,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},kb={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. 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 — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},eu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Eb={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...eu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...eu,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},Nb={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Qd,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},wb={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...wn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Ib={type:"object",properties:{name:{...wn,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},vb={type:"object",description:"기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부).",properties:{name:{type:"string"},type:{type:"string"},customType:{type:"string"},attrType:{type:"string",enum:[...Ld],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},description:{...wn,description:"속성 설명(다국어)."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...wn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},xb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Cb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Sb={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...wn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Rb={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경.'},Ab={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function it(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const $b={"entity.add":it("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":it("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":it("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":it("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":it("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":it("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":it("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":it("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":it("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":it("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":it("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":it("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":it("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":it("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":it("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":it("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":it("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":it("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":it("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":it("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":it("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":it("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":it("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},Tb={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},Mb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...wn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},tu={anyOf:Od.map(e=>$b[e])},Vb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Qd,nameHandle:yb,groupHandle:Tb,assocHandle:gb,entitySpec:bb,attrSpec:_b,embeddableOverrides:kb,assocSpec:Eb,indexSpec:Nb,operationSpec:wb,groupSpec:Ib,entityUpdatePatch:Rb,attrUpdatePatch:vb,assocUpdatePatch:xb,assocEndUpdatePatch:Ab,indexUpdatePatch:Cb,operationUpdatePatch:Sb,groupUpdatePatch:Mb,symbolicOp:tu}};function Bb(e,n,o,i={}){const a=i.mkClientOpId??Me,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const nu={location:{x:0,y:0},size:{width:220,height:140}};function ou(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 Db=/^[-=_*~\s]{3,}$/;function Ob(e){return e.attrType&&e.attrType!=="NORMAL"||!Db.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Lb(e){return e.type===tn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Pb(e,n){if(e.attrType==="DIVIDER"||Ob(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=Lb(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(ou)}}function zb(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Fb(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(n=>({columnRef:n.targetColumn.refId,descending:n.descending}))}}function Ub(e){var n,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(Pb),operations:(n=e.operations)==null?void 0:n.map(zb),indexes:(o=e.indexes)==null?void 0:o.map(Fb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Hb(e){const n={};for(const i of e.attributes)i.style&&(n[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??{...nu},style:e.style,attributeStyles:Object.keys(n).length?n:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function iu(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 cl(e){var n;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(n=e.attribute)==null?void 0:n.modelId,jpa:iu(e)}}function jb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>dl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Kb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:jb(e),end1:cl(e.end1),end2:cl(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:n,layout:o}}function dl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function au(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function ru(e){var o;const n=e.attribute;return(n==null?void 0:n.attrType)==="EMBED_OWN"&&(((o=n.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function lu(e,n){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:n,dbAttrs:(e.dbAttrs??[]).map(ou)}}function Gb(e,n,o){var E,I;const i=dl(e.end1.attribute),a=dl(e.end2.attribute);if(i===a)return Kb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(I=(E=s.dbAttrs)==null?void 0:E[0])==null?void 0:I.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((A,T)=>Math.max(A,T.order),-1)+1:s.order??0,p={...lu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const f=n.get(r.endModel.refId),h=l.attribute;let g;if(h&&f&&r.navigable){const A=Ui(l.multiplicity);g={modelId:h.modelId??crypto.randomUUID(),name:co(h.name??ji((u==null?void 0:u.name)??l.endModel.refId,A),new Set(f.attributes.map(T=>T.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((T,L)=>Math.max(T,L.order),-1)+1,dbAttrs:[]},f.attributes.push(g)}const k=(A,T)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:T?g==null?void 0:g.modelId:p.modelId,jpa:iu(A)}),N=r.endModel.refId===l.endModel.refId,b={modelId:e.modelId,description:e.description,identifying:!N&&p.identifier===!0?!0:void 0,end1:k(e.end1,i),end2:k(e.end2,a)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:b,layout:_}}function Yb(e,n){const o=e.targetModelId?n.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 qb(e,n,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((g,k)=>Math.max(g,k.order),-1)+1:l.order??0,d={...lu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Yb(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...cl(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function Wb(e,n){var i,a,r,l;const o=[];for(const s of n){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function su(e,n={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=Wb(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+n.x,y:a.location.y+n.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function cu(e,n,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(n.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function Jb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(p=>p.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(p=>p.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=Ui(i.end2.multiplicity),u=ji(r.name,d),m=co(u,new Set(a.attributes.map(p=>p.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((p,f)=>Math.max(p,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function Xb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function du(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if((l==null?void 0:l.stereotype)==="JPA_EMBEDDABLE")continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Us(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function uu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?Zb(n):Qb(n)}function Zb(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:p,...f}=m;return p!=null&&(o[m.modelId]=p),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);Jb(a,r),Xb(a,r),du(a,r);const{version:s,...c}=e.layout;cu(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Qb(e){var N,b;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(_,E)=>{o.push(Ub(_));const I=Hb(_);I.geo={location:{x:I.geo.location.x+E.x,y:I.geo.location.y+E.y},size:I.geo.size},i.push(I);for(const A of _.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const _ of e.entities??[])d(_,u);const m=[];for(const _ of e.groups??[]){const E=_.entities??[];l.push({modelId:_.modelId,name:_.name,description:_.description,packageName:_.packageName,excludeDDLGeneration:_.excludeDDLGeneration??!1,memberEntityRefs:E.map(A=>A.modelId)});const I=((N=_.geo)==null?void 0:N.location)??u;if(_.geo){const A=(_.notes??[]).map(T=>T.modelId);s.push({groupRef:_.modelId,geo:_.geo,style:_.style,locked:_.locked,memberNoteRefs:A.length?A:void 0})}for(const A of E)d(A,I);for(const A of _.notes??[])m.push(su(A,I))}const p=new Map(o.map(_=>[_.modelId,_])),f=new Map,h=new Map;for(const _ of o)for(const E of _.attributes)for(const I of E.dbAttrs)f.set(I.modelId,E.modelId),h.set(I.modelId,I);for(const _ of c)for(const E of[_.end1,_.end2]){const I=E.attribute;if(I&&(((b=I.dbAttrs)==null?void 0:b.length)??0)>0)for(const A of I.dbAttrs)A.modelId&&f.set(A.modelId,I.modelId)}for(const _ of c){const E=au(_.end1.attribute),I=au(_.end2.attribute),A=ru(_.end1)||ru(_.end2),{assoc:T,layout:L}=E!==I||A?qb(_,p,h):Gb(_,p,f);a.push(T),r.push(L)}cu(o,a,r),Lc(o),du(o,a);const g={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(_=>su(_)),...m]}},k={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:k}}function mu(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 e_(e,n){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(mu),style:n}}function t_(e,n){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:n}}function n_(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(n=>({targetColumn:{refId:n.columnRef},descending:n.descending}))}}function In(e,n){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:n??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function o_(e,n){const o=n==null?void 0:n.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 r;return{...mu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function i_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function fu(e,n){const o=l=>{if(!l.attributeRef)return;const s=n.logical.entities.find(c=>c.modelId===l.entityRef);return s==null?void 0:s.attributes.find(c=>c.modelId===l.attributeRef)},i=o(e.end1),a=o(e.end2),r=l=>(l==null?void 0:l.attrType)==="RELATION_OWN"?l:void 0;return(i==null?void 0:i.attrType)==="RELATION_REF"?{navEnd:e.end1,fkEnd:e.end2,navAttr:i,fk:r(a)}:(a==null?void 0:a.attrType)==="RELATION_REF"?{navEnd:e.end2,fkEnd:e.end1,navAttr:a,fk:r(i)}:null}function a_(e){const n=new Set;for(const o of e.logical.associations){const i=fu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function r_(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function l_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function s_(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:l_(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function c_(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var h;return((h=f.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.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((m,p)=>s_(m,l[p]))},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:In(e.end1,c?s:u),end2:In(e.end2,c?u:s)}}function d_(e,n,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:In(e.end1,e.end1.legacyEmbedRaw),end2:In(e.end2,e.end2.legacyEmbedRaw)};const a=c_(e,n,i);if(a)return a;const r=fu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?o_(r.fk,l):void 0,c=i_(r.navAttr);return{...i,end1:In(e.end1,r.navEnd===e.end1?s:c),end2:In(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:In(e.end1),end2:In(e.end2)}}function pu(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(p=>p.entityRef===e.modelId),l=n.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>n.layout.associationLayouts.find(f=>f.associationRef===p),c=(r==null?void 0:r.geo)??{...nu},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(p=>!o.has(p.modelId)&&!i.has(p.modelId)).map(p=>{var f;return e_(p,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var f;return t_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>d_(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(n_),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function u_(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>hu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>pu(c,n,o,i,l)),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 hu(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function m_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=a_(e),r=r_(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:n.id,diagramVersion:n.diagramVersion,version:n.version,size:n.size??e.layout.canvasSize,packageName:n.packageName??e.logical.packageName,entities:i.map(s=>pu(s,e,a,r)),groups:e.logical.groups.map(s=>u_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>hu(s))}}function f_(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,referenceOnly:n.referenceOnly,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.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:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const p_=["notNull"];function h_(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=uu(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(p=>[p.modelId,p]))]));for(const m of i.logical.entities){const p=c.get(m.modelId);if(p)for(const f of m.attributes){const h=p.get(f.modelId);if(!h){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const g={};for(const k of p_)f[k]===!0!=(h[k]===!0)&&(g[k]=f[k],s.attributeFieldsByName[k]=(s.attributeFieldsByName[k]??0)+1);Object.keys(g).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:g}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const p=d.get(m.modelId);p&&(m.end1.attributeRef&&m.end1.attributeRef!==p.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&p.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function ni(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function an(e){return typeof e=="function"?e():t.unref(e)}const y_=typeof window<"u"&&typeof document<"u",g_=e=>typeof e<"u",b_=Object.prototype.toString,__=e=>b_.call(e)==="[object Object]",k_=()=>{};function E_(e,n){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>n.apply(this,i),{fn:n,thisArg:this,args:i})).then(a).catch(r)})}return o}const yu=e=>e();function N_(e=yu){const n=t.ref(!0);function o(){n.value=!1}function i(){n.value=!0}const a=(...r)=>{n.value&&e(...r)};return{isActive:t.readonly(n),pause:o,resume:i,eventFilter:a}}function gu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function w_(e,n,o={}){const{eventFilter:i=yu,...a}=o;return t.watch(e,E_(i,n),a)}function wo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=N_(i);return{stop:w_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function I_(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=an(n.replaceRef))!=null?r:!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 ul(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:h,throwOnTimeout:g}={}){let k=null;const b=[new Promise(_=>{k=t.watch(e,E=>{m(E)!==n&&(k==null||k(),_(E))},{flush:p,deep:f,immediate:!0})})];return h!=null&&b.push(gu(h,g).then(()=>an(e)).finally(()=>k==null?void 0:k())),Promise.race(b)}function i(m,p){if(!t.isRef(m))return o(E=>E===m,p);const{flush:f="sync",deep:h=!1,timeout:g,throwOnTimeout:k}=p??{};let N=null;const _=[new Promise(E=>{N=t.watch([e,m],([I,A])=>{n!==(I===A)&&(N==null||N(),E(I))},{flush:f,deep:h,immediate:!0})})];return g!=null&&_.push(gu(g,k).then(()=>an(e)).finally(()=>(N==null||N(),an(e)))),Promise.race(_)}function a(m){return o(p=>!!p,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,p){return o(f=>{const h=Array.from(f);return h.includes(m)||h.includes(an(m))},p)}function d(m){return u(1,m)}function u(m=1,p){let f=-1;return o(()=>(f+=1,f>=m),p)}return Array.isArray(an(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return ul(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return ul(e,!n)}}}function ml(e){return ul(e)}function v_(e){var n;const o=an(e);return(n=o==null?void 0:o.$el)!=null?n:o}const bu=y_?window:void 0;function _u(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=bu):[n,o,i,a]=e,!n)return k_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,p,f)=>(u.addEventListener(m,p,f),()=>u.removeEventListener(m,p,f)),c=t.watch(()=>[v_(n),an(a)],([u,m])=>{if(l(),!u)return;const p=__(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(h=>s(u,f,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ni(d),d}function x_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function ku(...e){let n,o,i={};e.length===3?(n=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],i=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:a=bu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=x_(n);return _u(a,r,u=>{u.repeat&&an(s)||c(u)&&o(u)},l)}function C_(e){return JSON.parse(JSON.stringify(e))}function fl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:p}=i,f=t.getCurrentInstance(),h=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=d;n||(n="modelValue"),g=g||`update:${n.toString()}`;const k=_=>s?typeof s=="function"?s(_):C_(_):_,N=()=>g_(e[n])?k(e[n]):m,b=_=>{p?p(_)&&h(g,_):h(g,_)};if(c){const _=N(),E=t.ref(_);let I=!1;return t.watch(()=>e[n],A=>{I||(I=!0,E.value=k(A),t.nextTick(()=>I=!1))}),t.watch(E,A=>{!I&&(A!==e[n]||u)&&b(A)},{deep:u}),E}else return t.computed({get(){return N()},set(_){b(_)}})}var S_={value:()=>{}};function ma(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new fa(o)}function fa(e){this._=e}function R_(e,n){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&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}fa.prototype=ma.prototype={constructor:fa,on:function(e,n){var o=this._,i=R_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=A_(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Eu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Eu(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new fa(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function A_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Eu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=S_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var pl="http://www.w3.org/1999/xhtml";const Nu={svg:"http://www.w3.org/2000/svg",xhtml:pl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Nu.hasOwnProperty(n)?{space:Nu[n],local:e}:e}function $_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===pl&&n.documentElement.namespaceURI===pl?n.createElement(e):n.createElementNS(o,e)}}function T_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wu(e){var n=pa(e);return(n.local?T_:$_)(n)}function M_(){}function hl(e){return e==null?M_:function(){return this.querySelector(e)}}function V_(e){typeof e!="function"&&(e=hl(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Ct(i,this._parents)}function B_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function D_(){return[]}function Iu(e){return e==null?D_:function(){return this.querySelectorAll(e)}}function O_(e){return function(){return B_(e.apply(this,arguments))}}function L_(e){typeof e=="function"?e=O_(e):e=Iu(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Ct(i,a)}function vu(e){return function(){return this.matches(e)}}function xu(e){return function(n){return n.matches(e)}}var P_=Array.prototype.find;function z_(e){return function(){return P_.call(this.children,e)}}function F_(){return this.firstElementChild}function U_(e){return this.select(e==null?F_:z_(typeof e=="function"?e:xu(e)))}var H_=Array.prototype.filter;function j_(){return Array.from(this.children)}function K_(e){return function(){return H_.call(this.children,e)}}function G_(e){return this.selectAll(e==null?j_:K_(typeof e=="function"?e:xu(e)))}function Y_(e){typeof e!="function"&&(e=vu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Ct(i,this._parents)}function Cu(e){return new Array(e.length)}function q_(){return new Ct(this._enter||this._groups.map(Cu),this._parents)}function ha(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ha.prototype={constructor:ha,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function W_(e){return function(){return e}}function J_(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new ha(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function X_(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ha(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function Z_(e){return e.__data__}function Q_(e,n){if(!arguments.length)return Array.from(this,Z_);var o=n?X_:J_,i=this._parents,a=this._groups;typeof e!="function"&&(e=W_(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=ek(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),k=l[d]=new Array(h),N=c[d]=new Array(p);o(u,m,g,k,N,f,n);for(var b=0,_=0,E,I;b<h;++b)if(E=g[b]){for(b>=_&&(_=b+1);!(I=k[_])&&++_<h;);E._next=I||null}}return l=new Ct(l,i),l._enter=s,l._exit=c,l}function ek(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function tk(){return new Ct(this._exit||this._groups.map(Cu),this._parents)}function nk(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function ok(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Ct(s,this._parents)}function ik(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function ak(e){e||(e=rk);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Ct(a,this._parents).order()}function rk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function lk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sk(){return Array.from(this)}function ck(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function dk(){let e=0;for(const n of this)++e;return e}function uk(){return!this.node()}function mk(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function fk(e){return function(){this.removeAttribute(e)}}function pk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hk(e,n){return function(){this.setAttribute(e,n)}}function yk(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function gk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function bk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function _k(e,n){var o=pa(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?pk:fk:typeof n=="function"?o.local?bk:gk:o.local?yk:hk)(o,n))}function Su(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kk(e){return function(){this.style.removeProperty(e)}}function Ek(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Nk(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function wk(e,n,o){return arguments.length>1?this.each((n==null?kk:typeof n=="function"?Nk:Ek)(e,n,o??"")):Io(this.node(),e)}function Io(e,n){return e.style.getPropertyValue(n)||Su(e).getComputedStyle(e,null).getPropertyValue(n)}function Ik(e){return function(){delete this[e]}}function vk(e,n){return function(){this[e]=n}}function xk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ck(e,n){return arguments.length>1?this.each((n==null?Ik:typeof n=="function"?xk:vk)(e,n)):this.node()[e]}function Ru(e){return e.trim().split(/^|\s+/)}function yl(e){return e.classList||new Au(e)}function Au(e){this._node=e,this._names=Ru(e.getAttribute("class")||"")}Au.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function $u(e,n){for(var o=yl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Tu(e,n){for(var o=yl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Sk(e){return function(){$u(this,e)}}function Rk(e){return function(){Tu(this,e)}}function Ak(e,n){return function(){(n.apply(this,arguments)?$u:Tu)(this,e)}}function $k(e,n){var o=Ru(e+"");if(arguments.length<2){for(var i=yl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Ak:n?Sk:Rk)(o,n))}function Tk(){this.textContent=""}function Mk(e){return function(){this.textContent=e}}function Vk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Bk(e){return arguments.length?this.each(e==null?Tk:(typeof e=="function"?Vk:Mk)(e)):this.node().textContent}function Dk(){this.innerHTML=""}function Ok(e){return function(){this.innerHTML=e}}function Lk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Pk(e){return arguments.length?this.each(e==null?Dk:(typeof e=="function"?Lk:Ok)(e)):this.node().innerHTML}function zk(){this.nextSibling&&this.parentNode.appendChild(this)}function Fk(){return this.each(zk)}function Uk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Hk(){return this.each(Uk)}function jk(e){var n=typeof e=="function"?e:wu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Kk(){return null}function Gk(e,n){var o=typeof e=="function"?e:wu(e),i=n==null?Kk:typeof n=="function"?n:hl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Yk(){var e=this.parentNode;e&&e.removeChild(this)}function qk(){return this.each(Yk)}function Wk(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Jk(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Xk(e){return this.select(e?Jk:Wk)}function Zk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Qk(e){return function(n){e.call(this,n,this.__data__)}}function eE(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function tE(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function nE(e,n,o){return function(){var i=this.__on,a,r=Qk(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function oE(e,n,o){var i=eE(e+""),a,r=i.length,l;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<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?nE:tE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Mu(e,n,o){var i=Su(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function iE(e,n){return function(){return Mu(this,e,n)}}function aE(e,n){return function(){return Mu(this,e,n.apply(this,arguments))}}function rE(e,n){return this.each((typeof n=="function"?aE:iE)(e,n))}function*lE(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Vu=[null];function Ct(e,n){this._groups=e,this._parents=n}function oi(){return new Ct([[document.documentElement]],Vu)}function sE(){return this}Ct.prototype=oi.prototype={constructor:Ct,select:V_,selectAll:L_,selectChild:U_,selectChildren:G_,filter:Y_,data:Q_,enter:q_,exit:tk,join:nk,merge:ok,selection:sE,order:ik,sort:ak,call:lk,nodes:sk,node:ck,size:dk,empty:uk,each:mk,attr:_k,style:wk,property:Ck,classed:$k,text:Bk,html:Pk,raise:Fk,lower:Hk,append:jk,insert:Gk,remove:qk,clone:Xk,datum:Zk,on:oE,dispatch:rE,[Symbol.iterator]:lE};function Mt(e){return typeof e=="string"?new Ct([[document.querySelector(e)]],[document.documentElement]):new Ct([[e]],Vu)}function cE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Gt(e,n){if(e=cE(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const dE={passive:!1},ii={capture:!0,passive:!1};function gl(e){e.stopImmediatePropagation()}function vo(e){e.preventDefault(),e.stopImmediatePropagation()}function Bu(e){var n=e.document.documentElement,o=Mt(e).on("dragstart.drag",vo,ii);"onselectstart"in n?o.on("selectstart.drag",vo,ii):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Du(e,n){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);n&&(i.on("click.drag",vo,ii),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 ya=e=>()=>e;function bl(e,{sourceEvent:n,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}bl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function uE(e){return!e.ctrlKey&&!e.button}function mE(){return this.parentNode}function fE(e,n){return n??{x:e.x,y:e.y}}function pE(){return navigator.maxTouchPoints||"ontouchstart"in this}function hE(){var e=uE,n=mE,o=fE,i=pE,a={},r=ma("start","drag","end"),l=0,s,c,d,u,m=0;function p(E){E.on("mousedown.drag",f).filter(i).on("touchstart.drag",k).on("touchmove.drag",N,dE).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(E,I){if(!(u||!e.call(this,E,I))){var A=_(this,n.call(this,E,I),E,I,"mouse");A&&(Mt(E.view).on("mousemove.drag",h,ii).on("mouseup.drag",g,ii),Bu(E.view),gl(E),d=!1,s=E.clientX,c=E.clientY,A("start",E))}}function h(E){if(vo(E),!d){var I=E.clientX-s,A=E.clientY-c;d=I*I+A*A>m}a.mouse("drag",E)}function g(E){Mt(E.view).on("mousemove.drag mouseup.drag",null),Du(E.view,d),vo(E),a.mouse("end",E)}function k(E,I){if(e.call(this,E,I)){var A=E.changedTouches,T=n.call(this,E,I),L=A.length,x,R;for(x=0;x<L;++x)(R=_(this,T,E,I,A[x].identifier,A[x]))&&(gl(E),R("start",E,A[x]))}}function N(E){var I=E.changedTouches,A=I.length,T,L;for(T=0;T<A;++T)(L=a[I[T].identifier])&&(vo(E),L("drag",E,I[T]))}function b(E){var I=E.changedTouches,A=I.length,T,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),T=0;T<A;++T)(L=a[I[T].identifier])&&(gl(E),L("end",E,I[T]))}function _(E,I,A,T,L,x){var R=r.copy(),$=Gt(x||A,I),B,O,y;if((y=o.call(E,new bl("beforestart",{sourceEvent:A,target:p,identifier:L,active:l,x:$[0],y:$[1],dx:0,dy:0,dispatch:R}),T))!=null)return B=y.x-$[0]||0,O=y.y-$[1]||0,function w(v,M,D){var U=$,W;switch(v){case"start":a[L]=w,W=l++;break;case"end":delete a[L],--l;case"drag":$=Gt(D||M,I),W=l;break}R.call(v,E,new bl(v,{sourceEvent:M,subject:y,target:p,identifier:L,active:W,x:$[0]+B,y:$[1]+O,dx:$[0]-U[0],dy:$[1]-U[1],dispatch:R}),T)}}return p.filter=function(E){return arguments.length?(e=typeof E=="function"?E:ya(!!E),p):e},p.container=function(E){return arguments.length?(n=typeof E=="function"?E:ya(E),p):n},p.subject=function(E){return arguments.length?(o=typeof E=="function"?E:ya(E),p):o},p.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:ya(!!E),p):i},p.on=function(){var E=r.on.apply(r,arguments);return E===r?p:E},p.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,p):Math.sqrt(m)},p}function _l(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Ou(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ai(){}var ri=.7,ga=1/ri,xo="\\s*([+-]?\\d+)\\s*",li="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yE=/^#([0-9a-f]{3,8})$/,gE=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),bE=new RegExp(`^rgb\\(${Yt},${Yt},${Yt}\\)$`),_E=new RegExp(`^rgba\\(${xo},${xo},${xo},${li}\\)$`),kE=new RegExp(`^rgba\\(${Yt},${Yt},${Yt},${li}\\)$`),EE=new RegExp(`^hsl\\(${li},${Yt},${Yt}\\)$`),NE=new RegExp(`^hsla\\(${li},${Yt},${Yt},${li}\\)$`),Lu={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};_l(ai,Hn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Pu,formatHex:Pu,formatHex8:wE,formatHsl:IE,formatRgb:zu,toString:zu});function Pu(){return this.rgb().formatHex()}function wE(){return this.rgb().formatHex8()}function IE(){return Ku(this).formatHsl()}function zu(){return this.rgb().formatRgb()}function Hn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=yE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Fu(n):o===3?new wt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ba(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ba(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=gE.exec(e))?new wt(n[1],n[2],n[3],1):(n=bE.exec(e))?new wt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=_E.exec(e))?ba(n[1],n[2],n[3],n[4]):(n=kE.exec(e))?ba(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=EE.exec(e))?ju(n[1],n[2]/100,n[3]/100,1):(n=NE.exec(e))?ju(n[1],n[2]/100,n[3]/100,n[4]):Lu.hasOwnProperty(e)?Fu(Lu[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function Fu(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function ba(e,n,o,i){return i<=0&&(e=n=o=NaN),new wt(e,n,o,i)}function vE(e){return e instanceof ai||(e=Hn(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function kl(e,n,o,i){return arguments.length===1?vE(e):new wt(e,n,o,i??1)}function wt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}_l(wt,kl,Ou(ai,{brighter(e){return e=e==null?ga:Math.pow(ga,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ri:Math.pow(ri,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(jn(this.r),jn(this.g),jn(this.b),_a(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:Uu,formatHex:Uu,formatHex8:xE,formatRgb:Hu,toString:Hu}));function Uu(){return`#${Kn(this.r)}${Kn(this.g)}${Kn(this.b)}`}function xE(){return`#${Kn(this.r)}${Kn(this.g)}${Kn(this.b)}${Kn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hu(){const e=_a(this.opacity);return`${e===1?"rgb(":"rgba("}${jn(this.r)}, ${jn(this.g)}, ${jn(this.b)}${e===1?")":`, ${e})`}`}function _a(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function jn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Kn(e){return e=jn(e),(e<16?"0":"")+e.toString(16)}function ju(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Vt(e,n,o,i)}function Ku(e){if(e instanceof Vt)return new Vt(e.h,e.s,e.l,e.opacity);if(e instanceof ai||(e=Hn(e)),!e)return new Vt;if(e instanceof Vt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Vt(l,s,c,e.opacity)}function CE(e,n,o,i){return arguments.length===1?Ku(e):new Vt(e,n,o,i??1)}function Vt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}_l(Vt,CE,Ou(ai,{brighter(e){return e=e==null?ga:Math.pow(ga,e),new Vt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ri:Math.pow(ri,e),new Vt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new wt(El(e>=240?e-240:e+120,a,i),El(e,a,i),El(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Vt(Gu(this.h),ka(this.s),ka(this.l),_a(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=_a(this.opacity);return`${e===1?"hsl(":"hsla("}${Gu(this.h)}, ${ka(this.s)*100}%, ${ka(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Gu(e){return e=(e||0)%360,e<0?e+360:e}function ka(e){return Math.max(0,Math.min(1,e||0))}function El(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Nl=e=>()=>e;function SE(e,n){return function(o){return e+o*n}}function RE(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function AE(e){return(e=+e)==1?Yu:function(n,o){return o-n?RE(n,o,e):Nl(isNaN(n)?o:n)}}function Yu(e,n){var o=n-e;return o?SE(e,o):Nl(isNaN(e)?n:e)}const Ea=(function e(n){var o=AE(n);function i(a,r){var l=o((a=kl(a)).r,(r=kl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Yu(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function $E(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,i=n.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+n[a]*r;return i}}function TE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ME(e,n){var o=n?n.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=si(e[l],n[l]);for(;l<o;++l)r[l]=n[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function VE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function qt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function BE(e,n){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in e?o[a]=si(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var wl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Il=new RegExp(wl.source,"g");function DE(e){return function(){return e}}function OE(e){return function(n){return e(n)+""}}function qu(e,n){var o=wl.lastIndex=Il.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=wl.exec(e))&&(a=Il.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:qt(i,a)})),o=Il.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?OE(c[0].x):DE(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function si(e,n){var o=typeof n,i;return n==null||o==="boolean"?Nl(n):(o==="number"?qt:o==="string"?(i=Hn(n))?(n=i,Ea):qu:n instanceof Hn?Ea:n instanceof Date?VE:TE(n)?$E:Array.isArray(n)?ME:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?BE:qt)(e,n)}var Wu=180/Math.PI,vl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ju(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Wu,skewX:Math.atan(c)*Wu,scaleX:l,scaleY:s}}var Na;function LE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?vl:Ju(n.a,n.b,n.c,n.d,n.e,n.f)}function PE(e){return e==null||(Na||(Na=document.createElementNS("http://www.w3.org/2000/svg","g")),Na.setAttribute("transform",e),!(e=Na.transform.baseVal.consolidate()))?vl:(e=e.matrix,Ju(e.a,e.b,e.c,e.d,e.e,e.f))}function Xu(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:qt(d,m)},{i:g-2,x:qt(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:qt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:qt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:qt(d,m)},{i:g-2,x:qt(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,k;++h<g;)m[(k=p[h]).i]=k.x(f);return m.join("")}}}var zE=Xu(LE,"px, ","px)","deg)"),FE=Xu(PE,", ",")",")"),UE=1e-12;function Zu(e){return((e=Math.exp(e))+1/e)/2}function HE(e){return((e=Math.exp(e))-1/e)/2}function jE(e){return((e=Math.exp(2*e))-1)/(e+1)}const wa=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,k,N;if(g<UE)N=Math.log(p/d)/n,k=function(T){return[s+T*f,c+T*h,d*Math.exp(n*T*N)]};else{var b=Math.sqrt(g),_=(p*p-d*d+i*g)/(2*d*o*b),E=(p*p-d*d-i*g)/(2*p*o*b),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(E*E+1)-E);N=(A-I)/n,k=function(T){var L=T*N,x=Zu(I),R=d/(o*b)*(x*jE(n*L+I)-HE(I));return[s+R*f,c+R*h,d*x/Zu(n*L+I)]}}return k.duration=N*1e3*n/Math.SQRT2,k}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Co=0,ci=0,di=0,Qu=1e3,Ia,ui,va=0,Gn=0,xa=0,mi=typeof performance=="object"&&performance.now?performance:Date,em=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xl(){return Gn||(em(KE),Gn=mi.now()+xa)}function KE(){Gn=0}function Ca(){this._call=this._time=this._next=null}Ca.prototype=tm.prototype={constructor:Ca,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?xl():+o)+(n==null?0:+n),!this._next&&ui!==this&&(ui?ui._next=this:Ia=this,ui=this),this._call=e,this._time=o,Cl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cl())}};function tm(e,n,o){var i=new Ca;return i.restart(e,n,o),i}function GE(){xl(),++Co;for(var e=Ia,n;e;)(n=Gn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Co}function nm(){Gn=(va=mi.now())+xa,Co=ci=0;try{GE()}finally{Co=0,qE(),Gn=0}}function YE(){var e=mi.now(),n=e-va;n>Qu&&(xa-=n,va=e)}function qE(){for(var e,n=Ia,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ia=o);ui=e,Cl(i)}function Cl(e){if(!Co){ci&&(ci=clearTimeout(ci));var n=e-Gn;n>24?(e<1/0&&(ci=setTimeout(nm,e-mi.now()-xa)),di&&(di=clearInterval(di))):(di||(va=mi.now(),di=setInterval(YE,Qu)),Co=1,em(nm))}}function om(e,n,o){var i=new Ca;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var WE=ma("start","end","cancel","interrupt"),JE=[],im=0,am=1,Sl=2,Sa=3,rm=4,Rl=5,Ra=6;function Aa(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;XE(e,o,{name:n,index:i,group:a,on:WE,tween:JE,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:im})}function Al(e,n){var o=Bt(e,n);if(o.state>im)throw new Error("too late; already scheduled");return o}function Wt(e,n){var o=Bt(e,n);if(o.state>Sa)throw new Error("too late; already running");return o}function Bt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function XE(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=tm(r,0,o.time);function r(d){o.state=am,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==am)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Sa)return om(l);f.state===rm?(f.state=Ra,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Ra,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(om(function(){o.state===Sa&&(o.state=rm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Sl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Sl){for(o.state=Sa,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Rl,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===Rl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ra,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function $a(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>Sl&&i.state<Rl,i.state=Ra,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function ZE(e){return this.each(function(){$a(this,e)})}function QE(e,n){var o,i;return function(){var a=Wt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function e1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Wt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function t1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Bt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?QE:e1)(o,e,n))}function $l(e,n,o){var i=e._id;return e.each(function(){var a=Wt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Bt(a,i).value[n]}}function lm(e,n){var o;return(typeof n=="number"?qt:n instanceof Hn?Ea:(o=Hn(n))?(n=o,Ea):qu)(e,n)}function n1(e){return function(){this.removeAttribute(e)}}function o1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function i1(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function a1(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function r1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function l1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function s1(e,n){var o=pa(e),i=o==="transform"?FE:lm;return this.attrTween(e,typeof n=="function"?(o.local?l1:r1)(o,i,$l(this,"attr."+e,n)):n==null?(o.local?o1:n1)(o):(o.local?a1:i1)(o,i,n))}function c1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function d1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function u1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&d1(e,r)),o}return a._value=n,a}function m1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&c1(e,r)),o}return a._value=n,a}function f1(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=pa(e);return this.tween(o,(i.local?u1:m1)(i,n))}function p1(e,n){return function(){Al(this,e).delay=+n.apply(this,arguments)}}function h1(e,n){return n=+n,function(){Al(this,e).delay=n}}function y1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?p1:h1)(n,e)):Bt(this.node(),n).delay}function g1(e,n){return function(){Wt(this,e).duration=+n.apply(this,arguments)}}function b1(e,n){return n=+n,function(){Wt(this,e).duration=n}}function _1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?g1:b1)(n,e)):Bt(this.node(),n).duration}function k1(e,n){if(typeof n!="function")throw new Error;return function(){Wt(this,e).ease=n}}function E1(e){var n=this._id;return arguments.length?this.each(k1(n,e)):Bt(this.node(),n).ease}function N1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Wt(this,e).ease=o}}function w1(e){if(typeof e!="function")throw new Error;return this.each(N1(this._id,e))}function I1(e){typeof e!="function"&&(e=vu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new rn(i,this._parents,this._name,this._id)}function v1(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new rn(l,this._parents,this._name,this._id)}function x1(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function C1(e,n,o){var i,a,r=x1(n)?Al:Wt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function S1(e,n){var o=this._id;return arguments.length<2?Bt(this.node(),o).on.on(e):this.each(C1(o,e,n))}function R1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function A1(){return this.on("end.remove",R1(this._id))}function $1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=hl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Aa(d[p],n,o,p,d,Bt(u,o)));return new rn(r,this._parents,n,o)}function T1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Iu(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=Bt(u,o),g=0,k=p.length;g<k;++g)(f=p[g])&&Aa(f,n,o,g,p,h);r.push(p),l.push(u)}return new rn(r,l,n,o)}var M1=oi.prototype.constructor;function V1(){return new M1(this._groups,this._parents)}function B1(e,n){var o,i,a;return function(){var r=Io(this,e),l=(this.style.removeProperty(e),Io(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function sm(e){return function(){this.style.removeProperty(e)}}function D1(e,n,o){var i,a=o+"",r;return function(){var l=Io(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function O1(e,n,o){var i,a,r;return function(){var l=Io(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Io(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function L1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Wt(this,e),d=c.on,u=c.value[r]==null?s||(s=sm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function P1(e,n,o){var i=(e+="")=="transform"?zE:lm;return n==null?this.styleTween(e,B1(e,i)).on("end.style."+e,sm(e)):typeof n=="function"?this.styleTween(e,O1(e,i,$l(this,"style."+e,n))).each(L1(this._id,e)):this.styleTween(e,D1(e,i,n),o).on("end.style."+e,null)}function z1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function F1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&z1(e,l,o)),i}return r._value=n,r}function U1(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,F1(e,n,o??""))}function H1(e){return function(){this.textContent=e}}function j1(e){return function(){var n=e(this);this.textContent=n??""}}function K1(e){return this.tween("text",typeof e=="function"?j1($l(this,"text",e)):H1(e==null?"":e+""))}function G1(e){return function(n){this.textContent=e.call(this,n)}}function Y1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&G1(a)),n}return i._value=e,i}function q1(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,Y1(e))}function W1(){for(var e=this._name,n=this._id,o=cm(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Bt(c,n);Aa(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new rn(i,this._parents,e,o)}function J1(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Wt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var X1=0;function rn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function cm(){return++X1}var ln=oi.prototype;rn.prototype={constructor:rn,select:$1,selectAll:T1,selectChild:ln.selectChild,selectChildren:ln.selectChildren,filter:I1,merge:v1,selection:V1,transition:W1,call:ln.call,nodes:ln.nodes,node:ln.node,size:ln.size,empty:ln.empty,each:ln.each,on:S1,attr:s1,attrTween:f1,style:P1,styleTween:U1,text:K1,textTween:q1,remove:A1,tween:t1,delay:y1,duration:_1,ease:E1,easeVarying:w1,end:J1,[Symbol.iterator]:ln[Symbol.iterator]};function Z1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Q1={time:null,delay:0,duration:250,ease:Z1};function e0(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function t0(e){var n,o;e instanceof rn?(n=e._id,e=e._name):(n=cm(),(o=Q1).time=xl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Aa(c,e,n,d,l,o||e0(c,n));return new rn(i,this._parents,e,n)}oi.prototype.interrupt=ZE,oi.prototype.transition=t0;const Ta=e=>()=>e;function n0(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function sn(e,n,o){this.k=e,this.x=n,this.y=o}sn.prototype={constructor:sn,scale:function(e){return e===1?this:new sn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new sn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var So=new sn(1,0,0);sn.prototype;function Tl(e){e.stopImmediatePropagation()}function fi(e){e.preventDefault(),e.stopImmediatePropagation()}function o0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function i0(){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 dm(){return this.__zoom||So}function a0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function r0(){return navigator.maxTouchPoints||"ontouchstart"in this}function l0(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function s0(){var e=o0,n=i0,o=l0,i=a0,a=r0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=wa,d=ma("start","zoom","end"),u,m,p,f=500,h=150,g=0,k=10;function N(y){y.property("__zoom",dm).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(y,w,v,M){var D=y.selection?y.selection():y;D.property("__zoom",dm),y!==D?I(y,w,v,M):D.interrupt().each(function(){A(this,arguments).event(M).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},N.scaleBy=function(y,w,v,M){N.scaleTo(y,function(){var D=this.__zoom.k,U=typeof w=="function"?w.apply(this,arguments):w;return D*U},v,M)},N.scaleTo=function(y,w,v,M){N.transform(y,function(){var D=n.apply(this,arguments),U=this.__zoom,W=v==null?E(D):typeof v=="function"?v.apply(this,arguments):v,ie=U.invert(W),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(b(U,pe),W,ie),D,l)},v,M)},N.translateBy=function(y,w,v,M){N.transform(y,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,M)},N.translateTo=function(y,w,v,M,D){N.transform(y,function(){var U=n.apply(this,arguments),W=this.__zoom,ie=M==null?E(U):typeof M=="function"?M.apply(this,arguments):M;return o(So.translate(ie[0],ie[1]).scale(W.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),U,l)},M,D)};function b(y,w){return w=Math.max(r[0],Math.min(r[1],w)),w===y.k?y:new sn(w,y.x,y.y)}function _(y,w,v){var M=w[0]-v[0]*y.k,D=w[1]-v[1]*y.k;return M===y.x&&D===y.y?y:new sn(y.k,M,D)}function E(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function I(y,w,v,M){y.on("start.zoom",function(){A(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,U=arguments,W=A(D,U).event(M),ie=n.apply(D,U),pe=v==null?E(ie):typeof v=="function"?v.apply(D,U):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=D.__zoom,me=typeof w=="function"?w.apply(D,U):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new sn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}W.zoom(null,ke)}})}function A(y,w,v){return!v&&y.__zooming||new T(y,w)}function T(y,w){this.that=y,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(y,w),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,w){return this.mouse&&y!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&y!=="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(y){var w=Mt(this.that).datum();d.call(y,this.that,new n0(y,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:d}),w)}};function L(y,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(y),M=this.__zoom,D=Math.max(r[0],Math.min(r[1],M.k*Math.pow(2,i.apply(this,arguments)))),U=Gt(y);if(v.wheel)(v.mouse[0][0]!==U[0]||v.mouse[0][1]!==U[1])&&(v.mouse[1]=M.invert(v.mouse[0]=U)),clearTimeout(v.wheel);else{if(M.k===D)return;v.mouse=[U,M.invert(U)],$a(this),v.start()}fi(y),v.wheel=setTimeout(W,h),v.zoom("mouse",o(_(b(M,D),v.mouse[0],v.mouse[1]),v.extent,l));function W(){v.wheel=null,v.end()}}function x(y,...w){if(p||!e.apply(this,arguments))return;var v=y.currentTarget,M=A(this,w,!0).event(y),D=Mt(y.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),U=Gt(y,v),W=y.clientX,ie=y.clientY;Bu(y.view),Tl(y),M.mouse=[U,this.__zoom.invert(U)],$a(this),M.start();function pe(ge){if(fi(ge),!M.moved){var me=ge.clientX-W,se=ge.clientY-ie;M.moved=me*me+se*se>g}M.event(ge).zoom("mouse",o(_(M.that.__zoom,M.mouse[0]=Gt(ge,v),M.mouse[1]),M.extent,l))}function ye(ge){D.on("mousemove.zoom mouseup.zoom",null),Du(ge.view,M.moved),fi(ge),M.event(ge).end()}}function R(y,...w){if(e.apply(this,arguments)){var v=this.__zoom,M=Gt(y.changedTouches?y.changedTouches[0]:y,this),D=v.invert(M),U=v.k*(y.shiftKey?.5:2),W=o(_(b(v,U),M,D),n.apply(this,w),l);fi(y),s>0?Mt(this).transition().duration(s).call(I,W,M,y):Mt(this).call(N.transform,W,M,y)}}function $(y,...w){if(e.apply(this,arguments)){var v=y.touches,M=v.length,D=A(this,w,y.changedTouches.length===M).event(y),U,W,ie,pe;for(Tl(y),W=0;W<M;++W)ie=v[W],pe=Gt(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],D.touch0?!D.touch1&&D.touch0[2]!==pe[2]&&(D.touch1=pe,D.taps=0):(D.touch0=pe,U=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),U&&(D.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),$a(this),D.start())}}function B(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W,ie,pe;for(fi(y),U=0;U<D;++U)W=M[U],ie=Gt(W,this),v.touch0&&v.touch0[2]===W.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===W.identifier&&(v.touch1[0]=ie);if(W=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;W=b(W,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(_(W,ie,pe),v.extent,l))}}function O(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W;for(Tl(y),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),U=0;U<D;++U)W=M[U],v.touch0&&v.touch0[2]===W.identifier?delete v.touch0:v.touch1&&v.touch1[2]===W.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(W=Gt(W,this),Math.hypot(m[0]-W[0],m[1]-W[1])<k)){var ie=Mt(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return N.wheelDelta=function(y){return arguments.length?(i=typeof y=="function"?y:Ta(+y),N):i},N.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ta(!!y),N):e},N.touchable=function(y){return arguments.length?(a=typeof y=="function"?y:Ta(!!y),N):a},N.extent=function(y){return arguments.length?(n=typeof y=="function"?y:Ta([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),N):n},N.scaleExtent=function(y){return arguments.length?(r[0]=+y[0],r[1]=+y[1],N):[r[0],r[1]]},N.translateExtent=function(y){return arguments.length?(l[0][0]=+y[0][0],l[1][0]=+y[1][0],l[0][1]=+y[0][1],l[1][1]=+y[1][1],N):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},N.constrain=function(y){return arguments.length?(o=y,N):o},N.duration=function(y){return arguments.length?(s=+y,N):s},N.interpolate=function(y){return arguments.length?(c=y,N):c},N.on=function(){var y=d.on.apply(d,arguments);return y===d?N:y},N.clickDistance=function(y){return arguments.length?(g=(y=+y)*y,N):Math.sqrt(g)},N.tapDistance=function(y){return arguments.length?(k=+y,N):k},N}var $e=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))($e||{}),Ml=(e=>(e.Partial="partial",e.Full="full",e))(Ml||{}),Yn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Yn||{}),cn=(e=>(e.Strict="strict",e.Loose="loose",e))(cn||{}),Vl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Vl||{}),pi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(pi||{}),um=(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))(um||{});const c0=["INPUT","SELECT","TEXTAREA"],d0=typeof document<"u"?document:null;function Bl(e){var n,o;const i=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return c0.includes(i==null?void 0:i.nodeName)||a||!!r}function u0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function mm(e,n,o,i){const a=n.replace("+",`
|
|
28
28
|
`).replace(`
|
|
29
29
|
|
|
30
30
|
`,`
|
|
31
31
|
+`).split(`
|
|
32
|
-
`).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===n.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function a0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=r0(o.code,e);return Array.isArray(e)?e.some(a=>lm(o[i],a,n,o.type==="keyup")):lm(o[i],e,n,o.type==="keyup")}}function r0(e,n){return n.includes(e)?"code":"key"}function pi(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??o0),i=t.shallowRef(t.toValue(e)===!0);let a=!1;const r=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),pu(["blur","contextmenu"],s),hu((...d)=>l(...d),d=>{var u,m;const h=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,p=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=i0(d),(!a||a&&!h)&&Tl(d))return;const b=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,f=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!p&&(a||!f)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),hu((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Tl(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=t.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"?a0(d,r):d}return i}const sm="vue-flow__node-desc",cm="vue-flow__edge-desc",l0="vue-flow__aria-live",dm=["Enter"," ","Escape"],Ro={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ta(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ma(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*i)}function Va(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Wn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function um(e,n){return{x:Wn(e.x,n[0][0],n[1][0]),y:Wn(e.y,n[0][1],n[1][1])}}function mm(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function Cn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Jn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Cn(e)}function hi(e){return Jn(e)&&"computedPosition"in e}function Ba(e){return!Number.isNaN(e)&&Number.isFinite(e)}function s0(e){return Ba(e.width)&&Ba(e.height)&&Ba(e.x)&&Ba(e.y)}function c0(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function fm(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.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:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function pm(e,n,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return n.filter(s=>r.has(s.id))}function d0(...e){if(e.length===3){const[r,l,s]=e;return pm(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>Cn(r)&&r.source===i).map(r=>o.find(l=>Jn(l)&&l.id===r.target))}function u0(...e){if(e.length===3){const[r,l,s]=e;return pm(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>Cn(r)&&r.target===i).map(r=>o.find(l=>Jn(l)&&l.id===r.source))}function hm({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function m0(e,n){return n.some(o=>Cn(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 yi({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function gi({x:e,y:n},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(n-i)/a};return r?La(s,l):s}function ym(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function Da({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function gm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function f0(e,n){return gm(ym(Da(e),Da(n)))}function Ml(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];n=ym(n,Da({...i.computedPosition,...i.dimensions}))}return gm(n)}function bm(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...gi(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,h=c.height??s.height??null;if(a&&!d||u)continue;const p=Ma(r,Ta(s)),y=m===null||h===null,b=i&&p>0,f=(m??0)*(h??0);(y||b||p>=f||s.dragging)&&l.push(s)}return l}function Xn(e,n){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 n.filter(i=>o.has(i.source)||o.has(i.target))}function Ao(e,n){if(typeof e=="number")return Math.floor((n-n/(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(n*o*.01)}return ki(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function p0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=Ao(e,o),a=Ao(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Ao(e.top??e.y??0,o),a=Ao(e.bottom??e.y??0,o),r=Ao(e.left??e.x??0,n),l=Ao(e.right??e.x??0,n);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function h0(e,n,o,i,a,r){const{x:l,y:s}=yi(e,{x:n,y:o,zoom:i}),{x:c,y:d}=yi({x:e.x+e.width,y:e.y+e.height},{x:n,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function _m(e,n,o,i,a,r=.1){const l=p0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=Wn(d,i,a),m=e.x+e.width/2,h=e.y+e.height/2,p=n/2-m*u,y=o/2-h*u,b=h0(e,p,y,u,n,o),f={left:Math.min(b.left-l.left,0),top:Math.min(b.top-l.top,0),right:Math.min(b.right-l.right,0),bottom:Math.min(b.bottom-l.bottom,0)};return{x:p-f.left+f.right,y:y-f.top+f.bottom,zoom:u}}function y0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function km(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:km(o,n):!1}function bi(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Vl(e){const n=e.ctrlKey&&_i()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function Em(e,n,o){return e<n?Wn(Math.abs(e-n),1,n)/n:e>o?-Wn(Math.abs(e-o),1,n)/n:0}function Nm(e,n,o=15,i=40){const a=Em(e.x,i,n.width-i)*o,r=Em(e.y,i,n.height-i)*o;return[a,r]}function Bl(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,i=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof n.style=="function"?a={...n.style(n)}:n.style&&(a={...n.style}),a.width=a.width??`${n.dimensions.width}px`,a.height=a.height??`${n.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(n.position.x=n.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(n.position.y=n.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}n.dimensions.width=Number(a.width.toString().replace("px","")),n.dimensions.height=Number(a.height.toString().replace("px","")),typeof n.style=="function"?n.style=r=>{const l=n.style;return{...l(r),...a}}:n.style={...n.style,...a}}}}function wm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(hi(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&hi(c)&&Bl(l,c)}break;case"dimensions":if(hi(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&hi(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Bl(l,c):t.nextTick(()=>{Bl(l,c)}))}break}return n}function xn(e,n){return{id:e,type:"select",selected:n}}function Im(e){return{item:e,type:"add"}}function vm(e){return{id:e,type:"remove"}}function Cm(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Sn(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(xn(r.id,l)))}return i}const xm=()=>{};function Ae(e){const n=new Set;let o=xm,i=()=>!1;const a=()=>n.size>0||i(),r=h=>{o=h},l=()=>{o=xm},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{n.delete(h)};return{on:h=>{n.add(h);const p=()=>d(h);return ti(p),{off:p}},off:d,trigger:h=>{const p=[o];return a()?p.push(...n):e&&p.push(e),Promise.allSettled(p.map(y=>y(h)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Sm(e,n,o){let i=e;do{if(i&&i.matches(n))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function g0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!km(c,e))&&(c.draggable||n&&typeof c.draggable>"u")&&e.get(s)&&l.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-((r=c.computedPosition)==null?void 0:r.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(l.values())}function Dl({id:e,dragItems:n,findNode:o}){const i=[];for(const a of n){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function Rm(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 b0(e,n,o){const[i,a,r,l]=typeof e!="string"?Rm(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function _0(e,n,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 r=b0(a,e,i);r&&(a=r)}else n(new ut(st.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Rm(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+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function k0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Ll(e,n,o,i,a){const r=k0(e.dimensions,_0(e,o,i,a)),l=um(n,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function $o(e,n,o=Te.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??I0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case Te.Top:return{x:a+l/2,y:r};case Te.Right:return{x:a+l,y:r+s/2};case Te.Bottom:return{x:a+l/2,y:r+s};case Te.Left:return{x:a,y:r+s/2}}}function Am(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function E0({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+a),y2:Math.max(e.y+i,n.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=Da({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=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(m*h)>0}function N0(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var st=(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))(st||{});const $m={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
|
|
32
|
+
`).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===n.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function m0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=f0(o.code,e);return Array.isArray(e)?e.some(a=>mm(o[i],a,n,o.type==="keyup")):mm(o[i],e,n,o.type==="keyup")}}function f0(e,n){return n.includes(e)?"code":"key"}function hi(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??d0),i=t.shallowRef(t.toValue(e)===!0);let a=!1;const r=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),_u(["blur","contextmenu"],s),ku((...d)=>l(...d),d=>{var u,m;const p=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,f=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=u0(d),(!a||a&&!p)&&Bl(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,k=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!f&&(a||!k)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),ku((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Bl(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=t.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"?m0(d,r):d}return i}const fm="vue-flow__node-desc",pm="vue-flow__edge-desc",p0="vue-flow__aria-live",hm=["Enter"," ","Escape"],Ro={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ma(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Va(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*i)}function Ba(e){return{width:e.offsetWidth,height:e.offsetHeight}}function qn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function ym(e,n){return{x:qn(e.x,n[0][0],n[1][0]),y:qn(e.y,n[0][1],n[1][1])}}function gm(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function vn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Wn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!vn(e)}function yi(e){return Wn(e)&&"computedPosition"in e}function Da(e){return!Number.isNaN(e)&&Number.isFinite(e)}function h0(e){return Da(e.width)&&Da(e.height)&&Da(e.x)&&Da(e.y)}function y0(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function bm(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.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:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function _m(e,n,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return n.filter(s=>r.has(s.id))}function g0(...e){if(e.length===3){const[r,l,s]=e;return _m(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>vn(r)&&r.source===i).map(r=>o.find(l=>Wn(l)&&l.id===r.target))}function b0(...e){if(e.length===3){const[r,l,s]=e;return _m(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>vn(r)&&r.target===i).map(r=>o.find(l=>Wn(l)&&l.id===r.source))}function km({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function _0(e,n){return n.some(o=>vn(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 gi({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function bi({x:e,y:n},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(n-i)/a};return r?La(s,l):s}function Em(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function Oa({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function Nm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function k0(e,n){return Nm(Em(Oa(e),Oa(n)))}function Dl(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];n=Em(n,Oa({...i.computedPosition,...i.dimensions}))}return Nm(n)}function wm(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...bi(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,p=c.height??s.height??null;if(a&&!d||u)continue;const f=Va(r,Ma(s)),h=m===null||p===null,g=i&&f>0,k=(m??0)*(p??0);(h||g||f>=k||s.dragging)&&l.push(s)}return l}function Jn(e,n){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 n.filter(i=>o.has(i.source)||o.has(i.target))}function Ao(e,n){if(typeof e=="number")return Math.floor((n-n/(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(n*o*.01)}return Ei(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function E0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=Ao(e,o),a=Ao(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Ao(e.top??e.y??0,o),a=Ao(e.bottom??e.y??0,o),r=Ao(e.left??e.x??0,n),l=Ao(e.right??e.x??0,n);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function N0(e,n,o,i,a,r){const{x:l,y:s}=gi(e,{x:n,y:o,zoom:i}),{x:c,y:d}=gi({x:e.x+e.width,y:e.y+e.height},{x:n,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function Im(e,n,o,i,a,r=.1){const l=E0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=qn(d,i,a),m=e.x+e.width/2,p=e.y+e.height/2,f=n/2-m*u,h=o/2-p*u,g=N0(e,f,h,u,n,o),k={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:f-k.left+k.right,y:h-k.top+k.bottom,zoom:u}}function w0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function vm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:vm(o,n):!1}function _i(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Ol(e){const n=e.ctrlKey&&ki()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function xm(e,n,o){return e<n?qn(Math.abs(e-n),1,n)/n:e>o?-qn(Math.abs(e-o),1,n)/n:0}function Cm(e,n,o=15,i=40){const a=xm(e.x,i,n.width-i)*o,r=xm(e.y,i,n.height-i)*o;return[a,r]}function Ll(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,i=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof n.style=="function"?a={...n.style(n)}:n.style&&(a={...n.style}),a.width=a.width??`${n.dimensions.width}px`,a.height=a.height??`${n.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(n.position.x=n.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(n.position.y=n.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}n.dimensions.width=Number(a.width.toString().replace("px","")),n.dimensions.height=Number(a.height.toString().replace("px","")),typeof n.style=="function"?n.style=r=>{const l=n.style;return{...l(r),...a}}:n.style={...n.style,...a}}}}function Sm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(yi(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&yi(c)&&Ll(l,c)}break;case"dimensions":if(yi(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&yi(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Ll(l,c):t.nextTick(()=>{Ll(l,c)}))}break}return n}function xn(e,n){return{id:e,type:"select",selected:n}}function Rm(e){return{item:e,type:"add"}}function Am(e){return{id:e,type:"remove"}}function $m(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Cn(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(xn(r.id,l)))}return i}const Tm=()=>{};function Re(e){const n=new Set;let o=Tm,i=()=>!1;const a=()=>n.size>0||i(),r=p=>{o=p},l=()=>{o=Tm},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{n.delete(p)};return{on:p=>{n.add(p);const f=()=>d(p);return ni(f),{off:f}},off:d,trigger:p=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(h=>h(p)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Mm(e,n,o){let i=e;do{if(i&&i.matches(n))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function I0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!vm(c,e))&&(c.draggable||n&&typeof c.draggable>"u")&&e.get(s)&&l.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-((r=c.computedPosition)==null?void 0:r.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(l.values())}function Pl({id:e,dragItems:n,findNode:o}){const i=[];for(const a of n){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function Vm(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 v0(e,n,o){const[i,a,r,l]=typeof e!="string"?Vm(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function x0(e,n,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 r=v0(a,e,i);r&&(a=r)}else n(new ft(st.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Vm(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+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function C0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function zl(e,n,o,i,a){const r=C0(e.dimensions,x0(e,o,i,a)),l=ym(n,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function $o(e,n,o=$e.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??$0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case $e.Top:return{x:a+l/2,y:r};case $e.Right:return{x:a+l,y:r+s/2};case $e.Bottom:return{x:a+l/2,y:r+s};case $e.Left:return{x:a,y:r+s/2}}}function Bm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function S0({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+a),y2:Math.max(e.y+i,n.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=Oa({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),p=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*p)>0}function R0(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var st=(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))(st||{});const Dm={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
|
|
33
33
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
34
34
|
Node: ${e}`,NODE_MISSING_PARENT:(e,n)=>`Node is missing a parent
|
|
35
35
|
Node: ${e}
|
|
@@ -49,18 +49,18 @@ Edge: ${e}
|
|
|
49
49
|
Source: ${n}
|
|
50
50
|
Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
51
51
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
52
|
-
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 ut extends Error{constructor(n,...o){var i;super((i=$m[n])==null?void 0:i.call($m,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Ol(e){return"clientX"in e}function w0(e){return"sourceEvent"in e}function Jt(e,n){const o=Ol(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-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}}const _i=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function I0(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function La(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const v0=()=>!0;function Pl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function C0(e,n,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of n.values())Ma(a,Ta(r))>0&&i.push(r);return i}const x0=250;function S0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=C0(e,o,n+x0);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:h,y:p}=$o(d,m,m.position,!0),y=Math.sqrt((h-e.x)**2+(p-e.y)**2);y>n||(y<s?(l=[{...m,x:h,y:p}],s=y):y===s&&l.push({...m,x:h,y:p}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function Tm(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=v0},u,m,h,p){const y=r==="target",b=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:f,y:g}=Jt(e),k=l.elementFromPoint(f,g),_=k!=null&&k.classList.contains(`${s}-flow__handle`)?k:b,N={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const I=Mm(void 0,_),$=_.getAttribute("data-nodeid"),C=_.getAttribute("data-handleid"),A=_.classList.contains("connectable"),T=_.classList.contains("connectableend");if(!$||!I)return N;const V={source:y?$:i,sourceHandle:y?C:a,target:y?i:$,targetHandle:y?a:C};N.connection=V;const x=A&&T&&(o===cn.Strict?y&&I==="source"||!y&&I==="target":$!==i||C!==a);N.isValid=x&&d(V,{nodes:m,edges:u,sourceNode:h(V.source),targetNode:h(V.target)}),N.toHandle=Vm($,I,C,p,o,!0)}return N}function Mm(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function R0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function A0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Vm(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===cn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(h=>h.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...$o(d,m,m.position,!0)}:m}const zl={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top},$0=["production","prod"];function ki(e,...n){Bm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function Bm(){return!$0.includes(process.env.NODE_ENV||"")}function Dm(e,n,o,i,a){const r=n.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Va(l)}}):null}function Fl(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ct(e){return typeof t.unref(e)<"u"}function T0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ut(st.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Cn(e)?a=e:a={...e,id:hm(e)},a=fm(a,void 0,i),m0(a,n)?!1:a}function M0(e,n,o,i,a){if(!n.source||!n.target)return a(new ut(st.EDGE_INVALID,e.id)),!1;if(!o)return a(new ut(st.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?hm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Lm(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Jn(l)){o(new ut(st.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=c0(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new ut(st.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Om(e,n,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,n)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,n)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,n))}}function Ul(e,n,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;Om("source",c,u,e,a,l),Om("target",c,d,e,r,s)}}function Pm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Hl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=Cn(d)?d:T0(d,s,a,r);if(!u)continue;const m=o(u.source),h=o(u.target);if(!m||!h){a(new ut(st.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ut(st.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new ut(st.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:h})){a(new ut(st.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...fm(u,p,r),sourceNode:m,targetNode:h})}return c}const zm=Symbol("vueFlow"),Fm=Symbol("nodeId"),Um=Symbol("nodeRef"),V0=Symbol("edgeId"),B0=Symbol("edgeRef"),Oa=Symbol("slots");function Hm(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:h,findNode:p,multiSelectionActive:y,nodesSelectionActive:b,selectNodesOnDrag:f,removeSelectedElements:g,addSelectedNodes:k,updateNodePositions:_,emits:N}=je(),{onStart:I,onDrag:$,onStop:C,onClick:A,el:T,disabled:V,id:R,selectable:x,dragHandle:M}=e,E=t.shallowRef(!1);let w=[],S,B=null,z={x:void 0,y:void 0},K={x:0,y:0},J=null,re=!1,pe=!1,ce=0,Ne=!1;const he=O0(),de=({x:se,y:fe})=>{z={x:se,y:fe};let O=!1;if(w=w.map(L=>{const F={x:se-L.distance.x,y:fe-L.distance.y},{computedPosition:Q}=Ll(L,o.value?La(F,i.value):F,N.error,l.value,L.parentNode?p(L.parentNode):void 0);return O=O||L.position.x!==Q.x||L.position.y!==Q.y,L.position=Q,L}),pe=pe||O,!!O&&(_(w,!0,!0),E.value=!0,J)){const[L,F]=Dl({id:R,dragItems:w,findNode:p});$({event:J,node:L,nodes:F})}},_e=()=>{if(!B)return;const[se,fe]=Nm(K,B,u.value);if(se!==0||fe!==0){const O={x:(z.x??0)-se/c.value.zoom,y:(z.y??0)-fe/c.value.zoom};h({x:se,y:fe})&&de(O)}ce=requestAnimationFrame(_e)},Se=(se,fe)=>{re=!0;const O=p(R);!f.value&&!y.value&&O&&(O.selected||g()),O&&t.toValue(x)&&f.value&&Fl(O,y.value,k,g,b,!1,fe);const L=he(se.sourceEvent);if(z=L,w=g0(r.value,m.value,L,R),w.length){const[F,Q]=Dl({id:R,dragItems:w,findNode:p});I({event:se.sourceEvent,node:F,nodes:Q})}},me=(se,fe)=>{var O;se.sourceEvent.type==="touchmove"&&se.sourceEvent.touches.length>1||(pe=!1,s.value===0&&Se(se,fe),z=he(se.sourceEvent),B=((O=n.value)==null?void 0:O.getBoundingClientRect())||null,K=Jt(se.sourceEvent,B))},ye=(se,fe)=>{const O=he(se.sourceEvent);if(!Ne&&re&&d.value&&(Ne=!0,_e()),!re){const L=O.xSnapped-(z.x??0),F=O.ySnapped-(z.y??0);Math.sqrt(L*L+F*F)>s.value&&Se(se,fe)}(z.x!==O.xSnapped||z.y!==O.ySnapped)&&w.length&&re&&(J=se.sourceEvent,K=Jt(se.sourceEvent,B),de(O))},ie=se=>{let fe=!1;if(!re&&!E.value&&!y.value){const O=se.sourceEvent,L=he(O),F=L.xSnapped-(z.x??0),Q=L.ySnapped-(z.y??0),Y=Math.sqrt(F*F+Q*Q);Y!==0&&Y<=s.value&&(A==null||A(O),fe=!0)}if(w.length&&!fe){pe&&(_(w,!1,!1),pe=!1);const[O,L]=Dl({id:R,dragItems:w,findNode:p});C({event:se.sourceEvent,node:O,nodes:L})}w=[],E.value=!1,Ne=!1,re=!1,z={x:void 0,y:void 0},cancelAnimationFrame(ce)};return t.watch([()=>t.toValue(V),T],([se,fe],O,L)=>{if(fe){const F=Vt(fe);se||(S=sE().on("start",Q=>me(Q,fe)).on("drag",Q=>ye(Q,fe)).on("end",Q=>ie(Q)).filter(Q=>{const Y=Q.target,ke=t.toValue(M);return!Q.button&&(!a.value||!Sm(Y,`.${a.value}`,fe)&&(!ke||Sm(Y,ke,fe)))}),F.call(S)),L(()=>{F.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),E}function D0(){return{doubleClick:Ae(),click:Ae(),mouseEnter:Ae(),mouseMove:Ae(),mouseLeave:Ae(),contextMenu:Ae(),updateStart:Ae(),update:Ae(),updateEnd:Ae()}}function L0(e,n){const o=D0();return o.doubleClick.on(i=>{var a,r;n.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;n.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;n.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;n.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function O0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=je();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=w0(a)?a.sourceEvent:a,{x:c,y:d}=Jt(s,l),u=gi({x:c,y:d},e.value),{x:m,y:h}=o.value?La(u,n.value):u;return{xSnapped:m,ySnapped:h,...u}}}function Pa(){return!0}function jm({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:b,findNode:f,panBy:g,startConnection:k,updateConnection:_,endConnection:N,emits:I,viewport:$,edges:C,nodes:A,isValidConnection:T,nodeLookup:V}=je();let R=null,x=!1,M=null;function E(S){var B;const z=t.toValue(o)==="target",K=Ol(S),J=mm(S.target),re=S.currentTarget;if(re&&(K&&S.button===0||!K)){let pe=function(ve){O=Jt(ve,ie),de=S0(gi(O,$.value,!1,[1,1]),u.value,V.value,Q),L||(F(),L=!0);const U=Tm(ve,{handle:de,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:z?"target":"source",isValidConnection:he,doc:J,lib:"vue",flowId:s,nodeLookup:V.value},C.value,A.value,f,V.value);M=U.handleDomNode,R=U.connection,x=A0(!!de,U.isValid);const H={...xe,isValid:x,to:U.toHandle&&x?yi({x:U.toHandle.x,y:U.toHandle.y},$.value):O,toHandle:U.toHandle,toPosition:x&&U.toHandle?U.toHandle.position:zl[Q.position],toNode:U.toHandle?V.value.get(U.toHandle.nodeId):null};if(x&&de&&(xe!=null&&xe.toHandle)&&H.toHandle&&xe.toHandle.type===H.toHandle.type&&xe.toHandle.nodeId===H.toHandle.nodeId&&xe.toHandle.id===H.toHandle.id&&xe.to.x===H.to.x&&xe.to.y===H.to.y)return;const q=de??U.toHandle;if(_(q&&x?yi({x:q.x,y:q.y},$.value):O,q,R0(!!q,x)),xe=H,!de&&!x&&!M)return Pl(fe);R&&R.source!==R.target&&M&&(Pl(fe),fe=M,M.classList.add("connecting","vue-flow__handle-connecting"),M.classList.toggle("valid",!!x),M.classList.toggle("vue-flow__handle-valid",!!x))},ce=function(ve){"touches"in ve&&ve.touches.length>0||((de||M)&&R&&x&&(r?r(ve,R):I.connect(R)),I.connectEnd(ve),a&&(l==null||l(ve)),Pl(fe),cancelAnimationFrame(_e),N(ve),L=!1,x=!1,R=null,M=null,J.removeEventListener("mousemove",pe),J.removeEventListener("mouseup",ce),J.removeEventListener("touchmove",pe),J.removeEventListener("touchend",ce))};const Ne=f(t.toValue(n));let he=t.toValue(i)||T.value||Pa;!he&&Ne&&(he=(z?Ne.isValidSourcePos:Ne.isValidTargetPos)||Pa);let de,_e=0;const{x:Se,y:me}=Jt(S),ye=Mm(t.toValue(a),re),ie=(B=c.value)==null?void 0:B.getBoundingClientRect();if(!ie||!ye)return;const se=Vm(t.toValue(n),ye,t.toValue(e),V.value,d.value);if(!se)return;let fe,O=Jt(S,ie),L=!1;const F=()=>{if(!y.value)return;const[ve,U]=Nm(O,ie,b.value);g({x:ve,y:U}),_e=requestAnimationFrame(F)},Q={...se,nodeId:t.toValue(n),type:ye,position:se.position},Y=V.value.get(t.toValue(n)),be={inProgress:!0,isValid:null,from:$o(Y,Q,Te.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:Y,to:O,toHandle:null,toPosition:zl[Q.position],toNode:null};k({nodeId:t.toValue(n),id:t.toValue(e),type:ye,position:(re==null?void 0:re.getAttribute("data-handlepos"))||Te.Top,...O},{x:Se-ie.left,y:me-ie.top}),I.connectStart({event:S,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:ye});let xe=be;J.addEventListener("mousemove",pe),J.addEventListener("mouseup",ce),J.addEventListener("touchmove",pe),J.addEventListener("touchend",ce)}}function w(S){var B,z;if(!m.value)return;const K=t.toValue(o)==="target";if(!h.value){I.clickConnectStart({event:S,nodeId:t.toValue(n),handleId:t.toValue(e)}),k({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Te.Top,...Jt(S)},void 0,!0);return}let J=t.toValue(i)||T.value||Pa;const re=f(t.toValue(n));if(!J&&re&&(J=(K?re.isValidSourcePos:re.isValidTargetPos)||Pa),re&&(typeof re.connectable>"u"?p.value:re.connectable)===!1)return;const pe=mm(S.target),ce=Tm(S,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Te.Top,...Jt(S)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:J,doc:pe,lib:"vue",flowId:s,nodeLookup:V.value},C.value,A.value,f,V.value),Ne=((B=ce.connection)==null?void 0:B.source)===((z=ce.connection)==null?void 0:z.target);ce.isValid&&ce.connection&&!Ne&&I.connect(ce.connection),I.clickConnectEnd(S),N(S,!0)}return{handlePointerDown:E,handleClick:w}}function P0(){return t.inject(Fm,"")}function Km(e){const n=e??P0()??"",o=t.inject(Um,t.ref(null)),{findNode:i,edges:a,emits:r}=je(),l=i(n);return l||r.error(new ut(st.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Xn([l],a.value))}}function z0(){return{doubleClick:Ae(),click:Ae(),mouseEnter:Ae(),mouseMove:Ae(),mouseLeave:Ae(),contextMenu:Ae(),dragStart:Ae(),drag:Ae(),dragStop:Ae()}}function F0(e,n){const o=z0();return o.doubleClick.on(i=>{var a,r;n.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;n.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;n.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;n.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function Gm(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=je();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,h=d?4:1,p=c.x*u*h,y=c.y*m*h,b=[];for(const f of e.value)if(f.draggable||l&&typeof f.draggable>"u"){const g={x:f.computedPosition.x+p,y:f.computedPosition.y+y},{position:k}=Ll(f,g,s.error,n.value,f.parentNode?i(f.parentNode):void 0);b.push({id:f.id,position:k,from:f.position,distance:{x:c.x,y:c.y},dimensions:f.dimensions})}o(b,!0,!1)}}const za=.1,U0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Rn(){return ki("Viewport not initialized yet."),Promise.resolve(!1)}const H0={zoomIn:Rn,zoomOut:Rn,zoomTo:Rn,fitView:Rn,setCenter:Rn,fitBounds:Rn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Rn,setTransform:Rn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function j0(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?li:Na).scaleBy(jl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=um({x:-i,y:-a},e.translateExtent),m=So.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?li:Na).transform(jl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>n(1.2,a),zoomOut:a=>n(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?li:Na).scaleTo(jl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),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:za,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!h.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const c=Ml(s),{x:d,y:u,zoom:m}=_m(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??za);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:za})=>{const{x:l,y:s,zoom:c}=_m(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??za);return o(l,s,c,r)},project:a=>gi(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return gi(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return yi(s,e.viewport)}return{x:0,y:0}}}:H0)}function jl(e,n=0,o=U0,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function K0(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,f,g=!!(o.nodes.value.length||o.edges.value.length);b=wo([e.modelValue,()=>{var k,_;return(_=(k=e.modelValue)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setElements(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([k,_])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...k,..._],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},r=()=>{i.run(()=>{let b,f,g=!!o.nodes.value.length;b=wo([e.nodes,()=>{var k,_;return(_=(k=e.nodes)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setNodes(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.nodes,()=>o.nodes.value.length],([k])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},l=()=>{i.run(()=>{let b,f,g=!!o.edges.value.length;b=wo([e.edges,()=>{var k,_;return(_=(k=e.edges)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setEdges(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.edges,()=>o.edges.value.length],([k])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ct(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ct(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ct(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ct(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ct(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const b=async f=>{let g=f;typeof n.autoConnect=="function"&&(g=await n.autoConnect(f)),g!==!1&&o.addEdges([g])};t.watch(()=>n.autoConnect,()=>{ct(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(f,g,k)=>{f?o.onConnect(b):o.hooks.value.connect.off(b),k(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},p=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const f of Object.keys(n)){const g=f;if(!b.includes(g)){const k=t.toRef(()=>n[g]),_=o[g];t.isRef(_)&&i.run(()=>{t.watch(k,N=>{ct(N)&&(_.value=N)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),h(),p()})()}),()=>i.stop()}function G0(){return{edgesChange:Ae(),nodesChange:Ae(),nodeDoubleClick:Ae(),nodeClick:Ae(),nodeMouseEnter:Ae(),nodeMouseMove:Ae(),nodeMouseLeave:Ae(),nodeContextMenu:Ae(),nodeDragStart:Ae(),nodeDrag:Ae(),nodeDragStop:Ae(),nodesInitialized:Ae(),miniMapNodeClick:Ae(),miniMapNodeDoubleClick:Ae(),miniMapNodeMouseEnter:Ae(),miniMapNodeMouseMove:Ae(),miniMapNodeMouseLeave:Ae(),connect:Ae(),connectStart:Ae(),connectEnd:Ae(),clickConnectStart:Ae(),clickConnectEnd:Ae(),paneReady:Ae(),init:Ae(),move:Ae(),moveStart:Ae(),moveEnd:Ae(),selectionDragStart:Ae(),selectionDrag:Ae(),selectionDragStop:Ae(),selectionContextMenu:Ae(),selectionStart:Ae(),selectionEnd:Ae(),viewportChangeStart:Ae(),viewportChange:Ae(),viewportChangeEnd:Ae(),paneScroll:Ae(),paneClick:Ae(),paneContextMenu:Ae(),paneMouseEnter:Ae(),paneMouseMove:Ae(),paneMouseLeave:Ae(),edgeContextMenu:Ae(),edgeMouseEnter:Ae(),edgeMouseMove:Ae(),edgeMouseLeave:Ae(),edgeDoubleClick:Ae(),edgeClick:Ae(),edgeUpdateStart:Ae(),edgeUpdate:Ae(),edgeUpdateEnd:Ae(),updateNodeInternals:Ae(),error:Ae(e=>ki(e.message))}}function Y0(e,n){const o=t.getCurrentInstance();t.onBeforeMount(()=>{for(const[a,r]of Object.entries(n.value)){const l=s=>{e(a,s)};r.setEmitter(l),ti(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),ti(r.removeHasEmitListeners)}});function i(a){var r;const l=q0(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function q0(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Ym(){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:Al.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:fi.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:qn.Bezier,style:{}},connectionMode:cn.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:_i()?"Meta":"Control",zoomActivationKeyCode:_i()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:G0(),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 W0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function J0(e,n,o){const i=j0(e),a=O=>{const L=O??[];e.hooks.updateNodeInternals.trigger(L)},r=O=>u0(O,e.nodes,e.edges),l=O=>d0(O,e.nodes,e.edges),s=O=>Xn(O,e.edges),c=({id:O,type:L,nodeId:F})=>{var Q;const Y=O?`-${L}-${O}`:`-${L}`;return Array.from(((Q=e.connectionLookup.get(`${F}${Y}`))==null?void 0:Q.values())??[])},d=O=>{if(O)return n.value.get(O)},u=O=>{if(O)return o.value.get(O)},m=(O,L,F)=>{var Q,Y;const ke=[];for(const be of O){const xe={id:be.id,type:"position",dragging:F,from:be.from};if(L&&(xe.position=be.position,be.parentNode)){const ve=d(be.parentNode);xe.position={x:xe.position.x-(((Q=ve==null?void 0:ve.computedPosition)==null?void 0:Q.x)??0),y:xe.position.y-(((Y=ve==null?void 0:ve.computedPosition)==null?void 0:Y.y)??0)}}ke.push(xe)}ke!=null&&ke.length&&e.hooks.nodesChange.trigger(ke)},h=O=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const F=window.getComputedStyle(L),{m22:Q}=new window.DOMMatrixReadOnly(F.transform),Y=[];for(const ke of O){const be=ke,xe=d(be.id);if(xe){const ve=Va(be.nodeElement);if(!!(ve.width&&ve.height&&(xe.dimensions.width!==ve.width||xe.dimensions.height!==ve.height||be.forceUpdate))){const H=be.nodeElement.getBoundingClientRect();xe.dimensions=ve,xe.handleBounds.source=Dm("source",be.nodeElement,H,Q,xe.id),xe.handleBounds.target=Dm("target",be.nodeElement,H,Q,xe.id),Y.push({id:xe.id,type:"dimensions",dimensions:ve})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),Y.length&&e.hooks.nodesChange.trigger(Y)},p=(O,L)=>{const F=new Set,Q=new Set;for(const be of O)Jn(be)?F.add(be.id):Cn(be)&&Q.add(be.id);const Y=Sn(n.value,F,!0),ke=Sn(o.value,Q);if(e.multiSelectionActive){for(const be of F)Y.push(xn(be,L));for(const be of Q)ke.push(xn(be,L))}Y.length&&e.hooks.nodesChange.trigger(Y),ke.length&&e.hooks.edgesChange.trigger(ke)},y=O=>{if(e.multiSelectionActive){const L=O.map(F=>xn(F.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(Sn(n.value,new Set(O.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(Sn(o.value))},b=O=>{if(e.multiSelectionActive){const L=O.map(F=>xn(F.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(Sn(o.value,new Set(O.map(L=>L.id)))),e.hooks.nodesChange.trigger(Sn(n.value,new Set,!0))},f=O=>{p(O,!0)},g=O=>{const F=(O||e.nodes).map(Q=>(Q.selected=!1,xn(Q.id,!1)));e.hooks.nodesChange.trigger(F)},k=O=>{const F=(O||e.edges).map(Q=>(Q.selected=!1,xn(Q.id,!1)));e.hooks.edgesChange.trigger(F)},_=O=>{if(!O||!O.length)return p([],!1);const L=O.reduce((F,Q)=>{const Y=xn(Q.id,!1);return Jn(Q)?F.nodes.push(Y):F.edges.push(Y),F},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},N=O=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([O,e.maxZoom]),e.minZoom=O},I=O=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,O]),e.maxZoom=O},$=O=>{var L;(L=e.d3Zoom)==null||L.translateExtent(O),e.translateExtent=O},C=O=>{e.nodeExtent=O,a()},A=O=>{var L;(L=e.d3Zoom)==null||L.clickDistance(O)},T=O=>{e.nodesDraggable=O,e.nodesConnectable=O,e.elementsSelectable=O},V=O=>{const L=O instanceof Function?O(e.nodes):O;!e.initialized&&!L.length||(e.nodes=Lm(L,d,e.hooks.error.trigger))},R=O=>{const L=O instanceof Function?O(e.edges):O;if(!e.initialized&&!L.length)return;const F=Hl(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Ul(e.connectionLookup,o.value,F),e.edges=F},x=O=>{const L=O instanceof Function?O([...e.nodes,...e.edges]):O;!e.initialized&&!L.length||(V(L.filter(Jn)),R(L.filter(Cn)))},M=O=>{let L=O instanceof Function?O(e.nodes):O;L=Array.isArray(L)?L:[L];const F=Lm(L,d,e.hooks.error.trigger),Q=[];for(const Y of F)Q.push(Im(Y));Q.length&&e.hooks.nodesChange.trigger(Q)},E=O=>{let L=O instanceof Function?O(e.edges):O;L=Array.isArray(L)?L:[L];const F=Hl(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const Y of F)Q.push(Im(Y));Q.length&&e.hooks.edgesChange.trigger(Q)},w=(O,L=!0,F=!1)=>{const Q=O instanceof Function?O(e.nodes):O,Y=Array.isArray(Q)?Q:[Q],ke=[],be=[];function xe(U){const H=s(U);for(const q of H)(!ct(q.deletable)||q.deletable)&&be.push(Cm(q.id,q.source,q.target,q.sourceHandle,q.targetHandle))}function ve(U){const H=[];for(const q of e.nodes)q.parentNode===U&&H.push(q);if(H.length){for(const q of H)ke.push(vm(q.id));L&&xe(H);for(const q of H)ve(q.id)}}for(const U of Y){const H=typeof U=="string"?d(U):U;H&&(ct(H.deletable)&&!H.deletable||(ke.push(vm(H.id)),L&&xe([H]),F&&ve(H.id)))}be.length&&e.hooks.edgesChange.trigger(be),ke.length&&e.hooks.nodesChange.trigger(ke)},S=O=>{const L=O instanceof Function?O(e.edges):O,F=Array.isArray(L)?L:[L],Q=[];for(const Y of F){const ke=typeof Y=="string"?u(Y):Y;ke&&(ct(ke.deletable)&&!ke.deletable||Q.push(Cm(typeof Y=="string"?Y:Y.id,ke.source,ke.target,ke.sourceHandle,ke.targetHandle)))}e.hooks.edgesChange.trigger(Q)},B=(O,L,F=!0)=>{const Q=u(O.id);if(!Q)return!1;const Y=e.edges.indexOf(Q),ke=M0(O,L,Q,F,e.hooks.error.trigger);if(ke){const[be]=Hl([ke],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((xe,ve)=>ve===Y?be:xe),Ul(e.connectionLookup,o.value,[be]),be}return!1},z=(O,L,F={replace:!1})=>{const Q=u(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;Q.data=F.replace?Y:{...Q.data,...Y}},K=O=>wm(O,e.nodes),J=O=>{const L=wm(O,e.edges);return Ul(e.connectionLookup,o.value,L),L},re=(O,L,F={replace:!1})=>{const Q=d(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;F.replace?e.nodes.splice(e.nodes.indexOf(Q),1,Y):Object.assign(Q,Y)},pe=(O,L,F={replace:!1})=>{const Q=d(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;Q.data=F.replace?Y:{...Q.data,...Y}},ce=(O,L,F=!1)=>{F?e.connectionClickStartHandle=O:e.connectionStartHandle=O,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},Ne=(O,L=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=O,e.connectionEndHandle=L,e.connectionStatus=F)},he=(O,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},de=O=>{const L=s0(O),F=L?null:hi(O)?O:d(O.id);return!L&&!F?[null,null,L]:[L?O:Ta(F),F,L]},_e=(O,L=!0,F=e.nodes)=>{const[Q,Y,ke]=de(O);if(!Q)return[];const be=[];for(const xe of F||e.nodes){if(!ke&&(xe.id===Y.id||!xe.computedPosition))continue;const ve=Ta(xe),U=Ma(ve,Q);(L&&U>0||U>=ve.width*ve.height||U>=Number(Q.width)*Number(Q.height))&&be.push(xe)}return be},Se=(O,L,F=!0)=>{const[Q]=de(O);if(!Q)return!1;const Y=Ma(Q,L);return F&&Y>0||Y>=Number(Q.width)*Number(Q.height)},me=O=>{const{viewport:L,dimensions:F,d3Zoom:Q,d3Selection:Y,translateExtent:ke}=e;if(!Q||!Y||!O.x&&!O.y)return!1;const be=So.translate(L.x+O.x,L.y+O.y).scale(L.zoom),xe=[[0,0],[F.width,F.height]],ve=Q.constrain()(be,xe,ke),U=e.viewport.x!==ve.x||e.viewport.y!==ve.y||e.viewport.zoom!==ve.k;return Q.transform(Y,ve),U},ye=O=>{const L=O instanceof Function?O(e):O,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ct(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const Q=L.modelValue||L.nodes||L.edges?[]:void 0;Q&&(L.modelValue&&Q.push(...L.modelValue),L.nodes&&Q.push(...L.nodes),L.edges&&Q.push(...L.edges),x(Q));const Y=()=>{ct(L.maxZoom)&&I(L.maxZoom),ct(L.minZoom)&&N(L.minZoom),ct(L.translateExtent)&&$(L.translateExtent)};for(const ke of Object.keys(L)){const be=ke,xe=L[be];![...W0,...F].includes(be)&&ct(xe)&&(e[be]=xe)}cl(()=>e.d3Zoom).not.toBeNull().then(Y),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:h,setElements:x,setNodes:V,setEdges:R,addNodes:M,addEdges:E,removeNodes:w,removeEdges:S,findNode:d,findEdge:u,updateEdge:B,updateEdgeData:z,updateNode:re,updateNodeData:pe,applyEdgeChanges:J,applyNodeChanges:K,addSelectedElements:f,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:N,setMaxZoom:I,setTranslateExtent:$,setNodeExtent:C,setPaneClickDistance:A,removeSelectedElements:_,removeSelectedNodes:g,removeSelectedEdges:k,startConnection:ce,updateConnection:Ne,endConnection:he,setInteractive:T,setState:ye,getIntersectingNodes:_e,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Se,panBy:me,fitView:O=>i.value.fitView(O),zoomIn:O=>i.value.zoomIn(O),zoomOut:O=>i.value.zoomOut(O),zoomTo:(O,L)=>i.value.zoomTo(O,L),setViewport:(O,L)=>i.value.setViewport(O,L),setTransform:(O,L)=>i.value.setTransform(O,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(O,L,F)=>i.value.setCenter(O,L,F),fitBounds:(O,L)=>i.value.fitBounds(O,L),project:O=>i.value.project(O),screenToFlowCoordinate:O=>i.value.screenToFlowCoordinate(O),flowToScreenCoordinate:O=>i.value.flowToScreenCoordinate(O),toObject:()=>{const O=[],L=[];for(const F of e.nodes){const{computedPosition:Q,handleBounds:Y,selected:ke,dimensions:be,isParent:xe,resizing:ve,dragging:U,events:H,...q}=F;O.push(q)}for(const F of e.edges){const{selected:Q,sourceNode:Y,targetNode:ke,events:be,...xe}=F;L.push(xe)}return JSON.parse(JSON.stringify({nodes:O,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:O=>new Promise(L=>{const{nodes:F,edges:Q,position:Y,zoom:ke,viewport:be}=O;F&&V(F),Q&&R(Q);const[xe,ve]=be!=null&&be.x&&(be!=null&&be.y)?[be.x,be.y]:Y??[null,null];if(xe&&ve){const U=(be==null?void 0:be.zoom)||ke||e.viewport.zoom;return cl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:xe,y:ve,zoom:U}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const O=Ym();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=So.translate(O.defaultViewport.x??0,O.defaultViewport.y??0).scale(Wn(O.defaultViewport.zoom??1,O.minZoom,O.maxZoom)),F=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[F.width,F.height]],Y=e.d3Zoom.constrain()(L,Q,O.translateExtent);e.d3Zoom.transform(e.d3Selection,Y)}ye(O)},$destroy:()=>{}}}const X0=["data-id","data-handleid","data-nodeid","data-handlepos"],Z0={name:"Handle",compatConfig:{MODE:3}},Zn=t.defineComponent({...Z0,props:{id:{default:null},type:{},position:{default:()=>Te.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:h}=je(),{id:p,node:y,nodeEl:b,connectedEdges:f}=Km(),g=t.ref(),k=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=t.toRef(()=>{var R,x,M,E,w,S;return((R=l.value)==null?void 0:R.nodeId)===p&&((x=l.value)==null?void 0:x.id)===e.id&&((M=l.value)==null?void 0:M.type)===i.value||((E=c.value)==null?void 0:E.nodeId)===p&&((w=c.value)==null?void 0:w.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),I=t.toRef(()=>{var R,x,M;return((R=s.value)==null?void 0:R.nodeId)===p&&((x=s.value)==null?void 0:x.id)===e.id&&((M=s.value)==null?void 0:M.type)===i.value}),{handlePointerDown:$,handleClick:C}=jm({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),A=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!f.value.some(R=>{const x=R[`${i.value}Handle`];return R[i.value]!==p?!1:x?x===e.id:!0}):typeof e.connectable=="number"?f.value.filter(R=>{const x=R[`${i.value}Handle`];return R[i.value]!==p?!1:x?x===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,f.value):ct(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var R;if(!y.dimensions.width||!y.dimensions.height)return;const x=(R=y.handleBounds[i.value])==null?void 0:R.find(K=>K.id===e.id);if(!d.value||x)return;const M=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!g.value||!M||!e.id)return;const E=b.value.getBoundingClientRect(),w=g.value.getBoundingClientRect(),S=window.getComputedStyle(M),{m22:B}=new window.DOMMatrixReadOnly(S.transform),z={id:e.id,position:e.position,x:(w.left-E.left)/B,y:(w.top-E.top)/B,type:i.value,nodeId:p,...Va(g.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],z]});function T(R){const x=Ol(R);A.value&&k.value&&(x&&R.button===0||!x)&&$(R)}function V(R){!p||!s.value&&!k.value||A.value&&C(R)}return n({handleClick:C,handlePointerDown:$,onClick:V,onPointerDown:T}),(R,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:g,"data-id":`${t.unref(r)}-${t.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(p),"data-handlepos":R.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${R.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(h),i.value,{connectable:A.value,connecting:I.value,connectablestart:k.value,connectableend:_.value,connectionindicator:A.value&&(k.value&&!N.value||_.value&&N.value)}]]),onMousedown:T,onTouchstartPassive:T,onClick:V},[t.renderSlot(R.$slots,"default",{id:R.id})],42,X0))}}),Fa=function({sourcePosition:e=Te.Bottom,targetPosition:n=Te.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Zn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Zn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Fa.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Fa.inheritAttrs=!1,Fa.compatConfig={MODE:3};const Q0=Fa,Ua=function({targetPosition:e=Te.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Zn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};Ua.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ua.inheritAttrs=!1,Ua.compatConfig={MODE:3};const eN=Ua,Ha=function({sourcePosition:e=Te.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Zn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ha.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ha.inheritAttrs=!1,Ha.compatConfig={MODE:3};const tN=Ha,nN=["transform"],oN=["width","height","x","y","rx","ry"],iN=["y"],aN={name:"EdgeText",compatConfig:{MODE:3}},rN=t.defineComponent({...aN,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),i=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(a),t.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==n.value.width||r.height!==n.value.height)&&(n.value=r)}return(r,l)=>(t.openBlock(),t.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*r.labelBgPadding[0]}px`,height:`${n.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:t.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,oN)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:r.labelStyle}),[t.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(r.label),1)],64))])],16,iN)],8,nN))}}),lN=["id","d","marker-end","marker-start"],sN=["d","stroke-width"],cN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ja=t.defineComponent({...cN,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),i=t.ref(null),a=t.ref(null),r=t.useAttrs();return n({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,lN),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,sN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(rN,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function qm({sourceX:e,sourceY:n,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-n)/2,s=i<n?i+l:i-l;return[r,s,a,l]}function Wm({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=n*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function Ka(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Jm({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Te.Left:l=n-Ka(n-i,r),s=o;break;case Te.Right:l=n+Ka(i-n,r),s=o;break;case Te.Top:l=n,s=o-Ka(o-a,r);break;case Te.Bottom:l=n,s=o+Ka(a-o,r);break}return[l,s]}function Xm(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top,curvature:s=.25}=e,[c,d]=Jm({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=Jm({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[h,p,y,b]=Wm({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,h,p,y,b]}function Zm({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Te.Left:case Te.Right:r=.5*(n+i),l=o;break;case Te.Top:case Te.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Qm(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top}=e,[s,c]=Zm({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=Zm({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,h,p,y]=Wm({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,h,p,y]}const ef={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}};function dN({source:e,sourcePosition:n=Te.Bottom,target:o}){return n===Te.Left||n===Te.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 tf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function uN({source:e,sourcePosition:n=Te.Bottom,target:o,targetPosition:i=Te.Top,center:a,offset:r}){const l=ef[n],s=ef[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=dN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",h=u[m];let p,y,b;const f={x:0,y:0},g={x:0,y:0},[k,_,N,I]=qm({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??k,b=a.y??_;const C=[{x:y,y:c.y},{x:y,y:d.y}],A=[{x:c.x,y:b},{x:d.x,y:b}];l[m]===h?p=m==="x"?C:A:p=m==="x"?A:C}else{const C=[{x:c.x,y:d.y}],A=[{x:d.x,y:c.y}];if(m==="x"?p=l.x===h?A:C:p=l.y===h?C:A,n===i){const M=Math.abs(e[m]-o[m]);if(M<=r){const E=Math.min(r-1,r-M);l[m]===h?f[m]=(c[m]>e[m]?-1:1)*E:g[m]=(d[m]>o[m]?-1:1)*E}}if(n!==i){const M=m==="x"?"y":"x",E=l[m]===s[M],w=c[M]>d[M],S=c[M]<d[M];(l[m]===1&&(!E&&w||E&&S)||l[m]!==1&&(!E&&S||E&&w))&&(p=m==="x"?C:A)}const T={x:c.x+f.x,y:c.y+f.y},V={x:d.x+g.x,y:d.y+g.y},R=Math.max(Math.abs(T.x-p[0].x),Math.abs(V.x-p[0].x)),x=Math.max(Math.abs(T.y-p[0].y),Math.abs(V.y-p[0].y));R>=x?(y=(T.x+V.x)/2,b=p[0].y):(y=p[0].x,b=(T.y+V.y)/2)}return[[e,{x:c.x+f.x,y:c.y+f.y},...p,{x:d.x+g.x,y:d.y+g.y},o],y,b,N,I]}function mN(e,n,o,i){const a=Math.min(tf(e,n)/2,tf(n,o)/2,i),{x:r,y:l}=n;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function Kl(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,h,p,y,b]=uN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((g,k,_)=>{let N;return _>0&&_<m.length-1?N=mN(m[_-1],k,m[_+1],s):N=`${_===0?"M":"L"}${k.x} ${k.y}`,g+=N,g},""),h,p,y,b]}function fN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=qm({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const pN=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=fN(e);return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),nf=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Kl({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),hN=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(nf,{...e,...n,borderRadius:0})}}),yN=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Xm({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),gN=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Qm({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),bN={input:tN,default:Q0,output:eN},_N={default:yN,straight:pN,step:hN,smoothstep:nf,simplebezier:gN};function kN(e,n,o){const i=t.computed(()=>b=>n.value.get(b)),a=t.computed(()=>b=>o.value.get(b)),r=t.computed(()=>{const b={..._N,...e.edgeTypes},f=Object.keys(b);for(const g of e.edges)g.type&&!f.includes(g.type)&&(b[g.type]=g.type);return b}),l=t.computed(()=>{const b={...bN,...e.nodeTypes},f=Object.keys(b);for(const g of e.nodes)g.type&&!f.includes(g.type)&&(b[g.type]=g.type);return b}),s=t.computed(()=>e.onlyRenderVisibleElements?bm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const f of e.edges){const g=n.value.get(f.source),k=n.value.get(f.target);E0({sourcePos:g.computedPosition||{x:0,y:0},targetPos:k.computedPosition||{x:0,y:0},sourceWidth:g.dimensions.width,sourceHeight:g.dimensions.height,targetWidth:k.dimensions.width,targetHeight:k.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(f)}return b}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const b=[];for(const f of e.nodes)f.selected&&b.push(f);return b}),m=t.computed(()=>{const b=[];for(const f of e.edges)f.selected&&b.push(f);return b}),h=t.computed(()=>[...u.value,...m.value]),p=t.computed(()=>{const b=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&f.handleBounds!==void 0&&b.push(f);return b}),y=t.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:p,areNodesInitialized:y}}class Qn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Qn.instance;return Qn.instance=i??new Qn,o&&(o.config.globalProperties.$vueFlowStorage=Qn.instance),Qn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=Ym(),a=t.reactive(i),r={};for(const[h,p]of Object.entries(a.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=p.on}const l={};for(const[h,p]of Object.entries(a.hooks))l[h]=p.trigger;const s=t.computed(()=>{const h=new Map;for(const p of a.nodes)h.set(p.id,p);return h}),c=t.computed(()=>{const h=new Map;for(const p of a.edges)h.set(p.id,p);return h}),d=kN(a,s,c),u=J0(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...g_(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function je(e){const n=Qn.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(zm,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,h,p)=>{const y=f=>{d.applyNodeChanges(f)},b=f=>{d.applyEdgeChanges(f)};m?(d.onNodesChange(y),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),ti(()=>{if(s){const m=n.get(s.id);m?m.$destroy():ki(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(zm,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ut(st.USEVUEFLOW_OPTIONS))}return s}function EN(e){const{emits:n,dimensions:o}=je();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Va(e.value);(s.width===0||s.height===0)&&n.error(new ut(st.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)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const NN={name:"UserSelection",compatConfig:{MODE:3}},wN=t.defineComponent({...NN,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),IN=["tabIndex"],vN={name:"NodesSelection",compatConfig:{MODE:3}},CN=t.defineComponent({...vN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=je(),s=Gm(),c=t.ref(null),d=Hm({el:c,onStart(y){n.selectionDragStart(y),n.nodeDragStart(y)},onDrag(y){n.selectionDrag(y),n.nodeDrag(y)},onStop(y){n.selectionDragStop(y),n.nodeDragStop(y)}});t.onMounted(()=>{var y;r.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=t.computed(()=>Ml(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(y){n.selectionContextMenu({event:y,nodes:i.value})}function p(y){r.value||Ro[y.key]&&(y.preventDefault(),s({x:Ro[y.key].x,y:Ro[y.key].y},y.shiftKey))}return(y,b)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,IN)],6)):t.createCommentVNode("",!0)}});function xN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const SN={name:"Pane",compatConfig:{MODE:3}},RN=t.defineComponent({...SN,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:h,removeEdges:p,selectionMode:y,deleteKeyCode:b,multiSelectionKeyCode:f,multiSelectionActive:g,edgeLookup:k,nodeLookup:_,connectionLookup:N,defaultEdgeOptions:I,connectionStartHandle:$,panOnDrag:C}=je(),A=t.shallowRef(null),T=t.shallowRef(new Set),V=t.shallowRef(new Set),R=t.shallowRef(null),x=t.toRef(()=>c.value&&(e.isSelecting||r.value)),M=t.toRef(()=>$.value!==null);let E=!1,w=!1;const S=pi(b,{actInsideInputWithModifier:!1}),B=pi(f);t.watch(S,he=>{he&&(h(m.value),p(u.value),d.value=!1)}),t.watch(B,he=>{g.value=he});function z(he,de){return _e=>{_e.target===de&&(he==null||he(_e))}}function K(he){if(E||M.value){E=!1;return}a.paneClick(he),l(),d.value=!1}function J(he){var de;if(Array.isArray(C.value)&&((de=C.value)!=null&&de.includes(2))){he.preventDefault();return}a.paneContextMenu(he)}function re(he){a.paneScroll(he)}function pe(he){var de,_e,Se;if(R.value=((de=n.value)==null?void 0:de.getBoundingClientRect())??null,!c.value||!e.isSelecting||he.button!==0||he.target!==A.value||!R.value)return;(Se=(_e=he.target)==null?void 0:_e.setPointerCapture)==null||Se.call(_e,he.pointerId);const{x:me,y:ye}=xN(he,R.value);w=!0,E=!1,l(),s.value={width:0,height:0,startX:me,startY:ye,x:me,y:ye},a.selectionStart(he)}function ce(he){var de;if(!R.value||!s.value)return;E=!0;const{x:_e,y:Se}=Jt(he,R.value),{startX:me=0,startY:ye=0}=s.value,ie={startX:me,startY:ye,x:_e<me?_e:me,y:Se<ye?Se:ye,width:Math.abs(_e-me),height:Math.abs(Se-ye)},se=T.value,fe=V.value;T.value=new Set(bm(o.value,ie,i.value,y.value===Al.Partial,!0).map(L=>L.id)),V.value=new Set;const O=((de=I.value)==null?void 0:de.selectable)??!0;for(const L of T.value){const F=N.value.get(L);if(F)for(const{edgeId:Q}of F.values()){const Y=k.value.get(Q);Y&&(Y.selectable??O)&&V.value.add(Q)}}if(!Pm(se,T.value)){const L=Sn(_.value,T.value,!0);a.nodesChange(L)}if(!Pm(fe,V.value)){const L=Sn(k.value,V.value);a.edgesChange(L)}s.value=ie,r.value=!0,d.value=!1}function Ne(he){var de;he.button!==0||!w||((de=he.target)==null||de.releasePointerCapture(he.pointerId),!r.value&&s.value&&he.target===A.value&&K(he),r.value=!1,s.value=null,d.value=T.value.size>0,a.selectionEnd(he),e.selectionKeyPressed&&(E=!1),w=!1)}return(he,de)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:A,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:he.isSelecting}]),onClick:de[0]||(de[0]=_e=>x.value?void 0:z(K,A.value)(_e)),onContextmenu:de[1]||(de[1]=_e=>z(J,A.value)(_e)),onWheelPassive:de[2]||(de[2]=_e=>z(re,A.value)(_e)),onPointerenter:de[3]||(de[3]=_e=>x.value?void 0:t.unref(a).paneMouseEnter(_e)),onPointerdown:de[4]||(de[4]=_e=>x.value?pe(_e):t.unref(a).paneMouseMove(_e)),onPointermove:de[5]||(de[5]=_e=>x.value?ce(_e):t.unref(a).paneMouseMove(_e)),onPointerup:de[6]||(de[6]=_e=>x.value?Ne(_e):void 0),onPointerleave:de[7]||(de[7]=_e=>t.unref(a).paneMouseLeave(_e))},[t.renderSlot(he.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(wN,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(CN,{key:1})):t.createCommentVNode("",!0)],34))}}),AN={name:"Transform",compatConfig:{MODE:3}},$N=t.defineComponent({...AN,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=je(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),TN={name:"Viewport",compatConfig:{MODE:3}},MN=t.defineComponent({...TN,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:b,noWheelClassName:f,noPanClassName:g,emits:k,connectionStartHandle:_,userSelectionActive:N,paneDragging:I,d3Zoom:$,d3Selection:C,d3ZoomHandler:A,viewport:T,viewportRef:V,paneClickDistance:R}=je();EN(V);const x=t.shallowRef(!1),M=t.shallowRef(!1);let E=null,w=!1,S=0,B={x:0,y:0,zoom:0};const z=pi(s),K=pi(l),J=pi(r),re=t.toRef(()=>(!K.value||K.value&&l.value===!0)&&(z.value||m.value)),pe=t.toRef(()=>z.value||c.value),ce=t.toRef(()=>l.value===!0&&re.value!==!0),Ne=t.toRef(()=>K.value&&l.value!==!0||N.value||ce.value),he=t.toRef(()=>_.value!==null);t.onMounted(()=>{if(!V.value){ki("Viewport element is missing");return}const ye=V.value,ie=ye.getBoundingClientRect(),se=t0().clickDistance(R.value).scaleExtent([n.value,o.value]).translateExtent(a.value),fe=Vt(ye).call(se),O=fe.on("wheel.zoom"),L=So.translate(i.value.x??0,i.value.y??0).scale(Wn(i.value.zoom??1,n.value,o.value)),F=[[0,0],[ie.width,ie.height]],Q=se.constrain()(L,F,a.value);se.transform(fe,Q),se.wheelDelta(Vl),$.value=se,C.value=fe,A.value=O,T.value={x:Q.x,y:Q.y,zoom:Q.k},se.on("start",Y=>{var ke;if(!Y.sourceEvent)return null;S=Y.sourceEvent.button,x.value=!0;const be=Se(Y.transform);((ke=Y.sourceEvent)==null?void 0:ke.type)==="mousedown"&&(I.value=!0),B=be,k.viewportChangeStart(be),k.moveStart({event:Y,flowTransform:be})}),se.on("end",Y=>{if(!Y.sourceEvent)return null;if(x.value=!1,I.value=!1,de(re.value,S??0)&&!w&&k.paneContextMenu(Y.sourceEvent),w=!1,_e(B,Y.transform)){const ke=Se(Y.transform);B=ke,k.viewportChangeEnd(ke),k.moveEnd({event:Y,flowTransform:ke})}}),se.filter(Y=>{var ke;const be=J.value||y.value,xe=p.value&&Y.ctrlKey,ve=Y.button,U=Y.type==="wheel";if(ve===1&&Y.type==="mousedown"&&(me(Y,"vue-flow__node")||me(Y,"vue-flow__edge")))return!0;if(!re.value&&!be&&!pe.value&&!h.value&&!p.value||N.value||he.value&&!U||!h.value&&Y.type==="dblclick"||me(Y,f.value)&&U||me(Y,g.value)&&(!U||pe.value&&U&&!J.value)||!p.value&&Y.ctrlKey&&U||!be&&!pe.value&&!xe&&U)return!1;if(!p&&Y.type==="touchstart"&&((ke=Y.touches)==null?void 0:ke.length)>1)return Y.preventDefault(),!1;if(!re.value&&(Y.type==="mousedown"||Y.type==="touchstart")||ce.value&&Array.isArray(m.value)&&m.value.includes(0)&&ve===0||Array.isArray(m.value)&&!m.value.includes(ve)&&(Y.type==="mousedown"||Y.type==="touchstart"))return!1;const H=Array.isArray(m.value)&&m.value.includes(ve)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!ve||ve<=1;return(!Y.ctrlKey||z.value||U)&&H}),t.watch([N,re],()=>{N.value&&!x.value?se.on("zoom",null):N.value||se.on("zoom",Y=>{T.value={x:Y.transform.x,y:Y.transform.y,zoom:Y.transform.k};const ke=Se(Y.transform);w=de(re.value,S??0),k.viewportChange(ke),k.move({event:Y,flowTransform:ke})})},{immediate:!0}),t.watch([N,pe,d,J,p,b,f],()=>{pe.value&&!J.value&&!N.value?fe.on("wheel.zoom",Y=>{if(me(Y,f.value))return!1;const ke=J.value||y.value,be=p.value&&Y.ctrlKey;if(!(!b.value||pe.value||ke||be))return!1;Y.preventDefault(),Y.stopImmediatePropagation();const ve=fe.property("__zoom").k||1,U=_i();if(!z.value&&Y.ctrlKey&&p.value&&U){const W=Gt(Y),ne=Vl(Y),G=ve*2**ne;se.scaleTo(fe,G,W,Y);return}const H=Y.deltaMode===1?20:1;let q=d.value===fi.Vertical?0:Y.deltaX*H,Ce=d.value===fi.Horizontal?0:Y.deltaY*H;!U&&Y.shiftKey&&d.value!==fi.Vertical&&!q&&Ce&&(q=Ce,Ce=0),se.translateBy(fe,-(q/ve)*u.value,-(Ce/ve)*u.value);const De=Se(fe.property("__zoom"));E&&clearTimeout(E),M.value?(k.move({event:Y,flowTransform:De}),k.viewportChange(De),E=setTimeout(()=>{k.moveEnd({event:Y,flowTransform:De}),k.viewportChangeEnd(De),M.value=!1},150)):(M.value=!0,k.moveStart({event:Y,flowTransform:De}),k.viewportChangeStart(De))},{passive:!1}):typeof O<"u"&&fe.on("wheel.zoom",function(Y,ke){const be=!b.value&&Y.type==="wheel"&&!Y.ctrlKey,xe=J.value||y.value,ve=p.value&&Y.ctrlKey;if(!xe&&!c.value&&!ve&&Y.type==="wheel"||be||me(Y,f.value))return null;Y.preventDefault(),O.call(this,Y,ke)},{passive:!1})},{immediate:!0})});function de(ye,ie){return ie===2&&Array.isArray(ye)&&ye.includes(2)}function _e(ye,ie){return ye.x!==ie.x&&!Number.isNaN(ie.x)||ye.y!==ie.y&&!Number.isNaN(ie.y)||ye.zoom!==ie.k&&!Number.isNaN(ie.k)}function Se(ye){return{x:ye.x,y:ye.y,zoom:ye.k}}function me(ye,ie){return ye.target.closest(`.${ie}`)}return(ye,ie)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:V,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(RN,{"is-selecting":Ne.value,"selection-key-pressed":t.unref(K),class:t.normalizeClass({connecting:he.value,dragging:t.unref(I),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode($N,null,{default:t.withCtx(()=>[t.renderSlot(ye.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),VN=["id"],BN=["id"],DN=["id"],LN={name:"A11yDescriptions",compatConfig:{MODE:3}},ON=t.defineComponent({...LN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(sm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,VN),t.createElementVNode("div",{id:`${t.unref(cm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,BN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(l0)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(i)),9,DN))],64))}});function PN(){const e=je();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function zN(e,n,o){return o===Te.Left?e-n:o===Te.Right?e+n:e}function FN(e,n,o){return o===Te.Top?e-n:o===Te.Bottom?e+n:e}const Gl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Te.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:zN(n,e,i),cy:FN(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Gl.props=["radius","centerX","centerY","position","type"],Gl.compatConfig={MODE:3};const of=Gl,UN=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:b,edgesUpdatable:f,edgesFocusable:g,hooks:k}=je(),_=t.computed(()=>u(e.id)),{emit:N,on:I}=L0(_.value,r),$=t.inject(Oa),C=t.getCurrentInstance(),A=t.ref(!1),T=t.ref(!1),V=t.ref(""),R=t.ref(null),x=t.ref("source"),M=t.ref(null),E=t.toRef(()=>typeof _.value.selectable>"u"?b.value:_.value.selectable),w=t.toRef(()=>typeof _.value.updatable>"u"?f.value:_.value.updatable),S=t.toRef(()=>typeof _.value.focusable>"u"?g.value:_.value.focusable);t.provide(V0,e.id),t.provide(B0,M);const B=t.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),z=t.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),K=t.computed(()=>{const L=_.value.type||"default",F=$==null?void 0:$[`edge-${L}`];if(F)return F;let Q=_.value.template??c.value[L];if(typeof Q=="string"&&C){const Y=Object.keys(C.appContext.components);Y&&Y.includes(L)&&(Q=t.resolveComponent(L,!1))}return Q&&typeof Q!="string"?Q:(r.error(new ut(st.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:J}=jm({nodeId:V,handleId:R,type:x,isValidConnection:h,edgeUpdaterType:x,onEdgeUpdate:ce,onEdgeUpdateEnd:Ne});return()=>{const L=m(_.value.source),F=m(_.value.target),Q="pathOptions"in _.value?_.value.pathOptions:{};if(!L&&!F)return r.error(new ut(st.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!L)return r.error(new ut(st.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!F)return r.error(new ut(st.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||L.hidden||F.hidden)return null;let Y;i.value===cn.Strict?Y=L.handleBounds.source:Y=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const ke=Am(Y,_.value.sourceHandle);let be;i.value===cn.Strict?be=F.handleBounds.target:be=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const xe=Am(be,_.value.targetHandle),ve=(ke==null?void 0:ke.position)||Te.Bottom,U=(xe==null?void 0:xe.position)||Te.Top,{x:H,y:q}=$o(L,ke,ve),{x:Ce,y:De}=$o(F,xe,U);return _.value.sourceX=H,_.value.sourceY=q,_.value.targetX=Ce,_.value.targetY=De,t.h("g",{ref:M,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${K.value===!1?"default":_.value.type||"default"}`,s.value,B.value,{updating:A.value,selected:_.value.selected,animated:_.value.animated,inactive:!E.value&&!k.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":S.value?`${cm}-${n}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",..._.value.domAttributes,onClick:de,onContextmenu:_e,onDblclick:Se,onMouseenter:me,onMousemove:ye,onMouseleave:ie,onKeyDown:S.value?O:void 0},[T.value?null:t.h(K.value===!1?c.value.default:K.value,{id:e.id,sourceNode:L,targetNode:F,source:_.value.source,target:_.value.target,type:_.value.type,updatable:w.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...I},style:z.value,markerStart:`url('#${bi(_.value.markerStart,n)}')`,markerEnd:`url('#${bi(_.value.markerEnd,n)}')`,sourcePosition:ve,targetPosition:U,sourceX:H,sourceY:q,targetX:Ce,targetY:De,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...Q}),[w.value==="source"||w.value===!0?[t.h("g",{onMousedown:se,onMouseenter:re,onMouseout:pe},t.h(of,{position:ve,centerX:H,centerY:q,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[t.h("g",{onMousedown:fe,onMouseenter:re,onMouseout:pe},t.h(of,{position:U,centerX:Ce,centerY:De,radius:a.value,type:"target","data-type":"target"}))]:null]])};function re(){A.value=!0}function pe(){A.value=!1}function ce(L,F){N.update({event:L,edge:_.value,connection:F})}function Ne(L){N.updateEnd({event:L,edge:_.value}),T.value=!1}function he(L,F){L.button===0&&(T.value=!0,V.value=F?_.value.target:_.value.source,R.value=(F?_.value.targetHandle:_.value.sourceHandle)??null,x.value=F?"target":"source",N.updateStart({event:L,edge:_.value}),J(L))}function de(L){var F;const Q={event:L,edge:_.value};E.value&&(l.value=!1,_.value.selected&&p.value?(d([_.value]),(F=M.value)==null||F.blur()):o([_.value])),N.click(Q)}function _e(L){N.contextMenu({event:L,edge:_.value})}function Se(L){N.doubleClick({event:L,edge:_.value})}function me(L){N.mouseEnter({event:L,edge:_.value})}function ye(L){N.mouseMove({event:L,edge:_.value})}function ie(L){N.mouseLeave({event:L,edge:_.value})}function se(L){he(L,!0)}function fe(L){he(L,!1)}function O(L){var F;!y.value&&dm.includes(L.key)&&E.value&&(L.key==="Escape"?((F=M.value)==null||F.blur(),d([u(e.id)])):o([u(e.id)]))}}}),HN=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=je(),h=(e=t.inject(Oa))==null?void 0:e["connection-line"],p=t.computed(()=>{var k;return m((k=i.value)==null?void 0:k.nodeId)}),y=t.computed(()=>{var k;return m((k=a.value)==null?void 0:k.nodeId)??null}),b=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),f=t.computed(()=>c.value.markerStart?`url(#${bi(c.value.markerStart,n)})`:""),g=t.computed(()=>c.value.markerEnd?`url(#${bi(c.value.markerEnd,n)})`:"");return()=>{var k,_,N;if(!p.value||!i.value)return null;const I=i.value.id,$=i.value.type,C=p.value.handleBounds;let A=(C==null?void 0:C[$])??[];if(o.value===cn.Loose){const z=(C==null?void 0:C[$==="source"?"target":"source"])??[];A=[...A,...z]}if(!A)return null;const T=(I?A.find(z=>z.id===I):A[0])??null,V=(T==null?void 0:T.position)??Te.Top,{x:R,y:x}=$o(p.value,T,V);let M=null;y.value&&(o.value===cn.Strict?M=((k=y.value.handleBounds[$==="source"?"target":"source"])==null?void 0:k.find(z=>{var K;return z.id===((K=a.value)==null?void 0:K.id)}))||null:M=((_=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:_.find(z=>{var K;return z.id===((K=a.value)==null?void 0:K.id)}))||null);const E=((N=a.value)==null?void 0:N.position)??(V?zl[V]:null);if(!V||!E)return null;const w=l.value??c.value.type??qn.Bezier;let S="";const B={sourceX:R,sourceY:x,sourcePosition:V,targetX:b.value.x,targetY:b.value.y,targetPosition:E};return w===qn.Bezier?[S]=Xm(B):w===qn.Step?[S]=Kl({...B,borderRadius:0}):w===qn.SmoothStep?[S]=Kl(B):w===qn.SimpleBezier?[S]=Qm(B):S=`M${R},${x} ${b.value.x},${b.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},h?t.h(h,{sourceX:R,sourceY:x,sourcePosition:V,targetX:b.value.x,targetY:b.value.y,targetPosition:E,sourceNode:p.value,sourceHandle:T,targetNode:y.value,targetHandle:M,markerEnd:g.value,markerStart:f.value,connectionStatus:d.value}):t.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":g.value,"marker-start":f.value})))}}}),jN=["id","markerWidth","markerHeight","markerUnits","orient"],KN={name:"MarkerType",compatConfig:{MODE:3}},GN=t.defineComponent({...KN,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref($l).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref($l).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,jN))}}),YN={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},qN={name:"MarkerDefinitions",compatConfig:{MODE:3}},WN=t.defineComponent({...qN,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=je(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=bi(d,n);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.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(l,s)=>(t.openBlock(),t.createElementBlock("svg",YN,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(GN,{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))])]))}}),JN={name:"Edges",compatConfig:{MODE:3}},XN=t.defineComponent({...JN,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(WN),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(N0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(UN),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(HN))],64))}}),ZN=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:b,snapToGrid:f,snapGrid:g,nodeDragThreshold:k,nodesDraggable:_,elementsSelectable:N,nodesConnectable:I,nodesFocusable:$,hooks:C}=je(),A=t.ref(null);t.provide(Um,A),t.provide(Fm,e.id);const T=t.inject(Oa),V=t.getCurrentInstance(),R=Gm(),{node:x,parentNode:M}=Km(e.id),{emit:E,on:w}=F0(x,l),S=t.toRef(()=>typeof x.draggable>"u"?_.value:x.draggable),B=t.toRef(()=>typeof x.selectable>"u"?N.value:x.selectable),z=t.toRef(()=>typeof x.connectable>"u"?I.value:x.connectable),K=t.toRef(()=>typeof x.focusable>"u"?$.value:x.focusable),J=t.computed(()=>B.value||S.value||C.value.nodeClick.hasListeners()||C.value.nodeDoubleClick.hasListeners()||C.value.nodeMouseEnter.hasListeners()||C.value.nodeMouseMove.hasListeners()||C.value.nodeMouseLeave.hasListeners()),re=t.toRef(()=>!!x.dimensions.width&&!!x.dimensions.height),pe=t.computed(()=>{const F=x.type||"default",Q=T==null?void 0:T[`node-${F}`];if(Q)return Q;let Y=x.template||m.value[F];if(typeof Y=="string"&&V){const ke=Object.keys(V.appContext.components);ke&&ke.includes(F)&&(Y=t.resolveComponent(F,!1))}return Y&&typeof Y!="string"?Y:(l.error(new ut(st.NODE_TYPE_MISSING,Y)),!1)}),ce=Hm({id:e.id,el:A,disabled:()=>!S.value,selectable:B,dragHandle:()=>x.dragHandle,onStart(F){E.dragStart(F)},onDrag(F){E.drag(F)},onStop(F){E.dragStop(F)},onClick(F){O(F)}}),Ne=t.computed(()=>x.class instanceof Function?x.class(x):x.class),he=t.computed(()=>{const F=(x.style instanceof Function?x.style(x):x.style)||{},Q=x.width instanceof Function?x.width(x):x.width,Y=x.height instanceof Function?x.height(x):x.height;return!F.width&&Q&&(F.width=typeof Q=="string"?Q:`${Q}px`),!F.height&&Y&&(F.height=typeof Y=="string"?Y:`${Y}px`),F}),de=t.toRef(()=>Number(x.zIndex??he.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Se()}),t.onMounted(()=>{t.watch(()=>x.hidden,(F=!1,Q,Y)=>{!F&&A.value&&(e.resizeObserver.observe(A.value),Y(()=>{A.value&&e.resizeObserver.unobserve(A.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>x.type,()=>x.sourcePosition,()=>x.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])})}),t.watch([()=>x.position.x,()=>x.position.y,()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.z},de,()=>x.selected,()=>x.dimensions.height,()=>x.dimensions.width,()=>{var F;return(F=M.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=M.value)==null?void 0:F.dimensions.width}],([F,Q,Y,ke,be,xe])=>{const ve={x:F,y:Q,z:xe+(p.value&&x.selected?1e3:0)};typeof Y<"u"&&typeof ke<"u"?x.computedPosition=y0({x:Y,y:ke,z:be},ve):x.computedPosition=ve},{flush:"post",immediate:!0}),t.watch([()=>x.extent,h],([F,Q],[Y,ke])=>{(F!==Y||Q!==ke)&&_e()}),x.extent==="parent"||typeof x.extent=="object"&&"range"in x.extent&&x.extent.range==="parent"?cl(()=>re).toBe(!0).then(_e):_e(),()=>x.hidden?null:t.h("div",{ref:A,"data-id":x.id,class:["vue-flow__node",`vue-flow__node-${pe.value===!1?"default":x.type||"default"}`,{[o.value]:S.value,dragging:ce==null?void 0:ce.value,draggable:S.value,selected:x.selected,selectable:B.value,parent:x.isParent},Ne.value],style:{visibility:re.value?"visible":"hidden",zIndex:x.computedPosition.z??de.value,transform:`translate(${x.computedPosition.x}px,${x.computedPosition.y}px)`,pointerEvents:J.value?"all":"none",...he.value},tabIndex:K.value?0:void 0,role:K.value?"group":void 0,"aria-describedby":y.value?void 0:`${sm}-${n}`,"aria-label":x.ariaLabel,"aria-roledescription":"node",...x.domAttributes,onMouseenter:me,onMousemove:ye,onMouseleave:ie,onContextmenu:se,onClick:O,onDblclick:fe,onKeydown:L},[t.h(pe.value===!1?m.value.default:pe.value,{id:x.id,type:x.type,data:x.data,events:{...x.events,...w},selected:x.selected,resizing:x.resizing,dragging:ce.value,connectable:z.value,position:x.computedPosition,dimensions:x.dimensions,isValidTargetPos:x.isValidTargetPos,isValidSourcePos:x.isValidSourcePos,parent:x.parentNode,parentNodeId:x.parentNode,zIndex:x.computedPosition.z??de.value,targetPosition:x.targetPosition,sourcePosition:x.sourcePosition,label:x.label,dragHandle:x.dragHandle,onUpdateNodeInternals:Se})]);function _e(){const F=x.computedPosition,{computedPosition:Q,position:Y}=Ll(x,f.value?La(F,g.value):F,l.error,h.value,M.value);(x.computedPosition.x!==Q.x||x.computedPosition.y!==Q.y)&&(x.computedPosition={...x.computedPosition,...Q}),(x.position.x!==Y.x||x.position.y!==Y.y)&&(x.position=Y)}function Se(){A.value&&d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])}function me(F){ce!=null&&ce.value||E.mouseEnter({event:F,node:x})}function ye(F){ce!=null&&ce.value||E.mouseMove({event:F,node:x})}function ie(F){ce!=null&&ce.value||E.mouseLeave({event:F,node:x})}function se(F){return E.contextMenu({event:F,node:x})}function fe(F){return E.doubleClick({event:F,node:x})}function O(F){B.value&&(!i.value||!S.value||k.value>0)&&Fl(x,r.value,c,s,a,!1,A.value),E.click({event:F,node:x})}function L(F){if(!(Tl(F)||y.value))if(dm.includes(F.key)&&B.value){const Q=F.key==="Escape";Fl(x,r.value,c,s,a,Q,A.value)}else S.value&&x.selected&&Ro[F.key]&&(F.preventDefault(),b.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~x.position.x}, y: ${~~x.position.y}`,R({x:Ro[F.key].x,y:Ro[F.key].y},F.shiftKey))}}});function QN(e={includeHiddenNodes:!1}){const{nodes:n}=je();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const ew={class:"vue-flow__nodes vue-flow__container"},tw={name:"Nodes",compatConfig:{MODE:3}},nw=t.defineComponent({...tw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=je(),a=QN(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",ew,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const h=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,h))return m;const p=(t.openBlock(),t.createBlock(t.unref(ZN),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},s,0),128)):t.createCommentVNode("",!0)]))}});function ow(){const{emits:e}=je();t.onMounted(()=>{if(Bm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ut(st.MISSING_STYLES))}})}const iw=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),aw={name:"VueFlow",compatConfig:{MODE:3}},rw=t.defineComponent({...aw,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const i=e,a=t.useSlots(),r=dl(i,"modelValue",o),l=dl(i,"nodes",o),s=dl(i,"edges",o),c=je(i),d=K0({modelValue:r,nodes:l,edges:s},i,c);return Y0(o,c.hooks),PN(),ow(),t.provide(Oa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(MN,null,{default:t.withCtx(()=>[t.createVNode(XN),iw,t.createVNode(nw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(ON)],512))}}),lw={name:"Panel",compatConfig:{MODE:3}},af=t.defineComponent({...lw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=je(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),sw=["width","height","innerHTML"],cw=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={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"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"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)=>(t.openBlock(),t.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:n[e.name]??""},null,8,sw))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},$e=Ke(cw,[["__scopeId","data-v-05aac699"]]),eo=["red","amber","green","teal","blue","indigo","violet","pink"],rf={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function dw(e){return typeof e=="string"&&e in rf}const uw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},mw=.15;function fw(e){const n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n)return null;let o=n[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,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function pw(e){if(typeof e!="string")return null;const n=fw(e);if(!n||n.s<mw)return null;let o=null,i=1/0;for(const a of eo){const r=Math.abs(n.h-uw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function _t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(dw(n))return n;const o=e==null?void 0:e.properties;return pw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Yl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const hw={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)"},yw={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 lf(e,n=!1){return e?n?yw[e]:hw[e]:null}function to(e){return rf[e]}function To(e){return`var(--em-swatch-${e}-bar)`}function gw(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function bw(e,n){const o=gw(n);return o?e(o):n.split("-")[1]??n}function _w(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function sf(e,n){const o=_w(n);if(n.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=n.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,n.params)}function kw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Ew={class:"em-inline-issue__msgs"},no=Ke(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode($e,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",Ew,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(c,d)=>(t.openBlock(),t.createElementBlock("span",{key:d},t.toDisplayString(t.unref(sf)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Nw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],ww={key:0,class:"em-mlang__dot"},Iw=["id","role","aria-labelledby"],vw=["title"],dn=Ke(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const g=o.defaultLang;return g&&o.languages.includes(g)?g:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const g=o.activeLang;return g&&o.languages.includes(g)?g:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(g){var k,_;return!!((_=(k=o.modelValue)==null?void 0:k[g])!=null&&_.trim())}const d=g=>`${o.name}-tab-${g}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function h(g){var N,I;const k=o.languages,_=k[(g+k.length)%k.length];_&&(l.value=_,await t.nextTick(),(I=(N=m.value)==null?void 0:N.querySelectorAll('[role="tab"]')[k.indexOf(_)])==null||I.focus())}function p(g){h(o.languages.indexOf(s.value)+g)}const y=t.computed(()=>o.languages.filter(g=>{var k,_;return g!==s.value&&!!((_=(k=o.modelValue)==null?void 0:k[g])!=null&&_.trim())})),b=t.computed(()=>{var g;return((g=o.modelValue)==null?void 0:g[s.value])??""});function f(g){const k={...o.modelValue};g.trim()===""?delete k[s.value]:k[s.value]=g,i("update:modelValue",k)}return(g,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,_=>(t.openBlock(),t.createElementBlock("span",{id:d(_),key:_,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===_}]),role:"tab","aria-selected":s.value===_,"aria-controls":u.value,tabindex:s.value===_?0:-1,onClick:N=>l.value=_,onKeydown:[t.withKeys(t.withModifiers(N=>l.value=_,["prevent"]),["enter"]),t.withKeys(t.withModifiers(N=>l.value=_,["prevent"]),["space"]),k[0]||(k[0]=t.withKeys(t.withModifiers(N=>p(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(N=>p(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(N=>h(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(N=>h(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(_),1),c(_)?(t.openBlock(),t.createElementBlock("span",ww,"•")):t.createCommentVNode("",!0)],42,Nw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(te.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":b.value,"onUpdate:modelValue":f},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":b.value,"onUpdate:modelValue":f},null,8,["name","placeholder","model-value"]))],8,Iw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,vw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Cw=["disabled"],xw={class:"em-panel__sub-label"},Sw={class:"em-field"},Rw={class:"em-field"},Aw={class:"em-field"},$w={class:"em-class"},Tw={class:"em-field"},Mw={class:"em-field"},Vw={class:"em-field"},Bw={class:"em-field"},Dw={class:"em-multilang"},Lw={class:"em-multilang"},Ow={class:"em-jpa"},Pw={class:"em-field"},zw={class:"em-field"},Fw={class:"em-field"},Uw={class:"em-swatch"},Hw={class:"em-swatch__row"},jw=["title"],Kw=["title","onClick"],cf=Ke(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(x=>x.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(x=>x.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var x;return _t(((x=l.value)==null?void 0:x.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"],m=x=>x;function h(x){return x==="inherit"?a.t("em.common.inherit"):x}function p(x){r.value&&a.updateEntity(r.value.modelId,x)}function y(x,M,E){var S;const w=((S=r.value)==null?void 0:S.table)??{physicalName:""};p(x==="physicalName"?{table:{...w,physicalName:E}}:{table:{...w,logicalName:{...w.logicalName,[M]:E}}})}function b(x){p({description:Object.keys(x).length?x:void 0})}function f(x,M){var E;p({jpaAttrs:{...(E=r.value)==null?void 0:E.jpaAttrs,[x]:M}})}function g(x,M){f(x,M)}const k=t.computed(()=>{var x,M;return((M=(x=r.value)==null?void 0:x.jpaAttrs)==null?void 0:M.discriminatorType)??"inherit"}),_=t.computed(()=>{var x,M;return!((M=(x=r.value)==null?void 0:x.jpaAttrs)!=null&&M.useDiscriminator)});function N(x){f("discriminatorType",x==="inherit"?void 0:x)}function I(x){p({hasPersonalInfo:x})}function $(x){p({superClass:x.trim()||void 0})}function C(x){p({schema:x.trim()||void 0})}function A(x){p({abstractClass:x})}const T=t.computed(()=>{var x,M;return((M=(x=r.value)==null?void 0:x.declarationOfInterfaces)==null?void 0:M.join(", "))??""});function V(x){const M=x.split(",").map(E=>E.trim()).filter(Boolean);p({declarationOfInterfaces:M.length?M:void 0})}function R(x){r.value&&a.setEntitySwatch(r.value.modelId,x)}return(x,M)=>{var E,w,S;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:M[0]||(M[0]=B=>i("toggle"))},[t.createElementVNode("span",xw,[t.createVNode($e,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(no,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Sw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":M[1]||(M[1]=B=>p({name:B}))},null,8,["model-value"])]),t.createElementVNode("label",Rw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(jo),"onUpdate:modelValue":M[2]||(M[2]=B=>p({stereotype:B}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Aw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":M[3]||(M[3]=B=>p({packageName:B}))},null,8,["model-value"])]),t.createElementVNode("fieldset",$w,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Tw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":M[4]||(M[4]=B=>$(B))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",Mw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":T.value,"onUpdate:modelValue":M[5]||(M[5]=B=>V(B))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":M[6]||(M[6]=B=>A(B))},null,8,["label","model-value"])]),t.createElementVNode("label",Vw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-table",width:"100%","model-value":((E=r.value.table)==null?void 0:E.physicalName)??"","onUpdate:modelValue":M[7]||(M[7]=B=>y("physicalName",null,B))},null,8,["model-value"])]),t.createElementVNode("label",Bw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":M[8]||(M[8]=B=>C(B))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",Dw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,B=>{var z,K;return t.openBlock(),t.createElementBlock("label",{key:B,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(B),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${B}`,width:"100%","model-value":((K=(z=r.value.table)==null?void 0:z.logicalName)==null?void 0:K[B])??"","onUpdate:modelValue":J=>y("logicalName",B,J)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",Lw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":b},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Ow,[M[13]||(M[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,B=>{var z;return t.createVNode(t.unref(te.BSCheckbox),{key:B.key,name:`jpa-${B.key}`,class:"em-check",label:B.label,"model-value":!!((z=r.value.jpaAttrs)!=null&&z[B.key]),"onUpdate:modelValue":K=>g(B.key,K)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Pw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(te.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:_.value,"model-value":((w=r.value.jpaAttrs)==null?void 0:w.discriminatorColumnName)??"","onUpdate:modelValue":M[9]||(M[9]=B=>f("discriminatorColumnName",B.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",zw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(te.BSSelect),{disabled:_.value,"model-value":k.value,items:u,"value-provider":m,"label-provider":h,"onUpdate:modelValue":M[10]||(M[10]=B=>B&&N(B))},null,8,["disabled","model-value"])]),t.createElementVNode("label",Fw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(te.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:_.value,"model-value":(S=r.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":M[11]||(M[11]=B=>f("discriminatorLength",B||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":I},null,8,["label","model-value"]),t.createElementVNode("fieldset",Uw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",Hw,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:M[12]||(M[12]=B=>R(null))},"∅",10,jw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),B=>(t.openBlock(),t.createElementBlock("button",{key:B,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===B}]),style:t.normalizeStyle({background:t.unref(To)(B)}),title:t.unref(a).t(t.unref(to)(B)),onClick:z=>R(B)},null,14,Kw))),128))])])],64)):t.createCommentVNode("",!0)],8,Cw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9055ced6"]]),Gw=["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"],df=["inherit","true","false"],Ga="__OWN__";function uf(e,n){const o=t.computed(()=>e.state.logical.entities.find(W=>W.modelId===n())??null),i=t.computed(()=>{var W;return((W=o.value)==null?void 0:W.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(W){return W==="none"?e.t("em.common.noneParen"):W}const l=W=>W;function s(W,ne){o.value&&e.updateAttribute(o.value.modelId,W.modelId,ne)}function c(W){return!!o.value&&!!Wi(e.state.logical,o.value.modelId,W.modelId)}function d(W,ne){s(W,{naturalId:ne||void 0,naturalIdMutable:ne?W.naturalIdMutable:void 0})}function u(){return{naturalId:void 0,naturalIdMutable:void 0}}function m(W,ne){s(W,{identifier:ne,...ne?u():{}})}function h(W,ne){s(W,{transient:ne||void 0,...ne?u():{}})}function p(W){return!!W.transient||W.attrType==="RELATION_REF"}function y(W){return Di(W)}function b(W,ne=0){var G;return((G=Li(W,o.value,e.state.logical.entities,e.state.logical.associations,ne))==null?void 0:G.physicalName)||void 0}const f=W=>W.value,g=W=>W.label;function k(W,ne){if(!ne)return;const G=R.value.find(P=>P.type===ne);if(G){const P=W.dbAttrs[0]??{modelId:W.modelId+".c",physicalName:W.name,dataType:"VARCHAR"};s(W,{type:ne,customType:void 0,dbAttrs:[{...P,dataType:G.dataType,length:G.length,scale:G.scale}]});return}s(W,ne===tn?{type:ne}:{type:ne,customType:void 0})}function _(W,ne){s(W,{customType:ne.trim()===""?void 0:ne})}function N(W,ne){if(W.attrType==="RELATION_REF")return;const P={...W.dbAttrs[0]??{modelId:W.modelId+".c",physicalName:W.name,dataType:"VARCHAR"},...ne};ne.dataType!==void 0&&!Cr.has(P.dataType)&&(P.scale=void 0),s(W,{dbAttrs:[P]})}function I(W){var ne;return Cr.has(((ne=W.dbAttrs[0])==null?void 0:ne.dataType)??"")}function $(W){return!I(W)&&!y(W)&&!p(W)?e.t("em.attr.scaleTypeHint"):void 0}function C(W,ne){N(W,{logicalName:Object.keys(ne).length?ne:void 0})}function A(W,ne){s(W,{description:Object.keys(ne).length?ne:void 0})}function T(W){return W.personalInfoAttributeType??"none"}function V(W,ne){s(W,{personalInfoAttributeType:ne==="none"?void 0:ne})}const R=t.computed(()=>e.predefinedCustomTypeCatalog.value),x=t.computed(()=>e.embeddableCatalog.value);function M(W){var ne,G,P;return((ne=W.label)==null?void 0:ne[e.userLanguage.value])??((G=W.label)==null?void 0:G.ko)??((P=W.label)==null?void 0:P.en)??W.type}const E=t.computed(()=>e.groupCodeCatalog.value);function w(W){var ne;return((ne=E.value.find(G=>G.groupCode===W.groupCode))==null?void 0:ne.codes)??[]}function S(W){return["none",...w(W)]}function B(W){return W==="none"?"none":W.code}function z(W){var G,P,ae;if(W==="none")return e.t("em.common.noneParen");const ne=((G=W.label)==null?void 0:G[e.userLanguage.value])??((P=W.label)==null?void 0:P.ko)??((ae=W.label)==null?void 0:ae.en);return ne?`${W.code} (${ne})`:W.code}function K(W,ne){o.value&&e.setAttributeGroupCode(o.value.modelId,W.modelId,ne)}function J(W,ne){s(W,{defaultValue:ne==="none"?void 0:ne})}function re(W,ne){s(W,{defaultValue:ne.trim()===""?void 0:ne})}function pe(W){return W.attrType.startsWith("EMBED")&&W.dbAttrs.length>0}function ce(W,ne,G){const P=W.dbAttrs.map((ae,Re)=>{if(Re!==ne)return ae;const le={...ae,...G};for(const j of Object.keys(G))G[j]===void 0&&delete le[j];return le});o.value&&e.setEmbedColumns(o.value.modelId,W.modelId,P)}function Ne(W,ne,G){ce(W,ne,{logicalName:Object.keys(G).length?G:void 0})}function he(W,ne){var ae,Re,le;if(W.attrType==="EMBED_PREDEF"){const j=(ae=e.embeddableCatalog.value.find(Ze=>Ze.type===W.type))==null?void 0:ae.fields[ne];return j?{name:j.name,physicalName:j.physicalName,dataType:j.dataType,length:j.length,scale:j.scale,shareable:j.shareable,logicalName:j.logicalName}:void 0}const G=(Re=W.embedded)==null?void 0:Re.embeddableRef;if(!G)return;const P=(le=e.state.logical.entities.find(j=>j.modelId===G))==null?void 0:le.attributes.flatMap(j=>j.dbAttrs)[ne];return P?{physicalName:P.physicalName,dataType:P.dataType,length:P.length,scale:P.scale,logicalName:P.logicalName}:void 0}function de(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.dataType)||((P=W.dbAttrs[ne])==null?void 0:P.dataType)||""}function _e(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.length)??((P=W.dbAttrs[ne])==null?void 0:P.length)}function Se(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.scale)??((P=W.dbAttrs[ne])==null?void 0:P.scale)}const me=df;function ye(W){return W==="inherit"?e.t("em.common.inherit"):W}function ie(W){return(W==null?void 0:W.updatable)===void 0?"inherit":W.updatable?"true":"false"}function se(W,ne,G){ce(W,ne,{updatable:G==="inherit"?void 0:G==="true"})}function fe(W,ne){N(W,{updatable:ne==="inherit"?void 0:ne==="true"})}const O=df;function L(W){return W==="inherit"?e.t("em.common.inherit"):W}function F(W){return(W==null?void 0:W.insertable)===void 0?"inherit":W.insertable?"true":"false"}function Q(W,ne,G){ce(W,ne,{insertable:G==="inherit"?void 0:G==="true"})}function Y(W,ne){N(W,{insertable:ne==="inherit"?void 0:ne==="true"})}const ke=t.computed(()=>o.value?Er(o.value,e.state.logical.entities):[]),be=t.computed(()=>co(ke.value.flatMap(W=>W.attributes.flatMap(ne=>ne.dbAttrs)))),xe=t.computed(()=>ke.value.flatMap(W=>W.attributes.filter(ne=>ne.attrType==="NORMAL"&&ne.dbAttrs.length===1&&ne.dbAttrs[0]).map(ne=>{var G;return{modelId:ne.dbAttrs[0].modelId,physical:ne.dbAttrs[0].physicalName||ne.name,isCurrency:ne.type==="Currency",ownerName:W.modelId===((G=o.value)==null?void 0:G.modelId)?void 0:W.name}})));function ve(){const W=[...xe.value].sort((ne,G)=>Number(G.isCurrency)-Number(ne.isCurrency));return[Ga,...W.map(ne=>ne.modelId)]}function U(W){if(W===Ga)return e.t("em.attr.sharedOwn");const ne=xe.value.find(P=>P.modelId===W);if(!ne)return W;const G=ne.ownerName?`${ne.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:G,physical:ne.physical,mode:ne.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function H(W){return(W==null?void 0:W.sharedColumnRef)??Ga}function q(W,ne,G){ce(W,ne,{sharedColumnRef:G===Ga?void 0:G})}function Ce(W){return(W==null?void 0:W.sharedColumnRef)!=null}function De(W){var ne;return((ne=Dn(W,be.value))==null?void 0:ne.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:Gw,piiLabel:r,idn:l,setAttr:s,isManagedFk:c,setNaturalId:d,clearNaturalIdPatch:u,setIdentifier:m,setTransient:h,dbLocked:p,fkDerived:y,fkOriginPhysical:b,typeValueOf:f,typeLabelOf:g,setAttrType:k,setAttrCustomType:_,setDb:N,scaleApplicable:I,scaleHint:$,setDbLogical:C,setAttrDescription:A,attrPiiValue:T,setAttrPii:V,predefinedCustomTypeCatalog:R,embeddableCatalog:x,predefinedLabel:M,groupCodeCatalog:E,attrGroupCodes:w,attrCodeItems:S,codeValueOf:B,codeLabelOf:z,setAttrGroupCode:K,setAttrCode:J,setAttrDefaultValue:re,isEmbedExpanded:pe,setDbAt:ce,setDbLogicalAt:Ne,embedColMeta:he,fixedDataType:de,fixedLength:_e,fixedScale:Se,updatableItems:me,updatableLabel:ye,updatableValue:ie,setUpdatableAt:se,setUpdatable:fe,insertableItems:O,insertableLabel:L,insertableValue:F,setInsertableAt:Q,setInsertable:Y,scopeEntities:ke,columnsById:be,sharedCandidates:xe,sharedItems:ve,sharedLabel:U,sharedValue:H,setSharedAt:q,isShared:Ce,sharedPhysical:De}}const mf={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every embedded column in this entity","em.node.embedAllShow":"Expand all collapsed embedded columns","em.node.embedAllSummary":"{n} embedded column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},ff={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティの埋め込み列をすべて折りたたむ","em.node.embedAllShow":"折りたたまれた埋め込み列をすべて展開","em.node.embedAllSummary":"埋め込み列 {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},pf={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 임베드 컬럼 모두 접기","em.node.embedAllShow":"접힌 임베드 컬럼 모두 펼치기","em.node.embedAllSummary":"임베드 컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},Yw=["ko","en","ja"],ql={ko:pf,en:mf,ja:ff};function Lt(e,n,o){let a=(ql[e]??ql.ko)[n]??ql.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const hf=["ko","en","ja","zh"];function qw(e){if(e)for(const n of hf){const o=e[n];if(o)return o}}function Wl(e){const n=qw(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function Ww(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:hf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const Jw=["aria-expanded","placeholder"],Xw=["aria-selected","onClick","onMouseenter"],Zw={key:0,class:"gcc__opt gcc__opt--empty"},yf=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(T,V)=>Lt(o.locale??"ko",T,V),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),h=t.computed(()=>o.items.find(T=>T.groupCode===o.modelValue)),p=t.computed(()=>h.value?Wl(h.value):"");t.watch(p,T=>{d.value||(c.value=T)},{immediate:!0});const y=t.computed(()=>c.value===p.value?o.items:Ww(o.items,c.value));function b(){var V;const T=(V=r.value)==null?void 0:V.getBoundingClientRect();T&&(m.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function f(){d.value=!0,b(),u.value=Math.max(0,y.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),document.addEventListener("mousedown",A)}function g(){d.value=!1,window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b),document.removeEventListener("mousedown",A)}t.onBeforeUnmount(g);function k(){f(),t.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function _(){d.value||f(),u.value=0}function N(T){i("update:modelValue",T.groupCode),c.value=Wl(T),g()}function I(){i("update:modelValue",void 0),c.value="",g()}function $(){c.value.trim()===""?I():(c.value=p.value,g())}function C(T){var V;if(T.key==="ArrowDown")d.value||f(),u.value=Math.min(u.value+1,y.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")u.value=Math.max(u.value-1,0),T.preventDefault();else if(T.key==="Enter"){const R=y.value[u.value];R&&N(R),T.preventDefault()}else T.key==="Escape"&&(c.value=p.value,g(),(V=l.value)==null||V.blur())}function A(T){var R,x;const V=T.target;!((R=r.value)!=null&&R.contains(V))&&!((x=s.value)!=null&&x.contains(V))&&$()}return(T,V)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":V[0]||(V[0]=R=>c.value=R),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:k,onInput:_,onKeydown:C},null,40,Jw),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:V[1]||(V[1]=t.withModifiers(()=>{},["prevent"])),onClick:I},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(R,x)=>(t.openBlock(),t.createElementBlock("li",{key:R.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":x===u.value,"is-selected":R.groupCode===e.modelValue}]),role:"option","aria-selected":R.groupCode===e.modelValue,onMousedown:V[2]||(V[2]=t.withModifiers(()=>{},["prevent"])),onClick:M=>N(R),onMouseenter:M=>u.value=x},t.toDisplayString(t.unref(Wl)(R)),43,Xw))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Zw,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),Qw=["aria-labelledby"],eI=["aria-checked","tabindex","onClick","onKeydown"],gf=Ke(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,eI))),128))],8,Qw))}}),[["__scopeId","data-v-5c793bbb"]]),tI=["disabled"],nI={class:"em-aw__toolbar"},oI={class:"em-aw__count"},iI={class:"em-aw__scroll"},aI={class:"em-aw__table"},rI={class:"c-name"},lI={class:"c-type"},sI={class:"c-logical"},cI=["id"],dI={class:"c-col"},uI={class:"c-constraints"},mI={class:"c-del"},fI={class:"c-expand"},pI=["title","onClick","onKeydown"],hI=["title"],yI={key:1,class:"em-aw__muted"},gI=["title"],bI=["title"],_I=["title"],kI={class:"em-aw__cflags"},EI=["title"],NI={colspan:"8"},wI={class:"em-aw__detail"},II={class:"em-aw__dgroup"},vI=["title"],CI={class:"em-aw__df"},xI={class:"em-aw__df"},SI={class:"em-aw__dgroup"},RI={key:0,class:"em-aw__dgroup"},AI={class:"em-aw__df"},$I={key:0,class:"em-aw__df"},TI={class:"em-aw__df"},MI={class:"em-aw__dgroup em-aw__ddesc"},VI={class:"c-expand"},BI={class:"em-aw__caret is-static","aria-hidden":"true"},DI={class:"c-del"},LI={class:"c-expand"},OI=["title","onClick","onKeydown"],PI={class:"em-aw__embed-label"},zI=["title"],FI=["title"],UI={class:"em-aw__ro"},HI=["title"],jI={class:"em-aw__ro"},KI=["title"],GI={class:"em-aw__ro"},YI={key:0,class:"em-aw__detail-row em-aw__embed-detail"},qI={colspan:"8"},WI={class:"em-aw__detail"},JI={class:"em-aw__dgroup"},XI={key:0,class:"em-aw__df"},ZI={class:"em-aw__df"},QI={class:"em-aw__df"},ev={key:0},tv={colspan:"99",class:"em-aw__empty"},nv=6,ov=5,iv=Ke(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:h,setTransient:p,dbLocked:y,fkDerived:b,fkOriginPhysical:f,typeValueOf:g,typeLabelOf:k,setAttrType:_,setAttrCustomType:N,setDb:I,scaleApplicable:$,scaleHint:C,setDbLogical:A,attrPiiValue:T,setAttrPii:V,predefinedCustomTypeCatalog:R,embeddableCatalog:x,predefinedLabel:M,groupCodeCatalog:E,attrGroupCodes:w,attrCodeItems:S,codeValueOf:B,codeLabelOf:z,setAttrGroupCode:K,setAttrCode:J,setAttrDefaultValue:re,setAttrDescription:pe,isEmbedExpanded:ce,setDbAt:Ne,setDbLogicalAt:he,embedColMeta:de,fixedDataType:_e,fixedLength:Se,fixedScale:me,updatableItems:ye,updatableLabel:ie,updatableValue:se,setUpdatableAt:fe,setUpdatable:O,insertableItems:L,insertableLabel:F,insertableValue:Q,setInsertableAt:Y,setInsertable:ke,sharedItems:be,sharedLabel:xe,sharedValue:ve,setSharedAt:U,isShared:H,sharedPhysical:q}=uf(o,()=>n.entityId),Ce=t.computed(()=>{var Re;return[...((Re=i.value)==null?void 0:Re.attributes)??[]].sort((le,j)=>le.order-j.order)}),De=t.computed(()=>{var Re;return(((Re=i.value)==null?void 0:Re.attributes)??[]).filter(le=>le.attrType!=="DIVIDER").length}),W=t.ref(new Set);function ne(Re){return W.value.has(Re)}function G(Re){const le=new Set(W.value);le.has(Re)?le.delete(Re):le.add(Re),W.value=le}const P=t.ref(o.userLanguage.value);function ae(Re){!Re||!i.value||o.addPredefinedEmbed(i.value.modelId,Re)}return(Re,le)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",nI,[t.createElementVNode("span",oI,t.toDisplayString(t.unref(o).t("em.attr.section",{n:De.value})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:le[0]||(le[0]=j=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:le[1]||(le[1]=j=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(x).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(x),"value-provider":j=>j.type,"label-provider":t.unref(M),"onUpdate:modelValue":ae},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",iI,[t.createElementVNode("table",aI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[le[3]||(le[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",rI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",lI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",sI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,cI),t.createVNode(gf,{modelValue:P.value,"onUpdate:modelValue":le[2]||(le[2]=j=>P.value=j),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",dI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),le[4]||(le[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),le[5]||(le[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",uI,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),le[6]||(le[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ce.value,j=>{var Ze,rt,He,Pe,Oe,X,Nt,Et,yn,gn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:j.modelId},[j.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(j.modelId)}])},[le[7]||(le[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-divlabel-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:nv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",mI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])])],2)):t.unref(ce)(j)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(j.modelId)}])},[t.createElementVNode("td",VI,[t.createElementVNode("span",BI,[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${j.modelId}`,width:"100%",disabled:"","model-value":j.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:ov,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:j.dbAttrs.length})),1),t.createElementVNode("td",DI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(j.dbAttrs,(Ee,nt)=>{var mt,Ft,Qt,en,we,et,ft,bn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":ne(Ee.modelId)}])},[t.createElementVNode("td",LI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ne(Ee.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ne(Ee.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:ot=>G(Ee.modelId),onKeydown:[t.withKeys(t.withModifiers(ot=>G(Ee.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ot=>G(Ee.modelId),["prevent"]),["space"])]},[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,OI)]),t.createElementVNode("td",PI,"↳ "+t.toDisplayString(((mt=t.unref(de)(j,nt))==null?void 0:mt.name)??((Ft=t.unref(de)(j,nt))==null?void 0:Ft.physicalName)??t.unref(o).t("em.attr.colFallback",{n:nt+1})),1),le[14]||(le[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(dn,{name:`aw-embed-logical-${Ee.modelId}`,languages:t.unref(o).languages.value,"active-lang":P.value,placeholder:((en=(Qt=t.unref(de)(j,nt))==null?void 0:Qt.logicalName)==null?void 0:en[P.value])??((et=(we=t.unref(de)(j,nt))==null?void 0:we.logicalName)==null?void 0:et.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ee.logicalName,"onUpdate:modelValue":ot=>t.unref(he)(j,nt,ot)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(H)(Ee)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-embed-col-${Ee.modelId}`,width:"100%",disabled:t.unref(H)(Ee),placeholder:((ft=t.unref(de)(j,nt))==null?void 0:ft.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(H)(Ee)?t.unref(q)(Ee):Ee.physicalName,"onUpdate:modelValue":ot=>t.unref(Ne)(j,nt,{physicalName:ot})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(no,{controller:t.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"])],8,zI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",UI,t.toDisplayString(t.unref(_e)(j,nt)),1)],8,FI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",jI,t.toDisplayString(t.unref(Se)(j,nt)??""),1)],8,HI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",GI,t.toDisplayString(t.unref(me)(j,nt)!=null?`scale ${t.unref(me)(j,nt)}`:""),1)],8,KI),le[15]||(le[15]=t.createElementVNode("td",null,null,-1))],2),ne(Ee.modelId)?(t.openBlock(),t.createElementBlock("tr",YI,[le[18]||(le[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",qI,[t.createElementVNode("div",WI,[t.createElementVNode("fieldset",JI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(bn=t.unref(de)(j,nt))!=null&&bn.shareable?(t.openBlock(),t.createElementBlock("label",XI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(ve)(Ee),items:t.unref(be)(),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":ot=>ot&&t.unref(U)(j,nt,ot)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",ZI,[le[16]||(le[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(H)(Ee),"model-value":t.unref(H)(Ee)?"false":t.unref(Q)(Ee),items:t.unref(L),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":ot=>ot&&t.unref(Y)(j,nt,ot)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",QI,[le[17]||(le[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(H)(Ee),"model-value":t.unref(H)(Ee)?"false":t.unref(se)(Ee),items:t.unref(ye),"value-provider":t.unref(c),"label-provider":t.unref(ie),"onUpdate:modelValue":ot=>ot&&t.unref(fe)(j,nt,ot)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(r).has(j.modelId),"em-aw__open":ne(j.modelId)})},[t.createElementVNode("td",fI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ne(j.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ne(j.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:Ee=>G(j.modelId),onKeydown:[t.withKeys(t.withModifiers(Ee=>G(j.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Ee=>G(j.modelId),["prevent"]),["space"])]},[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,pI)]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!j.groupCode||j.attrType==="RELATION_REF"||t.unref(b)(j),items:t.unref(qs)(j.type,t.unref(R)),"value-provider":t.unref(g),"label-provider":t.unref(k),"model-value":j.type,"onUpdate:modelValue":Ee=>t.unref(_)(j,Ee)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),j.type===t.unref(tn)&&!t.unref(b)(j)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":j.customType??"","onUpdate:modelValue":Ee=>t.unref(N)(j,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,hI),t.createElementVNode("td",null,[j.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(dn,{key:0,name:`aw-logical-${j.modelId}`,languages:t.unref(o).languages.value,"active-lang":P.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Ze=j.dbAttrs[0])==null?void 0:Ze.logicalName,"onUpdate:modelValue":Ee=>t.unref(A)(j,Ee)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",yI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${j.modelId}`,width:"100%",placeholder:t.unref(f)(j)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(y)(j),"model-value":((rt=j.dbAttrs[0])==null?void 0:rt.physicalName)??"","onUpdate:modelValue":Ee=>t.unref(I)(j,{physicalName:Ee})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(no,{controller:t.unref(o),"ref-id":(He=j.dbAttrs[0])==null?void 0:He.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${j.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(y)(j)||t.unref(b)(j),items:t.unref(Ks)(((Pe=j.dbAttrs[0])==null?void 0:Pe.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(vr),"model-value":((Oe=j.dbAttrs[0])==null?void 0:Oe.dataType)??"","onUpdate:modelValue":Ee=>Ee&&t.unref(I)(j,{dataType:Ee})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,gI),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${j.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(y)(j)||t.unref(b)(j),"model-value":(X=j.dbAttrs[0])==null?void 0:X.length,"onUpdate:modelValue":Ee=>t.unref(I)(j,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,bI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",kI,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${j.modelId}`,label:"PK","model-value":j.identifier,disabled:t.unref(a)||t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(h)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${j.modelId}`,label:"NN","model-value":j.notNull,disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(d)(j,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${j.modelId}`,label:"UQ","model-value":!!((Nt=j.dbAttrs[0])!=null&&Nt.unique),disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(I)(j,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,_I),t.createElementVNode("td",{class:"c-del",title:t.unref(u)(j)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])],8,EI)],2),ne(j.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(j.modelId)}])},[le[13]||(le[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",NI,[t.createElementVNode("div",wI,[t.createElementVNode("fieldset",II,[le[11]||(le[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(C)(j)},[le[8]||(le[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${j.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(y)(j)||t.unref(b)(j)||!t.unref($)(j),"model-value":(Et=j.dbAttrs[0])==null?void 0:Et.scale,"onUpdate:modelValue":Ee=>t.unref(I)(j,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,vI),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${j.modelId}`,label:"Auto Increment","model-value":!!((yn=j.dbAttrs[0])!=null&&yn.autoIncrement),disabled:t.unref(y)(j)||t.unref(b)(j)||!j.identifier,"onUpdate:modelValue":Ee=>t.unref(I)(j,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",CI,[le[9]||(le[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${j.modelId}`,width:"110px",disabled:t.unref(y)(j),"model-value":t.unref(Q)(j.dbAttrs[0]),items:t.unref(L),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ee=>Ee&&t.unref(ke)(j,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",xI,[le[10]||(le[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${j.modelId}`,width:"110px",disabled:t.unref(y)(j),"model-value":t.unref(se)(j.dbAttrs[0]),items:t.unref(ye),"value-provider":t.unref(c),"label-provider":t.unref(ie),"onUpdate:modelValue":Ee=>Ee&&t.unref(O)(j,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",SI,[le[12]||(le[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${j.modelId}`,label:"@Transient","model-value":!!j.transient,disabled:j.identifier||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(p)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${j.modelId}`,label:"@NaturalId","model-value":!!j.naturalId,disabled:j.identifier||t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(m)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${j.modelId}`,label:"mutable","model-value":!!j.naturalIdMutable,disabled:t.unref(y)(j)||!j.naturalId,"onUpdate:modelValue":Ee=>t.unref(d)(j,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${j.modelId}`,label:"Multi-Value (Set)","model-value":!!((gn=j.dbAttrs[0])!=null&&gn.multiValue),disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(I)(j,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(b)(j)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",RI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",AI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(T)(j),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ee=>Ee&&t.unref(V)(j,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(E).length?(t.openBlock(),t.createElementBlock("label",$I,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(yf,{"model-value":j.groupCode,items:t.unref(E),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ee=>t.unref(K)(j,Ee)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",TI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(w)(j).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":j.defaultValue??"none",items:t.unref(S)(j),"value-provider":t.unref(B),"label-provider":t.unref(z),"onUpdate:modelValue":Ee=>Ee&&t.unref(J)(j,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`aw-default-${j.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":j.defaultValue??"","onUpdate:modelValue":Ee=>t.unref(re)(j,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",MI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`aw-desc-${j.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":j.description,"onUpdate:modelValue":Ee=>t.unref(pe)(j,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",ev,[t.createElementVNode("td",tv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,tI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-559a29b3"]]);function Jl(e,n){return n&&n!==e?`${e} (${n})`:e}function bf(e,n,o){const i=e.dbAttrs[n];return i?Ko(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function _f(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):Jl(o,bf(e,0,n))}function kf(e,n){var l;if(Vn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?Jl(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return Jl(i,bf(o,r<0?0:r,n))}const av=["disabled"],rv={class:"em-idxw__list"},lv={class:"em-idxw__list-head"},sv=["aria-label"],cv=["aria-current","onClick","onKeydown"],dv={class:"em-idxw__item-name"},uv={key:0,class:"em-idxw__badge"},mv={class:"em-idxw__item-cnt"},fv={key:0,class:"em-idxw__empty"},pv={key:0,class:"em-idxw__edit"},hv={class:"em-idxw__form"},yv={class:"em-field em-idxw__name"},gv={class:"em-field"},bv=["value","placeholder"],_v={class:"em-idxw__transfer"},kv={class:"em-idxw__pane"},Ev={class:"em-idxw__pane-head"},Nv=["aria-label"],wv=["aria-pressed","onClick","onKeydown"],Iv=["title"],vv={key:0,class:"em-idxw__empty"},Cv={class:"em-idxw__arrows"},xv={class:"em-idxw__pane"},Sv={class:"em-idxw__pane-head"},Rv={class:"em-idxw__col-name"},Av=["title"],$v={class:"em-idxw__col-ops"},Tv=["title","disabled","onClick"],Mv=["title","disabled","onClick"],Vv=["title","onClick"],Bv={key:0,class:"em-idxw__empty"},Dv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Lv=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(E=>E.modelId===n.entityId)??null),a=t.computed(()=>{var E;return((E=i.value)==null?void 0:E.indexes)??[]}),r=t.computed(()=>{var E;return((E=i.value)==null?void 0:E.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,E=>{var w;E.some(S=>S.modelId===s.value)||(s.value=((w=E[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(E=>E.modelId===s.value)??null),d=t.computed(()=>i.value?Ho(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Mn(r.value)),m=E=>u.value.canon(E),h=t.computed(()=>{var E;return new Set((((E=c.value)==null?void 0:E.columns)??[]).map(w=>m(w.columnRef)))}),p=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function y(E){return _f(E,p.value)}function b(E){return E.physicalName&&E.physicalName!==E.field?`${E.field} (${E.physicalName})`:E.field}function f(E){return kf(E,p.value)}const g=t.computed(()=>[...r.value.filter(E=>E.dbAttrs.length>0&&!h.value.has(m(E.modelId))).map(E=>({ref:E.modelId,label:y(E),inherited:!1})),...d.value.filter(E=>!h.value.has(m(E.modelId))).map(E=>({ref:E.modelId,label:b(E),inherited:!0}))]),k=t.ref(new Set);t.watch(s,()=>k.value=new Set);function _(E){return Vn(E)}function N(E,w){i.value&&o.updateIndex(i.value.modelId,E,w)}function I(){var w;if(!i.value)return;const E=Be();o.addIndex(i.value.modelId,{modelId:E,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=E}function $(E){i.value&&o.removeIndex(i.value.modelId,E)}function C(E){c.value&&N(c.value.modelId,{parameters:E.trim()===""?void 0:E})}function A(E){const w=new Set(k.value);w.has(E)?w.delete(E):w.add(E),k.value=w}function T(){const E=c.value;if(!E||!k.value.size)return;const w=[...k.value].map(S=>({columnRef:S,descending:!1}));N(E.modelId,{columns:[...E.columns,...w]}),k.value=new Set}function V(E){const w=c.value;w&&N(w.modelId,{columns:w.columns.filter((S,B)=>B!==E)})}function R(E,w){const S=c.value;S&&N(S.modelId,{columns:S.columns.map((B,z)=>z===E?{...B,descending:w}:B)})}function x(E,w){const S=c.value;if(!S)return;const B=E+w;if(B<0||B>=S.columns.length)return;const z=[...S.columns];[z[E],z[B]]=[z[B],z[E]],N(S.modelId,{columns:z}),M(B,w)}async function M(E,w){var J,re;await t.nextTick();const S=(J=l.value)==null?void 0:J.querySelectorAll(".em-idxw__col--idx")[E];if(!S)return;const B=pe=>S.querySelector(`[data-move="${pe}"]`),z=B(w<0?"up":"down"),K=B(w<0?"down":"up");(re=z&&!z.disabled?z:K)==null||re.focus()}return(E,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",rv,[t.createElementVNode("div",lv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:I},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,S=>(t.openBlock(),t.createElementBlock("li",{key:S.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":S.modelId===s.value}]),role:"button",tabindex:"0","aria-current":S.modelId===s.value?"true":void 0,onClick:B=>s.value=S.modelId,onKeydown:[t.withKeys(t.withModifiers(B=>s.value=S.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(B=>s.value=S.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",dv,t.toDisplayString(S.name||t.unref(o).t("em.attr.nameless")),1),S.unique?(t.openBlock(),t.createElementBlock("span",uv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",mv,t.toDisplayString(S.columns.length),1)],42,cv))),128))],8,sv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",fv,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",pv,[t.createElementVNode("div",hv,[t.createElementVNode("label",yv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=S=>N(c.value.modelId,{name:S}))},null,8,["model-value"]),t.createVNode(no,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=S=>N(c.value.modelId,{unique:S}))},null,8,["model-value"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=S=>$(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",gv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=S=>C(S.target.value))},null,40,bv)]),t.createElementVNode("div",_v,[t.createElementVNode("div",kv,[t.createElementVNode("div",Ev,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:g.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:g.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,S=>(t.openBlock(),t.createElementBlock("li",{key:S.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":k.value.has(S.ref)}]),role:"button",tabindex:"0","aria-pressed":k.value.has(S.ref),onClick:B=>A(S.ref),onKeydown:[t.withKeys(t.withModifiers(B=>A(S.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(B=>A(S.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(S.label),1),S.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Iv)):t.createCommentVNode("",!0)],42,wv))),128))],8,Nv),g.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",vv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",Cv,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!k.value.size,onClick:T},null,8,["caption","disabled"])]),t.createElementVNode("div",xv,[t.createElementVNode("div",Sv,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(S,B)=>(t.openBlock(),t.createElementBlock("li",{key:B,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",Rv,[t.createTextVNode(t.toDisplayString(f(S.columnRef)),1),_(S.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Av)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${B}`,class:"em-check",label:"DESC","model-value":S.descending,"onUpdate:modelValue":z=>R(B,z)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",$v,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:B===0,onClick:z=>x(B,-1)},"↑",8,Tv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:B===c.value.columns.length-1,onClick:z=>x(B,1)},"↓",8,Mv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:z=>V(B)},"✕",8,Vv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Bv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",Dv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,av)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),Ov={class:"em-op-src"},Pv=["placeholder"],zv={class:"em-op-src__actions"},Ef=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(l,s)=>Lt(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",Ov,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,Pv),[[t.vModelText,a.value]]),t.createElementVNode("div",zv,[t.createVNode(t.unref(te.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),Fv=["disabled"],Uv={class:"em-ow__toolbar"},Hv={class:"em-ow__count"},jv={class:"em-ow__scroll"},Kv={class:"em-ow__table"},Gv={class:"c-name"},Yv={class:"c-desc"},qv=["id"],Wv={class:"c-pii"},Jv={class:"c-src"},Xv={class:"c-del"},Zv={key:0},Qv={colspan:"6",class:"em-ow__empty"},eC=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModal(),a=t.computed(()=>o.state.logical.entities.find(f=>f.modelId===n.entityId)??null),r=t.computed(()=>{var f;return[...((f=a.value)==null?void 0:f.operations)??[]].sort((g,k)=>g.order-k.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],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(f){return f==="none"?o.t("em.common.noneParen"):f}const u=f=>f;function m(f,g){a.value&&o.updateOperation(a.value.modelId,f.modelId,g)}function h(f,g){m(f,{description:Object.keys(g).length?g:void 0})}function p(f){return f.personalInfoAttributeType??"none"}function y(f,g){m(f,{personalInfoAttributeType:g==="none"?void 0:g})}function b(f){i.openModal({component:Ef,bind:{operationName:f.name,sourceCode:f.sourceCode??"",locale:o.uiLocale.value,onSave:g=>m(f,{sourceCode:g})}})}return(f,g)=>{var k,_;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",Uv,[t.createElementVNode("span",Hv,t.toDisplayString(t.unref(o).t("em.op.section",{n:((k=a.value.operations)==null?void 0:k.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:g[0]||(g[0]=N=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",jv,[t.createElementVNode("table",Kv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",Gv,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),g[2]||(g[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",Yv,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,qv),t.createVNode(gf,{modelValue:l.value,"onUpdate:modelValue":g[1]||(g[1]=N=>l.value=N),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",Wv,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",Jv,t.toDisplayString(t.unref(o).t("em.op.body")),1),g[3]||(g[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,N=>(t.openBlock(),t.createElementBlock("tr",{key:N.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":I=>m(N,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&m(N,{visibility:I})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(dn,{name:`ow-desc-${N.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":N.description,"onUpdate:modelValue":I=>h(N,I)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":p(N),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":I=>I&&y(N,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t(N.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:I=>b(N)},null,8,["caption","onClick"])]),t.createElementVNode("td",Xv,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])]))),128)),(_=a.value.operations)!=null&&_.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",Zv,[t.createElementVNode("td",Qv,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,Fv)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),tC={class:"em-detail__tabs"},nC=["onClick"],oC={key:0,class:"em-detail__lock"},iC=["disabled"],aC={key:0,class:"em-detail__narrow"},rC=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",tC,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:h=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,nC)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",oC,[t.createVNode($e,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",aC,[t.createVNode(cf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(iv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(Lv,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(eC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,iC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Ya(e,n,o){e.openModal({component:rC,bind:{controller:t.markRaw(n),entityId:o}})}function un(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>nd(e,r))}function Ot(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of Vd(l,r))i.push(ca(a,s.indexRef,{columns:s.columns}))}return i}function qa(e,n,o,i){var c;const a=[];a.push(...un(n,o.remove,i));for(const d of o.update)a.push(on(n,d.attributeId,d.patch));for(const d of o.add)a.push(jt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const h=l.filter(p=>{var y;return((y=p.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&p.dbAttrs.length>0}).sort((p,y)=>p.order-y.order)[0];h&&a.push(Mt(d.modelId,"end2",{attributeRef:h.modelId}))}return a}function Mo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Ei(e,n,o){const i=[];for(const[a,r]of fc(e,n,Be))i.push(...qa(e,a,r,o));for(const a of Fg(e,n,Be))i.push(on(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function lC(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Hr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return Dd(e,n,r).map(l=>on(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function sC(e,n,o){const i=new Set(o.remove);return Mo(e,n,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function Wa(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of pc(e,r,Be)){const c=i.get(l);i.set(l,c?mc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...qa(e,r,cC(l),o));return a}function cC(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function Nf(e){return e.attributes.flatMap(n=>n.dbAttrs).map(n=>({...n,modelId:Be()}))}function dC(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=At(o.attributes),h=new Set(o.attributes.map(y=>y.name));let p="id";for(let y=2;h.has(p);y++)p=`id${y}`;a={modelId:Be(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Be(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(jt(n,a))}const r=[];for(const m of e.entities)for(const h of m.attributes){if(((u=h.embedded)==null?void 0:u.embeddableRef)!==n)continue;const p=e.associations.find(g=>g.modelId===h.embedded.associationRef);if(!p)continue;const y=p.end1.entityRef===m.modelId,b=y?p.end1:p.end2,f=y?p.end2:p.end1;r.push({ownerId:m.modelId,dispId:h.modelId,assocId:p.modelId,end1:{entityRef:m.modelId,multiplicity:b.multiplicity,navigable:b.navigable,composition:!1},end2:{entityRef:n,multiplicity:f.multiplicity,navigable:f.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const h=new Set(r.filter(p=>p.ownerId===m.modelId).map(p=>p.dispId));return h.size?{...m,attributes:m.attributes.filter(p=>!h.has(p.modelId))}:m}),associations:e.associations.map(m=>{const h=r.find(p=>p.assocId===m.modelId);return h?{...m,end1:h.end1,end2:h.end2}:m})},s=qo(l,n,Be);for(const m of r){const h=s.add.find(p=>{var y;return((y=p.derivedFrom)==null?void 0:y.associationRef)===m.assocId});h&&(m.end2.attributeRef=h.modelId)}const c=[];for(const m of r)i.push(...un(m.ownerId,[m.dispId],c)),i.push(sa(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...qa(l,n,s,c));const d=sC(l,n,s);return i.push(...Ei(d,n,c)),i.push(...Ot(e,c)),i}function uC(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(_=>_.modelId===c);if(!d||d.attributes.some(_=>{var N;return((N=_.embedded)==null?void 0:N.associationRef)===r.modelId}))continue;const u=Be(),m=At(d.attributes),h=new Set(d.attributes.map(_=>_.name)),p=a(o.name);let y=p;for(let _=2;h.has(y);_++)y=`${p}${_}`;const b=o.attributes.filter(_=>!_.identifier&&!_.derivedFrom).flatMap(_=>_.dbAttrs).map(_=>({..._,modelId:Be()})),f={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:b,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(jt(c,f));const g=l?"end2":"end1",k=l?"end1":"end2";i.push(sa(r.modelId,{identifying:!1,[g]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Be()},[k]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function wf(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[Zc(n,o),...i.map(u=>ko(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const h=e.layout.associationLayouts.find(p=>p.associationRef===m.modelId);h&&h.waypoints.length&&c.push(pd(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const h=e.layout.notes.find(p=>p.modelId===m);h&&c.push(ei(m,{x:h.geo.location.x+l,y:h.geo.location.y+s}))}}return c}function mC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Be(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},h={...n.logical,associations:[...n.logical.associations,m]},p=qo(h,s,Be),y=p.add[0];y&&(m.end2.attributeRef=y.modelId);const b={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},f=la(m,b),g=qa(h,s,p,[]);return i(g.length?Je("관계 추가",[f,...g]):f),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find($=>$.modelId===l),d=n.logical.entities.find($=>$.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Be(),m=Be(),h=Be(),p=At(c.attributes),y=Nf(d),b=$=>$&&$.charAt(0).toLowerCase()+$.slice(1),f=new Set(c.attributes.map($=>$.name)),g=b(d.name);let k=g;for(let $=2;f.has(k);$++)k=`${g}${$}`;const _={modelId:m,name:k,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:p,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},N={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:h},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},I={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(Je("임베드 추가",[jt(l,_),la(N,I)])),u},setEmbedCardinality(l,s){var g;if(r(l))return;const c=n.logical.associations.find(k=>k.modelId===l);if(!c)return;let d,u;for(const k of n.logical.entities){const _=k.attributes.find(N=>{var I;return((I=N.embedded)==null?void 0:I.associationRef)===l&&N.attrType==="EMBED_OWN"});if(_){d=k.modelId,u=_;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,h=c.end2.entityRef===m?"end2":"end1",p=c[h];if(p.multiplicity===s)return;const y=k=>k==="ZERO_OR_MORE_INSTANCES"||k==="ONE_OR_MORE_INSTANCES",b=y(p.multiplicity),f=y(s);if(b===f){i(Mt(l,h,{multiplicity:s}));return}if(f)i(Je("임베드 컬렉션 전환",[on(d,u.modelId,{dbAttrs:[]}),Mt(l,h,{multiplicity:s,jpa:{...p.jpa,collectionType:((g=p.jpa)==null?void 0:g.collectionType)??"LIST"}})]));else{const k=n.logical.entities.find(_=>_.modelId===m);if(!k)return;i(Je("임베드 단일 전환",[on(d,u.modelId,{dbAttrs:Nf(k)}),Mt(l,h,{multiplicity:s,jpa:{...p.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(p=>p.modelId===l),c=cd(l);if(!s){i(c);return}for(const p of n.logical.entities){const y=p.attributes.find(b=>{var f;return((f=b.embedded)==null?void 0:f.associationRef)===l});if(y){const b=[];i(Je("임베드 삭제",[c,...un(p.modelId,[y.modelId],b),...Ot(n.logical,b)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(p=>p.modelId!==l)},m=[],h=Wa(u,[d],m);if(s.end1.attributeRef){const p=n.logical.entities.find(b=>b.modelId===s.end1.entityRef),y=p==null?void 0:p.attributes.find(b=>b.modelId===s.end1.attributeRef&&b.attrType==="RELATION_REF");y&&h.push(...un(p.modelId,[y.modelId],m))}h.push(...Ot(n.logical,m)),i(h.length?Je("관계 삭제",[c,...h]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=sa(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(y=>y.modelId===l?{...y,identifying:s}:y)},h=[],p=Wa(m,[u],h);p.push(...Ot(n.logical,h)),i(p.length?Je("식별 관계 변경",[d,...p]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(p=>p.modelId===d.end1.entityRef),m=n.logical.entities.find(p=>p.modelId===d.end2.entityRef),h=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!h){if(c.navigable===!0&&!d.end1.attributeRef){const p=Fi(d.end2.multiplicity),y=d.end1.navFieldNameHint||Hi(m.name,p),b=uo(y,new Set(u.attributes.map(_=>_.name))),f=Be(),g=At(u.attributes),k={modelId:f,name:b,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:g,dbAttrs:[]};i(Je("inverse nav 추가",[jt(d.end1.entityRef,k),Mt(l,"end1",{...c,attributeRef:f,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const p=d.end1.attributeRef,y=u.attributes.find(k=>k.modelId===p&&k.attrType==="RELATION_REF"),b=Mt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),f=[],g=y?un(d.end1.entityRef,[p],f):[];i(y?Je("inverse nav 제거",[...g,b,...Ot(n.logical,f)]):b);return}}}i(Mt(l,s,c))}}}function fC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,h)=>{if(a(u))return;const p=on(u,m,h),y=Mo(n.logical,u,g=>g.map(k=>k.modelId===m?{...k,...h}:k)),b=[],f=Ei(y,u,b);f.push(...Ot(n.logical,b)),i(f.length?Je("속성 수정",[p,...f]):p)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const h=r.value.find(k=>k.type===m),p=n.logical.entities.find(k=>k.modelId===u);if(!h||!p)return null;const y=At(p.attributes),b=Be(),f=h.fields.map(()=>({modelId:Be(),physicalName:"",dataType:""})),g={modelId:b,name:h.defaultName,type:h.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:f};return i(jt(u,g)),b},addAttribute(u,m={}){if(!o.value||a(u))return null;const h=n.logical.entities.find(I=>I.modelId===u),p=h?At(h.attributes):0,y=m.modelId??Be(),b=m.name??`field${p}`,f={modelId:y,name:b,type:m.type??xr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:p,dbAttrs:m.dbAttrs??[{modelId:Be(),physicalName:b,dataType:"VARCHAR"}],...m},g=jt(u,f),k=Mo(n.logical,u,I=>[...I,f]),_=[],N=Ei(k,u,_);return N.push(...Ot(n.logical,_)),i(N.length?Je("속성 추가",[g,...N]):g),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(b=>b.modelId===u),h=m?At(m.attributes):0,p=Be();return i(jt(u,{modelId:p,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:h,dbAttrs:[]})),p},updateAttribute(u,m,h){d(u,m,h)},setAttributeGroupCode(u,m,h){d(u,m,{groupCode:h,type:h?Ln:xr})},setEmbedColumns(u,m,h){var k,_;if(a(u))return;const p=on(u,m,{dbAttrs:h}),y=(k=n.logical.entities.find(N=>N.modelId===u))==null?void 0:k.attributes.find(N=>N.modelId===m),b=(_=y==null?void 0:y.embedded)==null?void 0:_.associationRef,f=b?n.logical.associations.find(N=>N.modelId===b):void 0,g=[];f&&b&&(f.end1.legacyEmbedRaw&&g.push(Mt(b,"end1",{legacyEmbedRaw:void 0})),f.end2.legacyEmbedRaw&&g.push(Mt(b,"end2",{legacyEmbedRaw:void 0}))),i(g.length?Je("임베드 컬럼 수정",[p,...g]):p)},removeAttribute(u,m){if(a(u))return;if(Wi(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const h=[],p=un(u,[m],h),y=Mo(n.logical,u,g=>g.filter(k=>k.modelId!==m)),b=[...Ei(y,u,h),...Ot(n.logical,h)],f=[...p,...b];i(f.length===1?f[0]:Je("속성 삭제",f))},removeAttributes(u,m){var k;if(!m.length||a(u))return;const h=m.filter(_=>!Wi(n.logical,u,_));if(h.length<m.length&&s(l("em.attr.fkDeleteHint")),!h.length)return;const p=[],y=un(u,h,p),b=new Set(h),f=Mo(n.logical,u,_=>_.filter(N=>!b.has(N.modelId))),g=[...y,...Ei(f,u,p),...Ot(n.logical,p)];i(g.length===1?g[0]:Je("속성 삭제",g)),((k=c.value)==null?void 0:k.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,h){i(ia(u,m,h))},setAttributeSwatches(u,m,h){m.length&&(m.length===1?i(ia(u,m[0],h)):i(Je("속성 색상",m.map(p=>ia(u,p,h)))))},reorderAttributes(u,m,h){if(!m.length||a(u))return;const p=el(u,m,h),y=lC(n.logical,u,m,h);i(y.length?Je("속성 재정렬",[p,...y]):p)}}}function pC(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Be(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=Be();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Be()}for(const a of n.indexes??[]){a.modelId=Be();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Be();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const hC=220;function yC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||hC));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of n.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of n.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const Xl=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function gC(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const b=c.filter(f=>n.logical.entities.some(g=>g.modelId===f));if(b.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:b}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const b=n.logical.entities.find(g=>g.modelId===d.entityId);if(!b)return;const f=[...b.attributes].sort((g,k)=>g.order-k.order).filter(g=>d.ids.includes(g.modelId));if(!f.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:f}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(b=>b.modelId===u),h=n.layout.entityLayouts.find(b=>b.entityRef===u);if(!m)return;const p=(h==null?void 0:h.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(h){const{entityRef:b,geo:f,locked:g,...k}=h;Object.keys(k).length&&(y=k)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:p,layoutExtras:y}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const p=a.value;if(!p)return[];const y=n.logical.entities.find(N=>N.modelId===p);if(!y)return[];const b=new Set(y.attributes.map(N=>N.name)),f=new Set(y.attributes.flatMap(N=>N.dbAttrs.map(I=>I.physicalName))),g=At(y.attributes),k=[],_=c.attributes.map((N,I)=>{const $=JSON.parse(JSON.stringify(N));$.modelId=Be();for(const C of $.dbAttrs)C.modelId=Be();b.has($.name)&&($.name=uo(`${$.name}_copy`,b)),b.add($.name);for(const C of $.dbAttrs)C.physicalName&&f.has(C.physicalName)&&(C.physicalName=uo(`${C.physicalName}_copy`,f)),C.physicalName&&f.add(C.physicalName);return $.order=g+I,k.push($.modelId),jt(p,$)});return l(_.length===1?_[0]:Je("속성 붙여넣기",_)),i.value={kind:"attribute",entityId:p,ids:k,anchor:k[k.length-1]},[]}const{clone:d,idMap:u}=pC(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let h;if(c.layoutExtras){const p={...c.layoutExtras},y=b=>u.get(b);p.attributeStyles&&(p.attributeStyles=ea(p.attributeStyles,y)),p.operationStyles&&(p.operationStyles=ea(p.operationStyles,y)),h=p}return l(oa(d,m,h)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Vc(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const h=(u==null?void 0:u.placement)??"append-right",p=h==="append-right"?yC(n.layout,m.layout):h.offset,y=new Map(m.layout.entityLayouts.map(_=>[_.entityRef,_])),b=new Map(m.layout.associationLayouts.map(_=>[_.associationRef,_])),f=new Map(m.layout.groupLayouts.map(_=>[_.groupRef,_])),g=[];let k=80;for(const _ of m.logical.entities){const N=y.get(_.modelId),I=N?{location:Xl(N.geo.location,p),size:{...N.geo.size}}:{location:{x:k+=40,y:80},size:{width:220,height:140}};let $;if(N){const{entityRef:C,geo:A,locked:T,...V}=N;$=V}g.push(oa(_,I,$))}for(const _ of m.logical.associations){const N=b.get(_.modelId),I=N?{...N,waypoints:N.waypoints.map($=>Xl($,p))}:{associationRef:_.modelId,waypoints:[]};g.push(la(_,I))}for(const _ of m.logical.groups){const N=f.get(_.modelId),I=N?{location:Xl(N.geo.location,p),size:{...N.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let $;if(N){const{groupRef:C,geo:A,locked:T,memberNoteRefs:V,...R}=N;$=R}g.push(aa(_,I,$))}return l(Je("다이어그램 가져오기",g)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(_=>_.modelId)}};return s}function bC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l}=e;return{addEntity(s="NewEntity",c={x:80,y:80}){if(!o.value)return null;const d=Be(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Be(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Be(),physicalName:"id",dataType:"BIGINT"}]}]};return i(oa(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(jc(s,c))},updateEntity(s,c){if(a(s))return;const d=Hc(s,c),u=n.logical.entities.find(p=>p.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",h=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const p=u.attributes.filter(_=>_.identifier&&!_.derivedFrom).map(_=>on(s,_.modelId,{identifier:!1})),y=Mo({...n.logical,entities:n.logical.entities.map(_=>_.modelId===s?{..._,stereotype:"JPA_EMBEDDABLE"}:_)},s,_=>_.map(N=>N.identifier&&!N.derivedFrom?{...N,identifier:!1}:N)),b=[],f=Wa(y,[s],b);f.push(...Ot(n.logical,b));const g=uC(n.logical,s),k=[d,...p,...f,...g];i(k.length>1?Je("임베더블 변환",k):d);return}if(h){const p=dC(n.logical,s),y=[d,...p];i(y.length>1?Je("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(ko(s,c))},resizeEntity(s,c){a(s)||i(Kc(s,c))},removeEntity(s){if(a(s))return;const c=Uc(s);if(!n.logical.entities.find(f=>f.modelId===s)){i(c);return}const u=n.logical.associations.filter(f=>f.end1.entityRef===s||f.end2.entityRef===s),m=new Set(u.map(f=>f.modelId)),h=[],p=[];for(const f of n.logical.entities)if(f.modelId!==s)for(const g of f.attributes)g.embedded&&m.has(g.embedded.associationRef)&&h.push(...un(f.modelId,[g.modelId],p));for(const f of u){if(f.end1.entityRef===s||!f.end1.attributeRef)continue;const g=n.logical.entities.find(_=>_.modelId===f.end1.entityRef),k=g==null?void 0:g.attributes.find(_=>_.modelId===f.end1.attributeRef&&_.attrType==="RELATION_REF");k&&h.push(...un(g.modelId,[k.modelId],p))}const y={...n.logical,entities:n.logical.entities.filter(f=>f.modelId!==s),associations:n.logical.associations.filter(f=>!m.has(f.modelId))},b=new Set(u.filter(f=>f.end1.entityRef===s&&f.end2.entityRef!==s).map(f=>f.end2.entityRef));h.push(...Wa(y,[...b],p)),h.push(...Ot(n.logical,p.filter(f=>f.entityId!==s))),i(h.length?Je("엔티티 삭제",[c,...h]):c)},setEntitySwatch(s,c){i(Gc(s,c))},setEntityCollapsed(s,c){i(Yc(s,c))},setEntityLocked(s,c){i(qc(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(Qr(!0))},expandAll(){i(Qr(!1))}}}function _C(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(g=>n.layout.entityLayouts.find(k=>k.entityRef===g)).filter(g=>!!g);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,h=1/0,p=-1/0,y=-1/0;for(const g of u){const k=g.geo.size.width||220,_=g.geo.size.height||140;m=Math.min(m,g.geo.location.x),h=Math.min(h,g.geo.location.y),p=Math.max(p,g.geo.location.x+k),y=Math.max(y,g.geo.location.y+_)}const b=40,f=28;return{location:{x:m-b,y:h-b-f},size:{width:p-m+b*2,height:y-h+b*2+f}}}return{dragGroup(d,u,m){l(d)||i(Je("그룹 이동",wf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Qc(d,u))},setGroupSwatch(d,u){i(ed(d,u))},setGroupLocked(d,u){i(td(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(Wc(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const b of d)y.memberEntityRefs.includes(b)&&m.push(ra(y.modelId,b));const h=Be(),p={modelId:h,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(aa(p,c(d))),i(Je("그룹 생성",m)),a.value=null,h},addEmptyGroup(d,u){if(!o.value)return null;const m=Be();return i(aa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(Jc(d))},dropEntity(d,u,m){var y;if(r(d))return;const h=((y=n.logical.groups.find(b=>b.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,p=[ko(d,u)];h!==m&&(h&&p.push(ra(h,d)),m&&p.push(Xc(m,d))),i(Je("이동",p))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(ra(u.modelId,d))},dropNote(d,u,m){var y;const h=((y=n.layout.groupLayouts.find(b=>{var f;return(f=b.memberNoteRefs)==null?void 0:f.includes(d)}))==null?void 0:y.groupRef)??null,p=[ei(d,u)];h!==m&&(h&&p.push(wd(h,d)),m&&p.push(Nd(m,d))),i(Je("이동",p))}}}function kC(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(b,f){if(d(),!o.value||!e.opTransport)return;const g=new $d({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:k=>{i.value=!1,a.value=k},onError:e.onOpError});g.seed((f==null?void 0:f.revSeed)??{}),c=g.attach(b),s=g}const m=t.computed(()=>o.value&&r!==void 0),h=t.ref(0),p=t.computed(()=>o.value&&i.value&&l!==void 0);async function y(b){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let f;try{f=await l(b)}catch(g){return{ok:!1,reason:g instanceof Error?g.message:String(g)}}return f.ok&&h.value++,f}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:p,restoreToSeq:y,reloadRequest:h}}function EC(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Be();return o(gd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(bd(i))},moveNote(i,a){o(ei(i,a))},resizeNote(i,a){o(_d(i,a))},setNoteMemo(i,a){o(kd(i,a))},setNoteSwatch(i,a){o(Ed(i,a))},addNoteConnection(i,a){o(Id(i,a))},removeNoteConnection(i,a){o(vd(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Cd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(xd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Sd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Rd(i,a))}}}function NC(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const h=o.value,p=(h==null?void 0:h.kind)==="attribute"&&h.entityId===d;if(m==="replace"||!p){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const N=h.ids.includes(u),I=N?h.ids.filter(C=>C!==u):[...h.ids,u];if(!I.length){o.value=null;return}const $=N&&h.anchor===u?I[I.length-1]:N?h.anchor:u;o.value={kind:"attribute",entityId:d,ids:I,anchor:$};return}const y=n.logical.entities.find(N=>N.modelId===d),b=[...(y==null?void 0:y.attributes)??[]].sort((N,I)=>N.order-I.order).map(N=>N.modelId),f=b.indexOf(h.anchor),g=b.indexOf(u);if(f<0||g<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[k,_]=f<=g?[f,g]:[g,f];o.value={kind:"attribute",entityId:d,ids:b.slice(k,_+1),anchor:h.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(b=>b.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const h=m.attributes.findIndex(b=>b.modelId===u.anchor);if(h<0)return!1;const p=Math.min(Math.max(h+d,0),m.attributes.length-1);if(p===h)return!0;const y=m.attributes[p].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[y],anchor:y},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(N=>N.modelId===u.entityId);if(!m)return!1;const h=m.attributes,p=new Set(u.ids),y=h.map((N,I)=>p.has(N.modelId)?I:-1).filter(N=>N>=0);if(!y.length)return!1;const b=Math.min(...y),f=h.filter(N=>!p.has(N.modelId)),g=h.slice(0,b).filter(N=>!p.has(N.modelId)).length;let k;if(d<0){if(g<=0)return!0;k=g-1}else{if(f.length-g<=0)return!0;k=g+1}if(r(u.entityId))return!0;const _=h.filter(N=>p.has(N.modelId)).map(N=>N.modelId);return a(el(u.entityId,_,k)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const h=new Set(n.logical.entities.map(k=>k.modelId)),p=new Set(n.logical.groups.map(k=>k.modelId)),y=new Set(n.layout.notes.map(k=>k.modelId)),b=new Set;for(const k of d){if(!p.has(k))continue;const _=n.logical.groups.find(N=>N.modelId===k);for(const N of(_==null?void 0:_.memberEntityRefs)??[])b.add(N)}const f=[],g=[];for(const k of d)if(p.has(k)){if(s(k))continue;const _=n.layout.groupLayouts.find(C=>C.groupRef===k);if(!_)continue;const N=n.logical.groups.find(C=>C.modelId===k),I=((N==null?void 0:N.memberEntityRefs)??[]).map(C=>{var T;const A=((T=n.layout.entityLayouts.find(V=>V.entityRef===C))==null?void 0:T.geo.location)??{x:0,y:0};return{id:C,location:{x:A.x+u,y:A.y+m}}}),$={x:_.geo.location.x+u,y:_.geo.location.y+m};f.push(Je("그룹 이동",wf(n,k,$,I))),g.push("g:"+k)}else if(h.has(k)){if(b.has(k)||l(k))continue;const _=n.layout.entityLayouts.find(N=>N.entityRef===k);if(!_)continue;f.push(ko(k,{x:_.geo.location.x+u,y:_.geo.location.y+m})),g.push("e:"+k)}else if(y.has(k)){const _=n.layout.notes.find(N=>N.modelId===k);if(!_)continue;f.push(ei(k,{x:_.geo.location.x+u,y:_.geo.location.y+m})),g.push("n:"+k)}return f.length?(a(Je("이동",f,"nudge:"+g.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const oo=Symbol("editorController");function If(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function wC(e=If(),n={}){var ne,G;const o=t.reactive(e);let i=new Zr(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),u=t.ref(n.uiLocale??"ko"),m=(P,ae)=>Lt(u.value,P,ae),h=t.ref(n.reservedWords),p=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),b=t.ref(n.flagEntitiesWithoutRelations??!1),f=t.ref(!1),g=t.ref(!1),k=t.ref(!1),_=t.ref(0),N=t.ref(null);let I=0;const $=P=>{if(n.onNotice){n.onNotice(P);return}N.value={text:P,id:++I}},C=t.ref(((ne=n.meta)==null?void 0:ne.schemaVersion)??1),A=t.ref(((G=n.meta)==null?void 0:G.opWriteEnabled)??!1),T=t.computed(()=>C.value>=2&&A.value),V=t.ref(!(C.value>=2&&A.value===!1)),R=t.ref("LOGICAL_PHYSICAL"),x=t.ref("straight"),M=t.ref(!0),E=t.ref(!0),w=t.ref(null),S=t.computed(()=>{var P;return((P=w.value)==null?void 0:P.kind)==="attribute"?{entityId:w.value.entityId,attrId:w.value.anchor}:null}),B=t.computed(()=>{var P;return((P=w.value)==null?void 0:P.kind)==="attribute"?w.value.ids:[]}),z=t.computed(()=>{var P,ae;return((P=w.value)==null?void 0:P.kind)==="entity"?w.value.id:((ae=w.value)==null?void 0:ae.kind)==="attribute"?w.value.entityId:null}),K=t.ref(null),J=t.ref(null),re=t.ref(null),pe=t.ref(null),ce=kC({state:o,opMode:T,editable:V,opConflict:re,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function Ne(){i.onChange(()=>{f.value=i.canUndo,g.value=i.canRedo,k.value=i.isDirty,_.value++})}Ne(),ce.setupOpAdapter(i,n.meta);const he=t.computed(()=>vs(o.logical,o.layout)),de=t.computed(()=>({reservedWords:h.value,selectableDataTypes:p.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:b.value,embeddableCatalog:a.value,superClassCatalog:s.value})),_e=n.validationDebounceMs??250;let Se,me=()=>{};if(_e>0){const P=t.shallowRef(Ji(o.logical,de.value));let ae;me=()=>{ae!==void 0&&(clearTimeout(ae),ae=void 0),P.value=Ji(o.logical,de.value)},t.watch([_,de],()=>{ae!==void 0&&clearTimeout(ae),ae=setTimeout(me,_e)},{flush:"sync"}),Se=t.computed(()=>P.value)}else Se=t.computed(()=>Ji(o.logical,de.value));const ye=t.computed(()=>{const P=new Map;for(const ae of Se.value){if(!ae.targetRef)continue;const Re=P.get(ae.targetRef);Re?Re.push(ae):P.set(ae.targetRef,[ae])}return P}),ie=1500,se=new Map,fe=P=>{const ae=Date.now();ae-(se.get(P)??0)<ie||(se.set(P,ae),$(P))},O=P=>{if(!pe.value){if(!V.value){fe(m("em.notice.readOnly"));return}try{i.execute(P)}catch(ae){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${P.label}):`,ae),V.value=!1,pe.value={label:P.label}}}},L=P=>o.layout.entityLayouts.some(ae=>ae.entityRef===P&&!!ae.locked),F=P=>o.layout.groupLayouts.some(ae=>ae.groupRef===P&&!!ae.locked),Q=P=>{const ae=o.logical.associations.find(Re=>Re.modelId===P);return!!ae&&(L(ae.end1.entityRef)||L(ae.end2.entityRef))},Y=P=>L(P)?(fe(m("em.notice.entityLocked")),!0):!1,ke=P=>F(P)?(fe(m("em.notice.groupLocked")),!0):!1,be=P=>Q(P)?(fe(m("em.notice.assocLocked")),!0):!1,xe=gC({state:o,clipboard:J,selection:w,inspectedEntityId:z,editable:V,run:O}),ve=NC({state:o,selection:w,focusRequest:K,run:O,gateEntityLocked:Y,isEntityLockedFn:L,isGroupLockedFn:F}),U=bC({state:o,editable:V,run:O,gateEntityLocked:Y,isEntityLockedFn:L,isAssocLockedFn:Q}),H=fC({state:o,editable:V,run:O,gateEntityLocked:Y,embeddableCatalog:a,t:m,emitGateNotice:fe,selection:w}),q=_C({state:o,editable:V,run:O,selection:w,gateEntityLocked:Y,gateGroupLocked:ke,isGroupLockedFn:F}),Ce=EC({editable:V,run:O}),De=mC({state:o,editable:V,run:O,gateEntityLocked:Y,gateAssocLocked:be});return{state:o,resolved:he,issues:Se,issuesByRef:ye,flagEntitiesWithoutRelations:b,canUndo:f,canRedo:g,dirty:k,revision:_,notice:N,editable:V,schemaVersion:C,opWriteEnabled:A,opMode:T,opConflict:re,commandFailure:pe,historyTransport:ce.historyTransport,historyAvailable:ce.historyAvailable,restoreTransport:ce.restoreTransport,restoreAvailable:ce.restoreAvailable,restoreToSeq:ce.restoreToSeq,reloadRequest:ce.reloadRequest,displayMode:R,routingMode:x,showGrid:M,showMinimap:E,selection:w,selectedAttr:S,selectedAttrIds:B,inspectedEntityId:z,focusRequest:K,clipboard:J,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,uiLocale:u,t:m,selectableDataTypes:p,setEditable(P){V.value=P&&T.value},setEmbeddableCatalog(P){a.value=P},setGroupCodeCatalog(P){r.value=P},setPredefinedCustomTypeCatalog(P){l.value=P},setSuperClassCatalog(P){s.value=P},selectAttribute:ve.selectAttribute,moveAttributeFocus:ve.moveAttributeFocus,nudgeSelectedAttributes:ve.nudgeSelectedAttributes,nudgeNodes:ve.nudgeNodes,requestFocus:ve.requestFocus,deleteSelection(){if(!V.value)return!1;const P=w.value;if(!P)return!1;if(P.kind==="attribute"){if(Y(P.entityId))return!1;const ae=P.ids;if(!ae.length)return!1;ae.length===1?H.removeAttribute(P.entityId,ae[0]):H.removeAttributes(P.entityId,ae)}else if(P.kind==="entity"){if(Y(P.id))return!1;U.removeEntity(P.id)}else if(P.kind==="note")Ce.removeNote(P.id);else if(P.kind==="group"){if(ke(P.id))return!1;q.removeGroup(P.id)}else De.removeAssociation(P.id);return w.value=null,!0},undo:()=>{V.value&&i.undo()},redo:()=>{V.value&&i.redo()},markSaved:()=>{V.value&&(ce.flush(),i.markSavePoint())},loadDiagram(P,ae){ce.teardownOpAdapter(),o.logical=P.logical,o.layout=P.layout,i=new Zr(o),Ne(),C.value=(ae==null?void 0:ae.schemaVersion)??1,A.value=(ae==null?void 0:ae.opWriteEnabled)??!1,V.value=!(C.value>=2&&A.value===!1),re.value=null,pe.value=null,w.value=null,f.value=i.canUndo,g.value=i.canRedo,k.value=i.isDirty,ce.setupOpAdapter(i,ae),me()},flush:ce.flush,whenOpsSettled:ce.whenOpsSettled,addEntity:U.addEntity,renameEntity:U.renameEntity,updateEntity:U.updateEntity,moveEntity:U.moveEntity,resizeEntity:U.resizeEntity,removeEntity:U.removeEntity,setEntitySwatch:U.setEntitySwatch,setEntityCollapsed:U.setEntityCollapsed,setEntityLocked:U.setEntityLocked,isEntityLocked:U.isEntityLocked,isAssociationLocked:U.isAssociationLocked,collapseAll:U.collapseAll,expandAll:U.expandAll,setAttributeSwatch:H.setAttributeSwatch,dragGroup:q.dragGroup,resizeGroup:q.resizeGroup,setGroupSwatch:q.setGroupSwatch,setGroupLocked:q.setGroupLocked,isGroupLocked:q.isGroupLocked,updateGroup:q.updateGroup,createGroup:q.createGroup,addEmptyGroup:q.addEmptyGroup,removeGroup:q.removeGroup,dropEntity:q.dropEntity,ungroupEntity:q.ungroupEntity,dropNote:q.dropNote,addPredefinedEmbed:H.addPredefinedEmbed,addAttribute:H.addAttribute,addDivider:H.addDivider,updateAttribute:H.updateAttribute,setAttributeGroupCode:H.setAttributeGroupCode,setEmbedColumns:H.setEmbedColumns,removeAttribute:H.removeAttribute,removeAttributes:H.removeAttributes,setAttributeSwatches:H.setAttributeSwatches,reorderAttributes:H.reorderAttributes,addIndex(P,ae){Y(P)||O(dd(P,ae))},updateIndex(P,ae,Re){Y(P)||O(ca(P,ae,Re))},removeIndex(P,ae){Y(P)||O(ud(P,ae))},addOperation(P,ae={}){if(!V.value||Y(P))return null;const Re=o.logical.entities.find(rt=>rt.modelId===P),le=Re!=null&&Re.operations?At(Re.operations):0,j=ae.modelId??Be(),Ze={modelId:j,name:ae.name??`method${le}`,visibility:ae.visibility??"PACKAGE",order:le,...ae};return O(id(P,Ze)),j},updateOperation(P,ae,Re){Y(P)||O(ad(P,ae,Re))},removeOperation(P,ae){Y(P)||O(rd(P,ae))},reorderOperations(P,ae,Re){!ae.length||Y(P)||O(ld(P,ae,Re))},setOperationSwatch(P,ae,Re){O(sd(P,ae,Re))},addAssociation:De.addAssociation,addEmbedAssociation:De.addEmbedAssociation,setEmbedCardinality:De.setEmbedCardinality,removeAssociation:De.removeAssociation,setAssociationIdentifying:De.setAssociationIdentifying,updateAssociationEnd:De.updateAssociationEnd,hasQuickFix(P){if(!V.value)return!1;const ae=Or(P,o.logical);return ae?ae.kind==="setEndCascades"?!Q(ae.assocRef):!L(ae.entityRef):!1},applyQuickFix(P){if(!V.value)return!1;const ae=Or(P,o.logical);if(!ae)return!1;if(ae.kind==="setIndexColumns")return Y(ae.entityRef)?!1:(O(ca(ae.entityRef,ae.indexRef,{columns:ae.columns})),!0);if(be(ae.assocRef))return!1;const Re=o.logical.associations.find(le=>le.modelId===ae.assocRef);return Re?(O(Mt(ae.assocRef,ae.which,{jpa:{...Re[ae.which].jpa,cascadeTypes:ae.cascades}})),!0):!1},moveWaypoint(P,ae,Re){O(md(P,ae,Re))},addWaypoint(P,ae,Re){O(yd(P,ae,Re))},removeWaypoint(P,ae){O(fd(P,ae))},clearWaypoints(P){O(hd(P))},addNote:Ce.addNote,removeNote:Ce.removeNote,moveNote:Ce.moveNote,resizeNote:Ce.resizeNote,setNoteMemo:Ce.setNoteMemo,setNoteSwatch:Ce.setNoteSwatch,addNoteConnection:Ce.addNoteConnection,removeNoteConnection:Ce.removeNoteConnection,moveNoteConnectionWaypoint:Ce.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:Ce.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:Ce.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:Ce.clearNoteConnectionWaypoints,autoLayout(){const P=Cs(o.logical,o.layout);P.length&&O(Je("자동 배치",P.map(ae=>ko(ae.id,ae.location))))},copy:xe.copy,paste:xe.paste,importEntities:xe.importEntities}}const Ja=Symbol("groupHover"),vf=Symbol("groupDrag"),Vo=Symbol("relationHighlight"),Cf=Symbol("diffOverlay"),xf=Symbol("nodeInternals"),Sf=Symbol("columnResolution");function IC(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function Rf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!IC(e[o],n[o]))return!1;return!0}function vC(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!Rf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function CC(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function xC(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!CC(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!vC(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Rf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function SC(){let e;return(n,o)=>e=RC(n,o,e)}function RC(e,n,o){const i=e.entities,a=new Map;for(const r of i){const l=new Map,s=new Map,c=new Map;let d=null;const u=()=>d??(d=co(En(r,i)));for(const b of r.attributes){if(Di(b)){const _=b.dbAttrs[0];if(!(_!=null&&_.physicalName&&(_!=null&&_.dataType))){const N=Li(b,r,i,e.associations);N&&l.set(b.modelId,{...b,dbAttrs:[{..._,physicalName:(_==null?void 0:_.physicalName)||N.physicalName,dataType:(_==null?void 0:_.dataType)||N.dataType,length:(_==null?void 0:_.length)??N.length,scale:(_==null?void 0:_.scale)??N.scale},...b.dbAttrs.slice(1)]})}}const f=Sr(b,e.associations);if(f&&c.set(b.modelId,f),!b.attrType.startsWith("EMBED")||b.dbAttrs.length===0)continue;if(b.attrType!=="EMBED_PREDEF"){const _=u();s.set(b.modelId,b.dbAttrs.map((N,I)=>{const $=Dn(N,_);return $?{...N,physicalName:$.physicalName}:Bn(b,N,I,r,e)}));continue}const g=n==null?void 0:n.find(_=>_.type===b.type);if(!g)continue;const k=u();s.set(b.modelId,b.dbAttrs.map((_,N)=>{const I=g.fields[N],$=Dn(_,k);return $?{..._,physicalName:$.physicalName,logicalName:_.logicalName??(I==null?void 0:I.logicalName),dataType:_.dataType||(I==null?void 0:I.dataType)||""}:I?{..._,physicalName:_.physicalName||I.physicalName,logicalName:_.logicalName??I.logicalName,dataType:_.dataType||I.dataType,length:_.length??I.length}:_}))}const m=new Map,h=new Map;for(const b of r.attributes){const f=s.get(b.modelId);if(f)for(let g=0;g<f.length;g++){const k=`${b.attrType}\0${b.type??""}\0${g}`,_={attrId:b.modelId,slot:g,name:f[g].physicalName??""},N=h.get(k);N?N.push(_):h.set(k,[_])}}for(const b of h.values()){if(b.length<2)continue;const f=new Map;for(const g of b)f.set(g.name,(f.get(g.name)??0)+1);for(const g of b){if((f.get(g.name)??0)<2)continue;const k=m.get(g.attrId);k?k.add(g.slot):m.set(g.attrId,new Set([g.slot]))}}const p={effectiveAttrs:l,embedCols:s,collectionTypes:c,redundantSlots:m},y=o==null?void 0:o.get(r.modelId);a.set(r.modelId,y&&xC(p,y)?y:p)}return a}const Af=Symbol("embedSlotCollapse"),$f=(e,n)=>`${e}:${n}`,Tf="all:",Mf="one:",Vf=e=>`${Tf}${e}`,Bf=(e,n)=>`${Mf}${e}:${n}`,AC=e=>!e.startsWith(Tf)&&!e.startsWith(Mf),$C={key:0,class:"em-sel","aria-hidden":"true"},TC=["title","aria-expanded","disabled"],MC={class:"em-entity__stereotype"},VC={key:1,class:"em-entity__name"},BC=["title","aria-expanded"],DC={"aria-hidden":"true"},LC=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],OC=["onPointerdown"],PC={key:1,class:"em-entity__divider-label"},zC=["title"],FC={class:"em-key-slot"},UC={class:"em-key-slot"},HC=["title","aria-expanded","onClick"],jC=["title","onClick"],KC=["title","aria-expanded","onClick"],GC={key:2,class:"em-entity__type"},YC=["onClick"],qC={class:"em-entity__attrname"},WC={class:"em-entity__type"},JC={key:1,class:"em-entity__embed-summary"},XC=["title"],ZC=["data-op"],QC=["onPointerdown"],ex={class:"em-entity__op-vis","aria-hidden":"true"},tx=["title"],nx={key:4,class:"em-entity__footer"},Df=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(oo,null),i=(oe,v)=>o?o.t(oe,v):Lt("ko",oe,v),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=te.useModal();function l(){o&&Ya(r,o,n.id)}const s=t.inject(Ja,null),c=t.inject(Vo,null),d=t.inject(Cf,null),u=t.computed(()=>{var oe;return((oe=d==null?void 0:d.marks.value)==null?void 0:oe.get(n.id))??null}),m=t.inject(Sf,null),h=t.computed(()=>m==null?void 0:m.value.get(n.id)),p=t.inject(Af,void 0),y=t.inject(xf,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const b=t.computed(()=>!!o&&o.editable.value);function f(){s&&(s.value=n.data.groupRef??null)}function g(){c==null||c.setEntityHover(n.id)}function k(){c==null||c.setEntityHover(null)}const _=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),N=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!_.value),I=t.computed(()=>{var oe;return((oe=o==null?void 0:o.selection.value)==null?void 0:oe.kind)==="entity"&&o.selection.value.id===n.id}),$=t.computed(()=>!!n.selected&&!I.value),C=t.computed(()=>{var oe;return o&&((oe=o.selectedAttr.value)==null?void 0:oe.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),A=t.computed(()=>C.value.size>0);function T(oe,v){const D=v.shiftKey?"range":v.metaKey||v.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,oe.modelId,D)}const V=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!I.value),R=t.computed(()=>n.data.entity),x=t.computed(()=>[...R.value.attributes].sort((oe,v)=>oe.order-v.order)),M=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),E=t.computed(()=>n.data.collapsed??!1),w=t.computed(()=>n.data.locked??!1),S=t.computed(()=>b.value&&!w.value);function B(){b.value&&(o==null||o.setEntityCollapsed(n.id,!E.value))}const z=t.computed(()=>M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL"),K=t.computed(()=>{const oe=M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL",v={};for(const D of x.value){const ee=D.attrType.startsWith("RELATION")&&D.dbAttrs.length>0;v[D.modelId]={pk:D.identifier,fk:ee&&oe,required:D.notNull&&!D.identifier}}return v});function J(oe){if(!oe)return"";const v=[];return oe.pk&&oe.fk?v.push(i("em.node.keyPfk")):oe.pk?v.push(i("em.node.keyPk")):oe.fk&&v.push(i("em.node.keyFk")),oe.required&&v.push(i("em.node.required")),v.join(" · ")}const re=t.computed(()=>{const oe=Yl(_t(n.data.style)),v={};return oe&&(v["--em-header-bg"]=oe.bar,v["--em-header-fg"]=oe.barOn),v});function pe(oe){var v,D;return(D=Yl(_t((v=n.data.attributeStyles)==null?void 0:v[oe.modelId])))==null?void 0:D.text}const ce=t.computed(()=>[...R.value.operations??[]].sort((oe,v)=>oe.order-v.order)),Ne=t.computed(()=>M.value==="CLASS"&&ce.value.length>0),he={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function de(oe){return oe?he[oe]:"~"}function _e(oe){var v,D;return(D=Yl(_t((v=n.data.operationStyles)==null?void 0:v[oe.modelId])))==null?void 0:D.text}function Se(oe,v,D){switch(M.value){case"CLASS":return[{text:oe}];case"PHYSICAL":return[{text:D||oe}];case"LOGICAL":return[v?{text:v}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const ee=v?{text:v}:{text:i("em.node.logicalMissing"),missing:!0};return D?[ee,{text:` · ${D}`}]:[ee]}}}function me(oe){var v;return((v=h.value)==null?void 0:v.effectiveAttrs.get(oe.modelId))??oe}function ye(oe){var D,ee,Z;if(ie(oe))return[{text:oe.name}];const v=me(oe);return Se(oe.name,(ee=(D=v.dbAttrs[0])==null?void 0:D.logicalName)==null?void 0:ee[a.value],((Z=v.dbAttrs[0])==null?void 0:Z.physicalName)??"")}function ie(oe){return oe.attrType.startsWith("EMBED")&&oe.dbAttrs.length>0}function se(oe){return oe.attrType==="DIVIDER"}function fe(oe){var v;return((v=h.value)==null?void 0:v.embedCols.get(oe.modelId))??oe.dbAttrs}function O(oe){var v;return(v=h.value)==null?void 0:v.redundantSlots.get(oe.modelId)}const L=t.computed(()=>(p==null?void 0:p.isCollapsed(Vf(n.id)))??!1),F=t.computed(()=>L.value&&z.value?x.value.reduce((oe,v)=>ie(v)?oe+fe(v).length:oe,0):0),Q=t.computed(()=>x.value.some(oe=>ie(oe)));function Y(oe){const v=O(oe);return!v||v.size===0?!1:p?p.isCollapsed($f(n.id,oe.modelId)):!1}function ke(oe){var v;return Y(oe)?((v=O(oe))==null?void 0:v.size)??0:0}function be(oe){return p?p.isCollapsed(Bf(n.id,oe.modelId)):!1}function xe(oe){var v;return!z.value||L.value?null:be(oe)?"attr":(((v=O(oe))==null?void 0:v.size)??0)>0?"slot":null}function ve(oe){return!L.value&&ie(oe)}function U(oe){return be(oe)?fe(oe).length:0}function H(oe){if(L.value||be(oe))return[];const v=fe(oe);if(!Y(oe))return v;const D=O(oe);return v.filter((ee,Z)=>!D.has(Z))}function q(oe){p==null||p.toggle($f(n.id,oe.modelId))}function Ce(oe){p==null||p.toggle(Bf(n.id,oe.modelId))}function De(){p==null||p.toggle(Vf(n.id))}function W(oe){var v;return Se(oe.physicalName,(v=oe.logicalName)==null?void 0:v[a.value],oe.physicalName)}function ne(oe){var D;const v=(D=h.value)==null?void 0:D.collectionTypes.get(oe.modelId);return Rr(M.value,me(oe),v)}const G=t.computed(()=>{const oe={};for(const v of x.value)oe[v.modelId]=ne(v);return oe}),P=t.computed(()=>{var oe,v,D;return Se(R.value.name,(v=(oe=R.value.table)==null?void 0:oe.logicalName)==null?void 0:v[a.value],((D=R.value.table)==null?void 0:D.physicalName)??"")}),ae=t.ref(!1),Re=t.ref(""),le=t.ref(null);async function j(){var oe,v;S.value&&(Re.value=R.value.name,ae.value=!0,await t.nextTick(),(oe=le.value)==null||oe.focus(),(v=le.value)==null||v.select())}function Ze(){if(!ae.value)return;ae.value=!1;const oe=Re.value.trim();oe&&oe!==R.value.name&&(o==null||o.renameEntity(n.id,oe))}function rt(){o==null||o.addAttribute(n.id)}function He(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:Pe,findNode:Oe}=je(),X=t.ref(null),Nt=t.computed(()=>{const oe=X.value??n.data.size;return oe?{width:`${oe.width}px`,minHeight:`${oe.height}px`}:void 0});let Et=null;function yn(oe){var ee,Z,Ie;if(!S.value)return;oe.stopPropagation();const v=(ee=Oe(n.id))==null?void 0:ee.dimensions,D=Pe({x:oe.clientX,y:oe.clientY});Et={fx:D.x,fy:D.y,w:(v==null?void 0:v.width)??((Z=n.data.size)==null?void 0:Z.width)??200,h:(v==null?void 0:v.height)??((Ie=n.data.size)==null?void 0:Ie.height)??120},oe.target.setPointerCapture(oe.pointerId)}function gn(oe){if(!Et)return;const v=Pe({x:oe.clientX,y:oe.clientY});X.value={width:Math.max(40,Et.w+(v.x-Et.fx)),height:Math.max(40,Et.h+(v.y-Et.fy))}}function Ee(oe){var v,D,ee;if(Et&&X.value&&o){const Z=(v=Oe(n.id))==null?void 0:v.dimensions;o.resizeEntity(n.id,{width:Math.round((Z==null?void 0:Z.width)??X.value.width),height:Math.round((Z==null?void 0:Z.height)??X.value.height)})}Et=null,X.value=null,(ee=(D=oe.target).releasePointerCapture)==null||ee.call(D,oe.pointerId)}const nt=t.ref(null),mt=t.ref(null);function Ft(oe,v){if(!S.value)return;v.stopPropagation(),v.preventDefault();const D=C.value,ee=D.has(oe.modelId)?new Set(D):new Set([oe.modelId]);mt.value={ids:ee,dropIndex:-1,lineY:0},v.target.setPointerCapture(v.pointerId)}function Qt(oe){if(!mt.value||!nt.value)return;const v=Array.from(nt.value.querySelectorAll(".em-entity__row"));if(!v.length)return;let D=v.length;for(let Ie=0;Ie<v.length;Ie++){const Me=v[Ie].getBoundingClientRect();if(oe.clientY<Me.top+Me.height/2){D=Ie;break}}const ee=v[v.length-1],Z=D<v.length?v[D].offsetTop:ee.offsetTop+ee.offsetHeight;mt.value={...mt.value,dropIndex:D,lineY:Z}}function en(){const oe=mt.value;if(mt.value=null,!oe||oe.dropIndex<0)return;const v=x.value,D=v.filter(ue=>oe.ids.has(ue.modelId)).map(ue=>ue.modelId),ee=v.filter((ue,Ve)=>oe.ids.has(ue.modelId)&&Ve<oe.dropIndex).length,Z=oe.dropIndex-ee,Ie=v.filter(ue=>!oe.ids.has(ue.modelId)).map(ue=>ue.modelId);[...Ie.slice(0,Z),...D,...Ie.slice(Z)].join(",")!==v.map(ue=>ue.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,D,Z))}function we(){mt.value=null}const et=t.ref(null),ft=t.ref(null);function bn(oe,v){S.value&&(v.stopPropagation(),v.preventDefault(),ft.value={id:oe.modelId,dropIndex:-1,lineY:0},v.target.setPointerCapture(v.pointerId))}function ot(oe){if(!ft.value||!et.value)return;const v=Array.from(et.value.querySelectorAll(".em-entity__op-row"));if(!v.length)return;let D=v.length;for(let Ie=0;Ie<v.length;Ie++){const Me=v[Ie].getBoundingClientRect();if(oe.clientY<Me.top+Me.height/2){D=Ie;break}}const ee=v[v.length-1],Z=D<v.length?v[D].offsetTop:ee.offsetTop+ee.offsetHeight;ft.value={...ft.value,dropIndex:D,lineY:Z}}function Fo(){const oe=ft.value;if(ft.value=null,!oe||oe.dropIndex<0)return;const D=ce.value.findIndex(Z=>Z.modelId===oe.id);if(D<0)return;const ee=oe.dropIndex-(D<oe.dropIndex?1:0);ee!==D&&(o==null||o.reorderOperations(n.id,[oe.id],ee))}function Uo(){ft.value=null}return(oe,v)=>{var D,ee;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":_.value,"is-related":N.value,"is-dimmed":V.value,"is-selected":I.value,"is-multi-selected":$.value,"has-focused-attr":A.value,"is-locked":w.value,"is-diff-added":((D=u.value)==null?void 0:D.verb)==="added","is-diff-modified":((ee=u.value)==null?void 0:ee.verb)==="modified"}]),tabindex:"-1",style:t.normalizeStyle(Nt.value),onPointerdown:f,onMouseenter:g,onMouseleave:k,onDblclick:l},[I.value?(t.openBlock(),t.createElementBlock("div",$C,[...v[11]||(v[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(re.value),onDblclick:t.withModifiers(j,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(E.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!E.value,disabled:!b.value,onClick:t.withModifiers(B,["stop"]),onPointerdown:v[0]||(v[0]=t.withModifiers(()=>{},["stop"])),onDblclick:v[1]||(v[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(E.value?"▸":"▾"),41,TC),t.createElementVNode("span",MC,"«"+t.toDisplayString(t.unref(jo)(R.value.stereotype))+"»",1),ae.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:le,"onUpdate:modelValue":v[2]||(v[2]=Z=>Re.value=Z),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Ze,["enter"]),v[3]||(v[3]=t.withKeys(Z=>ae.value=!1,["esc"]))],onBlur:Ze,onPointerdown:v[4]||(v[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,Re.value]]):(t.openBlock(),t.createElementBlock("span",VC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(P.value,(Z,Ie)=>(t.openBlock(),t.createElementBlock("span",{key:Ie,class:t.normalizeClass({"em-entity__missing":Z.missing})},t.toDisplayString(Z.text),3))),128))])),!E.value&&z.value&&Q.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:L.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!L.value,onClick:t.withModifiers(De,["stop"]),onPointerdown:v[5]||(v[5]=t.withModifiers(()=>{},["stop"])),onDblclick:v[6]||(v[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode($e,{name:"table",size:11}),t.createElementVNode("span",DC,t.toDisplayString(L.value?"▸":"▾"),1)],40,BC)):t.createCommentVNode("",!0),w.value?(t.openBlock(),t.createBlock($e,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),E.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:nt,class:"em-entity__attrs"},[mt.value&&mt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${mt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,Z=>{var Ie,Me,ue,Ve,ze,Ue;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":C.value.has(Z.modelId),"is-dragging":(Ie=mt.value)==null?void 0:Ie.ids.has(Z.modelId),"is-embed":ie(Z),"is-divider":se(Z),"has-embed-badge":!!xe(Z),nodrag:se(Z)&&S.value,"is-diff-changed":!!((Me=u.value)!=null&&Me.changedAttributeIds.has(Z.modelId))}]),"data-attr":Z.modelId,onClick:t.withModifiers(Fe=>T(Z,Fe),["stop"]),onPointerdown:Fe=>se(Z)?Ft(Z,Fe):void 0,onPointermove:Fe=>se(Z)?Qt(Fe):void 0,onPointerup:Fe=>se(Z)?en():void 0,onPointercancel:Fe=>se(Z)?we():void 0},[S.value&&!se(Z)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Fe=>Ft(Z,Fe),onPointermove:Qt,onPointerup:en,onPointercancel:we,onClick:v[7]||(v[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,OC)):t.createCommentVNode("",!0),se(Z)?(t.openBlock(),t.createElementBlock("span",PC,t.toDisplayString(Z.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Zn),{id:`l:${Z.modelId}`,type:"target",position:t.unref(Te).Left,class:"em-handle",title:S.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:J(K.value[Z.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",FC,[(ue=K.value[Z.modelId])!=null&&ue.pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Ve=K.value[Z.modelId])!=null&&Ve.required?(t.openBlock(),t.createBlock($e,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",UC,[z.value&&ve(Z)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:be(Z)?i("em.node.embedAttrShow",{count:U(Z)}):i("em.node.embedAttrHide"),"aria-expanded":!be(Z),onClick:t.withModifiers(Fe=>Ce(Z),["stop"]),onPointerdown:v[8]||(v[8]=t.withModifiers(()=>{},["stop"])),onDblclick:v[9]||(v[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(be(Z)?"▸":"▾"),41,HC)):ie(Z)?(t.openBlock(),t.createBlock($e,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(ze=K.value[Z.modelId])!=null&&ze.fk?(t.openBlock(),t.createBlock($e,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,zC),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:pe(Z)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ye(Z),(Fe,Ye)=>(t.openBlock(),t.createElementBlock("span",{key:Ye,class:t.normalizeClass({"em-entity__missing":Fe.missing})},t.toDisplayString(Fe.text),3))),128))],4),xe(Z)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:U(Z)}),onClick:t.withModifiers(Fe=>Ce(Z),["stop"])},"+"+t.toDisplayString(U(Z)),9,jC)):xe(Z)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:Y(Z)?i("em.node.embedRepeatedShow",{count:((Ue=O(Z))==null?void 0:Ue.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!Y(Z),onClick:t.withModifiers(Fe=>q(Z),["stop"])},t.toDisplayString(Y(Z)?`+${ke(Z)}`:"−"),9,KC)):t.createCommentVNode("",!0),G.value[Z.modelId]?(t.openBlock(),t.createElementBlock("span",GC,t.toDisplayString(G.value[Z.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Zn),{id:`r:${Z.modelId}`,type:"source",position:t.unref(Te).Right,class:"em-handle",title:S.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,LC),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ie(Z)&&z.value?H(Z):[],Fe=>(t.openBlock(),t.createElementBlock("li",{key:`${Z.modelId}:${Fe.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":C.value.has(Z.modelId)}]),onClick:t.withModifiers(Ye=>T(Z,Ye),["stop"])},[v[12]||(v[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",qC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(W(Fe),(Ye,pt)=>(t.openBlock(),t.createElementBlock("span",{key:pt,class:t.normalizeClass({"em-entity__missing":Ye.missing})},t.toDisplayString(Ye.text),3))),128))]),t.createElementVNode("span",WC,t.toDisplayString(Fe.dataType),1)],10,YC))),128))],64)}),128)),F.value?(t.openBlock(),t.createElementBlock("li",JC,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(De,["stop"])},[t.createVNode($e,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:F.value})),1)],8,XC)])):t.createCommentVNode("",!0)],512)),!E.value&&Ne.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:et,class:"em-entity__ops"},[ft.value&&ft.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ft.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,Z=>{var Ie,Me;return t.openBlock(),t.createElementBlock("li",{key:Z.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ie=ft.value)==null?void 0:Ie.id)===Z.modelId,"is-diff-changed":!!((Me=u.value)!=null&&Me.changedOperationIds.has(Z.modelId))}]),"data-op":Z.modelId},[S.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ue=>bn(Z,ue),onPointermove:ot,onPointerup:Fo,onPointercancel:Uo,onClick:v[10]||(v[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,QC)):t.createCommentVNode("",!0),t.createElementVNode("span",ex,t.toDisplayString(de(Z.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:_e(Z)})},t.toDisplayString(Z.name)+"()",5)],10,ZC)}),128))],512)):ce.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ce.value.length})},[t.createVNode($e,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ce.value.length})),1)],8,tx)):t.createCommentVNode("",!0),S.value?(t.openBlock(),t.createElementBlock("footer",nx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:rt},t.toDisplayString(i("em.node.addAttr")),1),v[13]||(v[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:He},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),S.value&&!ae.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:yn,onPointermove:gn,onPointerup:Ee},null,32)):t.createCommentVNode("",!0)],38)}}}),[["__scopeId","data-v-00804c52"]]),ox={key:0,class:"em-sel","aria-hidden":"true"},ix={class:"em-group__label"},ax={class:"em-group__name"},rx={key:0,class:"em-group__pkg"},lx={key:1,class:"em-group__flag"},Lf=Ke(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>_t(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(oo,null),s=(R,x)=>l?l.t(R,x):Lt("ko",R,x),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var R;return!!n.id&&((R=l==null?void 0:l.selection.value)==null?void 0:R.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Ja,null),h=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),p=t.inject(Vo,null);function y(){n.id&&(p==null||p.setGroupHover(n.id))}function b(){p==null||p.setGroupHover(null)}const f=t.computed(()=>!!p&&p.hoverGroupId.value===n.id),g=t.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==n.id),{screenToFlowCoordinate:k,findNode:_}=je();let N=null,I=null;function $(R){var E;if(!n.id||!c.value)return;R.stopPropagation();const x=((E=_(n.id))==null?void 0:E.dimensions)??{width:400,height:300},M=k({x:R.clientX,y:R.clientY});N={fx:M.x,fy:M.y,w:x.width,h:x.height},R.target.setPointerCapture(R.pointerId)}function C(R){if(!N||!n.id)return;const x=k({x:R.clientX,y:R.clientY});I={width:Math.max(160,N.w+(x.x-N.fx)),height:Math.max(120,N.h+(x.y-N.fy))};const M=_(n.id);M&&(M.style={width:`${I.width}px`,height:`${I.height}px`})}function A(R){var x,M;N&&I&&n.id&&l&&l.resizeGroup(n.id,I),N=null,I=null,(M=(x=R.target).releasePointerCapture)==null||M.call(x,R.pointerId)}const T=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),V=t.computed(()=>{const R=o.value.name;return(R==null?void 0:R[T.value])||(R==null?void 0:R.ko)||(R==null?void 0:R.en)||(R==null?void 0:R.ja)||(R==null?void 0:R.zh)||o.value.packageName||s("em.group.fallback")});return(R,x)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":h.value,"is-hover-origin":f.value,"is-dimmed":g.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:b},[d.value?(t.openBlock(),t.createElementBlock("div",ox,[...x[0]||(x[0]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",ix,[t.createElementVNode("span",ax,t.toDisplayString(V.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",rx,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",lx,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock($e,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:$,onPointermove:C,onPointerup:A},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),sx={key:0,class:"em-sel","aria-hidden":"true"},cx={key:2,class:"em-note__text"},Of=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(oo,null),i=t.inject(Ja,null),a=t.inject(Vo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>_t(r.value.style)),c=t.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=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const h=t.computed(()=>{var E;return((E=a==null?void 0:a.source.value)==null?void 0:E.kind)==="note"&&a.source.value.id===n.id}),p=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!h.value),y=t.computed(()=>{var E;return((E=o==null?void 0:o.selection.value)==null?void 0:E.kind)==="note"&&o.selection.value.id===n.id}),b=t.computed(()=>!!n.selected&&!y.value),f=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),g=[{id:"n-top",pos:Te.Top},{id:"n-right",pos:Te.Right},{id:"n-bottom",pos:Te.Bottom},{id:"n-left",pos:Te.Left}],k=t.ref(!1),_=t.ref(""),N=t.ref(null);async function I(){var E;l.value&&(_.value=r.value.memo,k.value=!0,await t.nextTick(),(E=N.value)==null||E.focus())}function $(){k.value&&(k.value=!1,_.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,_.value)))}const{screenToFlowCoordinate:C,findNode:A}=je();let T=null,V=null;function R(E){var B;if(!l.value)return;E.stopPropagation();const w=((B=A(n.id))==null?void 0:B.dimensions)??r.value.geo.size,S=C({x:E.clientX,y:E.clientY});T={fx:S.x,fy:S.y,w:w.width,h:w.height},E.target.setPointerCapture(E.pointerId)}function x(E){if(!T)return;const w=C({x:E.clientX,y:E.clientY});V={width:Math.max(140,T.w+(w.x-T.fx)),height:Math.max(60,T.h+(w.y-T.fy))};const S=A(n.id);S&&(S.style={width:`${V.width}px`,height:`${V.height}px`})}function M(E){var w,S;T&&V&&o&&o.resizeNote(n.id,V),T=null,V=null,(S=(w=E.target).releasePointerCapture)==null||S.call(w,E.pointerId)}return(E,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":p.value,"is-dimmed":f.value,"is-selected":y.value,"is-multi-selected":b.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:I,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",sx,[...w[4]||(w[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),k.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:N,"onUpdate:modelValue":w[0]||(w[0]=S=>_.value=S),class:"em-note__edit nodrag",onBlur:$,onKeydown:w[1]||(w[1]=t.withKeys(S=>k.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,_.value]]):(t.openBlock(),t.createElementBlock("div",cx,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(g,S=>t.createVNode(t.unref(Zn),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!k.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:R,onPointermove:x,onPointerup:M},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Xa(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 Bo=.5;function Pf(e,n,o,i,a,r){const l=Xa(n),s=Xa(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let h=e;const p=(f,g)=>{(Math.abs(f.x-h.x)>=Bo||Math.abs(f.y-h.y)>=Bo)&&(m.push({a:h,b:f,seg:g}),h=f)};p(c,0);let y=l.x!==0,b=c;for(let f=1;f<u.length;f++){const g=u[f],k=f<=o.length?f-1:o.length,_=Math.abs(g.x-b.x)<Bo,N=Math.abs(g.y-b.y)<Bo;_&&N||(_?(p(g,k),y=!1):N?(p(g,k),y=!0):y?(p({x:b.x,y:g.y},k),p(g,k),y=!0):(p({x:g.x,y:b.y},k),p(g,k),y=!1),b=g)}return p(i,o.length),m}function zf(e,n,o,i,a,r=20){const l=Pf(e,n,o,i,a,r);let s=`M ${kt(e.x)},${kt(e.y)}`;for(const c of l)s+=` L ${kt(c.b.x)},${kt(c.b.y)}`;return s}const dx=14;function Ff(e,n,o,i,a,r=20){return Pf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=dx).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function kt(e){return Math.round(e*100)/100}const ux=36;function mx(e,n,o=ux){const i=Math.max(e.x,n.x)+o;return`M ${kt(e.x)},${kt(e.y)} L ${kt(i)},${kt(e.y)} L ${kt(i)},${kt(n.y)} L ${kt(n.x)},${kt(n.y)}`}function Uf(e,n,o){const i=[e,...n,o];let a=`M ${kt(i[0].x)},${kt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${kt(i[r].x)},${kt(i[r].y)}`;return a}function fx(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Hf(e,n){const o=fx(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Bo&&Math.abs(l)<Bo)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function jf(e,n,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:n},side:i?"right":"left"}}function Kf(e,n,o){const i=[e,...n,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const px=20,hx=22,yx=7,gx=22,Gf=31,Yf=7,bx=20,qf=11,Wf=11,_x=Gf+Yf;function kx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Ex(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Za(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function Jf(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function Qa(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function Xf(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Jf(e,n);return[Qa(o,a,r-Math.PI/2),Qa(o,a,r+Math.PI/2)]}function Zf(e,n,o,i){const a=n*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function Qf(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Za(e,n,px),[d,u]=Xf(e,n,c,hx);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}),kx(o.multiplicity)){const m=Za(e,n,Gf);r.push({cx:m.x,cy:m.y,r:Yf})}if(Ex(o.multiplicity)){const m=Za(e,n,yx),[h,p]=Xf(e,n,m,gx);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Za(e,n,bx),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Jf(e,n),m=Qa(d,qf/2,u-Math.PI/2),h=Qa(d,qf/2,u+Math.PI/2);l.push({points:[e,m,c,h]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=Zf(s,c,Wf,!0),u=Zf(s,c,Wf,!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:r,polygons:l}}const ep=200,tp=120,Zl=24;function np(e){var a,r;if(!e)return{x:0,y:0,width:ep,height:tp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||ep,i=((r=e.dimensions)==null?void 0:r.height)||tp;return{x:n.x,y:n.y,width:o,height:i}}function op(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ip(e){const n=t.computed(()=>np(e.sourceNode())),o=t.computed(()=>np(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var p,y;const d=n.value,u=d.x+d.width;let m=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,h=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(h-m)<Zl){const b=(m+h)/2;m=b-Zl/2,h=b+Zl/2}return{source:{x:u,y:m},target:{x:u,y:h}}}),r=t.computed(()=>e.waypoints()[0]??op(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??op(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?jf(n.value,d,r.value.x):Hf(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?jf(o.value,d,l.value.x):Hf(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const Ql=Symbol("waypointController"),Nx=["d"],wx=["d"],Ix=["d"],vx=["x1","y1","x2","y2"],Cx=["cx","cy","r"],xx=["x","y"],Sx=["x","y"],Rx=["cx","cy","onDblclick"],Ax=["x","y","onPointerdown","onDblclick"],ap=Ke(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(Ql),a=t.inject(oo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(vf,null),s=t.inject(Vo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var ie;return((ie=a==null?void 0:a.selection.value)==null?void 0:ie.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const ie=l==null?void 0:l.value;if(!ie||!a)return null;const se=a.resolved.value.entities,fe=L=>{var F;return(F=se.find(Q=>Q.entity.modelId===L))==null?void 0:F.groupRef},O=n.data.association;return fe(O.end1.entityRef)===ie.groupId&&fe(O.end2.entityRef)===ie.groupId?{dx:ie.dx,dy:ie.dy}:null}),h=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),p=t.ref(-1),y=t.ref({x:0,y:0}),b=t.computed(()=>{const ie=m.value;return h.value.map((se,fe)=>fe===p.value?y.value:ie?{x:se.x+ie.dx,y:se.y+ie.dy}:se)}),f=t.computed(()=>{var ie;return!!((ie=n.sourceNode.data)!=null&&ie.collapsed)}),g=t.computed(()=>{var ie;return!!((ie=n.targetNode.data)!=null&&ie.collapsed)}),{source:k,target:_,sourceSide:N,targetSide:I,isSelf:$}=ip({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>b.value,sourceRowY:()=>n.data.sourceColumnRef&&!f.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!g.value?n.targetY:void 0}),C=_x+4,A=t.computed(()=>$.value?mx(k.value,_.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?zf(k.value,N.value,b.value,_.value,I.value,C):Uf(k.value,b.value,_.value)),T=t.computed(()=>$.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Ff(k.value,N.value,b.value,_.value,I.value,C):Kf(k.value,b.value,_.value).map((ie,se)=>({point:ie,segIndex:se}))),V=t.computed(()=>$.value||!r.value?[]:b.value),R=Ui;function x(ie,se){p.value=ie,y.value={...h.value[ie]},se.target.setPointerCapture(se.pointerId),se.stopPropagation()}function M(ie){if(p.value<0)return;const se=o({x:ie.clientX,y:ie.clientY});y.value={x:se.x,y:se.y}}function E(ie){var se,fe;p.value>=0&&i&&i.movePoint(n.id,p.value,{...y.value}),p.value=-1,(fe=(se=ie.target).releasePointerCapture)==null||fe.call(se,ie.pointerId)}function w(ie,se){se.stopPropagation(),i==null||i.removePoint(n.id,ie)}function S(ie,se){if(!i)return;const fe=o({x:se.clientX,y:se.clientY});i.insertPoint(n.id,ie,{x:fe.x,y:fe.y})}const B=t.computed(()=>R(n.data.association.end1.multiplicity)),z=t.computed(()=>R(n.data.association.end2.multiplicity)),K=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),J=t.computed(()=>K.value==="class"),re=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ie=Xa(N.value);return{x:k.value.x+ie.x*10,y:k.value.y+ie.y*10}}return b.value[0]??_.value}),pe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const se=Xa(I.value);return{x:_.value.x+se.x*10,y:_.value.y+se.y*10}}const ie=b.value;return ie[ie.length-1]??k.value}),ce=t.computed(()=>{const ie=n.data.association;return{multiplicity:ie.end1.multiplicity,navigable:ie.end1.navigable,composition:ie.end1.composition,otherNavigable:ie.end2.navigable}}),Ne=t.computed(()=>{const ie=n.data.association;return{multiplicity:ie.end2.multiplicity,navigable:ie.end2.navigable,composition:ie.end2.composition,otherNavigable:ie.end1.navigable}}),he=t.computed(()=>Qf(k.value,re.value,ce.value,K.value)),de=t.computed(()=>Qf(_.value,pe.value,Ne.value,K.value)),_e=t.computed(()=>[...he.value.lines,...de.value.lines]),Se=t.computed(()=>[...he.value.circles,...de.value.circles]),me=t.computed(()=>[...he.value.polygons,...de.value.polygons].map(ie=>`M${ie.points.map(se=>`${se.x},${se.y}`).join(" L")} Z`)),ye=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ie,se)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:A.value,fill:"none",class:"em-edge__hit"},null,8,Nx),t.createElementVNode("path",{d:A.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,wx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me.value,(fe,O)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${O}`,d:fe,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",ye.value])},null,10,Ix))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,(fe,O)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${O}`,x1:fe.x1,y1:fe.y1,x2:fe.x2,y2:fe.y2,class:t.normalizeClass(["em-edge__marker",ye.value])},null,10,vx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(fe,O)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${O}`,cx:fe.cx,cy:fe.cy,r:fe.r,class:t.normalizeClass(["em-edge__marker",ye.value])},null,10,Cx))),128)),J.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(k).x+8,y:t.unref(k).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(B.value),11,xx),t.createElementVNode("text",{x:t.unref(_).x-8,y:t.unref(_).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(z.value),11,Sx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(fe,O)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${O}`,cx:fe.point.x,cy:fe.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(L=>S(fe.segIndex,L),["stop"])},null,42,Rx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.value,(fe,O)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${O}`,x:fe.x-5,y:fe.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>x(O,L),onPointermove:M,onPointerup:E,onDblclick:L=>w(O,L)},null,42,Ax))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var mn=(e=>(e.Lines="lines",e.Dots="dots",e))(mn||{});const rp=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},lp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};mn.Lines+"",mn.Dots+"";const $x={[mn.Dots]:"#81818a",[mn.Lines]:"#eee"},Tx=["id","x","y","width","height","patternTransform"],Mx={key:2,height:"100",width:"100"},Vx=["fill"],Bx=["x","y","fill"],Dx={name:"Background",compatConfig:{MODE:3}},Lx=t.defineComponent({...Dx,props:{id:{},variant:{default:()=>mn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=je(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[m*l||1+d[0]/2,h*l||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||$x[e.variant||mn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.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"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(mn).Lines?(t.openBlock(),t.createBlock(t.unref(rp),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(mn).Dots?(t.openBlock(),t.createBlock(t.unref(lp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",Mx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Vx)])):t.createCommentVNode("",!0)])],8,Tx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Bx),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),Ox={name:"ControlButton",compatConfig:{MODE:3}},Px=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},zx={type:"button",class:"vue-flow__controls-button"};function Fx(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",zx,[t.renderSlot(e.$slots,"default")])}const io=Px(Ox,[["render",Fx]]),Ux={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Hx=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function jx(e,n){return t.openBlock(),t.createElementBlock("svg",Ux,Hx)}const Kx={render:jx},Gx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Yx=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function qx(e,n){return t.openBlock(),t.createElementBlock("svg",Gx,Yx)}const Wx={render:qx},Jx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Xx=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function Zx(e,n){return t.openBlock(),t.createElementBlock("svg",Jx,Xx)}const Qx={render:Zx},eS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},tS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function nS(e,n){return t.openBlock(),t.createElementBlock("svg",eS,tS)}const oS={render:nS},iS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},aS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function rS(e,n){return t.openBlock(),t.createElementBlock("svg",iS,aS)}const lS={render:rS},sS={name:"Controls",compatConfig:{MODE:3}},cS=t.defineComponent({...sS,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>rm.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=je(),h=t.toRef(()=>o.value||i.value||a.value),p=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function b(){l(),n("zoomIn")}function f(){s(),n("zoomOut")}function g(){c(e.fitViewParams),n("fitView")}function k(){r(!h.value),n("interactionChange",!h.value)}return(_,N)=>(t.openBlock(),t.createBlock(t.unref(af),{class:"vue-flow__controls",position:_.position},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"top"),_.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(_.$slots,"control-zoom-in",{},()=>[t.createVNode(io,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:b},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Kx))))])]),_:3},8,["disabled"])]),t.renderSlot(_.$slots,"control-zoom-out",{},()=>[t.createVNode(io,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:f},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Wx))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),_.showFitView?t.renderSlot(_.$slots,"control-fit-view",{key:1},()=>[t.createVNode(io,{class:"vue-flow__controls-fitview",onClick:g},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Qx))))])]),_:3})]):t.createCommentVNode("",!0),_.showInteractive?t.renderSlot(_.$slots,"control-interactive",{key:2},()=>[_.showInteractive?(t.openBlock(),t.createBlock(io,{key:0,class:"vue-flow__controls-interactive",onClick:k},{default:t.withCtx(()=>[h.value?t.renderSlot(_.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(lS))))]):t.createCommentVNode("",!0),h.value?t.createCommentVNode("",!0):t.renderSlot(_.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(oS))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(_.$slots,"default")]),_:3},8,["position"]))}});var dS={value:()=>{}};function es(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new er(o)}function er(e){this._=e}function uS(e,n){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&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}er.prototype=es.prototype={constructor:er,on:function(e,n){var o=this._,i=uS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=mS(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=sp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=sp(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new er(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function mS(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function sp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=dS,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ts="http://www.w3.org/1999/xhtml";const cp={svg:"http://www.w3.org/2000/svg",xhtml:ts,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),cp.hasOwnProperty(n)?{space:cp[n],local:e}:e}function fS(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ts&&n.documentElement.namespaceURI===ts?n.createElement(e):n.createElementNS(o,e)}}function pS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function dp(e){var n=tr(e);return(n.local?pS:fS)(n)}function hS(){}function ns(e){return e==null?hS:function(){return this.querySelector(e)}}function yS(e){typeof e!="function"&&(e=ns(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Rt(i,this._parents)}function gS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function bS(){return[]}function up(e){return e==null?bS:function(){return this.querySelectorAll(e)}}function _S(e){return function(){return gS(e.apply(this,arguments))}}function kS(e){typeof e=="function"?e=_S(e):e=up(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Rt(i,a)}function mp(e){return function(){return this.matches(e)}}function fp(e){return function(n){return n.matches(e)}}var ES=Array.prototype.find;function NS(e){return function(){return ES.call(this.children,e)}}function wS(){return this.firstElementChild}function IS(e){return this.select(e==null?wS:NS(typeof e=="function"?e:fp(e)))}var vS=Array.prototype.filter;function CS(){return Array.from(this.children)}function xS(e){return function(){return vS.call(this.children,e)}}function SS(e){return this.selectAll(e==null?CS:xS(typeof e=="function"?e:fp(e)))}function RS(e){typeof e!="function"&&(e=mp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Rt(i,this._parents)}function pp(e){return new Array(e.length)}function AS(){return new Rt(this._enter||this._groups.map(pp),this._parents)}function nr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}nr.prototype={constructor:nr,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function $S(e){return function(){return e}}function TS(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new nr(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function MS(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),p;for(s=0;s<u;++s)(c=n[s])&&(h[s]=p=l.call(c,c.__data__,s,n)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new nr(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function VS(e){return e.__data__}function BS(e,n){if(!arguments.length)return Array.from(this,VS);var o=n?MS:TS,i=this._parents,a=this._groups;typeof e!="function"&&(e=$S(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,p=DS(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),f=l[d]=new Array(y),g=c[d]=new Array(h);o(u,m,b,f,g,p,n);for(var k=0,_=0,N,I;k<y;++k)if(N=b[k]){for(k>=_&&(_=k+1);!(I=f[_])&&++_<y;);N._next=I||null}}return l=new Rt(l,i),l._enter=s,l._exit=c,l}function DS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function LS(){return new Rt(this._exit||this._groups.map(pp),this._parents)}function OS(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function PS(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(h[y]=p);for(;c<a;++c)s[c]=o[c];return new Rt(s,this._parents)}function zS(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function FS(e){e||(e=US);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Rt(a,this._parents).order()}function US(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function HS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function jS(){return Array.from(this)}function KS(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function GS(){let e=0;for(const n of this)++e;return e}function YS(){return!this.node()}function qS(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function WS(e){return function(){this.removeAttribute(e)}}function JS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function XS(e,n){return function(){this.setAttribute(e,n)}}function ZS(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function QS(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function eR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function tR(e,n){var o=tr(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?JS:WS:typeof n=="function"?o.local?eR:QS:o.local?ZS:XS)(o,n))}function hp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function nR(e){return function(){this.style.removeProperty(e)}}function oR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function iR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function aR(e,n,o){return arguments.length>1?this.each((n==null?nR:typeof n=="function"?iR:oR)(e,n,o??"")):Do(this.node(),e)}function Do(e,n){return e.style.getPropertyValue(n)||hp(e).getComputedStyle(e,null).getPropertyValue(n)}function rR(e){return function(){delete this[e]}}function lR(e,n){return function(){this[e]=n}}function sR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function cR(e,n){return arguments.length>1?this.each((n==null?rR:typeof n=="function"?sR:lR)(e,n)):this.node()[e]}function yp(e){return e.trim().split(/^|\s+/)}function os(e){return e.classList||new gp(e)}function gp(e){this._node=e,this._names=yp(e.getAttribute("class")||"")}gp.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function bp(e,n){for(var o=os(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function _p(e,n){for(var o=os(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function dR(e){return function(){bp(this,e)}}function uR(e){return function(){_p(this,e)}}function mR(e,n){return function(){(n.apply(this,arguments)?bp:_p)(this,e)}}function fR(e,n){var o=yp(e+"");if(arguments.length<2){for(var i=os(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?mR:n?dR:uR)(o,n))}function pR(){this.textContent=""}function hR(e){return function(){this.textContent=e}}function yR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function gR(e){return arguments.length?this.each(e==null?pR:(typeof e=="function"?yR:hR)(e)):this.node().textContent}function bR(){this.innerHTML=""}function _R(e){return function(){this.innerHTML=e}}function kR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function ER(e){return arguments.length?this.each(e==null?bR:(typeof e=="function"?kR:_R)(e)):this.node().innerHTML}function NR(){this.nextSibling&&this.parentNode.appendChild(this)}function wR(){return this.each(NR)}function IR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vR(){return this.each(IR)}function CR(e){var n=typeof e=="function"?e:dp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function xR(){return null}function SR(e,n){var o=typeof e=="function"?e:dp(e),i=n==null?xR:typeof n=="function"?n:ns(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function RR(){var e=this.parentNode;e&&e.removeChild(this)}function AR(){return this.each(RR)}function $R(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function TR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function MR(e){return this.select(e?TR:$R)}function VR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function BR(e){return function(n){e.call(this,n,this.__data__)}}function DR(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function LR(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function OR(e,n,o){return function(){var i=this.__on,a,r=BR(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function PR(e,n,o){var i=DR(e+""),a,r=i.length,l;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<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?OR:LR,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function kp(e,n,o){var i=hp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function zR(e,n){return function(){return kp(this,e,n)}}function FR(e,n){return function(){return kp(this,e,n.apply(this,arguments))}}function UR(e,n){return this.each((typeof n=="function"?FR:zR)(e,n))}function*HR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Ep=[null];function Rt(e,n){this._groups=e,this._parents=n}function Ni(){return new Rt([[document.documentElement]],Ep)}function jR(){return this}Rt.prototype=Ni.prototype={constructor:Rt,select:yS,selectAll:kS,selectChild:IS,selectChildren:SS,filter:RS,data:BS,enter:AS,exit:LS,join:OS,merge:PS,selection:jR,order:zS,sort:FS,call:HS,nodes:jS,node:KS,size:GS,empty:YS,each:qS,attr:tR,style:aR,property:cR,classed:fR,text:gR,html:ER,raise:wR,lower:vR,append:CR,insert:SR,remove:AR,clone:MR,datum:VR,on:PR,dispatch:UR,[Symbol.iterator]:HR};function An(e){return typeof e=="string"?new Rt([[document.querySelector(e)]],[document.documentElement]):new Rt([[e]],Ep)}function KR(e){let n;for(;n=e.sourceEvent;)e=n;return e}function $n(e,n){if(e=KR(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const is={capture:!0,passive:!1};function as(e){e.preventDefault(),e.stopImmediatePropagation()}function GR(e){var n=e.document.documentElement,o=An(e).on("dragstart.drag",as,is);"onselectstart"in n?o.on("selectstart.drag",as,is):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function YR(e,n){var o=e.document.documentElement,i=An(e).on("dragstart.drag",null);n&&(i.on("click.drag",as,is),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 rs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Np(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function wi(){}var Ii=.7,or=1/Ii,Lo="\\s*([+-]?\\d+)\\s*",vi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",qR=/^#([0-9a-f]{3,8})$/,WR=new RegExp(`^rgb\\(${Lo},${Lo},${Lo}\\)$`),JR=new RegExp(`^rgb\\(${Xt},${Xt},${Xt}\\)$`),XR=new RegExp(`^rgba\\(${Lo},${Lo},${Lo},${vi}\\)$`),ZR=new RegExp(`^rgba\\(${Xt},${Xt},${Xt},${vi}\\)$`),QR=new RegExp(`^hsl\\(${vi},${Xt},${Xt}\\)$`),eA=new RegExp(`^hsla\\(${vi},${Xt},${Xt},${vi}\\)$`),wp={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};rs(wi,Ci,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ip,formatHex:Ip,formatHex8:tA,formatHsl:nA,formatRgb:vp,toString:vp});function Ip(){return this.rgb().formatHex()}function tA(){return this.rgb().formatHex8()}function nA(){return Ap(this).formatHsl()}function vp(){return this.rgb().formatRgb()}function Ci(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=qR.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Cp(n):o===3?new vt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ir(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ir(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=WR.exec(e))?new vt(n[1],n[2],n[3],1):(n=JR.exec(e))?new vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=XR.exec(e))?ir(n[1],n[2],n[3],n[4]):(n=ZR.exec(e))?ir(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=QR.exec(e))?Rp(n[1],n[2]/100,n[3]/100,1):(n=eA.exec(e))?Rp(n[1],n[2]/100,n[3]/100,n[4]):wp.hasOwnProperty(e)?Cp(wp[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function Cp(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function ir(e,n,o,i){return i<=0&&(e=n=o=NaN),new vt(e,n,o,i)}function oA(e){return e instanceof wi||(e=Ci(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function ls(e,n,o,i){return arguments.length===1?oA(e):new vt(e,n,o,i??1)}function vt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}rs(vt,ls,Np(wi,{brighter(e){return e=e==null?or:Math.pow(or,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ii:Math.pow(Ii,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(ao(this.r),ao(this.g),ao(this.b),ar(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:xp,formatHex:xp,formatHex8:iA,formatRgb:Sp,toString:Sp}));function xp(){return`#${ro(this.r)}${ro(this.g)}${ro(this.b)}`}function iA(){return`#${ro(this.r)}${ro(this.g)}${ro(this.b)}${ro((isNaN(this.opacity)?1:this.opacity)*255)}`}function Sp(){const e=ar(this.opacity);return`${e===1?"rgb(":"rgba("}${ao(this.r)}, ${ao(this.g)}, ${ao(this.b)}${e===1?")":`, ${e})`}`}function ar(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ao(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ro(e){return e=ao(e),(e<16?"0":"")+e.toString(16)}function Rp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Pt(e,n,o,i)}function Ap(e){if(e instanceof Pt)return new Pt(e.h,e.s,e.l,e.opacity);if(e instanceof wi||(e=Ci(e)),!e)return new Pt;if(e instanceof Pt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Pt(l,s,c,e.opacity)}function aA(e,n,o,i){return arguments.length===1?Ap(e):new Pt(e,n,o,i??1)}function Pt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}rs(Pt,aA,Np(wi,{brighter(e){return e=e==null?or:Math.pow(or,e),new Pt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ii:Math.pow(Ii,e),new Pt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new vt(ss(e>=240?e-240:e+120,a,i),ss(e,a,i),ss(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Pt($p(this.h),rr(this.s),rr(this.l),ar(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=ar(this.opacity);return`${e===1?"hsl(":"hsla("}${$p(this.h)}, ${rr(this.s)*100}%, ${rr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function $p(e){return e=(e||0)%360,e<0?e+360:e}function rr(e){return Math.max(0,Math.min(1,e||0))}function ss(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Tp=e=>()=>e;function rA(e,n){return function(o){return e+o*n}}function lA(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function sA(e){return(e=+e)==1?Mp:function(n,o){return o-n?lA(n,o,e):Tp(isNaN(n)?o:n)}}function Mp(e,n){var o=n-e;return o?rA(e,o):Tp(isNaN(e)?n:e)}const Vp=(function e(n){var o=sA(n);function i(a,r){var l=o((a=ls(a)).r,(r=ls(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Mp(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Tn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var cs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ds=new RegExp(cs.source,"g");function cA(e){return function(){return e}}function dA(e){return function(n){return e(n)+""}}function uA(e,n){var o=cs.lastIndex=ds.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=cs.exec(e))&&(a=ds.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Tn(i,a)})),o=ds.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?dA(c[0].x):cA(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var Bp=180/Math.PI,us={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Dp(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Bp,skewX:Math.atan(c)*Bp,scaleX:l,scaleY:s}}var lr;function mA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?us:Dp(n.a,n.b,n.c,n.d,n.e,n.f)}function fA(e){return e==null||(lr||(lr=document.createElementNS("http://www.w3.org/2000/svg","g")),lr.setAttribute("transform",e),!(e=lr.transform.baseVal.consolidate()))?us:(e=e.matrix,Dp(e.a,e.b,e.c,e.d,e.e,e.f))}function Lp(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push("translate(",null,n,null,o);y.push({i:b-4,x:Tn(d,m)},{i:b-2,x:Tn(u,h)})}else(m||h)&&p.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Tn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Tn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:Tn(d,m)},{i:b-2,x:Tn(u,h)})}else(m!==1||h!==1)&&p.push(a(p)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(p){for(var y=-1,b=h.length,f;++y<b;)m[(f=h[y]).i]=f.x(p);return m.join("")}}}var pA=Lp(mA,"px, ","px)","deg)"),hA=Lp(fA,", ",")",")"),yA=1e-12;function Op(e){return((e=Math.exp(e))+1/e)/2}function gA(e){return((e=Math.exp(e))-1/e)/2}function bA(e){return((e=Math.exp(2*e))-1)/(e+1)}const _A=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],p=u-s,y=m-c,b=p*p+y*y,f,g;if(b<yA)g=Math.log(h/d)/n,f=function(C){return[s+C*p,c+C*y,d*Math.exp(n*C*g)]};else{var k=Math.sqrt(b),_=(h*h-d*d+i*b)/(2*d*o*k),N=(h*h-d*d-i*b)/(2*h*o*k),I=Math.log(Math.sqrt(_*_+1)-_),$=Math.log(Math.sqrt(N*N+1)-N);g=($-I)/n,f=function(C){var A=C*g,T=Op(I),V=d/(o*k)*(T*bA(n*A+I)-gA(I));return[s+V*p,c+V*y,d*T/Op(n*A+I)]}}return f.duration=g*1e3*n/Math.SQRT2,f}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Oo=0,xi=0,Si=0,Pp=1e3,sr,Ri,cr=0,lo=0,dr=0,Ai=typeof performance=="object"&&performance.now?performance:Date,zp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ms(){return lo||(zp(kA),lo=Ai.now()+dr)}function kA(){lo=0}function ur(){this._call=this._time=this._next=null}ur.prototype=Fp.prototype={constructor:ur,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ms():+o)+(n==null?0:+n),!this._next&&Ri!==this&&(Ri?Ri._next=this:sr=this,Ri=this),this._call=e,this._time=o,fs()},stop:function(){this._call&&(this._call=null,this._time=1/0,fs())}};function Fp(e,n,o){var i=new ur;return i.restart(e,n,o),i}function EA(){ms(),++Oo;for(var e=sr,n;e;)(n=lo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Oo}function Up(){lo=(cr=Ai.now())+dr,Oo=xi=0;try{EA()}finally{Oo=0,wA(),lo=0}}function NA(){var e=Ai.now(),n=e-cr;n>Pp&&(dr-=n,cr=e)}function wA(){for(var e,n=sr,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:sr=o);Ri=e,fs(i)}function fs(e){if(!Oo){xi&&(xi=clearTimeout(xi));var n=e-lo;n>24?(e<1/0&&(xi=setTimeout(Up,e-Ai.now()-dr)),Si&&(Si=clearInterval(Si))):(Si||(cr=Ai.now(),Si=setInterval(NA,Pp)),Oo=1,zp(Up))}}function Hp(e,n,o){var i=new ur;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var IA=es("start","end","cancel","interrupt"),vA=[],jp=0,Kp=1,ps=2,mr=3,Gp=4,hs=5,fr=6;function pr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;CA(e,o,{name:n,index:i,group:a,on:IA,tween:vA,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:jp})}function ys(e,n){var o=zt(e,n);if(o.state>jp)throw new Error("too late; already scheduled");return o}function Zt(e,n){var o=zt(e,n);if(o.state>mr)throw new Error("too late; already running");return o}function zt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function CA(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Fp(r,0,o.time);function r(d){o.state=Kp,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,p;if(o.state!==Kp)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===mr)return Hp(l);p.state===Gp?(p.state=fr,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<n&&(p.state=fr,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Hp(function(){o.state===mr&&(o.state=Gp,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ps,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ps){for(o.state=mr,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=hs,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===hs&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=fr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function hr(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>ps&&i.state<hs,i.state=fr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function xA(e){return this.each(function(){hr(this,e)})}function SA(e,n){var o,i;return function(){var a=Zt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function RA(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Zt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function AA(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=zt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?SA:RA)(o,e,n))}function gs(e,n,o){var i=e._id;return e.each(function(){var a=Zt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return zt(a,i).value[n]}}function Yp(e,n){var o;return(typeof n=="number"?Tn:n instanceof Ci?Vp:(o=Ci(n))?(n=o,Vp):uA)(e,n)}function $A(e){return function(){this.removeAttribute(e)}}function TA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function MA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function VA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function BA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function DA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function LA(e,n){var o=tr(e),i=o==="transform"?hA:Yp;return this.attrTween(e,typeof n=="function"?(o.local?DA:BA)(o,i,gs(this,"attr."+e,n)):n==null?(o.local?TA:$A)(o):(o.local?VA:MA)(o,i,n))}function OA(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function PA(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function zA(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&PA(e,r)),o}return a._value=n,a}function FA(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&OA(e,r)),o}return a._value=n,a}function UA(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=tr(e);return this.tween(o,(i.local?zA:FA)(i,n))}function HA(e,n){return function(){ys(this,e).delay=+n.apply(this,arguments)}}function jA(e,n){return n=+n,function(){ys(this,e).delay=n}}function KA(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?HA:jA)(n,e)):zt(this.node(),n).delay}function GA(e,n){return function(){Zt(this,e).duration=+n.apply(this,arguments)}}function YA(e,n){return n=+n,function(){Zt(this,e).duration=n}}function qA(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?GA:YA)(n,e)):zt(this.node(),n).duration}function WA(e,n){if(typeof n!="function")throw new Error;return function(){Zt(this,e).ease=n}}function JA(e){var n=this._id;return arguments.length?this.each(WA(n,e)):zt(this.node(),n).ease}function XA(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Zt(this,e).ease=o}}function ZA(e){if(typeof e!="function")throw new Error;return this.each(XA(this._id,e))}function QA(e){typeof e!="function"&&(e=mp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new fn(i,this._parents,this._name,this._id)}function e$(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||d[p])&&(m[p]=h);for(;s<i;++s)l[s]=n[s];return new fn(l,this._parents,this._name,this._id)}function t$(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function n$(e,n,o){var i,a,r=t$(n)?ys:Zt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function o$(e,n){var o=this._id;return arguments.length<2?zt(this.node(),o).on.on(e):this.each(n$(o,e,n))}function i$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function a$(){return this.on("end.remove",i$(this._id))}function r$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ns(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,pr(d[h],n,o,h,d,zt(u,o)));return new fn(r,this._parents,n,o)}function l$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=up(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),p,y=zt(u,o),b=0,f=h.length;b<f;++b)(p=h[b])&&pr(p,n,o,b,h,y);r.push(h),l.push(u)}return new fn(r,l,n,o)}var s$=Ni.prototype.constructor;function c$(){return new s$(this._groups,this._parents)}function d$(e,n){var o,i,a;return function(){var r=Do(this,e),l=(this.style.removeProperty(e),Do(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function qp(e){return function(){this.style.removeProperty(e)}}function u$(e,n,o){var i,a=o+"",r;return function(){var l=Do(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function m$(e,n,o){var i,a,r;return function(){var l=Do(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Do(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function f$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Zt(this,e),d=c.on,u=c.value[r]==null?s||(s=qp(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function p$(e,n,o){var i=(e+="")=="transform"?pA:Yp;return n==null?this.styleTween(e,d$(e,i)).on("end.style."+e,qp(e)):typeof n=="function"?this.styleTween(e,m$(e,i,gs(this,"style."+e,n))).each(f$(this._id,e)):this.styleTween(e,u$(e,i,n),o).on("end.style."+e,null)}function h$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function y$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&h$(e,l,o)),i}return r._value=n,r}function g$(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,y$(e,n,o??""))}function b$(e){return function(){this.textContent=e}}function _$(e){return function(){var n=e(this);this.textContent=n??""}}function k$(e){return this.tween("text",typeof e=="function"?_$(gs(this,"text",e)):b$(e==null?"":e+""))}function E$(e){return function(n){this.textContent=e.call(this,n)}}function N$(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&E$(a)),n}return i._value=e,i}function w$(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,N$(e))}function I$(){for(var e=this._name,n=this._id,o=Wp(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=zt(c,n);pr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new fn(i,this._parents,e,o)}function v$(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Zt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var C$=0;function fn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Wp(){return++C$}var pn=Ni.prototype;fn.prototype={constructor:fn,select:r$,selectAll:l$,selectChild:pn.selectChild,selectChildren:pn.selectChildren,filter:QA,merge:e$,selection:c$,transition:I$,call:pn.call,nodes:pn.nodes,node:pn.node,size:pn.size,empty:pn.empty,each:pn.each,on:o$,attr:LA,attrTween:UA,style:p$,styleTween:g$,text:k$,textTween:w$,remove:a$,tween:AA,delay:KA,duration:qA,ease:JA,easeVarying:ZA,end:v$,[Symbol.iterator]:pn[Symbol.iterator]};function x$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var S$={time:null,delay:0,duration:250,ease:x$};function R$(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function A$(e){var n,o;e instanceof fn?(n=e._id,e=e._name):(n=Wp(),(o=S$).time=ms(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&pr(c,e,n,d,l,o||R$(c,n));return new fn(i,this._parents,e,n)}Ni.prototype.interrupt=xA,Ni.prototype.transition=A$;const yr=e=>()=>e;function $$(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function hn(e,n,o){this.k=e,this.x=n,this.y=o}hn.prototype={constructor:hn,scale:function(e){return e===1?this:new hn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new hn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var bs=new hn(1,0,0);hn.prototype;function _s(e){e.stopImmediatePropagation()}function $i(e){e.preventDefault(),e.stopImmediatePropagation()}function T$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function M$(){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 Jp(){return this.__zoom||bs}function V$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function B$(){return navigator.maxTouchPoints||"ontouchstart"in this}function D$(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function L$(){var e=T$,n=M$,o=D$,i=V$,a=B$,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=_A,d=es("start","zoom","end"),u,m,h,p=500,y=150,b=0,f=10;function g(E){E.property("__zoom",Jp).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(a).on("touchstart.zoom",R).on("touchmove.zoom",x).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(E,w,S,B){var z=E.selection?E.selection():E;z.property("__zoom",Jp),E!==z?I(E,w,S,B):z.interrupt().each(function(){$(this,arguments).event(B).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},g.scaleBy=function(E,w,S,B){g.scaleTo(E,function(){var z=this.__zoom.k,K=typeof w=="function"?w.apply(this,arguments):w;return z*K},S,B)},g.scaleTo=function(E,w,S,B){g.transform(E,function(){var z=n.apply(this,arguments),K=this.__zoom,J=S==null?N(z):typeof S=="function"?S.apply(this,arguments):S,re=K.invert(J),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(k(K,pe),J,re),z,l)},S,B)},g.translateBy=function(E,w,S,B){g.transform(E,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof S=="function"?S.apply(this,arguments):S),n.apply(this,arguments),l)},null,B)},g.translateTo=function(E,w,S,B,z){g.transform(E,function(){var K=n.apply(this,arguments),J=this.__zoom,re=B==null?N(K):typeof B=="function"?B.apply(this,arguments):B;return o(bs.translate(re[0],re[1]).scale(J.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof S=="function"?-S.apply(this,arguments):-S),K,l)},B,z)};function k(E,w){return w=Math.max(r[0],Math.min(r[1],w)),w===E.k?E:new hn(w,E.x,E.y)}function _(E,w,S){var B=w[0]-S[0]*E.k,z=w[1]-S[1]*E.k;return B===E.x&&z===E.y?E:new hn(E.k,B,z)}function N(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function I(E,w,S,B){E.on("start.zoom",function(){$(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(B).end()}).tween("zoom",function(){var z=this,K=arguments,J=$(z,K).event(B),re=n.apply(z,K),pe=S==null?N(re):typeof S=="function"?S.apply(z,K):S,ce=Math.max(re[1][0]-re[0][0],re[1][1]-re[0][1]),Ne=z.__zoom,he=typeof w=="function"?w.apply(z,K):w,de=c(Ne.invert(pe).concat(ce/Ne.k),he.invert(pe).concat(ce/he.k));return function(_e){if(_e===1)_e=he;else{var Se=de(_e),me=ce/Se[2];_e=new hn(me,pe[0]-Se[0]*me,pe[1]-Se[1]*me)}J.zoom(null,_e)}})}function $(E,w,S){return!S&&E.__zooming||new C(E,w)}function C(E,w){this.that=E,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(E,w),this.taps=0}C.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,w){return this.mouse&&E!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&E!=="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(E){var w=An(this.that).datum();d.call(E,this.that,new $$(E,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),w)}};function A(E,...w){if(!e.apply(this,arguments))return;var S=$(this,w).event(E),B=this.__zoom,z=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),K=$n(E);if(S.wheel)(S.mouse[0][0]!==K[0]||S.mouse[0][1]!==K[1])&&(S.mouse[1]=B.invert(S.mouse[0]=K)),clearTimeout(S.wheel);else{if(B.k===z)return;S.mouse=[K,B.invert(K)],hr(this),S.start()}$i(E),S.wheel=setTimeout(J,y),S.zoom("mouse",o(_(k(B,z),S.mouse[0],S.mouse[1]),S.extent,l));function J(){S.wheel=null,S.end()}}function T(E,...w){if(h||!e.apply(this,arguments))return;var S=E.currentTarget,B=$(this,w,!0).event(E),z=An(E.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ce,!0),K=$n(E,S),J=E.clientX,re=E.clientY;GR(E.view),_s(E),B.mouse=[K,this.__zoom.invert(K)],hr(this),B.start();function pe(Ne){if($i(Ne),!B.moved){var he=Ne.clientX-J,de=Ne.clientY-re;B.moved=he*he+de*de>b}B.event(Ne).zoom("mouse",o(_(B.that.__zoom,B.mouse[0]=$n(Ne,S),B.mouse[1]),B.extent,l))}function ce(Ne){z.on("mousemove.zoom mouseup.zoom",null),YR(Ne.view,B.moved),$i(Ne),B.event(Ne).end()}}function V(E,...w){if(e.apply(this,arguments)){var S=this.__zoom,B=$n(E.changedTouches?E.changedTouches[0]:E,this),z=S.invert(B),K=S.k*(E.shiftKey?.5:2),J=o(_(k(S,K),B,z),n.apply(this,w),l);$i(E),s>0?An(this).transition().duration(s).call(I,J,B,E):An(this).call(g.transform,J,B,E)}}function R(E,...w){if(e.apply(this,arguments)){var S=E.touches,B=S.length,z=$(this,w,E.changedTouches.length===B).event(E),K,J,re,pe;for(_s(E),J=0;J<B;++J)re=S[J],pe=$n(re,this),pe=[pe,this.__zoom.invert(pe),re.identifier],z.touch0?!z.touch1&&z.touch0[2]!==pe[2]&&(z.touch1=pe,z.taps=0):(z.touch0=pe,K=!0,z.taps=1+!!u);u&&(u=clearTimeout(u)),K&&(z.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},p)),hr(this),z.start())}}function x(E,...w){if(this.__zooming){var S=$(this,w).event(E),B=E.changedTouches,z=B.length,K,J,re,pe;for($i(E),K=0;K<z;++K)J=B[K],re=$n(J,this),S.touch0&&S.touch0[2]===J.identifier?S.touch0[0]=re:S.touch1&&S.touch1[2]===J.identifier&&(S.touch1[0]=re);if(J=S.that.__zoom,S.touch1){var ce=S.touch0[0],Ne=S.touch0[1],he=S.touch1[0],de=S.touch1[1],_e=(_e=he[0]-ce[0])*_e+(_e=he[1]-ce[1])*_e,Se=(Se=de[0]-Ne[0])*Se+(Se=de[1]-Ne[1])*Se;J=k(J,Math.sqrt(_e/Se)),re=[(ce[0]+he[0])/2,(ce[1]+he[1])/2],pe=[(Ne[0]+de[0])/2,(Ne[1]+de[1])/2]}else if(S.touch0)re=S.touch0[0],pe=S.touch0[1];else return;S.zoom("touch",o(_(J,re,pe),S.extent,l))}}function M(E,...w){if(this.__zooming){var S=$(this,w).event(E),B=E.changedTouches,z=B.length,K,J;for(_s(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),K=0;K<z;++K)J=B[K],S.touch0&&S.touch0[2]===J.identifier?delete S.touch0:S.touch1&&S.touch1[2]===J.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(J=$n(J,this),Math.hypot(m[0]-J[0],m[1]-J[1])<f)){var re=An(this).on("dblclick.zoom");re&&re.apply(this,arguments)}}}return g.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:yr(+E),g):i},g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:yr(!!E),g):e},g.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:yr(!!E),g):a},g.extent=function(E){return arguments.length?(n=typeof E=="function"?E:yr([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),g):n},g.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],g):[r[0],r[1]]},g.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],g):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},g.constrain=function(E){return arguments.length?(o=E,g):o},g.duration=function(E){return arguments.length?(s=+E,g):s},g.interpolate=function(E){return arguments.length?(c=E,g):c},g.on=function(){var E=d.on.apply(d,arguments);return E===d?g:E},g.clickDistance=function(E){return arguments.length?(b=(E=+E)*E,g):Math.sqrt(b)},g.tapDistance=function(E){return arguments.length?(f=+E,g):f},g}const Xp=Symbol("MiniMapSlots"),O$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],P$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},z$=t.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:n}){const o=e,i=t.inject(Xp),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,h)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,O$))],64)):t.createCommentVNode("",!0)}}),F$=["width","height","viewBox","aria-labelledby"],U$=["id"],H$=["d","fill","stroke","stroke-width"],j$={name:"MiniMap",compatConfig:{MODE:3}},K$=t.defineComponent({...j$,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:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:h,d3Zoom:p,getNodesInitialized:y}=je(),b=t.ref();t.provide(Xp,o);const f=t.toRef(()=>{var z;return e.width??((z=i.style)==null?void 0:z.width)??a}),g=t.toRef(()=>{var z;return e.height??((z=i.style)==null?void 0:z.height)??r}),k=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",_=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),I=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),$=t.computed(()=>Ml(y.value.filter(z=>!z.hidden))),C=t.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})),A=t.computed(()=>y.value&&y.value.length?f0($.value,C.value):C.value),T=t.computed(()=>{const z=A.value.width/f.value,K=A.value.height/g.value;return Math.max(z,K)}),V=t.computed(()=>{const z=T.value*f.value,K=T.value*g.value,J=e.offsetScale*T.value;return{offset:J,x:A.value.x-(z-A.value.width)/2-J,y:A.value.y-(K-A.value.height)/2-J,width:z+J*2,height:K+J*2}}),R=t.computed(()=>!V.value.x||!V.value.y?"":`
|
|
53
|
-
M${
|
|
54
|
-
h${
|
|
55
|
-
v${
|
|
56
|
-
h${-
|
|
57
|
-
M${
|
|
58
|
-
h${
|
|
52
|
+
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 ft extends Error{constructor(n,...o){var i;super((i=Dm[n])==null?void 0:i.call(Dm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Fl(e){return"clientX"in e}function A0(e){return"sourceEvent"in e}function Jt(e,n){const o=Fl(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}}const ki=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function $0(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function La(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const T0=()=>!0;function Ul(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function M0(e,n,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of n.values())Va(a,Ma(r))>0&&i.push(r);return i}const V0=250;function B0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=M0(e,o,n+V0);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:p,y:f}=$o(d,m,m.position,!0),h=Math.sqrt((p-e.x)**2+(f-e.y)**2);h>n||(h<s?(l=[{...m,x:p,y:f}],s=h):h===s&&l.push({...m,x:p,y:f}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function Om(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=T0},u,m,p,f){const h=r==="target",g=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:k,y:N}=Jt(e),b=l.elementFromPoint(k,N),_=b!=null&&b.classList.contains(`${s}-flow__handle`)?b:g,E={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const I=Lm(void 0,_),A=_.getAttribute("data-nodeid"),T=_.getAttribute("data-handleid"),L=_.classList.contains("connectable"),x=_.classList.contains("connectableend");if(!A||!I)return E;const R={source:h?A:i,sourceHandle:h?T:a,target:h?i:A,targetHandle:h?a:T};E.connection=R;const B=L&&x&&(o===cn.Strict?h&&I==="source"||!h&&I==="target":A!==i||T!==a);E.isValid=B&&d(R,{nodes:m,edges:u,sourceNode:p(R.source),targetNode:p(R.target)}),E.toHandle=Pm(A,I,T,f,o,!0)}return E}function Lm(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function D0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function O0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Pm(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===cn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...$o(d,m,m.position,!0)}:m}const Hl={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},L0=["production","prod"];function Ei(e,...n){zm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function zm(){return!L0.includes(process.env.NODE_ENV||"")}function Fm(e,n,o,i,a){const r=n.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Ba(l)}}):null}function jl(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ct(e){return typeof t.unref(e)<"u"}function P0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ft(st.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return vn(e)?a=e:a={...e,id:km(e)},a=bm(a,void 0,i),_0(a,n)?!1:a}function z0(e,n,o,i,a){if(!n.source||!n.target)return a(new ft(st.EDGE_INVALID,e.id)),!1;if(!o)return a(new ft(st.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?km(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Um(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Wn(l)){o(new ft(st.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=y0(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new ft(st.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Hm(e,n,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,n)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,n)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,n))}}function Kl(e,n,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;Hm("source",c,u,e,a,l),Hm("target",c,d,e,r,s)}}function jm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Gl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=vn(d)?d:P0(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new ft(st.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ft(st.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new ft(st.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new ft(st.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...bm(u,f,r),sourceNode:m,targetNode:p})}return c}const Km=Symbol("vueFlow"),Gm=Symbol("nodeId"),Ym=Symbol("nodeRef"),F0=Symbol("edgeId"),U0=Symbol("edgeRef"),Pa=Symbol("slots");function qm(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:p,findNode:f,multiSelectionActive:h,nodesSelectionActive:g,selectNodesOnDrag:k,removeSelectedElements:N,addSelectedNodes:b,updateNodePositions:_,emits:E}=je(),{onStart:I,onDrag:A,onStop:T,onClick:L,el:x,disabled:R,id:$,selectable:B,dragHandle:O}=e,y=t.shallowRef(!1);let w=[],v,M=null,D={x:void 0,y:void 0},U={x:0,y:0},W=null,ie=!1,pe=!1,ye=0,ge=!1;const me=K0(),se=({x:le,y:ue})=>{D={x:le,y:ue};let z=!1;if(w=w.map(P=>{const F={x:le-P.distance.x,y:ue-P.distance.y},{computedPosition:Q}=zl(P,o.value?La(F,i.value):F,E.error,l.value,P.parentNode?f(P.parentNode):void 0);return z=z||P.position.x!==Q.x||P.position.y!==Q.y,P.position=Q,P}),pe=pe||z,!!z&&(_(w,!0,!0),y.value=!0,W)){const[P,F]=Pl({id:$,dragItems:w,findNode:f});A({event:W,node:P,nodes:F})}},ke=()=>{if(!M)return;const[le,ue]=Cm(U,M,u.value);if(le!==0||ue!==0){const z={x:(D.x??0)-le/c.value.zoom,y:(D.y??0)-ue/c.value.zoom};p({x:le,y:ue})&&se(z)}ye=requestAnimationFrame(ke)},Se=(le,ue)=>{ie=!0;const z=f($);!k.value&&!h.value&&z&&(z.selected||N()),z&&t.toValue(B)&&k.value&&jl(z,h.value,b,N,g,!1,ue);const P=me(le.sourceEvent);if(D=P,w=I0(r.value,m.value,P,$),w.length){const[F,Q]=Pl({id:$,dragItems:w,findNode:f});I({event:le.sourceEvent,node:F,nodes:Q})}},ce=(le,ue)=>{var z;le.sourceEvent.type==="touchmove"&&le.sourceEvent.touches.length>1||(pe=!1,s.value===0&&Se(le,ue),D=me(le.sourceEvent),M=((z=n.value)==null?void 0:z.getBoundingClientRect())||null,U=Jt(le.sourceEvent,M))},fe=(le,ue)=>{const z=me(le.sourceEvent);if(!ge&&ie&&d.value&&(ge=!0,ke()),!ie){const P=z.xSnapped-(D.x??0),F=z.ySnapped-(D.y??0);Math.sqrt(P*P+F*F)>s.value&&Se(le,ue)}(D.x!==z.xSnapped||D.y!==z.ySnapped)&&w.length&&ie&&(W=le.sourceEvent,U=Jt(le.sourceEvent,M),se(z))},oe=le=>{let ue=!1;if(!ie&&!y.value&&!h.value){const z=le.sourceEvent,P=me(z),F=P.xSnapped-(D.x??0),Q=P.ySnapped-(D.y??0),X=Math.sqrt(F*F+Q*Q);X!==0&&X<=s.value&&(L==null||L(z),ue=!0)}if(w.length&&!ue){pe&&(_(w,!1,!1),pe=!1);const[z,P]=Pl({id:$,dragItems:w,findNode:f});T({event:le.sourceEvent,node:z,nodes:P})}w=[],y.value=!1,ge=!1,ie=!1,D={x:void 0,y:void 0},cancelAnimationFrame(ye)};return t.watch([()=>t.toValue(R),x],([le,ue],z,P)=>{if(ue){const F=Mt(ue);le||(v=hE().on("start",Q=>ce(Q,ue)).on("drag",Q=>fe(Q,ue)).on("end",Q=>oe(Q)).filter(Q=>{const X=Q.target,_e=t.toValue(O);return!Q.button&&(!a.value||!Mm(X,`.${a.value}`,ue)&&(!_e||Mm(X,_e,ue)))}),F.call(v)),P(()=>{F.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),y}function H0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),updateStart:Re(),update:Re(),updateEnd:Re()}}function j0(e,n){const o=H0();return o.doubleClick.on(i=>{var a,r;n.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;n.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;n.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;n.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function K0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=je();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=A0(a)?a.sourceEvent:a,{x:c,y:d}=Jt(s,l),u=bi({x:c,y:d},e.value),{x:m,y:p}=o.value?La(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function za(){return!0}function Wm({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:p,nodesConnectable:f,autoPanOnConnect:h,autoPanSpeed:g,findNode:k,panBy:N,startConnection:b,updateConnection:_,endConnection:E,emits:I,viewport:A,edges:T,nodes:L,isValidConnection:x,nodeLookup:R}=je();let $=null,B=!1,O=null;function y(v){var M;const D=t.toValue(o)==="target",U=Fl(v),W=gm(v.target),ie=v.currentTarget;if(ie&&(U&&v.button===0||!U)){let pe=function(Ie){z=Jt(Ie,oe),se=B0(bi(z,A.value,!1,[1,1]),u.value,R.value,Q),P||(F(),P=!0);const Y=Om(Ie,{handle:se,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:D?"target":"source",isValidConnection:me,doc:W,lib:"vue",flowId:s,nodeLookup:R.value},T.value,L.value,k,R.value);O=Y.handleDomNode,$=Y.connection,B=O0(!!se,Y.isValid);const j={...we,isValid:B,to:Y.toHandle&&B?gi({x:Y.toHandle.x,y:Y.toHandle.y},A.value):z,toHandle:Y.toHandle,toPosition:B&&Y.toHandle?Y.toHandle.position:Hl[Q.position],toNode:Y.toHandle?R.value.get(Y.toHandle.nodeId):null};if(B&&se&&(we!=null&&we.toHandle)&&j.toHandle&&we.toHandle.type===j.toHandle.type&&we.toHandle.nodeId===j.toHandle.nodeId&&we.toHandle.id===j.toHandle.id&&we.to.x===j.to.x&&we.to.y===j.to.y)return;const J=se??Y.toHandle;if(_(J&&B?gi({x:J.x,y:J.y},A.value):z,J,D0(!!J,B)),we=j,!se&&!B&&!O)return Ul(ue);$&&$.source!==$.target&&O&&(Ul(ue),ue=O,O.classList.add("connecting","vue-flow__handle-connecting"),O.classList.toggle("valid",!!B),O.classList.toggle("vue-flow__handle-valid",!!B))},ye=function(Ie){"touches"in Ie&&Ie.touches.length>0||((se||O)&&$&&B&&(r?r(Ie,$):I.connect($)),I.connectEnd(Ie),a&&(l==null||l(Ie)),Ul(ue),cancelAnimationFrame(ke),E(Ie),P=!1,B=!1,$=null,O=null,W.removeEventListener("mousemove",pe),W.removeEventListener("mouseup",ye),W.removeEventListener("touchmove",pe),W.removeEventListener("touchend",ye))};const ge=k(t.toValue(n));let me=t.toValue(i)||x.value||za;!me&&ge&&(me=(D?ge.isValidSourcePos:ge.isValidTargetPos)||za);let se,ke=0;const{x:Se,y:ce}=Jt(v),fe=Lm(t.toValue(a),ie),oe=(M=c.value)==null?void 0:M.getBoundingClientRect();if(!oe||!fe)return;const le=Pm(t.toValue(n),fe,t.toValue(e),R.value,d.value);if(!le)return;let ue,z=Jt(v,oe),P=!1;const F=()=>{if(!h.value)return;const[Ie,Y]=Cm(z,oe,g.value);N({x:Ie,y:Y}),ke=requestAnimationFrame(F)},Q={...le,nodeId:t.toValue(n),type:fe,position:le.position},X=R.value.get(t.toValue(n)),he={inProgress:!0,isValid:null,from:$o(X,Q,$e.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:X,to:z,toHandle:null,toPosition:Hl[Q.position],toNode:null};b({nodeId:t.toValue(n),id:t.toValue(e),type:fe,position:(ie==null?void 0:ie.getAttribute("data-handlepos"))||$e.Top,...z},{x:Se-oe.left,y:ce-oe.top}),I.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:fe});let we=he;W.addEventListener("mousemove",pe),W.addEventListener("mouseup",ye),W.addEventListener("touchmove",pe),W.addEventListener("touchend",ye)}}function w(v){var M,D;if(!m.value)return;const U=t.toValue(o)==="target";if(!p.value){I.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),b({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:$e.Top,...Jt(v)},void 0,!0);return}let W=t.toValue(i)||x.value||za;const ie=k(t.toValue(n));if(!W&&ie&&(W=(U?ie.isValidSourcePos:ie.isValidTargetPos)||za),ie&&(typeof ie.connectable>"u"?f.value:ie.connectable)===!1)return;const pe=gm(v.target),ye=Om(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:$e.Top,...Jt(v)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:W,doc:pe,lib:"vue",flowId:s,nodeLookup:R.value},T.value,L.value,k,R.value),ge=((M=ye.connection)==null?void 0:M.source)===((D=ye.connection)==null?void 0:D.target);ye.isValid&&ye.connection&&!ge&&I.connect(ye.connection),I.clickConnectEnd(v),E(v,!0)}return{handlePointerDown:y,handleClick:w}}function G0(){return t.inject(Gm,"")}function Jm(e){const n=e??G0()??"",o=t.inject(Ym,t.ref(null)),{findNode:i,edges:a,emits:r}=je(),l=i(n);return l||r.error(new ft(st.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Jn([l],a.value))}}function Y0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),dragStart:Re(),drag:Re(),dragStop:Re()}}function q0(e,n){const o=Y0();return o.doubleClick.on(i=>{var a,r;n.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;n.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;n.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;n.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function Xm(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=je();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,p=d?4:1,f=c.x*u*p,h=c.y*m*p,g=[];for(const k of e.value)if(k.draggable||l&&typeof k.draggable>"u"){const N={x:k.computedPosition.x+f,y:k.computedPosition.y+h},{position:b}=zl(k,N,s.error,n.value,k.parentNode?i(k.parentNode):void 0);g.push({id:k.id,position:b,from:k.position,distance:{x:c.x,y:c.y},dimensions:k.dimensions})}o(g,!0,!1)}}const Fa=.1,W0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Sn(){return Ei("Viewport not initialized yet."),Promise.resolve(!1)}const J0={zoomIn:Sn,zoomOut:Sn,zoomTo:Sn,fitView:Sn,setCenter:Sn,fitBounds:Sn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Sn,setTransform:Sn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function X0(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?si:wa).scaleBy(Yl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=ym({x:-i,y:-a},e.translateExtent),m=So.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?si:wa).transform(Yl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>n(1.2,a),zoomOut:a=>n(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?si:wa).scaleTo(Yl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),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:Fa,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Dl(s),{x:d,y:u,zoom:m}=Im(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Fa);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:Fa})=>{const{x:l,y:s,zoom:c}=Im(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Fa);return o(l,s,c,r)},project:a=>bi(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return bi(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return gi(s,e.viewport)}return{x:0,y:0}}}:J0)}function Yl(e,n=0,o=W0,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function Z0(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,k,N=!!(o.nodes.value.length||o.edges.value.length);g=wo([e.modelValue,()=>{var b,_;return(_=(b=e.modelValue)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setElements(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([b,_])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...b,..._],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},r=()=>{i.run(()=>{let g,k,N=!!o.nodes.value.length;g=wo([e.nodes,()=>{var b,_;return(_=(b=e.nodes)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setNodes(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.nodes,()=>o.nodes.value.length],([b])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...b],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},l=()=>{i.run(()=>{let g,k,N=!!o.edges.value.length;g=wo([e.edges,()=>{var b,_;return(_=(b=e.edges)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setEdges(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.edges,()=>o.edges.value.length],([b])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...b],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ct(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ct(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ct(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ct(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ct(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const g=async k=>{let N=k;typeof n.autoConnect=="function"&&(N=await n.autoConnect(k)),N!==!1&&o.addEdges([N])};t.watch(()=>n.autoConnect,()=>{ct(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(k,N,b)=>{k?o.onConnect(g):o.hooks.value.connect.off(g),b(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},f=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const k of Object.keys(n)){const N=k;if(!g.includes(N)){const b=t.toRef(()=>n[N]),_=o[N];t.isRef(_)&&i.run(()=>{t.watch(b,E=>{ct(E)&&(_.value=E)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function Q0(){return{edgesChange:Re(),nodesChange:Re(),nodeDoubleClick:Re(),nodeClick:Re(),nodeMouseEnter:Re(),nodeMouseMove:Re(),nodeMouseLeave:Re(),nodeContextMenu:Re(),nodeDragStart:Re(),nodeDrag:Re(),nodeDragStop:Re(),nodesInitialized:Re(),miniMapNodeClick:Re(),miniMapNodeDoubleClick:Re(),miniMapNodeMouseEnter:Re(),miniMapNodeMouseMove:Re(),miniMapNodeMouseLeave:Re(),connect:Re(),connectStart:Re(),connectEnd:Re(),clickConnectStart:Re(),clickConnectEnd:Re(),paneReady:Re(),init:Re(),move:Re(),moveStart:Re(),moveEnd:Re(),selectionDragStart:Re(),selectionDrag:Re(),selectionDragStop:Re(),selectionContextMenu:Re(),selectionStart:Re(),selectionEnd:Re(),viewportChangeStart:Re(),viewportChange:Re(),viewportChangeEnd:Re(),paneScroll:Re(),paneClick:Re(),paneContextMenu:Re(),paneMouseEnter:Re(),paneMouseMove:Re(),paneMouseLeave:Re(),edgeContextMenu:Re(),edgeMouseEnter:Re(),edgeMouseMove:Re(),edgeMouseLeave:Re(),edgeDoubleClick:Re(),edgeClick:Re(),edgeUpdateStart:Re(),edgeUpdate:Re(),edgeUpdateEnd:Re(),updateNodeInternals:Re(),error:Re(e=>Ei(e.message))}}function eN(e,n){const o=t.getCurrentInstance();t.onBeforeMount(()=>{for(const[a,r]of Object.entries(n.value)){const l=s=>{e(a,s)};r.setEmitter(l),ni(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),ni(r.removeHasEmitListeners)}});function i(a){var r;const l=tN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function tN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Zm(){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:Ml.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:pi.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:Yn.Bezier,style:{}},connectionMode:cn.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:ki()?"Meta":"Control",zoomActivationKeyCode:ki()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Q0(),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 nN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function oN(e,n,o){const i=X0(e),a=z=>{const P=z??[];e.hooks.updateNodeInternals.trigger(P)},r=z=>b0(z,e.nodes,e.edges),l=z=>g0(z,e.nodes,e.edges),s=z=>Jn(z,e.edges),c=({id:z,type:P,nodeId:F})=>{var Q;const X=z?`-${P}-${z}`:`-${P}`;return Array.from(((Q=e.connectionLookup.get(`${F}${X}`))==null?void 0:Q.values())??[])},d=z=>{if(z)return n.value.get(z)},u=z=>{if(z)return o.value.get(z)},m=(z,P,F)=>{var Q,X;const _e=[];for(const he of z){const we={id:he.id,type:"position",dragging:F,from:he.from};if(P&&(we.position=he.position,he.parentNode)){const Ie=d(he.parentNode);we.position={x:we.position.x-(((Q=Ie==null?void 0:Ie.computedPosition)==null?void 0:Q.x)??0),y:we.position.y-(((X=Ie==null?void 0:Ie.computedPosition)==null?void 0:X.y)??0)}}_e.push(we)}_e!=null&&_e.length&&e.hooks.nodesChange.trigger(_e)},p=z=>{if(!e.vueFlowRef)return;const P=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!P)return;const F=window.getComputedStyle(P),{m22:Q}=new window.DOMMatrixReadOnly(F.transform),X=[];for(const _e of z){const he=_e,we=d(he.id);if(we){const Ie=Ba(he.nodeElement);if(!!(Ie.width&&Ie.height&&(we.dimensions.width!==Ie.width||we.dimensions.height!==Ie.height||he.forceUpdate))){const j=he.nodeElement.getBoundingClientRect();we.dimensions=Ie,we.handleBounds.source=Fm("source",he.nodeElement,j,Q,we.id),we.handleBounds.target=Fm("target",he.nodeElement,j,Q,we.id),X.push({id:we.id,type:"dimensions",dimensions:Ie})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),X.length&&e.hooks.nodesChange.trigger(X)},f=(z,P)=>{const F=new Set,Q=new Set;for(const he of z)Wn(he)?F.add(he.id):vn(he)&&Q.add(he.id);const X=Cn(n.value,F,!0),_e=Cn(o.value,Q);if(e.multiSelectionActive){for(const he of F)X.push(xn(he,P));for(const he of Q)_e.push(xn(he,P))}X.length&&e.hooks.nodesChange.trigger(X),_e.length&&e.hooks.edgesChange.trigger(_e)},h=z=>{if(e.multiSelectionActive){const P=z.map(F=>xn(F.id,!0));e.hooks.nodesChange.trigger(P);return}e.hooks.nodesChange.trigger(Cn(n.value,new Set(z.map(P=>P.id)),!0)),e.hooks.edgesChange.trigger(Cn(o.value))},g=z=>{if(e.multiSelectionActive){const P=z.map(F=>xn(F.id,!0));e.hooks.edgesChange.trigger(P);return}e.hooks.edgesChange.trigger(Cn(o.value,new Set(z.map(P=>P.id)))),e.hooks.nodesChange.trigger(Cn(n.value,new Set,!0))},k=z=>{f(z,!0)},N=z=>{const F=(z||e.nodes).map(Q=>(Q.selected=!1,xn(Q.id,!1)));e.hooks.nodesChange.trigger(F)},b=z=>{const F=(z||e.edges).map(Q=>(Q.selected=!1,xn(Q.id,!1)));e.hooks.edgesChange.trigger(F)},_=z=>{if(!z||!z.length)return f([],!1);const P=z.reduce((F,Q)=>{const X=xn(Q.id,!1);return Wn(Q)?F.nodes.push(X):F.edges.push(X),F},{nodes:[],edges:[]});P.nodes.length&&e.hooks.nodesChange.trigger(P.nodes),P.edges.length&&e.hooks.edgesChange.trigger(P.edges)},E=z=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([z,e.maxZoom]),e.minZoom=z},I=z=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([e.minZoom,z]),e.maxZoom=z},A=z=>{var P;(P=e.d3Zoom)==null||P.translateExtent(z),e.translateExtent=z},T=z=>{e.nodeExtent=z,a()},L=z=>{var P;(P=e.d3Zoom)==null||P.clickDistance(z)},x=z=>{e.nodesDraggable=z,e.nodesConnectable=z,e.elementsSelectable=z},R=z=>{const P=z instanceof Function?z(e.nodes):z;!e.initialized&&!P.length||(e.nodes=Um(P,d,e.hooks.error.trigger))},$=z=>{const P=z instanceof Function?z(e.edges):z;if(!e.initialized&&!P.length)return;const F=Gl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Kl(e.connectionLookup,o.value,F),e.edges=F},B=z=>{const P=z instanceof Function?z([...e.nodes,...e.edges]):z;!e.initialized&&!P.length||(R(P.filter(Wn)),$(P.filter(vn)))},O=z=>{let P=z instanceof Function?z(e.nodes):z;P=Array.isArray(P)?P:[P];const F=Um(P,d,e.hooks.error.trigger),Q=[];for(const X of F)Q.push(Rm(X));Q.length&&e.hooks.nodesChange.trigger(Q)},y=z=>{let P=z instanceof Function?z(e.edges):z;P=Array.isArray(P)?P:[P];const F=Gl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const X of F)Q.push(Rm(X));Q.length&&e.hooks.edgesChange.trigger(Q)},w=(z,P=!0,F=!1)=>{const Q=z instanceof Function?z(e.nodes):z,X=Array.isArray(Q)?Q:[Q],_e=[],he=[];function we(Y){const j=s(Y);for(const J of j)(!ct(J.deletable)||J.deletable)&&he.push($m(J.id,J.source,J.target,J.sourceHandle,J.targetHandle))}function Ie(Y){const j=[];for(const J of e.nodes)J.parentNode===Y&&j.push(J);if(j.length){for(const J of j)_e.push(Am(J.id));P&&we(j);for(const J of j)Ie(J.id)}}for(const Y of X){const j=typeof Y=="string"?d(Y):Y;j&&(ct(j.deletable)&&!j.deletable||(_e.push(Am(j.id)),P&&we([j]),F&&Ie(j.id)))}he.length&&e.hooks.edgesChange.trigger(he),_e.length&&e.hooks.nodesChange.trigger(_e)},v=z=>{const P=z instanceof Function?z(e.edges):z,F=Array.isArray(P)?P:[P],Q=[];for(const X of F){const _e=typeof X=="string"?u(X):X;_e&&(ct(_e.deletable)&&!_e.deletable||Q.push($m(typeof X=="string"?X:X.id,_e.source,_e.target,_e.sourceHandle,_e.targetHandle)))}e.hooks.edgesChange.trigger(Q)},M=(z,P,F=!0)=>{const Q=u(z.id);if(!Q)return!1;const X=e.edges.indexOf(Q),_e=z0(z,P,Q,F,e.hooks.error.trigger);if(_e){const[he]=Gl([_e],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((we,Ie)=>Ie===X?he:we),Kl(e.connectionLookup,o.value,[he]),he}return!1},D=(z,P,F={replace:!1})=>{const Q=u(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=F.replace?X:{...Q.data,...X}},U=z=>Sm(z,e.nodes),W=z=>{const P=Sm(z,e.edges);return Kl(e.connectionLookup,o.value,P),P},ie=(z,P,F={replace:!1})=>{const Q=d(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;F.replace?e.nodes.splice(e.nodes.indexOf(Q),1,X):Object.assign(Q,X)},pe=(z,P,F={replace:!1})=>{const Q=d(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=F.replace?X:{...Q.data,...X}},ye=(z,P,F=!1)=>{F?e.connectionClickStartHandle=z:e.connectionStartHandle=z,e.connectionEndHandle=null,e.connectionStatus=null,P&&(e.connectionPosition=P)},ge=(z,P=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=z,e.connectionEndHandle=P,e.connectionStatus=F)},me=(z,P)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,P?e.connectionClickStartHandle=null:e.connectionStartHandle=null},se=z=>{const P=h0(z),F=P?null:yi(z)?z:d(z.id);return!P&&!F?[null,null,P]:[P?z:Ma(F),F,P]},ke=(z,P=!0,F=e.nodes)=>{const[Q,X,_e]=se(z);if(!Q)return[];const he=[];for(const we of F||e.nodes){if(!_e&&(we.id===X.id||!we.computedPosition))continue;const Ie=Ma(we),Y=Va(Ie,Q);(P&&Y>0||Y>=Ie.width*Ie.height||Y>=Number(Q.width)*Number(Q.height))&&he.push(we)}return he},Se=(z,P,F=!0)=>{const[Q]=se(z);if(!Q)return!1;const X=Va(Q,P);return F&&X>0||X>=Number(Q.width)*Number(Q.height)},ce=z=>{const{viewport:P,dimensions:F,d3Zoom:Q,d3Selection:X,translateExtent:_e}=e;if(!Q||!X||!z.x&&!z.y)return!1;const he=So.translate(P.x+z.x,P.y+z.y).scale(P.zoom),we=[[0,0],[F.width,F.height]],Ie=Q.constrain()(he,we,_e),Y=e.viewport.x!==Ie.x||e.viewport.y!==Ie.y||e.viewport.zoom!==Ie.k;return Q.transform(X,Ie),Y},fe=z=>{const P=z instanceof Function?z(e):z,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ct(P.defaultEdgeOptions)&&(e.defaultEdgeOptions=P.defaultEdgeOptions);const Q=P.modelValue||P.nodes||P.edges?[]:void 0;Q&&(P.modelValue&&Q.push(...P.modelValue),P.nodes&&Q.push(...P.nodes),P.edges&&Q.push(...P.edges),B(Q));const X=()=>{ct(P.maxZoom)&&I(P.maxZoom),ct(P.minZoom)&&E(P.minZoom),ct(P.translateExtent)&&A(P.translateExtent)};for(const _e of Object.keys(P)){const he=_e,we=P[he];![...nN,...F].includes(he)&&ct(we)&&(e[he]=we)}ml(()=>e.d3Zoom).not.toBeNull().then(X),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:B,setNodes:R,setEdges:$,addNodes:O,addEdges:y,removeNodes:w,removeEdges:v,findNode:d,findEdge:u,updateEdge:M,updateEdgeData:D,updateNode:ie,updateNodeData:pe,applyEdgeChanges:W,applyNodeChanges:U,addSelectedElements:k,addSelectedNodes:h,addSelectedEdges:g,setMinZoom:E,setMaxZoom:I,setTranslateExtent:A,setNodeExtent:T,setPaneClickDistance:L,removeSelectedElements:_,removeSelectedNodes:N,removeSelectedEdges:b,startConnection:ye,updateConnection:ge,endConnection:me,setInteractive:x,setState:fe,getIntersectingNodes:ke,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Se,panBy:ce,fitView:z=>i.value.fitView(z),zoomIn:z=>i.value.zoomIn(z),zoomOut:z=>i.value.zoomOut(z),zoomTo:(z,P)=>i.value.zoomTo(z,P),setViewport:(z,P)=>i.value.setViewport(z,P),setTransform:(z,P)=>i.value.setTransform(z,P),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(z,P,F)=>i.value.setCenter(z,P,F),fitBounds:(z,P)=>i.value.fitBounds(z,P),project:z=>i.value.project(z),screenToFlowCoordinate:z=>i.value.screenToFlowCoordinate(z),flowToScreenCoordinate:z=>i.value.flowToScreenCoordinate(z),toObject:()=>{const z=[],P=[];for(const F of e.nodes){const{computedPosition:Q,handleBounds:X,selected:_e,dimensions:he,isParent:we,resizing:Ie,dragging:Y,events:j,...J}=F;z.push(J)}for(const F of e.edges){const{selected:Q,sourceNode:X,targetNode:_e,events:he,...we}=F;P.push(we)}return JSON.parse(JSON.stringify({nodes:z,edges:P,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:z=>new Promise(P=>{const{nodes:F,edges:Q,position:X,zoom:_e,viewport:he}=z;F&&R(F),Q&&$(Q);const[we,Ie]=he!=null&&he.x&&(he!=null&&he.y)?[he.x,he.y]:X??[null,null];if(we&&Ie){const Y=(he==null?void 0:he.zoom)||_e||e.viewport.zoom;return ml(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:we,y:Ie,zoom:Y}).then(()=>{P(!0)})})}else P(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const z=Zm();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const P=So.translate(z.defaultViewport.x??0,z.defaultViewport.y??0).scale(qn(z.defaultViewport.zoom??1,z.minZoom,z.maxZoom)),F=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[F.width,F.height]],X=e.d3Zoom.constrain()(P,Q,z.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}fe(z)},$destroy:()=>{}}}const iN=["data-id","data-handleid","data-nodeid","data-handlepos"],aN={name:"Handle",compatConfig:{MODE:3}},Xn=t.defineComponent({...aN,props:{id:{default:null},type:{},position:{default:()=>$e.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:p}=je(),{id:f,node:h,nodeEl:g,connectedEdges:k}=Jm(),N=t.ref(),b=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),E=t.toRef(()=>{var $,B,O,y,w,v;return(($=l.value)==null?void 0:$.nodeId)===f&&((B=l.value)==null?void 0:B.id)===e.id&&((O=l.value)==null?void 0:O.type)===i.value||((y=c.value)==null?void 0:y.nodeId)===f&&((w=c.value)==null?void 0:w.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),I=t.toRef(()=>{var $,B,O;return(($=s.value)==null?void 0:$.nodeId)===f&&((B=s.value)==null?void 0:B.id)===e.id&&((O=s.value)==null?void 0:O.type)===i.value}),{handlePointerDown:A,handleClick:T}=Wm({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),L=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!k.value.some($=>{const B=$[`${i.value}Handle`];return $[i.value]!==f?!1:B?B===e.id:!0}):typeof e.connectable=="number"?k.value.filter($=>{const B=$[`${i.value}Handle`];return $[i.value]!==f?!1:B?B===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,k.value):ct(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var $;if(!h.dimensions.width||!h.dimensions.height)return;const B=($=h.handleBounds[i.value])==null?void 0:$.find(U=>U.id===e.id);if(!d.value||B)return;const O=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!N.value||!O||!e.id)return;const y=g.value.getBoundingClientRect(),w=N.value.getBoundingClientRect(),v=window.getComputedStyle(O),{m22:M}=new window.DOMMatrixReadOnly(v.transform),D={id:e.id,position:e.position,x:(w.left-y.left)/M,y:(w.top-y.top)/M,type:i.value,nodeId:f,...Ba(N.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],D]});function x($){const B=Fl($);L.value&&b.value&&(B&&$.button===0||!B)&&A($)}function R($){!f||!s.value&&!b.value||L.value&&T($)}return n({handleClick:T,handlePointerDown:A,onClick:R,onPointerDown:x}),($,B)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:N,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":$.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${$.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:L.value,connecting:I.value,connectablestart:b.value,connectableend:_.value,connectionindicator:L.value&&(b.value&&!E.value||_.value&&E.value)}]]),onMousedown:x,onTouchstartPassive:x,onClick:R},[t.renderSlot($.$slots,"default",{id:$.id})],42,iN))}}),Ua=function({sourcePosition:e=$e.Bottom,targetPosition:n=$e.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Xn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Xn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Ua.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ua.inheritAttrs=!1,Ua.compatConfig={MODE:3};const rN=Ua,Ha=function({targetPosition:e=$e.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Xn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};Ha.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ha.inheritAttrs=!1,Ha.compatConfig={MODE:3};const lN=Ha,ja=function({sourcePosition:e=$e.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Xn,{type:"source",position:e,connectable:o,isValidConnection:i})]};ja.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ja.inheritAttrs=!1,ja.compatConfig={MODE:3};const sN=ja,cN=["transform"],dN=["width","height","x","y","rx","ry"],uN=["y"],mN={name:"EdgeText",compatConfig:{MODE:3}},fN=t.defineComponent({...mN,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),i=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(a),t.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==n.value.width||r.height!==n.value.height)&&(n.value=r)}return(r,l)=>(t.openBlock(),t.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*r.labelBgPadding[0]}px`,height:`${n.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:t.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,dN)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:r.labelStyle}),[t.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(r.label),1)],64))])],16,uN)],8,cN))}}),pN=["id","d","marker-end","marker-start"],hN=["d","stroke-width"],yN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ka=t.defineComponent({...yN,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),i=t.ref(null),a=t.ref(null),r=t.useAttrs();return n({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,pN),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,hN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(fN,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function Qm({sourceX:e,sourceY:n,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-n)/2,s=i<n?i+l:i-l;return[r,s,a,l]}function ef({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=n*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function Ga(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function tf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case $e.Left:l=n-Ga(n-i,r),s=o;break;case $e.Right:l=n+Ga(i-n,r),s=o;break;case $e.Top:l=n,s=o-Ga(o-a,r);break;case $e.Bottom:l=n,s=o+Ga(a-o,r);break}return[l,s]}function nf(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,curvature:s=.25}=e,[c,d]=tf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=tf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,h,g]=ef({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,p,f,h,g]}function of({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case $e.Left:case $e.Right:r=.5*(n+i),l=o;break;case $e.Top:case $e.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function af(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top}=e,[s,c]=of({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=of({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,h]=ef({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,p,f,h]}const rf={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};function gN({source:e,sourcePosition:n=$e.Bottom,target:o}){return n===$e.Left||n===$e.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 lf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function bN({source:e,sourcePosition:n=$e.Bottom,target:o,targetPosition:i=$e.Top,center:a,offset:r}){const l=rf[n],s=rf[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=gN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,h,g;const k={x:0,y:0},N={x:0,y:0},[b,_,E,I]=Qm({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){h=a.x??b,g=a.y??_;const T=[{x:h,y:c.y},{x:h,y:d.y}],L=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===p?f=m==="x"?T:L:f=m==="x"?L:T}else{const T=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?L:T:f=l.y===p?T:L,n===i){const O=Math.abs(e[m]-o[m]);if(O<=r){const y=Math.min(r-1,r-O);l[m]===p?k[m]=(c[m]>e[m]?-1:1)*y:N[m]=(d[m]>o[m]?-1:1)*y}}if(n!==i){const O=m==="x"?"y":"x",y=l[m]===s[O],w=c[O]>d[O],v=c[O]<d[O];(l[m]===1&&(!y&&w||y&&v)||l[m]!==1&&(!y&&v||y&&w))&&(f=m==="x"?T:L)}const x={x:c.x+k.x,y:c.y+k.y},R={x:d.x+N.x,y:d.y+N.y},$=Math.max(Math.abs(x.x-f[0].x),Math.abs(R.x-f[0].x)),B=Math.max(Math.abs(x.y-f[0].y),Math.abs(R.y-f[0].y));$>=B?(h=(x.x+R.x)/2,g=f[0].y):(h=f[0].x,g=(x.y+R.y)/2)}return[[e,{x:c.x+k.x,y:c.y+k.y},...f,{x:d.x+N.x,y:d.y+N.y},o],h,g,E,I]}function _N(e,n,o,i){const a=Math.min(lf(e,n)/2,lf(n,o)/2,i),{x:r,y:l}=n;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function ql(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,h,g]=bN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((N,b,_)=>{let E;return _>0&&_<m.length-1?E=_N(m[_-1],b,m[_+1],s):E=`${_===0?"M":"L"}${b.x} ${b.y}`,N+=E,N},""),p,f,h,g]}function kN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Qm({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const EN=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=kN(e);return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),sf=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=ql({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),NN=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(sf,{...e,...n,borderRadius:0})}}),wN=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=nf({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),IN=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=af({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),vN={input:sN,default:rN,output:lN},xN={default:wN,straight:EN,step:NN,smoothstep:sf,simplebezier:IN};function CN(e,n,o){const i=t.computed(()=>g=>n.value.get(g)),a=t.computed(()=>g=>o.value.get(g)),r=t.computed(()=>{const g={...xN,...e.edgeTypes},k=Object.keys(g);for(const N of e.edges)N.type&&!k.includes(N.type)&&(g[N.type]=N.type);return g}),l=t.computed(()=>{const g={...vN,...e.nodeTypes},k=Object.keys(g);for(const N of e.nodes)N.type&&!k.includes(N.type)&&(g[N.type]=N.type);return g}),s=t.computed(()=>e.onlyRenderVisibleElements?wm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const k of e.edges){const N=n.value.get(k.source),b=n.value.get(k.target);S0({sourcePos:N.computedPosition||{x:0,y:0},targetPos:b.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:b.dimensions.width,targetHeight:b.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(k)}return g}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const g=[];for(const k of e.nodes)k.selected&&g.push(k);return g}),m=t.computed(()=>{const g=[];for(const k of e.edges)k.selected&&g.push(k);return g}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const g=[];for(const k of e.nodes)k.dimensions.width&&k.dimensions.height&&k.handleBounds!==void 0&&g.push(k);return g}),h=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:h}}class Zn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Zn.instance;return Zn.instance=i??new Zn,o&&(o.config.globalProperties.$vueFlowStorage=Zn.instance),Zn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=Zm(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[h]=f.on}const l={};for(const[p,f]of Object.entries(a.hooks))l[p]=f.trigger;const s=t.computed(()=>{const p=new Map;for(const f of a.nodes)p.set(f.id,f);return p}),c=t.computed(()=>{const p=new Map;for(const f of a.edges)p.set(f.id,f);return p}),d=CN(a,s,c),u=oN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...I_(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function je(e){const n=Zn.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Km,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,p,f)=>{const h=k=>{d.applyNodeChanges(k)},g=k=>{d.applyEdgeChanges(k)};m?(d.onNodesChange(h),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)),f(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),ni(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ei(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Km,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ft(st.USEVUEFLOW_OPTIONS))}return s}function SN(e){const{emits:n,dimensions:o}=je();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Ba(e.value);(s.width===0||s.height===0)&&n.error(new ft(st.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)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const RN={name:"UserSelection",compatConfig:{MODE:3}},AN=t.defineComponent({...RN,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),$N=["tabIndex"],TN={name:"NodesSelection",compatConfig:{MODE:3}},MN=t.defineComponent({...TN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=je(),s=Xm(),c=t.ref(null),d=qm({el:c,onStart(h){n.selectionDragStart(h),n.nodeDragStart(h)},onDrag(h){n.selectionDrag(h),n.nodeDrag(h)},onStop(h){n.selectionDragStop(h),n.nodeDragStop(h)}});t.onMounted(()=>{var h;r.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=t.computed(()=>Dl(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){n.selectionContextMenu({event:h,nodes:i.value})}function f(h){r.value||Ro[h.key]&&(h.preventDefault(),s({x:Ro[h.key].x,y:Ro[h.key].y},h.shiftKey))}return(h,g)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,$N)],6)):t.createCommentVNode("",!0)}});function VN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const BN={name:"Pane",compatConfig:{MODE:3}},DN=t.defineComponent({...BN,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:p,removeEdges:f,selectionMode:h,deleteKeyCode:g,multiSelectionKeyCode:k,multiSelectionActive:N,edgeLookup:b,nodeLookup:_,connectionLookup:E,defaultEdgeOptions:I,connectionStartHandle:A,panOnDrag:T}=je(),L=t.shallowRef(null),x=t.shallowRef(new Set),R=t.shallowRef(new Set),$=t.shallowRef(null),B=t.toRef(()=>c.value&&(e.isSelecting||r.value)),O=t.toRef(()=>A.value!==null);let y=!1,w=!1;const v=hi(g,{actInsideInputWithModifier:!1}),M=hi(k);t.watch(v,me=>{me&&(p(m.value),f(u.value),d.value=!1)}),t.watch(M,me=>{N.value=me});function D(me,se){return ke=>{ke.target===se&&(me==null||me(ke))}}function U(me){if(y||O.value){y=!1;return}a.paneClick(me),l(),d.value=!1}function W(me){var se;if(Array.isArray(T.value)&&((se=T.value)!=null&&se.includes(2))){me.preventDefault();return}a.paneContextMenu(me)}function ie(me){a.paneScroll(me)}function pe(me){var se,ke,Se;if($.value=((se=n.value)==null?void 0:se.getBoundingClientRect())??null,!c.value||!e.isSelecting||me.button!==0||me.target!==L.value||!$.value)return;(Se=(ke=me.target)==null?void 0:ke.setPointerCapture)==null||Se.call(ke,me.pointerId);const{x:ce,y:fe}=VN(me,$.value);w=!0,y=!1,l(),s.value={width:0,height:0,startX:ce,startY:fe,x:ce,y:fe},a.selectionStart(me)}function ye(me){var se;if(!$.value||!s.value)return;y=!0;const{x:ke,y:Se}=Jt(me,$.value),{startX:ce=0,startY:fe=0}=s.value,oe={startX:ce,startY:fe,x:ke<ce?ke:ce,y:Se<fe?Se:fe,width:Math.abs(ke-ce),height:Math.abs(Se-fe)},le=x.value,ue=R.value;x.value=new Set(wm(o.value,oe,i.value,h.value===Ml.Partial,!0).map(P=>P.id)),R.value=new Set;const z=((se=I.value)==null?void 0:se.selectable)??!0;for(const P of x.value){const F=E.value.get(P);if(F)for(const{edgeId:Q}of F.values()){const X=b.value.get(Q);X&&(X.selectable??z)&&R.value.add(Q)}}if(!jm(le,x.value)){const P=Cn(_.value,x.value,!0);a.nodesChange(P)}if(!jm(ue,R.value)){const P=Cn(b.value,R.value);a.edgesChange(P)}s.value=oe,r.value=!0,d.value=!1}function ge(me){var se;me.button!==0||!w||((se=me.target)==null||se.releasePointerCapture(me.pointerId),!r.value&&s.value&&me.target===L.value&&U(me),r.value=!1,s.value=null,d.value=x.value.size>0,a.selectionEnd(me),e.selectionKeyPressed&&(y=!1),w=!1)}return(me,se)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:L,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:me.isSelecting}]),onClick:se[0]||(se[0]=ke=>B.value?void 0:D(U,L.value)(ke)),onContextmenu:se[1]||(se[1]=ke=>D(W,L.value)(ke)),onWheelPassive:se[2]||(se[2]=ke=>D(ie,L.value)(ke)),onPointerenter:se[3]||(se[3]=ke=>B.value?void 0:t.unref(a).paneMouseEnter(ke)),onPointerdown:se[4]||(se[4]=ke=>B.value?pe(ke):t.unref(a).paneMouseMove(ke)),onPointermove:se[5]||(se[5]=ke=>B.value?ye(ke):t.unref(a).paneMouseMove(ke)),onPointerup:se[6]||(se[6]=ke=>B.value?ge(ke):void 0),onPointerleave:se[7]||(se[7]=ke=>t.unref(a).paneMouseLeave(ke))},[t.renderSlot(me.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(AN,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(MN,{key:1})):t.createCommentVNode("",!0)],34))}}),ON={name:"Transform",compatConfig:{MODE:3}},LN=t.defineComponent({...ON,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=je(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),PN={name:"Viewport",compatConfig:{MODE:3}},zN=t.defineComponent({...PN,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:p,zoomOnPinch:f,zoomOnScroll:h,preventScrolling:g,noWheelClassName:k,noPanClassName:N,emits:b,connectionStartHandle:_,userSelectionActive:E,paneDragging:I,d3Zoom:A,d3Selection:T,d3ZoomHandler:L,viewport:x,viewportRef:R,paneClickDistance:$}=je();SN(R);const B=t.shallowRef(!1),O=t.shallowRef(!1);let y=null,w=!1,v=0,M={x:0,y:0,zoom:0};const D=hi(s),U=hi(l),W=hi(r),ie=t.toRef(()=>(!U.value||U.value&&l.value===!0)&&(D.value||m.value)),pe=t.toRef(()=>D.value||c.value),ye=t.toRef(()=>l.value===!0&&ie.value!==!0),ge=t.toRef(()=>U.value&&l.value!==!0||E.value||ye.value),me=t.toRef(()=>_.value!==null);t.onMounted(()=>{if(!R.value){Ei("Viewport element is missing");return}const fe=R.value,oe=fe.getBoundingClientRect(),le=s0().clickDistance($.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Mt(fe).call(le),z=ue.on("wheel.zoom"),P=So.translate(i.value.x??0,i.value.y??0).scale(qn(i.value.zoom??1,n.value,o.value)),F=[[0,0],[oe.width,oe.height]],Q=le.constrain()(P,F,a.value);le.transform(ue,Q),le.wheelDelta(Ol),A.value=le,T.value=ue,L.value=z,x.value={x:Q.x,y:Q.y,zoom:Q.k},le.on("start",X=>{var _e;if(!X.sourceEvent)return null;v=X.sourceEvent.button,B.value=!0;const he=Se(X.transform);((_e=X.sourceEvent)==null?void 0:_e.type)==="mousedown"&&(I.value=!0),M=he,b.viewportChangeStart(he),b.moveStart({event:X,flowTransform:he})}),le.on("end",X=>{if(!X.sourceEvent)return null;if(B.value=!1,I.value=!1,se(ie.value,v??0)&&!w&&b.paneContextMenu(X.sourceEvent),w=!1,ke(M,X.transform)){const _e=Se(X.transform);M=_e,b.viewportChangeEnd(_e),b.moveEnd({event:X,flowTransform:_e})}}),le.filter(X=>{var _e;const he=W.value||h.value,we=f.value&&X.ctrlKey,Ie=X.button,Y=X.type==="wheel";if(Ie===1&&X.type==="mousedown"&&(ce(X,"vue-flow__node")||ce(X,"vue-flow__edge")))return!0;if(!ie.value&&!he&&!pe.value&&!p.value&&!f.value||E.value||me.value&&!Y||!p.value&&X.type==="dblclick"||ce(X,k.value)&&Y||ce(X,N.value)&&(!Y||pe.value&&Y&&!W.value)||!f.value&&X.ctrlKey&&Y||!he&&!pe.value&&!we&&Y)return!1;if(!f&&X.type==="touchstart"&&((_e=X.touches)==null?void 0:_e.length)>1)return X.preventDefault(),!1;if(!ie.value&&(X.type==="mousedown"||X.type==="touchstart")||ye.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ie===0||Array.isArray(m.value)&&!m.value.includes(Ie)&&(X.type==="mousedown"||X.type==="touchstart"))return!1;const j=Array.isArray(m.value)&&m.value.includes(Ie)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ie||Ie<=1;return(!X.ctrlKey||D.value||Y)&&j}),t.watch([E,ie],()=>{E.value&&!B.value?le.on("zoom",null):E.value||le.on("zoom",X=>{x.value={x:X.transform.x,y:X.transform.y,zoom:X.transform.k};const _e=Se(X.transform);w=se(ie.value,v??0),b.viewportChange(_e),b.move({event:X,flowTransform:_e})})},{immediate:!0}),t.watch([E,pe,d,W,f,g,k],()=>{pe.value&&!W.value&&!E.value?ue.on("wheel.zoom",X=>{if(ce(X,k.value))return!1;const _e=W.value||h.value,he=f.value&&X.ctrlKey;if(!(!g.value||pe.value||_e||he))return!1;X.preventDefault(),X.stopImmediatePropagation();const Ie=ue.property("__zoom").k||1,Y=ki();if(!D.value&&X.ctrlKey&&f.value&&Y){const K=Gt(X),te=Ol(X),G=Ie*2**te;le.scaleTo(ue,G,K,X);return}const j=X.deltaMode===1?20:1;let J=d.value===pi.Vertical?0:X.deltaX*j,ve=d.value===pi.Horizontal?0:X.deltaY*j;!Y&&X.shiftKey&&d.value!==pi.Vertical&&!J&&ve&&(J=ve,ve=0),le.translateBy(ue,-(J/Ie)*u.value,-(ve/Ie)*u.value);const Te=Se(ue.property("__zoom"));y&&clearTimeout(y),O.value?(b.move({event:X,flowTransform:Te}),b.viewportChange(Te),y=setTimeout(()=>{b.moveEnd({event:X,flowTransform:Te}),b.viewportChangeEnd(Te),O.value=!1},150)):(O.value=!0,b.moveStart({event:X,flowTransform:Te}),b.viewportChangeStart(Te))},{passive:!1}):typeof z<"u"&&ue.on("wheel.zoom",function(X,_e){const he=!g.value&&X.type==="wheel"&&!X.ctrlKey,we=W.value||h.value,Ie=f.value&&X.ctrlKey;if(!we&&!c.value&&!Ie&&X.type==="wheel"||he||ce(X,k.value))return null;X.preventDefault(),z.call(this,X,_e)},{passive:!1})},{immediate:!0})});function se(fe,oe){return oe===2&&Array.isArray(fe)&&fe.includes(2)}function ke(fe,oe){return fe.x!==oe.x&&!Number.isNaN(oe.x)||fe.y!==oe.y&&!Number.isNaN(oe.y)||fe.zoom!==oe.k&&!Number.isNaN(oe.k)}function Se(fe){return{x:fe.x,y:fe.y,zoom:fe.k}}function ce(fe,oe){return fe.target.closest(`.${oe}`)}return(fe,oe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:R,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(DN,{"is-selecting":ge.value,"selection-key-pressed":t.unref(U),class:t.normalizeClass({connecting:me.value,dragging:t.unref(I),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(LN,null,{default:t.withCtx(()=>[t.renderSlot(fe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),FN=["id"],UN=["id"],HN=["id"],jN={name:"A11yDescriptions",compatConfig:{MODE:3}},KN=t.defineComponent({...jN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(fm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,FN),t.createElementVNode("div",{id:`${t.unref(pm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,UN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(p0)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(i)),9,HN))],64))}});function GN(){const e=je();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function YN(e,n,o){return o===$e.Left?e-n:o===$e.Right?e+n:e}function qN(e,n,o){return o===$e.Top?e-n:o===$e.Bottom?e+n:e}const Wl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=$e.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:YN(n,e,i),cy:qN(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Wl.props=["radius","centerX","centerY","position","type"],Wl.compatConfig={MODE:3};const cf=Wl,WN=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:p,multiSelectionActive:f,disableKeyboardA11y:h,elementsSelectable:g,edgesUpdatable:k,edgesFocusable:N,hooks:b}=je(),_=t.computed(()=>u(e.id)),{emit:E,on:I}=j0(_.value,r),A=t.inject(Pa),T=t.getCurrentInstance(),L=t.ref(!1),x=t.ref(!1),R=t.ref(""),$=t.ref(null),B=t.ref("source"),O=t.ref(null),y=t.toRef(()=>typeof _.value.selectable>"u"?g.value:_.value.selectable),w=t.toRef(()=>typeof _.value.updatable>"u"?k.value:_.value.updatable),v=t.toRef(()=>typeof _.value.focusable>"u"?N.value:_.value.focusable);t.provide(F0,e.id),t.provide(U0,O);const M=t.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),D=t.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),U=t.computed(()=>{const P=_.value.type||"default",F=A==null?void 0:A[`edge-${P}`];if(F)return F;let Q=_.value.template??c.value[P];if(typeof Q=="string"&&T){const X=Object.keys(T.appContext.components);X&&X.includes(P)&&(Q=t.resolveComponent(P,!1))}return Q&&typeof Q!="string"?Q:(r.error(new ft(st.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:W}=Wm({nodeId:R,handleId:$,type:B,isValidConnection:p,edgeUpdaterType:B,onEdgeUpdate:ye,onEdgeUpdateEnd:ge});return()=>{const P=m(_.value.source),F=m(_.value.target),Q="pathOptions"in _.value?_.value.pathOptions:{};if(!P&&!F)return r.error(new ft(st.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!P)return r.error(new ft(st.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!F)return r.error(new ft(st.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||P.hidden||F.hidden)return null;let X;i.value===cn.Strict?X=P.handleBounds.source:X=[...P.handleBounds.source||[],...P.handleBounds.target||[]];const _e=Bm(X,_.value.sourceHandle);let he;i.value===cn.Strict?he=F.handleBounds.target:he=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const we=Bm(he,_.value.targetHandle),Ie=(_e==null?void 0:_e.position)||$e.Bottom,Y=(we==null?void 0:we.position)||$e.Top,{x:j,y:J}=$o(P,_e,Ie),{x:ve,y:Te}=$o(F,we,Y);return _.value.sourceX=j,_.value.sourceY=J,_.value.targetX=ve,_.value.targetY=Te,t.h("g",{ref:O,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${U.value===!1?"default":_.value.type||"default"}`,s.value,M.value,{updating:L.value,selected:_.value.selected,animated:_.value.animated,inactive:!y.value&&!b.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":v.value?`${pm}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",..._.value.domAttributes,onClick:se,onContextmenu:ke,onDblclick:Se,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onKeyDown:v.value?z:void 0},[x.value?null:t.h(U.value===!1?c.value.default:U.value,{id:e.id,sourceNode:P,targetNode:F,source:_.value.source,target:_.value.target,type:_.value.type,updatable:w.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...I},style:D.value,markerStart:`url('#${_i(_.value.markerStart,n)}')`,markerEnd:`url('#${_i(_.value.markerEnd,n)}')`,sourcePosition:Ie,targetPosition:Y,sourceX:j,sourceY:J,targetX:ve,targetY:Te,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...Q}),[w.value==="source"||w.value===!0?[t.h("g",{onMousedown:le,onMouseenter:ie,onMouseout:pe},t.h(cf,{position:Ie,centerX:j,centerY:J,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:ie,onMouseout:pe},t.h(cf,{position:Y,centerX:ve,centerY:Te,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ie(){L.value=!0}function pe(){L.value=!1}function ye(P,F){E.update({event:P,edge:_.value,connection:F})}function ge(P){E.updateEnd({event:P,edge:_.value}),x.value=!1}function me(P,F){P.button===0&&(x.value=!0,R.value=F?_.value.target:_.value.source,$.value=(F?_.value.targetHandle:_.value.sourceHandle)??null,B.value=F?"target":"source",E.updateStart({event:P,edge:_.value}),W(P))}function se(P){var F;const Q={event:P,edge:_.value};y.value&&(l.value=!1,_.value.selected&&f.value?(d([_.value]),(F=O.value)==null||F.blur()):o([_.value])),E.click(Q)}function ke(P){E.contextMenu({event:P,edge:_.value})}function Se(P){E.doubleClick({event:P,edge:_.value})}function ce(P){E.mouseEnter({event:P,edge:_.value})}function fe(P){E.mouseMove({event:P,edge:_.value})}function oe(P){E.mouseLeave({event:P,edge:_.value})}function le(P){me(P,!0)}function ue(P){me(P,!1)}function z(P){var F;!h.value&&hm.includes(P.key)&&y.value&&(P.key==="Escape"?((F=O.value)==null||F.blur(),d([u(e.id)])):o([u(e.id)]))}}}),JN=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=je(),p=(e=t.inject(Pa))==null?void 0:e["connection-line"],f=t.computed(()=>{var b;return m((b=i.value)==null?void 0:b.nodeId)}),h=t.computed(()=>{var b;return m((b=a.value)==null?void 0:b.nodeId)??null}),g=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),k=t.computed(()=>c.value.markerStart?`url(#${_i(c.value.markerStart,n)})`:""),N=t.computed(()=>c.value.markerEnd?`url(#${_i(c.value.markerEnd,n)})`:"");return()=>{var b,_,E;if(!f.value||!i.value)return null;const I=i.value.id,A=i.value.type,T=f.value.handleBounds;let L=(T==null?void 0:T[A])??[];if(o.value===cn.Loose){const D=(T==null?void 0:T[A==="source"?"target":"source"])??[];L=[...L,...D]}if(!L)return null;const x=(I?L.find(D=>D.id===I):L[0])??null,R=(x==null?void 0:x.position)??$e.Top,{x:$,y:B}=$o(f.value,x,R);let O=null;h.value&&(o.value===cn.Strict?O=((b=h.value.handleBounds[A==="source"?"target":"source"])==null?void 0:b.find(D=>{var U;return D.id===((U=a.value)==null?void 0:U.id)}))||null:O=((_=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:_.find(D=>{var U;return D.id===((U=a.value)==null?void 0:U.id)}))||null);const y=((E=a.value)==null?void 0:E.position)??(R?Hl[R]:null);if(!R||!y)return null;const w=l.value??c.value.type??Yn.Bezier;let v="";const M={sourceX:$,sourceY:B,sourcePosition:R,targetX:g.value.x,targetY:g.value.y,targetPosition:y};return w===Yn.Bezier?[v]=nf(M):w===Yn.Step?[v]=ql({...M,borderRadius:0}):w===Yn.SmoothStep?[v]=ql(M):w===Yn.SimpleBezier?[v]=af(M):v=`M${$},${B} ${g.value.x},${g.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:$,sourceY:B,sourcePosition:R,targetX:g.value.x,targetY:g.value.y,targetPosition:y,sourceNode:f.value,sourceHandle:x,targetNode:h.value,targetHandle:O,markerEnd:N.value,markerStart:k.value,connectionStatus:d.value}):t.h("path",{d:v,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":N.value,"marker-start":k.value})))}}}),XN=["id","markerWidth","markerHeight","markerUnits","orient"],ZN={name:"MarkerType",compatConfig:{MODE:3}},QN=t.defineComponent({...ZN,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(Vl).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref(Vl).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,XN))}}),ew={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},tw={name:"MarkerDefinitions",compatConfig:{MODE:3}},nw=t.defineComponent({...tw,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=je(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=_i(d,n);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.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(l,s)=>(t.openBlock(),t.createElementBlock("svg",ew,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(QN,{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))])]))}}),ow={name:"Edges",compatConfig:{MODE:3}},iw=t.defineComponent({...ow,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(nw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(R0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(WN),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(JN))],64))}}),aw=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:p,elevateNodesOnSelect:f,disableKeyboardA11y:h,ariaLiveMessage:g,snapToGrid:k,snapGrid:N,nodeDragThreshold:b,nodesDraggable:_,elementsSelectable:E,nodesConnectable:I,nodesFocusable:A,hooks:T}=je(),L=t.ref(null);t.provide(Ym,L),t.provide(Gm,e.id);const x=t.inject(Pa),R=t.getCurrentInstance(),$=Xm(),{node:B,parentNode:O}=Jm(e.id),{emit:y,on:w}=q0(B,l),v=t.toRef(()=>typeof B.draggable>"u"?_.value:B.draggable),M=t.toRef(()=>typeof B.selectable>"u"?E.value:B.selectable),D=t.toRef(()=>typeof B.connectable>"u"?I.value:B.connectable),U=t.toRef(()=>typeof B.focusable>"u"?A.value:B.focusable),W=t.computed(()=>M.value||v.value||T.value.nodeClick.hasListeners()||T.value.nodeDoubleClick.hasListeners()||T.value.nodeMouseEnter.hasListeners()||T.value.nodeMouseMove.hasListeners()||T.value.nodeMouseLeave.hasListeners()),ie=t.toRef(()=>!!B.dimensions.width&&!!B.dimensions.height),pe=t.computed(()=>{const F=B.type||"default",Q=x==null?void 0:x[`node-${F}`];if(Q)return Q;let X=B.template||m.value[F];if(typeof X=="string"&&R){const _e=Object.keys(R.appContext.components);_e&&_e.includes(F)&&(X=t.resolveComponent(F,!1))}return X&&typeof X!="string"?X:(l.error(new ft(st.NODE_TYPE_MISSING,X)),!1)}),ye=qm({id:e.id,el:L,disabled:()=>!v.value,selectable:M,dragHandle:()=>B.dragHandle,onStart(F){y.dragStart(F)},onDrag(F){y.drag(F)},onStop(F){y.dragStop(F)},onClick(F){z(F)}}),ge=t.computed(()=>B.class instanceof Function?B.class(B):B.class),me=t.computed(()=>{const F=(B.style instanceof Function?B.style(B):B.style)||{},Q=B.width instanceof Function?B.width(B):B.width,X=B.height instanceof Function?B.height(B):B.height;return!F.width&&Q&&(F.width=typeof Q=="string"?Q:`${Q}px`),!F.height&&X&&(F.height=typeof X=="string"?X:`${X}px`),F}),se=t.toRef(()=>Number(B.zIndex??me.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Se()}),t.onMounted(()=>{t.watch(()=>B.hidden,(F=!1,Q,X)=>{!F&&L.value&&(e.resizeObserver.observe(L.value),X(()=>{L.value&&e.resizeObserver.unobserve(L.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>B.type,()=>B.sourcePosition,()=>B.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])})}),t.watch([()=>B.position.x,()=>B.position.y,()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.z},se,()=>B.selected,()=>B.dimensions.height,()=>B.dimensions.width,()=>{var F;return(F=O.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=O.value)==null?void 0:F.dimensions.width}],([F,Q,X,_e,he,we])=>{const Ie={x:F,y:Q,z:we+(f.value&&B.selected?1e3:0)};typeof X<"u"&&typeof _e<"u"?B.computedPosition=w0({x:X,y:_e,z:he},Ie):B.computedPosition=Ie},{flush:"post",immediate:!0}),t.watch([()=>B.extent,p],([F,Q],[X,_e])=>{(F!==X||Q!==_e)&&ke()}),B.extent==="parent"||typeof B.extent=="object"&&"range"in B.extent&&B.extent.range==="parent"?ml(()=>ie).toBe(!0).then(ke):ke(),()=>B.hidden?null:t.h("div",{ref:L,"data-id":B.id,class:["vue-flow__node",`vue-flow__node-${pe.value===!1?"default":B.type||"default"}`,{[o.value]:v.value,dragging:ye==null?void 0:ye.value,draggable:v.value,selected:B.selected,selectable:M.value,parent:B.isParent},ge.value],style:{visibility:ie.value?"visible":"hidden",zIndex:B.computedPosition.z??se.value,transform:`translate(${B.computedPosition.x}px,${B.computedPosition.y}px)`,pointerEvents:W.value?"all":"none",...me.value},tabIndex:U.value?0:void 0,role:U.value?"group":void 0,"aria-describedby":h.value?void 0:`${fm}-${n}`,"aria-label":B.ariaLabel,"aria-roledescription":"node",...B.domAttributes,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onContextmenu:le,onClick:z,onDblclick:ue,onKeydown:P},[t.h(pe.value===!1?m.value.default:pe.value,{id:B.id,type:B.type,data:B.data,events:{...B.events,...w},selected:B.selected,resizing:B.resizing,dragging:ye.value,connectable:D.value,position:B.computedPosition,dimensions:B.dimensions,isValidTargetPos:B.isValidTargetPos,isValidSourcePos:B.isValidSourcePos,parent:B.parentNode,parentNodeId:B.parentNode,zIndex:B.computedPosition.z??se.value,targetPosition:B.targetPosition,sourcePosition:B.sourcePosition,label:B.label,dragHandle:B.dragHandle,onUpdateNodeInternals:Se})]);function ke(){const F=B.computedPosition,{computedPosition:Q,position:X}=zl(B,k.value?La(F,N.value):F,l.error,p.value,O.value);(B.computedPosition.x!==Q.x||B.computedPosition.y!==Q.y)&&(B.computedPosition={...B.computedPosition,...Q}),(B.position.x!==X.x||B.position.y!==X.y)&&(B.position=X)}function Se(){L.value&&d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])}function ce(F){ye!=null&&ye.value||y.mouseEnter({event:F,node:B})}function fe(F){ye!=null&&ye.value||y.mouseMove({event:F,node:B})}function oe(F){ye!=null&&ye.value||y.mouseLeave({event:F,node:B})}function le(F){return y.contextMenu({event:F,node:B})}function ue(F){return y.doubleClick({event:F,node:B})}function z(F){M.value&&(!i.value||!v.value||b.value>0)&&jl(B,r.value,c,s,a,!1,L.value),y.click({event:F,node:B})}function P(F){if(!(Bl(F)||h.value))if(hm.includes(F.key)&&M.value){const Q=F.key==="Escape";jl(B,r.value,c,s,a,Q,L.value)}else v.value&&B.selected&&Ro[F.key]&&(F.preventDefault(),g.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~B.position.x}, y: ${~~B.position.y}`,$({x:Ro[F.key].x,y:Ro[F.key].y},F.shiftKey))}}});function rw(e={includeHiddenNodes:!1}){const{nodes:n}=je();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const lw={class:"vue-flow__nodes vue-flow__container"},sw={name:"Nodes",compatConfig:{MODE:3}},cw=t.defineComponent({...sw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=je(),a=rw(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",lw,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(aw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=p,f},s,0),128)):t.createCommentVNode("",!0)]))}});function dw(){const{emits:e}=je();t.onMounted(()=>{if(zm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ft(st.MISSING_STYLES))}})}const uw=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),mw={name:"VueFlow",compatConfig:{MODE:3}},fw=t.defineComponent({...mw,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const i=e,a=t.useSlots(),r=fl(i,"modelValue",o),l=fl(i,"nodes",o),s=fl(i,"edges",o),c=je(i),d=Z0({modelValue:r,nodes:l,edges:s},i,c);return eN(o,c.hooks),GN(),dw(),t.provide(Pa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(zN,null,{default:t.withCtx(()=>[t.createVNode(iw),uw,t.createVNode(cw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(KN)],512))}}),pw={name:"Panel",compatConfig:{MODE:3}},df=t.defineComponent({...pw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=je(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),hw=["width","height","innerHTML"],yw=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={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"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"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)=>(t.openBlock(),t.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:n[e.name]??""},null,8,hw))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ae=Ke(yw,[["__scopeId","data-v-05aac699"]]),Qn=["red","amber","green","teal","blue","indigo","violet","pink"],uf={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function gw(e){return typeof e=="string"&&e in uf}const bw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},_w=.15;function kw(e){const n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n)return null;let o=n[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,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function Ew(e){if(typeof e!="string")return null;const n=kw(e);if(!n||n.s<_w)return null;let o=null,i=1/0;for(const a of Qn){const r=Math.abs(n.h-bw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function _t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(gw(n))return n;const o=e==null?void 0:e.properties;return Ew((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Jl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Nw={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)"},ww={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 mf(e,n=!1){return e?n?ww[e]:Nw[e]:null}function eo(e){return uf[e]}function To(e){return`var(--em-swatch-${e}-bar)`}function Iw(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function vw(e,n){const o=Iw(n);return o?e(o):n.split("-")[1]??n}function xw(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function ff(e,n){const o=xw(n);if(n.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=n.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,n.params)}function Cw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Sw={class:"em-inline-issue__msgs"},to=Ke(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode(Ae,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",Sw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(c,d)=>(t.openBlock(),t.createElementBlock("span",{key:d},t.toDisplayString(t.unref(ff)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Rw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Aw={key:0,class:"em-mlang__dot"},$w=["id","role","aria-labelledby"],Tw=["title"],dn=Ke(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const N=o.defaultLang;return N&&o.languages.includes(N)?N:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const N=o.activeLang;return N&&o.languages.includes(N)?N:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(N){var b,_;return!!((_=(b=o.modelValue)==null?void 0:b[N])!=null&&_.trim())}const d=N=>`${o.name}-tab-${N}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(N){var E,I;const b=o.languages,_=b[(N+b.length)%b.length];_&&(l.value=_,await t.nextTick(),(I=(E=m.value)==null?void 0:E.querySelectorAll('[role="tab"]')[b.indexOf(_)])==null||I.focus())}function f(N){p(o.languages.indexOf(s.value)+N)}const h=t.computed(()=>o.languages.filter(N=>{var b,_;return N!==s.value&&!!((_=(b=o.modelValue)==null?void 0:b[N])!=null&&_.trim())})),g=t.computed(()=>{var N;return((N=o.modelValue)==null?void 0:N[s.value])??""});function k(N){const b={...o.modelValue};N.trim()===""?delete b[s.value]:b[s.value]=N,i("update:modelValue",b)}return(N,b)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,_=>(t.openBlock(),t.createElementBlock("span",{id:d(_),key:_,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===_}]),role:"tab","aria-selected":s.value===_,"aria-controls":u.value,tabindex:s.value===_?0:-1,onClick:E=>l.value=_,onKeydown:[t.withKeys(t.withModifiers(E=>l.value=_,["prevent"]),["enter"]),t.withKeys(t.withModifiers(E=>l.value=_,["prevent"]),["space"]),b[0]||(b[0]=t.withKeys(t.withModifiers(E=>f(-1),["prevent"]),["left"])),b[1]||(b[1]=t.withKeys(t.withModifiers(E=>f(1),["prevent"]),["right"])),b[2]||(b[2]=t.withKeys(t.withModifiers(E=>p(0),["prevent"]),["home"])),b[3]||(b[3]=t.withKeys(t.withModifiers(E=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(_),1),c(_)?(t.openBlock(),t.createElementBlock("span",Aw,"•")):t.createCommentVNode("",!0)],42,Rw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(ee.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":k},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":k},null,8,["name","placeholder","model-value"]))],8,$w),r.value&&h.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:h.value.join(", "),"aria-hidden":"true"},"•",8,Tw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Mw=["disabled"],Vw={class:"em-panel__sub-label"},Bw={class:"em-field"},Dw={class:"em-field"},Ow={class:"em-field"},Lw={class:"em-class"},Pw={class:"em-field"},zw={class:"em-field"},Fw={class:"em-field"},Uw={class:"em-field"},Hw={class:"em-multilang"},jw={class:"em-multilang"},Kw={class:"em-jpa"},Gw={class:"em-field"},Yw={class:"em-field"},qw={class:"em-field"},Ww=["title"],Jw={class:"em-swatch"},Xw={class:"em-swatch__row"},Zw=["title"],Qw=["title","onClick"],pf=Ke(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(O=>O.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(O=>O.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var O;return _t(((O=l.value)==null?void 0:O.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"],m=O=>O;function p(O){return O==="inherit"?a.t("em.common.inherit"):O}function f(O){r.value&&a.updateEntity(r.value.modelId,O)}function h(O,y,w){var M;const v=((M=r.value)==null?void 0:M.table)??{physicalName:""};f(O==="physicalName"?{table:{...v,physicalName:w}}:{table:{...v,logicalName:{...v.logicalName,[y]:w}}})}function g(O){f({description:Object.keys(O).length?O:void 0})}function k(O,y){var w;f({jpaAttrs:{...(w=r.value)==null?void 0:w.jpaAttrs,[O]:y}})}function N(O,y){k(O,y)}const b=t.computed(()=>{var O,y;return((y=(O=r.value)==null?void 0:O.jpaAttrs)==null?void 0:y.discriminatorType)??"inherit"}),_=t.computed(()=>{var O,y;return!((y=(O=r.value)==null?void 0:O.jpaAttrs)!=null&&y.useDiscriminator)});function E(O){k("discriminatorType",O==="inherit"?void 0:O)}function I(O){f({hasPersonalInfo:O})}function A(O){f({referenceOnly:O?!0:void 0})}function T(O){f({superClass:O.trim()||void 0})}function L(O){f({schema:O.trim()||void 0})}function x(O){f({abstractClass:O})}const R=t.computed(()=>{var O,y;return((y=(O=r.value)==null?void 0:O.declarationOfInterfaces)==null?void 0:y.join(", "))??""});function $(O){const y=O.split(",").map(w=>w.trim()).filter(Boolean);f({declarationOfInterfaces:y.length?y:void 0})}function B(O){r.value&&a.setEntitySwatch(r.value.modelId,O)}return(O,y)=>{var w,v,M;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:y[0]||(y[0]=D=>i("toggle"))},[t.createElementVNode("span",Vw,[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(to,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Bw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":y[1]||(y[1]=D=>f({name:D}))},null,8,["model-value"])]),t.createElementVNode("label",Dw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(Ko),"onUpdate:modelValue":y[2]||(y[2]=D=>f({stereotype:D}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Ow,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":y[3]||(y[3]=D=>f({packageName:D}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Lw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Pw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":y[4]||(y[4]=D=>T(D))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",zw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":R.value,"onUpdate:modelValue":y[5]||(y[5]=D=>$(D))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":y[6]||(y[6]=D=>x(D))},null,8,["label","model-value"])]),t.createElementVNode("label",Fw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-table",width:"100%","model-value":((w=r.value.table)==null?void 0:w.physicalName)??"","onUpdate:modelValue":y[7]||(y[7]=D=>h("physicalName",null,D))},null,8,["model-value"])]),t.createElementVNode("label",Uw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":y[8]||(y[8]=D=>L(D))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",Hw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,D=>{var U,W;return t.openBlock(),t.createElementBlock("label",{key:D,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(D),1),t.createVNode(t.unref(ee.BSTextInput),{name:`ent-logical-${D}`,width:"100%","model-value":((W=(U=r.value.table)==null?void 0:U.logicalName)==null?void 0:W[D])??"","onUpdate:modelValue":ie=>h("logicalName",D,ie)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Kw,[y[13]||(y[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,D=>{var U;return t.createVNode(t.unref(ee.BSCheckbox),{key:D.key,name:`jpa-${D.key}`,class:"em-check",label:D.label,"model-value":!!((U=r.value.jpaAttrs)!=null&&U[D.key]),"onUpdate:modelValue":W=>N(D.key,W)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Gw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:_.value,"model-value":((v=r.value.jpaAttrs)==null?void 0:v.discriminatorColumnName)??"","onUpdate:modelValue":y[9]||(y[9]=D=>k("discriminatorColumnName",D.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",Yw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(ee.BSSelect),{disabled:_.value,"model-value":b.value,items:u,"value-provider":m,"label-provider":p,"onUpdate:modelValue":y[10]||(y[10]=D=>D&&E(D))},null,8,["disabled","model-value"])]),t.createElementVNode("label",qw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(ee.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:_.value,"model-value":(M=r.value.jpaAttrs)==null?void 0:M.discriminatorLength,"onUpdate:modelValue":y[11]||(y[11]=D=>k("discriminatorLength",D||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":I},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":A},null,8,["label","model-value"])],8,Ww),t.createElementVNode("fieldset",Jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",Xw,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:y[12]||(y[12]=D=>B(null))},"∅",10,Zw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),D=>(t.openBlock(),t.createElementBlock("button",{key:D,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===D}]),style:t.normalizeStyle({background:t.unref(To)(D)}),title:t.unref(a).t(t.unref(eo)(D)),onClick:U=>B(D)},null,14,Qw))),128))])])],64)):t.createCommentVNode("",!0)],8,Mw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),eI=["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"],hf=["inherit","true","false"],Ya="__OWN__";function yf(e,n){const o=t.computed(()=>e.state.logical.entities.find(K=>K.modelId===n())??null),i=t.computed(()=>{var K;return((K=o.value)==null?void 0:K.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(K){return K==="none"?e.t("em.common.noneParen"):K}const l=K=>K;function s(K,te){o.value&&e.updateAttribute(o.value.modelId,K.modelId,te)}function c(K){return!!o.value&&!!Ji(e.state.logical,o.value.modelId,K.modelId)}function d(K,te){s(K,{naturalId:te||void 0,naturalIdMutable:te?K.naturalIdMutable:void 0})}function u(){return{naturalId:void 0,naturalIdMutable:void 0}}function m(K,te){s(K,{identifier:te,...te?u():{}})}function p(K,te){s(K,{transient:te||void 0,...te?u():{}})}function f(K){return!!K.transient||K.attrType==="RELATION_REF"}function h(K){return Oi(K)}function g(K,te=0){var G;return((G=Li(K,o.value,e.state.logical.entities,e.state.logical.associations,te))==null?void 0:G.physicalName)||void 0}const k=K=>K.value,N=K=>K.label;function b(K,te){if(!te)return;const G=$.value.find(ae=>ae.type===te);if(G){const ae=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};s(K,{type:te,customType:void 0,dbAttrs:[{...ae,dataType:G.dataType,length:G.length,scale:G.scale}]});return}s(K,te===tn?{type:te}:{type:te,customType:void 0})}function _(K,te){s(K,{customType:te.trim()===""?void 0:te})}function E(K,te){if(K.attrType==="RELATION_REF")return;const ae={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...te};te.dataType!==void 0&&!Sr.has(ae.dataType)&&(ae.scale=void 0),s(K,{dbAttrs:[ae]})}function I(K){var te;return Sr.has(((te=K.dbAttrs[0])==null?void 0:te.dataType)??"")}function A(K){return!I(K)&&!h(K)&&!f(K)?e.t("em.attr.scaleTypeHint"):void 0}function T(K,te){E(K,{logicalName:Object.keys(te).length?te:void 0})}function L(K,te){s(K,{description:Object.keys(te).length?te:void 0})}function x(K){return K.personalInfoAttributeType??"none"}function R(K,te){s(K,{personalInfoAttributeType:te==="none"?void 0:te})}const $=t.computed(()=>e.predefinedCustomTypeCatalog.value),B=t.computed(()=>e.embeddableCatalog.value);function O(K){var te,G,ae;return((te=K.label)==null?void 0:te[e.userLanguage.value])??((G=K.label)==null?void 0:G.ko)??((ae=K.label)==null?void 0:ae.en)??K.type}const y=t.computed(()=>e.groupCodeCatalog.value);function w(K){var te;return((te=y.value.find(G=>G.groupCode===K.groupCode))==null?void 0:te.codes)??[]}function v(K){return["none",...w(K)]}function M(K){return K==="none"?"none":K.code}function D(K){var G,ae,Be;if(K==="none")return e.t("em.common.noneParen");const te=((G=K.label)==null?void 0:G[e.userLanguage.value])??((ae=K.label)==null?void 0:ae.ko)??((Be=K.label)==null?void 0:Be.en);return te?`${K.code} (${te})`:K.code}function U(K,te){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,te)}function W(K,te){s(K,{defaultValue:te==="none"?void 0:te})}function ie(K,te){s(K,{defaultValue:te.trim()===""?void 0:te})}function pe(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}function ye(K,te,G){const ae=K.dbAttrs.map((Be,Ve)=>{if(Ve!==te)return Be;const H={...Be,...G};for(const V of Object.keys(G))G[V]===void 0&&delete H[V];return H});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,ae)}function ge(K,te,G){ye(K,te,{logicalName:Object.keys(G).length?G:void 0})}function me(K,te){var Be,Ve,H;if(K.attrType==="EMBED_PREDEF"){const V=(Be=e.embeddableCatalog.value.find(Pe=>Pe.type===K.type))==null?void 0:Be.fields[te];return V?{name:V.name,physicalName:V.physicalName,dataType:V.dataType,length:V.length,scale:V.scale,shareable:V.shareable,logicalName:V.logicalName}:void 0}const G=(Ve=K.embedded)==null?void 0:Ve.embeddableRef;if(!G)return;const ae=(H=e.state.logical.entities.find(V=>V.modelId===G))==null?void 0:H.attributes.flatMap(V=>V.dbAttrs)[te];return ae?{physicalName:ae.physicalName,dataType:ae.dataType,length:ae.length,scale:ae.scale,logicalName:ae.logicalName}:void 0}function se(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.dataType)||((ae=K.dbAttrs[te])==null?void 0:ae.dataType)||""}function ke(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.length)??((ae=K.dbAttrs[te])==null?void 0:ae.length)}function Se(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.scale)??((ae=K.dbAttrs[te])==null?void 0:ae.scale)}const ce=hf;function fe(K){return K==="inherit"?e.t("em.common.inherit"):K}function oe(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function le(K,te,G){ye(K,te,{updatable:G==="inherit"?void 0:G==="true"})}function ue(K,te){E(K,{updatable:te==="inherit"?void 0:te==="true"})}const z=hf;function P(K){return K==="inherit"?e.t("em.common.inherit"):K}function F(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function Q(K,te,G){ye(K,te,{insertable:G==="inherit"?void 0:G==="true"})}function X(K,te){E(K,{insertable:te==="inherit"?void 0:te==="true"})}const _e=t.computed(()=>o.value?Nr(o.value,e.state.logical.entities):[]),he=t.computed(()=>so(_e.value.flatMap(K=>K.attributes.flatMap(te=>te.dbAttrs)))),we=t.computed(()=>_e.value.flatMap(K=>K.attributes.filter(te=>te.attrType==="NORMAL"&&te.dbAttrs.length===1&&te.dbAttrs[0]).map(te=>{var G;return{modelId:te.dbAttrs[0].modelId,physical:te.dbAttrs[0].physicalName||te.name,isCurrency:te.type==="Currency",ownerName:K.modelId===((G=o.value)==null?void 0:G.modelId)?void 0:K.name}})));function Ie(){const K=[...we.value].sort((te,G)=>Number(G.isCurrency)-Number(te.isCurrency));return[Ya,...K.map(te=>te.modelId)]}function Y(K){if(K===Ya)return e.t("em.attr.sharedOwn");const te=we.value.find(ae=>ae.modelId===K);if(!te)return K;const G=te.ownerName?`${te.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:G,physical:te.physical,mode:te.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function j(K){return(K==null?void 0:K.sharedColumnRef)??Ya}function J(K,te,G){ye(K,te,{sharedColumnRef:G===Ya?void 0:G})}function ve(K){return(K==null?void 0:K.sharedColumnRef)!=null}function Te(K){var te;return((te=Bn(K,he.value))==null?void 0:te.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:eI,piiLabel:r,idn:l,setAttr:s,isManagedFk:c,setNaturalId:d,clearNaturalIdPatch:u,setIdentifier:m,setTransient:p,dbLocked:f,fkDerived:h,fkOriginPhysical:g,typeValueOf:k,typeLabelOf:N,setAttrType:b,setAttrCustomType:_,setDb:E,scaleApplicable:I,scaleHint:A,setDbLogical:T,setAttrDescription:L,attrPiiValue:x,setAttrPii:R,predefinedCustomTypeCatalog:$,embeddableCatalog:B,predefinedLabel:O,groupCodeCatalog:y,attrGroupCodes:w,attrCodeItems:v,codeValueOf:M,codeLabelOf:D,setAttrGroupCode:U,setAttrCode:W,setAttrDefaultValue:ie,isEmbedExpanded:pe,setDbAt:ye,setDbLogicalAt:ge,embedColMeta:me,fixedDataType:se,fixedLength:ke,fixedScale:Se,updatableItems:ce,updatableLabel:fe,updatableValue:oe,setUpdatableAt:le,setUpdatable:ue,insertableItems:z,insertableLabel:P,insertableValue:F,setInsertableAt:Q,setInsertable:X,scopeEntities:_e,columnsById:he,sharedCandidates:we,sharedItems:Ie,sharedLabel:Y,sharedValue:j,setSharedAt:J,isShared:ve,sharedPhysical:Te}}const gf={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every embedded column in this entity","em.node.embedAllShow":"Expand all collapsed embedded columns","em.node.embedAllSummary":"{n} embedded column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},bf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティの埋め込み列をすべて折りたたむ","em.node.embedAllShow":"折りたたまれた埋め込み列をすべて展開","em.node.embedAllSummary":"埋め込み列 {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},_f={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 임베드 컬럼 모두 접기","em.node.embedAllShow":"접힌 임베드 컬럼 모두 펼치기","em.node.embedAllSummary":"임베드 컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},tI=["ko","en","ja"],Xl={ko:_f,en:gf,ja:bf};function Dt(e,n,o){let a=(Xl[e]??Xl.ko)[n]??Xl.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const kf=["ko","en","ja","zh"];function nI(e){if(e)for(const n of kf){const o=e[n];if(o)return o}}function Zl(e){const n=nI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function oI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:kf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const iI=["aria-expanded","placeholder"],aI=["aria-selected","onClick","onMouseenter"],rI={key:0,class:"gcc__opt gcc__opt--empty"},Ef=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(x,R)=>Dt(o.locale??"ko",x,R),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),p=t.computed(()=>o.items.find(x=>x.groupCode===o.modelValue)),f=t.computed(()=>p.value?Zl(p.value):"");t.watch(f,x=>{d.value||(c.value=x)},{immediate:!0});const h=t.computed(()=>c.value===f.value?o.items:oI(o.items,c.value));function g(){var R;const x=(R=r.value)==null?void 0:R.getBoundingClientRect();x&&(m.value={left:`${x.left}px`,top:`${x.bottom}px`,width:`${x.width}px`})}function k(){d.value=!0,g(),u.value=Math.max(0,h.value.findIndex(x=>x.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",L)}function N(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",L)}t.onBeforeUnmount(N);function b(){k(),t.nextTick(()=>{var x;return(x=l.value)==null?void 0:x.select()})}function _(){d.value||k(),u.value=0}function E(x){i("update:modelValue",x.groupCode),c.value=Zl(x),N()}function I(){i("update:modelValue",void 0),c.value="",N()}function A(){c.value.trim()===""?I():(c.value=f.value,N())}function T(x){var R;if(x.key==="ArrowDown")d.value||k(),u.value=Math.min(u.value+1,h.value.length-1),x.preventDefault();else if(x.key==="ArrowUp")u.value=Math.max(u.value-1,0),x.preventDefault();else if(x.key==="Enter"){const $=h.value[u.value];$&&E($),x.preventDefault()}else x.key==="Escape"&&(c.value=f.value,N(),(R=l.value)==null||R.blur())}function L(x){var $,B;const R=x.target;!(($=r.value)!=null&&$.contains(R))&&!((B=s.value)!=null&&B.contains(R))&&A()}return(x,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":R[0]||(R[0]=$=>c.value=$),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:b,onInput:_,onKeydown:T},null,40,iI),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:R[1]||(R[1]=t.withModifiers(()=>{},["prevent"])),onClick:I},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,($,B)=>(t.openBlock(),t.createElementBlock("li",{key:$.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":B===u.value,"is-selected":$.groupCode===e.modelValue}]),role:"option","aria-selected":$.groupCode===e.modelValue,onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["prevent"])),onClick:O=>E($),onMouseenter:O=>u.value=B},t.toDisplayString(t.unref(Zl)($)),43,aI))),128)),h.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",rI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),lI=["aria-labelledby"],sI=["aria-checked","tabindex","onClick","onKeydown"],Nf=Ke(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,sI))),128))],8,lI))}}),[["__scopeId","data-v-5c793bbb"]]),cI=["disabled"],dI={class:"em-aw__toolbar"},uI={class:"em-aw__count"},mI={class:"em-aw__scroll"},fI={class:"em-aw__table"},pI={class:"c-name"},hI={class:"c-type"},yI={class:"c-logical"},gI=["id"],bI={class:"c-col"},_I={class:"c-constraints"},kI={class:"c-del"},EI={class:"c-expand"},NI=["title","onClick","onKeydown"],wI=["title"],II={key:1,class:"em-aw__muted"},vI=["title"],xI=["title"],CI=["title"],SI={class:"em-aw__cflags"},RI=["title"],AI={colspan:"8"},$I={class:"em-aw__detail"},TI={class:"em-aw__dgroup"},MI=["title"],VI={class:"em-aw__df"},BI={class:"em-aw__df"},DI={class:"em-aw__dgroup"},OI={key:0,class:"em-aw__dgroup"},LI={class:"em-aw__df"},PI={key:0,class:"em-aw__df"},zI={class:"em-aw__df"},FI={class:"em-aw__dgroup em-aw__ddesc"},UI={class:"c-expand"},HI={class:"em-aw__caret is-static","aria-hidden":"true"},jI={class:"c-del"},KI={class:"c-expand"},GI=["title","onClick","onKeydown"],YI={class:"em-aw__embed-label"},qI=["title"],WI=["title"],JI={class:"em-aw__ro"},XI=["title"],ZI={class:"em-aw__ro"},QI=["title"],ev={class:"em-aw__ro"},tv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},nv={colspan:"8"},ov={class:"em-aw__detail"},iv={class:"em-aw__dgroup"},av={key:0,class:"em-aw__df"},rv={class:"em-aw__df"},lv={class:"em-aw__df"},sv={key:0},cv={colspan:"99",class:"em-aw__empty"},dv=6,uv=5,mv=Ke(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:p,setTransient:f,dbLocked:h,fkDerived:g,fkOriginPhysical:k,typeValueOf:N,typeLabelOf:b,setAttrType:_,setAttrCustomType:E,setDb:I,scaleApplicable:A,scaleHint:T,setDbLogical:L,attrPiiValue:x,setAttrPii:R,predefinedCustomTypeCatalog:$,embeddableCatalog:B,predefinedLabel:O,groupCodeCatalog:y,attrGroupCodes:w,attrCodeItems:v,codeValueOf:M,codeLabelOf:D,setAttrGroupCode:U,setAttrCode:W,setAttrDefaultValue:ie,setAttrDescription:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:z,insertableItems:P,insertableLabel:F,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:Y,isShared:j,sharedPhysical:J}=yf(o,()=>n.entityId),ve=t.computed(()=>{var Ve;return[...((Ve=i.value)==null?void 0:Ve.attributes)??[]].sort((H,V)=>H.order-V.order)}),Te=t.computed(()=>{var Ve;return(((Ve=i.value)==null?void 0:Ve.attributes)??[]).filter(H=>H.attrType!=="DIVIDER").length}),K=t.ref(new Set);function te(Ve){return K.value.has(Ve)}function G(Ve){const H=new Set(K.value);H.has(Ve)?H.delete(Ve):H.add(Ve),K.value=H}const ae=t.ref(o.userLanguage.value);function Be(Ve){!Ve||!i.value||o.addPredefinedEmbed(i.value.modelId,Ve)}return(Ve,H)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",dI,[t.createElementVNode("span",uI,t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:H[0]||(H[0]=V=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:H[1]||(H[1]=V=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(B).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(B),"value-provider":V=>V.type,"label-provider":t.unref(O),"onUpdate:modelValue":Be},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",mI,[t.createElementVNode("table",fI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[H[3]||(H[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",pI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",hI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",yI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,gI),t.createVNode(Nf,{modelValue:ae.value,"onUpdate:modelValue":H[2]||(H[2]=V=>ae.value=V),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",bI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),H[4]||(H[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),H[5]||(H[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",_I,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),H[6]||(H[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value,V=>{var Pe,Ze,Ue,Le,De,Z,dt,yn,Et,gn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:V.modelId},[V.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(V.modelId)}])},[H[7]||(H[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-divlabel-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:dv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",kI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])])],2)):t.unref(ye)(V)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(V.modelId)}])},[t.createElementVNode("td",UI,[t.createElementVNode("span",HI,[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-type-${V.modelId}`,width:"100%",disabled:"","model-value":V.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:uv,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:V.dbAttrs.length})),1),t.createElementVNode("td",jI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.dbAttrs,(Ee,at)=>{var zt,ut,Qt,en,Ne,et,Ft,pt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":te(Ee.modelId)}])},[t.createElementVNode("td",KI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(Ee.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(Ee.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:nt=>G(Ee.modelId),onKeydown:[t.withKeys(t.withModifiers(nt=>G(Ee.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(nt=>G(Ee.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,GI)]),t.createElementVNode("td",YI,"↳ "+t.toDisplayString(((zt=t.unref(se)(V,at))==null?void 0:zt.name)??((ut=t.unref(se)(V,at))==null?void 0:ut.physicalName)??t.unref(o).t("em.attr.colFallback",{n:at+1})),1),H[14]||(H[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(dn,{name:`aw-embed-logical-${Ee.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:((en=(Qt=t.unref(se)(V,at))==null?void 0:Qt.logicalName)==null?void 0:en[ae.value])??((et=(Ne=t.unref(se)(V,at))==null?void 0:Ne.logicalName)==null?void 0:et.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ee.logicalName,"onUpdate:modelValue":nt=>t.unref(me)(V,at,nt)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(j)(Ee)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-embed-col-${Ee.modelId}`,width:"100%",disabled:t.unref(j)(Ee),placeholder:((Ft=t.unref(se)(V,at))==null?void 0:Ft.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(j)(Ee)?t.unref(J)(Ee):Ee.physicalName,"onUpdate:modelValue":nt=>t.unref(ge)(V,at,{physicalName:nt})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(to,{controller:t.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"])],8,qI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",JI,t.toDisplayString(t.unref(ke)(V,at)),1)],8,WI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",ZI,t.toDisplayString(t.unref(Se)(V,at)??""),1)],8,XI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",ev,t.toDisplayString(t.unref(ce)(V,at)!=null?`scale ${t.unref(ce)(V,at)}`:""),1)],8,QI),H[15]||(H[15]=t.createElementVNode("td",null,null,-1))],2),te(Ee.modelId)?(t.openBlock(),t.createElementBlock("tr",tv,[H[18]||(H[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",nv,[t.createElementVNode("div",ov,[t.createElementVNode("fieldset",iv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(pt=t.unref(se)(V,at))!=null&&pt.shareable?(t.openBlock(),t.createElementBlock("label",av,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(Ie)(Ee),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":nt=>nt&&t.unref(Y)(V,at,nt)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",rv,[H[16]||(H[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ee),"model-value":t.unref(j)(Ee)?"false":t.unref(Q)(Ee),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":nt=>nt&&t.unref(X)(V,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",lv,[H[17]||(H[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ee),"model-value":t.unref(j)(Ee)?"false":t.unref(le)(Ee),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":nt=>nt&&t.unref(ue)(V,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(r).has(V.modelId),"em-aw__open":te(V.modelId)})},[t.createElementVNode("td",EI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(V.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(V.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:Ee=>G(V.modelId),onKeydown:[t.withKeys(t.withModifiers(Ee=>G(V.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Ee=>G(V.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,NI)]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-type-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!V.groupCode||V.attrType==="RELATION_REF"||t.unref(g)(V),items:t.unref(ec)(V.type,t.unref($)),"value-provider":t.unref(N),"label-provider":t.unref(b),"model-value":V.type,"onUpdate:modelValue":Ee=>t.unref(_)(V,Ee)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),V.type===t.unref(tn)&&!t.unref(g)(V)?(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:0,name:`aw-customtype-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":V.customType??"","onUpdate:modelValue":Ee=>t.unref(E)(V,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,wI),t.createElementVNode("td",null,[V.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(dn,{key:0,name:`aw-logical-${V.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Pe=V.dbAttrs[0])==null?void 0:Pe.logicalName,"onUpdate:modelValue":Ee=>t.unref(L)(V,Ee)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",II,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-col-${V.modelId}`,width:"100%",placeholder:t.unref(k)(V)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(h)(V),"model-value":((Ze=V.dbAttrs[0])==null?void 0:Ze.physicalName)??"","onUpdate:modelValue":Ee=>t.unref(I)(V,{physicalName:Ee})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(to,{controller:t.unref(o),"ref-id":(Ue=V.dbAttrs[0])==null?void 0:Ue.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-dtype-${V.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(h)(V)||t.unref(g)(V),items:t.unref(Xs)(((Le=V.dbAttrs[0])==null?void 0:Le.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Cr),"model-value":((De=V.dbAttrs[0])==null?void 0:De.dataType)??"","onUpdate:modelValue":Ee=>Ee&&t.unref(I)(V,{dataType:Ee})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,vI),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-len-${V.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(h)(V)||t.unref(g)(V),"model-value":(Z=V.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":Ee=>t.unref(I)(V,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,xI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",SI,[t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-pk-${V.modelId}`,label:"PK","model-value":V.identifier,disabled:t.unref(a)||t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(p)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nn-${V.modelId}`,label:"NN","model-value":V.notNull,disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(d)(V,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-uq-${V.modelId}`,label:"UQ","model-value":!!((dt=V.dbAttrs[0])!=null&&dt.unique),disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(I)(V,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,CI),t.createElementVNode("td",{class:"c-del",title:t.unref(u)(V)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])],8,RI)],2),te(V.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(V.modelId)}])},[H[13]||(H[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",AI,[t.createElementVNode("div",$I,[t.createElementVNode("fieldset",TI,[H[11]||(H[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(T)(V)},[H[8]||(H[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-scale-${V.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(h)(V)||t.unref(g)(V)||!t.unref(A)(V),"model-value":(yn=V.dbAttrs[0])==null?void 0:yn.scale,"onUpdate:modelValue":Ee=>t.unref(I)(V,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,MI),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-ai-${V.modelId}`,label:"Auto Increment","model-value":!!((Et=V.dbAttrs[0])!=null&&Et.autoIncrement),disabled:t.unref(h)(V)||t.unref(g)(V)||!V.identifier,"onUpdate:modelValue":Ee=>t.unref(I)(V,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",VI,[H[9]||(H[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-ins-${V.modelId}`,width:"110px",disabled:t.unref(h)(V),"model-value":t.unref(Q)(V.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ee=>Ee&&t.unref(_e)(V,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",BI,[H[10]||(H[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-upd-${V.modelId}`,width:"110px",disabled:t.unref(h)(V),"model-value":t.unref(le)(V.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ee=>Ee&&t.unref(z)(V,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",DI,[H[12]||(H[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-tr-${V.modelId}`,label:"@Transient","model-value":!!V.transient,disabled:V.identifier||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(f)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nid-${V.modelId}`,label:"@NaturalId","model-value":!!V.naturalId,disabled:V.identifier||t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(m)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${V.modelId}`,label:"mutable","model-value":!!V.naturalIdMutable,disabled:t.unref(h)(V)||!V.naturalId,"onUpdate:modelValue":Ee=>t.unref(d)(V,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-mv-${V.modelId}`,label:"Multi-Value (Set)","model-value":!!((gn=V.dbAttrs[0])!=null&&gn.multiValue),disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(I)(V,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(g)(V)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",OI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",LI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(x)(V),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ee=>Ee&&t.unref(R)(V,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(y).length?(t.openBlock(),t.createElementBlock("label",PI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Ef,{"model-value":V.groupCode,items:t.unref(y),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ee=>t.unref(U)(V,Ee)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",zI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(w)(V).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"150px","model-value":V.defaultValue??"none",items:t.unref(v)(V),"value-provider":t.unref(M),"label-provider":t.unref(D),"onUpdate:modelValue":Ee=>Ee&&t.unref(W)(V,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`aw-default-${V.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":V.defaultValue??"","onUpdate:modelValue":Ee=>t.unref(ie)(V,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",FI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`aw-desc-${V.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":V.description,"onUpdate:modelValue":Ee=>t.unref(pe)(V,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",sv,[t.createElementVNode("td",cv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,cI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-559a29b3"]]);function Ql(e,n){return n&&n!==e?`${e} (${n})`:e}function wf(e,n,o){const i=e.dbAttrs[n];return i?Go(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function If(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):Ql(o,wf(e,0,n))}function vf(e,n){var l;if(Mn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?Ql(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return Ql(i,wf(o,r<0?0:r,n))}const fv=["disabled"],pv={class:"em-idxw__list"},hv={class:"em-idxw__list-head"},yv=["aria-label"],gv=["aria-current","onClick","onKeydown"],bv={class:"em-idxw__item-name"},_v={key:0,class:"em-idxw__badge"},kv={class:"em-idxw__item-cnt"},Ev={key:0,class:"em-idxw__empty"},Nv={key:0,class:"em-idxw__edit"},wv={class:"em-idxw__form"},Iv={class:"em-field em-idxw__name"},vv={class:"em-field"},xv=["value","placeholder"],Cv={class:"em-idxw__transfer"},Sv={class:"em-idxw__pane"},Rv={class:"em-idxw__pane-head"},Av=["aria-label"],$v=["aria-pressed","onClick","onKeydown"],Tv=["title"],Mv={key:0,class:"em-idxw__empty"},Vv={class:"em-idxw__arrows"},Bv={class:"em-idxw__pane"},Dv={class:"em-idxw__pane-head"},Ov={class:"em-idxw__col-name"},Lv=["title"],Pv={class:"em-idxw__col-ops"},zv=["title","disabled","onClick"],Fv=["title","disabled","onClick"],Uv=["title","onClick"],Hv={key:0,class:"em-idxw__empty"},jv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Kv=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(y=>y.modelId===n.entityId)??null),a=t.computed(()=>{var y;return((y=i.value)==null?void 0:y.indexes)??[]}),r=t.computed(()=>{var y;return((y=i.value)==null?void 0:y.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,y=>{var w;y.some(v=>v.modelId===s.value)||(s.value=((w=y[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(y=>y.modelId===s.value)??null),d=t.computed(()=>i.value?jo(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Tn(r.value)),m=y=>u.value.canon(y),p=t.computed(()=>{var y;return new Set((((y=c.value)==null?void 0:y.columns)??[]).map(w=>m(w.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function h(y){return If(y,f.value)}function g(y){return y.physicalName&&y.physicalName!==y.field?`${y.field} (${y.physicalName})`:y.field}function k(y){return vf(y,f.value)}const N=t.computed(()=>[...r.value.filter(y=>y.dbAttrs.length>0&&!p.value.has(m(y.modelId))).map(y=>({ref:y.modelId,label:h(y),inherited:!1})),...d.value.filter(y=>!p.value.has(m(y.modelId))).map(y=>({ref:y.modelId,label:g(y),inherited:!0}))]),b=t.ref(new Set);t.watch(s,()=>b.value=new Set);function _(y){return Mn(y)}function E(y,w){i.value&&o.updateIndex(i.value.modelId,y,w)}function I(){var w;if(!i.value)return;const y=Me();o.addIndex(i.value.modelId,{modelId:y,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=y}function A(y){i.value&&o.removeIndex(i.value.modelId,y)}function T(y){c.value&&E(c.value.modelId,{parameters:y.trim()===""?void 0:y})}function L(y){const w=new Set(b.value);w.has(y)?w.delete(y):w.add(y),b.value=w}function x(){const y=c.value;if(!y||!b.value.size)return;const w=[...b.value].map(v=>({columnRef:v,descending:!1}));E(y.modelId,{columns:[...y.columns,...w]}),b.value=new Set}function R(y){const w=c.value;w&&E(w.modelId,{columns:w.columns.filter((v,M)=>M!==y)})}function $(y,w){const v=c.value;v&&E(v.modelId,{columns:v.columns.map((M,D)=>D===y?{...M,descending:w}:M)})}function B(y,w){const v=c.value;if(!v)return;const M=y+w;if(M<0||M>=v.columns.length)return;const D=[...v.columns];[D[y],D[M]]=[D[M],D[y]],E(v.modelId,{columns:D}),O(M,w)}async function O(y,w){var W,ie;await t.nextTick();const v=(W=l.value)==null?void 0:W.querySelectorAll(".em-idxw__col--idx")[y];if(!v)return;const M=pe=>v.querySelector(`[data-move="${pe}"]`),D=M(w<0?"up":"down"),U=M(w<0?"down":"up");(ie=D&&!D.disabled?D:U)==null||ie.focus()}return(y,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",pv,[t.createElementVNode("div",hv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:I},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":v.modelId===s.value}]),role:"button",tabindex:"0","aria-current":v.modelId===s.value?"true":void 0,onClick:M=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(M=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(M=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",bv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",_v,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",kv,t.toDisplayString(v.columns.length),1)],42,gv))),128))],8,yv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Ev,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Nv,[t.createElementVNode("div",wv,[t.createElementVNode("label",Iv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=v=>E(c.value.modelId,{name:v}))},null,8,["model-value"]),t.createVNode(to,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=v=>E(c.value.modelId,{unique:v}))},null,8,["model-value"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=v=>A(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",vv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=v=>T(v.target.value))},null,40,xv)]),t.createElementVNode("div",Cv,[t.createElementVNode("div",Sv,[t.createElementVNode("div",Rv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:N.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:N.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":b.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":b.value.has(v.ref),onClick:M=>L(v.ref),onKeydown:[t.withKeys(t.withModifiers(M=>L(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(M=>L(v.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(v.label),1),v.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Tv)):t.createCommentVNode("",!0)],42,$v))),128))],8,Av),N.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Mv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",Vv,[t.createVNode(t.unref(ee.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!b.value.size,onClick:x},null,8,["caption","disabled"])]),t.createElementVNode("div",Bv,[t.createElementVNode("div",Dv,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(v,M)=>(t.openBlock(),t.createElementBlock("li",{key:M,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",Ov,[t.createTextVNode(t.toDisplayString(k(v.columnRef)),1),_(v.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Lv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idxw-desc-${M}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":D=>$(M,D)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",Pv,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:M===0,onClick:D=>B(M,-1)},"↑",8,zv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:M===c.value.columns.length-1,onClick:D=>B(M,1)},"↓",8,Fv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:D=>R(M)},"✕",8,Uv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Hv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",jv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,fv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),Gv={class:"em-op-src"},Yv=["placeholder"],qv={class:"em-op-src__actions"},xf=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(l,s)=>Dt(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",Gv,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,Yv),[[t.vModelText,a.value]]),t.createElementVNode("div",qv,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),Wv=["disabled"],Jv={class:"em-ow__toolbar"},Xv={class:"em-ow__count"},Zv={class:"em-ow__scroll"},Qv={class:"em-ow__table"},ex={class:"c-name"},tx={class:"c-desc"},nx=["id"],ox={class:"c-pii"},ix={class:"c-src"},ax={class:"c-del"},rx={key:0},lx={colspan:"6",class:"em-ow__empty"},sx=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModal(),a=t.computed(()=>o.state.logical.entities.find(k=>k.modelId===n.entityId)??null),r=t.computed(()=>{var k;return[...((k=a.value)==null?void 0:k.operations)??[]].sort((N,b)=>N.order-b.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],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(k){return k==="none"?o.t("em.common.noneParen"):k}const u=k=>k;function m(k,N){a.value&&o.updateOperation(a.value.modelId,k.modelId,N)}function p(k,N){m(k,{description:Object.keys(N).length?N:void 0})}function f(k){return k.personalInfoAttributeType??"none"}function h(k,N){m(k,{personalInfoAttributeType:N==="none"?void 0:N})}function g(k){i.openModal({component:xf,bind:{operationName:k.name,sourceCode:k.sourceCode??"",locale:o.uiLocale.value,onSave:N=>m(k,{sourceCode:N})}})}return(k,N)=>{var b,_;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",Jv,[t.createElementVNode("span",Xv,t.toDisplayString(t.unref(o).t("em.op.section",{n:((b=a.value.operations)==null?void 0:b.length)??0})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:N[0]||(N[0]=E=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",Zv,[t.createElementVNode("table",Qv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",ex,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),N[2]||(N[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",tx,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,nx),t.createVNode(Nf,{modelValue:l.value,"onUpdate:modelValue":N[1]||(N[1]=E=>l.value=E),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",ox,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",ix,t.toDisplayString(t.unref(o).t("em.op.body")),1),N[3]||(N[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,E=>(t.openBlock(),t.createElementBlock("tr",{key:E.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`ow-name-${E.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":E.name,"onUpdate:modelValue":I=>m(E,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":E.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&m(E,{visibility:I})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(dn,{name:`ow-desc-${E.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":E.description,"onUpdate:modelValue":I=>p(E,I)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":f(E),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":I=>I&&h(E,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t(E.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:I=>g(E)},null,8,["caption","onClick"])]),t.createElementVNode("td",ax,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(o).removeOperation(a.value.modelId,E.modelId)},null,8,["onClick"])])]))),128)),(_=a.value.operations)!=null&&_.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",rx,[t.createElementVNode("td",lx,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,Wv)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),cx={class:"em-detail__tabs"},dx=["onClick"],ux={key:0,class:"em-detail__lock"},mx=["disabled"],fx={key:0,class:"em-detail__narrow"},px=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",cx,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:p=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,dx)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",ux,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",fx,[t.createVNode(pf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(mv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(Kv,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(sx,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,mx)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function qa(e,n,o){e.openModal({component:px,bind:{controller:t.markRaw(n),entityId:o}})}function un(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>ld(e,r))}function Ot(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of Pd(l,r))i.push(da(a,s.indexRef,{columns:s.columns}))}return i}function Wa(e,n,o,i){var c;const a=[];a.push(...un(n,o.remove,i));for(const d of o.update)a.push(on(n,d.attributeId,d.patch));for(const d of o.add)a.push(jt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const p=l.filter(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,h)=>f.order-h.order)[0];p&&a.push(Tt(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function Mo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Ni(e,n,o){const i=[];for(const[a,r]of bc(e,n,Me))i.push(...Wa(e,a,r,o));for(const a of qg(e,n,Me))i.push(on(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function hx(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Gr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return Fd(e,n,r).map(l=>on(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function yx(e,n,o){const i=new Set(o.remove);return Mo(e,n,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function Ja(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of _c(e,r,Me)){const c=i.get(l);i.set(l,c?gc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...Wa(e,r,gx(l),o));return a}function gx(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function Cf(e){return e.attributes.flatMap(n=>n.dbAttrs).map(n=>({...n,modelId:Me()}))}function bx(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=Rt(o.attributes),p=new Set(o.attributes.map(h=>h.name));let f="id";for(let h=2;p.has(f);h++)f=`id${h}`;a={modelId:Me(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Me(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(jt(n,a))}const r=[];for(const m of e.entities)for(const p of m.attributes){if(((u=p.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(N=>N.modelId===p.embedded.associationRef);if(!f)continue;const h=f.end1.entityRef===m.modelId,g=h?f.end1:f.end2,k=h?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1},end2:{entityRef:n,multiplicity:k.multiplicity,navigable:k.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const p=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return p.size?{...m,attributes:m.attributes.filter(f=>!p.has(f.modelId))}:m}),associations:e.associations.map(m=>{const p=r.find(f=>f.assocId===m.modelId);return p?{...m,end1:p.end1,end2:p.end2}:m})},s=Wo(l,n,Me);for(const m of r){const p=s.add.find(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...un(m.ownerId,[m.dispId],c)),i.push(ca(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Wa(l,n,s,c));const d=yx(l,n,s);return i.push(...Ni(d,n,c)),i.push(...Ot(e,c)),i}function _x(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(_=>_.modelId===c);if(!d||d.attributes.some(_=>{var E;return((E=_.embedded)==null?void 0:E.associationRef)===r.modelId}))continue;const u=Me(),m=Rt(d.attributes),p=new Set(d.attributes.map(_=>_.name)),f=a(o.name);let h=f;for(let _=2;p.has(h);_++)h=`${f}${_}`;const g=o.attributes.filter(_=>!_.identifier&&!_.derivedFrom).flatMap(_=>_.dbAttrs).map(_=>({..._,modelId:Me()})),k={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(jt(c,k));const N=l?"end2":"end1",b=l?"end1":"end2";i.push(ca(r.modelId,{identifying:!1,[N]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Me()},[b]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Sf(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[od(n,o),...i.map(u=>ko(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(_d(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const p=e.layout.notes.find(f=>f.modelId===m);p&&c.push(ti(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}function kx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Me(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},p={...n.logical,associations:[...n.logical.associations,m]},f=Wo(p,s,Me),h=f.add[0];h&&(m.end2.attributeRef=h.modelId);const g={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(h==null?void 0:h.modelId)??d},k=sa(m,g),N=Wa(p,s,f,[]);return i(N.length?We("관계 추가",[k,...N]):k),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(A=>A.modelId===l),d=n.logical.entities.find(A=>A.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Me(),m=Me(),p=Me(),f=Rt(c.attributes),h=Cf(d),g=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),k=new Set(c.attributes.map(A=>A.name)),N=g(d.name);let b=N;for(let A=2;k.has(b);A++)b=`${N}${A}`;const _={modelId:m,name:b,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:h,embedded:{associationRef:u,embeddableRef:s}},E={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},I={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(We("임베드 추가",[jt(l,_),sa(E,I)])),u},setEmbedCardinality(l,s){var N;if(r(l))return;const c=n.logical.associations.find(b=>b.modelId===l);if(!c)return;let d,u;for(const b of n.logical.entities){const _=b.attributes.find(E=>{var I;return((I=E.embedded)==null?void 0:I.associationRef)===l&&E.attrType==="EMBED_OWN"});if(_){d=b.modelId,u=_;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,p=c.end2.entityRef===m?"end2":"end1",f=c[p];if(f.multiplicity===s)return;const h=b=>b==="ZERO_OR_MORE_INSTANCES"||b==="ONE_OR_MORE_INSTANCES",g=h(f.multiplicity),k=h(s);if(g===k){i(Tt(l,p,{multiplicity:s}));return}if(k)i(We("임베드 컬렉션 전환",[on(d,u.modelId,{dbAttrs:[]}),Tt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((N=f.jpa)==null?void 0:N.collectionType)??"LIST"}})]));else{const b=n.logical.entities.find(_=>_.modelId===m);if(!b)return;i(We("임베드 단일 전환",[on(d,u.modelId,{dbAttrs:Cf(b)}),Tt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=pd(l);if(!s){i(c);return}for(const f of n.logical.entities){const h=f.attributes.find(g=>{var k;return((k=g.embedded)==null?void 0:k.associationRef)===l});if(h){const g=[];i(We("임베드 삭제",[c,...un(f.modelId,[h.modelId],g),...Ot(n.logical,g)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=Ja(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(g=>g.modelId===s.end1.entityRef),h=f==null?void 0:f.attributes.find(g=>g.modelId===s.end1.attributeRef&&g.attrType==="RELATION_REF");h&&p.push(...un(f.modelId,[h.modelId],m))}p.push(...Ot(n.logical,m)),i(p.length?We("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(h=>h.modelId===l),d=ca(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(h=>h.modelId===l?{...h,identifying:s}:h)},p=[],f=Ja(m,[u],p);f.push(...Ot(n.logical,p)),i(f.length?We("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.modelId===d.end2.entityRef),p=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!p){if(c.navigable===!0&&!d.end1.attributeRef){const f=Ui(d.end2.multiplicity),h=d.end1.navFieldNameHint||ji(m.name,f),g=co(h,new Set(u.attributes.map(_=>_.name))),k=Me(),N=Rt(u.attributes),b={modelId:k,name:g,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:N,dbAttrs:[]};i(We("inverse nav 추가",[jt(d.end1.entityRef,b),Tt(l,"end1",{...c,attributeRef:k,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,h=u.attributes.find(b=>b.modelId===f&&b.attrType==="RELATION_REF"),g=Tt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(h==null?void 0:h.name)??d.end1.navFieldNameHint}),k=[],N=h?un(d.end1.entityRef,[f],k):[];i(h?We("inverse nav 제거",[...N,g,...Ot(n.logical,k)]):g);return}}}i(Tt(l,s,c))}}}function Ex(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,p)=>{if(a(u))return;const f=on(u,m,p),h=Mo(n.logical,u,N=>N.map(b=>b.modelId===m?{...b,...p}:b)),g=[],k=Ni(h,u,g);k.push(...Ot(n.logical,g)),i(k.length?We("속성 수정",[f,...k]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(b=>b.type===m),f=n.logical.entities.find(b=>b.modelId===u);if(!p||!f)return null;const h=Rt(f.attributes),g=Me(),k=p.fields.map(()=>({modelId:Me(),physicalName:"",dataType:""})),N={modelId:g,name:p.defaultName,type:p.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:h,dbAttrs:k};return i(jt(u,N)),g},addAttribute(u,m={}){if(!o.value||a(u))return null;const p=n.logical.entities.find(I=>I.modelId===u),f=p?Rt(p.attributes):0,h=m.modelId??Me(),g=m.name??`field${f}`,k={modelId:h,name:g,type:m.type??Rr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Me(),physicalName:g,dataType:"VARCHAR"}],...m},N=jt(u,k),b=Mo(n.logical,u,I=>[...I,k]),_=[],E=Ni(b,u,_);return E.push(...Ot(n.logical,_)),i(E.length?We("속성 추가",[N,...E]):N),h},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(g=>g.modelId===u),p=m?Rt(m.attributes):0,f=Me();return i(jt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:p,dbAttrs:[]})),f},updateAttribute(u,m,p){d(u,m,p)},setAttributeGroupCode(u,m,p){d(u,m,{groupCode:p,type:p?Dn:Rr})},setEmbedColumns(u,m,p){var b,_;if(a(u))return;const f=on(u,m,{dbAttrs:p}),h=(b=n.logical.entities.find(E=>E.modelId===u))==null?void 0:b.attributes.find(E=>E.modelId===m),g=(_=h==null?void 0:h.embedded)==null?void 0:_.associationRef,k=g?n.logical.associations.find(E=>E.modelId===g):void 0,N=[];k&&g&&(k.end1.legacyEmbedRaw&&N.push(Tt(g,"end1",{legacyEmbedRaw:void 0})),k.end2.legacyEmbedRaw&&N.push(Tt(g,"end2",{legacyEmbedRaw:void 0}))),i(N.length?We("임베드 컬럼 수정",[f,...N]):f)},removeAttribute(u,m){if(a(u))return;if(Ji(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=un(u,[m],p),h=Mo(n.logical,u,N=>N.filter(b=>b.modelId!==m)),g=[...Ni(h,u,p),...Ot(n.logical,p)],k=[...f,...g];i(k.length===1?k[0]:We("속성 삭제",k))},removeAttributes(u,m){var b;if(!m.length||a(u))return;const p=m.filter(_=>!Ji(n.logical,u,_));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],h=un(u,p,f),g=new Set(p),k=Mo(n.logical,u,_=>_.filter(E=>!g.has(E.modelId))),N=[...h,...Ni(k,u,f),...Ot(n.logical,f)];i(N.length===1?N[0]:We("속성 삭제",N)),((b=c.value)==null?void 0:b.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,p){i(aa(u,m,p))},setAttributeSwatches(u,m,p){m.length&&(m.length===1?i(aa(u,m[0],p)):i(We("속성 색상",m.map(f=>aa(u,f,p)))))},reorderAttributes(u,m,p){if(!m.length||a(u))return;const f=ol(u,m,p),h=hx(n.logical,u,m,p);i(h.length?We("속성 재정렬",[f,...h]):f)}}}function Nx(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Me(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=Me();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Me()}for(const a of n.indexes??[]){a.modelId=Me();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Me();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const wx=220;function Ix(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||wx));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of n.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of n.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const es=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function vx(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const g=c.filter(k=>n.logical.entities.some(N=>N.modelId===k));if(g.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:g}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const g=n.logical.entities.find(N=>N.modelId===d.entityId);if(!g)return;const k=[...g.attributes].sort((N,b)=>N.order-b.order).filter(N=>d.ids.includes(N.modelId));if(!k.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:k}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(g=>g.modelId===u),p=n.layout.entityLayouts.find(g=>g.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let h;if(p){const{entityRef:g,geo:k,locked:N,...b}=p;Object.keys(b).length&&(h=b)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:h}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const h=n.logical.entities.find(E=>E.modelId===f);if(!h)return[];const g=new Set(h.attributes.map(E=>E.name)),k=new Set(h.attributes.flatMap(E=>E.dbAttrs.map(I=>I.physicalName))),N=Rt(h.attributes),b=[],_=c.attributes.map((E,I)=>{const A=JSON.parse(JSON.stringify(E));A.modelId=Me();for(const T of A.dbAttrs)T.modelId=Me();g.has(A.name)&&(A.name=co(`${A.name}_copy`,g)),g.add(A.name);for(const T of A.dbAttrs)T.physicalName&&k.has(T.physicalName)&&(T.physicalName=co(`${T.physicalName}_copy`,k)),T.physicalName&&k.add(T.physicalName);return A.order=N+I,b.push(A.modelId),jt(f,A)});return l(_.length===1?_[0]:We("속성 붙여넣기",_)),i.value={kind:"attribute",entityId:f,ids:b,anchor:b[b.length-1]},[]}const{clone:d,idMap:u}=Nx(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let p;if(c.layoutExtras){const f={...c.layoutExtras},h=g=>u.get(g);f.attributeStyles&&(f.attributeStyles=ta(f.attributeStyles,h)),f.operationStyles&&(f.operationStyles=ta(f.operationStyles,h)),p=f}return l(ia(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Pc(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const p=(u==null?void 0:u.placement)??"append-right",f=p==="append-right"?Ix(n.layout,m.layout):p.offset,h=new Map(m.layout.entityLayouts.map(_=>[_.entityRef,_])),g=new Map(m.layout.associationLayouts.map(_=>[_.associationRef,_])),k=new Map(m.layout.groupLayouts.map(_=>[_.groupRef,_])),N=[];let b=80;for(const _ of m.logical.entities){const E=h.get(_.modelId),I=E?{location:es(E.geo.location,f),size:{...E.geo.size}}:{location:{x:b+=40,y:80},size:{width:220,height:140}};let A;if(E){const{entityRef:T,geo:L,locked:x,...R}=E;A=R}N.push(ia(_,I,A))}for(const _ of m.logical.associations){const E=g.get(_.modelId),I=E?{...E,waypoints:E.waypoints.map(A=>es(A,f))}:{associationRef:_.modelId,waypoints:[]};N.push(sa(_,I))}for(const _ of m.logical.groups){const E=k.get(_.modelId),I=E?{location:es(E.geo.location,f),size:{...E.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(E){const{groupRef:T,geo:L,locked:x,memberNoteRefs:R,...$}=E;A=$}N.push(ra(_,I,A))}return l(We("다이어그램 가져오기",N)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(_=>_.modelId)}};return s}function xx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l}=e;return{addEntity(s="NewEntity",c={x:80,y:80}){if(!o.value)return null;const d=Me(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Me(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Me(),physicalName:"id",dataType:"BIGINT"}]}]};return i(ia(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(Wc(s,c))},updateEntity(s,c){if(a(s))return;const d=qc(s,c),u=n.logical.entities.find(f=>f.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",p=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const f=u.attributes.filter(_=>_.identifier&&!_.derivedFrom).map(_=>on(s,_.modelId,{identifier:!1})),h=Mo({...n.logical,entities:n.logical.entities.map(_=>_.modelId===s?{..._,stereotype:"JPA_EMBEDDABLE"}:_)},s,_=>_.map(E=>E.identifier&&!E.derivedFrom?{...E,identifier:!1}:E)),g=[],k=Ja(h,[s],g);k.push(...Ot(n.logical,g));const N=_x(n.logical,s),b=[d,...f,...k,...N];i(b.length>1?We("임베더블 변환",b):d);return}if(p){const f=bx(n.logical,s),h=[d,...f];i(h.length>1?We("엔터티 전환",h):d);return}i(d)},moveEntity(s,c){a(s)||i(ko(s,c))},resizeEntity(s,c){a(s)||i(Jc(s,c))},removeEntity(s){if(a(s))return;const c=Yc(s);if(!n.logical.entities.find(k=>k.modelId===s)){i(c);return}const u=n.logical.associations.filter(k=>k.end1.entityRef===s||k.end2.entityRef===s),m=new Set(u.map(k=>k.modelId)),p=[],f=[];for(const k of n.logical.entities)if(k.modelId!==s)for(const N of k.attributes)N.embedded&&m.has(N.embedded.associationRef)&&p.push(...un(k.modelId,[N.modelId],f));for(const k of u){if(k.end1.entityRef===s||!k.end1.attributeRef)continue;const N=n.logical.entities.find(_=>_.modelId===k.end1.entityRef),b=N==null?void 0:N.attributes.find(_=>_.modelId===k.end1.attributeRef&&_.attrType==="RELATION_REF");b&&p.push(...un(N.modelId,[b.modelId],f))}const h={...n.logical,entities:n.logical.entities.filter(k=>k.modelId!==s),associations:n.logical.associations.filter(k=>!m.has(k.modelId))},g=new Set(u.filter(k=>k.end1.entityRef===s&&k.end2.entityRef!==s).map(k=>k.end2.entityRef));p.push(...Ja(h,[...g],f)),p.push(...Ot(n.logical,f.filter(k=>k.entityId!==s))),i(p.length?We("엔티티 삭제",[c,...p]):c)},setEntitySwatch(s,c){i(Xc(s,c))},setEntityCollapsed(s,c){i(Zc(s,c))},setEntityLocked(s,c){i(Qc(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(nl(!0))},expandAll(){i(nl(!1))}}}function Cx(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(N=>n.layout.entityLayouts.find(b=>b.entityRef===N)).filter(N=>!!N);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,h=-1/0;for(const N of u){const b=N.geo.size.width||220,_=N.geo.size.height||140;m=Math.min(m,N.geo.location.x),p=Math.min(p,N.geo.location.y),f=Math.max(f,N.geo.location.x+b),h=Math.max(h,N.geo.location.y+_)}const g=40,k=28;return{location:{x:m-g,y:p-g-k},size:{width:f-m+g*2,height:h-p+g*2+k}}}return{dragGroup(d,u,m){l(d)||i(We("그룹 이동",Sf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(id(d,u))},setGroupSwatch(d,u){i(ad(d,u))},setGroupLocked(d,u){i(rd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(ed(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const h of n.logical.groups)for(const g of d)h.memberEntityRefs.includes(g)&&m.push(la(h.modelId,g));const p=Me(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(ra(f,c(d))),i(We("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Me();return i(ra({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(td(d))},dropEntity(d,u,m){var h;if(r(d))return;const p=((h=n.logical.groups.find(g=>g.memberEntityRefs.includes(d)))==null?void 0:h.modelId)??null,f=[ko(d,u)];p!==m&&(p&&f.push(la(p,d)),m&&f.push(nd(m,d))),i(We("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(la(u.modelId,d))},dropNote(d,u,m){var h;const p=((h=n.layout.groupLayouts.find(g=>{var k;return(k=g.memberNoteRefs)==null?void 0:k.includes(d)}))==null?void 0:h.groupRef)??null,f=[ti(d,u)];p!==m&&(p&&f.push(Sd(p,d)),m&&f.push(Cd(m,d))),i(We("이동",f))}}}function Sx(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(g,k){if(d(),!o.value||!e.opTransport)return;const N=new Dd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:b=>{i.value=!1,a.value=b},onError:e.onOpError});N.seed((k==null?void 0:k.revSeed)??{}),c=N.attach(g),s=N}const m=t.computed(()=>o.value&&r!==void 0),p=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function h(g){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let k;try{k=await l(g)}catch(N){return{ok:!1,reason:N instanceof Error?N.message:String(N)}}return k.ok&&p.value++,k}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:h,reloadRequest:p}}function Rx(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Me();return o(Nd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(wd(i))},moveNote(i,a){o(ti(i,a))},resizeNote(i,a){o(Id(i,a))},setNoteMemo(i,a){o(vd(i,a))},setNoteSwatch(i,a){o(xd(i,a))},addNoteConnection(i,a){o(Rd(i,a))},removeNoteConnection(i,a){o(Ad(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o($d(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Td(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Md(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Vd(i,a))}}}function Ax(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const E=p.ids.includes(u),I=E?p.ids.filter(T=>T!==u):[...p.ids,u];if(!I.length){o.value=null;return}const A=E&&p.anchor===u?I[I.length-1]:E?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:I,anchor:A};return}const h=n.logical.entities.find(E=>E.modelId===d),g=[...(h==null?void 0:h.attributes)??[]].sort((E,I)=>E.order-I.order).map(E=>E.modelId),k=g.indexOf(p.anchor),N=g.indexOf(u);if(k<0||N<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[b,_]=k<=N?[k,N]:[N,k];o.value={kind:"attribute",entityId:d,ids:g.slice(b,_+1),anchor:p.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(g=>g.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(g=>g.modelId===u.anchor);if(p<0)return!1;const f=Math.min(Math.max(p+d,0),m.attributes.length-1);if(f===p)return!0;const h=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[h],anchor:h},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(E=>E.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),h=p.map((E,I)=>f.has(E.modelId)?I:-1).filter(E=>E>=0);if(!h.length)return!1;const g=Math.min(...h),k=p.filter(E=>!f.has(E.modelId)),N=p.slice(0,g).filter(E=>!f.has(E.modelId)).length;let b;if(d<0){if(N<=0)return!0;b=N-1}else{if(k.length-N<=0)return!0;b=N+1}if(r(u.entityId))return!0;const _=p.filter(E=>f.has(E.modelId)).map(E=>E.modelId);return a(ol(u.entityId,_,b)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(b=>b.modelId)),f=new Set(n.logical.groups.map(b=>b.modelId)),h=new Set(n.layout.notes.map(b=>b.modelId)),g=new Set;for(const b of d){if(!f.has(b))continue;const _=n.logical.groups.find(E=>E.modelId===b);for(const E of(_==null?void 0:_.memberEntityRefs)??[])g.add(E)}const k=[],N=[];for(const b of d)if(f.has(b)){if(s(b))continue;const _=n.layout.groupLayouts.find(T=>T.groupRef===b);if(!_)continue;const E=n.logical.groups.find(T=>T.modelId===b),I=((E==null?void 0:E.memberEntityRefs)??[]).map(T=>{var x;const L=((x=n.layout.entityLayouts.find(R=>R.entityRef===T))==null?void 0:x.geo.location)??{x:0,y:0};return{id:T,location:{x:L.x+u,y:L.y+m}}}),A={x:_.geo.location.x+u,y:_.geo.location.y+m};k.push(We("그룹 이동",Sf(n,b,A,I))),N.push("g:"+b)}else if(p.has(b)){if(g.has(b)||l(b))continue;const _=n.layout.entityLayouts.find(E=>E.entityRef===b);if(!_)continue;k.push(ko(b,{x:_.geo.location.x+u,y:_.geo.location.y+m})),N.push("e:"+b)}else if(h.has(b)){const _=n.layout.notes.find(E=>E.modelId===b);if(!_)continue;k.push(ti(b,{x:_.geo.location.x+u,y:_.geo.location.y+m})),N.push("n:"+b)}return k.length?(a(We("이동",k,"nudge:"+N.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const no=Symbol("editorController");function Rf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function $x(e=Rf(),n={}){var ae,Be,Ve;const o=t.reactive(e);let i=new tl(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),u=t.ref(n.uiLocale??"ko"),m=(H,V)=>Dt(u.value,H,V),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),h=t.ref(n.largeEntityThreshold),g=t.ref(n.flagEntitiesWithoutRelations??!1),k=t.ref(!1),N=t.ref(!1),b=t.ref(!1),_=t.ref(0),E=t.ref(null);let I=0;const A=H=>{if(n.onNotice){n.onNotice(H);return}E.value={text:H,id:++I}},T=t.ref(((ae=n.meta)==null?void 0:ae.schemaVersion)??1),L=t.ref(((Be=n.meta)==null?void 0:Be.opWriteEnabled)??!1),x=t.ref(((Ve=n.meta)==null?void 0:Ve.referenceOnly)??!1),R=t.computed(()=>T.value>=2&&L.value),$=t.ref(!(T.value>=2&&L.value===!1)),B=t.ref("LOGICAL_PHYSICAL"),O=t.ref("straight"),y=t.ref(!0),w=t.ref(!0),v=t.ref(null),M=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),D=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?v.value.ids:[]}),U=t.computed(()=>{var H,V;return((H=v.value)==null?void 0:H.kind)==="entity"?v.value.id:((V=v.value)==null?void 0:V.kind)==="attribute"?v.value.entityId:null}),W=t.ref(null),ie=t.ref(null),pe=t.ref(null),ye=t.ref(null),ge=Sx({state:o,opMode:R,editable:$,opConflict:pe,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function me(){i.onChange(()=>{k.value=i.canUndo,N.value=i.canRedo,b.value=i.isDirty,_.value++})}me(),ge.setupOpAdapter(i,n.meta);const se=t.computed(()=>Ss(o.logical,o.layout)),ke=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:h.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Se=()=>Ks(o.logical,x.value),ce=n.validationDebounceMs??250;let fe,oe=()=>{};if(ce>0){const H=t.shallowRef(Xi(Se(),ke.value));let V;oe=()=>{V!==void 0&&(clearTimeout(V),V=void 0),H.value=Xi(Se(),ke.value)},t.watch([_,ke,x],()=>{V!==void 0&&clearTimeout(V),V=setTimeout(oe,ce)},{flush:"sync"}),fe=t.computed(()=>H.value)}else fe=t.computed(()=>Xi(Se(),ke.value));const le=t.computed(()=>{const H=new Map;for(const V of fe.value){if(!V.targetRef)continue;const Pe=H.get(V.targetRef);Pe?Pe.push(V):H.set(V.targetRef,[V])}return H}),ue=1500,z=new Map,P=H=>{const V=Date.now();V-(z.get(H)??0)<ue||(z.set(H,V),A(H))},F=H=>{if(!ye.value){if(!$.value){P(m("em.notice.readOnly"));return}try{i.execute(H)}catch(V){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${H.label}):`,V),$.value=!1,ye.value={label:H.label}}}},Q=H=>o.layout.entityLayouts.some(V=>V.entityRef===H&&!!V.locked),X=H=>o.layout.groupLayouts.some(V=>V.groupRef===H&&!!V.locked),_e=H=>{const V=o.logical.associations.find(Pe=>Pe.modelId===H);return!!V&&(Q(V.end1.entityRef)||Q(V.end2.entityRef))},he=H=>Q(H)?(P(m("em.notice.entityLocked")),!0):!1,we=H=>X(H)?(P(m("em.notice.groupLocked")),!0):!1,Ie=H=>_e(H)?(P(m("em.notice.assocLocked")),!0):!1,Y=vx({state:o,clipboard:ie,selection:v,inspectedEntityId:U,editable:$,run:F}),j=Ax({state:o,selection:v,focusRequest:W,run:F,gateEntityLocked:he,isEntityLockedFn:Q,isGroupLockedFn:X}),J=xx({state:o,editable:$,run:F,gateEntityLocked:he,isEntityLockedFn:Q,isAssocLockedFn:_e}),ve=Ex({state:o,editable:$,run:F,gateEntityLocked:he,embeddableCatalog:a,t:m,emitGateNotice:P,selection:v}),Te=Cx({state:o,editable:$,run:F,selection:v,gateEntityLocked:he,gateGroupLocked:we,isGroupLockedFn:X}),K=Rx({editable:$,run:F}),te=kx({state:o,editable:$,run:F,gateEntityLocked:he,gateAssocLocked:Ie});return{state:o,resolved:se,issues:fe,issuesByRef:le,flagEntitiesWithoutRelations:g,canUndo:k,canRedo:N,dirty:b,revision:_,notice:E,editable:$,schemaVersion:T,opWriteEnabled:L,opMode:R,opConflict:pe,commandFailure:ye,historyTransport:ge.historyTransport,historyAvailable:ge.historyAvailable,restoreTransport:ge.restoreTransport,restoreAvailable:ge.restoreAvailable,restoreToSeq:ge.restoreToSeq,reloadRequest:ge.reloadRequest,displayMode:B,routingMode:O,showGrid:y,showMinimap:w,selection:v,selectedAttr:M,selectedAttrIds:D,inspectedEntityId:U,focusRequest:W,clipboard:ie,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:x,uiLocale:u,t:m,selectableDataTypes:f,setEditable(H){$.value=H&&R.value},setEmbeddableCatalog(H){a.value=H},setGroupCodeCatalog(H){r.value=H},setPredefinedCustomTypeCatalog(H){l.value=H},setSuperClassCatalog(H){s.value=H},selectAttribute:j.selectAttribute,moveAttributeFocus:j.moveAttributeFocus,nudgeSelectedAttributes:j.nudgeSelectedAttributes,nudgeNodes:j.nudgeNodes,requestFocus:j.requestFocus,deleteSelection(){if(!$.value)return!1;const H=v.value;if(!H)return!1;if(H.kind==="attribute"){if(he(H.entityId))return!1;const V=H.ids;if(!V.length)return!1;V.length===1?ve.removeAttribute(H.entityId,V[0]):ve.removeAttributes(H.entityId,V)}else if(H.kind==="entity"){if(he(H.id))return!1;J.removeEntity(H.id)}else if(H.kind==="note")K.removeNote(H.id);else if(H.kind==="group"){if(we(H.id))return!1;Te.removeGroup(H.id)}else te.removeAssociation(H.id);return v.value=null,!0},undo:()=>{$.value&&i.undo()},redo:()=>{$.value&&i.redo()},markSaved:()=>{$.value&&(ge.flush(),i.markSavePoint())},loadDiagram(H,V){ge.teardownOpAdapter(),o.logical=H.logical,o.layout=H.layout,i=new tl(o),me(),T.value=(V==null?void 0:V.schemaVersion)??1,L.value=(V==null?void 0:V.opWriteEnabled)??!1,x.value=(V==null?void 0:V.referenceOnly)??!1,$.value=!(T.value>=2&&L.value===!1),pe.value=null,ye.value=null,v.value=null,k.value=i.canUndo,N.value=i.canRedo,b.value=i.isDirty,ge.setupOpAdapter(i,V),oe()},flush:ge.flush,whenOpsSettled:ge.whenOpsSettled,addEntity:J.addEntity,renameEntity:J.renameEntity,updateEntity:J.updateEntity,moveEntity:J.moveEntity,resizeEntity:J.resizeEntity,removeEntity:J.removeEntity,setEntitySwatch:J.setEntitySwatch,setEntityCollapsed:J.setEntityCollapsed,setEntityLocked:J.setEntityLocked,isEntityLocked:J.isEntityLocked,isAssociationLocked:J.isAssociationLocked,collapseAll:J.collapseAll,expandAll:J.expandAll,setAttributeSwatch:ve.setAttributeSwatch,dragGroup:Te.dragGroup,resizeGroup:Te.resizeGroup,setGroupSwatch:Te.setGroupSwatch,setGroupLocked:Te.setGroupLocked,isGroupLocked:Te.isGroupLocked,updateGroup:Te.updateGroup,createGroup:Te.createGroup,addEmptyGroup:Te.addEmptyGroup,removeGroup:Te.removeGroup,dropEntity:Te.dropEntity,ungroupEntity:Te.ungroupEntity,dropNote:Te.dropNote,addPredefinedEmbed:ve.addPredefinedEmbed,addAttribute:ve.addAttribute,addDivider:ve.addDivider,updateAttribute:ve.updateAttribute,setAttributeGroupCode:ve.setAttributeGroupCode,setEmbedColumns:ve.setEmbedColumns,removeAttribute:ve.removeAttribute,removeAttributes:ve.removeAttributes,setAttributeSwatches:ve.setAttributeSwatches,reorderAttributes:ve.reorderAttributes,addIndex(H,V){he(H)||F(hd(H,V))},updateIndex(H,V,Pe){he(H)||F(da(H,V,Pe))},removeIndex(H,V){he(H)||F(yd(H,V))},addOperation(H,V={}){if(!$.value||he(H))return null;const Pe=o.logical.entities.find(De=>De.modelId===H),Ze=Pe!=null&&Pe.operations?Rt(Pe.operations):0,Ue=V.modelId??Me(),Le={modelId:Ue,name:V.name??`method${Ze}`,visibility:V.visibility??"PACKAGE",order:Ze,...V};return F(cd(H,Le)),Ue},updateOperation(H,V,Pe){he(H)||F(dd(H,V,Pe))},removeOperation(H,V){he(H)||F(ud(H,V))},reorderOperations(H,V,Pe){!V.length||he(H)||F(md(H,V,Pe))},setOperationSwatch(H,V,Pe){F(fd(H,V,Pe))},addAssociation:te.addAssociation,addEmbedAssociation:te.addEmbedAssociation,setEmbedCardinality:te.setEmbedCardinality,removeAssociation:te.removeAssociation,setAssociationIdentifying:te.setAssociationIdentifying,updateAssociationEnd:te.updateAssociationEnd,hasQuickFix(H){if(!$.value)return!1;const V=Fr(H,o.logical);return V?V.kind==="setEndCascades"?!_e(V.assocRef):!Q(V.entityRef):!1},applyQuickFix(H){if(!$.value)return!1;const V=Fr(H,o.logical);if(!V)return!1;if(V.kind==="setIndexColumns")return he(V.entityRef)?!1:(F(da(V.entityRef,V.indexRef,{columns:V.columns})),!0);if(Ie(V.assocRef))return!1;const Pe=o.logical.associations.find(Ze=>Ze.modelId===V.assocRef);return Pe?(F(Tt(V.assocRef,V.which,{jpa:{...Pe[V.which].jpa,cascadeTypes:V.cascades}})),!0):!1},moveWaypoint(H,V,Pe){F(gd(H,V,Pe))},addWaypoint(H,V,Pe){F(Ed(H,V,Pe))},removeWaypoint(H,V){F(bd(H,V))},clearWaypoints(H){F(kd(H))},addNote:K.addNote,removeNote:K.removeNote,moveNote:K.moveNote,resizeNote:K.resizeNote,setNoteMemo:K.setNoteMemo,setNoteSwatch:K.setNoteSwatch,addNoteConnection:K.addNoteConnection,removeNoteConnection:K.removeNoteConnection,moveNoteConnectionWaypoint:K.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:K.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:K.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:K.clearNoteConnectionWaypoints,autoLayout(){const H=Rs(o.logical,o.layout);H.length&&F(We("자동 배치",H.map(V=>ko(V.id,V.location))))},copy:Y.copy,paste:Y.paste,importEntities:Y.importEntities}}const Xa=Symbol("groupHover"),Af=Symbol("groupDrag"),Vo=Symbol("relationHighlight"),$f=Symbol("diffOverlay"),Tf=Symbol("nodeInternals"),Mf=Symbol("columnResolution");function Tx(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function Vf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!Tx(e[o],n[o]))return!1;return!0}function Mx(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!Vf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function Vx(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Bx(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!Vx(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!Mx(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Vf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function Dx(){let e;return(n,o)=>e=Ox(n,o,e)}function Ox(e,n,o){const i=e.entities,a=new Map;for(const r of i){const l=new Map,s=new Map,c=new Map;let d=null;const u=()=>d??(d=so(kn(r,i)));for(const g of r.attributes){if(Oi(g)){const _=g.dbAttrs[0];if(!(_!=null&&_.physicalName&&(_!=null&&_.dataType))){const E=Li(g,r,i,e.associations);E&&l.set(g.modelId,{...g,dbAttrs:[{..._,physicalName:(_==null?void 0:_.physicalName)||E.physicalName,dataType:(_==null?void 0:_.dataType)||E.dataType,length:(_==null?void 0:_.length)??E.length,scale:(_==null?void 0:_.scale)??E.scale},...g.dbAttrs.slice(1)]})}}const k=Ar(g,e.associations);if(k&&c.set(g.modelId,k),!g.attrType.startsWith("EMBED")||g.dbAttrs.length===0)continue;if(g.attrType!=="EMBED_PREDEF"){const _=u();s.set(g.modelId,g.dbAttrs.map((E,I)=>{const A=Bn(E,_);return A?{...E,physicalName:A.physicalName}:Vn(g,E,I,r,e)}));continue}const N=n==null?void 0:n.find(_=>_.type===g.type);if(!N)continue;const b=u();s.set(g.modelId,g.dbAttrs.map((_,E)=>{const I=N.fields[E],A=Bn(_,b);return A?{..._,physicalName:A.physicalName,logicalName:_.logicalName??(I==null?void 0:I.logicalName),dataType:_.dataType||(I==null?void 0:I.dataType)||""}:I?{..._,physicalName:_.physicalName||I.physicalName,logicalName:_.logicalName??I.logicalName,dataType:_.dataType||I.dataType,length:_.length??I.length}:_}))}const m=new Map,p=new Map;for(const g of r.attributes){const k=s.get(g.modelId);if(k)for(let N=0;N<k.length;N++){const b=`${g.attrType}\0${g.type??""}\0${N}`,_={attrId:g.modelId,slot:N,name:k[N].physicalName??""},E=p.get(b);E?E.push(_):p.set(b,[_])}}for(const g of p.values()){if(g.length<2)continue;const k=new Map;for(const N of g)k.set(N.name,(k.get(N.name)??0)+1);for(const N of g){if((k.get(N.name)??0)<2)continue;const b=m.get(N.attrId);b?b.add(N.slot):m.set(N.attrId,new Set([N.slot]))}}const f={effectiveAttrs:l,embedCols:s,collectionTypes:c,redundantSlots:m},h=o==null?void 0:o.get(r.modelId);a.set(r.modelId,h&&Bx(f,h)?h:f)}return a}const Bf=Symbol("embedSlotCollapse"),Df=(e,n)=>`${e}:${n}`,Of="all:",Lf="one:",Pf=e=>`${Of}${e}`,zf=(e,n)=>`${Lf}${e}:${n}`,Lx=e=>!e.startsWith(Of)&&!e.startsWith(Lf),Px=["title"],zx={key:0,class:"em-sel","aria-hidden":"true"},Fx=["title","aria-expanded","disabled"],Ux={class:"em-entity__stereotype"},Hx={key:1,class:"em-entity__name"},jx=["title","aria-expanded"],Kx={"aria-hidden":"true"},Gx=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Yx=["onPointerdown"],qx={key:1,class:"em-entity__divider-label"},Wx=["title"],Jx={class:"em-key-slot"},Xx={class:"em-key-slot"},Zx=["title","aria-expanded","onClick"],Qx=["title","onClick"],eC=["title","aria-expanded","onClick"],tC={key:2,class:"em-entity__type"},nC=["onClick"],oC={class:"em-entity__attrname"},iC={class:"em-entity__type"},aC={key:1,class:"em-entity__embed-summary"},rC=["title"],lC=["data-op"],sC=["onPointerdown"],cC={class:"em-entity__op-vis","aria-hidden":"true"},dC=["title"],uC={key:4,class:"em-entity__footer"},Ff=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(no,null),i=(C,S)=>o?o.t(C,S):Dt("ko",C,S),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=ee.useModal();function l(){o&&qa(r,o,n.id)}const s=t.inject(Xa,null),c=t.inject(Vo,null),d=t.inject($f,null),u=t.computed(()=>{var C;return((C=d==null?void 0:d.marks.value)==null?void 0:C.get(n.id))??null}),m=t.inject(Mf,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(Bf,void 0),h=t.inject(Tf,null);t.onUpdated(()=>h==null?void 0:h.mark(n.id));const g=t.computed(()=>!!o&&o.editable.value);function k(){s&&(s.value=n.data.groupRef??null)}function N(){c==null||c.setEntityHover(n.id)}function b(){c==null||c.setEntityHover(null)}const _=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),E=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!_.value),I=t.computed(()=>{var C;return((C=o==null?void 0:o.selection.value)==null?void 0:C.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!I.value),T=t.computed(()=>{var C;return o&&((C=o.selectedAttr.value)==null?void 0:C.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),L=t.computed(()=>T.value.size>0);function x(C,S){const q=S.shiftKey?"range":S.metaKey||S.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,C.modelId,q)}const R=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!I.value),$=t.computed(()=>n.data.entity),B=t.computed(()=>Bh($.value,o==null?void 0:o.referenceOnlyDocument.value)),O=t.computed(()=>[...$.value.attributes].sort((C,S)=>C.order-S.order)),y=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>n.data.collapsed??!1),v=t.computed(()=>n.data.locked??!1),M=t.computed(()=>g.value&&!v.value);function D(){g.value&&(o==null||o.setEntityCollapsed(n.id,!w.value))}const U=t.computed(()=>y.value==="PHYSICAL"||y.value==="LOGICAL_PHYSICAL"),W=t.computed(()=>{const C=y.value==="PHYSICAL"||y.value==="LOGICAL_PHYSICAL",S={};for(const q of O.value){const re=q.attrType.startsWith("RELATION")&&q.dbAttrs.length>0;S[q.modelId]={pk:q.identifier,fk:re&&C,required:q.notNull&&!q.identifier}}return S});function ie(C){if(!C)return"";const S=[];return C.pk&&C.fk?S.push(i("em.node.keyPfk")):C.pk?S.push(i("em.node.keyPk")):C.fk&&S.push(i("em.node.keyFk")),C.required&&S.push(i("em.node.required")),S.join(" · ")}const pe=t.computed(()=>{const C=Jl(_t(n.data.style)),S={};return C&&(S["--em-header-bg"]=C.bar,S["--em-header-fg"]=C.barOn),S});function ye(C){var S,q;return(q=Jl(_t((S=n.data.attributeStyles)==null?void 0:S[C.modelId])))==null?void 0:q.text}const ge=t.computed(()=>[...$.value.operations??[]].sort((C,S)=>C.order-S.order)),me=t.computed(()=>y.value==="CLASS"&&ge.value.length>0),se={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ke(C){return C?se[C]:"~"}function Se(C){var S,q;return(q=Jl(_t((S=n.data.operationStyles)==null?void 0:S[C.modelId])))==null?void 0:q.text}function ce(C,S,q){switch(y.value){case"CLASS":return[{text:C}];case"PHYSICAL":return[{text:q||C}];case"LOGICAL":return[S?{text:S}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=S?{text:S}:{text:i("em.node.logicalMissing"),missing:!0};return q?[re,{text:` · ${q}`}]:[re]}}}function fe(C){var S;return((S=p.value)==null?void 0:S.effectiveAttrs.get(C.modelId))??C}function oe(C){var q,re,ne;if(le(C))return[{text:C.name}];const S=fe(C);return ce(C.name,(re=(q=S.dbAttrs[0])==null?void 0:q.logicalName)==null?void 0:re[a.value],((ne=S.dbAttrs[0])==null?void 0:ne.physicalName)??"")}function le(C){return C.attrType.startsWith("EMBED")&&C.dbAttrs.length>0}function ue(C){return C.attrType==="DIVIDER"}function z(C){var S;return((S=p.value)==null?void 0:S.embedCols.get(C.modelId))??C.dbAttrs}function P(C){var S;return(S=p.value)==null?void 0:S.redundantSlots.get(C.modelId)}const F=t.computed(()=>(f==null?void 0:f.isCollapsed(Pf(n.id)))??!1),Q=t.computed(()=>F.value&&U.value?O.value.reduce((C,S)=>le(S)?C+z(S).length:C,0):0),X=t.computed(()=>O.value.some(C=>le(C)));function _e(C){const S=P(C);return!S||S.size===0?!1:f?f.isCollapsed(Df(n.id,C.modelId)):!1}function he(C){var S;return _e(C)?((S=P(C))==null?void 0:S.size)??0:0}function we(C){return f?f.isCollapsed(zf(n.id,C.modelId)):!1}function Ie(C){var S;return!U.value||F.value?null:we(C)?"attr":(((S=P(C))==null?void 0:S.size)??0)>0?"slot":null}function Y(C){return!F.value&&le(C)}function j(C){return we(C)?z(C).length:0}function J(C){if(F.value||we(C))return[];const S=z(C);if(!_e(C))return S;const q=P(C);return S.filter((re,ne)=>!q.has(ne))}function ve(C){f==null||f.toggle(Df(n.id,C.modelId))}function Te(C){f==null||f.toggle(zf(n.id,C.modelId))}function K(){f==null||f.toggle(Pf(n.id))}function te(C){var S;return ce(C.physicalName,(S=C.logicalName)==null?void 0:S[a.value],C.physicalName)}function G(C){var q;const S=(q=p.value)==null?void 0:q.collectionTypes.get(C.modelId);return $r(y.value,fe(C),S)}const ae=t.computed(()=>{const C={};for(const S of O.value)C[S.modelId]=G(S);return C}),Be=t.computed(()=>{var C,S,q;return ce($.value.name,(S=(C=$.value.table)==null?void 0:C.logicalName)==null?void 0:S[a.value],((q=$.value.table)==null?void 0:q.physicalName)??"")}),Ve=t.ref(!1),H=t.ref(""),V=t.ref(null);async function Pe(){var C,S;M.value&&(H.value=$.value.name,Ve.value=!0,await t.nextTick(),(C=V.value)==null||C.focus(),(S=V.value)==null||S.select())}function Ze(){if(!Ve.value)return;Ve.value=!1;const C=H.value.trim();C&&C!==$.value.name&&(o==null||o.renameEntity(n.id,C))}function Ue(){o==null||o.addAttribute(n.id)}function Le(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:De,findNode:Z}=je(),dt=t.ref(null),yn=t.computed(()=>{const C=dt.value??n.data.size;return C?{width:`${C.width}px`,minHeight:`${C.height}px`}:void 0});let Et=null;function gn(C){var re,ne,xe;if(!M.value)return;C.stopPropagation();const S=(re=Z(n.id))==null?void 0:re.dimensions,q=De({x:C.clientX,y:C.clientY});Et={fx:q.x,fy:q.y,w:(S==null?void 0:S.width)??((ne=n.data.size)==null?void 0:ne.width)??200,h:(S==null?void 0:S.height)??((xe=n.data.size)==null?void 0:xe.height)??120},C.target.setPointerCapture(C.pointerId)}function Ee(C){if(!Et)return;const S=De({x:C.clientX,y:C.clientY});dt.value={width:Math.max(40,Et.w+(S.x-Et.fx)),height:Math.max(40,Et.h+(S.y-Et.fy))}}function at(C){var S,q,re;if(Et&&dt.value&&o){const ne=(S=Z(n.id))==null?void 0:S.dimensions;o.resizeEntity(n.id,{width:Math.round((ne==null?void 0:ne.width)??dt.value.width),height:Math.round((ne==null?void 0:ne.height)??dt.value.height)})}Et=null,dt.value=null,(re=(q=C.target).releasePointerCapture)==null||re.call(q,C.pointerId)}const zt=t.ref(null),ut=t.ref(null);function Qt(C,S){if(!M.value)return;S.stopPropagation(),S.preventDefault();const q=T.value,re=q.has(C.modelId)?new Set(q):new Set([C.modelId]);ut.value={ids:re,dropIndex:-1,lineY:0},S.target.setPointerCapture(S.pointerId)}function en(C){if(!ut.value||!zt.value)return;const S=Array.from(zt.value.querySelectorAll(".em-entity__row"));if(!S.length)return;let q=S.length;for(let xe=0;xe<S.length;xe++){const de=S[xe].getBoundingClientRect();if(C.clientY<de.top+de.height/2){q=xe;break}}const re=S[S.length-1],ne=q<S.length?S[q].offsetTop:re.offsetTop+re.offsetHeight;ut.value={...ut.value,dropIndex:q,lineY:ne}}function Ne(){const C=ut.value;if(ut.value=null,!C||C.dropIndex<0)return;const S=O.value,q=S.filter(Ce=>C.ids.has(Ce.modelId)).map(Ce=>Ce.modelId),re=S.filter((Ce,Fe)=>C.ids.has(Ce.modelId)&&Fe<C.dropIndex).length,ne=C.dropIndex-re,xe=S.filter(Ce=>!C.ids.has(Ce.modelId)).map(Ce=>Ce.modelId);[...xe.slice(0,ne),...q,...xe.slice(ne)].join(",")!==S.map(Ce=>Ce.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,q,ne))}function et(){ut.value=null}const Ft=t.ref(null),pt=t.ref(null);function nt(C,S){M.value&&(S.stopPropagation(),S.preventDefault(),pt.value={id:C.modelId,dropIndex:-1,lineY:0},S.target.setPointerCapture(S.pointerId))}function Fo(C){if(!pt.value||!Ft.value)return;const S=Array.from(Ft.value.querySelectorAll(".em-entity__op-row"));if(!S.length)return;let q=S.length;for(let xe=0;xe<S.length;xe++){const de=S[xe].getBoundingClientRect();if(C.clientY<de.top+de.height/2){q=xe;break}}const re=S[S.length-1],ne=q<S.length?S[q].offsetTop:re.offsetTop+re.offsetHeight;pt.value={...pt.value,dropIndex:q,lineY:ne}}function Uo(){const C=pt.value;if(pt.value=null,!C||C.dropIndex<0)return;const q=ge.value.findIndex(ne=>ne.modelId===C.id);if(q<0)return;const re=C.dropIndex-(q<C.dropIndex?1:0);re!==q&&(o==null||o.reorderOperations(n.id,[C.id],re))}function Ho(){pt.value=null}return(C,S)=>{var q,re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":_.value,"is-related":E.value,"is-dimmed":R.value,"is-selected":I.value,"is-multi-selected":A.value,"has-focused-attr":L.value,"is-locked":v.value,"is-reference-only":B.value,"is-diff-added":((q=u.value)==null?void 0:q.verb)==="added","is-diff-modified":((re=u.value)==null?void 0:re.verb)==="modified"}]),tabindex:"-1",title:B.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(yn.value),onPointerdown:k,onMouseenter:N,onMouseleave:b,onDblclick:l},[I.value?(t.openBlock(),t.createElementBlock("div",zx,[...S[11]||(S[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(pe.value),onDblclick:t.withModifiers(Pe,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(w.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!w.value,disabled:!g.value,onClick:t.withModifiers(D,["stop"]),onPointerdown:S[0]||(S[0]=t.withModifiers(()=>{},["stop"])),onDblclick:S[1]||(S[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(w.value?"▸":"▾"),41,Fx),t.createElementVNode("span",Ux,"«"+t.toDisplayString(t.unref(Ko)($.value.stereotype))+"»",1),Ve.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:V,"onUpdate:modelValue":S[2]||(S[2]=ne=>H.value=ne),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Ze,["enter"]),S[3]||(S[3]=t.withKeys(ne=>Ve.value=!1,["esc"]))],onBlur:Ze,onPointerdown:S[4]||(S[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,H.value]]):(t.openBlock(),t.createElementBlock("span",Hx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Be.value,(ne,xe)=>(t.openBlock(),t.createElementBlock("span",{key:xe,class:t.normalizeClass({"em-entity__missing":ne.missing})},t.toDisplayString(ne.text),3))),128))])),!w.value&&U.value&&X.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:F.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!F.value,onClick:t.withModifiers(K,["stop"]),onPointerdown:S[5]||(S[5]=t.withModifiers(()=>{},["stop"])),onDblclick:S[6]||(S[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",Kx,t.toDisplayString(F.value?"▸":"▾"),1)],40,jx)):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(Ae,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:zt,class:"em-entity__attrs"},[ut.value&&ut.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ut.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.value,ne=>{var xe,de,Ce,Fe,He,rt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ne.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":T.value.has(ne.modelId),"is-dragging":(xe=ut.value)==null?void 0:xe.ids.has(ne.modelId),"is-embed":le(ne),"is-divider":ue(ne),"has-embed-badge":!!Ie(ne),nodrag:ue(ne)&&M.value,"is-diff-changed":!!((de=u.value)!=null&&de.changedAttributeIds.has(ne.modelId))}]),"data-attr":ne.modelId,onClick:t.withModifiers(ze=>x(ne,ze),["stop"]),onPointerdown:ze=>ue(ne)?Qt(ne,ze):void 0,onPointermove:ze=>ue(ne)?en(ze):void 0,onPointerup:ze=>ue(ne)?Ne():void 0,onPointercancel:ze=>ue(ne)?et():void 0},[M.value&&!ue(ne)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ze=>Qt(ne,ze),onPointermove:en,onPointerup:Ne,onPointercancel:et,onClick:S[7]||(S[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Yx)):t.createCommentVNode("",!0),ue(ne)?(t.openBlock(),t.createElementBlock("span",qx,t.toDisplayString(ne.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Xn),{id:`l:${ne.modelId}`,type:"target",position:t.unref($e).Left,class:"em-handle",title:M.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:ie(W.value[ne.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",Jx,[(Ce=W.value[ne.modelId])!=null&&Ce.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Fe=W.value[ne.modelId])!=null&&Fe.required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",Xx,[U.value&&Y(ne)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:we(ne)?i("em.node.embedAttrShow",{count:j(ne)}):i("em.node.embedAttrHide"),"aria-expanded":!we(ne),onClick:t.withModifiers(ze=>Te(ne),["stop"]),onPointerdown:S[8]||(S[8]=t.withModifiers(()=>{},["stop"])),onDblclick:S[9]||(S[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(we(ne)?"▸":"▾"),41,Zx)):le(ne)?(t.openBlock(),t.createBlock(Ae,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(He=W.value[ne.modelId])!=null&&He.fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,Wx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:ye(ne)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe(ne),(ze,ot)=>(t.openBlock(),t.createElementBlock("span",{key:ot,class:t.normalizeClass({"em-entity__missing":ze.missing})},t.toDisplayString(ze.text),3))),128))],4),Ie(ne)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:j(ne)}),onClick:t.withModifiers(ze=>Te(ne),["stop"])},"+"+t.toDisplayString(j(ne)),9,Qx)):Ie(ne)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:_e(ne)?i("em.node.embedRepeatedShow",{count:((rt=P(ne))==null?void 0:rt.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!_e(ne),onClick:t.withModifiers(ze=>ve(ne),["stop"])},t.toDisplayString(_e(ne)?`+${he(ne)}`:"−"),9,eC)):t.createCommentVNode("",!0),ae.value[ne.modelId]?(t.openBlock(),t.createElementBlock("span",tC,t.toDisplayString(ae.value[ne.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Xn),{id:`r:${ne.modelId}`,type:"source",position:t.unref($e).Right,class:"em-handle",title:M.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,Gx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le(ne)&&U.value?J(ne):[],ze=>(t.openBlock(),t.createElementBlock("li",{key:`${ne.modelId}:${ze.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":T.value.has(ne.modelId)}]),onClick:t.withModifiers(ot=>x(ne,ot),["stop"])},[S[12]||(S[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",oC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te(ze),(ot,tt)=>(t.openBlock(),t.createElementBlock("span",{key:tt,class:t.normalizeClass({"em-entity__missing":ot.missing})},t.toDisplayString(ot.text),3))),128))]),t.createElementVNode("span",iC,t.toDisplayString(ze.dataType),1)],10,nC))),128))],64)}),128)),Q.value?(t.openBlock(),t.createElementBlock("li",aC,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(K,["stop"])},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:Q.value})),1)],8,rC)])):t.createCommentVNode("",!0)],512)),!w.value&&me.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ft,class:"em-entity__ops"},[pt.value&&pt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${pt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,ne=>{var xe,de;return t.openBlock(),t.createElementBlock("li",{key:ne.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((xe=pt.value)==null?void 0:xe.id)===ne.modelId,"is-diff-changed":!!((de=u.value)!=null&&de.changedOperationIds.has(ne.modelId))}]),"data-op":ne.modelId},[M.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ce=>nt(ne,Ce),onPointermove:Fo,onPointerup:Uo,onPointercancel:Ho,onClick:S[10]||(S[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,sC)):t.createCommentVNode("",!0),t.createElementVNode("span",cC,t.toDisplayString(ke(ne.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:Se(ne)})},t.toDisplayString(ne.name)+"()",5)],10,lC)}),128))],512)):ge.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ge.value.length})},[t.createVNode(Ae,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ge.value.length})),1)],8,dC)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("footer",uC,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Ue},t.toDisplayString(i("em.node.addAttr")),1),S[13]||(S[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Le},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),M.value&&!Ve.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:gn,onPointermove:Ee,onPointerup:at},null,32)):t.createCommentVNode("",!0)],46,Px)}}}),[["__scopeId","data-v-4dfeab79"]]),mC={key:0,class:"em-sel","aria-hidden":"true"},fC={class:"em-group__label"},pC={class:"em-group__name"},hC={key:0,class:"em-group__pkg"},yC={key:1,class:"em-group__flag"},Uf=Ke(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>_t(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(no,null),s=($,B)=>l?l.t($,B):Dt("ko",$,B),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var $;return!!n.id&&(($=l==null?void 0:l.selection.value)==null?void 0:$.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Xa,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Vo,null);function h(){n.id&&(f==null||f.setGroupHover(n.id))}function g(){f==null||f.setGroupHover(null)}const k=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),N=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:b,findNode:_}=je();let E=null,I=null;function A($){var y;if(!n.id||!c.value)return;$.stopPropagation();const B=((y=_(n.id))==null?void 0:y.dimensions)??{width:400,height:300},O=b({x:$.clientX,y:$.clientY});E={fx:O.x,fy:O.y,w:B.width,h:B.height},$.target.setPointerCapture($.pointerId)}function T($){if(!E||!n.id)return;const B=b({x:$.clientX,y:$.clientY});I={width:Math.max(160,E.w+(B.x-E.fx)),height:Math.max(120,E.h+(B.y-E.fy))};const O=_(n.id);O&&(O.style={width:`${I.width}px`,height:`${I.height}px`})}function L($){var B,O;E&&I&&n.id&&l&&l.resizeGroup(n.id,I),E=null,I=null,(O=(B=$.target).releasePointerCapture)==null||O.call(B,$.pointerId)}const x=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),R=t.computed(()=>{const $=o.value.name;return($==null?void 0:$[x.value])||($==null?void 0:$.ko)||($==null?void 0:$.en)||($==null?void 0:$.ja)||($==null?void 0:$.zh)||o.value.packageName||s("em.group.fallback")});return($,B)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":k.value,"is-dimmed":N.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:h,onMouseleave:g},[d.value?(t.openBlock(),t.createElementBlock("div",mC,[...B[0]||(B[0]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",fC,[t.createElementVNode("span",pC,t.toDisplayString(R.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",hC,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",yC,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ae,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:T,onPointerup:L},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),gC={key:0,class:"em-sel","aria-hidden":"true"},bC={key:2,class:"em-note__text"},Hf=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(no,null),i=t.inject(Xa,null),a=t.inject(Vo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>_t(r.value.style)),c=t.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=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const p=t.computed(()=>{var y;return((y=a==null?void 0:a.source.value)==null?void 0:y.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),h=t.computed(()=>{var y;return((y=o==null?void 0:o.selection.value)==null?void 0:y.kind)==="note"&&o.selection.value.id===n.id}),g=t.computed(()=>!!n.selected&&!h.value),k=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!h.value),N=[{id:"n-top",pos:$e.Top},{id:"n-right",pos:$e.Right},{id:"n-bottom",pos:$e.Bottom},{id:"n-left",pos:$e.Left}],b=t.ref(!1),_=t.ref(""),E=t.ref(null);async function I(){var y;l.value&&(_.value=r.value.memo,b.value=!0,await t.nextTick(),(y=E.value)==null||y.focus())}function A(){b.value&&(b.value=!1,_.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,_.value)))}const{screenToFlowCoordinate:T,findNode:L}=je();let x=null,R=null;function $(y){var M;if(!l.value)return;y.stopPropagation();const w=((M=L(n.id))==null?void 0:M.dimensions)??r.value.geo.size,v=T({x:y.clientX,y:y.clientY});x={fx:v.x,fy:v.y,w:w.width,h:w.height},y.target.setPointerCapture(y.pointerId)}function B(y){if(!x)return;const w=T({x:y.clientX,y:y.clientY});R={width:Math.max(140,x.w+(w.x-x.fx)),height:Math.max(60,x.h+(w.y-x.fy))};const v=L(n.id);v&&(v.style={width:`${R.width}px`,height:`${R.height}px`})}function O(y){var w,v;x&&R&&o&&o.resizeNote(n.id,R),x=null,R=null,(v=(w=y.target).releasePointerCapture)==null||v.call(w,y.pointerId)}return(y,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":k.value,"is-selected":h.value,"is-multi-selected":g.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:I,onPointerdown:d,onMouseenter:u,onMouseleave:m},[h.value?(t.openBlock(),t.createElementBlock("div",gC,[...w[4]||(w[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),b.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:E,"onUpdate:modelValue":w[0]||(w[0]=v=>_.value=v),class:"em-note__edit nodrag",onBlur:A,onKeydown:w[1]||(w[1]=t.withKeys(v=>b.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,_.value]]):(t.openBlock(),t.createElementBlock("div",bC,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(N,v=>t.createVNode(t.unref(Xn),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!b.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:$,onPointermove:B,onPointerup:O},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Za(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 Bo=.5;function jf(e,n,o,i,a,r){const l=Za(n),s=Za(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let p=e;const f=(k,N)=>{(Math.abs(k.x-p.x)>=Bo||Math.abs(k.y-p.y)>=Bo)&&(m.push({a:p,b:k,seg:N}),p=k)};f(c,0);let h=l.x!==0,g=c;for(let k=1;k<u.length;k++){const N=u[k],b=k<=o.length?k-1:o.length,_=Math.abs(N.x-g.x)<Bo,E=Math.abs(N.y-g.y)<Bo;_&&E||(_?(f(N,b),h=!1):E?(f(N,b),h=!0):h?(f({x:g.x,y:N.y},b),f(N,b),h=!0):(f({x:N.x,y:g.y},b),f(N,b),h=!1),g=N)}return f(i,o.length),m}function Kf(e,n,o,i,a,r=20){const l=jf(e,n,o,i,a,r);let s=`M ${kt(e.x)},${kt(e.y)}`;for(const c of l)s+=` L ${kt(c.b.x)},${kt(c.b.y)}`;return s}const _C=14;function Gf(e,n,o,i,a,r=20){return jf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=_C).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function kt(e){return Math.round(e*100)/100}const kC=36;function EC(e,n,o=kC){const i=Math.max(e.x,n.x)+o;return`M ${kt(e.x)},${kt(e.y)} L ${kt(i)},${kt(e.y)} L ${kt(i)},${kt(n.y)} L ${kt(n.x)},${kt(n.y)}`}function Yf(e,n,o){const i=[e,...n,o];let a=`M ${kt(i[0].x)},${kt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${kt(i[r].x)},${kt(i[r].y)}`;return a}function NC(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function qf(e,n){const o=NC(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Bo&&Math.abs(l)<Bo)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function Wf(e,n,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:n},side:i?"right":"left"}}function Jf(e,n,o){const i=[e,...n,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const wC=20,IC=22,vC=7,xC=22,Xf=31,Zf=7,CC=20,Qf=11,ep=11,SC=Xf+Zf;function RC(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function AC(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Qa(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function tp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function er(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function np(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:tp(e,n);return[er(o,a,r-Math.PI/2),er(o,a,r+Math.PI/2)]}function op(e,n,o,i){const a=n*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function ip(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Qa(e,n,wC),[d,u]=np(e,n,c,IC);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}),RC(o.multiplicity)){const m=Qa(e,n,Xf);r.push({cx:m.x,cy:m.y,r:Zf})}if(AC(o.multiplicity)){const m=Qa(e,n,vC),[p,f]=np(e,n,m,xC);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Qa(e,n,CC),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=tp(e,n),m=er(d,Qf/2,u-Math.PI/2),p=er(d,Qf/2,u+Math.PI/2);l.push({points:[e,m,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=op(s,c,ep,!0),u=op(s,c,ep,!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:r,polygons:l}}const ap=200,rp=120,ts=24;function lp(e){var a,r;if(!e)return{x:0,y:0,width:ap,height:rp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||ap,i=((r=e.dimensions)==null?void 0:r.height)||rp;return{x:n.x,y:n.y,width:o,height:i}}function sp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function cp(e){const n=t.computed(()=>lp(e.sourceNode())),o=t.computed(()=>lp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,h;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<ts){const g=(m+p)/2;m=g-ts/2,p=g+ts/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??sp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??sp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Wf(n.value,d,r.value.x):qf(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Wf(o.value,d,l.value.x):qf(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const ns=Symbol("waypointController"),$C=["d"],TC=["d"],MC=["d"],VC=["x1","y1","x2","y2"],BC=["cx","cy","r"],DC=["x","y"],OC=["x","y"],LC=["cx","cy","onDblclick"],PC=["x","y","onPointerdown","onDblclick"],dp=Ke(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(ns),a=t.inject(no,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Af,null),s=t.inject(Vo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var oe;return((oe=a==null?void 0:a.selection.value)==null?void 0:oe.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const oe=l==null?void 0:l.value;if(!oe||!a)return null;const le=a.resolved.value.entities,ue=P=>{var F;return(F=le.find(Q=>Q.entity.modelId===P))==null?void 0:F.groupRef},z=n.data.association;return ue(z.end1.entityRef)===oe.groupId&&ue(z.end2.entityRef)===oe.groupId?{dx:oe.dx,dy:oe.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),h=t.ref({x:0,y:0}),g=t.computed(()=>{const oe=m.value;return p.value.map((le,ue)=>ue===f.value?h.value:oe?{x:le.x+oe.dx,y:le.y+oe.dy}:le)}),k=t.computed(()=>{var oe;return!!((oe=n.sourceNode.data)!=null&&oe.collapsed)}),N=t.computed(()=>{var oe;return!!((oe=n.targetNode.data)!=null&&oe.collapsed)}),{source:b,target:_,sourceSide:E,targetSide:I,isSelf:A}=cp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>g.value,sourceRowY:()=>n.data.sourceColumnRef&&!k.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!N.value?n.targetY:void 0}),T=SC+4,L=t.computed(()=>A.value?EC(b.value,_.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Kf(b.value,E.value,g.value,_.value,I.value,T):Yf(b.value,g.value,_.value)),x=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Gf(b.value,E.value,g.value,_.value,I.value,T):Jf(b.value,g.value,_.value).map((oe,le)=>({point:oe,segIndex:le}))),R=t.computed(()=>A.value||!r.value?[]:g.value),$=Hi;function B(oe,le){f.value=oe,h.value={...p.value[oe]},le.target.setPointerCapture(le.pointerId),le.stopPropagation()}function O(oe){if(f.value<0)return;const le=o({x:oe.clientX,y:oe.clientY});h.value={x:le.x,y:le.y}}function y(oe){var le,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...h.value}),f.value=-1,(ue=(le=oe.target).releasePointerCapture)==null||ue.call(le,oe.pointerId)}function w(oe,le){le.stopPropagation(),i==null||i.removePoint(n.id,oe)}function v(oe,le){if(!i)return;const ue=o({x:le.clientX,y:le.clientY});i.insertPoint(n.id,oe,{x:ue.x,y:ue.y})}const M=t.computed(()=>$(n.data.association.end1.multiplicity)),D=t.computed(()=>$(n.data.association.end2.multiplicity)),U=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),W=t.computed(()=>U.value==="class"),ie=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const oe=Za(E.value);return{x:b.value.x+oe.x*10,y:b.value.y+oe.y*10}}return g.value[0]??_.value}),pe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const le=Za(I.value);return{x:_.value.x+le.x*10,y:_.value.y+le.y*10}}const oe=g.value;return oe[oe.length-1]??b.value}),ye=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end1.multiplicity,navigable:oe.end1.navigable,composition:oe.end1.composition,otherNavigable:oe.end2.navigable}}),ge=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end2.multiplicity,navigable:oe.end2.navigable,composition:oe.end2.composition,otherNavigable:oe.end1.navigable}}),me=t.computed(()=>ip(b.value,ie.value,ye.value,U.value)),se=t.computed(()=>ip(_.value,pe.value,ge.value,U.value)),ke=t.computed(()=>[...me.value.lines,...se.value.lines]),Se=t.computed(()=>[...me.value.circles,...se.value.circles]),ce=t.computed(()=>[...me.value.polygons,...se.value.polygons].map(oe=>`M${oe.points.map(le=>`${le.x},${le.y}`).join(" L")} Z`)),fe=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(oe,le)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:L.value,fill:"none",class:"em-edge__hit"},null,8,$C),t.createElementVNode("path",{d:L.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,TC),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,(ue,z)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${z}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",fe.value])},null,10,MC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ke.value,(ue,z)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${z}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,VC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${z}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,BC))),128)),W.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(b).x+8,y:t.unref(b).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(M.value),11,DC),t.createElementVNode("text",{x:t.unref(_).x-8,y:t.unref(_).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(D.value),11,OC)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${z}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(P=>v(ue.segIndex,P),["stop"])},null,42,LC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.value,(ue,z)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${z}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:P=>B(z,P),onPointermove:O,onPointerup:y,onDblclick:P=>w(z,P)},null,42,PC))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var mn=(e=>(e.Lines="lines",e.Dots="dots",e))(mn||{});const up=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},mp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};mn.Lines+"",mn.Dots+"";const zC={[mn.Dots]:"#81818a",[mn.Lines]:"#eee"},FC=["id","x","y","width","height","patternTransform"],UC={key:2,height:"100",width:"100"},HC=["fill"],jC=["x","y","fill"],KC={name:"Background",compatConfig:{MODE:3}},GC=t.defineComponent({...KC,props:{id:{},variant:{default:()=>mn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=je(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||zC[e.variant||mn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.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"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(mn).Lines?(t.openBlock(),t.createBlock(t.unref(up),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(mn).Dots?(t.openBlock(),t.createBlock(t.unref(mp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",UC,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,HC)])):t.createCommentVNode("",!0)])],8,FC)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,jC),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),YC={name:"ControlButton",compatConfig:{MODE:3}},qC=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},WC={type:"button",class:"vue-flow__controls-button"};function JC(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",WC,[t.renderSlot(e.$slots,"default")])}const oo=qC(YC,[["render",JC]]),XC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ZC=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function QC(e,n){return t.openBlock(),t.createElementBlock("svg",XC,ZC)}const eS={render:QC},tS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},nS=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function oS(e,n){return t.openBlock(),t.createElementBlock("svg",tS,nS)}const iS={render:oS},aS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},rS=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function lS(e,n){return t.openBlock(),t.createElementBlock("svg",aS,rS)}const sS={render:lS},cS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function uS(e,n){return t.openBlock(),t.createElementBlock("svg",cS,dS)}const mS={render:uS},fS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function hS(e,n){return t.openBlock(),t.createElementBlock("svg",fS,pS)}const yS={render:hS},gS={name:"Controls",compatConfig:{MODE:3}},bS=t.defineComponent({...gS,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>um.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=je(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),h=t.toRef(()=>d.value.zoom>=m.value);function g(){l(),n("zoomIn")}function k(){s(),n("zoomOut")}function N(){c(e.fitViewParams),n("fitView")}function b(){r(!p.value),n("interactionChange",!p.value)}return(_,E)=>(t.openBlock(),t.createBlock(t.unref(df),{class:"vue-flow__controls",position:_.position},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"top"),_.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(_.$slots,"control-zoom-in",{},()=>[t.createVNode(oo,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(eS))))])]),_:3},8,["disabled"])]),t.renderSlot(_.$slots,"control-zoom-out",{},()=>[t.createVNode(oo,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:k},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(iS))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),_.showFitView?t.renderSlot(_.$slots,"control-fit-view",{key:1},()=>[t.createVNode(oo,{class:"vue-flow__controls-fitview",onClick:N},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(sS))))])]),_:3})]):t.createCommentVNode("",!0),_.showInteractive?t.renderSlot(_.$slots,"control-interactive",{key:2},()=>[_.showInteractive?(t.openBlock(),t.createBlock(oo,{key:0,class:"vue-flow__controls-interactive",onClick:b},{default:t.withCtx(()=>[p.value?t.renderSlot(_.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(yS))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(_.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(mS))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(_.$slots,"default")]),_:3},8,["position"]))}});var _S={value:()=>{}};function os(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new tr(o)}function tr(e){this._=e}function kS(e,n){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&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}tr.prototype=os.prototype={constructor:tr,on:function(e,n){var o=this._,i=kS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=ES(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=fp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=fp(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new tr(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function ES(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function fp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=_S,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var is="http://www.w3.org/1999/xhtml";const pp={svg:"http://www.w3.org/2000/svg",xhtml:is,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),pp.hasOwnProperty(n)?{space:pp[n],local:e}:e}function NS(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===is&&n.documentElement.namespaceURI===is?n.createElement(e):n.createElementNS(o,e)}}function wS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hp(e){var n=nr(e);return(n.local?wS:NS)(n)}function IS(){}function as(e){return e==null?IS:function(){return this.querySelector(e)}}function vS(e){typeof e!="function"&&(e=as(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new St(i,this._parents)}function xS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function CS(){return[]}function yp(e){return e==null?CS:function(){return this.querySelectorAll(e)}}function SS(e){return function(){return xS(e.apply(this,arguments))}}function RS(e){typeof e=="function"?e=SS(e):e=yp(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new St(i,a)}function gp(e){return function(){return this.matches(e)}}function bp(e){return function(n){return n.matches(e)}}var AS=Array.prototype.find;function $S(e){return function(){return AS.call(this.children,e)}}function TS(){return this.firstElementChild}function MS(e){return this.select(e==null?TS:$S(typeof e=="function"?e:bp(e)))}var VS=Array.prototype.filter;function BS(){return Array.from(this.children)}function DS(e){return function(){return VS.call(this.children,e)}}function OS(e){return this.selectAll(e==null?BS:DS(typeof e=="function"?e:bp(e)))}function LS(e){typeof e!="function"&&(e=gp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new St(i,this._parents)}function _p(e){return new Array(e.length)}function PS(){return new St(this._enter||this._groups.map(_p),this._parents)}function or(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}or.prototype={constructor:or,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function zS(e){return function(){return e}}function FS(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new or(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function US(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new or(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function HS(e){return e.__data__}function jS(e,n){if(!arguments.length)return Array.from(this,HS);var o=n?US:FS,i=this._parents,a=this._groups;typeof e!="function"&&(e=zS(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=KS(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),k=l[d]=new Array(h),N=c[d]=new Array(p);o(u,m,g,k,N,f,n);for(var b=0,_=0,E,I;b<h;++b)if(E=g[b]){for(b>=_&&(_=b+1);!(I=k[_])&&++_<h;);E._next=I||null}}return l=new St(l,i),l._enter=s,l._exit=c,l}function KS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function GS(){return new St(this._exit||this._groups.map(_p),this._parents)}function YS(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function qS(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new St(s,this._parents)}function WS(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function JS(e){e||(e=XS);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new St(a,this._parents).order()}function XS(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function ZS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function QS(){return Array.from(this)}function eR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function tR(){let e=0;for(const n of this)++e;return e}function nR(){return!this.node()}function oR(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function iR(e){return function(){this.removeAttribute(e)}}function aR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rR(e,n){return function(){this.setAttribute(e,n)}}function lR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function sR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function cR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function dR(e,n){var o=nr(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?aR:iR:typeof n=="function"?o.local?cR:sR:o.local?lR:rR)(o,n))}function kp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function uR(e){return function(){this.style.removeProperty(e)}}function mR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function fR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function pR(e,n,o){return arguments.length>1?this.each((n==null?uR:typeof n=="function"?fR:mR)(e,n,o??"")):Do(this.node(),e)}function Do(e,n){return e.style.getPropertyValue(n)||kp(e).getComputedStyle(e,null).getPropertyValue(n)}function hR(e){return function(){delete this[e]}}function yR(e,n){return function(){this[e]=n}}function gR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function bR(e,n){return arguments.length>1?this.each((n==null?hR:typeof n=="function"?gR:yR)(e,n)):this.node()[e]}function Ep(e){return e.trim().split(/^|\s+/)}function rs(e){return e.classList||new Np(e)}function Np(e){this._node=e,this._names=Ep(e.getAttribute("class")||"")}Np.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function wp(e,n){for(var o=rs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Ip(e,n){for(var o=rs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function _R(e){return function(){wp(this,e)}}function kR(e){return function(){Ip(this,e)}}function ER(e,n){return function(){(n.apply(this,arguments)?wp:Ip)(this,e)}}function NR(e,n){var o=Ep(e+"");if(arguments.length<2){for(var i=rs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?ER:n?_R:kR)(o,n))}function wR(){this.textContent=""}function IR(e){return function(){this.textContent=e}}function vR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function xR(e){return arguments.length?this.each(e==null?wR:(typeof e=="function"?vR:IR)(e)):this.node().textContent}function CR(){this.innerHTML=""}function SR(e){return function(){this.innerHTML=e}}function RR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function AR(e){return arguments.length?this.each(e==null?CR:(typeof e=="function"?RR:SR)(e)):this.node().innerHTML}function $R(){this.nextSibling&&this.parentNode.appendChild(this)}function TR(){return this.each($R)}function MR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function VR(){return this.each(MR)}function BR(e){var n=typeof e=="function"?e:hp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function DR(){return null}function OR(e,n){var o=typeof e=="function"?e:hp(e),i=n==null?DR:typeof n=="function"?n:as(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function LR(){var e=this.parentNode;e&&e.removeChild(this)}function PR(){return this.each(LR)}function zR(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function FR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function UR(e){return this.select(e?FR:zR)}function HR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function jR(e){return function(n){e.call(this,n,this.__data__)}}function KR(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function GR(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function YR(e,n,o){return function(){var i=this.__on,a,r=jR(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function qR(e,n,o){var i=KR(e+""),a,r=i.length,l;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<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?YR:GR,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function vp(e,n,o){var i=kp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function WR(e,n){return function(){return vp(this,e,n)}}function JR(e,n){return function(){return vp(this,e,n.apply(this,arguments))}}function XR(e,n){return this.each((typeof n=="function"?JR:WR)(e,n))}function*ZR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var xp=[null];function St(e,n){this._groups=e,this._parents=n}function wi(){return new St([[document.documentElement]],xp)}function QR(){return this}St.prototype=wi.prototype={constructor:St,select:vS,selectAll:RS,selectChild:MS,selectChildren:OS,filter:LS,data:jS,enter:PS,exit:GS,join:YS,merge:qS,selection:QR,order:WS,sort:JS,call:ZS,nodes:QS,node:eR,size:tR,empty:nR,each:oR,attr:dR,style:pR,property:bR,classed:NR,text:xR,html:AR,raise:TR,lower:VR,append:BR,insert:OR,remove:PR,clone:UR,datum:HR,on:qR,dispatch:XR,[Symbol.iterator]:ZR};function Rn(e){return typeof e=="string"?new St([[document.querySelector(e)]],[document.documentElement]):new St([[e]],xp)}function eA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function An(e,n){if(e=eA(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const ls={capture:!0,passive:!1};function ss(e){e.preventDefault(),e.stopImmediatePropagation()}function tA(e){var n=e.document.documentElement,o=Rn(e).on("dragstart.drag",ss,ls);"onselectstart"in n?o.on("selectstart.drag",ss,ls):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function nA(e,n){var o=e.document.documentElement,i=Rn(e).on("dragstart.drag",null);n&&(i.on("click.drag",ss,ls),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 cs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Cp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Ii(){}var vi=.7,ir=1/vi,Oo="\\s*([+-]?\\d+)\\s*",xi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oA=/^#([0-9a-f]{3,8})$/,iA=new RegExp(`^rgb\\(${Oo},${Oo},${Oo}\\)$`),aA=new RegExp(`^rgb\\(${Xt},${Xt},${Xt}\\)$`),rA=new RegExp(`^rgba\\(${Oo},${Oo},${Oo},${xi}\\)$`),lA=new RegExp(`^rgba\\(${Xt},${Xt},${Xt},${xi}\\)$`),sA=new RegExp(`^hsl\\(${xi},${Xt},${Xt}\\)$`),cA=new RegExp(`^hsla\\(${xi},${Xt},${Xt},${xi}\\)$`),Sp={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};cs(Ii,Ci,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Rp,formatHex:Rp,formatHex8:dA,formatHsl:uA,formatRgb:Ap,toString:Ap});function Rp(){return this.rgb().formatHex()}function dA(){return this.rgb().formatHex8()}function uA(){return Bp(this).formatHsl()}function Ap(){return this.rgb().formatRgb()}function Ci(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=oA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?$p(n):o===3?new It(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ar(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ar(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=iA.exec(e))?new It(n[1],n[2],n[3],1):(n=aA.exec(e))?new It(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=rA.exec(e))?ar(n[1],n[2],n[3],n[4]):(n=lA.exec(e))?ar(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=sA.exec(e))?Vp(n[1],n[2]/100,n[3]/100,1):(n=cA.exec(e))?Vp(n[1],n[2]/100,n[3]/100,n[4]):Sp.hasOwnProperty(e)?$p(Sp[e]):e==="transparent"?new It(NaN,NaN,NaN,0):null}function $p(e){return new It(e>>16&255,e>>8&255,e&255,1)}function ar(e,n,o,i){return i<=0&&(e=n=o=NaN),new It(e,n,o,i)}function mA(e){return e instanceof Ii||(e=Ci(e)),e?(e=e.rgb(),new It(e.r,e.g,e.b,e.opacity)):new It}function ds(e,n,o,i){return arguments.length===1?mA(e):new It(e,n,o,i??1)}function It(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}cs(It,ds,Cp(Ii,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vi:Math.pow(vi,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new It(io(this.r),io(this.g),io(this.b),rr(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:Tp,formatHex:Tp,formatHex8:fA,formatRgb:Mp,toString:Mp}));function Tp(){return`#${ao(this.r)}${ao(this.g)}${ao(this.b)}`}function fA(){return`#${ao(this.r)}${ao(this.g)}${ao(this.b)}${ao((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mp(){const e=rr(this.opacity);return`${e===1?"rgb(":"rgba("}${io(this.r)}, ${io(this.g)}, ${io(this.b)}${e===1?")":`, ${e})`}`}function rr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function io(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ao(e){return e=io(e),(e<16?"0":"")+e.toString(16)}function Vp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Lt(e,n,o,i)}function Bp(e){if(e instanceof Lt)return new Lt(e.h,e.s,e.l,e.opacity);if(e instanceof Ii||(e=Ci(e)),!e)return new Lt;if(e instanceof Lt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Lt(l,s,c,e.opacity)}function pA(e,n,o,i){return arguments.length===1?Bp(e):new Lt(e,n,o,i??1)}function Lt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}cs(Lt,pA,Cp(Ii,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new Lt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vi:Math.pow(vi,e),new Lt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new It(us(e>=240?e-240:e+120,a,i),us(e,a,i),us(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Lt(Dp(this.h),lr(this.s),lr(this.l),rr(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=rr(this.opacity);return`${e===1?"hsl(":"hsla("}${Dp(this.h)}, ${lr(this.s)*100}%, ${lr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dp(e){return e=(e||0)%360,e<0?e+360:e}function lr(e){return Math.max(0,Math.min(1,e||0))}function us(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Op=e=>()=>e;function hA(e,n){return function(o){return e+o*n}}function yA(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function gA(e){return(e=+e)==1?Lp:function(n,o){return o-n?yA(n,o,e):Op(isNaN(n)?o:n)}}function Lp(e,n){var o=n-e;return o?hA(e,o):Op(isNaN(e)?n:e)}const Pp=(function e(n){var o=gA(n);function i(a,r){var l=o((a=ds(a)).r,(r=ds(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Lp(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function $n(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var ms=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fs=new RegExp(ms.source,"g");function bA(e){return function(){return e}}function _A(e){return function(n){return e(n)+""}}function kA(e,n){var o=ms.lastIndex=fs.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=ms.exec(e))&&(a=fs.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:$n(i,a)})),o=fs.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?_A(c[0].x):bA(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var zp=180/Math.PI,ps={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fp(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*zp,skewX:Math.atan(c)*zp,scaleX:l,scaleY:s}}var sr;function EA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?ps:Fp(n.a,n.b,n.c,n.d,n.e,n.f)}function NA(e){return e==null||(sr||(sr=document.createElementNS("http://www.w3.org/2000/svg","g")),sr.setAttribute("transform",e),!(e=sr.transform.baseVal.consolidate()))?ps:(e=e.matrix,Fp(e.a,e.b,e.c,e.d,e.e,e.f))}function Up(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:$n(d,m)},{i:g-2,x:$n(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:$n(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:$n(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:$n(d,m)},{i:g-2,x:$n(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,k;++h<g;)m[(k=p[h]).i]=k.x(f);return m.join("")}}}var wA=Up(EA,"px, ","px)","deg)"),IA=Up(NA,", ",")",")"),vA=1e-12;function Hp(e){return((e=Math.exp(e))+1/e)/2}function xA(e){return((e=Math.exp(e))-1/e)/2}function CA(e){return((e=Math.exp(2*e))-1)/(e+1)}const SA=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,k,N;if(g<vA)N=Math.log(p/d)/n,k=function(T){return[s+T*f,c+T*h,d*Math.exp(n*T*N)]};else{var b=Math.sqrt(g),_=(p*p-d*d+i*g)/(2*d*o*b),E=(p*p-d*d-i*g)/(2*p*o*b),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(E*E+1)-E);N=(A-I)/n,k=function(T){var L=T*N,x=Hp(I),R=d/(o*b)*(x*CA(n*L+I)-xA(I));return[s+R*f,c+R*h,d*x/Hp(n*L+I)]}}return k.duration=N*1e3*n/Math.SQRT2,k}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Lo=0,Si=0,Ri=0,jp=1e3,cr,Ai,dr=0,ro=0,ur=0,$i=typeof performance=="object"&&performance.now?performance:Date,Kp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function hs(){return ro||(Kp(RA),ro=$i.now()+ur)}function RA(){ro=0}function mr(){this._call=this._time=this._next=null}mr.prototype=Gp.prototype={constructor:mr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?hs():+o)+(n==null?0:+n),!this._next&&Ai!==this&&(Ai?Ai._next=this:cr=this,Ai=this),this._call=e,this._time=o,ys()},stop:function(){this._call&&(this._call=null,this._time=1/0,ys())}};function Gp(e,n,o){var i=new mr;return i.restart(e,n,o),i}function AA(){hs(),++Lo;for(var e=cr,n;e;)(n=ro-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Lo}function Yp(){ro=(dr=$i.now())+ur,Lo=Si=0;try{AA()}finally{Lo=0,TA(),ro=0}}function $A(){var e=$i.now(),n=e-dr;n>jp&&(ur-=n,dr=e)}function TA(){for(var e,n=cr,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:cr=o);Ai=e,ys(i)}function ys(e){if(!Lo){Si&&(Si=clearTimeout(Si));var n=e-ro;n>24?(e<1/0&&(Si=setTimeout(Yp,e-$i.now()-ur)),Ri&&(Ri=clearInterval(Ri))):(Ri||(dr=$i.now(),Ri=setInterval($A,jp)),Lo=1,Kp(Yp))}}function qp(e,n,o){var i=new mr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var MA=os("start","end","cancel","interrupt"),VA=[],Wp=0,Jp=1,gs=2,fr=3,Xp=4,bs=5,pr=6;function hr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;BA(e,o,{name:n,index:i,group:a,on:MA,tween:VA,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Wp})}function _s(e,n){var o=Pt(e,n);if(o.state>Wp)throw new Error("too late; already scheduled");return o}function Zt(e,n){var o=Pt(e,n);if(o.state>fr)throw new Error("too late; already running");return o}function Pt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function BA(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Gp(r,0,o.time);function r(d){o.state=Jp,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==Jp)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===fr)return qp(l);f.state===Xp?(f.state=pr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=pr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(qp(function(){o.state===fr&&(o.state=Xp,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=gs,o.on.call("start",e,e.__data__,o.index,o.group),o.state===gs){for(o.state=fr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=bs,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===bs&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=pr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function yr(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>gs&&i.state<bs,i.state=pr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function DA(e){return this.each(function(){yr(this,e)})}function OA(e,n){var o,i;return function(){var a=Zt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function LA(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Zt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function PA(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Pt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?OA:LA)(o,e,n))}function ks(e,n,o){var i=e._id;return e.each(function(){var a=Zt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Pt(a,i).value[n]}}function Zp(e,n){var o;return(typeof n=="number"?$n:n instanceof Ci?Pp:(o=Ci(n))?(n=o,Pp):kA)(e,n)}function zA(e){return function(){this.removeAttribute(e)}}function FA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function UA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function HA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function jA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function KA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function GA(e,n){var o=nr(e),i=o==="transform"?IA:Zp;return this.attrTween(e,typeof n=="function"?(o.local?KA:jA)(o,i,ks(this,"attr."+e,n)):n==null?(o.local?FA:zA)(o):(o.local?HA:UA)(o,i,n))}function YA(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function qA(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function WA(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&qA(e,r)),o}return a._value=n,a}function JA(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&YA(e,r)),o}return a._value=n,a}function XA(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=nr(e);return this.tween(o,(i.local?WA:JA)(i,n))}function ZA(e,n){return function(){_s(this,e).delay=+n.apply(this,arguments)}}function QA(e,n){return n=+n,function(){_s(this,e).delay=n}}function e$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?ZA:QA)(n,e)):Pt(this.node(),n).delay}function t$(e,n){return function(){Zt(this,e).duration=+n.apply(this,arguments)}}function n$(e,n){return n=+n,function(){Zt(this,e).duration=n}}function o$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?t$:n$)(n,e)):Pt(this.node(),n).duration}function i$(e,n){if(typeof n!="function")throw new Error;return function(){Zt(this,e).ease=n}}function a$(e){var n=this._id;return arguments.length?this.each(i$(n,e)):Pt(this.node(),n).ease}function r$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Zt(this,e).ease=o}}function l$(e){if(typeof e!="function")throw new Error;return this.each(r$(this._id,e))}function s$(e){typeof e!="function"&&(e=gp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new fn(i,this._parents,this._name,this._id)}function c$(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new fn(l,this._parents,this._name,this._id)}function d$(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function u$(e,n,o){var i,a,r=d$(n)?_s:Zt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function m$(e,n){var o=this._id;return arguments.length<2?Pt(this.node(),o).on.on(e):this.each(u$(o,e,n))}function f$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function p$(){return this.on("end.remove",f$(this._id))}function h$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=as(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,hr(d[p],n,o,p,d,Pt(u,o)));return new fn(r,this._parents,n,o)}function y$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=yp(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=Pt(u,o),g=0,k=p.length;g<k;++g)(f=p[g])&&hr(f,n,o,g,p,h);r.push(p),l.push(u)}return new fn(r,l,n,o)}var g$=wi.prototype.constructor;function b$(){return new g$(this._groups,this._parents)}function _$(e,n){var o,i,a;return function(){var r=Do(this,e),l=(this.style.removeProperty(e),Do(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Qp(e){return function(){this.style.removeProperty(e)}}function k$(e,n,o){var i,a=o+"",r;return function(){var l=Do(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function E$(e,n,o){var i,a,r;return function(){var l=Do(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Do(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function N$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Zt(this,e),d=c.on,u=c.value[r]==null?s||(s=Qp(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function w$(e,n,o){var i=(e+="")=="transform"?wA:Zp;return n==null?this.styleTween(e,_$(e,i)).on("end.style."+e,Qp(e)):typeof n=="function"?this.styleTween(e,E$(e,i,ks(this,"style."+e,n))).each(N$(this._id,e)):this.styleTween(e,k$(e,i,n),o).on("end.style."+e,null)}function I$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function v$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&I$(e,l,o)),i}return r._value=n,r}function x$(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,v$(e,n,o??""))}function C$(e){return function(){this.textContent=e}}function S$(e){return function(){var n=e(this);this.textContent=n??""}}function R$(e){return this.tween("text",typeof e=="function"?S$(ks(this,"text",e)):C$(e==null?"":e+""))}function A$(e){return function(n){this.textContent=e.call(this,n)}}function $$(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&A$(a)),n}return i._value=e,i}function T$(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,$$(e))}function M$(){for(var e=this._name,n=this._id,o=eh(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Pt(c,n);hr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new fn(i,this._parents,e,o)}function V$(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Zt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var B$=0;function fn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function eh(){return++B$}var pn=wi.prototype;fn.prototype={constructor:fn,select:h$,selectAll:y$,selectChild:pn.selectChild,selectChildren:pn.selectChildren,filter:s$,merge:c$,selection:b$,transition:M$,call:pn.call,nodes:pn.nodes,node:pn.node,size:pn.size,empty:pn.empty,each:pn.each,on:m$,attr:GA,attrTween:XA,style:w$,styleTween:x$,text:R$,textTween:T$,remove:p$,tween:PA,delay:e$,duration:o$,ease:a$,easeVarying:l$,end:V$,[Symbol.iterator]:pn[Symbol.iterator]};function D$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var O$={time:null,delay:0,duration:250,ease:D$};function L$(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function P$(e){var n,o;e instanceof fn?(n=e._id,e=e._name):(n=eh(),(o=O$).time=hs(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&hr(c,e,n,d,l,o||L$(c,n));return new fn(i,this._parents,e,n)}wi.prototype.interrupt=DA,wi.prototype.transition=P$;const gr=e=>()=>e;function z$(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function hn(e,n,o){this.k=e,this.x=n,this.y=o}hn.prototype={constructor:hn,scale:function(e){return e===1?this:new hn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new hn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Es=new hn(1,0,0);hn.prototype;function Ns(e){e.stopImmediatePropagation()}function Ti(e){e.preventDefault(),e.stopImmediatePropagation()}function F$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function U$(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function th(){return this.__zoom||Es}function H$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function j$(){return navigator.maxTouchPoints||"ontouchstart"in this}function K$(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function G$(){var e=F$,n=U$,o=K$,i=H$,a=j$,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=SA,d=os("start","zoom","end"),u,m,p,f=500,h=150,g=0,k=10;function N(y){y.property("__zoom",th).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(y,w,v,M){var D=y.selection?y.selection():y;D.property("__zoom",th),y!==D?I(y,w,v,M):D.interrupt().each(function(){A(this,arguments).event(M).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},N.scaleBy=function(y,w,v,M){N.scaleTo(y,function(){var D=this.__zoom.k,U=typeof w=="function"?w.apply(this,arguments):w;return D*U},v,M)},N.scaleTo=function(y,w,v,M){N.transform(y,function(){var D=n.apply(this,arguments),U=this.__zoom,W=v==null?E(D):typeof v=="function"?v.apply(this,arguments):v,ie=U.invert(W),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(b(U,pe),W,ie),D,l)},v,M)},N.translateBy=function(y,w,v,M){N.transform(y,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,M)},N.translateTo=function(y,w,v,M,D){N.transform(y,function(){var U=n.apply(this,arguments),W=this.__zoom,ie=M==null?E(U):typeof M=="function"?M.apply(this,arguments):M;return o(Es.translate(ie[0],ie[1]).scale(W.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),U,l)},M,D)};function b(y,w){return w=Math.max(r[0],Math.min(r[1],w)),w===y.k?y:new hn(w,y.x,y.y)}function _(y,w,v){var M=w[0]-v[0]*y.k,D=w[1]-v[1]*y.k;return M===y.x&&D===y.y?y:new hn(y.k,M,D)}function E(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function I(y,w,v,M){y.on("start.zoom",function(){A(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,U=arguments,W=A(D,U).event(M),ie=n.apply(D,U),pe=v==null?E(ie):typeof v=="function"?v.apply(D,U):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=D.__zoom,me=typeof w=="function"?w.apply(D,U):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new hn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}W.zoom(null,ke)}})}function A(y,w,v){return!v&&y.__zooming||new T(y,w)}function T(y,w){this.that=y,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(y,w),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,w){return this.mouse&&y!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&y!=="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(y){var w=Rn(this.that).datum();d.call(y,this.that,new z$(y,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:d}),w)}};function L(y,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(y),M=this.__zoom,D=Math.max(r[0],Math.min(r[1],M.k*Math.pow(2,i.apply(this,arguments)))),U=An(y);if(v.wheel)(v.mouse[0][0]!==U[0]||v.mouse[0][1]!==U[1])&&(v.mouse[1]=M.invert(v.mouse[0]=U)),clearTimeout(v.wheel);else{if(M.k===D)return;v.mouse=[U,M.invert(U)],yr(this),v.start()}Ti(y),v.wheel=setTimeout(W,h),v.zoom("mouse",o(_(b(M,D),v.mouse[0],v.mouse[1]),v.extent,l));function W(){v.wheel=null,v.end()}}function x(y,...w){if(p||!e.apply(this,arguments))return;var v=y.currentTarget,M=A(this,w,!0).event(y),D=Rn(y.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),U=An(y,v),W=y.clientX,ie=y.clientY;tA(y.view),Ns(y),M.mouse=[U,this.__zoom.invert(U)],yr(this),M.start();function pe(ge){if(Ti(ge),!M.moved){var me=ge.clientX-W,se=ge.clientY-ie;M.moved=me*me+se*se>g}M.event(ge).zoom("mouse",o(_(M.that.__zoom,M.mouse[0]=An(ge,v),M.mouse[1]),M.extent,l))}function ye(ge){D.on("mousemove.zoom mouseup.zoom",null),nA(ge.view,M.moved),Ti(ge),M.event(ge).end()}}function R(y,...w){if(e.apply(this,arguments)){var v=this.__zoom,M=An(y.changedTouches?y.changedTouches[0]:y,this),D=v.invert(M),U=v.k*(y.shiftKey?.5:2),W=o(_(b(v,U),M,D),n.apply(this,w),l);Ti(y),s>0?Rn(this).transition().duration(s).call(I,W,M,y):Rn(this).call(N.transform,W,M,y)}}function $(y,...w){if(e.apply(this,arguments)){var v=y.touches,M=v.length,D=A(this,w,y.changedTouches.length===M).event(y),U,W,ie,pe;for(Ns(y),W=0;W<M;++W)ie=v[W],pe=An(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],D.touch0?!D.touch1&&D.touch0[2]!==pe[2]&&(D.touch1=pe,D.taps=0):(D.touch0=pe,U=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),U&&(D.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),yr(this),D.start())}}function B(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W,ie,pe;for(Ti(y),U=0;U<D;++U)W=M[U],ie=An(W,this),v.touch0&&v.touch0[2]===W.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===W.identifier&&(v.touch1[0]=ie);if(W=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;W=b(W,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(_(W,ie,pe),v.extent,l))}}function O(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W;for(Ns(y),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),U=0;U<D;++U)W=M[U],v.touch0&&v.touch0[2]===W.identifier?delete v.touch0:v.touch1&&v.touch1[2]===W.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(W=An(W,this),Math.hypot(m[0]-W[0],m[1]-W[1])<k)){var ie=Rn(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return N.wheelDelta=function(y){return arguments.length?(i=typeof y=="function"?y:gr(+y),N):i},N.filter=function(y){return arguments.length?(e=typeof y=="function"?y:gr(!!y),N):e},N.touchable=function(y){return arguments.length?(a=typeof y=="function"?y:gr(!!y),N):a},N.extent=function(y){return arguments.length?(n=typeof y=="function"?y:gr([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),N):n},N.scaleExtent=function(y){return arguments.length?(r[0]=+y[0],r[1]=+y[1],N):[r[0],r[1]]},N.translateExtent=function(y){return arguments.length?(l[0][0]=+y[0][0],l[1][0]=+y[1][0],l[0][1]=+y[0][1],l[1][1]=+y[1][1],N):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},N.constrain=function(y){return arguments.length?(o=y,N):o},N.duration=function(y){return arguments.length?(s=+y,N):s},N.interpolate=function(y){return arguments.length?(c=y,N):c},N.on=function(){var y=d.on.apply(d,arguments);return y===d?N:y},N.clickDistance=function(y){return arguments.length?(g=(y=+y)*y,N):Math.sqrt(g)},N.tapDistance=function(y){return arguments.length?(k=+y,N):k},N}const nh=Symbol("MiniMapSlots"),Y$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],q$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},W$=t.defineComponent({...q$,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:n}){const o=e,i=t.inject(nh),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,p)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,Y$))],64)):t.createCommentVNode("",!0)}}),J$=["width","height","viewBox","aria-labelledby"],X$=["id"],Z$=["d","fill","stroke","stroke-width"],Q$={name:"MiniMap",compatConfig:{MODE:3}},eT=t.defineComponent({...Q$,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:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:p,d3Zoom:f,getNodesInitialized:h}=je(),g=t.ref();t.provide(nh,o);const k=t.toRef(()=>{var D;return e.width??((D=i.style)==null?void 0:D.width)??a}),N=t.toRef(()=>{var D;return e.height??((D=i.style)==null?void 0:D.height)??r}),b=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",_=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),E=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),I=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=t.computed(()=>Dl(h.value.filter(D=>!D.hidden))),T=t.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})),L=t.computed(()=>h.value&&h.value.length?k0(A.value,T.value):T.value),x=t.computed(()=>{const D=L.value.width/k.value,U=L.value.height/N.value;return Math.max(D,U)}),R=t.computed(()=>{const D=x.value*k.value,U=x.value*N.value,W=e.offsetScale*x.value;return{offset:W,x:L.value.x-(D-L.value.width)/2-W,y:L.value.y-(U-L.value.height)/2-W,width:D+W*2,height:U+W*2}}),$=t.computed(()=>!R.value.x||!R.value.y?"":`
|
|
53
|
+
M${R.value.x-R.value.offset},${R.value.y-R.value.offset}
|
|
54
|
+
h${R.value.width+R.value.offset*2}
|
|
55
|
+
v${R.value.height+R.value.offset*2}
|
|
56
|
+
h${-R.value.width-R.value.offset*2}z
|
|
57
|
+
M${T.value.x+e.maskBorderRadius},${T.value.y}
|
|
58
|
+
h${T.value.width-2*e.maskBorderRadius}
|
|
59
59
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
|
|
60
|
-
v${
|
|
60
|
+
v${T.value.height-2*e.maskBorderRadius}
|
|
61
61
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
|
|
62
|
-
h${-(
|
|
62
|
+
h${-(T.value.width-2*e.maskBorderRadius)}
|
|
63
63
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
64
|
-
v${-(
|
|
65
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(z=>{if(b.value){const K=An(b.value),J=ce=>{if(ce.sourceEvent.type!=="wheel"||!h.value||!p.value)return;const Ne=ce.sourceEvent.ctrlKey&&_i()?10:1,he=-ce.sourceEvent.deltaY*(ce.sourceEvent.deltaMode===1?.05:ce.sourceEvent.deltaMode?1:.002)*e.zoomStep,de=c.value.zoom*2**(he*Ne);p.value.scaleTo(h.value,de)},re=ce=>{if(ce.sourceEvent.type!=="mousemove"||!h.value||!p.value)return;const Ne=T.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),he={x:c.value.x-ce.sourceEvent.movementX*Ne,y:c.value.y-ce.sourceEvent.movementY*Ne},de=[[0,0],[u.value.width,u.value.height]],_e=bs.translate(he.x,he.y).scale(c.value.zoom),Se=p.value.constrain()(_e,de,d.value);p.value.transform(h.value,Se)},pe=L$().wheelDelta(ce=>Vl(ce)*(e.zoomStep/10)).on("zoom",e.pannable?re:()=>{}).on("zoom.wheel",e.zoomable?J:()=>{});K.call(pe),z(()=>{K.on("zoom",null)})}},{flush:"post"});function x(z){const[K,J]=$n(z);n("click",{event:z,position:{x:K,y:J}})}function M(z,K){const J={event:z,node:K,connectedEdges:Xn([K],s.value)};m.miniMapNodeClick(J),n("nodeClick",J)}function E(z,K){const J={event:z,node:K,connectedEdges:Xn([K],s.value)};m.miniMapNodeDoubleClick(J),n("nodeDblclick",J)}function w(z,K){const J={event:z,node:K,connectedEdges:Xn([K],s.value)};m.miniMapNodeMouseEnter(J),n("nodeMouseenter",J)}function S(z,K){const J={event:z,node:K,connectedEdges:Xn([K],s.value)};m.miniMapNodeMouseMove(J),n("nodeMousemove",J)}function B(z,K){const J={event:z,node:K,connectedEdges:Xn([K],s.value)};m.miniMapNodeMouseLeave(J),n("nodeMouseleave",J)}return(z,K)=>(t.openBlock(),t.createBlock(t.unref(af),{position:z.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:z.pannable,zoomable:z.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:b,width:f.value,height:g.value,viewBox:[V.value.x,V.value.y,V.value.width,V.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:x},[z.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(z.ariaLabel),9,U$)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),J=>(t.openBlock(),t.createBlock(z$,{id:J.id,key:J.id,f:"",position:J.computedPosition,dimensions:J.dimensions,selected:J.selected,dragging:J.dragging,style:t.normalizeStyle(J.style),class:t.normalizeClass(I.value(J)),color:_.value(J),"border-radius":z.nodeBorderRadius,"stroke-color":N.value(J),"stroke-width":z.nodeStrokeWidth,"shape-rendering":t.unref(k),type:J.type,hidden:J.hidden,onClick:re=>M(re,J),onDblclick:re=>E(re,J),onMouseenter:re=>w(re,J),onMousemove:re=>S(re,J),onMouseleave:re=>B(re,J)},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)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:R.value,fill:z.maskColor,stroke:z.maskStrokeColor,"stroke-width":z.maskStrokeWidth,"fill-rule":"evenodd"},null,8,H$)],8,F$))]),_:1},8,["position","class"]))}}),G$=["d"],Y$=["cx","cy","onDblclick"],q$=["x","y","onPointerdown","onDblclick"],W$=Ke(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(Ql),a=t.inject(oo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Vo,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((A,T)=>T===d.value?u.value:A)),{source:h,target:p,sourceSide:y,targetSide:b}=ip({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),f=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?zf(h.value,y.value,m.value,p.value,b.value):Uf(h.value,m.value,p.value)),g=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Ff(h.value,y.value,m.value,p.value,b.value):Kf(h.value,m.value,p.value).map((A,T)=>({point:A,segIndex:T})):[]),k=t.computed(()=>r.value?m.value:[]);function _(A,T){d.value=A,u.value={...c.value[A]},T.target.setPointerCapture(T.pointerId),T.stopPropagation()}function N(A){if(d.value<0)return;const T=o({x:A.clientX,y:A.clientY});u.value={x:T.x,y:T.y}}function I(A){var T,V;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(V=(T=A.target).releasePointerCapture)==null||V.call(T,A.pointerId)}function $(A,T){T.stopPropagation(),i==null||i.removePoint(n.id,A)}function C(A,T){if(!i)return;const V=o({x:T.clientX,y:T.clientY});i.insertPoint(n.id,A,{x:V.x,y:V.y})}return(A,T)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:f.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,G$),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,(V,R)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${R}`,cx:V.point.x,cy:V.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(x=>C(V.segIndex,x),["stop"])},null,42,Y$))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,(V,R)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${R}`,x:V.x-5,y:V.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:x=>_(R,x),onPointermove:N,onPointerup:I,onDblclick:x=>$(R,x)},null,42,q$))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),J$=["data-theme"],X$={key:0,class:"em-ctx__sep",role:"separator"},Z$=["aria-label"],Q$={class:"em-ctx__swatches-label","aria-hidden":"true"},eT={class:"em-ctx__chips",role:"none"},tT=["aria-checked","aria-label","title","onClick"],nT=["aria-checked","aria-label","title","onClick"],oT=["disabled","onClick"],iT={class:"em-ctx__icon"},aT={class:"em-ctx__caption"},rT=Ke(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(_,N)=>Lt(o.locale??"ko",_,N),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(_,N){var C,A;r.value=N,l.value=(C=_.target)!=null&&C.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=_.clientX,c.y=_.clientY,a.value=!0,window.addEventListener("keydown",f),window.addEventListener("resize",h),await t.nextTick();const I=s.value;if(!I)return;const $=I.getBoundingClientRect();c.x+$.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-$.width)),c.y+$.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-$.height)),(A=p()[0])==null||A.focus()}function h(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",f),window.removeEventListener("resize",h);const _=d;d=null,_!=null&&_.isConnected&&_.focus()}function p(){const _=s.value;if(!_)return[];const N=[];for(const I of Array.from(_.children))if(I.classList.contains("em-ctx__item"))I.disabled||N.push(I);else if(I.classList.contains("em-ctx__swatches")){const $=Array.from(I.querySelectorAll(".em-ctx__chip"));$.length&&N.push($.find(C=>C===document.activeElement)??$[0])}return N}function y(_){var C;const N=p();if(!N.length)return;const I=N.indexOf(document.activeElement),$=I<0?_>0?0:N.length-1:(I+_+N.length)%N.length;(C=N[$])==null||C.focus()}function b(_){var C,A;const N=(C=document.activeElement)==null?void 0:C.closest(".em-ctx__swatches");if(!N)return!1;const I=Array.from(N.querySelectorAll(".em-ctx__chip")),$=I.indexOf(document.activeElement);return $<0?!1:((A=I[($+_+I.length)%I.length])==null||A.focus(),!0)}function f(_){var N,I;switch(_.key){case"Escape":_.stopPropagation(),h();return;case"ArrowDown":_.preventDefault(),y(1);return;case"ArrowUp":_.preventDefault(),y(-1);return;case"ArrowRight":b(1)&&_.preventDefault();return;case"ArrowLeft":b(-1)&&_.preventDefault();return;case"Home":_.preventDefault(),(N=p()[0])==null||N.focus();return;case"End":{_.preventDefault();const $=p();(I=$[$.length-1])==null||I.focus();return}case"Tab":_.preventDefault(),y(_.shiftKey?-1:1)}}function g(_){_.disabled||(_.handler(),h())}function k(_,N){_.onPick(N),h()}return t.onBeforeUnmount(h),n({open:m,close:h}),(_,N)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:h,onContextmenu:t.withModifiers(h,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:N[0]||(N[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(I,$)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:$},[I.type==="separator"?(t.openBlock(),t.createElementBlock("div",X$)):I.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":I.caption},[t.createElementVNode("span",Q$,t.toDisplayString(I.caption),1),t.createElementVNode("div",eT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":I.current===null}]),role:"menuitemradio","aria-checked":I.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:C=>k(I,null)},null,10,tT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),C=>(t.openBlock(),t.createElementBlock("button",{key:C,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":I.current===C}]),style:t.normalizeStyle({background:t.unref(To)(C)}),role:"menuitemradio","aria-checked":I.current===C,"aria-label":i(t.unref(to)(C)),title:i(t.unref(to)(C)),onClick:A=>k(I,C)},null,14,nT))),128))])],8,Z$)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":I.danger,"is-disabled":I.disabled}]),disabled:I.disabled,role:"menuitem",onClick:C=>g(I)},[t.createElementVNode("span",iT,[I.icon?(t.openBlock(),t.createBlock($e,{key:0,name:I.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",aT,t.toDisplayString(I.caption),1)],10,oT))],64))),128))],36)],8,J$)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function Zp(e,n){return n?`${e}:${n}`:e}function Qp(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(Zp(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function lT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=Zp(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function eh(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(Qp(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=Qp(e.storageKey,s)),t.watch(o,s=>lT(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const ks=[".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 Po(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function sT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function cT(e,n){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 r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const b=n(y.left,y.top+y.height/2);return[{...i,x:b.x,y:b.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,h=0;const p=()=>{const y=d.trim();if(y){const b=n(m,(u+h)/2);c.push({...i,x:b.x,y:b.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const b=a.getBoundingClientRect();u===null||Math.abs(b.top-u)>1?(p(),u=b.top,m=b.left,h=b.bottom,d=s[y]):(d+=s[y],h=Math.max(h,b.bottom))}return p(),c}function gr(e,n){const o=[];for(const i of e.querySelectorAll("*"))sT(i)&&(i.closest(ks)||Po(i)&&o.push(...cT(i,n)));return o}function Ti(e){return Math.round(e*100)/100}function dT(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(ks)||!Po(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=n(a.left,a.top),l=n(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="${Ti(r.x)}" y="${Ti(r.y)}" width="${Ti(l.x-r.x)}" height="${Ti(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function uT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Po(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Ti(parseFloat(o.getAttribute(d)??"0"));s==="line"?n.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?n.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&n.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return n}function th(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(ks)||!Po(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)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:r.borderTopColor,strokeWidth:l})}return i}function Mi(e,n){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=n(o.left,o.top),r=n(o.right,o.bottom),l=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:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function Es(e,n){e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x+n.w),e.maxY=Math.max(e.maxY,n.y+n.h)}function mT(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(p,y)=>e.screenToFlowCoordinate({x:p,y}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const p of e.nodes.value){const y=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(p.id)}"]`);if(!y||!Po(y))continue;const b=y.firstElementChild;if(b)if(p.type==="group"){const f=Mi(b,o);Es(s,f),i.push({...f,texts:[]});const g=b.querySelector(".em-group__label");g&&i.push({...Mi(g,o),stroke:"none",texts:[]}),i.push({...f,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:gr(b,o)})}else if(p.type==="note"){const f={...Mi(b,o),texts:gr(b,o),lines:th(b,b,o)};Es(s,f),r.push(f)}else{const f=Mi(b,o);Es(s,f);const g=f.radius??{tl:0,tr:0};a.push({...f,stroke:"none",texts:[]});const k=b.querySelector(".em-entity__header");if(k){const _=Mi(k,o);a.push({x:f.x,y:f.y,w:f.w,h:_.y+_.h-f.y,fill:_.fill,stroke:"none",radius:{tl:g.tl,tr:g.tr,br:0,bl:0},texts:[]})}a.push({...f,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:gr(b,o),lines:th(b,b,o),icons:dT(b,o)}),a.push({...f,fill:"none",texts:[]})}}for(const p of n.querySelectorAll(".vue-flow__edge")){const y=p.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!Po(y))continue;const b=y.getAttribute("d");if(!b)continue;const f=getComputedStyle(y),g=f.strokeDasharray,k=uT(p);l.push({d:b,stroke:f.stroke,strokeWidth:parseFloat(f.strokeWidth)||1.5,strokeDasharray:g&&g!=="none"?g:void 0,labels:gr(p,o),markers:k.length?k:void 0})}const c=n.closest(".em-canvas")??n,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:l,entities:a,notes:r}}function Ns(e){return lc(mT(e))}function nh(e,n){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function oh(e,n="diagram.svg"){const o=Ns(e);nh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function fT(e){var i,a;const n=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:n>0?n:1,h:o>0?o:1}}async function ih(e,n="diagram.png",o=2){const i=Ns(e),{w:a,h:r}=fT(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,h)=>{s.onload=()=>m(),s.onerror=()=>h(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");nh(u,n)}finally{URL.revokeObjectURL(l)}}const pT={class:"em-shortcuts"},hT={class:"em-shortcuts__list"},yT={class:"em-shortcuts__title"},gT={class:"em-shortcuts__keys"},bT={class:"em-shortcuts__kbd"},_T={key:0,class:"em-shortcuts__plus"},kT={class:"em-shortcuts__desc"},ET={class:"em-shortcuts__actions"},ah=Ke(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(s,c)=>Lt(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",pT,[t.createElementVNode("div",hT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,d=>(t.openBlock(),t.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[t.createElementVNode("h4",yT,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",gT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,h)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+h},[t.createElementVNode("kbd",bT,t.toDisplayString(m),1),h<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",_T,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",kT,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",ET,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function zo(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function NT(e,n){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(n);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const wT=["aria-label"],IT=["aria-activedescendant","aria-label","placeholder"],vT={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},CT=["aria-label"],xT={class:"em-cmdk__section","aria-hidden":"true"},ST=["id","aria-selected","onMouseenter","onClick"],RT={class:"em-cmdk__label"},AT={key:0,class:"em-cmdk__tag"},$T={key:1,class:"em-cmdk__sub"},TT=["aria-label"],MT={class:"em-cmdk__section","aria-hidden":"true"},VT=["id","aria-selected","aria-disabled","onMouseenter","onClick"],BT={class:"em-cmdk__label"},DT={key:1,class:"em-cmdk__empty"},LT=Ke(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const I=c.value,$=a.state.logical.entities.map(A=>{var T,V,R,x,M,E;return{type:"goto",kind:"entity",id:A.modelId,label:((V=(T=A.table)==null?void 0:T.logicalName)==null?void 0:V[I])||A.name,sub:(R=A.table)==null?void 0:R.physicalName,match:zo(A.name,(M=(x=A.table)==null?void 0:x.logicalName)==null?void 0:M[I],(E=A.table)==null?void 0:E.physicalName)??""}}),C=a.state.logical.groups.map(A=>{var T,V,R,x;return{type:"goto",kind:"group",id:A.modelId,label:((T=A.name)==null?void 0:T[I])||((V=A.name)==null?void 0:V.ko)||A.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:zo((R=A.name)==null?void 0:R[I],(x=A.name)==null?void 0:x.ko,A.packageName)??""}});return[...$,...C]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const I=[];a.editable.value&&(I.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),I.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),I.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),I.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),I.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),I.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),I.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),I.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const $ of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])I.push({type:"action",id:`dm-${$}`,label:a.t(u[$]),run:()=>a.displayMode.value=$});return I});function h(I,$){return I.label.toLowerCase().includes($)}const p=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?d.value.filter($=>$.match.includes(I)):d.value}),y=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?m.value.filter($=>h($,I)):m.value}),b=t.computed(()=>[...p.value,...y.value]);t.watch([p,y],()=>{l.value=0});function f(I){return b.value.indexOf(I)}const g=I=>`em-cmdk-opt-${I}`,k=t.computed(()=>b.value[l.value]?g(l.value):void 0);t.watch(l,async()=>{var $;await t.nextTick();const I=k.value;I&&(($=document.getElementById(I))==null||$.scrollIntoView({block:"nearest"}))});function _(I){if(I.type==="goto")a.selection.value={kind:I.kind,id:I.id},a.requestFocus(I.id);else{if(I.disabled)return;I.run()}i("close")}function N(I){if(I.key==="Escape"){i("close"),I.preventDefault();return}if(I.key==="ArrowDown"){l.value=Math.min(l.value+1,b.value.length-1),I.preventDefault();return}if(I.key==="ArrowUp"){l.value=Math.max(l.value-1,0),I.preventDefault();return}if(I.key==="Enter"){const $=b.value[l.value];$&&_($),I.preventDefault();return}I.key==="Tab"&&I.preventDefault()}return t.nextTick(()=>{var I;return(I=s.value)==null?void 0:I.focus()}),(I,$)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:$[1]||($[1]=t.withModifiers(C=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":$[0]||($[0]=C=>r.value=C),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":k.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:N},null,40,IT),[[t.vModelText,r.value]]),t.createElementVNode("div",vT,[b.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[p.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",xT,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,C=>(t.openBlock(),t.createElementBlock("button",{id:g(f(C)),key:C.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":f(C)===l.value}]),role:"option","aria-selected":f(C)===l.value,onMouseenter:A=>l.value=f(C),onClick:A=>_(C)},[t.createElementVNode("span",RT,t.toDisplayString(C.label),1),C.tag?(t.openBlock(),t.createElementBlock("span",AT,t.toDisplayString(C.tag),1)):C.sub?(t.openBlock(),t.createElementBlock("span",$T,t.toDisplayString(C.sub),1)):t.createCommentVNode("",!0)],42,ST))),128))],8,CT)):t.createCommentVNode("",!0),y.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",MT,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,C=>(t.openBlock(),t.createElementBlock("button",{id:g(f(C)),key:C.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":f(C)===l.value,"is-disabled":C.disabled}]),role:"option","aria-selected":f(C)===l.value,"aria-disabled":C.disabled||void 0,onMouseenter:A=>l.value=f(C),onClick:A=>_(C)},[t.createElementVNode("span",BT,t.toDisplayString(C.label),1)],42,VT))),128))],8,TT)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",DT,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,wT)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function OT(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const PT={key:0,class:"em-canvas__empty","aria-hidden":"true"},zT={class:"em-canvas__empty-title"},FT=["innerHTML"],UT=["innerHTML"],HT=["innerHTML"],jT={key:1,class:"em-canvas__empty-title"},KT={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},GT={class:"em-conflict-banner__body"},YT={class:"em-conflict-banner__title"},qT={class:"em-conflict-banner__detail"},WT={key:0,class:"em-toast",role:"status","aria-live":"polite"},ws="nc:",rh=Ke(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=te.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(v){l.value=v,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,v=>{v&&c(v.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const v=OT(i.opConflict.value);return v?{title:i.t(v.titleKey),detail:i.t(v.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),h={x:0,y:0};function p(v){h.x=v.clientX,h.y=v.clientY}const y=t.ref(null);t.provide(Ja,y);const b=t.ref(null);t.provide(vf,b);const f=t.ref(null),g=t.computed(()=>{const v=f.value,D=new Set;if(!v)return D;if(v.kind==="entity")D.add(v.id);else if(v.kind==="group"){const ee=i.resolved.value.groups.find(Z=>Z.group.modelId===v.id);for(const Z of(ee==null?void 0:ee.group.memberEntityRefs)??[])D.add(Z)}return D}),k=t.computed(()=>{const v=f.value,D=new Set(g.value),ee=new Set,Z=new Set;if(!v)return{related:D,edges:ee,notes:Z};if(v.kind==="note"){Z.add(v.id);for(const Me of i.resolved.value.noteConnections)Me.noteRef===v.id&&D.add(Me.targetRef);return{related:D,edges:ee,notes:Z}}const Ie=g.value;if(!Ie.size)return{related:D,edges:ee,notes:Z};for(const Me of i.resolved.value.associations){const{end1:ue,end2:Ve}=Me.association;(Ie.has(ue.entityRef)||Ie.has(Ve.entityRef))&&(ee.add(Me.association.modelId),D.add(ue.entityRef),D.add(Ve.entityRef))}for(const Me of i.resolved.value.noteConnections)D.has(Me.targetRef)&&Z.add(Me.noteRef);return{related:D,edges:ee,notes:Z}});t.provide(Vo,{source:f,active:t.computed(()=>f.value!==null),primaryEntityIds:g,relatedEntityIds:t.computed(()=>k.value.related),relatedEdgeIds:t.computed(()=>k.value.edges),relatedNoteIds:t.computed(()=>k.value.notes),hoverGroupId:t.computed(()=>{var v;return((v=f.value)==null?void 0:v.kind)==="group"?f.value.id:null}),setEntityHover:v=>{b.value||m.value||(f.value=v?{kind:"entity",id:v}:null)},setGroupHover:v=>{b.value||m.value||(f.value=v?{kind:"group",id:v}:null)},setNoteHover:v=>{b.value||m.value||(f.value=v?{kind:"note",id:v}:null)}}),t.provide(oo,i);const _=SC(),N=t.computed(()=>_(i.state.logical,i.embeddableCatalog.value));t.provide(Sf,N);const I=eh({expandableKeys:()=>[],defaultCollapsed:AC,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(Af,{isCollapsed:I.isCollapsed,toggle:I.toggle}),t.provide(Cf,{marks:t.toRef(o,"diffMarks")});function $(v,D){return`${ws}${v}:${D}`}function C(v){if(!v.startsWith(ws))return null;const[D,ee]=v.slice(ws.length).split(":");return D&&ee?{noteRef:D,targetRef:ee}:null}t.provide(Ql,{points:v=>{var ee,Z;const D=C(v);return D?((ee=i.resolved.value.noteConnections.find(Ie=>Ie.noteRef===D.noteRef&&Ie.targetRef===D.targetRef))==null?void 0:ee.waypoints)??[]:((Z=i.resolved.value.associations.find(Ie=>Ie.association.modelId===v))==null?void 0:Z.waypoints)??[]},movePoint:(v,D,ee)=>{const Z=C(v);Z?i.moveNoteConnectionWaypoint(Z.noteRef,Z.targetRef,D,ee):i.moveWaypoint(v,D,ee)},insertPoint:(v,D,ee)=>{const Z=C(v);Z?i.addNoteConnectionWaypoint(Z.noteRef,Z.targetRef,D,ee):i.addWaypoint(v,D,ee)},removePoint:(v,D)=>{const ee=C(v);ee?i.removeNoteConnectionWaypoint(ee.noteRef,ee.targetRef,D):i.removeWaypoint(v,D)}});const A=je(),{nodes:T,edges:V,findNode:R,findEdge:x,addNodes:M,addEdges:E,removeNodes:w,removeEdges:S,fitView:B,setCenter:z,getViewport:K,screenToFlowCoordinate:J,getSelectedNodes:re,updateNodeInternals:pe}=A,ce=t.ref(!1);async function Ne(v){ce.value=!0,await t.nextTick(),await new Promise(D=>requestAnimationFrame(()=>D(null)));try{return await v()}finally{ce.value=!1}}async function he(){try{await Ne(()=>oh(A))}catch(v){console.error("[entity-modeler] SVG export failed",v),c(i.t("em.canvas.exportFailed"))}}async function de(){try{await Ne(()=>ih(A))}catch(v){console.error("[entity-modeler] PNG export failed",v),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:he,exportPng:de,fitView:B});const _e=t.computed(()=>i.resolved.value.entities.length===0);function Se(){const v=K(),{width:D,height:ee}=A.dimensions.value;return{x:(D/2-v.x)/v.zoom,y:(ee/2-v.y)/v.zoom}}function me(){const v=Se();i.addEntity("NewEntity",{x:v.x,y:v.y})}function ye(){const v=Se();i.addNote("메모",{x:v.x,y:v.y})}function ie(v){for(const D of i.resolved.value.groups){const{location:ee,size:Z}=D.geo;if(v.x>=ee.x&&v.x<=ee.x+Z.width&&v.y>=ee.y&&v.y<=ee.y+Z.height)return D.group.modelId}return null}function se(v,D){return v.x===D.x&&v.y===D.y}function fe(v,D){return(v==null?void 0:v.width)===(D==null?void 0:D.width)&&(v==null?void 0:v.height)===(D==null?void 0:D.height)}function O(v,D){return v.entity===D.entity&&v.displayMode===D.displayMode&&v.collapsed===D.collapsed&&v.locked===D.locked&&v.groupRef===D.groupRef&&fe(v.size,D.size)&&v.style===D.style&&v.attributeStyles===D.attributeStyles&&v.operationStyles===D.operationStyles}function L(v,D){const ee=Object.keys(v);if(ee.length!==Object.keys(D).length)return!1;for(const Z of ee)if(Z==="geo"){const Ie=v.geo,Me=D.geo;if(!se(Ie.location,Me.location)||!fe(Ie.size,Me.size))return!1}else if(v[Z]!==D[Z])return!1;return!0}function F(){const v=i.resolved.value,D=new Map(v.groups.map(ue=>[ue.group.modelId,ue.geo])),ee=new Set(v.groups.map(ue=>ue.group.modelId)),Z=new Set([...ee,...v.entities.map(ue=>ue.entity.modelId),...v.notes.map(ue=>ue.note.modelId)]);for(const ue of[...T.value])Z.has(ue.id)||w([ue.id]);for(const ue of v.groups){const Ve=ue.group.modelId,ze={width:`${ue.geo.size.width}px`,height:`${ue.geo.size.height}px`},Ue={group:ue.group,style:ue.style,locked:ue.locked},Fe=ue.locked?!1:void 0,Ye=R(Ve);if(Ye){se(Ye.position,ue.geo.location)||(Ye.position={...ue.geo.location});const pt=Ye.data;(pt.group!==Ue.group||pt.style!==Ue.style||pt.locked!==Ue.locked)&&(Ye.data=Ue);const at=Ye.style;((at==null?void 0:at.width)!==ze.width||(at==null?void 0:at.height)!==ze.height)&&(Ye.style=ze),Ye.draggable!==Fe&&(Ye.draggable=Fe)}else M([{id:Ve,type:"group",position:{...ue.geo.location},draggable:Fe,style:ze,data:Ue}])}for(const ue of v.entities){const Ve=ue.entity.modelId,ze=ue.groupRef&&ee.has(ue.groupRef)?ue.groupRef:void 0,Ue={entity:ue.entity,displayMode:i.displayMode.value,collapsed:ue.collapsed,locked:ue.locked,groupRef:ze,size:ue.geo.size,style:ue.style,attributeStyles:ue.attributeStyles,operationStyles:ue.operationStyles},Fe=ue.locked?!1:void 0,Ye=ue.locked?!1:void 0,pt=ze?D.get(ze):void 0,at=pt?{x:ue.geo.location.x-pt.location.x,y:ue.geo.location.y-pt.location.y}:{...ue.geo.location},Ge=R(Ve);Ge?(se(Ge.position,at)||(Ge.position=at),O(Ge.data,Ue)||(Ge.data=Ue),Ge.parentNode!==ze&&(Ge.parentNode=ze),Ge.draggable!==Fe&&(Ge.draggable=Fe),Ge.connectable!==Ye&&(Ge.connectable=Ye)):M([{id:Ve,type:"entity",position:at,parentNode:ze,draggable:Fe,connectable:Ye,data:Ue}])}for(const ue of v.notes){const Ve=ue.note,ze=Ve.modelId,Ue=ue.groupRef&&ee.has(ue.groupRef)?ue.groupRef:void 0,Fe={note:Ve,groupRef:Ue},Ye={width:`${Ve.geo.size.width}px`,height:`${Ve.geo.size.height}px`},pt=Ue?D.get(Ue):void 0,at=pt?{x:Ve.geo.location.x-pt.location.x,y:Ve.geo.location.y-pt.location.y}:{...Ve.geo.location},Ge=R(ze);if(Ge){se(Ge.position,at)||(Ge.position=at);const so=Ge.data;(so.groupRef!==Ue||!L(so.note,Ve))&&(Ge.data=Fe);const _n=Ge.style;((_n==null?void 0:_n.width)!==Ye.width||(_n==null?void 0:_n.height)!==Ye.height)&&(Ge.style=Ye),Ge.parentNode!==Ue&&(Ge.parentNode=Ue)}else M([{id:ze,type:"note",position:at,parentNode:Ue,style:Ye,data:Fe}])}const Ie=new Map(v.associations.map(ue=>[ue.association.modelId,ue])),Me=new Set(v.noteConnections.map(ue=>$(ue.noteRef,ue.targetRef)));for(const ue of[...V.value])!Ie.has(ue.id)&&!Me.has(ue.id)&&S([ue.id]);for(const[ue,Ve]of Ie){const ze={id:ue,type:"association",source:Ve.association.end1.entityRef,target:Ve.association.end2.entityRef,sourceHandle:Ve.sourceColumnRef?`r:${Ve.sourceColumnRef}`:void 0,targetHandle:Ve.targetColumnRef?`l:${Ve.targetColumnRef}`:void 0,data:{association:Ve.association,sourceColumnRef:Ve.sourceColumnRef,targetColumnRef:Ve.targetColumnRef}},Ue=x(ue);if(Ue){const Fe=Ue.data;(Fe.association!==ze.data.association||Fe.sourceColumnRef!==ze.data.sourceColumnRef||Fe.targetColumnRef!==ze.data.targetColumnRef)&&(Ue.data=ze.data),Ue.sourceHandle!==ze.sourceHandle&&(Ue.sourceHandle=ze.sourceHandle),Ue.targetHandle!==ze.targetHandle&&(Ue.targetHandle=ze.targetHandle)}else E([ze])}for(const ue of v.noteConnections){const Ve=$(ue.noteRef,ue.targetRef),ze={noteRef:ue.noteRef,targetRef:ue.targetRef};x(Ve)||E([{id:Ve,type:"note-connection",source:ue.noteRef,target:ue.targetRef,data:ze}])}}const Q=new Set;let Y=!1,ke=!1;const be=new Map;function xe(v){const D=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(v)}"]`);if(!D)return null;let ee=`${D.offsetHeight}`;for(const Z of D.querySelectorAll(".em-entity__row"))ee+=`|${Z.dataset.attr}:${Z.offsetTop}`;return ee}function ve(){ke=!1;const v=Y;Y=!1;const D=[...Q];if(Q.clear(),v){pe();for(const Z of T.value){const Ie=xe(Z.id);Ie!==null&&be.set(Z.id,Ie)}return}const ee=[];for(const Z of D){const Ie=xe(Z);if(Ie===null){be.delete(Z);continue}be.get(Z)!==Ie&&(be.set(Z,Ie),ee.push(Z))}ee.length&&pe(ee)}function U(v){if(v)for(const D of v)Q.add(D);else Y=!0;ke||(ke=!0,t.nextTick(()=>requestAnimationFrame(ve)))}t.provide(xf,{mark:v=>U([v])});function H(){const v=re.value.map(ee=>ee.id);if(v.length)return v;const D=i.selection.value;return D&&(D.kind==="entity"||D.kind==="note"||D.kind==="group")?[D.id]:[]}function q(){return re.value.filter(v=>v.type==="entity").map(v=>v.id)}function Ce(){return re.value.filter(v=>v.type==="group").map(v=>v.id)}function De(v){var D;return[...((D=i.state.logical.groups.find(ee=>ee.modelId===v))==null?void 0:D.memberEntityRefs)??[]]}function W(){const v=Ce().flatMap(De);return[...new Set([...q(),...v])]}function ne(){return Ce().length>0||q().length>1}function G(){ne()?i.copy(W()):i.copy()}async function P(v){if(!v.length)return;await t.nextTick();const D=re.value;D.length&&A.removeSelectedNodes(D);const ee=v.map(Z=>R(Z)).filter(Z=>!!Z);ee.length&&A.addSelectedNodes(ee)}function ae(v){if(ne()&&q().includes(v)){const D=W();return{caption:i.t("em.ctx.copyN",{n:D.length}),icon:"copy",handler:()=>i.copy(D)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:v},i.copy()}}}function Re(v){var Ie;const D=v.target;if(D&&(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable))return;if(v.key==="?"){a.openModal({component:ah,bind:{locale:i.uiLocale.value}}),v.preventDefault();return}if((v.metaKey||v.ctrlKey)&&v.key.toLowerCase()==="k"){r.value=!0,v.preventDefault();return}if(!i.editable.value){(v.metaKey||v.ctrlKey)&&v.key.toLowerCase()==="c"&&(G(),v.preventDefault());return}if(v.key==="Delete"||v.key==="Backspace"){i.deleteSelection()&&v.preventDefault();return}if(v.key==="ArrowUp"||v.key==="ArrowDown"||v.key==="ArrowLeft"||v.key==="ArrowRight"){if(((Ie=i.selection.value)==null?void 0:Ie.kind)==="attribute"){if(v.key==="ArrowUp"||v.key==="ArrowDown"){const ze=v.key==="ArrowDown"?1:-1;(v.altKey?i.nudgeSelectedAttributes(ze):i.moveAttributeFocus(ze))&&v.preventDefault()}return}const Me=v.shiftKey?10:1,ue=v.key==="ArrowLeft"?-Me:v.key==="ArrowRight"?Me:0,Ve=v.key==="ArrowUp"?-Me:v.key==="ArrowDown"?Me:0;i.nudgeNodes(H(),ue,Ve)&&v.preventDefault();return}if(!(v.metaKey||v.ctrlKey))return;const Z=v.key.toLowerCase();Z==="c"?(G(),v.preventDefault()):Z==="v"?(P(i.paste()),v.preventDefault()):Z==="z"&&(v.shiftKey?i.redo():i.undo(),v.preventDefault())}t.onMounted(async()=>{F(),await t.nextTick(),B(),U(),window.addEventListener("keydown",Re),window.addEventListener("pointerup",le),window.addEventListener("pointermove",p,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",Re),window.removeEventListener("pointerup",le),window.removeEventListener("pointermove",p)});function le(){y.value=null}function j(){m.value=!0,f.value=null}function Ze(){var Z;m.value=!1;const v=(Z=document.elementFromPoint(h.x,h.y))==null?void 0:Z.closest(".vue-flow__node"),D=v==null?void 0:v.dataset.id;if(!D){f.value=null;return}const ee=v.classList.contains("vue-flow__node-group")?"group":v.classList.contains("vue-flow__node-note")?"note":"entity";f.value={kind:ee,id:D}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],F),t.watch(()=>i.resolved.value,v=>{const D=f.value;if(!D)return;(D.kind==="entity"?v.entities.some(Z=>Z.entity.modelId===D.id):D.kind==="group"?v.groups.some(Z=>Z.group.modelId===D.id):v.notes.some(Z=>Z.note.modelId===D.id))||(f.value=null)});function rt(v){const D=v.computedPosition??v.position,ee=v.dimensions??{width:0,height:0};return{x:D.x+ee.width/2,y:D.y+ee.height/2}}function He(v){const D=v.node;if(D){if(f.value=null,D.type==="group"){const ee=i.resolved.value.groups.find(Z=>Z.group.modelId===D.id);b.value=ee?{groupId:D.id,dx:D.position.x-ee.geo.location.x,dy:D.position.y-ee.geo.location.y}:null,y.value=null;return}if(D.type!=="entity"&&D.type!=="note"){y.value=null;return}y.value=ie(rt(D))}}function Pe(v){var Z;y.value=null,b.value=null;const D=(Z=v.nodes)!=null&&Z.length?v.nodes:[v.node],ee=D.filter(Ie=>(Ie==null?void 0:Ie.type)==="group");if(ee.length){for(const Ie of ee){if(!Ie)continue;const Me=i.resolved.value.entities.filter(ue=>ue.groupRef===Ie.id).map(ue=>{const Ve=R(ue.entity.modelId),ze=(Ve==null?void 0:Ve.computedPosition)??(Ve==null?void 0:Ve.position)??{x:0,y:0};return{id:ue.entity.modelId,location:{x:ze.x,y:ze.y}}});i.dragGroup(Ie.id,{x:Ie.position.x,y:Ie.position.y},Me)}return}for(const Ie of D){if(!Ie||Ie.type==="group")continue;const Me=Ie.computedPosition??Ie.position,ue=Ie.dimensions??{width:0,height:0},Ve={x:Me.x+ue.width/2,y:Me.y+ue.height/2};Ie.type==="note"?i.dropNote(Ie.id,{x:Me.x,y:Me.y},ie(Ve)):i.dropEntity(Ie.id,{x:Me.x,y:Me.y},ie(Ve))}}function Oe(v){var ze,Ue,Fe,Ye,pt;if(!i.editable.value||!v.source||!v.target)return;const D=((ze=R(v.source))==null?void 0:ze.type)==="note",ee=((Ue=R(v.target))==null?void 0:Ue.type)==="note";if(D||ee){if(D&&ee)return;const at=D?v.source:v.target,Ge=D?v.target:v.source;((Fe=R(Ge))==null?void 0:Fe.type)==="entity"&&i.addNoteConnection(at,Ge);return}const Z=at=>{var Ge;return(Ge=i.state.logical.entities.find(so=>so.modelId===at))==null?void 0:Ge.stereotype},Ie=Z(v.source)==="JPA_EMBEDDABLE",Me=Z(v.target)==="JPA_EMBEDDABLE";if(Ie||Me){if(Ie&&Me)return;const at=Ie?v.source:v.target,Ge=Ie?v.target:v.source;i.addEmbedAssociation(Ge,at);return}const ue=(Ye=v.sourceHandle)!=null&&Ye.startsWith("r:")?v.sourceHandle.slice(2):void 0,Ve=(pt=v.targetHandle)!=null&&pt.startsWith("l:")?v.targetHandle.slice(2):void 0;i.addAssociation(v.source,v.target,ue,Ve)}const X=t.ref(null);function Nt(v,D){var Z;const ee=i.state.layout.entityLayouts.find(Ie=>Ie.entityRef===v);return _t((Z=ee==null?void 0:ee.attributeStyles)==null?void 0:Z[D])}function Et(v,D){var Z;const ee=i.state.layout.entityLayouts.find(Ie=>Ie.entityRef===v);return _t((Z=ee==null?void 0:ee.operationStyles)==null?void 0:Z[D])}function yn(v){var D;return _t((D=i.state.layout.groupLayouts.find(ee=>ee.groupRef===v))==null?void 0:D.style)}function gn(v){var D;return _t((D=i.state.layout.notes.find(ee=>ee.modelId===v))==null?void 0:D.style)}function Ee(v){var Ie,Me;if(v.preventDefault(),!i.editable.value)return;const D=()=>J({x:v.clientX,y:v.clientY}),ee=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const ue=D();i.addEntity("NewEntity",{x:ue.x,y:ue.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const ue=D();i.addNote("메모",{x:ue.x,y:ue.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const ue=D();i.addEmptyGroup({x:ue.x,y:ue.y})}}],Z=(Ie=i.clipboard.value)==null?void 0:Ie.kind;(Z==="entity"||Z==="entities")&&ee.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>P(i.paste())}),i.resolved.value.entities.length>0&&ee.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(Me=X.value)==null||Me.open(v,ee)}function nt({event:v,node:D}){var ze,Ue,Fe,Ye,pt,at,Ge,so,_n,uh,mh,fh,ph,hh,yh,gh,bh,_h,kh;const ee=v;if(ee.preventDefault(),!i.editable.value){if(D.type==="group"||D.type==="note")return;const qe=(Ue=(ze=ee.target)==null?void 0:ze.closest("[data-attr]"))==null?void 0:Ue.dataset.attr;if(qe){const lt=i.selection.value;(lt==null?void 0:lt.kind)==="attribute"&<.entityId===D.id&<.ids.includes(qe)||i.selectAttribute(D.id,qe);const kn=((Fe=i.selection.value)==null?void 0:Fe.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[qe];(Ye=X.value)==null||Ye.open(ee,[{caption:kn.length>1?i.t("em.ctx.copyN",{n:kn.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(pt=X.value)==null||pt.open(ee,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Ya(a,i,D.id)},ae(D.id)]);return}if(D.type==="group"){const qe=i.isGroupLocked(D.id),lt=[];qe||lt.push({type:"swatches",caption:i.t("em.common.color"),current:yn(D.id),onPick:kn=>i.setGroupSwatch(D.id,kn)},{type:"separator"});const ht=ne()&&Ce().includes(D.id)?W():De(D.id);ht.length&<.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(ht)}),lt.push({caption:qe?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:qe?"unlock":"lock",handler:()=>i.setGroupLocked(D.id,!qe)}),qe||lt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(D.id)}),(at=X.value)==null||at.open(ee,lt);return}if(D.type==="note"){(Ge=X.value)==null||Ge.open(ee,[{type:"swatches",caption:i.t("em.common.color"),current:gn(D.id),onPick:qe=>i.setNoteSwatch(D.id,qe)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(D.id)}]);return}const Z=(_n=(so=ee.target)==null?void 0:so.closest("[data-attr]"))==null?void 0:_n.dataset.attr;if(Z){const qe=i.selection.value;(qe==null?void 0:qe.kind)==="attribute"&&qe.entityId===D.id&&qe.ids.includes(Z)||i.selectAttribute(D.id,Z);const ht=((uh=i.selection.value)==null?void 0:uh.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[Z];if(i.isEntityLocked(D.id)){(mh=X.value)==null||mh.open(ee,[{caption:ht.length>1?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const kn=ht.length>1,Is=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(D.id)},{type:"swatches",caption:kn?i.t("em.ctx.colorN",{n:ht.length}):i.t("em.common.color"),current:kn?null:Nt(D.id,Z),onPick:QB=>i.setAttributeSwatches(D.id,ht,QB)},{type:"separator"},{caption:kn?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Vi=i.clipboard.value;(Vi==null?void 0:Vi.kind)==="attribute"&&Is.push({caption:Vi.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Vi.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Is.push({type:"separator"},{caption:kn?i.t("em.ctx.deleteAttrN",{n:ht.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(D.id,ht)}),(fh=X.value)==null||fh.open(ee,Is);return}const Ie=(hh=(ph=ee.target)==null?void 0:ph.closest("[data-op]"))==null?void 0:hh.dataset.op;if(Ie){if(i.isEntityLocked(D.id))return;(yh=X.value)==null||yh.open(ee,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(D.id)},{type:"swatches",caption:i.t("em.common.color"),current:Et(D.id,Ie),onPick:qe=>i.setOperationSwatch(D.id,Ie,qe)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(D.id,Ie)}]);return}const Me=i.resolved.value.entities.find(qe=>qe.entity.modelId===D.id),ue=!!(Me!=null&&Me.locked),Ve=[{caption:ue?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Ya(a,i,D.id)}];if(!ue){Ve.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(D.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(D.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const lt=re.value.filter(ht=>ht.type==="entity").map(ht=>ht.id);i.createGroup(lt.includes(D.id)&<.length?lt:[D.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(D.id,D.id)});const qe=i.embeddableCatalog.value;if(qe.length){Ve.push({type:"separator"});for(const lt of qe){const ht=((gh=lt.label)==null?void 0:gh[i.userLanguage.value])??((bh=lt.label)==null?void 0:bh.ko)??((_h=lt.label)==null?void 0:_h.en)??lt.type;Ve.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:ht}),icon:"link",handler:()=>i.addPredefinedEmbed(D.id,lt.type)})}}}if(Ve.push({type:"separator"}),Ve.push({caption:Me!=null&&Me.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Me!=null&&Me.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(D.id,!(Me!=null&&Me.collapsed))}),Me!=null&&Me.groupRef&&!ue&&Ve.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(D.id)}),Ve.push({caption:ue?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:ue?"unlock":"lock",handler:()=>i.setEntityLocked(D.id,!ue)}),Ve.push(ae(D.id)),!ue){const qe=i.clipboard.value;(qe==null?void 0:qe.kind)==="attribute"&&Ve.push({caption:qe.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:qe.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Ve.push({type:"separator"}),Ve.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(D.id)})}(kh=X.value)==null||kh.open(ee,Ve)}function mt({event:v,edge:D}){var Me,ue;const ee=v;if(ee.preventDefault(),!i.editable.value)return;const Z=C(D.id);if(Z){(Me=X.value)==null||Me.open(ee,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(Z.noteRef,Z.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(Z.noteRef,Z.targetRef)}]);return}const Ie=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(D.id)}];i.isAssociationLocked(D.id)||Ie.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(D.id)}),(ue=X.value)==null||ue.open(ee,Ie)}function Ft(v){return v==="group"?"group":v==="note"?"note":"entity"}function Qt({node:v}){if(re.value.length>1){i.selection.value=null;return}i.selection.value={kind:Ft(v.type),id:v.id}}function en({nodes:v}){v.length>1&&(i.selection.value=null)}function we({edge:v}){const D=C(v.id);i.selection.value=D?{kind:"note",id:D.noteRef}:{kind:"association",id:v.id}}function et(v){const D=i.selection.value;return!!D&&D.kind!=="attribute"&&D.id===v.id}function ft(v){var D,ee;return et(v)?v.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":v.type==="note"?"var(--em-note-soft)":v.type==="group"?lf(_t((D=v.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":lf(_t((ee=v.data)==null?void 0:ee.style))??"var(--em-mm-entity)"}function bn(v){return et(v)?"var(--em-selection)":v.type==="note"?"var(--em-note-accent)":v.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ot(v,D){z(v,D,{zoom:K().zoom,duration:350})}t.watch(()=>i.focusRequest.value,v=>{if(!v)return;const D=R(v.id);if(!D)return;const ee=D.computedPosition??D.position,Z=D.dimensions??{width:0,height:0};ot(ee.x+Z.width/2,ee.y+Z.height/2)});function Fo({position:v}){ot(v.x,v.y)}function Uo({node:v}){i.selection.value={kind:Ft(v.type),id:v.id};const D=v.computedPosition??v.position,ee=v.dimensions??{width:0,height:0};ot(D.x+ee.width/2,D.y+ee.height/2)}function oe({node:v}){B({nodes:[v.id],duration:350,maxZoom:1.2,padding:.6})}return(v,D)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(rw),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ce.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(cn).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:j,onMoveEnd:Ze,onConnect:Oe,onConnectStart:D[1]||(D[1]=ee=>u.value=!0),onConnectEnd:D[2]||(D[2]=ee=>u.value=!1),onNodeDrag:He,onNodeDragStop:Pe,onNodeClick:Qt,onEdgeClick:we,onSelectionChange:en,onPaneClick:D[3]||(D[3]=ee=>t.unref(i).selection.value=null),onPaneContextMenu:Ee,onNodeContextMenu:nt,onEdgeContextMenu:mt},{"node-group":t.withCtx(ee=>[t.createVNode(Lf,t.normalizeProps(t.guardReactiveProps(ee)),null,16)]),"node-entity":t.withCtx(ee=>[t.createVNode(Df,t.normalizeProps(t.guardReactiveProps(ee)),null,16)]),"node-note":t.withCtx(ee=>[t.createVNode(Of,t.normalizeProps(t.guardReactiveProps(ee)),null,16)]),"edge-association":t.withCtx(ee=>[t.createVNode(ap,t.normalizeProps(t.guardReactiveProps(ee)),null,16)]),"edge-note-connection":t.withCtx(ee=>[t.createVNode(W$,t.normalizeProps(t.guardReactiveProps(ee)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(Lx),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(cS),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(io),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:me},{default:t.withCtx(()=>[t.createVNode($e,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(io),{title:t.unref(i).t("em.ctx.addNote"),onClick:ye},{default:t.withCtx(()=>[t.createVNode($e,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(io),{title:t.unref(i).t("em.palette.autoLayout"),onClick:D[0]||(D[0]=ee=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode($e,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(K$),{key:1,pannable:"",width:224,height:160,"node-color":ft,"node-stroke-color":bn,"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:Fo,onNodeClick:Uo,onNodeDblclick:oe})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),_e.value?(t.openBlock(),t.createElementBlock("div",PT,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",zT,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,FT),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,UT),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,HT)],64)):(t.openBlock(),t.createElementBlock("p",jT,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(LT,{key:1,controller:t.unref(i),onClose:D[4]||(D[4]=ee=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",KT,[t.createVNode($e,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",GT,[t.createElementVNode("strong",YT,t.toDisplayString(d.value.title),1),t.createElementVNode("span",qT,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(rT,{ref_key:"menuRef",ref:X,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",WT,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),JT={class:"em-explorer em-scroll-overlay"},XT={class:"em-explorer__search"},ZT=["placeholder","aria-label"],QT=["aria-label","title"],eM={key:0,class:"em-explorer__empty"},tM=["aria-label"],nM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],oM=["onClick"],iM=["title"],aM={class:"em-key-slot"},rM={class:"em-key-slot"},lM={class:"em-explorer__label"},sM={key:2,class:"em-explorer__sr"},lh=Ke(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=te.useModal(),r=t.computed(()=>{var _e,Se;const M=i.resolved.value,E=i.displayMode.value,w=i.userLanguage.value,S=me=>{var ye,ie,se;return Oi(E,me.name,(ie=(ye=me.table)==null?void 0:ye.logicalName)==null?void 0:ie[w],(se=me.table)==null?void 0:se.physicalName,i.t("em.node.logicalMissing"))},B=E==="PHYSICAL"||E==="LOGICAL_PHYSICAL",z=me=>{const ye=me.attrType.startsWith("RELATION")&&me.dbAttrs.length>0;return{icon:me.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:me.identifier,fk:ye&&B}}},K=me=>me.attrType.startsWith("EMBED")&&me.dbAttrs.length>0,J=E==="PHYSICAL"||E==="LOGICAL_PHYSICAL",re=me=>{if(me.attrType!=="EMBED_PREDEF")return me.dbAttrs;const ye=i.embeddableCatalog.value.find(ie=>ie.type===me.type);return ye?me.dbAttrs.map((ie,se)=>{const fe=ye.fields[se];return fe?{...ie,physicalName:ie.physicalName||fe.physicalName,logicalName:ie.logicalName??fe.logicalName,dataType:ie.dataType||fe.dataType,length:ie.length??fe.length}:ie}):me.dbAttrs},pe=(me,ye)=>{var O,L,F,Q,Y,ke,be,xe,ve;const ie={entityId:ye,attrId:me.modelId};if(K(me)){const U=Rr(E,me);return{key:`attr:${me.modelId}`,label:me.name+(U?` : ${U}`:""),icon:"table",attrRef:ie,focusId:ye,matchText:zo(me.name,(L=(O=me.dbAttrs[0])==null?void 0:O.logicalName)==null?void 0:L[w],(F=me.dbAttrs[0])==null?void 0:F.physicalName),children:J?re(me).map(H=>{var q,Ce;return{key:`attr:${me.modelId}:col:${H.modelId}`,label:Oi(E,H.physicalName,(q=H.logicalName)==null?void 0:q[w],H.physicalName,i.t("em.node.logicalMissing"))+(H.dataType?` : ${H.dataType}`:""),icon:"field",attrRef:ie,focusId:ye,matchText:zo(H.physicalName,(Ce=H.logicalName)==null?void 0:Ce[w]),children:[]}}):[]}}const se=Sr(me,i.state.logical.associations),fe=Rr(E,me,se);return{key:`attr:${me.modelId}`,label:Oi(E,me.name,(Y=(Q=me.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:Y[w],(ke=me.dbAttrs[0])==null?void 0:ke.physicalName,i.t("em.node.logicalMissing"))+(fe?` : ${fe}`:""),...z(me),attrRef:ie,focusId:ye,matchText:zo(me.name,(xe=(be=me.dbAttrs[0])==null?void 0:be.logicalName)==null?void 0:xe[w],(ve=me.dbAttrs[0])==null?void 0:ve.physicalName),children:[]}},ce=me=>{var se,fe,O;const ye=me.entity,ie=[...ye.attributes].sort((L,F)=>L.order-F.order);return{key:`entity:${ye.modelId}`,label:S(ye),icon:"table",selectKind:"entity",selectId:ye.modelId,focusId:ye.modelId,matchText:zo(ye.name,(fe=(se=ye.table)==null?void 0:se.logicalName)==null?void 0:fe[w],(O=ye.table)==null?void 0:O.physicalName),children:ie.map(L=>pe(L,ye.modelId))}},Ne=new Map,he=[];for(const me of M.entities)if(me.groupRef){const ye=Ne.get(me.groupRef)??[];ye.push(me),Ne.set(me.groupRef,ye)}else he.push(me);const de=[];for(const me of M.groups){const ye=me.group;de.push({key:`group:${ye.modelId}`,label:((_e=ye.name)==null?void 0:_e[w])||((Se=ye.name)==null?void 0:Se.ko)||ye.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:ye.modelId,children:(Ne.get(ye.modelId)??[]).map(ce)})}for(const me of he)de.push(ce(me));if(M.associations.length){const me=new Map(M.entities.map(ye=>[ye.entity.modelId,S(ye.entity)]));de.push({key:"section:associations",label:i.t("em.explorer.associations",{n:M.associations.length}),icon:"arrow-lr",children:M.associations.map(ye=>{const ie=ye.association,se=me.get(ie.end1.entityRef)??ie.end1.entityRef,fe=me.get(ie.end2.entityRef)??ie.end2.entityRef;return{key:`assoc:${ie.modelId}`,label:`${se} — ${fe}`,icon:"arrow-lr",selectKind:"association",selectId:ie.modelId,children:[]}})})}return M.notes.length&&de.push({key:"section:notes",label:i.t("em.explorer.notes",{n:M.notes.length}),icon:"note",children:M.notes.map(({note:me})=>{var ye;return{key:`note:${me.modelId}`,label:((ye=me.memo.split(`
|
|
66
|
-
`)[0])==null?void 0:ye.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:me.modelId,focusId:me.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:de}});function l(M){return M?M.pk&&M.fk?i.t("em.node.keyPfk"):M.pk?i.t("em.node.keyPk"):M.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const M=[],E=w=>{if(w.children.length){w.key!=="root"&&M.push(w.key);for(const S of w.children)E(S)}};return E(r.value),M}),c=M=>M.startsWith("entity:")||M==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:h}=eh({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),p=t.ref(""),y=t.ref(null),b=t.computed(()=>p.value.trim().length>0),f=t.computed(()=>{const M=[];if(b.value){const w=NT(r.value,p.value.trim().toLowerCase()),S=(B,z,K,J,re)=>{if(!w.has(B.key))return;M.push({node:B,depth:z,parentKey:K,posinset:J,setsize:re});const pe=B.children.filter(ce=>w.has(ce.key));pe.forEach((ce,Ne)=>S(ce,z+1,B.key,Ne+1,pe.length))};return S(r.value,0,null,1,1),M}const E=(w,S,B,z,K)=>{M.push({node:w,depth:S,parentKey:B,posinset:z,setsize:K}),d(w.key)||w.children.forEach((J,re)=>E(J,S+1,w.key,re+1,w.children.length))};return E(r.value,0,null,1,1),M}),g=t.ref(null),k=t.ref(null),_=t.computed(()=>{var E;const M=f.value;return k.value&&M.some(w=>w.node.key===k.value)?k.value:((E=M[0])==null?void 0:E.node.key)??null}),N=M=>!b.value&&d(M);async function I(M){var E,w;M&&(k.value=M,await t.nextTick(),(w=(E=g.value)==null?void 0:E.querySelector(`[data-key="${M}"]`))==null||w.focus())}function $(M,E){var B,z,K,J,re;const w=f.value,S=w.findIndex(pe=>pe.node.key===E.node.key);switch(M.key){case"ArrowDown":M.preventDefault(),I((B=w[S+1])==null?void 0:B.node.key);return;case"ArrowUp":M.preventDefault(),I((z=w[S-1])==null?void 0:z.node.key);return;case"Home":M.preventDefault(),I((K=w[0])==null?void 0:K.node.key);return;case"End":M.preventDefault(),I((J=w[w.length-1])==null?void 0:J.node.key);return;case"ArrowRight":if(M.preventDefault(),!E.node.children.length)return;N(E.node.key)?u(E.node.key):I((re=w[S+1])==null?void 0:re.node.key);return;case"ArrowLeft":M.preventDefault(),E.node.children.length&&!N(E.node.key)?u(E.node.key):I(E.parentKey);return;case"Enter":case" ":M.preventDefault(),R(E.node,M);return;case"F2":M.preventDefault(),x(E.node)}}const C=t.computed(()=>b.value&&f.value.length<=1);function A(M){var S;if(M.key!=="/"||M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;const E=M.target,w=E==null?void 0:E.tagName;w==="INPUT"||w==="TEXTAREA"||w==="SELECT"||E!=null&&E.isContentEditable||(M.preventDefault(),(S=y.value)==null||S.focus())}t.onMounted(()=>window.addEventListener("keydown",A)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",A)),n({toggleAll:m,allExpanded:h,hasExpandable:t.computed(()=>s.value.length>0)});function T(M){const E=i.selection.value;return M.attrRef?(E==null?void 0:E.kind)==="attribute"&&E.entityId===M.attrRef.entityId&&E.ids.includes(M.attrRef.attrId):!!E&&E.kind!=="attribute"&&!!M.selectId&&M.selectKind===E.kind&&M.selectId===E.id}function V(M){const E=i.selection.value;return M.selectKind==="entity"&&(E==null?void 0:E.kind)==="attribute"&&E.entityId===M.selectId}function R(M,E){if(M.attrRef){const w=E.shiftKey?"range":E.metaKey||E.ctrlKey?"toggle":"replace";i.selectAttribute(M.attrRef.entityId,M.attrRef.attrId,w)}else M.selectKind&&M.selectId&&(i.selection.value={kind:M.selectKind,id:M.selectId});M.focusId&&i.requestFocus(M.focusId)}function x(M){M.selectKind==="entity"&&M.selectId&&Ya(a,i,M.selectId)}return(M,E)=>(t.openBlock(),t.createElementBlock("section",JT,[t.createElementVNode("div",XT,[t.createVNode($e,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":E[0]||(E[0]=w=>p.value=w),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:E[1]||(E[1]=t.withKeys(w=>p.value="",["esc"]))},null,40,ZT),[[t.vModelText,p.value]]),p.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:E[2]||(E[2]=w=>p.value="")},[t.createVNode($e,{name:"x",size:13})],8,QT)):t.createCommentVNode("",!0)]),C.value?(t.openBlock(),t.createElementBlock("p",eM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:g,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,w=>(t.openBlock(),t.createElementBlock("div",{key:w.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":T(w.node),"is-focus-parent":V(w.node),"is-selectable":!!w.node.selectKind||!!w.node.attrRef||!!w.node.focusId}]),"data-key":w.node.key,role:"treeitem","aria-level":w.depth+1,"aria-posinset":w.posinset,"aria-setsize":w.setsize,"aria-expanded":w.node.children.length?!N(w.node.key):void 0,"aria-selected":T(w.node),tabindex:w.node.key===_.value?0:-1,style:t.normalizeStyle({paddingLeft:4+w.depth*14+"px"}),onClick:S=>R(w.node,S),onDblclick:S=>x(w.node),onFocus:S=>k.value=w.node.key,onKeydown:S=>$(S,w)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!w.node.children.length,"is-open":!N(w.node.key)}]),onClick:t.withModifiers(S=>w.node.children.length&&t.unref(u)(w.node.key),["stop"])},[w.node.children.length?(t.openBlock(),t.createBlock($e,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,oM),w.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(w.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",aM,[w.node.keyMarks.pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:14,class:"em-key is-pk"})):w.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock($e,{key:1,class:"em-explorer__icon",name:w.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",rM,[w.node.keyMarks.fk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,iM)):(t.openBlock(),t.createBlock($e,{key:1,class:"em-explorer__icon",name:w.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",lM,t.toDisplayString(w.node.label),1),l(w.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",sM,t.toDisplayString(l(w.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,nM))),128))],8,tM)]))}}),[["__scopeId","data-v-e5303c65"]]),cM={class:"em-text-export"},dM=["id","aria-selected","tabindex","onClick"],uM=["aria-labelledby"],mM={class:"em-text-export__actions"},fM=Ke(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(m,h)=>Lt(n.locale??"ko",m,h),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var h,p;a.value=m,await t.nextTick(),(p=(h=l.value)==null?void 0:h.querySelectorAll('[role="tab"]')[m])==null||p.focus()}function c(m){const h=n.formats.length;h&&s((a.value+m+h)%h)}async function d(){try{await navigator.clipboard.writeText(r().content),te.showNotification(i("em.export.copied"),"info")}catch{te.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),h=new Blob([m.content],{type:"text/plain;charset=utf-8"}),p=URL.createObjectURL(h);try{const y=document.createElement("a");y.href=p,y.download=m.filename,document.body.appendChild(y),y.click(),y.remove()}finally{URL.revokeObjectURL(p)}}return(m,h)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",cM,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(p,y)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${y}`,key:p.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":y===a.value}]),"aria-selected":y===a.value,"aria-controls":"em-text-export-panel",tabindex:y===a.value?0:-1,onClick:b=>a.value=y,onKeydown:[h[0]||(h[0]=t.withKeys(t.withModifiers(b=>c(-1),["prevent"]),["left"])),h[1]||(h[1]=t.withKeys(t.withModifiers(b=>c(1),["prevent"]),["right"])),h[2]||(h[2]=t.withKeys(t.withModifiers(b=>s(0),["prevent"]),["home"])),h[3]||(h[3]=t.withKeys(t.withModifiers(b=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(p.label),43,dM))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,uM),t.createElementVNode("div",mM,[t.createVNode(t.unref(te.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:h[4]||(h[4]=p=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),pM={class:"em-text-import"},hM=["aria-label"],yM=["aria-checked","tabindex","onClick"],gM=["placeholder"],bM={class:"em-text-import__status"},_M={class:"em-text-import__ok"},kM={key:0,class:"em-text-import__warn"},EM={key:1,class:"em-text-import__err"},NM={key:2,class:"em-text-import__err"},wM={key:3,class:"em-text-import__err"},IM={class:"em-text-import__actions"},vM=Ke(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(b,f)=>Lt(n.locale??"ko",b,f),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(b){var g,k;const f=l[(b+l.length)%l.length];f&&(r.value=f.key,await t.nextTick(),(k=(g=s.value)==null?void 0:g.querySelectorAll('[role="radio"]')[l.indexOf(f)])==null||k.focus())}function d(b){c(l.findIndex(f=>f.key===r.value)+b)}function u(b){return b?b.startsWith("{")?"json":/\berdiagram\b/i.test(b)?"mermaid":/\bcreate\s+table\b/i.test(b)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),h=t.computed(()=>{const b=a.value.trim();if(!b)return{status:"empty"};const f=m.value;if(!f)return{status:"unknown"};try{let g,k=[];return f==="json"?g=ac(b):f==="mermaid"?g=Js(b):(g=ec(b),k=Ar(b).warnings),g.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:g,warnings:k}}catch(g){return{status:"error",message:g instanceof Error?g.message:String(g)}}}),p=t.computed(()=>h.value.status==="ok");function y(){const b=h.value;b.status!=="ok"||!b.source||(n.onImport(b.source),o.close())}return(b,f)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",pM,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,g=>t.createElementVNode("button",{key:g.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":g.key===r.value}]),"aria-checked":g.key===r.value,tabindex:g.key===r.value?0:-1,onClick:k=>r.value=g.key,onKeydown:[f[0]||(f[0]=t.withKeys(t.withModifiers(k=>d(-1),["prevent"]),["left"])),f[1]||(f[1]=t.withKeys(t.withModifiers(k=>d(1),["prevent"]),["right"])),f[2]||(f[2]=t.withKeys(t.withModifiers(k=>c(0),["prevent"]),["home"])),f[3]||(f[3]=t.withKeys(t.withModifiers(k=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(g.labelKey)),43,yM)),64))],8,hM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":f[4]||(f[4]=g=>a.value=g),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,gM),[[t.vModelText,a.value]]),t.createElementVNode("div",bM,[h.value.status==="ok"&&h.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",_M,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:h.value.source.logical.entities.length,relations:h.value.source.logical.associations.length})),1),h.value.warnings&&h.value.warnings.length?(t.openBlock(),t.createElementBlock("span",kM," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:h.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):h.value.status==="error"?(t.openBlock(),t.createElementBlock("span",EM,t.toDisplayString(i("em.import.error",{message:h.value.message??""})),1)):h.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",NM,t.toDisplayString(i("em.import.unknownFormat")),1)):h.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",wM,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",IM,[t.createVNode(t.unref(te.BSButton),{caption:i("em.import.confirm"),disabled:!p.value,onClick:y},null,8,["caption","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:f[5]||(f[5]=g=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),CM={class:"em-toolbar"},xM={class:"em-toolbar__mode"},sh=Ke(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=te.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:y=>i.displayMode.value=y});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const y=i.resolved.value.entities;return y.length>0&&y.every(b=>b.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=i.state.logical;r.openModal({component:fM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Os(y,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Nr(y,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Nr(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:tc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:ic(y,i.state.layout),filename:"diagram.json"}]}})}function h(){r.openModal({component:vM,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(b=>b.modelId))}}})}function p(){r.openModal({component:ah,bind:{locale:i.uiLocale.value}})}return(y,b)=>(t.openBlock(),t.createElementBlock("div",CM,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:b[0]||(b[0]=f=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode($e,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:b[1]||(b[1]=f=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode($e,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),b[9]||(b[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",xM,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":b[2]||(b[2]=f=>s.value=f),items:l,"value-provider":f=>f.v,"label-provider":f=>t.unref(i).t(f.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode($e,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:b[3]||(b[3]=f=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode($e,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:b[4]||(b[4]=f=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode($e,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode($e,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),b[10]||(b[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:h},{left:t.withCtx(()=>[t.createVNode($e,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode($e,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:b[5]||(b[5]=f=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode($e,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:b[6]||(b[6]=f=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode($e,{name:"camera",size:16})]),_:1},8,["tooltip"]),b[11]||(b[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:b[7]||(b[7]=f=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode($e,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),b[8]||(b[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:p},{left:t.withCtx(()=>[t.createVNode($e,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-6a4ae0c1"]]),SM=["title"],RM=["title"],AM=["disabled","aria-pressed"],$M=["disabled","aria-pressed"],TM=Ke(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>Lt(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode($e,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,SM)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode($e,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,AM),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode($e,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,$M)],10,RM))}}),[["__scopeId","data-v-2b5162b7"]]),MM=["disabled"],VM={class:"em-panel__sub"},BM={class:"em-nav"},DM={key:0,class:"em-nav__divider","aria-hidden":"true"},LM={key:1},OM=["onClick","onKeydown"],PM={class:"em-nav__name"},zM=["title"],FM={key:0,class:"em-panel__note"},UM=["data-attr-block"],HM={class:"em-attr__row"},jM=["title"],KM={key:0,class:"em-attr__row"},GM={key:1,class:"em-attr__navhint"},YM={key:0,class:"em-attr__navhint"},qM={class:"em-attr__row"},WM={class:"em-attr__row"},JM=["title"],XM={class:"em-attr__flags"},ZM={class:"em-attr__pii"},QM={class:"em-attr__pii"},e2={key:1,class:"em-attr__pii"},t2={key:2,class:"em-attr__pii em-attr__codetop"},n2={class:"em-multilang"},o2={key:3,class:"em-embed-cols"},i2={class:"em-embed-col__label"},a2={class:"em-attr__row"},r2=["title"],l2=["title"],s2=["title"],c2={class:"em-attr__row"},d2={key:0,class:"em-embed-upd"},u2={key:1,class:"em-attr__navhint"},m2={class:"em-embed-upd"},f2={class:"em-embed-upd"},p2={class:"em-swatch__row em-attr__swatch"},h2=["title","onClick"],y2=["title","onClick"],g2={key:0,class:"em-attr__swatch-hint"},b2=Ke(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:h,setTransient:p,dbLocked:y,fkDerived:b,fkOriginPhysical:f,typeValueOf:g,typeLabelOf:k,setAttrType:_,setAttrCustomType:N,setDb:I,scaleApplicable:$,scaleHint:C,setDbLogical:A,setAttrDescription:T,attrPiiValue:V,setAttrPii:R,predefinedCustomTypeCatalog:x,embeddableCatalog:M,predefinedLabel:E,groupCodeCatalog:w,attrGroupCodes:S,attrCodeItems:B,codeValueOf:z,codeLabelOf:K,setAttrGroupCode:J,setAttrCode:re,setAttrDefaultValue:pe,isEmbedExpanded:ce,setDbAt:Ne,setDbLogicalAt:he,embedColMeta:de,fixedDataType:_e,fixedLength:Se,fixedScale:me,updatableItems:ye,updatableLabel:ie,updatableValue:se,setUpdatableAt:fe,setUpdatable:O,insertableItems:L,insertableLabel:F,insertableValue:Q,setInsertableAt:Y,setInsertable:ke,sharedItems:be,sharedLabel:xe,sharedValue:ve,setSharedAt:U,isShared:H,sharedPhysical:q}=uf(o,()=>n.entityId),Ce=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Pe=>Pe.entityRef===i.value.modelId)??null:null),De=t.computed(()=>{var Pe;return((Pe=i.value)==null?void 0:Pe.attributes.filter(Oe=>Oe.attrType!=="DIVIDER"))??[]}),W=t.computed(()=>{var Pe;return((Pe=i.value)==null?void 0:Pe.attributes)??[]}),ne=t.computed(()=>De.value.filter(Pe=>r.value.has(Pe.modelId)));function G(Pe){return{pk:Pe.identifier,fk:Pe.attrType.startsWith("RELATION")&&Pe.dbAttrs.length>0,required:Pe.notNull&&!Pe.identifier}}function P(Pe){const Oe=G(Pe),X=[Oe.pk&&"PK",Oe.fk&&"FK",Oe.required&&"NOT NULL"].filter(Boolean);return X.length?X.join(" · "):void 0}function ae(Pe,Oe){i.value&&o.selectAttribute(i.value.modelId,Pe.modelId,Oe.shiftKey?"range":Oe.metaKey||Oe.ctrlKey?"toggle":"replace")}function Re(Pe){var Oe,X;return _t((X=(Oe=Ce.value)==null?void 0:Oe.attributeStyles)==null?void 0:X[Pe.modelId])}function le(Pe){return r.value.size>1&&r.value.has(Pe.modelId)}function j(Pe,Oe){if(!i.value)return;const X=le(Pe)?o.selectedAttrIds.value:[Pe.modelId];o.setAttributeSwatches(i.value.modelId,X,Oe)}const Ze=t.ref(void 0);function rt(Pe){if(!Pe||!i.value)return;const Oe=o.addPredefinedEmbed(i.value.modelId,Pe);Oe&&o.selectAttribute(i.value.modelId,Oe),Ze.value=void 0}function He(){if(!i.value)return;const Pe=o.addAttribute(i.value.modelId);Pe&&o.selectAttribute(i.value.modelId,Pe)}return(Pe,Oe)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",VM,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:De.value.length}))+" ",1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:He},null,8,["caption"]),t.unref(M).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":Ze.value,items:t.unref(M),"value-provider":X=>X.type,"label-provider":t.unref(E),"onUpdate:modelValue":rt},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",BM,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(W.value,X=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:X.modelId},[X.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",DM,[...Oe[0]||(Oe[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",LM,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(X.modelId)}]),role:"button",tabindex:"0",onClick:Nt=>ae(X,Nt),onKeydown:[t.withKeys(t.withModifiers(Nt=>ae(X,Nt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Nt=>ae(X,Nt),["prevent"]),["space"])]},[t.createElementVNode("span",PM,t.toDisplayString(X.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:P(X)},[G(X).pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):G(X).required?(t.openBlock(),t.createBlock($e,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),G(X).fk?(t.openBlock(),t.createBlock($e,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,zM)],42,OM)]))],64))),128))]),De.value.length&&!ne.value.length?(t.openBlock(),t.createElementBlock("p",FM,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ne.value,X=>{var Nt,Et,yn,gn,Ee,nt,mt,Ft,Qt,en;return t.openBlock(),t.createElementBlock("div",{key:X.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(X.modelId)}]),"data-attr-block":X.modelId},[t.createElementVNode("div",HM,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-name-${X.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":X.name,"onUpdate:modelValue":we=>t.unref(d)(X,{name:we})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-type-${X.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:X.attrType.startsWith("EMBED")||!!X.groupCode||X.attrType==="RELATION_REF"||t.unref(b)(X),items:t.unref(qs)(X.type,t.unref(x)),"value-provider":t.unref(g),"label-provider":t.unref(k),"model-value":X.type,"onUpdate:modelValue":we=>t.unref(_)(X,we)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(u)(X)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:we=>t.unref(o).removeAttribute(t.unref(i).modelId,X.modelId)},null,8,["onClick"])],8,jM)]),X.type===t.unref(tn)&&!t.unref(b)(X)?(t.openBlock(),t.createElementBlock("div",KM,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-customtype-${X.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":X.customType??"","onUpdate:modelValue":we=>t.unref(N)(X,we)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),X.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",GM,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ce)(X)?(t.openBlock(),t.createElementBlock("div",o2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(X.dbAttrs,(we,et)=>{var ft,bn,ot,Fo,Uo,oe,v,D;return t.openBlock(),t.createElementBlock("div",{key:we.modelId,class:"em-embed-col"},[t.createElementVNode("span",i2,t.toDisplayString(((ft=t.unref(de)(X,et))==null?void 0:ft.name)??((bn=t.unref(de)(X,et))==null?void 0:bn.physicalName)??t.unref(o).t("em.attr.colFallback",{n:et+1})),1),t.createElementVNode("div",a2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`embed-col-${we.modelId}`,width:"100%",disabled:t.unref(H)(we),placeholder:((ot=t.unref(de)(X,et))==null?void 0:ot.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(H)(we)?t.unref(q)(we):we.physicalName,"onUpdate:modelValue":ee=>t.unref(Ne)(X,et,{physicalName:ee})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(te.BSTextInput),{name:`embed-dtype-${we.modelId}`,width:"84px",disabled:"","model-value":t.unref(_e)(X,et)},null,8,["name","model-value"])],8,r2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-len-${we.modelId}`,width:"48px",disabled:"","model-value":t.unref(Se)(X,et)},null,8,["name","model-value"])],8,l2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-scale-${we.modelId}`,width:"48px",disabled:"","model-value":t.unref(me)(X,et)},null,8,["name","model-value"])],8,s2)]),t.createVNode(no,{controller:t.unref(o),"ref-id":we.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",c2,[t.createVNode(dn,{class:"grow",name:`embed-logical-${we.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Uo=(Fo=t.unref(de)(X,et))==null?void 0:Fo.logicalName)==null?void 0:Uo[t.unref(o).userLanguage.value])??((v=(oe=t.unref(de)(X,et))==null?void 0:oe.logicalName)==null?void 0:v.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":we.logicalName,"onUpdate:modelValue":ee=>t.unref(he)(X,et,ee)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(D=t.unref(de)(X,et))!=null&&D.shareable?(t.openBlock(),t.createElementBlock("label",d2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"110px","model-value":t.unref(ve)(we),items:t.unref(be)(),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":ee=>ee&&t.unref(U)(X,et,ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(H)(we)?(t.openBlock(),t.createElementBlock("p",u2,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",m2,[Oe[3]||(Oe[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(H)(we),"model-value":t.unref(H)(we)?"false":t.unref(Q)(we),items:t.unref(L),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":ee=>ee&&t.unref(Y)(X,et,ee)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",f2,[Oe[4]||(Oe[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(H)(we),"model-value":t.unref(H)(we)?"false":t.unref(se)(we),items:t.unref(ye),"value-provider":t.unref(c),"label-provider":t.unref(ie),"onUpdate:modelValue":ee=>ee&&t.unref(fe)(X,et,ee)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.unref(b)(X)?(t.openBlock(),t.createElementBlock("p",YM,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",qM,[t.createVNode(dn,{class:"grow",name:`attr-logical-${X.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Nt=X.dbAttrs[0])==null?void 0:Nt.logicalName,"onUpdate:modelValue":we=>t.unref(A)(X,we)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",WM,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-col-${X.modelId}`,width:"100%",placeholder:t.unref(f)(X)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(y)(X),"model-value":((Et=X.dbAttrs[0])==null?void 0:Et.physicalName)??"","onUpdate:modelValue":we=>t.unref(I)(X,{physicalName:we})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-dtype-${X.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(y)(X)||t.unref(b)(X),items:t.unref(Ks)(((yn=X.dbAttrs[0])==null?void 0:yn.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(vr),"model-value":((gn=X.dbAttrs[0])==null?void 0:gn.dataType)??"","onUpdate:modelValue":we=>we&&t.unref(I)(X,{dataType:we})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSNumberInput),{name:`attr-len-${X.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(y)(X)||t.unref(b)(X),"model-value":(Ee=X.dbAttrs[0])==null?void 0:Ee.length,"onUpdate:modelValue":we=>t.unref(I)(X,{length:we||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(C)(X)},[t.createVNode(t.unref(te.BSNumberInput),{name:`attr-scale-${X.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(y)(X)||t.unref(b)(X)||!t.unref($)(X),"model-value":(nt=X.dbAttrs[0])==null?void 0:nt.scale,"onUpdate:modelValue":we=>t.unref(I)(X,{scale:we||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,JM)]),t.createVNode(no,{controller:t.unref(o),"ref-id":(mt=X.dbAttrs[0])==null?void 0:mt.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",XM,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${X.modelId}`,label:"Primary Key","model-value":X.identifier,disabled:t.unref(a)||t.unref(y)(X)||t.unref(b)(X),"onUpdate:modelValue":we=>t.unref(h)(X,we)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${X.modelId}`,label:"Not Null","model-value":X.notNull,disabled:t.unref(y)(X)||t.unref(b)(X),"onUpdate:modelValue":we=>t.unref(d)(X,{notNull:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-uq-${X.modelId}`,label:"Unique","model-value":!!((Ft=X.dbAttrs[0])!=null&&Ft.unique),disabled:t.unref(y)(X)||t.unref(b)(X),"onUpdate:modelValue":we=>t.unref(I)(X,{unique:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-ai-${X.modelId}`,label:"Auto Increment","model-value":!!((Qt=X.dbAttrs[0])!=null&&Qt.autoIncrement),disabled:t.unref(y)(X)||t.unref(b)(X)||!X.identifier,"onUpdate:modelValue":we=>t.unref(I)(X,{autoIncrement:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-tr-${X.modelId}`,label:"@Transient","model-value":!!X.transient,disabled:X.identifier||t.unref(b)(X),"onUpdate:modelValue":we=>t.unref(p)(X,we)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nid-${X.modelId}`,label:"@NaturalId","model-value":!!X.naturalId,disabled:X.identifier||t.unref(y)(X)||t.unref(b)(X),"onUpdate:modelValue":we=>t.unref(m)(X,we)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${X.modelId}`,label:"mutable","model-value":!!X.naturalIdMutable,disabled:t.unref(y)(X)||!X.naturalId,"onUpdate:modelValue":we=>t.unref(d)(X,{naturalIdMutable:we||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-mv-${X.modelId}`,label:"Multi-Value (Set)","model-value":!!((en=X.dbAttrs[0])!=null&&en.multiValue),disabled:t.unref(y)(X)||t.unref(b)(X),"onUpdate:modelValue":we=>t.unref(I)(X,{multiValue:we||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",ZM,[Oe[1]||(Oe[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(y)(X),"model-value":t.unref(Q)(X.dbAttrs[0]),items:t.unref(L),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":we=>we&&t.unref(ke)(X,we)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",QM,[Oe[2]||(Oe[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(y)(X),"model-value":t.unref(se)(X.dbAttrs[0]),items:t.unref(ye),"value-provider":t.unref(c),"label-provider":t.unref(ie),"onUpdate:modelValue":we=>we&&t.unref(O)(X,we)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(b)(X)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",e2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":t.unref(V)(X),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":we=>we&&t.unref(R)(X,we)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(w).length&&!t.unref(b)(X)?(t.openBlock(),t.createElementBlock("label",t2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(yf,{"model-value":X.groupCode,items:t.unref(w),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":we=>t.unref(J)(X,we)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(b)(X)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(w).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(S)(X).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"100%","model-value":X.defaultValue??"none",items:t.unref(B)(X),"value-provider":t.unref(z),"label-provider":t.unref(K),"onUpdate:modelValue":we=>we&&t.unref(re)(X,we)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`attr-default-${X.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":X.defaultValue??"","onUpdate:modelValue":we=>t.unref(pe)(X,we)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",n2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`attr-desc-${X.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":X.description,"onUpdate:modelValue":we=>t.unref(T)(X,we)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",p2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Re(X)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:we=>j(X,null)},"∅",10,h2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),we=>(t.openBlock(),t.createElementBlock("button",{key:we,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Re(X)===we}]),style:t.normalizeStyle({background:t.unref(To)(we)}),title:t.unref(o).t(t.unref(to)(we)),onClick:et=>j(X,we)},null,14,y2))),128)),le(X)?(t.openBlock(),t.createElementBlock("span",g2,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,UM)}),128))],8,MM)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-2c47fef2"]]),_2=["disabled"],k2={class:"em-panel__sub-label"},E2={class:"em-attr__row"},N2={class:"em-field em-idx-params"},w2=["value","placeholder","onChange"],I2=Ke(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(I=>I.modelId===o.entityId)??null),l=t.computed(()=>r.value?Ho(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var I;return Mn(((I=r.value)==null?void 0:I.attributes)??[])}),c=I=>s.value.canon(I),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>{var I;return[...(((I=r.value)==null?void 0:I.attributes)??[]).filter($=>$.dbAttrs.length>0).map($=>({value:$.modelId,label:_f($,d.value)})),...l.value.map($=>({value:$.modelId,label:a.t("em.index.inherited",{field:$.field})}))]});function m(I,$){var V;const C=new Set(I.columns.filter((R,x)=>x!==$).map(R=>c(R.columnRef))),A=u.value.filter(R=>!C.has(c(R.value))),T=(V=I.columns[$])==null?void 0:V.columnRef;return T&&!A.some(R=>R.value===T)&&A.push({value:T,label:h(T)}),A}function h(I){return kf(I,d.value)}function p(I){const $=new Set(I.columns.map(C=>c(C.columnRef)));return u.value.filter(C=>!$.has(c(C.value)))}function y(){var $;if(!r.value)return;const I=u.value[0];a.addIndex(r.value.modelId,{modelId:Be(),name:`idx_${((($=r.value.indexes)==null?void 0:$.length)??0)+1}`,unique:!1,columns:I?[{columnRef:I.value,descending:!1}]:[]})}function b(I,$){r.value&&a.updateIndex(r.value.modelId,I,$)}function f(I){const $=p(I)[0];$&&b(I.modelId,{columns:[...I.columns,{columnRef:$.value,descending:!1}]})}function g(I,$,C){b(I.modelId,{columns:I.columns.map((A,T)=>T===$?{...A,columnRef:C}:A)})}function k(I,$,C){b(I.modelId,{columns:I.columns.map((A,T)=>T===$?{...A,descending:C}:A)})}function _(I,$){b(I.modelId,{columns:I.columns.filter((C,A)=>A!==$)})}function N(I,$){b(I.modelId,{parameters:$.trim()===""?void 0:$})}return(I,$)=>{var C;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:$[0]||($[0]=A=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",k2,[e.collapsible?(t.openBlock(),t.createBlock($e,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:((C=r.value.indexes)==null?void 0:C.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(y,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],A=>(t.openBlock(),t.createElementBlock("div",{key:A.modelId,class:"em-attr"},[t.createElementVNode("div",E2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`idx-name-${A.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":T=>b(A.modelId,{name:T})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-uq-${A.modelId}`,class:"em-check",label:"UQ","model-value":A.unique,"onUpdate:modelValue":T=>b(A.modelId,{unique:T})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:T=>t.unref(a).removeIndex(r.value.modelId,A.modelId)},null,8,["onClick"])]),t.createVNode(no,{controller:t.unref(a),"ref-id":A.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(A.columns,(T,V)=>(t.openBlock(),t.createElementBlock("div",{key:V,class:"em-attr__row"},[t.createVNode(t.unref(te.BSSelect),{class:"grow","model-value":T.columnRef,items:m(A,V),"value-provider":R=>R.value,"label-provider":R=>R.label,"onUpdate:modelValue":R=>R&&g(A,V,R)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-${A.modelId}-desc-${V}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":R=>k(A,V,R)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:"−",onClick:R=>_(A,V)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!p(A).length,onClick:T=>f(A)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",N2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:A.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:T=>N(A,T.target.value)},null,40,w2)])]))),128)):t.createCommentVNode("",!0)],8,_2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),v2=["disabled"],C2={class:"em-panel__sub-label"},x2={class:"em-attr__row"},S2={class:"em-attr__row"},R2={class:"em-multilang"},A2={class:"em-attr__pii"},$2={class:"em-swatch__row em-attr__swatch"},T2=["title","onClick"],M2=["title","onClick"],V2=Ke(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=te.useModal(),l=t.computed(()=>a.state.logical.entities.find(_=>_.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(_=>_.entityRef===l.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(_){return _==="none"?a.t("em.common.noneParen"):_}const m=_=>_;function h(_,N){l.value&&a.updateOperation(l.value.modelId,_.modelId,N)}function p(_,N){h(_,{description:Object.keys(N).length?N:void 0})}function y(_){return _.personalInfoAttributeType??"none"}function b(_,N){h(_,{personalInfoAttributeType:N==="none"?void 0:N})}function f(_){var N,I;return _t((I=(N=s.value)==null?void 0:N.operationStyles)==null?void 0:I[_.modelId])}function g(_,N){l.value&&a.setOperationSwatch(l.value.modelId,_.modelId,N)}function k(_){r.openModal({component:Ef,bind:{operationName:_.name,sourceCode:_.sourceCode??"",locale:a.uiLocale.value,onSave:N=>h(_,{sourceCode:N})}})}return(_,N)=>{var I;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:N[1]||(N[1]=$=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",C2,[e.collapsible?(t.openBlock(),t.createBlock($e,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((I=l.value.operations)==null?void 0:I.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:N[0]||(N[0]=t.withModifiers($=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],$=>(t.openBlock(),t.createElementBlock("div",{key:$.modelId,class:"em-attr"},[t.createElementVNode("div",x2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`op-name-${$.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":$.name,"onUpdate:modelValue":C=>h($,{name:C})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{width:"96px","model-value":$.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":C=>C&&h($,{visibility:C})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:C=>t.unref(a).removeOperation(l.value.modelId,$.modelId)},null,8,["onClick"])]),t.createElementVNode("div",S2,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t($.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:C=>k($)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",R2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`op-desc-${$.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":$.description,"onUpdate:modelValue":C=>p($,C)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",A2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":y($),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":C=>C&&b($,C)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",$2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":f($)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:C=>g($,null)},"∅",10,T2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),C=>(t.openBlock(),t.createElementBlock("button",{key:C,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":f($)===C}]),style:t.normalizeStyle({background:t.unref(To)(C)}),title:t.unref(a).t(t.unref(to)(C)),onClick:A=>g($,C)},null,14,M2))),128))])]))),128)):t.createCommentVNode("",!0)],8,v2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),B2=["title"],D2={class:"em-panel__head"},L2={class:"em-panel__head-row"},O2=["title"],P2={class:"em-panel__context"},z2={key:0,class:"em-panel__lock"},F2=["disabled"],U2={key:0,class:"em-panel__note"},H2={key:1,class:"em-panel__note"},j2={key:2,class:"em-jpa"},K2={class:"em-field"},G2={class:"em-field"},Y2={class:"em-field"},q2={key:0,class:"em-field"},W2={class:"em-panel__note"},J2={class:"em-panel__sub"},X2={class:"em-field"},Z2={class:"em-field"},Q2={class:"em-jpa"},eV={key:0,class:"em-panel__note"},tV={key:1,class:"em-panel__note"},nV={class:"em-jpa"},oV={class:"em-field"},iV={key:0,class:"em-panel__note"},aV={class:"em-field"},rV={class:"em-multilang"},lV={class:"em-field"},sV=["value"],cV={class:"em-field"},dV={class:"em-swatch"},uV={class:"em-swatch__row"},mV=["title"],fV=["title","onClick"],pV={class:"em-panel__note"},hV={class:"em-field"},yV=["value"],gV={class:"em-swatch"},bV={class:"em-swatch__row"},_V=["title"],kV=["title","onClick"],ch=Ke(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var U;return(U=r.value)==null?void 0:U.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const U=c.value;return U?l.state.logical.entities.find(H=>H.modelId===U)??null:null}),u=t.computed(()=>{const U=s.value;if((U==null?void 0:U.kind)==="association")return l.isAssociationLocked(U.id);const H=c.value;return!!H&&l.isEntityLocked(H)}),m=t.computed(()=>{var U;return((U=l.selectedAttr.value)==null?void 0:U.attrId)??null}),h=t.computed(()=>new Set(l.selectedAttrIds.value)),p=t.computed(()=>m.value!==null),y=t.ref({});t.watch(p,()=>{y.value={}});function b(U){return y.value[U]??p.value}function f(U){y.value={...y.value,[U]:!b(U)}}const g=t.computed(()=>{var q;const U=d.value;if(!U)return l.t("em.entity.fallback");const H=(q=U.table)==null?void 0:q.physicalName;return H?`${U.name} (${H})`:U.name}),k=t.computed(()=>{const U=s.value;return(U==null?void 0:U.kind)==="association"?l.state.logical.associations.find(H=>H.modelId===U.id)??null:null}),_=t.computed(()=>{const U=s.value;return(U==null?void 0:U.kind)==="group"?l.state.logical.groups.find(H=>H.modelId===U.id)??null:null}),N=t.computed(()=>{const U=s.value;return(U==null?void 0:U.kind)==="note"?l.state.layout.notes.find(H=>H.modelId===U.id)??null:null}),I=t.computed(()=>{var H,q;const U=(H=_.value)==null?void 0:H.name;return(U==null?void 0:U[l.userLanguage.value])||(U==null?void 0:U.ko)||(U==null?void 0:U.en)||(U==null?void 0:U.ja)||(U==null?void 0:U.zh)||((q=_.value)==null?void 0:q.packageName)||l.t("em.group.fallback")}),$=t.computed(()=>{if(d.value){const U=h.value.size;if(U>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:U});if(m.value){const H=d.value.attributes.find(q=>q.modelId===m.value);return(H==null?void 0:H.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(H==null?void 0:H.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(k.value){const U=H=>{var q;return((q=l.state.logical.entities.find(Ce=>Ce.modelId===H))==null?void 0:q.name)??H};return l.t("em.inspector.ctxAssoc",{a:U(k.value.end1.entityRef),b:U(k.value.end2.entityRef)})}return _.value?l.t("em.inspector.ctxGroup",{name:I.value}):N.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),C=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],A=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],T={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},V=U=>{const H=T[U];return H?l.t(H):U},R=U=>{var H;return((H=l.state.logical.entities.find(q=>q.modelId===U))==null?void 0:H.name)??U},x=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],M=["LIST","SET"],E=["inherit","LAZY","EAGER"],w=U=>U;function S(U){return U==="inherit"?l.t("em.common.inherit"):U}const B=t.computed(()=>!!k.value&&k.value.end1.entityRef===k.value.end2.entityRef);function z(U,H){k.value&&l.updateAssociationEnd(k.value.modelId,U,H)}function K(U){return ie.value?U:U==="end1"?"end2":"end1"}function J(U){var De;const H=(De=k.value)==null?void 0:De[U];if(!(H!=null&&H.attributeRef))return;const q=l.state.logical.entities.find(W=>W.modelId===H.entityRef),Ce=q==null?void 0:q.attributes.find(W=>W.modelId===H.attributeRef);return Ce&&(Ce.attrType==="RELATION_OWN"||Ce.attrType==="RELATION_REF")?Ce.name:void 0}function re(U,H){var Ce;const q=(Ce=k.value)==null?void 0:Ce[U];q!=null&&q.attributeRef&&l.updateAttribute(q.entityRef,q.attributeRef,{name:H})}function pe(U){var W;const H=J(U);if(H!==void 0)return H;const q=(W=k.value)==null?void 0:W[U];if(q!=null&&q.navFieldNameHint)return q.navFieldNameHint;const Ce=U==="end1"?"end2":"end1",De=l.state.logical.entities.find(ne=>{var G;return ne.modelId===((G=k.value)==null?void 0:G[Ce].entityRef)});return De?Hi(De.name,Fi(k.value[Ce].multiplicity)):""}function ce(U){return!!ie.value||J(U)!==void 0}function Ne(U){k.value&&!B.value&&l.setAssociationIdentifying(k.value.modelId,U)}function he(U){var H,q,Ce;return!!((Ce=(q=(H=k.value)==null?void 0:H[U].jpa)==null?void 0:q.cascadeTypes)!=null&&Ce.includes("ALL"))}function de(U,H,q){var W,ne;const Ce=(W=k.value)==null?void 0:W[U];if(H==="ALL"&&q){z(U,{jpa:{...Ce==null?void 0:Ce.jpa,cascadeTypes:["ALL"]}});return}const De=new Set(((ne=Ce==null?void 0:Ce.jpa)==null?void 0:ne.cascadeTypes)??[]);q?De.add(H):De.delete(H),z(U,{jpa:{...Ce==null?void 0:Ce.jpa,cascadeTypes:[...De]}})}function _e(U,H){var Ce;const q=(Ce=k.value)==null?void 0:Ce[U];z(U,{jpa:{...q==null?void 0:q.jpa,...H}})}function Se(U){var H,q;return((q=(H=k.value)==null?void 0:H[U].jpa)==null?void 0:q.fetchType)??"inherit"}function me(U,H){_e(U,{fetchType:H==="inherit"?void 0:H})}function ye(U){var q;const H=(q=k.value)==null?void 0:q[U==="end1"?"end2":"end1"];return(H==null?void 0:H.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(H==null?void 0:H.multiplicity)==="ONE_OR_MORE_INSTANCES"}const ie=t.computed(()=>{const U=k.value;if(!U)return null;for(const H of l.state.logical.entities){const q=H.attributes.find(ne=>{var G;return((G=ne.embedded)==null?void 0:G.associationRef)===U.modelId&&ne.attrType==="EMBED_OWN"});if(!q)continue;const Ce=U.end2.entityRef===q.embedded.embeddableRef?"end2":"end1",De=U[Ce].multiplicity,W=U[Ce].jpa;return{which:Ce,cardinality:De,isCollection:De==="ZERO_OR_MORE_INSTANCES"||De==="ONE_OR_MORE_INSTANCES",collectionType:(W==null?void 0:W.collectionType)??"LIST",collectionTable:(W==null?void 0:W.collectionTable)??"",orderColumn:(W==null?void 0:W.orderColumn)??""}}return null});function se(U){k.value&&l.setEmbedCardinality(k.value.modelId,U)}function fe(U){const H=ie.value;H&&_e(H.which,U==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function O(U){const H=ie.value;H&&_e(H.which,{collectionTable:U.trim()||void 0})}function L(U){const H=ie.value;H&&_e(H.which,{orderColumn:U.trim()||void 0})}function F(U){_.value&&l.updateGroup(_.value.modelId,U)}function Q(U,H){var q;F({name:{...(q=_.value)==null?void 0:q.name,[U]:H}})}const Y=t.computed(()=>{var U;return _.value?_t((U=l.state.layout.groupLayouts.find(H=>H.groupRef===_.value.modelId))==null?void 0:U.style):null});function ke(U){_.value&&l.setGroupSwatch(_.value.modelId,U)}function be(U){N.value&&l.setNoteMemo(N.value.modelId,U)}const xe=t.computed(()=>{var U;return _t((U=N.value)==null?void 0:U.style)});function ve(U){N.value&&l.setNoteSwatch(N.value.modelId,U)}return(U,H)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:H[0]||(H[0]=(...q)=>e.startResize&&e.startResize(...q))},null,42,B2),t.createElementVNode("header",D2,[t.createElementVNode("div",L2,[H[14]||(H[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:H[1]||(H[1]=q=>a("collapse"))},[t.createVNode($e,{name:"panel-right-close",size:16})],8,O2)]),t.createElementVNode("p",P2,t.toDisplayString($.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",z2,[t.createVNode($e,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:H[2]||(H[2]=q=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(cf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("basics"),title:g.value,onToggle:H[3]||(H[3]=q=>f("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(b2,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(I2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("index"),onToggle:H[4]||(H[4]=q=>f("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(V2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("ops"),onToggle:H[5]||(H[5]=q=>f("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!k.value.identifying,disabled:B.value||!!ie.value,"onUpdate:modelValue":Ne},null,8,["label","model-value","disabled"]),B.value?(t.openBlock(),t.createElementBlock("p",U2,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):ie.value?(t.openBlock(),t.createElementBlock("p",H2,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),ie.value?(t.openBlock(),t.createElementBlock("fieldset",j2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",K2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":ie.value.cardinality,items:A,"value-provider":w,"label-provider":V,"onUpdate:modelValue":H[6]||(H[6]=q=>q&&se(q))},null,8,["model-value"])]),ie.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",G2,[H[15]||(H[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(te.BSSelect),{"model-value":ie.value.collectionType,items:M,"value-provider":w,"label-provider":w,"onUpdate:modelValue":H[7]||(H[7]=q=>q&&fe(q))},null,8,["model-value"])]),t.createElementVNode("label",Y2,[H[16]||(H[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(te.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":ie.value.collectionTable,"onUpdate:modelValue":O},null,8,["placeholder","model-value"])]),ie.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",q2,[H[17]||(H[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(te.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":ie.value.orderColumn,"onUpdate:modelValue":L},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",W2,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],q=>{var Ce,De,W;return t.withDirectives(t.createElementVNode("div",{key:q,class:"em-end"},[t.createElementVNode("h4",J2,t.toDisplayString(q)+" → "+t.toDisplayString(R(k.value[q].entityRef)),1),ie.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",X2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":k.value[q].multiplicity,items:C,"value-provider":w,"label-provider":t.unref(Ui),"onUpdate:modelValue":ne=>z(q,{multiplicity:ne})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${K(q)}-navigable`,class:"em-check",label:"navigable",title:K(q)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:K(q)==="end2","model-value":K(q)==="end2"?!0:k.value[K(q)].navigable,"onUpdate:modelValue":ne=>z(K(q),{navigable:ne})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",Z2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(te.BSTextInput),{name:`${K(q)}-navname`,width:"100%",disabled:!ce(K(q)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":pe(K(q)),"onUpdate:modelValue":ne=>re(K(q),ne)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${K(q)}-composition`,class:"em-check",label:"composition","model-value":k.value[K(q)].composition,"onUpdate:modelValue":ne=>z(K(q),{composition:ne})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",Q2,[H[18]||(H[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(x,ne=>{var G,P;return t.createVNode(t.unref(te.BSCheckbox),{key:ne,name:`${K(q)}-cascade-${ne}`,class:"em-check",label:ne,"model-value":!!((P=(G=k.value[K(q)].jpa)==null?void 0:G.cascadeTypes)!=null&&P.includes(ne)),disabled:!ce(K(q))||ne!=="ALL"&&he(K(q)),"onUpdate:modelValue":ae=>de(K(q),ne,ae)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ce(K(q))?he(K(q))?(t.openBlock(),t.createElementBlock("p",tV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",eV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",nV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",oV,[H[19]||(H[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(te.BSSelect),{disabled:!ce(K(q)),"model-value":Se(K(q)),items:E,"value-provider":w,"label-provider":S,"onUpdate:modelValue":ne=>ne&&me(K(q),ne)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${K(q)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Ce=k.value[K(q)].jpa)!=null&&Ce.orphanRemoval),disabled:!ce(K(q))||ye(q),"onUpdate:modelValue":ne=>_e(K(q),{orphanRemoval:ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ye(q)&&((De=k.value[K(q)].jpa)!=null&&De.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",iV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",aV,[H[20]||(H[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(te.BSTextInput),{name:`${K(q)}-orderby`,width:"100%",disabled:!ce(K(q)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((W=k.value[K(q)].jpa)==null?void 0:W.orderBy)??"","onUpdate:modelValue":ne=>_e(K(q),{orderBy:ne.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!ie.value||q===ie.value.which]])}),64))],64)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",rV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,q=>{var Ce;return t.openBlock(),t.createElementBlock("label",{key:q,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(q),1),t.createVNode(t.unref(te.BSTextInput),{name:`grp-name-${q}`,width:"100%","model-value":((Ce=_.value.name)==null?void 0:Ce[q])??"","onUpdate:modelValue":De=>Q(q,De)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",lV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:H[8]||(H[8]=q=>F({description:q.target.value}))},null,40,sV)]),t.createElementVNode("label",cV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":H[9]||(H[9]=q=>F({packageName:q}))},null,8,["model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":H[10]||(H[10]=q=>F({excludeDDLGeneration:q}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",dV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",uV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Y.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:H[11]||(H[11]=q=>ke(null))},"∅",10,mV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),q=>(t.openBlock(),t.createElementBlock("button",{key:q,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Y.value===q}]),style:t.normalizeStyle({background:t.unref(To)(q)}),title:t.unref(l).t(t.unref(to)(q)),onClick:Ce=>ke(q)},null,14,fV))),128))])]),t.createElementVNode("p",pV,t.toDisplayString(t.unref(l).t("em.group.members",{n:_.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",hV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:N.value.memo,rows:"6",onChange:H[12]||(H[12]=q=>be(q.target.value))},null,40,yV)]),t.createElementVNode("fieldset",gV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",bV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":xe.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:H[13]||(H[13]=q=>ve(null))},"∅",10,_V),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),q=>(t.openBlock(),t.createElementBlock("button",{key:q,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":xe.value===q}]),style:t.normalizeStyle({background:t.unref(To)(q)}),title:t.unref(l).t(t.unref(to)(q)),onClick:Ce=>ve(q)},null,14,kV))),128))])])],64)):t.createCommentVNode("",!0)],8,F2)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),EV=["title"],NV={class:"em-validation__title"},wV=["title","onClick"],IV={key:0,class:"em-validation__body"},vV={class:"em-validation__opt"},CV={key:0,class:"em-validation__empty"},xV={key:1,class:"em-validation__empty"},SV={key:2,class:"em-validation__list"},RV=["onClick"],AV={class:"em-validation__item-msg"},$V={key:0,class:"em-validation__item-entity"},TV=["title","onClick"],MV=["title"],VV=Ke(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const b=new Map;for(const f of o.state.logical.entities)b.set(f.modelId,f.name);return b});function r(b){const f=kw(b);if(!f)return null;const g=a.value.get(f);return g===void 0?null:g.trim()===""?o.t("em.validation.nameless"):g}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const b={error:0,warning:0,info:0};for(const f of i.value)b[f.severity]++;return b}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(b=>c.value[b.severity]).slice().sort((b,f)=>l[b.severity].order-l[f.severity].order)),u=t.computed(()=>d.value.map(b=>({issue:b,entityName:r(b),message:sf(o.t,b),category:bw(o.t,b.ruleId)}))),m=t.ref(!1);function h(b){c.value[b]=!c.value[b]}function p(b){if(!m.value){m.value=!0;return}h(b)}function y(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,f)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:f[1]||(f[1]=g=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode($e,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",NV,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,EV),t.createElementVNode("div",{class:"em-validation__counts",onClick:f[0]||(f[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],g=>t.createElementVNode("button",{key:g,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${g}`,{"is-off":!c.value[g]}]]),title:m.value?t.unref(o).t(c.value[g]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[g].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:k=>p(g)},[t.createVNode($e,{name:l[g].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[g]),1)],10,wV)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",IV,[t.createElementVNode("label",vV,[t.createVNode(t.unref(te.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":f[2]||(f[2]=g=>t.unref(o).flagEntitiesWithoutRelations.value=g)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",CV,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",xV,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",SV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:g,entityName:k,message:_,category:N},I)=>(t.openBlock(),t.createElementBlock("li",{key:`${g.ruleId}:${g.targetRef??"model"}:${I}`,class:t.normalizeClass(["em-validation__item",[`is-${g.severity}`,{"is-clickable":!!g.targetRef}]]),onClick:$=>y(g)},[t.createVNode($e,{name:l[g.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",AV,[k?(t.openBlock(),t.createElementBlock("span",$V,t.toDisplayString(k),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(_),1)]),t.unref(o).hasQuickFix(g)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers($=>t.unref(o).applyQuickFix(g),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,TV)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:g.ruleId},t.toDisplayString(N),9,MV)],10,RV))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),BV={class:"em-history"},DV={class:"em-history__head"},LV={class:"em-history__title"},OV={class:"em-history__head-actions"},PV=["title","disabled"],zV=["title"],FV={class:"em-history__filters"},UV={class:"em-history__filter"},HV={class:"em-history__filters em-history__filters--period"},jV={class:"em-history__filter-label"},KV=["title","aria-label","max"],GV=["title","aria-label","min"],YV=["title"],qV={key:0,class:"em-history__diffbar"},WV={class:"em-history__diffbar-range"},JV={class:"em-history__diffbar-count"},XV={class:"em-history__body"},ZV={key:0,class:"em-history__empty"},QV={key:1,class:"em-history__diff-list"},eB=["onClick"],tB={class:"em-history__action-head"},nB={class:"em-history__action-name"},oB={key:0,class:"em-history__fields"},iB={class:"em-history__fname"},aB={key:0,class:"em-history__old"},rB={class:"em-history__val"},lB={key:1,class:"em-history__empty"},sB={key:2,class:"em-history__empty is-error"},cB={key:3,class:"em-history__empty"},dB={key:4,class:"em-history__list"},uB=["onClick"],mB={class:"em-history__summary"},fB={class:"em-history__seq"},pB={class:"em-history__gmeta"},hB={class:"em-history__who"},yB={key:0,class:"em-history__time"},gB={key:1,class:"em-history__restored-from"},bB=["onClick"],_B={key:0,class:"em-history__detail"},kB={class:"em-history__action-head"},EB={class:"em-history__action-name"},NB={key:0,class:"em-history__fields"},wB={class:"em-history__fname"},IB={key:0,class:"em-history__old"},vB={class:"em-history__val"},CB={class:"em-history__preview"},xB=["disabled"],SB={key:0,class:"em-history__diff-list is-preview"},RB={class:"em-history__action-head"},AB={class:"em-history__action-name"},$B={key:0,class:"em-history__fields"},TB={class:"em-history__fname"},MB={key:0,class:"em-history__old"},VB={class:"em-history__val"},BB={class:"em-history__confirm-row"},DB={class:"em-history__confirm-msg"},LB=["disabled","onClick"],OB=["disabled"],PB=["onClick"],br=50,zB=Ke(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((G,P)=>P.seq>G?P.seq:G,-1/0));async function u(G){if(a.historyTransport){l.value=!0,s.value=null;try{const P=!(G!=null&&G.full)&&r.value.length>0&&Number.isFinite(d.value),ae=await a.historyTransport(P?d.value:void 0);if(!P)r.value=ae;else if(ae.length){const Re=new Set(r.value.map(j=>j.seq)),le=ae.filter(j=>!Re.has(j.seq));le.length&&(r.value=[...r.value,...le])}c.value=!0}catch(P){s.value=P instanceof Error?P.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const h=t.ref(null),p=t.ref(null);t.watch(()=>o.open,G=>{G?m():(h.value=null,p.value=null)},{immediate:!0});let y=null;t.watch(()=>a.revision.value,()=>{o.open&&(y&&clearTimeout(y),y=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const b=t.computed(()=>new Map(a.state.logical.entities.map(G=>[G.modelId,G]))),f=t.computed(()=>new Map(a.state.logical.associations.map(G=>[G.modelId,G]))),g=t.computed(()=>{const G=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(P=>{var ae,Re;return[P.modelId,P.packageName||((ae=P.name)==null?void 0:ae[G])||((Re=P.name)==null?void 0:Re.ko)||P.modelId]}))});function k(G){var le,j,Ze,rt,He,Pe,Oe;const P=f.value.get(G);if(!P)return a.t("em.history.assocFallback");if((le=P.description)!=null&&le.trim())return P.description.trim();const ae=(rt=(Ze=b.value.get((j=P.end1)==null?void 0:j.entityRef))==null?void 0:Ze.name)==null?void 0:rt.trim(),Re=(Oe=(Pe=b.value.get((He=P.end2)==null?void 0:He.entityRef))==null?void 0:Pe.name)==null?void 0:Oe.trim();return ae&&Re?`${ae}→${Re}`:a.t("em.history.assocFallback")}function _(G){var P,ae,Re,le;if(G.kind==="entity")return((ae=(P=b.value.get(G.ref))==null?void 0:P.name)==null?void 0:ae.trim())||a.t("em.attr.nameless");if(G.kind==="attribute"||G.kind==="operation"||G.kind==="index"){const j=G.entityRef?b.value.get(G.entityRef):void 0,rt=((G.kind==="attribute"?j==null?void 0:j.attributes:G.kind==="operation"?j==null?void 0:j.operations:j==null?void 0:j.indexes)??[]).find(Pe=>Pe.modelId===G.ref),He=(Re=j==null?void 0:j.name)==null?void 0:Re.trim();return`${He?He+".":""}${((le=rt==null?void 0:rt.name)==null?void 0:le.trim())||G.ref}`}return G.kind==="association"?k(G.ref):G.kind==="associationEnd"?`${k(G.ref)}(${G.end})`:G.kind==="group"?a.t("em.history.groupSubject",{name:g.value.get(G.ref)??G.ref}):G.ref}const N={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},I={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},$=t.ref("all"),C=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],A=t.computed({get:()=>$.value,set:G=>{G&&($.value=G)}}),T=t.computed(()=>Jr(r.value)),V=t.computed(()=>T.value.length?T.value[0].seq:null),R=t.computed(()=>$.value==="all"?T.value:T.value.filter(G=>(G.kind??"edit")===$.value)),x=t.ref(br),M=t.ref(""),E=t.ref(""),w=t.computed(()=>!!M.value||!!E.value);function S(){M.value="",E.value=""}const B=t.computed(()=>{const G=M.value?new Date(`${M.value}T00:00:00`).getTime():null,P=E.value?new Date(`${E.value}T23:59:59.999`).getTime():null;return G==null&&P==null?R.value:R.value.filter(ae=>{if(ae.ts==null)return!1;const Re=new Date(ae.ts).getTime();return!(isNaN(Re)||G!=null&&Re<G||P!=null&&Re>P)})}),z=t.computed(()=>B.value.slice(0,x.value)),K=t.computed(()=>Math.max(0,B.value.length-x.value));function J(){x.value+=br}t.watch([$,M,E],()=>{x.value=br}),t.watch(()=>o.open,G=>{G&&(x.value=br,S())});function re(G){return G===void 0?"—":G===null?a.t("em.history.emptyValue"):typeof G=="object"?JSON.stringify(G):String(G)}function pe(G){const P=_(G.subject);if(G.verb==="add")return a.t("em.history.summaryAdd",{name:P});if(G.verb==="remove")return a.t("em.history.summaryRemove",{name:P});if(G.fields.length===1){const ae=G.fields[0];return`${P}.${ae.field} ${ae.oldValue!==void 0?re(ae.oldValue)+"→":""}${re(ae.value)}`}return a.t("em.history.summaryFields",{name:P,n:G.fields.length})}function ce(G){return G.actions.length===0?a.t("em.history.noChange"):G.actions.length===1?pe(G.actions[0]):a.t("em.history.summaryMore",{summary:pe(G.actions[0]),n:G.actions.length-1})}const Ne=t.ref(new Set);function he(G){const P=new Set(Ne.value);P.has(G)?P.delete(G):P.add(G),Ne.value=P}function de(G){if(G==null)return"";const P=new Date(G);return isNaN(P.getTime())?String(G):P.toLocaleString()}function _e(G){const P=G.author,ae=G.origin;return P&&ae?`${P}(${ae})`:P||(ae?`(${ae})`:"—")}const Se=t.computed(()=>h.value==null?null:Xr(r.value,{fromSeq:h.value,...p.value!=null?{toSeq:p.value}:{}}));t.watch(()=>Se.value?zc(Se.value):null,G=>i("diffChange",G));function me(G){h.value=G,p.value=null,H.value=null}function ye(){h.value=null,p.value=null}const ie=t.computed(()=>T.value.map(G=>G.seq)),se=t.computed(()=>V.value??1/0),fe=t.computed(()=>p.value??se.value),O=t.computed(()=>p.value??se.value),L=t.computed(()=>ie.value.filter(G=>G<fe.value).map(G=>({v:G}))),F=t.computed(()=>ie.value.filter(G=>h.value!=null&&G>h.value).map(G=>({v:G})));function Q(G){G!=null&&(h.value=G,p.value!=null&&p.value<=G&&(p.value=null))}function Y(G){G!=null&&(p.value=G>=se.value?null:G)}function ke(G){return G>=se.value?a.t("em.history.diff.current"):`#${G}`}function be(G){return G.kind==="entity"?b.value.has(G.ref)?G.ref:null:(G.kind==="attribute"||G.kind==="operation"||G.kind==="index")&&G.entityRef?b.value.has(G.entityRef)?G.entityRef:null:G.kind==="group"&&g.value.has(G.ref)?G.ref:null}function xe(G){const P=be(G);P&&a.requestFocus(P)}const ve={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},U={added:"add",modified:"update",removed:"remove"},H=t.ref(null),q=t.ref(!1),Ce=t.computed(()=>H.value==null?null:Xr(r.value,{fromSeq:H.value})),De=t.ref(!1);function W(G){H.value=G,De.value=!1}async function ne(G){q.value=!0;try{const P=await a.restoreToSeq(G);P.ok?(h.value=null,p.value=null):s.value=a.t("em.history.restoreFailed",{reason:P.reason??a.t("em.history.unknown")})}finally{q.value=!1,H.value=null}}return(G,P)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var ae,Re;return[t.withDirectives(t.createElementVNode("section",BV,[t.createElementVNode("header",DV,[t.createElementVNode("div",LV,[t.createVNode($e,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",OV,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:P[0]||(P[0]=le=>u({full:!0}))},[t.createVNode($e,{name:"redo",size:15})],8,PV),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:P[1]||(P[1]=le=>i("close"))},[t.createVNode($e,{name:"panel-close",size:15})],8,zV)])]),t.createElementVNode("div",FV,[t.createElementVNode("label",UV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(te.BSSelect),{modelValue:A.value,"onUpdate:modelValue":P[2]||(P[2]=le=>A.value=le),items:C,"value-provider":le=>le.v,"label-provider":le=>t.unref(a).t(le.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",HV,[t.createElementVNode("span",jV,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:E.value||void 0,"onUpdate:modelValue":P[3]||(P[3]=le=>M.value=le)},null,8,KV),[[t.vModelText,M.value]]),P[9]||(P[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:M.value||void 0,"onUpdate:modelValue":P[4]||(P[4]=le=>E.value=le)},null,8,GV),[[t.vModelText,E.value]]),w.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:S},[t.createVNode($e,{name:"x",size:12})],8,YV)):t.createCommentVNode("",!0)]),h.value!=null?(t.openBlock(),t.createElementBlock("div",qV,[t.createElementVNode("div",WV,[t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":h.value??void 0,items:L.value,"value-provider":le=>le.v,"label-provider":le=>`#${le.v}`,"onUpdate:modelValue":P[5]||(P[5]=le=>Q(le??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode($e,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":O.value,items:F.value,"value-provider":le=>le.v,"label-provider":le=>ke(le.v),"onUpdate:modelValue":P[6]||(P[6]=le=>Y(le??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",JV,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((ae=Se.value)==null?void 0:ae.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:ye},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",XV,[h.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Re=Se.value)!=null&&Re.entries.length?(t.openBlock(),t.createElementBlock("ul",QV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value.entries,(le,j)=>(t.openBlock(),t.createElementBlock("li",{key:j,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!be(le.subject)}]),onClick:Ze=>xe(le.subject)},[t.createElementVNode("div",tB,[t.createVNode($e,{name:N[le.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",nB,t.toDisplayString(_(le.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${U[le.verb]}`])},t.toDisplayString(t.unref(a).t(ve[le.verb])),3)]),le.fields.length?(t.openBlock(),t.createElementBlock("ul",oB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le.fields,(Ze,rt)=>(t.openBlock(),t.createElementBlock("li",{key:rt,class:"em-history__field"},[t.createElementVNode("span",iB,t.toDisplayString(Ze.field),1),Ze.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",aB,t.toDisplayString(re(Ze.oldValue)),1)):t.createCommentVNode("",!0),Ze.oldValue!==void 0?(t.openBlock(),t.createBlock($e,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",rB,t.toDisplayString(re(Ze.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,eB))),128))])):(t.openBlock(),t.createElementBlock("p",ZV,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",lB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",sB,t.toDisplayString(s.value),1)):B.value.length===0?(t.openBlock(),t.createElementBlock("p",cB,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",dB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(z.value,le=>{var j,Ze,rt;return t.openBlock(),t.createElementBlock("li",{key:le.seq,class:t.normalizeClass(["em-history__group",[`is-${le.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:He=>he(le.seq)},[t.createVNode($e,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":Ne.value.has(le.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${le.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(le.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",mB,t.toDisplayString(ce(le)),1),t.createElementVNode("span",fB,"#"+t.toDisplayString(le.seq),1)],8,uB),t.createElementVNode("div",pB,[t.createElementVNode("span",hB,t.toDisplayString(_e(le)),1),le.ts?(t.openBlock(),t.createElementBlock("span",yB,t.toDisplayString(de(le.ts)),1)):t.createCommentVNode("",!0),le.kind==="restore"&&le.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",gB,"← #"+t.toDisplayString(le.restoredFromSeq),1)):t.createCommentVNode("",!0),le.seq!==V.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(He=>me(le.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,bB)):t.createCommentVNode("",!0)]),Ne.value.has(le.seq)?(t.openBlock(),t.createElementBlock("div",_B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le.actions,(He,Pe)=>(t.openBlock(),t.createElementBlock("div",{key:Pe,class:"em-history__action"},[t.createElementVNode("div",kB,[t.createVNode($e,{name:N[He.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",EB,t.toDisplayString(_(He.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${He.verb}`])},t.toDisplayString(t.unref(a).t(I[He.verb])),3)]),He.fields.length?(t.openBlock(),t.createElementBlock("ul",NB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(He.fields,(Oe,X)=>(t.openBlock(),t.createElementBlock("li",{key:X,class:"em-history__field"},[t.createElementVNode("span",wB,t.toDisplayString(Oe.field),1),Oe.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",IB,t.toDisplayString(re(Oe.oldValue)),1)):t.createCommentVNode("",!0),Oe.oldValue!==void 0?(t.openBlock(),t.createBlock($e,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",vB,t.toDisplayString(re(Oe.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&le.seq!==V.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":H.value===le.seq}])},[H.value===le.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",CB,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((j=Ce.value)!=null&&j.entries.length),onClick:P[7]||(P[7]=He=>De.value=!De.value)},[t.createVNode($e,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":De.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Ze=Ce.value)!=null&&Ze.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:Ce.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,xB),De.value&&((rt=Ce.value)!=null&&rt.entries.length)?(t.openBlock(),t.createElementBlock("ul",SB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ce.value.entries,(He,Pe)=>(t.openBlock(),t.createElementBlock("li",{key:Pe,class:"em-history__diff-entry"},[t.createElementVNode("div",RB,[t.createVNode($e,{name:N[He.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",AB,t.toDisplayString(_(He.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${U[He.verb]}`])},t.toDisplayString(t.unref(a).t(ve[He.verb])),3)]),He.fields.length?(t.openBlock(),t.createElementBlock("ul",$B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(He.fields,(Oe,X)=>(t.openBlock(),t.createElementBlock("li",{key:X,class:"em-history__field"},[t.createElementVNode("span",TB,t.toDisplayString(Oe.field),1),Oe.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",MB,t.toDisplayString(re(Oe.oldValue)),1)):t.createCommentVNode("",!0),Oe.oldValue!==void 0?(t.openBlock(),t.createBlock($e,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",VB,t.toDisplayString(re(Oe.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",BB,[t.createElementVNode("span",DB,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:q.value,onClick:He=>ne(le.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,LB),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:q.value,onClick:P[8]||(P[8]=He=>H.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,OB)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:He=>W(le.seq)},[t.createVNode($e,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,PB))],2)):t.createCommentVNode("",!0)],2)}),128))])),h.value==null&&K.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:J},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:K.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function FB(e,n){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>=n?i:null}function dh(e){const n=t.ref(FB(e.storageKey,e.min)??e.initial),o=t.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=n.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),n.value=m},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(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const UB={class:"em-modeler"},HB={class:"em-modeler__body"},jB={class:"em-drawer__inner"},KB={class:"em-drawer__head"},GB={class:"em-drawer__actions"},YB=["title"],qB=["title"],WB=["title"],JB=["title"],XB=["title"],ZB=Ke(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(N){t.nextTick(()=>{const I=N();I&&("focusCollapse"in I?I.focusCollapse():I.focus())})}function c(N){n.value=N,s(()=>N?i.value:a.value)}function d(N){o.value=N,s(()=>N?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:h,dragging:p,startResize:y}=dh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:b,dragging:f,startResize:g}=dh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),k=t.ref(null),_=t.ref(null);return(N,I)=>{var $,C,A;return t.openBlock(),t.createElementBlock("div",UB,[t.createVNode(sh,{controller:e.controller,"history-open":u.value,onExportSvg:I[0]||(I[0]=T=>{var V;return(V=k.value)==null?void 0:V.exportSvg()}),onExportPng:I[1]||(I[1]=T=>{var V;return(V=k.value)==null?void 0:V.exportPng()}),onToggleHistory:I[2]||(I[2]=T=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",HB,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(h)+"px"})},[t.createElementVNode("div",jB,[t.createElementVNode("header",KB,[I[11]||(I[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",GB,[($=_.value)!=null&&$.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((C=_.value)!=null&&C.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:I[3]||(I[3]=T=>{var V;return(V=_.value)==null?void 0:V.toggleAll()})},[t.createVNode($e,{name:(A=_.value)!=null&&A.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,YB)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:I[4]||(I[4]=T=>c(!1))},[t.createVNode($e,{name:"panel-close",size:16})],8,qB)])]),t.createVNode(lh,{ref_key:"explorer",ref:_,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(p)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:I[5]||(I[5]=(...T)=>t.unref(y)&&t.unref(y)(...T))},null,42,WB),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:I[6]||(I[6]=T=>c(!0))},[t.createVNode($e,{name:"panel-open",size:18})],8,JB),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(p),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(h)-6+"px"})},[t.createVNode(rh,{ref_key:"canvas",ref:k,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(ch,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(b),resizing:t.unref(f),"start-resize":t.unref(g),onCollapse:I[7]||(I[7]=T=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:I[8]||(I[8]=T=>d(!0))},[t.createVNode($e,{name:"panel-right-open",size:18})],8,XB),[[t.vShow,!o.value]])]),_:1}),t.createVNode(zB,{controller:e.controller,open:u.value,onClose:I[9]||(I[9]=T=>u.value=!1),onDiffChange:I[10]||(I[10]=T=>m.value=T)},null,8,["controller","open"])]),t.createVNode(VV,{controller:e.controller,"panel-width":t.unref(b),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);ge.APPLY_MODEL_OPS_INPUT_SCHEMA=xb,ge.AssociationEdge=ap,ge.CUSTOM_TYPE_VALUE=tn,ge.CommandStack=Zr,ge.DEFAULT_JAVA_TYPE=xr,ge.DIAGRAM_JSON_FORMAT=$r,ge.DIAGRAM_JSON_VERSION=Tr,ge.DiagramCanvas=rh,ge.DiagramExplorer=lh,ge.EDITOR=oo,ge.EditModeToggle=TM,ge.EditorToolbar=sh,ge.EntityModeler=ZB,ge.EntityNode=Df,ge.GROUP_CODE_ENUM_VALUE=Ln,ge.GroupNode=Lf,ge.INHERITED_REF_PREFIX=Bi,ge.InvalidDiagramJsonError=Pn,ge.JAVA_TYPES=Yo,ge.NoteNode=Of,ge.OpSyncAdapter=$d,ge.PHYSICAL_NAME_MAX_LENGTH=Wo,ge.PropertyPanel=ch,ge.RevCache=Ad,ge.SELECTABLE_JAVA_TYPES=Ys,ge.SYMBOLIC_OP_KINDS=Td,ge.SYMBOLIC_OP_SCHEMA=Jd,ge.UI_LOCALES=Yw,ge.buildAgentBatch=Sb,ge.buildDiagramSvg=Ns,ge.buildDiffMarks=zc,ge.collectSharedColumns=En,ge.commands=Vg,ge.computeAutoLayout=Cs,ge.createEditorController=wC,ge.dedupeModelIds=sg,ge.defaultMermaidDialect=Ah,ge.defaultSqlDialect=ly,ge.diagramToJson=ic,ge.displayLabel=Oi,ge.emptyState=If,ge.entityModelToDdl=tc,ge.entityModelToMermaid=Nr,ge.entityModelToText=Os,ge.exportDiagramPng=ih,ge.exportDiagramSvg=oh,ge.fromPersisted=ru,ge.isGeneratable=_c,ge.isInheritedColumnRef=Vn,ge.javaTypeLabel=mo,ge.makeInheritedColumnRef=Rs,ge.mergeDiagram=Vc,ge.mermaidErToImportSource=Js,ge.migrateLegacyMoney=lg,ge.multiplicityLabel=Ui,ge.newId=Be,ge.packEntityBoxes=_r,ge.parseDiagramJson=ac,ge.parseInheritedColumnRef=kr,ge.parseMermaidEr=Ws,ge.parseSqlDdl=Ar,ge.planHealBackfillOps=s_,ge.projectActionLog=Jr,ge.projectEntityAudit=Oc,ge.projectFieldAudit=Nn,ge.projectInheritedColumns=Ho,ge.projectSeqDiff=Xr,ge.renderDiagramSvg=lc,ge.resolveColumnPhysicalName=Ko,ge.resolveDiagram=vs,ge.resolveEffectiveColumn=Bn,ge.resolveQuickFix=Or,ge.resolveSharedColumn=Dn,ge.resolveSymbolicOps=sb,ge.restoreDeepEqual=zn,ge.scaffoldEntityJava=Vy,ge.sharedColumnScopeEntities=Er,ge.sqlDdlToImportSource=ec,ge.stereotypeLabel=jo,ge.synthesizeRestoreOps=kg,ge.toPersisted=a_,ge.toPersistedV2=r_,ge.translate=Lt,ge.uiMessagesEn=mf,ge.uiMessagesJa=ff,ge.uiMessagesKo=pf,ge.validateModel=Ji,Object.defineProperty(ge,Symbol.toStringTag,{value:"Module"})}));
|
|
64
|
+
v${-(T.value.height-2*e.maskBorderRadius)}
|
|
65
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(D=>{if(g.value){const U=Rn(g.value),W=ye=>{if(ye.sourceEvent.type!=="wheel"||!p.value||!f.value)return;const ge=ye.sourceEvent.ctrlKey&&ki()?10:1,me=-ye.sourceEvent.deltaY*(ye.sourceEvent.deltaMode===1?.05:ye.sourceEvent.deltaMode?1:.002)*e.zoomStep,se=c.value.zoom*2**(me*ge);f.value.scaleTo(p.value,se)},ie=ye=>{if(ye.sourceEvent.type!=="mousemove"||!p.value||!f.value)return;const ge=x.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),me={x:c.value.x-ye.sourceEvent.movementX*ge,y:c.value.y-ye.sourceEvent.movementY*ge},se=[[0,0],[u.value.width,u.value.height]],ke=Es.translate(me.x,me.y).scale(c.value.zoom),Se=f.value.constrain()(ke,se,d.value);f.value.transform(p.value,Se)},pe=G$().wheelDelta(ye=>Ol(ye)*(e.zoomStep/10)).on("zoom",e.pannable?ie:()=>{}).on("zoom.wheel",e.zoomable?W:()=>{});U.call(pe),D(()=>{U.on("zoom",null)})}},{flush:"post"});function B(D){const[U,W]=An(D);n("click",{event:D,position:{x:U,y:W}})}function O(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeClick(W),n("nodeClick",W)}function y(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeDoubleClick(W),n("nodeDblclick",W)}function w(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseEnter(W),n("nodeMouseenter",W)}function v(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseMove(W),n("nodeMousemove",W)}function M(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseLeave(W),n("nodeMouseleave",W)}return(D,U)=>(t.openBlock(),t.createBlock(t.unref(df),{position:D.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:D.pannable,zoomable:D.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:g,width:k.value,height:N.value,viewBox:[R.value.x,R.value.y,R.value.width,R.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:B},[D.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(D.ariaLabel),9,X$)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(h),W=>(t.openBlock(),t.createBlock(W$,{id:W.id,key:W.id,f:"",position:W.computedPosition,dimensions:W.dimensions,selected:W.selected,dragging:W.dragging,style:t.normalizeStyle(W.style),class:t.normalizeClass(I.value(W)),color:_.value(W),"border-radius":D.nodeBorderRadius,"stroke-color":E.value(W),"stroke-width":D.nodeStrokeWidth,"shape-rendering":t.unref(b),type:W.type,hidden:W.hidden,onClick:ie=>O(ie,W),onDblclick:ie=>y(ie,W),onMouseenter:ie=>w(ie,W),onMousemove:ie=>v(ie,W),onMouseleave:ie=>M(ie,W)},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)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:$.value,fill:D.maskColor,stroke:D.maskStrokeColor,"stroke-width":D.maskStrokeWidth,"fill-rule":"evenodd"},null,8,Z$)],8,J$))]),_:1},8,["position","class"]))}}),tT=["d"],nT=["cx","cy","onDblclick"],oT=["x","y","onPointerdown","onDblclick"],iT=Ke(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(ns),a=t.inject(no,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Vo,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((L,x)=>x===d.value?u.value:L)),{source:p,target:f,sourceSide:h,targetSide:g}=cp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),k=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Kf(p.value,h.value,m.value,f.value,g.value):Yf(p.value,m.value,f.value)),N=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Gf(p.value,h.value,m.value,f.value,g.value):Jf(p.value,m.value,f.value).map((L,x)=>({point:L,segIndex:x})):[]),b=t.computed(()=>r.value?m.value:[]);function _(L,x){d.value=L,u.value={...c.value[L]},x.target.setPointerCapture(x.pointerId),x.stopPropagation()}function E(L){if(d.value<0)return;const x=o({x:L.clientX,y:L.clientY});u.value={x:x.x,y:x.y}}function I(L){var x,R;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(R=(x=L.target).releasePointerCapture)==null||R.call(x,L.pointerId)}function A(L,x){x.stopPropagation(),i==null||i.removePoint(n.id,L)}function T(L,x){if(!i)return;const R=o({x:x.clientX,y:x.clientY});i.insertPoint(n.id,L,{x:R.x,y:R.y})}return(L,x)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:k.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,tT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,(R,$)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${$}`,cx:R.point.x,cy:R.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(B=>T(R.segIndex,B),["stop"])},null,42,nT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,(R,$)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${$}`,x:R.x-5,y:R.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:B=>_($,B),onPointermove:E,onPointerup:I,onDblclick:B=>A($,B)},null,42,oT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),aT=["data-theme"],rT={key:0,class:"em-ctx__sep",role:"separator"},lT=["aria-label"],sT={class:"em-ctx__swatches-label","aria-hidden":"true"},cT={class:"em-ctx__chips",role:"none"},dT=["aria-checked","aria-label","title","onClick"],uT=["aria-checked","aria-label","title","onClick"],mT=["disabled","onClick"],fT={class:"em-ctx__icon"},pT={class:"em-ctx__caption"},hT=Ke(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(_,E)=>Dt(o.locale??"ko",_,E),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(_,E){var T,L;r.value=E,l.value=(T=_.target)!=null&&T.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=_.clientX,c.y=_.clientY,a.value=!0,window.addEventListener("keydown",k),window.addEventListener("resize",p),await t.nextTick();const I=s.value;if(!I)return;const A=I.getBoundingClientRect();c.x+A.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-A.width)),c.y+A.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-A.height)),(L=f()[0])==null||L.focus()}function p(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",k),window.removeEventListener("resize",p);const _=d;d=null,_!=null&&_.isConnected&&_.focus()}function f(){const _=s.value;if(!_)return[];const E=[];for(const I of Array.from(_.children))if(I.classList.contains("em-ctx__item"))I.disabled||E.push(I);else if(I.classList.contains("em-ctx__swatches")){const A=Array.from(I.querySelectorAll(".em-ctx__chip"));A.length&&E.push(A.find(T=>T===document.activeElement)??A[0])}return E}function h(_){var T;const E=f();if(!E.length)return;const I=E.indexOf(document.activeElement),A=I<0?_>0?0:E.length-1:(I+_+E.length)%E.length;(T=E[A])==null||T.focus()}function g(_){var T,L;const E=(T=document.activeElement)==null?void 0:T.closest(".em-ctx__swatches");if(!E)return!1;const I=Array.from(E.querySelectorAll(".em-ctx__chip")),A=I.indexOf(document.activeElement);return A<0?!1:((L=I[(A+_+I.length)%I.length])==null||L.focus(),!0)}function k(_){var E,I;switch(_.key){case"Escape":_.stopPropagation(),p();return;case"ArrowDown":_.preventDefault(),h(1);return;case"ArrowUp":_.preventDefault(),h(-1);return;case"ArrowRight":g(1)&&_.preventDefault();return;case"ArrowLeft":g(-1)&&_.preventDefault();return;case"Home":_.preventDefault(),(E=f()[0])==null||E.focus();return;case"End":{_.preventDefault();const A=f();(I=A[A.length-1])==null||I.focus();return}case"Tab":_.preventDefault(),h(_.shiftKey?-1:1)}}function N(_){_.disabled||(_.handler(),p())}function b(_,E){_.onPick(E),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(_,E)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:p,onContextmenu:t.withModifiers(p,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:E[0]||(E[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(I,A)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:A},[I.type==="separator"?(t.openBlock(),t.createElementBlock("div",rT)):I.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":I.caption},[t.createElementVNode("span",sT,t.toDisplayString(I.caption),1),t.createElementVNode("div",cT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":I.current===null}]),role:"menuitemradio","aria-checked":I.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:T=>b(I,null)},null,10,dT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),T=>(t.openBlock(),t.createElementBlock("button",{key:T,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":I.current===T}]),style:t.normalizeStyle({background:t.unref(To)(T)}),role:"menuitemradio","aria-checked":I.current===T,"aria-label":i(t.unref(eo)(T)),title:i(t.unref(eo)(T)),onClick:L=>b(I,T)},null,14,uT))),128))])],8,lT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":I.danger,"is-disabled":I.disabled}]),disabled:I.disabled,role:"menuitem",onClick:T=>N(I)},[t.createElementVNode("span",fT,[I.icon?(t.openBlock(),t.createBlock(Ae,{key:0,name:I.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",pT,t.toDisplayString(I.caption),1)],10,mT))],64))),128))],36)],8,aT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function oh(e,n){return n?`${e}:${n}`:e}function ih(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(oh(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function yT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=oh(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function ah(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(ih(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=ih(e.storageKey,s)),t.watch(o,s=>yT(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const ws=[".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 Po(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function gT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function bT(e,n){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 r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const h=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const g=n(h.left,h.top+h.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,p=0;const f=()=>{const h=d.trim();if(h){const g=n(m,(u+p)/2);c.push({...i,x:g.x,y:g.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(r,h),a.setEnd(r,h+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(f(),u=g.top,m=g.left,p=g.bottom,d=s[h]):(d+=s[h],p=Math.max(p,g.bottom))}return f(),c}function br(e,n){const o=[];for(const i of e.querySelectorAll("*"))gT(i)&&(i.closest(ws)||Po(i)&&o.push(...bT(i,n)));return o}function Mi(e){return Math.round(e*100)/100}function _T(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(ws)||!Po(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=n(a.left,a.top),l=n(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="${Mi(r.x)}" y="${Mi(r.y)}" width="${Mi(l.x-r.x)}" height="${Mi(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function kT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Po(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Mi(parseFloat(o.getAttribute(d)??"0"));s==="line"?n.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?n.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&n.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return n}function rh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(ws)||!Po(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)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:r.borderTopColor,strokeWidth:l})}return i}function Vi(e,n){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=n(o.left,o.top),r=n(o.right,o.bottom),l=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:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function Is(e,n){e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x+n.w),e.maxY=Math.max(e.maxY,n.y+n.h)}function ET(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,h)=>e.screenToFlowCoordinate({x:f,y:h}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const h=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!h||!Po(h))continue;const g=h.firstElementChild;if(g)if(f.type==="group"){const k=Vi(g,o);Is(s,k),i.push({...k,texts:[]});const N=g.querySelector(".em-group__label");N&&i.push({...Vi(N,o),stroke:"none",texts:[]}),i.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:br(g,o)})}else if(f.type==="note"){const k={...Vi(g,o),texts:br(g,o),lines:rh(g,g,o)};Is(s,k),r.push(k)}else{const k=Vi(g,o);Is(s,k);const N=k.radius??{tl:0,tr:0};a.push({...k,stroke:"none",texts:[]});const b=g.querySelector(".em-entity__header");if(b){const _=Vi(b,o);a.push({x:k.x,y:k.y,w:k.w,h:_.y+_.h-k.y,fill:_.fill,stroke:"none",radius:{tl:N.tl,tr:N.tr,br:0,bl:0},texts:[]})}a.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:br(g,o),lines:rh(g,g,o),icons:_T(g,o)}),a.push({...k,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const h=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!Po(h))continue;const g=h.getAttribute("d");if(!g)continue;const k=getComputedStyle(h),N=k.strokeDasharray,b=kT(f);l.push({d:g,stroke:k.stroke,strokeWidth:parseFloat(k.strokeWidth)||1.5,strokeDasharray:N&&N!=="none"?N:void 0,labels:br(f,o),markers:b.length?b:void 0})}const c=n.closest(".em-canvas")??n,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:l,entities:a,notes:r}}function vs(e){return mc(ET(e))}function lh(e,n){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function sh(e,n="diagram.svg"){const o=vs(e);lh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function NT(e){var i,a;const n=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:n>0?n:1,h:o>0?o:1}}async function ch(e,n="diagram.png",o=2){const i=vs(e),{w:a,h:r}=NT(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,p)=>{s.onload=()=>m(),s.onerror=()=>p(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");lh(u,n)}finally{URL.revokeObjectURL(l)}}const wT={class:"em-shortcuts"},IT={class:"em-shortcuts__list"},vT={class:"em-shortcuts__title"},xT={class:"em-shortcuts__keys"},CT={class:"em-shortcuts__kbd"},ST={key:0,class:"em-shortcuts__plus"},RT={class:"em-shortcuts__desc"},AT={class:"em-shortcuts__actions"},dh=Ke(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(s,c)=>Dt(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",wT,[t.createElementVNode("div",IT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,d=>(t.openBlock(),t.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[t.createElementVNode("h4",vT,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",xT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+p},[t.createElementVNode("kbd",CT,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",ST,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",RT,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",AT,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function zo(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function $T(e,n){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(n);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const TT=["aria-label"],MT=["aria-activedescendant","aria-label","placeholder"],VT={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},BT=["aria-label"],DT={class:"em-cmdk__section","aria-hidden":"true"},OT=["id","aria-selected","onMouseenter","onClick"],LT={class:"em-cmdk__label"},PT={key:0,class:"em-cmdk__tag"},zT={key:1,class:"em-cmdk__sub"},FT=["aria-label"],UT={class:"em-cmdk__section","aria-hidden":"true"},HT=["id","aria-selected","aria-disabled","onMouseenter","onClick"],jT={class:"em-cmdk__label"},KT={key:1,class:"em-cmdk__empty"},GT=Ke(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const I=c.value,A=a.state.logical.entities.map(L=>{var x,R,$,B,O,y;return{type:"goto",kind:"entity",id:L.modelId,label:((R=(x=L.table)==null?void 0:x.logicalName)==null?void 0:R[I])||L.name,sub:($=L.table)==null?void 0:$.physicalName,match:zo(L.name,(O=(B=L.table)==null?void 0:B.logicalName)==null?void 0:O[I],(y=L.table)==null?void 0:y.physicalName)??""}}),T=a.state.logical.groups.map(L=>{var x,R,$,B;return{type:"goto",kind:"group",id:L.modelId,label:((x=L.name)==null?void 0:x[I])||((R=L.name)==null?void 0:R.ko)||L.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:zo(($=L.name)==null?void 0:$[I],(B=L.name)==null?void 0:B.ko,L.packageName)??""}});return[...A,...T]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const I=[];a.editable.value&&(I.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),I.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),I.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),I.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),I.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),I.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),I.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),I.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const A of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])I.push({type:"action",id:`dm-${A}`,label:a.t(u[A]),run:()=>a.displayMode.value=A});return I});function p(I,A){return I.label.toLowerCase().includes(A)}const f=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?d.value.filter(A=>A.match.includes(I)):d.value}),h=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?m.value.filter(A=>p(A,I)):m.value}),g=t.computed(()=>[...f.value,...h.value]);t.watch([f,h],()=>{l.value=0});function k(I){return g.value.indexOf(I)}const N=I=>`em-cmdk-opt-${I}`,b=t.computed(()=>g.value[l.value]?N(l.value):void 0);t.watch(l,async()=>{var A;await t.nextTick();const I=b.value;I&&((A=document.getElementById(I))==null||A.scrollIntoView({block:"nearest"}))});function _(I){if(I.type==="goto")a.selection.value={kind:I.kind,id:I.id},a.requestFocus(I.id);else{if(I.disabled)return;I.run()}i("close")}function E(I){if(I.key==="Escape"){i("close"),I.preventDefault();return}if(I.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),I.preventDefault();return}if(I.key==="ArrowUp"){l.value=Math.max(l.value-1,0),I.preventDefault();return}if(I.key==="Enter"){const A=g.value[l.value];A&&_(A),I.preventDefault();return}I.key==="Tab"&&I.preventDefault()}return t.nextTick(()=>{var I;return(I=s.value)==null?void 0:I.focus()}),(I,A)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:A[1]||(A[1]=t.withModifiers(T=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":A[0]||(A[0]=T=>r.value=T),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":b.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:E},null,40,MT),[[t.vModelText,r.value]]),t.createElementVNode("div",VT,[g.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",DT,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,T=>(t.openBlock(),t.createElementBlock("button",{id:N(k(T)),key:T.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":k(T)===l.value}]),role:"option","aria-selected":k(T)===l.value,onMouseenter:L=>l.value=k(T),onClick:L=>_(T)},[t.createElementVNode("span",LT,t.toDisplayString(T.label),1),T.tag?(t.openBlock(),t.createElementBlock("span",PT,t.toDisplayString(T.tag),1)):T.sub?(t.openBlock(),t.createElementBlock("span",zT,t.toDisplayString(T.sub),1)):t.createCommentVNode("",!0)],42,OT))),128))],8,BT)):t.createCommentVNode("",!0),h.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",UT,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,T=>(t.openBlock(),t.createElementBlock("button",{id:N(k(T)),key:T.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":k(T)===l.value,"is-disabled":T.disabled}]),role:"option","aria-selected":k(T)===l.value,"aria-disabled":T.disabled||void 0,onMouseenter:L=>l.value=k(T),onClick:L=>_(T)},[t.createElementVNode("span",jT,t.toDisplayString(T.label),1)],42,HT))),128))],8,FT)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",KT,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,TT)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function YT(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const qT={key:0,class:"em-canvas__empty","aria-hidden":"true"},WT={class:"em-canvas__empty-title"},JT=["innerHTML"],XT=["innerHTML"],ZT=["innerHTML"],QT={key:1,class:"em-canvas__empty-title"},eM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},tM={class:"em-conflict-banner__body"},nM={class:"em-conflict-banner__title"},oM={class:"em-conflict-banner__detail"},iM={key:0,class:"em-toast",role:"status","aria-live":"polite"},xs="nc:",uh=Ke(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(C){l.value=C,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,C=>{C&&c(C.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const C=YT(i.opConflict.value);return C?{title:i.t(C.titleKey),detail:i.t(C.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(C){p.x=C.clientX,p.y=C.clientY}const h=t.ref(null);t.provide(Xa,h);const g=t.ref(null);t.provide(Af,g);const k=t.ref(null),N=t.computed(()=>{const C=k.value,S=new Set;if(!C)return S;if(C.kind==="entity")S.add(C.id);else if(C.kind==="group"){const q=i.resolved.value.groups.find(re=>re.group.modelId===C.id);for(const re of(q==null?void 0:q.group.memberEntityRefs)??[])S.add(re)}return S}),b=t.computed(()=>{const C=k.value,S=new Set(N.value),q=new Set,re=new Set;if(!C)return{related:S,edges:q,notes:re};if(C.kind==="note"){re.add(C.id);for(const xe of i.resolved.value.noteConnections)xe.noteRef===C.id&&S.add(xe.targetRef);return{related:S,edges:q,notes:re}}const ne=N.value;if(!ne.size)return{related:S,edges:q,notes:re};for(const xe of i.resolved.value.associations){const{end1:de,end2:Ce}=xe.association;(ne.has(de.entityRef)||ne.has(Ce.entityRef))&&(q.add(xe.association.modelId),S.add(de.entityRef),S.add(Ce.entityRef))}for(const xe of i.resolved.value.noteConnections)S.has(xe.targetRef)&&re.add(xe.noteRef);return{related:S,edges:q,notes:re}});t.provide(Vo,{source:k,active:t.computed(()=>k.value!==null),primaryEntityIds:N,relatedEntityIds:t.computed(()=>b.value.related),relatedEdgeIds:t.computed(()=>b.value.edges),relatedNoteIds:t.computed(()=>b.value.notes),hoverGroupId:t.computed(()=>{var C;return((C=k.value)==null?void 0:C.kind)==="group"?k.value.id:null}),setEntityHover:C=>{g.value||m.value||(k.value=C?{kind:"entity",id:C}:null)},setGroupHover:C=>{g.value||m.value||(k.value=C?{kind:"group",id:C}:null)},setNoteHover:C=>{g.value||m.value||(k.value=C?{kind:"note",id:C}:null)}}),t.provide(no,i);const _=Dx(),E=t.computed(()=>_(i.state.logical,i.embeddableCatalog.value));t.provide(Mf,E);const I=ah({expandableKeys:()=>[],defaultCollapsed:Lx,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(Bf,{isCollapsed:I.isCollapsed,toggle:I.toggle}),t.provide($f,{marks:t.toRef(o,"diffMarks")});function A(C,S){return`${xs}${C}:${S}`}function T(C){if(!C.startsWith(xs))return null;const[S,q]=C.slice(xs.length).split(":");return S&&q?{noteRef:S,targetRef:q}:null}t.provide(ns,{points:C=>{var q,re;const S=T(C);return S?((q=i.resolved.value.noteConnections.find(ne=>ne.noteRef===S.noteRef&&ne.targetRef===S.targetRef))==null?void 0:q.waypoints)??[]:((re=i.resolved.value.associations.find(ne=>ne.association.modelId===C))==null?void 0:re.waypoints)??[]},movePoint:(C,S,q)=>{const re=T(C);re?i.moveNoteConnectionWaypoint(re.noteRef,re.targetRef,S,q):i.moveWaypoint(C,S,q)},insertPoint:(C,S,q)=>{const re=T(C);re?i.addNoteConnectionWaypoint(re.noteRef,re.targetRef,S,q):i.addWaypoint(C,S,q)},removePoint:(C,S)=>{const q=T(C);q?i.removeNoteConnectionWaypoint(q.noteRef,q.targetRef,S):i.removeWaypoint(C,S)}});const L=je(),{nodes:x,edges:R,findNode:$,findEdge:B,addNodes:O,addEdges:y,removeNodes:w,removeEdges:v,fitView:M,setCenter:D,getViewport:U,screenToFlowCoordinate:W,getSelectedNodes:ie,updateNodeInternals:pe}=L,ye=t.ref(!1);async function ge(C){ye.value=!0,await t.nextTick(),await new Promise(S=>requestAnimationFrame(()=>S(null)));try{return await C()}finally{ye.value=!1}}async function me(){try{await ge(()=>sh(L))}catch(C){console.error("[entity-modeler] SVG export failed",C),c(i.t("em.canvas.exportFailed"))}}async function se(){try{await ge(()=>ch(L))}catch(C){console.error("[entity-modeler] PNG export failed",C),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:me,exportPng:se,fitView:M});const ke=t.computed(()=>i.resolved.value.entities.length===0);function Se(){const C=U(),{width:S,height:q}=L.dimensions.value;return{x:(S/2-C.x)/C.zoom,y:(q/2-C.y)/C.zoom}}function ce(){const C=Se();i.addEntity("NewEntity",{x:C.x,y:C.y})}function fe(){const C=Se();i.addNote("메모",{x:C.x,y:C.y})}function oe(C){for(const S of i.resolved.value.groups){const{location:q,size:re}=S.geo;if(C.x>=q.x&&C.x<=q.x+re.width&&C.y>=q.y&&C.y<=q.y+re.height)return S.group.modelId}return null}function le(C,S){return C.x===S.x&&C.y===S.y}function ue(C,S){return(C==null?void 0:C.width)===(S==null?void 0:S.width)&&(C==null?void 0:C.height)===(S==null?void 0:S.height)}function z(C,S){return C.entity===S.entity&&C.displayMode===S.displayMode&&C.collapsed===S.collapsed&&C.locked===S.locked&&C.groupRef===S.groupRef&&ue(C.size,S.size)&&C.style===S.style&&C.attributeStyles===S.attributeStyles&&C.operationStyles===S.operationStyles}function P(C,S){const q=Object.keys(C);if(q.length!==Object.keys(S).length)return!1;for(const re of q)if(re==="geo"){const ne=C.geo,xe=S.geo;if(!le(ne.location,xe.location)||!ue(ne.size,xe.size))return!1}else if(C[re]!==S[re])return!1;return!0}function F(){const C=i.resolved.value,S=new Map(C.groups.map(de=>[de.group.modelId,de.geo])),q=new Set(C.groups.map(de=>de.group.modelId)),re=new Set([...q,...C.entities.map(de=>de.entity.modelId),...C.notes.map(de=>de.note.modelId)]);for(const de of[...x.value])re.has(de.id)||w([de.id]);for(const de of C.groups){const Ce=de.group.modelId,Fe={width:`${de.geo.size.width}px`,height:`${de.geo.size.height}px`},He={group:de.group,style:de.style,locked:de.locked},rt=de.locked?!1:void 0,ze=$(Ce);if(ze){le(ze.position,de.geo.location)||(ze.position={...de.geo.location});const ot=ze.data;(ot.group!==He.group||ot.style!==He.style||ot.locked!==He.locked)&&(ze.data=He);const tt=ze.style;((tt==null?void 0:tt.width)!==Fe.width||(tt==null?void 0:tt.height)!==Fe.height)&&(ze.style=Fe),ze.draggable!==rt&&(ze.draggable=rt)}else O([{id:Ce,type:"group",position:{...de.geo.location},draggable:rt,style:Fe,data:He}])}for(const de of C.entities){const Ce=de.entity.modelId,Fe=de.groupRef&&q.has(de.groupRef)?de.groupRef:void 0,He={entity:de.entity,displayMode:i.displayMode.value,collapsed:de.collapsed,locked:de.locked,groupRef:Fe,size:de.geo.size,style:de.style,attributeStyles:de.attributeStyles,operationStyles:de.operationStyles},rt=de.locked?!1:void 0,ze=de.locked?!1:void 0,ot=Fe?S.get(Fe):void 0,tt=ot?{x:de.geo.location.x-ot.location.x,y:de.geo.location.y-ot.location.y}:{...de.geo.location},Ge=$(Ce);Ge?(le(Ge.position,tt)||(Ge.position=tt),z(Ge.data,He)||(Ge.data=He),Ge.parentNode!==Fe&&(Ge.parentNode=Fe),Ge.draggable!==rt&&(Ge.draggable=rt),Ge.connectable!==ze&&(Ge.connectable=ze)):O([{id:Ce,type:"entity",position:tt,parentNode:Fe,draggable:rt,connectable:ze,data:He}])}for(const de of C.notes){const Ce=de.note,Fe=Ce.modelId,He=de.groupRef&&q.has(de.groupRef)?de.groupRef:void 0,rt={note:Ce,groupRef:He},ze={width:`${Ce.geo.size.width}px`,height:`${Ce.geo.size.height}px`},ot=He?S.get(He):void 0,tt=ot?{x:Ce.geo.location.x-ot.location.x,y:Ce.geo.location.y-ot.location.y}:{...Ce.geo.location},Ge=$(Fe);if(Ge){le(Ge.position,tt)||(Ge.position=tt);const lo=Ge.data;(lo.groupRef!==He||!P(lo.note,Ce))&&(Ge.data=rt);const bn=Ge.style;((bn==null?void 0:bn.width)!==ze.width||(bn==null?void 0:bn.height)!==ze.height)&&(Ge.style=ze),Ge.parentNode!==He&&(Ge.parentNode=He)}else O([{id:Fe,type:"note",position:tt,parentNode:He,style:ze,data:rt}])}const ne=new Map(C.associations.map(de=>[de.association.modelId,de])),xe=new Set(C.noteConnections.map(de=>A(de.noteRef,de.targetRef)));for(const de of[...R.value])!ne.has(de.id)&&!xe.has(de.id)&&v([de.id]);for(const[de,Ce]of ne){const Fe={id:de,type:"association",source:Ce.association.end1.entityRef,target:Ce.association.end2.entityRef,sourceHandle:Ce.sourceColumnRef?`r:${Ce.sourceColumnRef}`:void 0,targetHandle:Ce.targetColumnRef?`l:${Ce.targetColumnRef}`:void 0,data:{association:Ce.association,sourceColumnRef:Ce.sourceColumnRef,targetColumnRef:Ce.targetColumnRef}},He=B(de);if(He){const rt=He.data;(rt.association!==Fe.data.association||rt.sourceColumnRef!==Fe.data.sourceColumnRef||rt.targetColumnRef!==Fe.data.targetColumnRef)&&(He.data=Fe.data),He.sourceHandle!==Fe.sourceHandle&&(He.sourceHandle=Fe.sourceHandle),He.targetHandle!==Fe.targetHandle&&(He.targetHandle=Fe.targetHandle)}else y([Fe])}for(const de of C.noteConnections){const Ce=A(de.noteRef,de.targetRef),Fe={noteRef:de.noteRef,targetRef:de.targetRef};B(Ce)||y([{id:Ce,type:"note-connection",source:de.noteRef,target:de.targetRef,data:Fe}])}}const Q=new Set;let X=!1,_e=!1;const he=new Map;function we(C){const S=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(C)}"]`);if(!S)return null;let q=`${S.offsetHeight}`;for(const re of S.querySelectorAll(".em-entity__row"))q+=`|${re.dataset.attr}:${re.offsetTop}`;return q}function Ie(){_e=!1;const C=X;X=!1;const S=[...Q];if(Q.clear(),C){pe();for(const re of x.value){const ne=we(re.id);ne!==null&&he.set(re.id,ne)}return}const q=[];for(const re of S){const ne=we(re);if(ne===null){he.delete(re);continue}he.get(re)!==ne&&(he.set(re,ne),q.push(re))}q.length&&pe(q)}function Y(C){if(C)for(const S of C)Q.add(S);else X=!0;_e||(_e=!0,t.nextTick(()=>requestAnimationFrame(Ie)))}t.provide(Tf,{mark:C=>Y([C])});function j(){const C=ie.value.map(q=>q.id);if(C.length)return C;const S=i.selection.value;return S&&(S.kind==="entity"||S.kind==="note"||S.kind==="group")?[S.id]:[]}function J(){return ie.value.filter(C=>C.type==="entity").map(C=>C.id)}function ve(){return ie.value.filter(C=>C.type==="group").map(C=>C.id)}function Te(C){var S;return[...((S=i.state.logical.groups.find(q=>q.modelId===C))==null?void 0:S.memberEntityRefs)??[]]}function K(){const C=ve().flatMap(Te);return[...new Set([...J(),...C])]}function te(){return ve().length>0||J().length>1}function G(){te()?i.copy(K()):i.copy()}async function ae(C){if(!C.length)return;await t.nextTick();const S=ie.value;S.length&&L.removeSelectedNodes(S);const q=C.map(re=>$(re)).filter(re=>!!re);q.length&&L.addSelectedNodes(q)}function Be(C){if(te()&&J().includes(C)){const S=K();return{caption:i.t("em.ctx.copyN",{n:S.length}),icon:"copy",handler:()=>i.copy(S)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:C},i.copy()}}}function Ve(C){var ne;const S=C.target;if(S&&(S.tagName==="INPUT"||S.tagName==="TEXTAREA"||S.isContentEditable))return;if(C.key==="?"){a.openModal({component:dh,bind:{locale:i.uiLocale.value}}),C.preventDefault();return}if((C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="k"){r.value=!0,C.preventDefault();return}if(!i.editable.value){(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="c"&&(G(),C.preventDefault());return}if(C.key==="Delete"||C.key==="Backspace"){i.deleteSelection()&&C.preventDefault();return}if(C.key==="ArrowUp"||C.key==="ArrowDown"||C.key==="ArrowLeft"||C.key==="ArrowRight"){if(((ne=i.selection.value)==null?void 0:ne.kind)==="attribute"){if(C.key==="ArrowUp"||C.key==="ArrowDown"){const Fe=C.key==="ArrowDown"?1:-1;(C.altKey?i.nudgeSelectedAttributes(Fe):i.moveAttributeFocus(Fe))&&C.preventDefault()}return}const xe=C.shiftKey?10:1,de=C.key==="ArrowLeft"?-xe:C.key==="ArrowRight"?xe:0,Ce=C.key==="ArrowUp"?-xe:C.key==="ArrowDown"?xe:0;i.nudgeNodes(j(),de,Ce)&&C.preventDefault();return}if(!(C.metaKey||C.ctrlKey))return;const re=C.key.toLowerCase();re==="c"?(G(),C.preventDefault()):re==="v"?(ae(i.paste()),C.preventDefault()):re==="z"&&(C.shiftKey?i.redo():i.undo(),C.preventDefault())}t.onMounted(async()=>{F(),await t.nextTick(),M(),Y(),window.addEventListener("keydown",Ve),window.addEventListener("pointerup",H),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ve),window.removeEventListener("pointerup",H),window.removeEventListener("pointermove",f)});function H(){h.value=null}function V(){m.value=!0,k.value=null}function Pe(){var re;m.value=!1;const C=(re=document.elementFromPoint(p.x,p.y))==null?void 0:re.closest(".vue-flow__node"),S=C==null?void 0:C.dataset.id;if(!S){k.value=null;return}const q=C.classList.contains("vue-flow__node-group")?"group":C.classList.contains("vue-flow__node-note")?"note":"entity";k.value={kind:q,id:S}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],F),t.watch(()=>i.resolved.value,C=>{const S=k.value;if(!S)return;(S.kind==="entity"?C.entities.some(re=>re.entity.modelId===S.id):S.kind==="group"?C.groups.some(re=>re.group.modelId===S.id):C.notes.some(re=>re.note.modelId===S.id))||(k.value=null)});function Ze(C){const S=C.computedPosition??C.position,q=C.dimensions??{width:0,height:0};return{x:S.x+q.width/2,y:S.y+q.height/2}}function Ue(C){const S=C.node;if(S){if(k.value=null,S.type==="group"){const q=i.resolved.value.groups.find(re=>re.group.modelId===S.id);g.value=q?{groupId:S.id,dx:S.position.x-q.geo.location.x,dy:S.position.y-q.geo.location.y}:null,h.value=null;return}if(S.type!=="entity"&&S.type!=="note"){h.value=null;return}h.value=oe(Ze(S))}}function Le(C){var re;h.value=null,g.value=null;const S=(re=C.nodes)!=null&&re.length?C.nodes:[C.node],q=S.filter(ne=>(ne==null?void 0:ne.type)==="group");if(q.length){for(const ne of q){if(!ne)continue;const xe=i.resolved.value.entities.filter(de=>de.groupRef===ne.id).map(de=>{const Ce=$(de.entity.modelId),Fe=(Ce==null?void 0:Ce.computedPosition)??(Ce==null?void 0:Ce.position)??{x:0,y:0};return{id:de.entity.modelId,location:{x:Fe.x,y:Fe.y}}});i.dragGroup(ne.id,{x:ne.position.x,y:ne.position.y},xe)}return}for(const ne of S){if(!ne||ne.type==="group")continue;const xe=ne.computedPosition??ne.position,de=ne.dimensions??{width:0,height:0},Ce={x:xe.x+de.width/2,y:xe.y+de.height/2};ne.type==="note"?i.dropNote(ne.id,{x:xe.x,y:xe.y},oe(Ce)):i.dropEntity(ne.id,{x:xe.x,y:xe.y},oe(Ce))}}function De(C){var Fe,He,rt,ze,ot;if(!i.editable.value||!C.source||!C.target)return;const S=((Fe=$(C.source))==null?void 0:Fe.type)==="note",q=((He=$(C.target))==null?void 0:He.type)==="note";if(S||q){if(S&&q)return;const tt=S?C.source:C.target,Ge=S?C.target:C.source;((rt=$(Ge))==null?void 0:rt.type)==="entity"&&i.addNoteConnection(tt,Ge);return}const re=tt=>{var Ge;return(Ge=i.state.logical.entities.find(lo=>lo.modelId===tt))==null?void 0:Ge.stereotype},ne=re(C.source)==="JPA_EMBEDDABLE",xe=re(C.target)==="JPA_EMBEDDABLE";if(ne||xe){if(ne&&xe)return;const tt=ne?C.source:C.target,Ge=ne?C.target:C.source;i.addEmbedAssociation(Ge,tt);return}const de=(ze=C.sourceHandle)!=null&&ze.startsWith("r:")?C.sourceHandle.slice(2):void 0,Ce=(ot=C.targetHandle)!=null&&ot.startsWith("l:")?C.targetHandle.slice(2):void 0;i.addAssociation(C.source,C.target,de,Ce)}const Z=t.ref(null);function dt(C,S){var re;const q=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=q==null?void 0:q.attributeStyles)==null?void 0:re[S])}function yn(C,S){var re;const q=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=q==null?void 0:q.operationStyles)==null?void 0:re[S])}function Et(C){var S;return _t((S=i.state.layout.groupLayouts.find(q=>q.groupRef===C))==null?void 0:S.style)}function gn(C){var S;return _t((S=i.state.layout.notes.find(q=>q.modelId===C))==null?void 0:S.style)}function Ee(C){var ne,xe;if(C.preventDefault(),!i.editable.value)return;const S=()=>W({x:C.clientX,y:C.clientY}),q=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const de=S();i.addEntity("NewEntity",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const de=S();i.addNote("메모",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const de=S();i.addEmptyGroup({x:de.x,y:de.y})}}],re=(ne=i.clipboard.value)==null?void 0:ne.kind;(re==="entity"||re==="entities")&&q.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>ae(i.paste())}),i.resolved.value.entities.length>0&&q.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(xe=Z.value)==null||xe.open(C,q)}function at({event:C,node:S}){var Fe,He,rt,ze,ot,tt,Ge,lo,bn,yh,gh,bh,_h,kh,Eh,Nh,wh,Ih,vh;const q=C;if(q.preventDefault(),!i.editable.value){if(S.type==="group"||S.type==="note")return;const Ye=(He=(Fe=q.target)==null?void 0:Fe.closest("[data-attr]"))==null?void 0:He.dataset.attr;if(Ye){const lt=i.selection.value;(lt==null?void 0:lt.kind)==="attribute"&<.entityId===S.id&<.ids.includes(Ye)||i.selectAttribute(S.id,Ye);const _n=((rt=i.selection.value)==null?void 0:rt.kind)==="attribute"&&i.selection.value.entityId===S.id?[...i.selection.value.ids]:[Ye];(ze=Z.value)==null||ze.open(q,[{caption:_n.length>1?i.t("em.ctx.copyN",{n:_n.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(ot=Z.value)==null||ot.open(q,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>qa(a,i,S.id)},Be(S.id)]);return}if(S.type==="group"){const Ye=i.isGroupLocked(S.id),lt=[];Ye||lt.push({type:"swatches",caption:i.t("em.common.color"),current:Et(S.id),onPick:_n=>i.setGroupSwatch(S.id,_n)},{type:"separator"});const ht=te()&&ve().includes(S.id)?K():Te(S.id);ht.length&<.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(ht)}),lt.push({caption:Ye?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Ye?"unlock":"lock",handler:()=>i.setGroupLocked(S.id,!Ye)}),Ye||lt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(S.id)}),(tt=Z.value)==null||tt.open(q,lt);return}if(S.type==="note"){(Ge=Z.value)==null||Ge.open(q,[{type:"swatches",caption:i.t("em.common.color"),current:gn(S.id),onPick:Ye=>i.setNoteSwatch(S.id,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(S.id)}]);return}const re=(bn=(lo=q.target)==null?void 0:lo.closest("[data-attr]"))==null?void 0:bn.dataset.attr;if(re){const Ye=i.selection.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ye.entityId===S.id&&Ye.ids.includes(re)||i.selectAttribute(S.id,re);const ht=((yh=i.selection.value)==null?void 0:yh.kind)==="attribute"&&i.selection.value.entityId===S.id?[...i.selection.value.ids]:[re];if(i.isEntityLocked(S.id)){(gh=Z.value)==null||gh.open(q,[{caption:ht.length>1?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const _n=ht.length>1,Cs=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(S.id)},{type:"swatches",caption:_n?i.t("em.ctx.colorN",{n:ht.length}):i.t("em.common.color"),current:_n?null:dt(S.id,re),onPick:cD=>i.setAttributeSwatches(S.id,ht,cD)},{type:"separator"},{caption:_n?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Bi=i.clipboard.value;(Bi==null?void 0:Bi.kind)==="attribute"&&Cs.push({caption:Bi.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Bi.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:S.id},i.paste()}}),Cs.push({type:"separator"},{caption:_n?i.t("em.ctx.deleteAttrN",{n:ht.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(S.id,ht)}),(bh=Z.value)==null||bh.open(q,Cs);return}const ne=(kh=(_h=q.target)==null?void 0:_h.closest("[data-op]"))==null?void 0:kh.dataset.op;if(ne){if(i.isEntityLocked(S.id))return;(Eh=Z.value)==null||Eh.open(q,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(S.id)},{type:"swatches",caption:i.t("em.common.color"),current:yn(S.id,ne),onPick:Ye=>i.setOperationSwatch(S.id,ne,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(S.id,ne)}]);return}const xe=i.resolved.value.entities.find(Ye=>Ye.entity.modelId===S.id),de=!!(xe!=null&&xe.locked),Ce=[{caption:de?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>qa(a,i,S.id)}];if(!de){Ce.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(S.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(S.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const lt=ie.value.filter(ht=>ht.type==="entity").map(ht=>ht.id);i.createGroup(lt.includes(S.id)&<.length?lt:[S.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(S.id,S.id)});const Ye=i.embeddableCatalog.value;if(Ye.length){Ce.push({type:"separator"});for(const lt of Ye){const ht=((Nh=lt.label)==null?void 0:Nh[i.userLanguage.value])??((wh=lt.label)==null?void 0:wh.ko)??((Ih=lt.label)==null?void 0:Ih.en)??lt.type;Ce.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:ht}),icon:"link",handler:()=>i.addPredefinedEmbed(S.id,lt.type)})}}}if(Ce.push({type:"separator"}),Ce.push({caption:xe!=null&&xe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:xe!=null&&xe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(S.id,!(xe!=null&&xe.collapsed))}),xe!=null&&xe.groupRef&&!de&&Ce.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(S.id)}),Ce.push({caption:de?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:de?"unlock":"lock",handler:()=>i.setEntityLocked(S.id,!de)}),Ce.push(Be(S.id)),!de){const Ye=i.clipboard.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ce.push({caption:Ye.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Ye.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:S.id},i.paste()}}),Ce.push({type:"separator"}),Ce.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(S.id)})}(vh=Z.value)==null||vh.open(q,Ce)}function zt({event:C,edge:S}){var xe,de;const q=C;if(q.preventDefault(),!i.editable.value)return;const re=T(S.id);if(re){(xe=Z.value)==null||xe.open(q,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(re.noteRef,re.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(re.noteRef,re.targetRef)}]);return}const ne=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(S.id)}];i.isAssociationLocked(S.id)||ne.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(S.id)}),(de=Z.value)==null||de.open(q,ne)}function ut(C){return C==="group"?"group":C==="note"?"note":"entity"}function Qt({node:C}){if(ie.value.length>1){i.selection.value=null;return}i.selection.value={kind:ut(C.type),id:C.id}}function en({nodes:C}){C.length>1&&(i.selection.value=null)}function Ne({edge:C}){const S=T(C.id);i.selection.value=S?{kind:"note",id:S.noteRef}:{kind:"association",id:C.id}}function et(C){const S=i.selection.value;return!!S&&S.kind!=="attribute"&&S.id===C.id}function Ft(C){var S,q;return et(C)?C.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":C.type==="note"?"var(--em-note-soft)":C.type==="group"?mf(_t((S=C.data)==null?void 0:S.style),!0)??"var(--em-mm-group)":mf(_t((q=C.data)==null?void 0:q.style))??"var(--em-mm-entity)"}function pt(C){return et(C)?"var(--em-selection)":C.type==="note"?"var(--em-note-accent)":C.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function nt(C,S){D(C,S,{zoom:U().zoom,duration:350})}t.watch(()=>i.focusRequest.value,C=>{if(!C)return;const S=$(C.id);if(!S)return;const q=S.computedPosition??S.position,re=S.dimensions??{width:0,height:0};nt(q.x+re.width/2,q.y+re.height/2)});function Fo({position:C}){nt(C.x,C.y)}function Uo({node:C}){i.selection.value={kind:ut(C.type),id:C.id};const S=C.computedPosition??C.position,q=C.dimensions??{width:0,height:0};nt(S.x+q.width/2,S.y+q.height/2)}function Ho({node:C}){M({nodes:[C.id],duration:350,maxZoom:1.2,padding:.6})}return(C,S)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(fw),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ye.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(cn).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:V,onMoveEnd:Pe,onConnect:De,onConnectStart:S[1]||(S[1]=q=>u.value=!0),onConnectEnd:S[2]||(S[2]=q=>u.value=!1),onNodeDrag:Ue,onNodeDragStop:Le,onNodeClick:Qt,onEdgeClick:Ne,onSelectionChange:en,onPaneClick:S[3]||(S[3]=q=>t.unref(i).selection.value=null),onPaneContextMenu:Ee,onNodeContextMenu:at,onEdgeContextMenu:zt},{"node-group":t.withCtx(q=>[t.createVNode(Uf,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"node-entity":t.withCtx(q=>[t.createVNode(Ff,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"node-note":t.withCtx(q=>[t.createVNode(Hf,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"edge-association":t.withCtx(q=>[t.createVNode(dp,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"edge-note-connection":t.withCtx(q=>[t.createVNode(iT,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(GC),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(bS),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(oo),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:ce},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(oo),{title:t.unref(i).t("em.ctx.addNote"),onClick:fe},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(oo),{title:t.unref(i).t("em.palette.autoLayout"),onClick:S[0]||(S[0]=q=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(eT),{key:1,pannable:"",width:224,height:160,"node-color":Ft,"node-stroke-color":pt,"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:Fo,onNodeClick:Uo,onNodeDblclick:Ho})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ke.value?(t.openBlock(),t.createElementBlock("div",qT,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",WT,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,JT),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,XT),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,ZT)],64)):(t.openBlock(),t.createElementBlock("p",QT,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(GT,{key:1,controller:t.unref(i),onClose:S[4]||(S[4]=q=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",eM,[t.createVNode(Ae,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",tM,[t.createElementVNode("strong",nM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",oM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(hT,{ref_key:"menuRef",ref:Z,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",iM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),aM={class:"em-explorer em-scroll-overlay"},rM={class:"em-explorer__search"},lM=["placeholder","aria-label"],sM=["aria-label","title"],cM={key:0,class:"em-explorer__empty"},dM=["aria-label"],uM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],mM=["onClick"],fM=["title"],pM={class:"em-key-slot"},hM={class:"em-key-slot"},yM={class:"em-explorer__label"},gM={key:2,class:"em-explorer__sr"},mh=Ke(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.computed(()=>{var ke,Se;const O=i.resolved.value,y=i.displayMode.value,w=i.userLanguage.value,v=ce=>{var fe,oe,le;return Pi(y,ce.name,(oe=(fe=ce.table)==null?void 0:fe.logicalName)==null?void 0:oe[w],(le=ce.table)==null?void 0:le.physicalName,i.t("em.node.logicalMissing"))},M=y==="PHYSICAL"||y==="LOGICAL_PHYSICAL",D=ce=>{const fe=ce.attrType.startsWith("RELATION")&&ce.dbAttrs.length>0;return{icon:ce.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:ce.identifier,fk:fe&&M}}},U=ce=>ce.attrType.startsWith("EMBED")&&ce.dbAttrs.length>0,W=y==="PHYSICAL"||y==="LOGICAL_PHYSICAL",ie=ce=>{if(ce.attrType!=="EMBED_PREDEF")return ce.dbAttrs;const fe=i.embeddableCatalog.value.find(oe=>oe.type===ce.type);return fe?ce.dbAttrs.map((oe,le)=>{const ue=fe.fields[le];return ue?{...oe,physicalName:oe.physicalName||ue.physicalName,logicalName:oe.logicalName??ue.logicalName,dataType:oe.dataType||ue.dataType,length:oe.length??ue.length}:oe}):ce.dbAttrs},pe=(ce,fe)=>{var z,P,F,Q,X,_e,he,we,Ie;const oe={entityId:fe,attrId:ce.modelId};if(U(ce)){const Y=$r(y,ce);return{key:`attr:${ce.modelId}`,label:ce.name+(Y?` : ${Y}`:""),icon:"table",attrRef:oe,focusId:fe,matchText:zo(ce.name,(P=(z=ce.dbAttrs[0])==null?void 0:z.logicalName)==null?void 0:P[w],(F=ce.dbAttrs[0])==null?void 0:F.physicalName),children:W?ie(ce).map(j=>{var J,ve;return{key:`attr:${ce.modelId}:col:${j.modelId}`,label:Pi(y,j.physicalName,(J=j.logicalName)==null?void 0:J[w],j.physicalName,i.t("em.node.logicalMissing"))+(j.dataType?` : ${j.dataType}`:""),icon:"field",attrRef:oe,focusId:fe,matchText:zo(j.physicalName,(ve=j.logicalName)==null?void 0:ve[w]),children:[]}}):[]}}const le=Ar(ce,i.state.logical.associations),ue=$r(y,ce,le);return{key:`attr:${ce.modelId}`,label:Pi(y,ce.name,(X=(Q=ce.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:X[w],(_e=ce.dbAttrs[0])==null?void 0:_e.physicalName,i.t("em.node.logicalMissing"))+(ue?` : ${ue}`:""),...D(ce),attrRef:oe,focusId:fe,matchText:zo(ce.name,(we=(he=ce.dbAttrs[0])==null?void 0:he.logicalName)==null?void 0:we[w],(Ie=ce.dbAttrs[0])==null?void 0:Ie.physicalName),children:[]}},ye=ce=>{var le,ue,z;const fe=ce.entity,oe=[...fe.attributes].sort((P,F)=>P.order-F.order);return{key:`entity:${fe.modelId}`,label:v(fe),icon:"table",selectKind:"entity",selectId:fe.modelId,focusId:fe.modelId,matchText:zo(fe.name,(ue=(le=fe.table)==null?void 0:le.logicalName)==null?void 0:ue[w],(z=fe.table)==null?void 0:z.physicalName),children:oe.map(P=>pe(P,fe.modelId))}},ge=new Map,me=[];for(const ce of O.entities)if(ce.groupRef){const fe=ge.get(ce.groupRef)??[];fe.push(ce),ge.set(ce.groupRef,fe)}else me.push(ce);const se=[];for(const ce of O.groups){const fe=ce.group;se.push({key:`group:${fe.modelId}`,label:((ke=fe.name)==null?void 0:ke[w])||((Se=fe.name)==null?void 0:Se.ko)||fe.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:fe.modelId,children:(ge.get(fe.modelId)??[]).map(ye)})}for(const ce of me)se.push(ye(ce));if(O.associations.length){const ce=new Map(O.entities.map(fe=>[fe.entity.modelId,v(fe.entity)]));se.push({key:"section:associations",label:i.t("em.explorer.associations",{n:O.associations.length}),icon:"arrow-lr",children:O.associations.map(fe=>{const oe=fe.association,le=ce.get(oe.end1.entityRef)??oe.end1.entityRef,ue=ce.get(oe.end2.entityRef)??oe.end2.entityRef;return{key:`assoc:${oe.modelId}`,label:`${le} — ${ue}`,icon:"arrow-lr",selectKind:"association",selectId:oe.modelId,children:[]}})})}return O.notes.length&&se.push({key:"section:notes",label:i.t("em.explorer.notes",{n:O.notes.length}),icon:"note",children:O.notes.map(({note:ce})=>{var fe;return{key:`note:${ce.modelId}`,label:((fe=ce.memo.split(`
|
|
66
|
+
`)[0])==null?void 0:fe.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:ce.modelId,focusId:ce.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:se}});function l(O){return O?O.pk&&O.fk?i.t("em.node.keyPfk"):O.pk?i.t("em.node.keyPk"):O.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const O=[],y=w=>{if(w.children.length){w.key!=="root"&&O.push(w.key);for(const v of w.children)y(v)}};return y(r.value),O}),c=O=>O.startsWith("entity:")||O==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=ah({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),h=t.ref(null),g=t.computed(()=>f.value.trim().length>0),k=t.computed(()=>{const O=[];if(g.value){const w=$T(r.value,f.value.trim().toLowerCase()),v=(M,D,U,W,ie)=>{if(!w.has(M.key))return;O.push({node:M,depth:D,parentKey:U,posinset:W,setsize:ie});const pe=M.children.filter(ye=>w.has(ye.key));pe.forEach((ye,ge)=>v(ye,D+1,M.key,ge+1,pe.length))};return v(r.value,0,null,1,1),O}const y=(w,v,M,D,U)=>{O.push({node:w,depth:v,parentKey:M,posinset:D,setsize:U}),d(w.key)||w.children.forEach((W,ie)=>y(W,v+1,w.key,ie+1,w.children.length))};return y(r.value,0,null,1,1),O}),N=t.ref(null),b=t.ref(null),_=t.computed(()=>{var y;const O=k.value;return b.value&&O.some(w=>w.node.key===b.value)?b.value:((y=O[0])==null?void 0:y.node.key)??null}),E=O=>!g.value&&d(O);async function I(O){var y,w;O&&(b.value=O,await t.nextTick(),(w=(y=N.value)==null?void 0:y.querySelector(`[data-key="${O}"]`))==null||w.focus())}function A(O,y){var M,D,U,W,ie;const w=k.value,v=w.findIndex(pe=>pe.node.key===y.node.key);switch(O.key){case"ArrowDown":O.preventDefault(),I((M=w[v+1])==null?void 0:M.node.key);return;case"ArrowUp":O.preventDefault(),I((D=w[v-1])==null?void 0:D.node.key);return;case"Home":O.preventDefault(),I((U=w[0])==null?void 0:U.node.key);return;case"End":O.preventDefault(),I((W=w[w.length-1])==null?void 0:W.node.key);return;case"ArrowRight":if(O.preventDefault(),!y.node.children.length)return;E(y.node.key)?u(y.node.key):I((ie=w[v+1])==null?void 0:ie.node.key);return;case"ArrowLeft":O.preventDefault(),y.node.children.length&&!E(y.node.key)?u(y.node.key):I(y.parentKey);return;case"Enter":case" ":O.preventDefault(),$(y.node,O);return;case"F2":O.preventDefault(),B(y.node)}}const T=t.computed(()=>g.value&&k.value.length<=1);function L(O){var v;if(O.key!=="/"||O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;const y=O.target,w=y==null?void 0:y.tagName;w==="INPUT"||w==="TEXTAREA"||w==="SELECT"||y!=null&&y.isContentEditable||(O.preventDefault(),(v=h.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",L)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",L)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function x(O){const y=i.selection.value;return O.attrRef?(y==null?void 0:y.kind)==="attribute"&&y.entityId===O.attrRef.entityId&&y.ids.includes(O.attrRef.attrId):!!y&&y.kind!=="attribute"&&!!O.selectId&&O.selectKind===y.kind&&O.selectId===y.id}function R(O){const y=i.selection.value;return O.selectKind==="entity"&&(y==null?void 0:y.kind)==="attribute"&&y.entityId===O.selectId}function $(O,y){if(O.attrRef){const w=y.shiftKey?"range":y.metaKey||y.ctrlKey?"toggle":"replace";i.selectAttribute(O.attrRef.entityId,O.attrRef.attrId,w)}else O.selectKind&&O.selectId&&(i.selection.value={kind:O.selectKind,id:O.selectId});O.focusId&&i.requestFocus(O.focusId)}function B(O){O.selectKind==="entity"&&O.selectId&&qa(a,i,O.selectId)}return(O,y)=>(t.openBlock(),t.createElementBlock("section",aM,[t.createElementVNode("div",rM,[t.createVNode(Ae,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":y[0]||(y[0]=w=>f.value=w),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:y[1]||(y[1]=t.withKeys(w=>f.value="",["esc"]))},null,40,lM),[[t.vModelText,f.value]]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:y[2]||(y[2]=w=>f.value="")},[t.createVNode(Ae,{name:"x",size:13})],8,sM)):t.createCommentVNode("",!0)]),T.value?(t.openBlock(),t.createElementBlock("p",cM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:N,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,w=>(t.openBlock(),t.createElementBlock("div",{key:w.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":x(w.node),"is-focus-parent":R(w.node),"is-selectable":!!w.node.selectKind||!!w.node.attrRef||!!w.node.focusId}]),"data-key":w.node.key,role:"treeitem","aria-level":w.depth+1,"aria-posinset":w.posinset,"aria-setsize":w.setsize,"aria-expanded":w.node.children.length?!E(w.node.key):void 0,"aria-selected":x(w.node),tabindex:w.node.key===_.value?0:-1,style:t.normalizeStyle({paddingLeft:4+w.depth*14+"px"}),onClick:v=>$(w.node,v),onDblclick:v=>B(w.node),onFocus:v=>b.value=w.node.key,onKeydown:v=>A(v,w)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!w.node.children.length,"is-open":!E(w.node.key)}]),onClick:t.withModifiers(v=>w.node.children.length&&t.unref(u)(w.node.key),["stop"])},[w.node.children.length?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,mM),w.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(w.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",pM,[w.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-pk"})):w.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",hM,[w.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,fM)):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",yM,t.toDisplayString(w.node.label),1),l(w.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",gM,t.toDisplayString(l(w.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,uM))),128))],8,dM)]))}}),[["__scopeId","data-v-e5303c65"]]),bM={class:"em-text-export"},_M=["id","aria-selected","tabindex","onClick"],kM=["aria-labelledby"],EM={class:"em-text-export__actions"},NM=Ke(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(m,p)=>Dt(n.locale??"ko",m,p),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var p,f;a.value=m,await t.nextTick(),(f=(p=l.value)==null?void 0:p.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const p=n.formats.length;p&&s((a.value+m+p)%p)}async function d(){try{await navigator.clipboard.writeText(r().content),ee.showNotification(i("em.export.copied"),"info")}catch{ee.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),p=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(p);try{const h=document.createElement("a");h.href=f,h.download=m.filename,document.body.appendChild(h),h.click(),h.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",bM,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,h)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${h}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":h===a.value}]),"aria-selected":h===a.value,"aria-controls":"em-text-export-panel",tabindex:h===a.value?0:-1,onClick:g=>a.value=h,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(g=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(g=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(g=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(g=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,_M))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,kM),t.createElementVNode("div",EM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),wM={class:"em-text-import"},IM=["aria-label"],vM=["aria-checked","tabindex","onClick"],xM=["placeholder"],CM={class:"em-text-import__status"},SM={class:"em-text-import__ok"},RM={key:0,class:"em-text-import__warn"},AM={key:1,class:"em-text-import__err"},$M={key:2,class:"em-text-import__err"},TM={key:3,class:"em-text-import__err"},MM={class:"em-text-import__actions"},VM=Ke(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(g,k)=>Dt(n.locale??"ko",g,k),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(g){var N,b;const k=l[(g+l.length)%l.length];k&&(r.value=k.key,await t.nextTick(),(b=(N=s.value)==null?void 0:N.querySelectorAll('[role="radio"]')[l.indexOf(k)])==null||b.focus())}function d(g){c(l.findIndex(k=>k.key===r.value)+g)}function u(g){return g?g.startsWith("{")?"json":/\berdiagram\b/i.test(g)?"mermaid":/\bcreate\s+table\b/i.test(g)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const g=a.value.trim();if(!g)return{status:"empty"};const k=m.value;if(!k)return{status:"unknown"};try{let N,b=[];return k==="json"?N=dc(g):k==="mermaid"?N=nc(g):(N=rc(g),b=Tr(g).warnings),N.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:N,warnings:b}}catch(N){return{status:"error",message:N instanceof Error?N.message:String(N)}}}),f=t.computed(()=>p.value.status==="ok");function h(){const g=p.value;g.status!=="ok"||!g.source||(n.onImport(g.source),o.close())}return(g,k)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",wM,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,N=>t.createElementVNode("button",{key:N.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":N.key===r.value}]),"aria-checked":N.key===r.value,tabindex:N.key===r.value?0:-1,onClick:b=>r.value=N.key,onKeydown:[k[0]||(k[0]=t.withKeys(t.withModifiers(b=>d(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(b=>d(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(b=>c(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(b=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(N.labelKey)),43,vM)),64))],8,IM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":k[4]||(k[4]=N=>a.value=N),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,xM),[[t.vModelText,a.value]]),t.createElementVNode("div",CM,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",SM,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:p.value.source.logical.entities.length,relations:p.value.source.logical.associations.length})),1),p.value.warnings&&p.value.warnings.length?(t.openBlock(),t.createElementBlock("span",RM," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:p.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):p.value.status==="error"?(t.openBlock(),t.createElementBlock("span",AM,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",$M,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",TM,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",MM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:h},null,8,["caption","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:k[5]||(k[5]=N=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),BM={class:"em-toolbar"},DM=["title"],OM={class:"em-toolbar__mode"},fh=Ke(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=ee.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:h=>i.displayMode.value=h});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const h=i.resolved.value.entities;return h.length>0&&h.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const h=Ks(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:NM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Fs(h,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Ir(h,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Ir(h,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:lc(h,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:cc(h,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:VM,bind:{locale:i.uiLocale.value,onImport:h=>{i.importEntities(h,h.logical.entities.map(g=>g.modelId))}}})}function f(){r.openModal({component:dh,bind:{locale:i.uiLocale.value}})}return(h,g)=>(t.openBlock(),t.createElementBlock("div",BM,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,DM)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:g[0]||(g[0]=k=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:g[1]||(g[1]=k=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",OM,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(ee.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=k=>s.value=k),items:l,"value-provider":k=>k.v,"label-provider":k=>t.unref(i).t(k.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=k=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=k=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(Ae,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:p},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=k=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=k=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"camera",size:16})]),_:1},8,["tooltip"]),g[11]||(g[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=k=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),g[8]||(g[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),LM=["title"],PM=["title"],zM=["disabled","aria-pressed"],FM=["disabled","aria-pressed"],UM=Ke(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>Dt(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode(Ae,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,LM)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode(Ae,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,zM),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode(Ae,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,FM)],10,PM))}}),[["__scopeId","data-v-2b5162b7"]]),HM=["disabled"],jM={class:"em-panel__sub"},KM={class:"em-nav"},GM={key:0,class:"em-nav__divider","aria-hidden":"true"},YM={key:1},qM=["onClick","onKeydown"],WM={class:"em-nav__name"},JM=["title"],XM={key:0,class:"em-panel__note"},ZM=["data-attr-block"],QM={class:"em-attr__row"},e2=["title"],t2={key:0,class:"em-attr__row"},n2={key:1,class:"em-attr__navhint"},o2={key:0,class:"em-attr__navhint"},i2={class:"em-attr__row"},a2={class:"em-attr__row"},r2=["title"],l2={class:"em-attr__flags"},s2={class:"em-attr__pii"},c2={class:"em-attr__pii"},d2={key:1,class:"em-attr__pii"},u2={key:2,class:"em-attr__pii em-attr__codetop"},m2={class:"em-multilang"},f2={key:3,class:"em-embed-cols"},p2={class:"em-embed-col__label"},h2={class:"em-attr__row"},y2=["title"],g2=["title"],b2=["title"],_2={class:"em-attr__row"},k2={key:0,class:"em-embed-upd"},E2={key:1,class:"em-attr__navhint"},N2={class:"em-embed-upd"},w2={class:"em-embed-upd"},I2={class:"em-swatch__row em-attr__swatch"},v2=["title","onClick"],x2=["title","onClick"],C2={key:0,class:"em-attr__swatch-hint"},S2=Ke(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:p,setTransient:f,dbLocked:h,fkDerived:g,fkOriginPhysical:k,typeValueOf:N,typeLabelOf:b,setAttrType:_,setAttrCustomType:E,setDb:I,scaleApplicable:A,scaleHint:T,setDbLogical:L,setAttrDescription:x,attrPiiValue:R,setAttrPii:$,predefinedCustomTypeCatalog:B,embeddableCatalog:O,predefinedLabel:y,groupCodeCatalog:w,attrGroupCodes:v,attrCodeItems:M,codeValueOf:D,codeLabelOf:U,setAttrGroupCode:W,setAttrCode:ie,setAttrDefaultValue:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:z,insertableItems:P,insertableLabel:F,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:Y,isShared:j,sharedPhysical:J}=yf(o,()=>n.entityId),ve=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Le=>Le.entityRef===i.value.modelId)??null:null),Te=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes.filter(De=>De.attrType!=="DIVIDER"))??[]}),K=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes)??[]}),te=t.computed(()=>Te.value.filter(Le=>r.value.has(Le.modelId)));function G(Le){return{pk:Le.identifier,fk:Le.attrType.startsWith("RELATION")&&Le.dbAttrs.length>0,required:Le.notNull&&!Le.identifier}}function ae(Le){const De=G(Le),Z=[De.pk&&"PK",De.fk&&"FK",De.required&&"NOT NULL"].filter(Boolean);return Z.length?Z.join(" · "):void 0}function Be(Le,De){i.value&&o.selectAttribute(i.value.modelId,Le.modelId,De.shiftKey?"range":De.metaKey||De.ctrlKey?"toggle":"replace")}function Ve(Le){var De,Z;return _t((Z=(De=ve.value)==null?void 0:De.attributeStyles)==null?void 0:Z[Le.modelId])}function H(Le){return r.value.size>1&&r.value.has(Le.modelId)}function V(Le,De){if(!i.value)return;const Z=H(Le)?o.selectedAttrIds.value:[Le.modelId];o.setAttributeSwatches(i.value.modelId,Z,De)}const Pe=t.ref(void 0);function Ze(Le){if(!Le||!i.value)return;const De=o.addPredefinedEmbed(i.value.modelId,Le);De&&o.selectAttribute(i.value.modelId,De),Pe.value=void 0}function Ue(){if(!i.value)return;const Le=o.addAttribute(i.value.modelId);Le&&o.selectAttribute(i.value.modelId,Le)}return(Le,De)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",jM,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value.length}))+" ",1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ue},null,8,["caption"]),t.unref(O).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":Pe.value,items:t.unref(O),"value-provider":Z=>Z.type,"label-provider":t.unref(y),"onUpdate:modelValue":Ze},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",KM,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(K.value,Z=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[Z.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",GM,[...De[0]||(De[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",YM,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Z.modelId)}]),role:"button",tabindex:"0",onClick:dt=>Be(Z,dt),onKeydown:[t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["space"])]},[t.createElementVNode("span",WM,t.toDisplayString(Z.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:ae(Z)},[G(Z).pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):G(Z).required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),G(Z).fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,JM)],42,qM)]))],64))),128))]),Te.value.length&&!te.value.length?(t.openBlock(),t.createElementBlock("p",XM,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.value,Z=>{var dt,yn,Et,gn,Ee,at,zt,ut,Qt,en;return t.openBlock(),t.createElementBlock("div",{key:Z.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(Z.modelId)}]),"data-attr-block":Z.modelId},[t.createElementVNode("div",QM,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-name-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":Z.name,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{name:Ne})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-type-${Z.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Z.attrType.startsWith("EMBED")||!!Z.groupCode||Z.attrType==="RELATION_REF"||t.unref(g)(Z),items:t.unref(ec)(Z.type,t.unref(B)),"value-provider":t.unref(N),"label-provider":t.unref(b),"model-value":Z.type,"onUpdate:modelValue":Ne=>t.unref(_)(Z,Ne)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(u)(Z)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ne=>t.unref(o).removeAttribute(t.unref(i).modelId,Z.modelId)},null,8,["onClick"])],8,e2)]),Z.type===t.unref(tn)&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("div",t2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-customtype-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Z.customType??"","onUpdate:modelValue":Ne=>t.unref(E)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",n2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ye)(Z)?(t.openBlock(),t.createElementBlock("div",f2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.dbAttrs,(Ne,et)=>{var Ft,pt,nt,Fo,Uo,Ho,C,S;return t.openBlock(),t.createElementBlock("div",{key:Ne.modelId,class:"em-embed-col"},[t.createElementVNode("span",p2,t.toDisplayString(((Ft=t.unref(se)(Z,et))==null?void 0:Ft.name)??((pt=t.unref(se)(Z,et))==null?void 0:pt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:et+1})),1),t.createElementVNode("div",h2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`embed-col-${Ne.modelId}`,width:"100%",disabled:t.unref(j)(Ne),placeholder:((nt=t.unref(se)(Z,et))==null?void 0:nt.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(j)(Ne)?t.unref(J)(Ne):Ne.physicalName,"onUpdate:modelValue":q=>t.unref(ge)(Z,et,{physicalName:q})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSTextInput),{name:`embed-dtype-${Ne.modelId}`,width:"84px",disabled:"","model-value":t.unref(ke)(Z,et)},null,8,["name","model-value"])],8,y2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-len-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(Se)(Z,et)},null,8,["name","model-value"])],8,g2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-scale-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ce)(Z,et)},null,8,["name","model-value"])],8,b2)]),t.createVNode(to,{controller:t.unref(o),"ref-id":Ne.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",_2,[t.createVNode(dn,{class:"grow",name:`embed-logical-${Ne.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Uo=(Fo=t.unref(se)(Z,et))==null?void 0:Fo.logicalName)==null?void 0:Uo[t.unref(o).userLanguage.value])??((C=(Ho=t.unref(se)(Z,et))==null?void 0:Ho.logicalName)==null?void 0:C.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ne.logicalName,"onUpdate:modelValue":q=>t.unref(me)(Z,et,q)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(S=t.unref(se)(Z,et))!=null&&S.shareable?(t.openBlock(),t.createElementBlock("label",k2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"110px","model-value":t.unref(Ie)(Ne),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":q=>q&&t.unref(Y)(Z,et,q)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(j)(Ne)?(t.openBlock(),t.createElementBlock("p",E2,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",N2,[De[3]||(De[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ne),"model-value":t.unref(j)(Ne)?"false":t.unref(Q)(Ne),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":q=>q&&t.unref(X)(Z,et,q)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",w2,[De[4]||(De[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ne),"model-value":t.unref(j)(Ne)?"false":t.unref(le)(Ne),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":q=>q&&t.unref(ue)(Z,et,q)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("p",o2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",i2,[t.createVNode(dn,{class:"grow",name:`attr-logical-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(dt=Z.dbAttrs[0])==null?void 0:dt.logicalName,"onUpdate:modelValue":Ne=>t.unref(L)(Z,Ne)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",a2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(k)(Z)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(h)(Z),"model-value":((yn=Z.dbAttrs[0])==null?void 0:yn.physicalName)??"","onUpdate:modelValue":Ne=>t.unref(I)(Z,{physicalName:Ne})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-dtype-${Z.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(h)(Z)||t.unref(g)(Z),items:t.unref(Xs)(((Et=Z.dbAttrs[0])==null?void 0:Et.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Cr),"model-value":((gn=Z.dbAttrs[0])==null?void 0:gn.dataType)??"","onUpdate:modelValue":Ne=>Ne&&t.unref(I)(Z,{dataType:Ne})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-len-${Z.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(h)(Z)||t.unref(g)(Z),"model-value":(Ee=Z.dbAttrs[0])==null?void 0:Ee.length,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{length:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(T)(Z)},[t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-scale-${Z.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(h)(Z)||t.unref(g)(Z)||!t.unref(A)(Z),"model-value":(at=Z.dbAttrs[0])==null?void 0:at.scale,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{scale:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,r2)]),t.createVNode(to,{controller:t.unref(o),"ref-id":(zt=Z.dbAttrs[0])==null?void 0:zt.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",l2,[t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:t.unref(a)||t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(p)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(d)(Z,{notNull:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-uq-${Z.modelId}`,label:"Unique","model-value":!!((ut=Z.dbAttrs[0])!=null&&ut.unique),disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{unique:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-ai-${Z.modelId}`,label:"Auto Increment","model-value":!!((Qt=Z.dbAttrs[0])!=null&&Qt.autoIncrement),disabled:t.unref(h)(Z)||t.unref(g)(Z)||!Z.identifier,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{autoIncrement:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-tr-${Z.modelId}`,label:"@Transient","model-value":!!Z.transient,disabled:Z.identifier||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(f)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(m)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Z.modelId}`,label:"mutable","model-value":!!Z.naturalIdMutable,disabled:t.unref(h)(Z)||!Z.naturalId,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{naturalIdMutable:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-mv-${Z.modelId}`,label:"Multi-Value (Set)","model-value":!!((en=Z.dbAttrs[0])!=null&&en.multiValue),disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{multiValue:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",s2,[De[1]||(De[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(h)(Z),"model-value":t.unref(Q)(Z.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ne=>Ne&&t.unref(_e)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",c2,[De[2]||(De[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(h)(Z),"model-value":t.unref(le)(Z.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ne=>Ne&&t.unref(z)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",d2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":t.unref(R)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ne=>Ne&&t.unref($)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(w).length&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("label",u2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Ef,{"model-value":Z.groupCode,items:t.unref(w),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ne=>t.unref(W)(Z,Ne)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(w).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(v)(Z).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"100%","model-value":Z.defaultValue??"none",items:t.unref(M)(Z),"value-provider":t.unref(D),"label-provider":t.unref(U),"onUpdate:modelValue":Ne=>Ne&&t.unref(ie)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`attr-default-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Z.defaultValue??"","onUpdate:modelValue":Ne=>t.unref(pe)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",m2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`attr-desc-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Z.description,"onUpdate:modelValue":Ne=>t.unref(x)(Z,Ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",I2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ve(Z)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:Ne=>V(Z,null)},"∅",10,v2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),Ne=>(t.openBlock(),t.createElementBlock("button",{key:Ne,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ve(Z)===Ne}]),style:t.normalizeStyle({background:t.unref(To)(Ne)}),title:t.unref(o).t(t.unref(eo)(Ne)),onClick:et=>V(Z,Ne)},null,14,x2))),128)),H(Z)?(t.openBlock(),t.createElementBlock("span",C2,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,ZM)}),128))],8,HM)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-2c47fef2"]]),R2=["disabled"],A2={class:"em-panel__sub-label"},$2={class:"em-attr__row"},T2={class:"em-field em-idx-params"},M2=["value","placeholder","onChange"],V2=Ke(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(I=>I.modelId===o.entityId)??null),l=t.computed(()=>r.value?jo(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var I;return Tn(((I=r.value)==null?void 0:I.attributes)??[])}),c=I=>s.value.canon(I),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>{var I;return[...(((I=r.value)==null?void 0:I.attributes)??[]).filter(A=>A.dbAttrs.length>0).map(A=>({value:A.modelId,label:If(A,d.value)})),...l.value.map(A=>({value:A.modelId,label:a.t("em.index.inherited",{field:A.field})}))]});function m(I,A){var R;const T=new Set(I.columns.filter(($,B)=>B!==A).map($=>c($.columnRef))),L=u.value.filter($=>!T.has(c($.value))),x=(R=I.columns[A])==null?void 0:R.columnRef;return x&&!L.some($=>$.value===x)&&L.push({value:x,label:p(x)}),L}function p(I){return vf(I,d.value)}function f(I){const A=new Set(I.columns.map(T=>c(T.columnRef)));return u.value.filter(T=>!A.has(c(T.value)))}function h(){var A;if(!r.value)return;const I=u.value[0];a.addIndex(r.value.modelId,{modelId:Me(),name:`idx_${(((A=r.value.indexes)==null?void 0:A.length)??0)+1}`,unique:!1,columns:I?[{columnRef:I.value,descending:!1}]:[]})}function g(I,A){r.value&&a.updateIndex(r.value.modelId,I,A)}function k(I){const A=f(I)[0];A&&g(I.modelId,{columns:[...I.columns,{columnRef:A.value,descending:!1}]})}function N(I,A,T){g(I.modelId,{columns:I.columns.map((L,x)=>x===A?{...L,columnRef:T}:L)})}function b(I,A,T){g(I.modelId,{columns:I.columns.map((L,x)=>x===A?{...L,descending:T}:L)})}function _(I,A){g(I.modelId,{columns:I.columns.filter((T,L)=>L!==A)})}function E(I,A){g(I.modelId,{parameters:A.trim()===""?void 0:A})}return(I,A)=>{var T;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:A[0]||(A[0]=L=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",A2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:((T=r.value.indexes)==null?void 0:T.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(h,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],L=>(t.openBlock(),t.createElementBlock("div",{key:L.modelId,class:"em-attr"},[t.createElementVNode("div",$2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`idx-name-${L.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":L.name,"onUpdate:modelValue":x=>g(L.modelId,{name:x})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-uq-${L.modelId}`,class:"em-check",label:"UQ","model-value":L.unique,"onUpdate:modelValue":x=>g(L.modelId,{unique:x})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:x=>t.unref(a).removeIndex(r.value.modelId,L.modelId)},null,8,["onClick"])]),t.createVNode(to,{controller:t.unref(a),"ref-id":L.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(L.columns,(x,R)=>(t.openBlock(),t.createElementBlock("div",{key:R,class:"em-attr__row"},[t.createVNode(t.unref(ee.BSSelect),{class:"grow","model-value":x.columnRef,items:m(L,R),"value-provider":$=>$.value,"label-provider":$=>$.label,"onUpdate:modelValue":$=>$&&N(L,R,$)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-${L.modelId}-desc-${R}`,class:"em-check",label:"DESC","model-value":x.descending,"onUpdate:modelValue":$=>b(L,R,$)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:"−",onClick:$=>_(L,R)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(L).length,onClick:x=>k(L)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",T2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:L.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:x=>E(L,x.target.value)},null,40,M2)])]))),128)):t.createCommentVNode("",!0)],8,R2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),B2=["disabled"],D2={class:"em-panel__sub-label"},O2={class:"em-attr__row"},L2={class:"em-attr__row"},P2={class:"em-multilang"},z2={class:"em-attr__pii"},F2={class:"em-swatch__row em-attr__swatch"},U2=["title","onClick"],H2=["title","onClick"],j2=Ke(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=ee.useModal(),l=t.computed(()=>a.state.logical.entities.find(_=>_.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(_=>_.entityRef===l.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(_){return _==="none"?a.t("em.common.noneParen"):_}const m=_=>_;function p(_,E){l.value&&a.updateOperation(l.value.modelId,_.modelId,E)}function f(_,E){p(_,{description:Object.keys(E).length?E:void 0})}function h(_){return _.personalInfoAttributeType??"none"}function g(_,E){p(_,{personalInfoAttributeType:E==="none"?void 0:E})}function k(_){var E,I;return _t((I=(E=s.value)==null?void 0:E.operationStyles)==null?void 0:I[_.modelId])}function N(_,E){l.value&&a.setOperationSwatch(l.value.modelId,_.modelId,E)}function b(_){r.openModal({component:xf,bind:{operationName:_.name,sourceCode:_.sourceCode??"",locale:a.uiLocale.value,onSave:E=>p(_,{sourceCode:E})}})}return(_,E)=>{var I;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:E[1]||(E[1]=A=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",D2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((I=l.value.operations)==null?void 0:I.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:E[0]||(E[0]=t.withModifiers(A=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],A=>(t.openBlock(),t.createElementBlock("div",{key:A.modelId,class:"em-attr"},[t.createElementVNode("div",O2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":T=>p(A,{name:T})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":T=>T&&p(A,{visibility:T})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:T=>t.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),t.createElementVNode("div",L2,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:T=>b(A)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",P2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`op-desc-${A.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":T=>f(A,T)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",z2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":h(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":T=>T&&g(A,T)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",F2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":k(A)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:T=>N(A,null)},"∅",10,U2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),T=>(t.openBlock(),t.createElementBlock("button",{key:T,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":k(A)===T}]),style:t.normalizeStyle({background:t.unref(To)(T)}),title:t.unref(a).t(t.unref(eo)(T)),onClick:L=>N(A,T)},null,14,H2))),128))])]))),128)):t.createCommentVNode("",!0)],8,B2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),K2=["title"],G2={class:"em-panel__head"},Y2={class:"em-panel__head-row"},q2=["title"],W2={class:"em-panel__context"},J2={key:0,class:"em-panel__lock"},X2=["disabled"],Z2={key:0,class:"em-panel__note"},Q2={key:1,class:"em-panel__note"},eV={key:2,class:"em-jpa"},tV={class:"em-field"},nV={class:"em-field"},oV={class:"em-field"},iV={key:0,class:"em-field"},aV={class:"em-panel__note"},rV={class:"em-panel__sub"},lV={class:"em-field"},sV={class:"em-field"},cV={class:"em-jpa"},dV={key:0,class:"em-panel__note"},uV={key:1,class:"em-panel__note"},mV={class:"em-jpa"},fV={class:"em-field"},pV={key:0,class:"em-panel__note"},hV={class:"em-field"},yV={class:"em-multilang"},gV={class:"em-field"},bV=["value"],_V={class:"em-field"},kV={class:"em-swatch"},EV={class:"em-swatch__row"},NV=["title"],wV=["title","onClick"],IV={class:"em-panel__note"},vV={class:"em-field"},xV=["value"],CV={class:"em-swatch"},SV={class:"em-swatch__row"},RV=["title"],AV=["title","onClick"],ph=Ke(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var Y;return(Y=r.value)==null?void 0:Y.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const Y=c.value;return Y?l.state.logical.entities.find(j=>j.modelId===Y)??null:null}),u=t.computed(()=>{const Y=s.value;if((Y==null?void 0:Y.kind)==="association")return l.isAssociationLocked(Y.id);const j=c.value;return!!j&&l.isEntityLocked(j)}),m=t.computed(()=>{var Y;return((Y=l.selectedAttr.value)==null?void 0:Y.attrId)??null}),p=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),h=t.ref({});t.watch(f,()=>{h.value={}});function g(Y){return h.value[Y]??f.value}function k(Y){h.value={...h.value,[Y]:!g(Y)}}const N=t.computed(()=>{var J;const Y=d.value;if(!Y)return l.t("em.entity.fallback");const j=(J=Y.table)==null?void 0:J.physicalName;return j?`${Y.name} (${j})`:Y.name}),b=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="association"?l.state.logical.associations.find(j=>j.modelId===Y.id)??null:null}),_=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="group"?l.state.logical.groups.find(j=>j.modelId===Y.id)??null:null}),E=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="note"?l.state.layout.notes.find(j=>j.modelId===Y.id)??null:null}),I=t.computed(()=>{var j,J;const Y=(j=_.value)==null?void 0:j.name;return(Y==null?void 0:Y[l.userLanguage.value])||(Y==null?void 0:Y.ko)||(Y==null?void 0:Y.en)||(Y==null?void 0:Y.ja)||(Y==null?void 0:Y.zh)||((J=_.value)==null?void 0:J.packageName)||l.t("em.group.fallback")}),A=t.computed(()=>{if(d.value){const Y=p.value.size;if(Y>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:Y});if(m.value){const j=d.value.attributes.find(J=>J.modelId===m.value);return(j==null?void 0:j.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(j==null?void 0:j.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(b.value){const Y=j=>{var J;return((J=l.state.logical.entities.find(ve=>ve.modelId===j))==null?void 0:J.name)??j};return l.t("em.inspector.ctxAssoc",{a:Y(b.value.end1.entityRef),b:Y(b.value.end2.entityRef)})}return _.value?l.t("em.inspector.ctxGroup",{name:I.value}):E.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),T=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],L=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],x={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},R=Y=>{const j=x[Y];return j?l.t(j):Y},$=Y=>{var j;return((j=l.state.logical.entities.find(J=>J.modelId===Y))==null?void 0:j.name)??Y},B=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],O=["LIST","SET"],y=["inherit","LAZY","EAGER"],w=Y=>Y;function v(Y){return Y==="inherit"?l.t("em.common.inherit"):Y}const M=t.computed(()=>!!b.value&&b.value.end1.entityRef===b.value.end2.entityRef);function D(Y,j){b.value&&l.updateAssociationEnd(b.value.modelId,Y,j)}function U(Y){return oe.value?Y:Y==="end1"?"end2":"end1"}function W(Y){var Te;const j=(Te=b.value)==null?void 0:Te[Y];if(!(j!=null&&j.attributeRef))return;const J=l.state.logical.entities.find(K=>K.modelId===j.entityRef),ve=J==null?void 0:J.attributes.find(K=>K.modelId===j.attributeRef);return ve&&(ve.attrType==="RELATION_OWN"||ve.attrType==="RELATION_REF")?ve.name:void 0}function ie(Y,j){var ve;const J=(ve=b.value)==null?void 0:ve[Y];J!=null&&J.attributeRef&&l.updateAttribute(J.entityRef,J.attributeRef,{name:j})}function pe(Y){var K;const j=W(Y);if(j!==void 0)return j;const J=(K=b.value)==null?void 0:K[Y];if(J!=null&&J.navFieldNameHint)return J.navFieldNameHint;const ve=Y==="end1"?"end2":"end1",Te=l.state.logical.entities.find(te=>{var G;return te.modelId===((G=b.value)==null?void 0:G[ve].entityRef)});return Te?ji(Te.name,Ui(b.value[ve].multiplicity)):""}function ye(Y){return!!oe.value||W(Y)!==void 0}function ge(Y){b.value&&!M.value&&l.setAssociationIdentifying(b.value.modelId,Y)}function me(Y){var j,J,ve;return!!((ve=(J=(j=b.value)==null?void 0:j[Y].jpa)==null?void 0:J.cascadeTypes)!=null&&ve.includes("ALL"))}function se(Y,j,J){var K,te;const ve=(K=b.value)==null?void 0:K[Y];if(j==="ALL"&&J){D(Y,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:["ALL"]}});return}const Te=new Set(((te=ve==null?void 0:ve.jpa)==null?void 0:te.cascadeTypes)??[]);J?Te.add(j):Te.delete(j),D(Y,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:[...Te]}})}function ke(Y,j){var ve;const J=(ve=b.value)==null?void 0:ve[Y];D(Y,{jpa:{...J==null?void 0:J.jpa,...j}})}function Se(Y){var j,J;return((J=(j=b.value)==null?void 0:j[Y].jpa)==null?void 0:J.fetchType)??"inherit"}function ce(Y,j){ke(Y,{fetchType:j==="inherit"?void 0:j})}function fe(Y){var J;const j=(J=b.value)==null?void 0:J[Y==="end1"?"end2":"end1"];return(j==null?void 0:j.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(j==null?void 0:j.multiplicity)==="ONE_OR_MORE_INSTANCES"}const oe=t.computed(()=>{const Y=b.value;if(!Y)return null;for(const j of l.state.logical.entities){const J=j.attributes.find(te=>{var G;return((G=te.embedded)==null?void 0:G.associationRef)===Y.modelId&&te.attrType==="EMBED_OWN"});if(!J)continue;const ve=Y.end2.entityRef===J.embedded.embeddableRef?"end2":"end1",Te=Y[ve].multiplicity,K=Y[ve].jpa;return{which:ve,cardinality:Te,isCollection:Te==="ZERO_OR_MORE_INSTANCES"||Te==="ONE_OR_MORE_INSTANCES",collectionType:(K==null?void 0:K.collectionType)??"LIST",collectionTable:(K==null?void 0:K.collectionTable)??"",orderColumn:(K==null?void 0:K.orderColumn)??""}}return null});function le(Y){b.value&&l.setEmbedCardinality(b.value.modelId,Y)}function ue(Y){const j=oe.value;j&&ke(j.which,Y==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function z(Y){const j=oe.value;j&&ke(j.which,{collectionTable:Y.trim()||void 0})}function P(Y){const j=oe.value;j&&ke(j.which,{orderColumn:Y.trim()||void 0})}function F(Y){_.value&&l.updateGroup(_.value.modelId,Y)}function Q(Y,j){var J;F({name:{...(J=_.value)==null?void 0:J.name,[Y]:j}})}const X=t.computed(()=>{var Y;return _.value?_t((Y=l.state.layout.groupLayouts.find(j=>j.groupRef===_.value.modelId))==null?void 0:Y.style):null});function _e(Y){_.value&&l.setGroupSwatch(_.value.modelId,Y)}function he(Y){E.value&&l.setNoteMemo(E.value.modelId,Y)}const we=t.computed(()=>{var Y;return _t((Y=E.value)==null?void 0:Y.style)});function Ie(Y){E.value&&l.setNoteSwatch(E.value.modelId,Y)}return(Y,j)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:j[0]||(j[0]=(...J)=>e.startResize&&e.startResize(...J))},null,42,K2),t.createElementVNode("header",G2,[t.createElementVNode("div",Y2,[j[14]||(j[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:j[1]||(j[1]=J=>a("collapse"))},[t.createVNode(Ae,{name:"panel-right-close",size:16})],8,q2)]),t.createElementVNode("p",W2,t.toDisplayString(A.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",J2,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:j[2]||(j[2]=J=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(pf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("basics"),title:N.value,onToggle:j[3]||(j[3]=J=>k("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(S2,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(V2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("index"),onToggle:j[4]||(j[4]=J=>k("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(j2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("ops"),onToggle:j[5]||(j[5]=J=>k("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!b.value.identifying,disabled:M.value||!!oe.value,"onUpdate:modelValue":ge},null,8,["label","model-value","disabled"]),M.value?(t.openBlock(),t.createElementBlock("p",Z2,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):oe.value?(t.openBlock(),t.createElementBlock("p",Q2,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("fieldset",eV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",tV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.cardinality,items:L,"value-provider":w,"label-provider":R,"onUpdate:modelValue":j[6]||(j[6]=J=>J&&le(J))},null,8,["model-value"])]),oe.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",nV,[j[15]||(j[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.collectionType,items:O,"value-provider":w,"label-provider":w,"onUpdate:modelValue":j[7]||(j[7]=J=>J&&ue(J))},null,8,["model-value"])]),t.createElementVNode("label",oV,[j[16]||(j[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":oe.value.collectionTable,"onUpdate:modelValue":z},null,8,["placeholder","model-value"])]),oe.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",iV,[j[17]||(j[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":oe.value.orderColumn,"onUpdate:modelValue":P},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",aV,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],J=>{var ve,Te,K;return t.withDirectives(t.createElementVNode("div",{key:J,class:"em-end"},[t.createElementVNode("h4",rV,t.toDisplayString(J)+" → "+t.toDisplayString($(b.value[J].entityRef)),1),oe.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",lV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":b.value[J].multiplicity,items:T,"value-provider":w,"label-provider":t.unref(Hi),"onUpdate:modelValue":te=>D(J,{multiplicity:te})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-navigable`,class:"em-check",label:"navigable",title:U(J)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:U(J)==="end2","model-value":U(J)==="end2"?!0:b.value[U(J)].navigable,"onUpdate:modelValue":te=>D(U(J),{navigable:te})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",sV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(ee.BSTextInput),{name:`${U(J)}-navname`,width:"100%",disabled:!ye(U(J)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":pe(U(J)),"onUpdate:modelValue":te=>ie(U(J),te)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-composition`,class:"em-check",label:"composition","model-value":b.value[U(J)].composition,"onUpdate:modelValue":te=>D(U(J),{composition:te})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",cV,[j[18]||(j[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(B,te=>{var G,ae;return t.createVNode(t.unref(ee.BSCheckbox),{key:te,name:`${U(J)}-cascade-${te}`,class:"em-check",label:te,"model-value":!!((ae=(G=b.value[U(J)].jpa)==null?void 0:G.cascadeTypes)!=null&&ae.includes(te)),disabled:!ye(U(J))||te!=="ALL"&&me(U(J)),"onUpdate:modelValue":Be=>se(U(J),te,Be)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ye(U(J))?me(U(J))?(t.openBlock(),t.createElementBlock("p",uV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",dV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",mV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",fV,[j[19]||(j[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(ee.BSSelect),{disabled:!ye(U(J)),"model-value":Se(U(J)),items:y,"value-provider":w,"label-provider":v,"onUpdate:modelValue":te=>te&&ce(U(J),te)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((ve=b.value[U(J)].jpa)!=null&&ve.orphanRemoval),disabled:!ye(U(J))||fe(J),"onUpdate:modelValue":te=>ke(U(J),{orphanRemoval:te})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),fe(J)&&((Te=b.value[U(J)].jpa)!=null&&Te.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",pV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",hV,[j[20]||(j[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:`${U(J)}-orderby`,width:"100%",disabled:!ye(U(J)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((K=b.value[U(J)].jpa)==null?void 0:K.orderBy)??"","onUpdate:modelValue":te=>ke(U(J),{orderBy:te.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!oe.value||J===oe.value.which]])}),64))],64)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",yV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,J=>{var ve;return t.openBlock(),t.createElementBlock("label",{key:J,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(J),1),t.createVNode(t.unref(ee.BSTextInput),{name:`grp-name-${J}`,width:"100%","model-value":((ve=_.value.name)==null?void 0:ve[J])??"","onUpdate:modelValue":Te=>Q(J,Te)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",gV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:j[8]||(j[8]=J=>F({description:J.target.value}))},null,40,bV)]),t.createElementVNode("label",_V,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":j[9]||(j[9]=J=>F({packageName:J}))},null,8,["model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":j[10]||(j[10]=J=>F({excludeDDLGeneration:J}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",kV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",EV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":X.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:j[11]||(j[11]=J=>_e(null))},"∅",10,NV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":X.value===J}]),style:t.normalizeStyle({background:t.unref(To)(J)}),title:t.unref(l).t(t.unref(eo)(J)),onClick:ve=>_e(J)},null,14,wV))),128))])]),t.createElementVNode("p",IV,t.toDisplayString(t.unref(l).t("em.group.members",{n:_.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",vV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:E.value.memo,rows:"6",onChange:j[12]||(j[12]=J=>he(J.target.value))},null,40,xV)]),t.createElementVNode("fieldset",CV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",SV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":we.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:j[13]||(j[13]=J=>Ie(null))},"∅",10,RV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":we.value===J}]),style:t.normalizeStyle({background:t.unref(To)(J)}),title:t.unref(l).t(t.unref(eo)(J)),onClick:ve=>Ie(J)},null,14,AV))),128))])])],64)):t.createCommentVNode("",!0)],8,X2)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),$V=["title"],TV={class:"em-validation__title"},MV=["title","onClick"],VV={key:0,class:"em-validation__body"},BV={class:"em-validation__opt"},DV={key:0,class:"em-validation__empty"},OV={key:1,class:"em-validation__empty"},LV={key:2,class:"em-validation__list"},PV=["onClick"],zV={class:"em-validation__item-msg"},FV={key:0,class:"em-validation__item-entity"},UV=["title","onClick"],HV=["title"],jV=Ke(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const g=new Map;for(const k of o.state.logical.entities)g.set(k.modelId,k.name);return g});function r(g){const k=Cw(g);if(!k)return null;const N=a.value.get(k);return N===void 0?null:N.trim()===""?o.t("em.validation.nameless"):N}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const g={error:0,warning:0,info:0};for(const k of i.value)g[k.severity]++;return g}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,k)=>l[g.severity].order-l[k.severity].order)),u=t.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:ff(o.t,g),category:vw(o.t,g.ruleId)}))),m=t.ref(!1);function p(g){c.value[g]=!c.value[g]}function f(g){if(!m.value){m.value=!0;return}p(g)}function h(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,k)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:k[1]||(k[1]=N=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Ae,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",TV,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,$V),t.createElementVNode("div",{class:"em-validation__counts",onClick:k[0]||(k[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],N=>t.createElementVNode("button",{key:N,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${N}`,{"is-off":!c.value[N]}]]),title:m.value?t.unref(o).t(c.value[N]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[N].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:b=>f(N)},[t.createVNode(Ae,{name:l[N].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[N]),1)],10,MV)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",VV,[t.createElementVNode("label",BV,[t.createVNode(t.unref(ee.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":k[2]||(k[2]=N=>t.unref(o).flagEntitiesWithoutRelations.value=N)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",DV,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",OV,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",LV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:N,entityName:b,message:_,category:E},I)=>(t.openBlock(),t.createElementBlock("li",{key:`${N.ruleId}:${N.targetRef??"model"}:${I}`,class:t.normalizeClass(["em-validation__item",[`is-${N.severity}`,{"is-clickable":!!N.targetRef}]]),onClick:A=>h(N)},[t.createVNode(Ae,{name:l[N.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",zV,[b?(t.openBlock(),t.createElementBlock("span",FV,t.toDisplayString(b),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(_),1)]),t.unref(o).hasQuickFix(N)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers(A=>t.unref(o).applyQuickFix(N),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,UV)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:N.ruleId},t.toDisplayString(E),9,HV)],10,PV))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),KV={class:"em-history"},GV={class:"em-history__head"},YV={class:"em-history__title"},qV={class:"em-history__head-actions"},WV=["title","disabled"],JV=["title"],XV={class:"em-history__filters"},ZV={class:"em-history__filter"},QV={class:"em-history__filters em-history__filters--period"},eB={class:"em-history__filter-label"},tB=["title","aria-label","max"],nB=["title","aria-label","min"],oB=["title"],iB={key:0,class:"em-history__diffbar"},aB={class:"em-history__diffbar-range"},rB={class:"em-history__diffbar-count"},lB={class:"em-history__body"},sB={key:0,class:"em-history__empty"},cB={key:1,class:"em-history__diff-list"},dB=["onClick"],uB={class:"em-history__action-head"},mB={class:"em-history__action-name"},fB={key:0,class:"em-history__fields"},pB={class:"em-history__fname"},hB={key:0,class:"em-history__old"},yB={class:"em-history__val"},gB={key:1,class:"em-history__empty"},bB={key:2,class:"em-history__empty is-error"},_B={key:3,class:"em-history__empty"},kB={key:4,class:"em-history__list"},EB=["onClick"],NB={class:"em-history__summary"},wB={class:"em-history__seq"},IB={class:"em-history__gmeta"},vB={class:"em-history__who"},xB={key:0,class:"em-history__time"},CB={key:1,class:"em-history__restored-from"},SB=["onClick"],RB={key:0,class:"em-history__detail"},AB={class:"em-history__action-head"},$B={class:"em-history__action-name"},TB={key:0,class:"em-history__fields"},MB={class:"em-history__fname"},VB={key:0,class:"em-history__old"},BB={class:"em-history__val"},DB={class:"em-history__preview"},OB=["disabled"],LB={key:0,class:"em-history__diff-list is-preview"},PB={class:"em-history__action-head"},zB={class:"em-history__action-name"},FB={key:0,class:"em-history__fields"},UB={class:"em-history__fname"},HB={key:0,class:"em-history__old"},jB={class:"em-history__val"},KB={class:"em-history__confirm-row"},GB={class:"em-history__confirm-msg"},YB=["disabled","onClick"],qB=["disabled"],WB=["onClick"],_r=50,JB=Ke(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((G,ae)=>ae.seq>G?ae.seq:G,-1/0));async function u(G){if(a.historyTransport){l.value=!0,s.value=null;try{const ae=!(G!=null&&G.full)&&r.value.length>0&&Number.isFinite(d.value),Be=await a.historyTransport(ae?d.value:void 0);if(!ae)r.value=Be;else if(Be.length){const Ve=new Set(r.value.map(V=>V.seq)),H=Be.filter(V=>!Ve.has(V.seq));H.length&&(r.value=[...r.value,...H])}c.value=!0}catch(ae){s.value=ae instanceof Error?ae.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const p=t.ref(null),f=t.ref(null);t.watch(()=>o.open,G=>{G?m():(p.value=null,f.value=null)},{immediate:!0});let h=null;t.watch(()=>a.revision.value,()=>{o.open&&(h&&clearTimeout(h),h=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const g=t.computed(()=>new Map(a.state.logical.entities.map(G=>[G.modelId,G]))),k=t.computed(()=>new Map(a.state.logical.associations.map(G=>[G.modelId,G]))),N=t.computed(()=>{const G=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(ae=>{var Be,Ve;return[ae.modelId,ae.packageName||((Be=ae.name)==null?void 0:Be[G])||((Ve=ae.name)==null?void 0:Ve.ko)||ae.modelId]}))});function b(G){var H,V,Pe,Ze,Ue,Le,De;const ae=k.value.get(G);if(!ae)return a.t("em.history.assocFallback");if((H=ae.description)!=null&&H.trim())return ae.description.trim();const Be=(Ze=(Pe=g.value.get((V=ae.end1)==null?void 0:V.entityRef))==null?void 0:Pe.name)==null?void 0:Ze.trim(),Ve=(De=(Le=g.value.get((Ue=ae.end2)==null?void 0:Ue.entityRef))==null?void 0:Le.name)==null?void 0:De.trim();return Be&&Ve?`${Be}→${Ve}`:a.t("em.history.assocFallback")}function _(G){var ae,Be,Ve,H;if(G.kind==="entity")return((Be=(ae=g.value.get(G.ref))==null?void 0:ae.name)==null?void 0:Be.trim())||a.t("em.attr.nameless");if(G.kind==="attribute"||G.kind==="operation"||G.kind==="index"){const V=G.entityRef?g.value.get(G.entityRef):void 0,Ze=((G.kind==="attribute"?V==null?void 0:V.attributes:G.kind==="operation"?V==null?void 0:V.operations:V==null?void 0:V.indexes)??[]).find(Le=>Le.modelId===G.ref),Ue=(Ve=V==null?void 0:V.name)==null?void 0:Ve.trim();return`${Ue?Ue+".":""}${((H=Ze==null?void 0:Ze.name)==null?void 0:H.trim())||G.ref}`}return G.kind==="association"?b(G.ref):G.kind==="associationEnd"?`${b(G.ref)}(${G.end})`:G.kind==="group"?a.t("em.history.groupSubject",{name:N.value.get(G.ref)??G.ref}):G.ref}const E={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},I={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},A=t.ref("all"),T=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],L=t.computed({get:()=>A.value,set:G=>{G&&(A.value=G)}}),x=t.computed(()=>Qr(r.value)),R=t.computed(()=>x.value.length?x.value[0].seq:null),$=t.computed(()=>A.value==="all"?x.value:x.value.filter(G=>(G.kind??"edit")===A.value)),B=t.ref(_r),O=t.ref(""),y=t.ref(""),w=t.computed(()=>!!O.value||!!y.value);function v(){O.value="",y.value=""}const M=t.computed(()=>{const G=O.value?new Date(`${O.value}T00:00:00`).getTime():null,ae=y.value?new Date(`${y.value}T23:59:59.999`).getTime():null;return G==null&&ae==null?$.value:$.value.filter(Be=>{if(Be.ts==null)return!1;const Ve=new Date(Be.ts).getTime();return!(isNaN(Ve)||G!=null&&Ve<G||ae!=null&&Ve>ae)})}),D=t.computed(()=>M.value.slice(0,B.value)),U=t.computed(()=>Math.max(0,M.value.length-B.value));function W(){B.value+=_r}t.watch([A,O,y],()=>{B.value=_r}),t.watch(()=>o.open,G=>{G&&(B.value=_r,v())});function ie(G){return G===void 0?"—":G===null?a.t("em.history.emptyValue"):typeof G=="object"?JSON.stringify(G):String(G)}function pe(G){const ae=_(G.subject);if(G.verb==="add")return a.t("em.history.summaryAdd",{name:ae});if(G.verb==="remove")return a.t("em.history.summaryRemove",{name:ae});if(G.fields.length===1){const Be=G.fields[0];return`${ae}.${Be.field} ${Be.oldValue!==void 0?ie(Be.oldValue)+"→":""}${ie(Be.value)}`}return a.t("em.history.summaryFields",{name:ae,n:G.fields.length})}function ye(G){return G.actions.length===0?a.t("em.history.noChange"):G.actions.length===1?pe(G.actions[0]):a.t("em.history.summaryMore",{summary:pe(G.actions[0]),n:G.actions.length-1})}const ge=t.ref(new Set);function me(G){const ae=new Set(ge.value);ae.has(G)?ae.delete(G):ae.add(G),ge.value=ae}function se(G){if(G==null)return"";const ae=new Date(G);return isNaN(ae.getTime())?String(G):ae.toLocaleString()}function ke(G){const ae=G.author,Be=G.origin;return ae&&Be?`${ae}(${Be})`:ae||(Be?`(${Be})`:"—")}const Se=t.computed(()=>p.value==null?null:el(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Se.value?Kc(Se.value):null,G=>i("diffChange",G));function ce(G){p.value=G,f.value=null,j.value=null}function fe(){p.value=null,f.value=null}const oe=t.computed(()=>x.value.map(G=>G.seq)),le=t.computed(()=>R.value??1/0),ue=t.computed(()=>f.value??le.value),z=t.computed(()=>f.value??le.value),P=t.computed(()=>oe.value.filter(G=>G<ue.value).map(G=>({v:G}))),F=t.computed(()=>oe.value.filter(G=>p.value!=null&&G>p.value).map(G=>({v:G})));function Q(G){G!=null&&(p.value=G,f.value!=null&&f.value<=G&&(f.value=null))}function X(G){G!=null&&(f.value=G>=le.value?null:G)}function _e(G){return G>=le.value?a.t("em.history.diff.current"):`#${G}`}function he(G){return G.kind==="entity"?g.value.has(G.ref)?G.ref:null:(G.kind==="attribute"||G.kind==="operation"||G.kind==="index")&&G.entityRef?g.value.has(G.entityRef)?G.entityRef:null:G.kind==="group"&&N.value.has(G.ref)?G.ref:null}function we(G){const ae=he(G);ae&&a.requestFocus(ae)}const Ie={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},Y={added:"add",modified:"update",removed:"remove"},j=t.ref(null),J=t.ref(!1),ve=t.computed(()=>j.value==null?null:el(r.value,{fromSeq:j.value})),Te=t.ref(!1);function K(G){j.value=G,Te.value=!1}async function te(G){J.value=!0;try{const ae=await a.restoreToSeq(G);ae.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:ae.reason??a.t("em.history.unknown")})}finally{J.value=!1,j.value=null}}return(G,ae)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Be,Ve;return[t.withDirectives(t.createElementVNode("section",KV,[t.createElementVNode("header",GV,[t.createElementVNode("div",YV,[t.createVNode(Ae,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",qV,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:ae[0]||(ae[0]=H=>u({full:!0}))},[t.createVNode(Ae,{name:"redo",size:15})],8,WV),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:ae[1]||(ae[1]=H=>i("close"))},[t.createVNode(Ae,{name:"panel-close",size:15})],8,JV)])]),t.createElementVNode("div",XV,[t.createElementVNode("label",ZV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(ee.BSSelect),{modelValue:L.value,"onUpdate:modelValue":ae[2]||(ae[2]=H=>L.value=H),items:T,"value-provider":H=>H.v,"label-provider":H=>t.unref(a).t(H.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",QV,[t.createElementVNode("span",eB,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:y.value||void 0,"onUpdate:modelValue":ae[3]||(ae[3]=H=>O.value=H)},null,8,tB),[[t.vModelText,O.value]]),ae[9]||(ae[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:O.value||void 0,"onUpdate:modelValue":ae[4]||(ae[4]=H=>y.value=H)},null,8,nB),[[t.vModelText,y.value]]),w.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:v},[t.createVNode(Ae,{name:"x",size:12})],8,oB)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",iB,[t.createElementVNode("div",aB,[t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:P.value,"value-provider":H=>H.v,"label-provider":H=>`#${H.v}`,"onUpdate:modelValue":ae[5]||(ae[5]=H=>Q(H??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ae,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":z.value,items:F.value,"value-provider":H=>H.v,"label-provider":H=>_e(H.v),"onUpdate:modelValue":ae[6]||(ae[6]=H=>X(H??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",rB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Be=Se.value)==null?void 0:Be.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:fe},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",lB,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ve=Se.value)!=null&&Ve.entries.length?(t.openBlock(),t.createElementBlock("ul",cB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value.entries,(H,V)=>(t.openBlock(),t.createElementBlock("li",{key:V,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!he(H.subject)}]),onClick:Pe=>we(H.subject)},[t.createElementVNode("div",uB,[t.createVNode(Ae,{name:E[H.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",mB,t.toDisplayString(_(H.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[H.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[H.verb])),3)]),H.fields.length?(t.openBlock(),t.createElementBlock("ul",fB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.fields,(Pe,Ze)=>(t.openBlock(),t.createElementBlock("li",{key:Ze,class:"em-history__field"},[t.createElementVNode("span",pB,t.toDisplayString(Pe.field),1),Pe.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",hB,t.toDisplayString(ie(Pe.oldValue)),1)):t.createCommentVNode("",!0),Pe.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",yB,t.toDisplayString(ie(Pe.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,dB))),128))])):(t.openBlock(),t.createElementBlock("p",sB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",gB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",bB,t.toDisplayString(s.value),1)):M.value.length===0?(t.openBlock(),t.createElementBlock("p",_B,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",kB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.value,H=>{var V,Pe,Ze;return t.openBlock(),t.createElementBlock("li",{key:H.seq,class:t.normalizeClass(["em-history__group",[`is-${H.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Ue=>me(H.seq)},[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":ge.value.has(H.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${H.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(H.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",NB,t.toDisplayString(ye(H)),1),t.createElementVNode("span",wB,"#"+t.toDisplayString(H.seq),1)],8,EB),t.createElementVNode("div",IB,[t.createElementVNode("span",vB,t.toDisplayString(ke(H)),1),H.ts?(t.openBlock(),t.createElementBlock("span",xB,t.toDisplayString(se(H.ts)),1)):t.createCommentVNode("",!0),H.kind==="restore"&&H.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",CB,"← #"+t.toDisplayString(H.restoredFromSeq),1)):t.createCommentVNode("",!0),H.seq!==R.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Ue=>ce(H.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,SB)):t.createCommentVNode("",!0)]),ge.value.has(H.seq)?(t.openBlock(),t.createElementBlock("div",RB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.actions,(Ue,Le)=>(t.openBlock(),t.createElementBlock("div",{key:Le,class:"em-history__action"},[t.createElementVNode("div",AB,[t.createVNode(Ae,{name:E[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",$B,t.toDisplayString(_(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Ue.verb}`])},t.toDisplayString(t.unref(a).t(I[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",TB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",MB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",VB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",BB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&H.seq!==R.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":j.value===H.seq}])},[j.value===H.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",DB,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((V=ve.value)!=null&&V.entries.length),onClick:ae[7]||(ae[7]=Ue=>Te.value=!Te.value)},[t.createVNode(Ae,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Te.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Pe=ve.value)!=null&&Pe.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:ve.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,OB),Te.value&&((Ze=ve.value)!=null&&Ze.entries.length)?(t.openBlock(),t.createElementBlock("ul",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value.entries,(Ue,Le)=>(t.openBlock(),t.createElementBlock("li",{key:Le,class:"em-history__diff-entry"},[t.createElementVNode("div",PB,[t.createVNode(Ae,{name:E[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",zB,t.toDisplayString(_(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[Ue.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",FB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",UB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",HB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",jB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",KB,[t.createElementVNode("span",GB,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:J.value,onClick:Ue=>te(H.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,YB),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:J.value,onClick:ae[8]||(ae[8]=Ue=>j.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,qB)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Ue=>K(H.seq)},[t.createVNode(Ae,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,WB))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&U.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:W},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:U.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function XB(e,n){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>=n?i:null}function hh(e){const n=t.ref(XB(e.storageKey,e.min)??e.initial),o=t.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=n.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),n.value=m},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(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const ZB={class:"em-modeler"},QB={class:"em-modeler__body"},eD={class:"em-drawer__inner"},tD={class:"em-drawer__head"},nD={class:"em-drawer__actions"},oD=["title"],iD=["title"],aD=["title"],rD=["title"],lD=["title"],sD=Ke(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(E){t.nextTick(()=>{const I=E();I&&("focusCollapse"in I?I.focusCollapse():I.focus())})}function c(E){n.value=E,s(()=>E?i.value:a.value)}function d(E){o.value=E,s(()=>E?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:h}=hh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:g,dragging:k,startResize:N}=hh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),b=t.ref(null),_=t.ref(null);return(E,I)=>{var A,T,L;return t.openBlock(),t.createElementBlock("div",ZB,[t.createVNode(fh,{controller:e.controller,"history-open":u.value,onExportSvg:I[0]||(I[0]=x=>{var R;return(R=b.value)==null?void 0:R.exportSvg()}),onExportPng:I[1]||(I[1]=x=>{var R;return(R=b.value)==null?void 0:R.exportPng()}),onToggleHistory:I[2]||(I[2]=x=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",QB,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",eD,[t.createElementVNode("header",tD,[I[11]||(I[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",nD,[(A=_.value)!=null&&A.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((T=_.value)!=null&&T.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:I[3]||(I[3]=x=>{var R;return(R=_.value)==null?void 0:R.toggleAll()})},[t.createVNode(Ae,{name:(L=_.value)!=null&&L.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,oD)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:I[4]||(I[4]=x=>c(!1))},[t.createVNode(Ae,{name:"panel-close",size:16})],8,iD)])]),t.createVNode(mh,{ref_key:"explorer",ref:_,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:I[5]||(I[5]=(...x)=>t.unref(h)&&t.unref(h)(...x))},null,42,aD),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:I[6]||(I[6]=x=>c(!0))},[t.createVNode(Ae,{name:"panel-open",size:18})],8,rD),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(p)-6+"px"})},[t.createVNode(uh,{ref_key:"canvas",ref:b,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(ph,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(g),resizing:t.unref(k),"start-resize":t.unref(N),onCollapse:I[7]||(I[7]=x=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:I[8]||(I[8]=x=>d(!0))},[t.createVNode(Ae,{name:"panel-right-open",size:18})],8,lD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(JB,{controller:e.controller,open:u.value,onClose:I[9]||(I[9]=x=>u.value=!1),onDiffChange:I[10]||(I[10]=x=>m.value=x)},null,8,["controller","open"])]),t.createVNode(jV,{controller:e.controller,"panel-width":t.unref(g),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=Vb,be.AssociationEdge=dp,be.CUSTOM_TYPE_VALUE=tn,be.CommandStack=tl,be.DEFAULT_JAVA_TYPE=Rr,be.DIAGRAM_JSON_FORMAT=Vr,be.DIAGRAM_JSON_VERSION=Br,be.DiagramCanvas=uh,be.DiagramExplorer=mh,be.EDITOR=no,be.EditModeToggle=UM,be.EditorToolbar=fh,be.EntityModeler=sD,be.EntityNode=Ff,be.GROUP_CODE_ENUM_VALUE=Dn,be.GroupNode=Uf,be.INHERITED_REF_PREFIX=Di,be.InvalidDiagramJsonError=Ln,be.JAVA_TYPES=qo,be.NoteNode=Hf,be.OpSyncAdapter=Dd,be.PHYSICAL_NAME_MAX_LENGTH=Jo,be.PropertyPanel=ph,be.RevCache=Bd,be.SELECTABLE_JAVA_TYPES=Qs,be.SYMBOLIC_OP_KINDS=Od,be.SYMBOLIC_OP_SCHEMA=tu,be.UI_LOCALES=tI,be.buildAgentBatch=Bb,be.buildDiagramSvg=vs,be.buildDiffMarks=Kc,be.collectSharedColumns=kn,be.commands=Fg,be.computeAutoLayout=Rs,be.createEditorController=$x,be.dedupeModelIds=hg,be.defaultMermaidDialect=Dh,be.defaultSqlDialect=py,be.diagramToJson=cc,be.displayLabel=Pi,be.emptyState=Rf,be.entityModelToDdl=lc,be.entityModelToMermaid=Ir,be.entityModelToText=Fs,be.exportDiagramPng=ch,be.exportDiagramSvg=sh,be.fromPersisted=uu,be.isGeneratable=Ic,be.isInheritedColumnRef=Mn,be.javaTypeLabel=mo,be.makeInheritedColumnRef=Ts,be.mergeDiagram=Pc,be.mermaidErToImportSource=nc,be.migrateLegacyMoney=pg,be.multiplicityLabel=Hi,be.newId=Me,be.packEntityBoxes=kr,be.parseDiagramJson=dc,be.parseInheritedColumnRef=Er,be.parseMermaidEr=tc,be.parseSqlDdl=Tr,be.planHealBackfillOps=h_,be.projectActionLog=Qr,be.projectEntityAudit=Hc,be.projectFieldAudit=En,be.projectInheritedColumns=jo,be.projectSeqDiff=el,be.renderDiagramSvg=mc,be.resolveColumnPhysicalName=Go,be.resolveDiagram=Ss,be.resolveEffectiveColumn=Vn,be.resolveQuickFix=Fr,be.resolveSharedColumn=Bn,be.resolveSymbolicOps=hb,be.restoreDeepEqual=Pn,be.scaffoldEntityJava=Fy,be.sharedColumnScopeEntities=Nr,be.sqlDdlToImportSource=rc,be.stereotypeLabel=Ko,be.synthesizeRestoreOps=Cg,be.toPersisted=m_,be.toPersistedV2=f_,be.translate=Dt,be.uiMessagesEn=gf,be.uiMessagesJa=bf,be.uiMessagesKo=_f,be.validateModel=Xi,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|